text:
template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const T1& >::result
real(const T1& X)
  {
  arma_extra_debug_sigprint();

  return X;
  }

template<typename T1>
arma_warn_unused
arma_inline
const T1&
real(const BaseCube<typename T1::pod_type, T1>& X)
  {
  arma_extra_debug_sigprint();

  return X.get_ref();
  }

template<typename T1>
arma_warn_unused
arma_inline
const T1&
real(const SpBase<typename T1::pod_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return A.get_ref();
  }

template<typename T1>
arma_warn_unused
inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_real> >::result
real(const T1& X)
  {
  arma_extra_debug_sigprint();

  return mtOp<typename T1::pod_type, T1, op_real>( X );
  }

template<typename T1>
arma_warn_unused
inline
const mtOpCube<typename T1::pod_type, T1, op_real>
real(const BaseCube<std::complex<typename T1::pod_type>, T1>& X)
  {
  arma_extra_debug_sigprint();

  return mtOpCube<typename T1::pod_type, T1, op_real>( X.get_ref() );
  }

template<typename T1>
arma_warn_unused
arma_inline
const mtSpOp<typename T1::pod_type, T1, spop_real>
real(const SpBase<std::complex<typename T1::pod_type>,T1>& A)
  {
  arma_extra_debug_sigprint();

  return mtSpOp<typename T1::pod_type, T1, spop_real>(A.get_ref());
  }

//
// imag

template<typename T1>
arma_warn_unused
inline
const Gen< Mat<typename T1::pod_type>, gen_zeros >
imag(const Base<typename T1::pod_type,T1>& X)
  {
  arma_extra_debug_sigprint();

  const Proxy<T1> A(X.get_ref());

  return Gen< Mat<typename T1::pod_type>, gen_zeros>(A.get_n_rows(), A.get_n_cols());
  }

template<typename T1>
arma_warn_unused
inline
const GenCube<typename T1::pod_type, gen_zeros>
imag(const BaseCube<typename T1::pod_type,T1>& X)
  {
  arma_extra_debug_sigprint();

  const ProxyCube<T1> A(X.get_ref());

  return GenCube<typename T1::pod_type, gen_zeros>(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
  }

template<typename T1>
arma_warn_unused
inline
SpMat<typename T1::pod_type>
imag(const SpBase<typename T1::pod_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  const SpProxy<T1> P(A.get_ref());

  return SpMat<typename T1::pod_type>(P.get_n_rows(), P.get_n_cols());
  }

template<typename T1>
arma_warn_unused
inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_imag> >::result
imag(const T1& X)
  {
  arma_extra_debug_sigprint();

  return mtOp<typename T1::pod_type, T1, op_imag>( X );
  }

template<typename T1>
arma_warn_unused
inline
const mtOpCube<typename T1::pod_type, T1, op_imag>
imag(const BaseCube<std::complex<typename T1::pod_type>,T1>& X)
  {
  arma_extra_debug_sigprint();

  return mtOpCube<typename T1::pod_type, T1, op_imag>( X.get_ref() );
  }

template<typename T1>
arma_warn_unused
arma_inline
const mtSpOp<typename T1::pod_type, T1, spop_imag>
imag(const SpBase<std::complex<typename T1::pod_type>,T1>& A)
  {
  arma_extra_debug_sigprint();

  return mtSpOp<typename T1::pod_type, T1, spop_imag>(A.get_ref());
  }

//
// log

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_log> >::result
log(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_log>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_log>
log(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_log>(A.get_ref());
  }

//
// log2

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_log2> >::result
log2(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_log2>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_log2>
log2(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_log2>(A.get_ref());
  }

//
// log10

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_log10> >::result
log10(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_log10>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_log10>
log10(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_log10>(A.get_ref());
  }

//
// log1p

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_log1p> >::result
log1p(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_log1p>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_log1p> >::result
log1p(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_log1p>(A.get_ref());
  }

//
// exp

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_exp> >::result
exp(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_exp>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_exp>
exp(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_exp>(A.get_ref());
  }

// exp2

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_exp2> >::result
exp2(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_exp2>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_exp2>
exp2(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_exp2>(A.get_ref());
  }

// exp10

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_exp10> >::result
exp10(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_exp10>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_exp10>
exp10(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_exp10>(A.get_ref());
  }

// expm1

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_expm1> >::result
expm1(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_expm1>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_expm1> >::result
expm1(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_expm1>(A.get_ref());
  }

//
// abs

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_abs> >::result
abs(const T1& X)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_abs>(X);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_abs>
abs(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();

  arma_ignore(junk);

  return eOpCube<T1, eop_abs>(X.get_ref());
  }

template<typename T1>
arma_warn_unused
inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_abs> >::result
abs(const T1& X)
  {
  arma_extra_debug_sigprint();

  return mtOp<typename T1::pod_type, T1, op_abs>(X);
  }

template<typename T1>
arma_warn_unused
inline
const mtOpCube<typename T1::pod_type, T1, op_abs>
abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();

  arma_ignore(junk);

  return mtOpCube<typename T1::pod_type, T1, op_abs>( X.get_ref() );
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_abs>
abs(const SpBase<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();
  arma_ignore(junk);

  return SpOp<T1, spop_abs>(X.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const mtSpOp<typename T1::pod_type, T1, spop_cx_abs>
abs(const SpBase< std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();
  arma_ignore(junk);

  return mtSpOp<typename T1::pod_type, T1, spop_cx_abs>(X.get_ref());
  }

//
// arg

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_arg> >::result
arg(const T1& X)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_arg>(X);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_arg>
arg(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();

  arma_ignore(junk);

  return eOpCube<T1, eop_arg>(X.get_ref());
  }

template<typename T1>
arma_warn_unused
inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::yes), const mtOp<typename T1::pod_type, T1, op_arg> >::result
arg(const T1& X)
  {
  arma_extra_debug_sigprint();

  return mtOp<typename T1::pod_type, T1, op_arg>(X);
  }

template<typename T1>
arma_warn_unused
inline
const mtOpCube<typename T1::pod_type, T1, op_arg>
arg(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();

  arma_ignore(junk);

  return mtOpCube<typename T1::pod_type, T1, op_arg>( X.get_ref() );
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_arg>
arg(const SpBase<typename T1::elem_type,T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();
  arma_ignore(junk);

  return SpOp<T1, spop_arg>(X.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const mtSpOp<typename T1::pod_type, T1, spop_cx_arg>
arg(const SpBase< std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
  {
  arma_extra_debug_sigprint();
  arma_ignore(junk);

  return mtSpOp<typename T1::pod_type, T1, spop_cx_arg>(X.get_ref());
  }

//
// square

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_square> >::result
square(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_square>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_square>
square(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_square>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_square>
square(const SpBase<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_square>(A.get_ref());
  }

//
// sqrt

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_sqrt> >::result
sqrt(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_sqrt>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_sqrt>
sqrt(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_sqrt>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_sqrt>
sqrt(const SpBase<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_sqrt>(A.get_ref());
  }

//
// conj

template<typename T1>
arma_warn_unused
arma_inline
const T1&
conj(const Base<typename T1::pod_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return A.get_ref();
  }

template<typename T1>
arma_warn_unused
arma_inline
const T1&
conj(const BaseCube<typename T1::pod_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return A.get_ref();
  }

template<typename T1>
arma_warn_unused
arma_inline
const T1&
conj(const SpBase<typename T1::pod_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return A.get_ref();
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOp<T1, eop_conj>
conj(const Base<std::complex<typename T1::pod_type>,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_conj>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_conj>
conj(const BaseCube<std::complex<typename T1::pod_type>,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_conj>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_conj>
conj(const SpBase<std::complex<typename T1::pod_type>,T1>& A)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_conj>(A.get_ref());
  }

// pow

template<typename T1>
arma_warn_unused
arma_inline
const eOp<T1, eop_pow>
pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type exponent)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_pow>(A.get_ref(), exponent);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_pow>
pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_type exponent)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_pow>(A.get_ref(), exponent);
  }

// pow, specialised handling (non-complex exponent for complex matrices)

template<typename T1>
arma_warn_unused
arma_inline
const eOp<T1, eop_pow>
pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type::value_type exponent)
  {
  arma_extra_debug_sigprint();

  typedef typename T1::elem_type eT;

  return eOp<T1, eop_pow>(A.get_ref(), eT(exponent));
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_pow>
pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_type::value_type exponent)
  {
  arma_extra_debug_sigprint();

  typedef typename T1::elem_type eT;

  return eOpCube<T1, eop_pow>(A.get_ref(), eT(exponent));
  }

//
// floor

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_floor> >::result
floor(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_floor>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_floor>
floor(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_floor>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_floor>
floor(const SpBase<typename T1::elem_type,T1>& X)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_floor>(X.get_ref());
  }

//
// ceil

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_ceil> >::result
ceil(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_ceil>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_ceil>
ceil(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_ceil>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_ceil>
ceil(const SpBase<typename T1::elem_type,T1>& X)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_ceil>(X.get_ref());
  }

//
// round

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_round> >::result
round(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_round>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_round>
round(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_round>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_round>
round(const SpBase<typename T1::elem_type,T1>& X)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_round>(X.get_ref());
  }

//
// trunc

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_trunc> >::result
trunc(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_trunc>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_trunc>
trunc(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_trunc>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_trunc>
trunc(const SpBase<typename T1::elem_type,T1>& X)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_trunc>(X.get_ref());
  }

//
// sign

template<typename eT>
arma_warn_unused
arma_inline
typename arma_scalar_only<eT>::result
sign(const eT x)
  {
  arma_extra_debug_sigprint();

  return arma_sign(x);
  }

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_sign> >::result
sign(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_sign>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
const eOpCube<T1, eop_sign>
sign(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_sign>(A.get_ref());
  }

template<typename T1>
arma_warn_unused
arma_inline
const SpOp<T1, spop_sign>
sign(const SpBase<typename T1::elem_type,T1>& X)
  {
  arma_extra_debug_sigprint();

  return SpOp<T1, spop_sign>(X.get_ref());
  }

//
// erf

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_erf> >::result
erf(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_erf>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_erf> >::result
erf(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_erf>(A.get_ref());
  }

//
// erfc

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_erfc> >::result
erfc(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_erfc>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_erfc> >::result
erfc(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_erfc>(A.get_ref());
  }

//
// lgamma

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_lgamma> >::result
lgamma(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_lgamma>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_lgamma> >::result
lgamma(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_lgamma>(A.get_ref());
  }

//
// tgamma

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< (is_arma_type<T1>::value && is_cx<typename T1::elem_type>::no), const eOp<T1, eop_tgamma> >::result
tgamma(const T1& A)
  {
  arma_extra_debug_sigprint();

  return eOp<T1, eop_tgamma>(A);
  }

template<typename T1>
arma_warn_unused
arma_inline
typename enable_if2< is_cx<typename T1::elem_type>::no, const eOpCube<T1, eop_tgamma> >::result
tgamma(const BaseCube<typename T1::elem_type,T1>& A)
  {
  arma_extra_debug_sigprint();

  return eOpCube<T1, eop_tgamma>(A.get_ref());
  }

// the functions below are currently unused; reserved for potential future use

template<typename T1> void exp_approx(const T1&) { arma_stop_logic_error("unimplemented"); }
template<typename T1> void log_approx(const T1&) { arma_stop_logic_error("unimplemented"); }
template<typename T1> void approx_exp(const T1&) { arma_stop_logic_error("unimplemented"); }
template<typename T1> void approx_log(const T1&) { arma_stop_logic_error("unimplemented"); }

//! @}


text:
#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_

#include "application_manager/hmi_language_handler.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
#include "json/json.h"
#include "resumption/last_state_wrapper.h"
#include "smart_objects/smart_object.h"
#include "utils/macro.h"

namespace application_manager {
class ApplicationManager;

class HMICapabilities {
 public:
  /**
   * @brief Class destructor
   */
  virtual ~HMICapabilities() {}

  /**
   * @brief return component which follows for correctness of
   * languages
   * @return HMI language handler
   */
  virtual HMILanguageHandler& get_hmi_language_handler() = 0;

  /**
   * @brief Checks if image type(Static/Dynamic) requested by
   * Mobile Device is supported on current HMI.
   * @param image_type received type of image from Enum.
   * @return Bool true if supported
   */
  virtual bool VerifyImageType(const int32_t image_type) const = 0;

  /**
   * @brief Checks if all HMI capabilities received
   * @return TRUE if all information received, otherwise FALSE
   */
  virtual bool is_vr_cooperating() const = 0;
  virtual void set_is_vr_cooperating(const bool value) = 0;

  virtual bool is_tts_cooperating() const = 0;
  virtual void set_is_tts_cooperating(const bool value) = 0;

  virtual bool is_ui_cooperating() const = 0;
  virtual void set_is_ui_cooperating(const bool value) = 0;

  virtual bool is_navi_cooperating() const = 0;
  virtual void set_is_navi_cooperating(const bool value) = 0;

  virtual bool is_ivi_cooperating() const = 0;
  virtual void set_is_ivi_cooperating(const bool value) = 0;

  virtual bool is_rc_cooperating() const = 0;
  virtual void set_is_rc_cooperating(const bool value) = 0;

  /**
   * @brief Interface used to store information about software version of the
   * target
   * @param ccpu_version Received system/hmi software version
   */
  virtual void set_ccpu_version(const std::string& ccpu_version) = 0;

  /**
   * @brief Returns software version of the target
   * @return string representation of software version if supported, otherwise
   * empty string
   */
  virtual const std::string& ccpu_version() const = 0;

  /**
   * @brief Interface used to store information about hardware version of the
   * target
   * @param hardware_version Received system/hmi hardware version
   */
  virtual void set_hardware_version(const std::string& hardware_version) = 0;

  /**
   * @brief Returns hardware version of the target
   * @return string representation of hardware version if supported, otherwise
   * empty string
   */
  virtual const std::string& hardware_version() const = 0;

  /**
   * @brief Retrieves if mixing audio is supported by HMI
   * (ie recording TTS command and playing audio)
   * @return Current state of the mixing audio flag
   */
  virtual bool attenuated_supported() const = 0;

  /**
   * @brief Sets state for mixing audio
   * @param state New state to be set
   */
  virtual void set_attenuated_supported(const bool state) = 0;

  /**
   * @brief Retrieves currently active UI language
   * @return Currently active UI language
   */
  virtual const hmi_apis::Common_Language::eType active_ui_language() const = 0;

  /**
   * @brief Sets currently active UI language
   * @param language Currently active UI language
   */
  virtual void set_active_ui_language(
      const hmi_apis::Common_Language::eType language) = 0;

  /**
   * @brief Retrieves UI supported languages
   * @return Currently supported UI languages
   */
  virtual const smart_objects::SmartObjectSPtr ui_supported_languages()
      const = 0;

  /**
   * @brief Sets supported UI languages
   * @param supported_languages Supported UI languages
   */
  virtual void set_ui_supported_languages(
      const smart_objects::SmartObject& supported_languages) = 0;

  /**
   * @brief Retrieves currently active VR language
   * @return Currently active VR language
   */
  virtual const hmi_apis::Common_Language::eType active_vr_language() const = 0;

  /**
   * @brief Sets currently active VR language
   * @param language Currently active VR language
   */
  virtual void set_active_vr_language(
      const hmi_apis::Common_Language::eType language) = 0;

  /**
   * @brief Retrieves VR supported languages
   * @return Currently supported VR languages
   */
  virtual const smart_objects::SmartObjectSPtr vr_supported_languages()
      const = 0;

  /**
   * @brief Sets supported VR languages
   * @param supported_languages Supported VR languages
   */
  virtual void set_vr_supported_languages(
      const smart_objects::SmartObject& supported_languages) = 0;

  /**
   * @brief Retrieves currently active TTS language
   * @return Currently active TTS language
   */
  virtual const hmi_apis::Common_Language::eType active_tts_language()
      const = 0;

  /**
   * @brief Sets currently active TTS language
   * @param language Currently active TTS language
   */
  virtual void set_active_tts_language(
      const hmi_apis::Common_Language::eType language) = 0;

  /**
   * @brief Retrieves TTS  supported languages
   * @return Currently supported TTS languages
   */
  virtual const smart_objects::SmartObjectSPtr tts_supported_languages()
      const = 0;

  /**
   * @brief Sets supported TTS languages
   * @param supported_languages Supported TTS languages
   */
  virtual void set_tts_supported_languages(
      const smart_objects::SmartObject& supported_languages) = 0;

  /**
   * @brief Retrieves information about the display capabilities
   * @return Currently supported display capabilities
   */
  virtual const smart_objects::SmartObjectSPtr display_capabilities() const = 0;

  /**
   * @brief Sets supported display capabilities
   * @param display_capabilities supported display capabilities
   */
  virtual void set_display_capabilities(
      const smart_objects::SmartObject& display_capabilities) = 0;

  /**
   * @brief Retrieves information about the display capability
   * @return Currently supported display capability
   */
  virtual const smart_objects::SmartObjectSPtr system_display_capabilities()
      const = 0;

  /**
   * @brief Sets supported display capability
   * @param display_capabilities supported display capability
   */
  virtual void set_system_display_capabilities(
      const smart_objects::SmartObject& display_capabilities) = 0;

  /**
   * @brief Retrieves information about the HMI zone capabilities
   * @return Currently supported HMI zone capabilities
   */
  virtual const smart_objects::SmartObjectSPtr hmi_zone_capabilities()
      const = 0;

  /**
   * @brief Sets supported HMI zone capabilities
   * @param hmi_zone_capabilities supported HMI zone capabilities
   */
  virtual void set_hmi_zone_capabilities(
      const smart_objects::SmartObject& hmi_zone_capabilities) = 0;

  /**
   * @brief Retrieves information about the HMI capabilities
   * @return Currently supported UI HMI capabilities
   */
  virtual const smart_objects::SmartObjectSPtr ui_hmi_capabilities() const = 0;

  /**
   * @brief Sets supported HMI capabilities
   * @param ui_hmi_capabilities supported HMI capabilities
   */
  virtual void set_ui_hmi_capabilities(
      const smart_objects::SmartObject& ui_hmi_capabilities) = 0;

  /**
   * @brief Retrieves information about the SoftButton's capabilities
   * @return Currently supported SoftButton's capabilities
   */
  virtual const smart_objects::SmartObjectSPtr soft_button_capabilities()
      const = 0;

  /**
   * @brief Sets supported SoftButton's capabilities
   * @param soft_button_capabilities supported SoftButton's capabilities
   */
  virtual void set_soft_button_capabilities(
      const smart_objects::SmartObject& soft_button_capabilities) = 0;

  /**
   * @brief Retrieves information about the Button's capabilities
   * @return Currently supported Button's capabilities
   */
  virtual const smart_objects::SmartObjectSPtr button_capabilities() const = 0;

  /**
   * @brief Sets supported Button's capabilities
   * @param button_capabilities supported Button's capabilities
   */
  virtual void set_button_capabilities(
      const smart_objects::SmartObject& button_capabilities) = 0;

  /**
   * @brief Sets supported speech capabilities
   * @param speech_capabilities supported speech capabilities
   */
  virtual void set_speech_capabilities(
      const smart_objects::SmartObject& speech_capabilities) = 0;

  /**
   * @brief Retrieves information about the speech capabilities
   * @return Currently supported speech capabilities
   */
  virtual const smart_objects::SmartObjectSPtr speech_capabilities() const = 0;

  /**
   * @brief Sets supported VR capabilities
   * @param vr_capabilities supported VR capabilities
   */
  virtual void set_vr_capabilities(
      const smart_objects::SmartObject& vr_capabilities) = 0;

  /**
   * @brief Retrieves information about the VR capabilities
   * @return Currently supported VR capabilities
   */
  virtual const smart_objects::SmartObjectSPtr vr_capabilities() const = 0;

  /**
   * @brief Sets supported audio_pass_thru capabilities
   * @param vr_capabilities supported audio_pass_thru capabilities
   */
  virtual void set_audio_pass_thru_capabilities(
      const smart_objects::SmartObject& audio_pass_thru_capabilities) = 0;

  /**
   * @brief Retrieves information about the audio_pass_thru capabilities
   * @return Currently supported audio_pass_thru capabilities
   */
  virtual const smart_objects::SmartObjectSPtr audio_pass_thru_capabilities()
      const = 0;

  /**
   * @brief Sets supported pcm_stream capabilities
   * @param supported pcm_stream capabilities
   */
  virtual void set_pcm_stream_capabilities(
      const smart_objects::SmartObject& pcm_stream_capabilities) = 0;

  /**
   * @brief Retrieves information about the pcm_stream capabilities
   * @return Currently supported pcm_streaming capabilities
   */
  virtual const smart_objects::SmartObjectSPtr pcm_stream_capabilities()
      const = 0;

  /**
   * @brief Retrieves information about the preset bank capabilities
   * @return Currently supported preset bank capabilities
   */
  virtual const smart_objects::SmartObjectSPtr preset_bank_capabilities()
      const = 0;

  /**
   * @brief Sets supported preset bank capabilities
   * @param soft_button_capabilities supported preset bank capabilities
   */
  virtual void set_preset_bank_capabilities(
      const smart_objects::SmartObject& preset_bank_capabilities) = 0;

  /**
   * @brief Sets vehicle information(make, model, modelYear)
   * @param vehicle_type vehicle information
   */
  virtual void set_vehicle_type(
      const smart_objects::SmartObject& vehicle_type) = 0;

  /**
   * @brief Retrieves vehicle information(make, model, modelYear)
   * @param vehicle_type Current vehicle information
   */
  virtual const smart_objects::SmartObjectSPtr vehicle_type() const = 0;

  /**
   * @brief Retrieves information about the prerecorded speech
   * @return Currently supported prerecorded speech
   */
  virtual const smart_objects::SmartObjectSPtr prerecorded_speech() const = 0;

  /**
   * @brief Sets supported prerecorded speech
   * @param prerecorded_speech supported prerecorded speech
   */
  virtual void set_prerecorded_speech(
      const smart_objects::SmartObject& prerecorded_speech) = 0;

  /**
   * @brief Interface used to store information if navigation
   * supported by the system
   * @param supported Indicates if navigation supported by the system
   */
  virtual void set_navigation_supported(const bool supported) = 0;

  /**
   * @brief Retrieves information if navi supported by the system
   * @return TRUE if it supported, otherwise FALSE
   */
  virtual bool navigation_supported() const = 0;

  /**
   * @brief Interface used to store information if phone call
   * supported by the system
   * @param supported Indicates if navigation supported by the sustem
   */
  virtual void set_phone_call_supported(const bool supported) = 0;

  /**
   * @brief Retrieves information if phone call supported by the system
   * @return TRUE if it supported, otherwise FALSE
   */
  virtual bool phone_call_supported() const = 0;

  /**
   * @brief Interface to store whether HMI supports video streaming
   * @param supported Indicates whether video streaming is supported by HMI
   */
  virtual void set_video_streaming_supported(const bool supported) = 0;

  /**
   * @brief Retrieves whether HMI supports video streaming
   * @return TRUE if it supported, otherwise FALSE
   */
  virtual bool video_streaming_supported() const = 0;

  /**
   * @brief Interface to store whether HMI supports remote control
   * @param supported Indicates whether video streaming is supported by HMI
   */
  virtual void set_rc_supported(const bool supported) = 0;

  /**
   * @brief Retrieves whether HMI supports remote control
   * @return TRUE if it supported, otherwise FALSE
   */
  virtual bool rc_supported() const = 0;

  /*
   * @brief Interface to store whether HMI supports driver distraction menu
   * limits
   *
   * @param supported Indicates whether driver distraction menu limits is
   * supported by HMI
   */
  virtual void set_driver_distraction_supported(const bool supported) = 0;

  /*
   * @brief Retrieves whether HMI supports driver distraction menu limits
   *
   * @return TRUE if it supported, otherwise FALSE
   */
  virtual bool driver_distraction_supported() const = 0;

  /*
   * @brief Interface used to store information regarding
   * the navigation "System Capability"
   * @param navigation_capability contains information related
   * to the navigation system capability.
   */
  virtual void set_navigation_capability(
      const smart_objects::SmartObject& navigation_capability) = 0;

  /**
   * @brief Retrieves information regarding the navigation system capability
   * @return NAVIGATION system capability
   */
  virtual const smart_objects::SmartObjectSPtr navigation_capability()
      const = 0;

  /**
   * @brief Interface used to store information regarding
   * the phone "System Capability"
   * @param phone_capability contains information related
   * to the phone system capability.
   */
  virtual void set_phone_capability(
      const smart_objects::SmartObject& phone_capability) = 0;

  /**
   * @brief Retrieves information regarding the phone call system capability
   * @return PHONE_CALL system capability
   */
  virtual const smart_objects::SmartObjectSPtr phone_capability() const = 0;

  /**
   * @brief Sets HMI's video streaming related capability information
   * @param video_streaming_capability the video streaming related capabilities
   */
  virtual void set_video_streaming_capability(
      const smart_objects::SmartObject& video_streaming_capability) = 0;

  /**
   * @brief Retrieves HMI's video streaming related capabilities
   * @return HMI's video streaming related capability information
   */
  virtual const smart_objects::SmartObjectSPtr video_streaming_capability()
      const = 0;

  /**
   * @brief Sets available RC capabilities for further usage by RC functionality
   * @param rc_capability capabilities to set
   */
  virtual void set_rc_capability(
      const smart_objects::SmartObject& rc_capability) = 0;

  /**
   * @brief Retrieves information regarding the remote control capabilities
   * @return RC capabilities
   */
  virtual const smart_objects::SmartObjectSPtr rc_capability() const = 0;

  virtual void set_driver_distraction_capability(
      const smart_objects::SmartObject& driver_distraction_capability) = 0;

  virtual const smart_objects::SmartObjectSPtr driver_distraction_capability()
      const = 0;

  /**
   * @brief Sets available SeatLocation capabilities for further usage by
   * RC functionality
   * @param seat_location_capability capabilities to set
   */
  virtual void set_seat_location_capability(
      const smart_objects::SmartObject& seat_location_capability) = 0;

  /**
   * @brief seat_location_capability Retrieves information regarding the
   * seat location capability
   * @return smart object of seat location capability
   */
  virtual const smart_objects::SmartObjectSPtr seat_location_capability()
      const = 0;

  virtual void Init(resumption::LastStateWrapperPtr last_state_wrapper) = 0;

  /**
   * @brief Trigger waiting for response
   * @param request Request object
   */
  virtual void set_handle_response_for(
      const smart_objects::SmartObject& request) = 0;

  /**
   * @brief Writes cached HMI capabilities from internal cache into the file if
   * any of updated sections are not present in the file
   * @param interface_name name of interface to be updated
   * @param sections_to_update vector of names of sections which were updated in
   * cache
   * @param schema reference to schema which should be unapplied before saving
   * stringified JSON data into the file
   * @return true if cache was saved successfully, otherwise returns false
   */
  virtual bool SaveCachedCapabilitiesToFile(
      const std::string& interface_name,
      const std::vector<std::string>& sections_to_update,
      const smart_objects::CSmartSchema& schema) = 0;

  /**
   * @brief Deletes cached HMI capabilities file from a file system
   */
  virtual bool DeleteCachedCapabilitiesFile() const = 0;

  /**
   * @brief Checks if request required for appropriate function id
   * @param function_id function ID that required request to get appropriate hmi
   * capabilities
   * @return true if request required for capabilities, otherwise false
   */
  virtual bool IsRequestsRequiredForCapabilities(
      hmi_apis::FunctionID::eType function_id) const = 0;

  /**
   * @brief Update collection of requests that should be send to
   * the HMI to get required HMI capabilities
   * @param requested_interface function id
   */
  virtual void UpdateRequestsRequiredForCapabilities(
      hmi_apis::FunctionID::eType requested_interface) = 0;

  /**
   * @brief Interface that update capabilities depending on ccpu_version
   * @param ccpu_version Received system/hmi software version
   */
  virtual void OnSoftwareVersionReceived(const std::string& ccpu_version) = 0;

  /**
   * @brief Interface that update cached hmi capabilities
   */
  virtual void UpdateCachedCapabilities() = 0;
};

}  //  namespace application_manager

#endif  // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_

redpajama_set_name: RedPajamaGithub


text:
from __future__ import division
import dill as pickle
from collections import defaultdict

import datetime
import time

import xxhash
from bokeh.embed import components

from src.common.database import Database
from src.engine import EngineConstants
from src.engine.EngineConstants import EngineUtils
from src.engine.corpusprocessing.CorpusHandler import CorpusHandler
from src.engine.naturallanguageprocessing.LexiconBasedSA import LexiconBasedSentimentAnalyser

from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
import collections
import numpy as np
from nltk.stem.wordnet import WordNetLemmatizer
from bokeh.layouts import column
from bokeh.plotting import figure

DATABASE = Database()
EU = EngineUtils()

__author__ = 'abilgin'

class ModelVisualiser:

    def __init__(self, experiment, keyword, num_neighbours):

        self.experiment = experiment
        self.keyword = keyword
        self.number_of_neighbours = int(num_neighbours)

        self.bins = sorted(self.experiment.existing_models.keys())

        self.neighbours = set()
        self.neighbours_per_bin = {}
        self.neighbours_per_bin_with_score = {}

        self.keyword_vector_per_bin = {}

        timestr = time.strftime("%Y%m%d-%H%M%S")
        self.logger = EU.setup_logger(__name__, EngineConstants.EXP_LOG_PATH + self.experiment._id + timestr + '.log')

        self.keyword_error = EngineConstants.NO_KEYERR
        self._analyseVSModelSimilarity()

    def _analyseVSModelSimilarity(self):

        count_error = 0

        for bin in self.bins:
            # initialise the data structures
            self.neighbours_per_bin[bin] = set()
            self.neighbours_per_bin_with_score[bin] = []

            # Load a model from db
            pickled_model = DATABASE.getGridFS().get(self.experiment.existing_models[bin]).read()
            model = pickle.loads(pickled_model)

            # get the word vector of the keyword for bin
            keyword_bin_id = self.keyword + "(" + str(bin) + ")"
            if keyword_bin_id not in self.keyword_vector_per_bin.keys():
                try:
                    self.keyword_vector_per_bin[keyword_bin_id] = model.wv[self.keyword]
                except:
                    count_error += 1
                    self.logger.error(str(bin) + ": Vector could not be retrieved for " + self.keyword)

            # get the nearest neighours for keyword
            if self.number_of_neighbours > 0:
                similar_neighbours = self._queryModelForKeyword(model)
                if len(similar_neighbours) > 0:
                    for similar_word in similar_neighbours:
                        try:
                            self.neighbours_per_bin[bin].add(similar_word[0])
                            self.neighbours_per_bin_with_score[bin].append(similar_word)
                        except:
                            self.logger.error("Similarity analysis error for " + self.keyword + " in " + bin)

                        self.neighbours.add(similar_word[0])

        if count_error == len(self.bins):
            self.keyword_error = EngineConstants.ALL_KEYERR
        elif count_error > 0:
            self.keyword_error = EngineConstants.PARTIAL_KEYERR

    def _queryModelForKeyword(self, model):

        word_list= []
        lem = WordNetLemmatizer()
        try:
            word_list_raw = model.wv.most_similar(positive = [self.keyword], negative = [], topn = self.number_of_neighbours)

            for word in word_list_raw:
                if not set('[~!@#$%^&*()_+{}":;\'`]+$').intersection(str(word[0])):
                    word_lem = lem.lemmatize(str(word[0]))
                    if word_lem not in word_list:
                        word_list.append([word_lem, word[1]])

            words = [str(v[0]) for v in word_list]

            if not words:
                self.logger.info('Keyword ' + self.keyword + ' not found with cosine!')
            else:
                self.logger.info("Most similar words: " + ",".join(words))
        except Exception as e:
            self.logger.exception(e)

        # TODO: Return the agreement set of the different similarity measures
        return word_list

    def distanceBasedAspectVisualisation(self, aspect_words):
        modern_model = self._retrieveMostRecentModel()
        return self._drawSimilarityDistancePlot(modern_model, aspect_words)

    def _retrieveMostRecentModel(self):
        # the most recent model should be the last one
        final_existing_bin = self.bins[-1]
        pickled_model = DATABASE.getGridFS().get(self.experiment.existing_models[final_existing_bin]).read()
        recent_model = pickle.loads(pickled_model)
        return recent_model

    def _drawSimilarityDistancePlot(self, modern_model, aspect_words):

        s = []
        words_not_found = []
        # sort the bins
        self.neighbours_per_bin = collections.OrderedDict(sorted(self.neighbours_per_bin.items()))
        # for each aspect word
        for aspect in aspect_words:
            mean_scores_of_neighbours_per_bin = {}
            similarity_scores_of_keyword_per_bin = {}
            for bin in self.bins:
                similarity_scores_of_keyword_per_bin[bin], display_key_label = self._calculateBinSimilarityWithAspect(modern_model, bin, aspect)
                bin_total = 0
                for neighbour in self.neighbours_per_bin[bin]:
                    # retrieve similarity with sentiment and take average
                    try:
                        bin_total += float(modern_model.wv.similarity(neighbour, aspect))
                    except:
                        bin_total += 0

                if len(self.neighbours_per_bin[bin]) > 0:
                    mean_scores_of_neighbours_per_bin[bin] = bin_total / float(len(self.neighbours_per_bin[bin]))
                else:
                    mean_scores_of_neighbours_per_bin[bin] = 0

            if np.any(np.array(similarity_scores_of_keyword_per_bin.values())) or np.any(np.array(similarity_scores_of_keyword_per_bin.values())):

                similarity_scores_of_keyword_per_bin = collections.OrderedDict(sorted(similarity_scores_of_keyword_per_bin.items()))
                key_sims = np.array(similarity_scores_of_keyword_per_bin.values())

                mean_scores_of_neighbours_per_bin = collections.OrderedDict(sorted(mean_scores_of_neighbours_per_bin.items()))
                means = np.array(mean_scores_of_neighbours_per_bin.values())

                fig = figure(x_range=self.bins, width=800, plot_height=300, title="'" + aspect + "'")

                fig.xaxis.axis_label = "Time Intervals"
                fig.yaxis.axis_label = "Similarity"
                fig.yaxis.major_label_orientation = "vertical"
                fig.yaxis.bounds = [0,1]

                fig.axis.minor_tick_in = -3
                fig.axis.axis_line_width = 3

                fig.line(self.bins, key_sims.tolist(), legend=self.keyword, line_color="firebrick", line_width=4)
                fig.line(self.bins, means.tolist(), legend="Mean of neighbours", line_color="navy", line_width=4, line_dash=[4, 4])
                fig.legend.background_fill_alpha = 0.5

                s.append(fig)

            else:
                words_not_found.append(aspect)

        # put all the plots in a column
        list = [s[i] for i in range(0, len(s))]
        p = column(list)

        script, div = components(p)
        return script, div, words_not_found

    def _calculateBinSimilarityWithAspect(self, model, bin, aspect):

        for key_bin_id in self.keyword_vector_per_bin.keys():
            if bin in key_bin_id:
                vec_key = self.keyword_vector_per_bin[key_bin_id]
                try:
                    return np.dot(vec_key, model.wv[aspect])/(np.linalg.norm(vec_key)* np.linalg.norm(model.wv[aspect])), key_bin_id
                except:
                    return 0, ""

        return 0, ""

    def timeTrackingVisualisation(self, aspects, algorithm, tsne_perp, tsne_iter):
        modern_model = self._retrieveMostRecentModel()
        return self._drawTrackingPlot(modern_model, aspects, algorithm, tsne_perp, tsne_iter)

    def _drawTrackingPlot(self, modern_model, aspects, algorithm, tsne_perp, tsne_iter):
        # Prepare figure
        fig = figure(width=1200, plot_height=600, title="Semantic time travel of '" + self.keyword + "' using " + algorithm)

        if self.neighbours:
            # find the union of keyword's k nearest neighbours over all time points
            surrounding_words = filter(bool, self.neighbours)

            if aspects:
                surrounding_words.extend(aspects)

            embeddings = self._getEmbeddingsFromModelForWords(modern_model, surrounding_words)

            for key, value in self.keyword_vector_per_bin.items():
                embeddings[key] = value

            vectors = embeddings.values()
            words = embeddings.keys()

            if algorithm == "pca":
                pca = PCA(n_components=2, whiten=True)
                vectors2d = pca.fit(vectors).transform(vectors)
            else:
                # perplexity ranges from 20 to 50
                tsne = TSNE(perplexity=tsne_perp, n_components=2, init='pca', n_iter=tsne_iter, method='exact')
                vectors2d = tsne.fit_transform(vectors)

            bin_keyword_vectors_x = []
            bin_keyword_vectors_y = []
            bin_words = []

            default_neighbour_vectors_x = []
            default_neighbour_vectors_y = []
            default_neighbour_words = []

            aspect_vectors_x = []
            aspect_vectors_y = []
            aspect_words = []

            for point, word in zip(vectors2d, words):
                # categorise points
                if "(" in word:
                    bin_keyword_vectors_x.append(point[0])
                    bin_keyword_vectors_y.append(point[1])
                    bin_words.append(word)
                elif word in aspects:
                    aspect_vectors_x.append(point[0])
                    aspect_vectors_y.append(point[1])
                    aspect_words.append(word)
                else:
                    default_neighbour_vectors_x.append(point[0])
                    default_neighbour_vectors_y.append(point[1])
                    default_neighbour_words.append(word)

            fig.circle(default_neighbour_vectors_x, default_neighbour_vectors_y,
                      line_color="black", fill_color="blue", fill_alpha=0.5, size=10)
            fig.text(default_neighbour_vectors_x, default_neighbour_vectors_y, default_neighbour_words, text_font_size="10pt")

            fig.square(aspect_vectors_x, aspect_vectors_y,
                       line_color="black", fill_color="black", fill_alpha=0.5, size=15)
            fig.text(aspect_vectors_x, aspect_vectors_y, aspect_words, text_font_size="15pt")

            fig.triangle(bin_keyword_vectors_x, bin_keyword_vectors_y,
                       line_color="black", fill_color="red", fill_alpha=0.5, size=12)
            fig.text(bin_keyword_vectors_x, bin_keyword_vectors_y, bin_words, text_font_size="12pt")

        script, div = components(fig)
        return script, div

    def _getEmbeddingsFromModelForWords(self, model, word_list):

        similar_embeddings = {}

        for word in word_list:
            try:
                similar_embeddings[word] = model.wv[word]
            except:
                self.logger.info(word + " not found in model.")

        return similar_embeddings

    def sentimentVisualisation(self, lexicon, requested_corpus_list):

        if not requested_corpus_list:
            requested_corpus_list = self.experiment.corpus_list
        # check for existing keyword and corpus
        missing_corpora = []
        for corpus in requested_corpus_list:
            res = DATABASE.find_one(EngineConstants.SELECTED_SENTENCES_COLLECTION, {'exp_id': self.experiment._id, 'keyword': self.keyword,
                                                             'num_neighbours': self.number_of_neighbours, 'source':corpus})
            if not res:
                missing_corpora.append(corpus)

        if len(missing_corpora) > 0:
            ch = CorpusHandler(self.experiment, self.keyword, self.neighbours_per_bin)
            selected_sentences = ch.selectSentencesForSentimentAnalysis(missing_corpora)
            self._uploadToDB(selected_sentences)
        sentiment_analyser = LexiconBasedSentimentAnalyser(self.experiment._id, self.keyword, self.number_of_neighbours)
        sentiment_analyser.fromDBRunAnalysis()

        return self._drawSentimentEvolutionPlot(lexicon, requested_corpus_list)

    def _uploadToDB(self, selected_sentences):
        for corpus in selected_sentences.keys():
            for time in selected_sentences[corpus].keys():
                for genre in selected_sentences[corpus][time].keys():
                    text = ". ".join(selected_sentences[corpus][time][genre]).encode('utf-8')
                    texthash = xxhash.xxh64(text).hexdigest()
                    DATABASE.update(EngineConstants.SELECTED_SENTENCES_COLLECTION, {'texthash': texthash},
                                    {'date': time, 'source': corpus, 'genre': genre, 'exp_id': self.experiment._id,
                                     'keyword' : self.keyword, 'num_neighbours' : self.number_of_neighbours,
                                     'original_text': text, 'texthash': texthash, 'sentiment': {}, 'sentence_polarities': {}})

    def _drawSentimentEvolutionPlot(self, lexicon, corpus_list):

        data = self._get_plotdata(lexicon, corpus_list)

        if not len(data):
            self.keyword_error = EngineConstants.NO_DATA

        fig = figure(width=1200, plot_height=600, title="Sentiment analysis of '" + self.keyword + "' using " + lexicon + " within " + ', '.join(corpus_list))
        fig.square(data.keys(), data.values(), line_color="black", fill_color="blue", fill_alpha=0.5, size=10)

        fig.xaxis.axis_label = "Time"
        fig.yaxis.axis_label = "Sentiment Orientation"
        fig.axis.minor_tick_in = -3
        fig.axis.axis_line_width = 3

        script, div = components(fig)
        return script, div

    def _get_plotdata(self, lexicon, corpus_list):

        sentiment_per_timestamp = defaultdict(list)
        no_date_counter = 0
        use_dates = False

        for corpus in corpus_list:
            for doc in DATABASE.iter_collection(EngineConstants.SELECTED_SENTENCES_COLLECTION, {'exp_id': self.experiment._id,
                                                                             'num_neighbours': self.number_of_neighbours,
                                                                             'keyword': self.keyword, 'source': corpus,
                                                                             'sentiment.' + lexicon: {'$exists': True}}):
                if "date" in doc and doc['date']:
                    use_dates = True
                    if isinstance(doc['date'], int):
                        date = doc['date']
                    elif not isinstance(doc['date'], datetime.datetime):
                        date = int(doc['date'][:4])
                    else:
                        date = doc['date'].year
                elif doc['sentiment'] and not use_dates:
                    date = no_date_counter
                    no_date_counter += 1

                sentiment_per_timestamp[date].append(doc['sentiment'][lexicon])

        for time, sent_group in sentiment_per_timestamp.items():
            if len(sent_group) > 1:
                # take the average of genres
                genre_sum = 0
                for sent_genre in sent_group:
                    genre_sum += sent_genre
                average_sent = genre_sum / len(sent_group)
                sentiment_per_timestamp[time] = [average_sent]

        if use_dates:
            for date in range(min(sentiment_per_timestamp.keys()), max(sentiment_per_timestamp.keys())):
                if not date in sentiment_per_timestamp:
                    sentiment_per_timestamp[date] = []

        data = collections.OrderedDict(sorted(sentiment_per_timestamp.items(), key=lambda t: t[0]))
        return data

    def getKeywordErrorStatus(self):
        return self.keyword_error

    def getSimilarKeywordsPerBin(self):
        return self.neighbours_per_bin


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/monitoring/v3/alert.proto

namespace Google\Cloud\Monitoring\V3\AlertPolicy\Condition;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A condition type that checks whether a log message in the [scoping
 * project](https://cloud.google.com/monitoring/api/v3#project_name)
 * satisfies the given filter. Logs from other projects in the metrics
 * scope are not evaluated.
 *
 * Generated from protobuf message google.monitoring.v3.AlertPolicy.Condition.LogMatch
 */
class LogMatch extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. A logs-based filter. See [Advanced Logs
     * Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
     * for how this filter should be constructed.
     *
     * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED];
     */
    private $filter = '';
    /**
     * Optional. A map from a label key to an extractor expression, which is
     * used to extract the value for this label key. Each entry in this map is
     * a specification for how data should be extracted from log entries that
     * match `filter`. Each combination of extracted values is treated as a
     * separate rule for the purposes of triggering notifications. Label keys
     * and corresponding values can be used in notifications generated by this
     * condition.
     * Please see [the documentation on logs-based metric
     * `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
     * for syntax and examples.
     *
     * Generated from protobuf field map<string, string> label_extractors = 2;
     */
    private $label_extractors;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $filter
     *           Required. A logs-based filter. See [Advanced Logs
     *           Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
     *           for how this filter should be constructed.
     *     @type array|\Google\Protobuf\Internal\MapField $label_extractors
     *           Optional. A map from a label key to an extractor expression, which is
     *           used to extract the value for this label key. Each entry in this map is
     *           a specification for how data should be extracted from log entries that
     *           match `filter`. Each combination of extracted values is treated as a
     *           separate rule for the purposes of triggering notifications. Label keys
     *           and corresponding values can be used in notifications generated by this
     *           condition.
     *           Please see [the documentation on logs-based metric
     *           `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
     *           for syntax and examples.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Monitoring\V3\Alert::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. A logs-based filter. See [Advanced Logs
     * Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
     * for how this filter should be constructed.
     *
     * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED];
     * @return string
     */
    public function getFilter()
    {
        return $this->filter;
    }

    /**
     * Required. A logs-based filter. See [Advanced Logs
     * Queries](https://cloud.google.com/logging/docs/view/advanced-queries)
     * for how this filter should be constructed.
     *
     * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED];
     * @param string $var
     * @return $this
     */
    public function setFilter($var)
    {
        GPBUtil::checkString($var, True);
        $this->filter = $var;

        return $this;
    }

    /**
     * Optional. A map from a label key to an extractor expression, which is
     * used to extract the value for this label key. Each entry in this map is
     * a specification for how data should be extracted from log entries that
     * match `filter`. Each combination of extracted values is treated as a
     * separate rule for the purposes of triggering notifications. Label keys
     * and corresponding values can be used in notifications generated by this
     * condition.
     * Please see [the documentation on logs-based metric
     * `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
     * for syntax and examples.
     *
     * Generated from protobuf field map<string, string> label_extractors = 2;
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getLabelExtractors()
    {
        return $this->label_extractors;
    }

    /**
     * Optional. A map from a label key to an extractor expression, which is
     * used to extract the value for this label key. Each entry in this map is
     * a specification for how data should be extracted from log entries that
     * match `filter`. Each combination of extracted values is treated as a
     * separate rule for the purposes of triggering notifications. Label keys
     * and corresponding values can be used in notifications generated by this
     * condition.
     * Please see [the documentation on logs-based metric
     * `valueExtractor`s](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
     * for syntax and examples.
     *
     * Generated from protobuf field map<string, string> label_extractors = 2;
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setLabelExtractors($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->label_extractors = $arr;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(LogMatch::class, \Google\Cloud\Monitoring\V3\AlertPolicy_Condition_LogMatch::class);


text:
'use strict';

module.exports = function(sequelize) {

  var Conversation = sequelize.define('Conversation', {},
  {
    classMethods: {
      associate: function(models) {
        Conversation.belongsTo(models.Course);
        Conversation.belongsTo(models.User, { as: 'UserOne' });
        Conversation.belongsTo(models.User, { as: 'UserTwo' });
        Conversation.hasMany(models.Message, { onDelete: 'cascade' });
      }
    }
  });

  return Conversation;

};


text:
<head>
  <script src="/public/jquery-1.11.3.min.js"></script>

  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Language" content="fa">
      <meta name="Language" content="Farsi">

  <!-- Enable responsiveness on mobile devices-->
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>
    {% if page.title == "Home" %}
      {{ site.title }} · {{ site.tagline }}
    {% else if post.language == 'Persian' %}
      {{ page.title-persian }} · {{ site.title }}
    {% else %}
    {% endif %}
  </title>

  <!-- CSS -->
  <link rel="stylesheet" href="{{ site.baseurl }}/public/css/poole.css">
  <link rel="stylesheet" href="{{ site.baseurl }}/public/css/syntax.css">
  <link rel="stylesheet" href="{{ site.baseurl }}/public/css/lanyon.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400">

  <!-- Icons -->
  <link rel="apple-touch-icon" sizes="57x57" href="/Icon/apple-icon-57x57.png">
  <link rel="apple-touch-icon" sizes="60x60" href="/Icon/apple-icon-60x60.png">
  <link rel="apple-touch-icon" sizes="72x72" href="/Icon/apple-icon-72x72.png">
  <link rel="apple-touch-icon" sizes="76x76" href="/Icon/apple-icon-76x76.png">
  <link rel="apple-touch-icon" sizes="114x114" href="/Icon/apple-icon-114x114.png">
  <link rel="apple-touch-icon" sizes="120x120" href="/Icon/apple-icon-120x120.png">
  <link rel="apple-touch-icon" sizes="144x144" href="/Icon/apple-icon-144x144.png">
  <link rel="apple-touch-icon" sizes="152x152" href="/Icon/apple-icon-152x152.png">
  <link rel="apple-touch-icon" sizes="180x180" href="/Icon/apple-icon-180x180.png">
  <link rel="icon" type="image/png" sizes="192x192"  href="/Icon/android-icon-192x192.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/Icon/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="96x96" href="/Icon/favicon-96x96.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/Icon/favicon-16x16.png">
  <link rel="manifest" href="/Icon/manifest.json">
  <meta name="msapplication-TileColor" content="#ffffff">
  <meta name="msapplication-TileImage" content="/Icon/ms-icon-144x144.png">
  <meta name="theme-color" content="#ffffff">

  <!-- RSS -->
  <link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">
</head>


text:
package com.studerw.activiti.user;

/**
 * Exception used to explicitly tag failures due to invalid user permissions
 * (i.e. attempts at reading, updating objects without proper permission, etc).
 * WorkflowUser: Bill Studer
 * Date: 2/28/14
 */
public class InvalidAccessException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    public InvalidAccessException(String message) {
        super(message);
    }

    public InvalidAccessException(String message, Throwable t) {
        super(message, t);
    }

}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Forms.Sale;

import Classes.Client;
import Classes.Sale;
import Classes.Vehicle;
import Forms.Login;
import Forms.MainView;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author jourdanrodrigues
 */
public final class CloseSale extends javax.swing.JFrame {
    String userName;
    int isManager, employeeId;

    /**
     * Creates new form SellRegister
     */
    public CloseSale() {
        initComponents();
    }

    public CloseSale(String userName, int isManager, int employeeId){
        this.userName = userName;
        this.isManager = isManager;
        this.employeeId = employeeId;

        initComponents();

        UserNameLabel.setText(userName + ".");

        PaymentFormComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Crédito", "Débito", "À vista", "Financiamento", "Consórcio" }));

        listClients();
        listVehicles();

        ClientTextField.getDocument().addDocumentListener(new DocumentListener() {

            @Override
            public void changedUpdate(DocumentEvent e) {
                listClients();
            }

            @Override
            public void insertUpdate(DocumentEvent e) {
                listClients();
            }

            @Override
            public void removeUpdate(DocumentEvent e) {
                listClients();
            }
        });

        VehicleTextField.getDocument().addDocumentListener(new DocumentListener() {

            @Override
            public void changedUpdate(DocumentEvent e) {
                listVehicles();
            }

            @Override
            public void insertUpdate(DocumentEvent e) {
                listVehicles();
            }

            @Override
            public void removeUpdate(DocumentEvent e) {
                listVehicles();
            }
        });
    }

    public void listClients(){
        try {
            Client.getClientList(ClientTextField.getText(), (DefaultTableModel) ClientsList.getModel());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Ocorreu o seguinte erro:\n" + ex.getMessage());
        }
    }

    public void listVehicles(){
        try {
            Vehicle.getVehicleList(VehicleTextField.getText(), (DefaultTableModel) VehiclesList.getModel());
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Ocorreu o seguinte erro:\n" + ex.getMessage());
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        UserNameLabel = new javax.swing.JLabel();
        BackButton = new javax.swing.JButton();
        TopLabel = new javax.swing.JLabel();
        CloseSaleButton = new javax.swing.JButton();
        PaymentFormLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        VehiclesList = new javax.swing.JTable();
        LogoutButton = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        ClientsList = new javax.swing.JTable();
        PaymentFormComboBox = new javax.swing.JComboBox<>();
        ClientSearchLabel = new javax.swing.JLabel();
        VehicleSearchLabel = new javax.swing.JLabel();
        VehicleTextField = new javax.swing.JTextField();
        ClientTextField = new javax.swing.JTextField();
        AdditionalServicesLabel = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        AdditionalServicesTextArea = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        UserNameLabel.setFont(new java.awt.Font("Ubuntu", 0, 11)); // NOI18N
        UserNameLabel.setText("Não conseguimos obter seu nome.");

        BackButton.setText("Voltar");
        BackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BackButtonActionPerformed(evt);
            }
        });

        TopLabel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        TopLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        TopLabel.setText("Fechamento de Venda");

        CloseSaleButton.setText("FECHAR DE VENDA");
        CloseSaleButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CloseSaleButtonActionPerformed(evt);
            }
        });

        PaymentFormLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        PaymentFormLabel.setText("FORMA DE PAGAMENTO");

        VehiclesList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "ID", "MODELO", "COR", "CHASSI", "PREÇO"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(VehiclesList);

        LogoutButton.setFont(new java.awt.Font("Ubuntu", 0, 11)); // NOI18N
        LogoutButton.setText("Logout");
        LogoutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LogoutButtonActionPerformed(evt);
            }
        });

        ClientsList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "ID", "NOME"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(ClientsList);
        if (ClientsList.getColumnModel().getColumnCount() > 0) {
            ClientsList.getColumnModel().getColumn(0).setPreferredWidth(15);
        }

        PaymentFormComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        PaymentFormComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PaymentFormComboBoxActionPerformed(evt);
            }
        });

        ClientSearchLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        ClientSearchLabel.setText("CLIENTE");

        VehicleSearchLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        VehicleSearchLabel.setText("SELECIONE O VEÍCULO (MODELO / CHASSI)");

        AdditionalServicesLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        AdditionalServicesLabel.setText("SERVIÇOS ADICIONAIS");

        AdditionalServicesTextArea.setColumns(20);
        AdditionalServicesTextArea.setRows(5);
        jScrollPane3.setViewportView(AdditionalServicesTextArea);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(BackButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(UserNameLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(LogoutButton))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(49, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(VehicleSearchLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(VehicleTextField))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(TopLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 490, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(ClientSearchLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(ClientTextField))
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 323, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(PaymentFormComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(PaymentFormLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(AdditionalServicesLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addComponent(jScrollPane1)
                    .addComponent(CloseSaleButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(BackButton)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(LogoutButton)
                        .addComponent(UserNameLabel)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                .addComponent(TopLabel)
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ClientSearchLabel)
                            .addComponent(ClientTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(PaymentFormLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(PaymentFormComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(AdditionalServicesLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(VehicleSearchLabel)
                    .addComponent(VehicleTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(CloseSaleButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(24, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackButtonActionPerformed
        new MainView(this.userName, this.isManager, this.employeeId).setVisible(true);
        dispose();
    }//GEN-LAST:event_BackButtonActionPerformed

    private void CloseSaleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CloseSaleButtonActionPerformed

        try {
            Map<String, String> map = new HashMap<>();

            map.put("paymentForm", PaymentFormComboBox.getSelectedItem().toString());
            map.put("additionalServices", AdditionalServicesTextArea.getText());
            map.put("employeeId", String.valueOf(this.employeeId));

            try {
                map.put("vehicleId", (String) VehiclesList.getModel().getValueAt(VehiclesList.getSelectedRow(), 0));
            }
            catch (ArrayIndexOutOfBoundsException ex) {
                JOptionPane.showMessageDialog(null, "Selecione um veículo!");
                return;
            }

            try {
                map.put("clientId", (String) ClientsList.getModel().getValueAt(ClientsList.getSelectedRow(), 0));
            }
            catch (ArrayIndexOutOfBoundsException ex) {
                JOptionPane.showMessageDialog(null, "Selecione um cliente!");
                return;
            }

            new ChoosePromotion(this.userName, this.isManager, this.employeeId, map).setVisible(true);
            dispose();
        }
        catch (IllegalArgumentException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
    }//GEN-LAST:event_CloseSaleButtonActionPerformed

    private void LogoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LogoutButtonActionPerformed
        new Login().setVisible(true);
        dispose();
    }//GEN-LAST:event_LogoutButtonActionPerformed

    private void PaymentFormComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PaymentFormComboBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_PaymentFormComboBoxActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CloseSale.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CloseSale.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CloseSale.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CloseSale.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CloseSale().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel AdditionalServicesLabel;
    private javax.swing.JTextArea AdditionalServicesTextArea;
    private javax.swing.JButton BackButton;
    private javax.swing.JLabel ClientSearchLabel;
    private javax.swing.JTextField ClientTextField;
    private javax.swing.JTable ClientsList;
    private javax.swing.JButton CloseSaleButton;
    private javax.swing.JButton LogoutButton;
    private javax.swing.JComboBox<String> PaymentFormComboBox;
    private javax.swing.JLabel PaymentFormLabel;
    private javax.swing.JLabel TopLabel;
    private javax.swing.JLabel UserNameLabel;
    private javax.swing.JLabel VehicleSearchLabel;
    private javax.swing.JTextField VehicleTextField;
    private javax.swing.JTable VehiclesList;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    // End of variables declaration//GEN-END:variables
}


text:
ifdef BOOTSTRAP
EGEN=$(BOOTSTRAP_TOP)/lib/stdlib/egen
EBIN=$(BOOTSTRAP_TOP)/lib/stdlib/ebin
endif

include $(ERL_TOP)/make/target.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk

# ----------------------------------------------------
# Application version
# ----------------------------------------------------
include ../vsn.mk
VSN=$(STDLIB_VSN)

# ----------------------------------------------------
# Release directory specification
# ----------------------------------------------------
RELSYSDIR = $(RELEASE_PATH)/lib/stdlib-$(VSN)

# ----------------------------------------------------
# Target Specs
# ----------------------------------------------------
MODULES= \
	array \
	base64 \
	beam_lib \
	binary \
	c \
	calendar \
	dets \
	dets_server \
	dets_sup \
	dets_utils \
	dets_v9 \
	dict \
	digraph \
	digraph_utils \
	edlin \
	edlin_expand \
	epp \
	erl_abstract_code \
	erl_anno \
	erl_bits \
	erl_compile \
	erl_error \
	erl_eval \
	erl_expand_records \
	erl_features \
	erl_internal \
	erl_lint \
	erl_parse \
	erl_posix_msg \
	erl_pp \
	erl_scan \
	erl_stdlib_errors \
	erl_tar \
	error_logger_file_h \
	error_logger_tty_h \
	escript \
	ets \
	eval_bits \
	file_sorter \
	filelib \
	filename \
	gb_trees \
	gb_sets \
	gen \
	gen_event \
	gen_fsm \
	gen_server \
	gen_statem \
	io \
	io_lib \
	io_lib_format \
	io_lib_fread \
	io_lib_pretty \
	lists \
	log_mf_h \
	maps \
	math \
	ms_transform \
	otp_internal \
	orddict \
	ordsets \
	re \
	peer \
	pool \
	proc_lib \
	proplists \
	qlc \
	qlc_pt \
	queue \
	rand \
	random \
	sets \
	shell \
	shell_default \
	shell_docs \
	slave \
	sofs \
	string \
	supervisor \
	supervisor_bridge \
	sys \
	timer \
	unicode \
	unicode_util \
	uri_string \
	win32reg \
	zip

HRL_FILES= \
	../include/assert.hrl \
	../include/erl_compile.hrl \
	../include/erl_bits.hrl \
	../include/ms_transform.hrl \
	../include/qlc.hrl \
	../include/zip.hrl

INTERNAL_HRL_FILES= dets.hrl erl_tar.hrl otp_internal.hrl

ERL_FILES= $(MODULES:%=%.erl)

TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET)

APP_FILE= stdlib.app

APP_SRC= $(APP_FILE).src
APP_TARGET= $(EBIN)/$(APP_FILE)

APPUP_FILE= stdlib.appup

APPUP_SRC= $(APPUP_FILE).src
APPUP_TARGET= $(EBIN)/$(APPUP_FILE)

ifeq ($(TARGET),win32)
  EXE_SUFFIX=.exe
else
  EXE_SUFFIX=
endif

# ----------------------------------------------------
# FLAGS
# ----------------------------------------------------

ERL_COMPILE_FLAGS += -Werror
ERL_COMPILE_FLAGS += -I../include -I../../kernel/include

ifeq ($(ERL_DETERMINISTIC),yes)
	DETERMINISM_FLAG = +deterministic
else
	DETERMINISM_FLAG =
endif

# ----------------------------------------------------
# Targets
# ----------------------------------------------------

$(TYPES): $(TARGET_FILES)

clean:
	rm -f $(TARGET_FILES)
	rm -f core
	rm -f erl_parse.erl

docs:

# This is a trick so that the preloaded files will get the correct type
# specifications.
primary_bootstrap_compiler: \
  $(BOOTSTRAP_COMPILER)/ebin/epp.beam \
  $(BOOTSTRAP_COMPILER)/ebin/erl_anno.beam \
  $(BOOTSTRAP_COMPILER)/ebin/erl_error.beam \
  $(BOOTSTRAP_COMPILER)/ebin/erl_features.beam \
  $(BOOTSTRAP_COMPILER)/ebin/erl_scan.beam \
  $(BOOTSTRAP_COMPILER)/ebin/erl_parse.beam \
  $(BOOTSTRAP_COMPILER)/ebin/erl_lint.beam \
  $(BOOTSTRAP_COMPILER)/ebin/io.beam \
  $(BOOTSTRAP_COMPILER)/ebin/otp_internal.beam \
  $(BOOTSTRAP_COMPILER)/ebin/erl_internal.beam

$(BOOTSTRAP_COMPILER)/ebin/erl_parse.beam: erl_parse.yrl
	$(gen_verbose)
	$(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/egen $(DETERMINISM_FLAG) erl_parse.yrl
	$(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $(DETERMINISM_FLAG) $(BOOTSTRAP_COMPILER)/egen/erl_parse.erl

$(BOOTSTRAP_TOP)/lib/stdlib/egen/erl_parse.erl: erl_parse.yrl
	$(yecc_verbose)$(ERLC) $(YRL_FLAGS) -o$(BOOTSTRAP_TOP)/lib/stdlib/egen erl_parse.yrl

$(BOOTSTRAP_COMPILER)/ebin/%.beam: %.erl
	$(V_ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $(DETERMINISM_FLAG) $<

# ----------------------------------------------------
# Special Build Targets
# ----------------------------------------------------

$(APP_TARGET): $(APP_SRC) ../vsn.mk
	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@

$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@

unicode_util.erl: ../uc_spec/*
	escript$(EXE_SUFFIX) ../uc_spec/gen_unicode_mod.escript

# ----------------------------------------------------
# Release Target
# ----------------------------------------------------
include $(ERL_TOP)/make/otp_release_targets.mk

release_spec: opt
	$(INSTALL_DIR) "$(RELSYSDIR)/src"
	$(INSTALL_DATA) $(ERL_FILES) erl_parse.yrl "$(RELSYSDIR)/src"
	$(INSTALL_DATA) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src"
	$(INSTALL_DIR) "$(RELSYSDIR)/include"
	$(INSTALL_DATA) $(HRL_FILES) "$(RELSYSDIR)/include"
	$(INSTALL_DIR) "$(RELSYSDIR)/ebin"
	$(INSTALL_DATA) $(TARGET_FILES) "$(RELSYSDIR)/ebin"

release_docs_spec:

# ----------------------------------------------------
# Dependencies -- alphabetically, please
# ----------------------------------------------------

$(EBIN)/beam_lib.beam: ../include/erl_compile.hrl ../../kernel/include/file.hrl
$(EBIN)/dets.beam: dets.hrl ../../kernel/include/file.hrl
$(EBIN)/dets_server.beam: dets.hrl
$(EBIN)/dets_utils.beam: dets.hrl
$(EBIN)/dets_v9.beam: dets.hrl
$(EBIN)/erl_bits.beam: ../include/erl_bits.hrl
$(EBIN)/erl_compile.beam: ../include/erl_compile.hrl ../../kernel/include/file.hrl
$(EBIN)/erl_lint.beam: ../include/erl_bits.hrl
$(EBIN)/erl_tar.beam: ../../kernel/include/file.hrl erl_tar.hrl
$(EBIN)/file_sorter.beam: ../../kernel/include/file.hrl
$(EBIN)/filelib.beam: ../../kernel/include/file.hrl
$(EBIN)/filename.beam: ../../kernel/include/file.hrl
$(EBIN)/gen_event.beam: ../../kernel/include/logger.hrl
$(EBIN)/gen_fsm.beam: ../../kernel/include/logger.hrl
$(EBIN)/gen_server.beam: ../../kernel/include/logger.hrl
$(EBIN)/gen_statem.beam: ../../kernel/include/logger.hrl
$(EBIN)/proc_lib.beam: ../../kernel/include/logger.hrl
$(EBIN)/qlc_pt.beam: ../include/ms_transform.hrl
$(EBIN)/shell.beam: ../../kernel/include/file.hrl
$(EBIN)/supervisor.beam: ../../kernel/include/logger.hrl
$(EBIN)/supervisor_bridge.beam: ../../kernel/include/logger.hrl
$(EBIN)/zip.beam: ../include/zip.hrl ../../kernel/include/file.hrl


text:
<?php

abstract class ArkPlatformMail
{

}