text:
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-----------------------------------------------------------------
-- Autogenerated by Thrift Compiler (0.9.0)                      --
--                                                             --
-- DO NOT EDIT UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING --
-----------------------------------------------------------------

module Database.HBase.Internal.Thrift2.HBase_Types where
import Prelude ( Bool(..), Enum, Double, String, Maybe(..),
                 Eq, Show, Ord,
                 return, length, IO, fromIntegral, fromEnum, toEnum,
                 (.), (&&), (||), (==), (++), ($), (-) )

import Control.Exception
import Data.ByteString.Lazy
import Data.Hashable
import Data.Int
import Data.Text.Lazy ( Text )
import qualified Data.Text.Lazy as TL
import Data.Typeable ( Typeable )
import qualified Data.HashMap.Strict as Map
import qualified Data.HashSet as Set
import qualified Data.Vector as Vector

import Thrift
import Thrift.Types ()

data TDeleteType = DELETE_COLUMN|DELETE_COLUMNS  deriving (Show,Eq, Typeable, Ord)
instance Enum TDeleteType where
  fromEnum t = case t of
    DELETE_COLUMN -> 0
    DELETE_COLUMNS -> 1
  toEnum t = case t of
    0 -> DELETE_COLUMN
    1 -> DELETE_COLUMNS
    _ -> throw ThriftException
instance Hashable TDeleteType where
  hashWithSalt salt = hashWithSalt salt . fromEnum
data TDurability = SKIP_WAL|ASYNC_WAL|SYNC_WAL|FSYNC_WAL  deriving (Show,Eq, Typeable, Ord)
instance Enum TDurability where
  fromEnum t = case t of
    SKIP_WAL -> 1
    ASYNC_WAL -> 2
    SYNC_WAL -> 3
    FSYNC_WAL -> 4
  toEnum t = case t of
    1 -> SKIP_WAL
    2 -> ASYNC_WAL
    3 -> SYNC_WAL
    4 -> FSYNC_WAL
    _ -> throw ThriftException
instance Hashable TDurability where
  hashWithSalt salt = hashWithSalt salt . fromEnum
data TTimeRange = TTimeRange{f_TTimeRange_minStamp :: Maybe Int64,f_TTimeRange_maxStamp :: Maybe Int64} deriving (Show,Eq,Typeable)
instance Hashable TTimeRange where
  hashWithSalt salt record = salt   `hashWithSalt` f_TTimeRange_minStamp record   `hashWithSalt` f_TTimeRange_maxStamp record
write_TTimeRange oprot record = do
  writeStructBegin oprot "TTimeRange"
  case f_TTimeRange_minStamp record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("minStamp",T_I64,1)
    writeI64 oprot _v
    writeFieldEnd oprot}
  case f_TTimeRange_maxStamp record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("maxStamp",T_I64,2)
    writeI64 oprot _v
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TTimeRange_fields iprot record = do
  (_,_t3,_id4) <- readFieldBegin iprot
  if _t3 == T_STOP then return record else
    case _id4 of
      1 -> if _t3 == T_I64 then do
        s <- readI64 iprot
        read_TTimeRange_fields iprot record{f_TTimeRange_minStamp=Just s}
        else do
          skip iprot _t3
          read_TTimeRange_fields iprot record
      2 -> if _t3 == T_I64 then do
        s <- readI64 iprot
        read_TTimeRange_fields iprot record{f_TTimeRange_maxStamp=Just s}
        else do
          skip iprot _t3
          read_TTimeRange_fields iprot record
      _ -> do
        skip iprot _t3
        readFieldEnd iprot
        read_TTimeRange_fields iprot record
read_TTimeRange iprot = do
  _ <- readStructBegin iprot
  record <- read_TTimeRange_fields iprot (TTimeRange{f_TTimeRange_minStamp=Nothing,f_TTimeRange_maxStamp=Nothing})
  readStructEnd iprot
  return record
data TColumn = TColumn{f_TColumn_family :: Maybe ByteString,f_TColumn_qualifier :: Maybe ByteString,f_TColumn_timestamp :: Maybe Int64} deriving (Show,Eq,Typeable)
instance Hashable TColumn where
  hashWithSalt salt record = salt   `hashWithSalt` f_TColumn_family record   `hashWithSalt` f_TColumn_qualifier record   `hashWithSalt` f_TColumn_timestamp record
write_TColumn oprot record = do
  writeStructBegin oprot "TColumn"
  case f_TColumn_family record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("family",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TColumn_qualifier record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("qualifier",T_STRING,2)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TColumn_timestamp record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("timestamp",T_I64,3)
    writeI64 oprot _v
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TColumn_fields iprot record = do
  (_,_t8,_id9) <- readFieldBegin iprot
  if _t8 == T_STOP then return record else
    case _id9 of
      1 -> if _t8 == T_STRING then do
        s <- readBinary iprot
        read_TColumn_fields iprot record{f_TColumn_family=Just s}
        else do
          skip iprot _t8
          read_TColumn_fields iprot record
      2 -> if _t8 == T_STRING then do
        s <- readBinary iprot
        read_TColumn_fields iprot record{f_TColumn_qualifier=Just s}
        else do
          skip iprot _t8
          read_TColumn_fields iprot record
      3 -> if _t8 == T_I64 then do
        s <- readI64 iprot
        read_TColumn_fields iprot record{f_TColumn_timestamp=Just s}
        else do
          skip iprot _t8
          read_TColumn_fields iprot record
      _ -> do
        skip iprot _t8
        readFieldEnd iprot
        read_TColumn_fields iprot record
read_TColumn iprot = do
  _ <- readStructBegin iprot
  record <- read_TColumn_fields iprot (TColumn{f_TColumn_family=Nothing,f_TColumn_qualifier=Nothing,f_TColumn_timestamp=Nothing})
  readStructEnd iprot
  return record
data TColumnValue = TColumnValue{f_TColumnValue_family :: Maybe ByteString,f_TColumnValue_qualifier :: Maybe ByteString,f_TColumnValue_value :: Maybe ByteString,f_TColumnValue_timestamp :: Maybe Int64} deriving (Show,Eq,Typeable)
instance Hashable TColumnValue where
  hashWithSalt salt record = salt   `hashWithSalt` f_TColumnValue_family record   `hashWithSalt` f_TColumnValue_qualifier record   `hashWithSalt` f_TColumnValue_value record   `hashWithSalt` f_TColumnValue_timestamp record
write_TColumnValue oprot record = do
  writeStructBegin oprot "TColumnValue"
  case f_TColumnValue_family record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("family",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TColumnValue_qualifier record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("qualifier",T_STRING,2)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TColumnValue_value record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("value",T_STRING,3)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TColumnValue_timestamp record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("timestamp",T_I64,4)
    writeI64 oprot _v
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TColumnValue_fields iprot record = do
  (_,_t13,_id14) <- readFieldBegin iprot
  if _t13 == T_STOP then return record else
    case _id14 of
      1 -> if _t13 == T_STRING then do
        s <- readBinary iprot
        read_TColumnValue_fields iprot record{f_TColumnValue_family=Just s}
        else do
          skip iprot _t13
          read_TColumnValue_fields iprot record
      2 -> if _t13 == T_STRING then do
        s <- readBinary iprot
        read_TColumnValue_fields iprot record{f_TColumnValue_qualifier=Just s}
        else do
          skip iprot _t13
          read_TColumnValue_fields iprot record
      3 -> if _t13 == T_STRING then do
        s <- readBinary iprot
        read_TColumnValue_fields iprot record{f_TColumnValue_value=Just s}
        else do
          skip iprot _t13
          read_TColumnValue_fields iprot record
      4 -> if _t13 == T_I64 then do
        s <- readI64 iprot
        read_TColumnValue_fields iprot record{f_TColumnValue_timestamp=Just s}
        else do
          skip iprot _t13
          read_TColumnValue_fields iprot record
      _ -> do
        skip iprot _t13
        readFieldEnd iprot
        read_TColumnValue_fields iprot record
read_TColumnValue iprot = do
  _ <- readStructBegin iprot
  record <- read_TColumnValue_fields iprot (TColumnValue{f_TColumnValue_family=Nothing,f_TColumnValue_qualifier=Nothing,f_TColumnValue_value=Nothing,f_TColumnValue_timestamp=Nothing})
  readStructEnd iprot
  return record
data TColumnIncrement = TColumnIncrement{f_TColumnIncrement_family :: Maybe ByteString,f_TColumnIncrement_qualifier :: Maybe ByteString,f_TColumnIncrement_amount :: Maybe Int64} deriving (Show,Eq,Typeable)
instance Hashable TColumnIncrement where
  hashWithSalt salt record = salt   `hashWithSalt` f_TColumnIncrement_family record   `hashWithSalt` f_TColumnIncrement_qualifier record   `hashWithSalt` f_TColumnIncrement_amount record
write_TColumnIncrement oprot record = do
  writeStructBegin oprot "TColumnIncrement"
  case f_TColumnIncrement_family record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("family",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TColumnIncrement_qualifier record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("qualifier",T_STRING,2)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TColumnIncrement_amount record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("amount",T_I64,3)
    writeI64 oprot _v
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TColumnIncrement_fields iprot record = do
  (_,_t18,_id19) <- readFieldBegin iprot
  if _t18 == T_STOP then return record else
    case _id19 of
      1 -> if _t18 == T_STRING then do
        s <- readBinary iprot
        read_TColumnIncrement_fields iprot record{f_TColumnIncrement_family=Just s}
        else do
          skip iprot _t18
          read_TColumnIncrement_fields iprot record
      2 -> if _t18 == T_STRING then do
        s <- readBinary iprot
        read_TColumnIncrement_fields iprot record{f_TColumnIncrement_qualifier=Just s}
        else do
          skip iprot _t18
          read_TColumnIncrement_fields iprot record
      3 -> if _t18 == T_I64 then do
        s <- readI64 iprot
        read_TColumnIncrement_fields iprot record{f_TColumnIncrement_amount=Just s}
        else do
          skip iprot _t18
          read_TColumnIncrement_fields iprot record
      _ -> do
        skip iprot _t18
        readFieldEnd iprot
        read_TColumnIncrement_fields iprot record
read_TColumnIncrement iprot = do
  _ <- readStructBegin iprot
  record <- read_TColumnIncrement_fields iprot (TColumnIncrement{f_TColumnIncrement_family=Nothing,f_TColumnIncrement_qualifier=Nothing,f_TColumnIncrement_amount=Nothing})
  readStructEnd iprot
  return record
data TResult = TResult{f_TResult_row :: Maybe ByteString,f_TResult_columnValues :: Maybe (Vector.Vector TColumnValue)} deriving (Show,Eq,Typeable)
instance Hashable TResult where
  hashWithSalt salt record = salt   `hashWithSalt` f_TResult_row record   `hashWithSalt` f_TResult_columnValues record
write_TResult oprot record = do
  writeStructBegin oprot "TResult"
  case f_TResult_row record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("row",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TResult_columnValues record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("columnValues",T_LIST,2)
    (let f = Vector.mapM_ (\_viter22 -> write_TColumnValue oprot _viter22) in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Vector.length _v); f _v;writeListEnd oprot})
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TResult_fields iprot record = do
  (_,_t24,_id25) <- readFieldBegin iprot
  if _t24 == T_STOP then return record else
    case _id25 of
      1 -> if _t24 == T_STRING then do
        s <- readBinary iprot
        read_TResult_fields iprot record{f_TResult_row=Just s}
        else do
          skip iprot _t24
          read_TResult_fields iprot record
      2 -> if _t24 == T_LIST then do
        s <- (let f n = Vector.replicateM (fromIntegral n) ((read_TColumnValue iprot)) in do {(_etype29,_size26) <- readListBegin iprot; f _size26})
        read_TResult_fields iprot record{f_TResult_columnValues=Just s}
        else do
          skip iprot _t24
          read_TResult_fields iprot record
      _ -> do
        skip iprot _t24
        readFieldEnd iprot
        read_TResult_fields iprot record
read_TResult iprot = do
  _ <- readStructBegin iprot
  record <- read_TResult_fields iprot (TResult{f_TResult_row=Nothing,f_TResult_columnValues=Nothing})
  readStructEnd iprot
  return record
data TGet = TGet{f_TGet_row :: Maybe ByteString,f_TGet_columns :: Maybe (Vector.Vector TColumn),f_TGet_timestamp :: Maybe Int64,f_TGet_timeRange :: Maybe TTimeRange,f_TGet_maxVersions :: Maybe Int32,f_TGet_filterString :: Maybe ByteString,f_TGet_attributes :: Maybe (Map.HashMap ByteString ByteString)} deriving (Show,Eq,Typeable)
instance Hashable TGet where
  hashWithSalt salt record = salt   `hashWithSalt` f_TGet_row record   `hashWithSalt` f_TGet_columns record   `hashWithSalt` f_TGet_timestamp record   `hashWithSalt` f_TGet_timeRange record   `hashWithSalt` f_TGet_maxVersions record   `hashWithSalt` f_TGet_filterString record   `hashWithSalt` f_TGet_attributes record
write_TGet oprot record = do
  writeStructBegin oprot "TGet"
  case f_TGet_row record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("row",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TGet_columns record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("columns",T_LIST,2)
    (let f = Vector.mapM_ (\_viter33 -> write_TColumn oprot _viter33) in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Vector.length _v); f _v;writeListEnd oprot})
    writeFieldEnd oprot}
  case f_TGet_timestamp record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("timestamp",T_I64,3)
    writeI64 oprot _v
    writeFieldEnd oprot}
  case f_TGet_timeRange record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("timeRange",T_STRUCT,4)
    write_TTimeRange oprot _v
    writeFieldEnd oprot}
  case f_TGet_maxVersions record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("maxVersions",T_I32,5)
    writeI32 oprot _v
    writeFieldEnd oprot}
  case f_TGet_filterString record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("filterString",T_STRING,6)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TGet_attributes record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("attributes",T_MAP,7)
    (let {f [] = return (); f ((_kiter34,_viter35):t) = do {do {writeBinary oprot _kiter34;writeBinary oprot _viter35};f t}} in do {writeMapBegin oprot (T_STRING,T_STRING,fromIntegral $ Map.size _v); f (Map.toList _v);writeMapEnd oprot})
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TGet_fields iprot record = do
  (_,_t37,_id38) <- readFieldBegin iprot
  if _t37 == T_STOP then return record else
    case _id38 of
      1 -> if _t37 == T_STRING then do
        s <- readBinary iprot
        read_TGet_fields iprot record{f_TGet_row=Just s}
        else do
          skip iprot _t37
          read_TGet_fields iprot record
      2 -> if _t37 == T_LIST then do
        s <- (let f n = Vector.replicateM (fromIntegral n) ((read_TColumn iprot)) in do {(_etype42,_size39) <- readListBegin iprot; f _size39})
        read_TGet_fields iprot record{f_TGet_columns=Just s}
        else do
          skip iprot _t37
          read_TGet_fields iprot record
      3 -> if _t37 == T_I64 then do
        s <- readI64 iprot
        read_TGet_fields iprot record{f_TGet_timestamp=Just s}
        else do
          skip iprot _t37
          read_TGet_fields iprot record
      4 -> if _t37 == T_STRUCT then do
        s <- (read_TTimeRange iprot)
        read_TGet_fields iprot record{f_TGet_timeRange=Just s}
        else do
          skip iprot _t37
          read_TGet_fields iprot record
      5 -> if _t37 == T_I32 then do
        s <- readI32 iprot
        read_TGet_fields iprot record{f_TGet_maxVersions=Just s}
        else do
          skip iprot _t37
          read_TGet_fields iprot record
      6 -> if _t37 == T_STRING then do
        s <- readBinary iprot
        read_TGet_fields iprot record{f_TGet_filterString=Just s}
        else do
          skip iprot _t37
          read_TGet_fields iprot record
      7 -> if _t37 == T_MAP then do
        s <- (let {f 0 = return []; f n = do {k <- readBinary iprot; v <- readBinary iprot;r <- f (n-1); return $ (k,v):r}} in do {(_ktype45,_vtype46,_size44) <- readMapBegin iprot; l <- f _size44; return $ Map.fromList l})
        read_TGet_fields iprot record{f_TGet_attributes=Just s}
        else do
          skip iprot _t37
          read_TGet_fields iprot record
      _ -> do
        skip iprot _t37
        readFieldEnd iprot
        read_TGet_fields iprot record
read_TGet iprot = do
  _ <- readStructBegin iprot
  record <- read_TGet_fields iprot (TGet{f_TGet_row=Nothing,f_TGet_columns=Nothing,f_TGet_timestamp=Nothing,f_TGet_timeRange=Nothing,f_TGet_maxVersions=Nothing,f_TGet_filterString=Nothing,f_TGet_attributes=Nothing})
  readStructEnd iprot
  return record
data TPut = TPut{f_TPut_row :: Maybe ByteString,f_TPut_columnValues :: Maybe (Vector.Vector TColumnValue),f_TPut_timestamp :: Maybe Int64,f_TPut_attributes :: Maybe (Map.HashMap ByteString ByteString),f_TPut_durability :: Maybe TDurability} deriving (Show,Eq,Typeable)
instance Hashable TPut where
  hashWithSalt salt record = salt   `hashWithSalt` f_TPut_row record   `hashWithSalt` f_TPut_columnValues record   `hashWithSalt` f_TPut_timestamp record   `hashWithSalt` f_TPut_attributes record   `hashWithSalt` f_TPut_durability record
write_TPut oprot record = do
  writeStructBegin oprot "TPut"
  case f_TPut_row record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("row",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TPut_columnValues record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("columnValues",T_LIST,2)
    (let f = Vector.mapM_ (\_viter51 -> write_TColumnValue oprot _viter51) in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Vector.length _v); f _v;writeListEnd oprot})
    writeFieldEnd oprot}
  case f_TPut_timestamp record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("timestamp",T_I64,3)
    writeI64 oprot _v
    writeFieldEnd oprot}
  case f_TPut_attributes record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("attributes",T_MAP,5)
    (let {f [] = return (); f ((_kiter52,_viter53):t) = do {do {writeBinary oprot _kiter52;writeBinary oprot _viter53};f t}} in do {writeMapBegin oprot (T_STRING,T_STRING,fromIntegral $ Map.size _v); f (Map.toList _v);writeMapEnd oprot})
    writeFieldEnd oprot}
  case f_TPut_durability record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("durability",T_I32,6)
    writeI32 oprot (fromIntegral $ fromEnum _v)
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TPut_fields iprot record = do
  (_,_t55,_id56) <- readFieldBegin iprot
  if _t55 == T_STOP then return record else
    case _id56 of
      1 -> if _t55 == T_STRING then do
        s <- readBinary iprot
        read_TPut_fields iprot record{f_TPut_row=Just s}
        else do
          skip iprot _t55
          read_TPut_fields iprot record
      2 -> if _t55 == T_LIST then do
        s <- (let f n = Vector.replicateM (fromIntegral n) ((read_TColumnValue iprot)) in do {(_etype60,_size57) <- readListBegin iprot; f _size57})
        read_TPut_fields iprot record{f_TPut_columnValues=Just s}
        else do
          skip iprot _t55
          read_TPut_fields iprot record
      3 -> if _t55 == T_I64 then do
        s <- readI64 iprot
        read_TPut_fields iprot record{f_TPut_timestamp=Just s}
        else do
          skip iprot _t55
          read_TPut_fields iprot record
      5 -> if _t55 == T_MAP then do
        s <- (let {f 0 = return []; f n = do {k <- readBinary iprot; v <- readBinary iprot;r <- f (n-1); return $ (k,v):r}} in do {(_ktype63,_vtype64,_size62) <- readMapBegin iprot; l <- f _size62; return $ Map.fromList l})
        read_TPut_fields iprot record{f_TPut_attributes=Just s}
        else do
          skip iprot _t55
          read_TPut_fields iprot record
      6 -> if _t55 == T_I32 then do
        s <- (do {i <- readI32 iprot; return $ toEnum $ fromIntegral i})
        read_TPut_fields iprot record{f_TPut_durability=Just s}
        else do
          skip iprot _t55
          read_TPut_fields iprot record
      _ -> do
        skip iprot _t55
        readFieldEnd iprot
        read_TPut_fields iprot record
read_TPut iprot = do
  _ <- readStructBegin iprot
  record <- read_TPut_fields iprot (TPut{f_TPut_row=Nothing,f_TPut_columnValues=Nothing,f_TPut_timestamp=Nothing,f_TPut_attributes=Nothing,f_TPut_durability=Nothing})
  readStructEnd iprot
  return record
data TDelete = TDelete{f_TDelete_row :: Maybe ByteString,f_TDelete_columns :: Maybe (Vector.Vector TColumn),f_TDelete_timestamp :: Maybe Int64,f_TDelete_deleteType :: Maybe TDeleteType,f_TDelete_attributes :: Maybe (Map.HashMap ByteString ByteString),f_TDelete_durability :: Maybe TDurability} deriving (Show,Eq,Typeable)
instance Hashable TDelete where
  hashWithSalt salt record = salt   `hashWithSalt` f_TDelete_row record   `hashWithSalt` f_TDelete_columns record   `hashWithSalt` f_TDelete_timestamp record   `hashWithSalt` f_TDelete_deleteType record   `hashWithSalt` f_TDelete_attributes record   `hashWithSalt` f_TDelete_durability record
write_TDelete oprot record = do
  writeStructBegin oprot "TDelete"
  case f_TDelete_row record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("row",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TDelete_columns record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("columns",T_LIST,2)
    (let f = Vector.mapM_ (\_viter69 -> write_TColumn oprot _viter69) in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Vector.length _v); f _v;writeListEnd oprot})
    writeFieldEnd oprot}
  case f_TDelete_timestamp record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("timestamp",T_I64,3)
    writeI64 oprot _v
    writeFieldEnd oprot}
  case f_TDelete_deleteType record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("deleteType",T_I32,4)
    writeI32 oprot (fromIntegral $ fromEnum _v)
    writeFieldEnd oprot}
  case f_TDelete_attributes record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("attributes",T_MAP,6)
    (let {f [] = return (); f ((_kiter70,_viter71):t) = do {do {writeBinary oprot _kiter70;writeBinary oprot _viter71};f t}} in do {writeMapBegin oprot (T_STRING,T_STRING,fromIntegral $ Map.size _v); f (Map.toList _v);writeMapEnd oprot})
    writeFieldEnd oprot}
  case f_TDelete_durability record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("durability",T_I32,7)
    writeI32 oprot (fromIntegral $ fromEnum _v)
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TDelete_fields iprot record = do
  (_,_t73,_id74) <- readFieldBegin iprot
  if _t73 == T_STOP then return record else
    case _id74 of
      1 -> if _t73 == T_STRING then do
        s <- readBinary iprot
        read_TDelete_fields iprot record{f_TDelete_row=Just s}
        else do
          skip iprot _t73
          read_TDelete_fields iprot record
      2 -> if _t73 == T_LIST then do
        s <- (let f n = Vector.replicateM (fromIntegral n) ((read_TColumn iprot)) in do {(_etype78,_size75) <- readListBegin iprot; f _size75})
        read_TDelete_fields iprot record{f_TDelete_columns=Just s}
        else do
          skip iprot _t73
          read_TDelete_fields iprot record
      3 -> if _t73 == T_I64 then do
        s <- readI64 iprot
        read_TDelete_fields iprot record{f_TDelete_timestamp=Just s}
        else do
          skip iprot _t73
          read_TDelete_fields iprot record
      4 -> if _t73 == T_I32 then do
        s <- (do {i <- readI32 iprot; return $ toEnum $ fromIntegral i})
        read_TDelete_fields iprot record{f_TDelete_deleteType=Just s}
        else do
          skip iprot _t73
          read_TDelete_fields iprot record
      6 -> if _t73 == T_MAP then do
        s <- (let {f 0 = return []; f n = do {k <- readBinary iprot; v <- readBinary iprot;r <- f (n-1); return $ (k,v):r}} in do {(_ktype81,_vtype82,_size80) <- readMapBegin iprot; l <- f _size80; return $ Map.fromList l})
        read_TDelete_fields iprot record{f_TDelete_attributes=Just s}
        else do
          skip iprot _t73
          read_TDelete_fields iprot record
      7 -> if _t73 == T_I32 then do
        s <- (do {i <- readI32 iprot; return $ toEnum $ fromIntegral i})
        read_TDelete_fields iprot record{f_TDelete_durability=Just s}
        else do
          skip iprot _t73
          read_TDelete_fields iprot record
      _ -> do
        skip iprot _t73
        readFieldEnd iprot
        read_TDelete_fields iprot record
read_TDelete iprot = do
  _ <- readStructBegin iprot
  record <- read_TDelete_fields iprot (TDelete{f_TDelete_row=Nothing,f_TDelete_columns=Nothing,f_TDelete_timestamp=Nothing,f_TDelete_deleteType=Nothing,f_TDelete_attributes=Nothing,f_TDelete_durability=Nothing})
  readStructEnd iprot
  return record
data TIncrement = TIncrement{f_TIncrement_row :: Maybe ByteString,f_TIncrement_columns :: Maybe (Vector.Vector TColumnIncrement),f_TIncrement_attributes :: Maybe (Map.HashMap ByteString ByteString),f_TIncrement_durability :: Maybe TDurability} deriving (Show,Eq,Typeable)
instance Hashable TIncrement where
  hashWithSalt salt record = salt   `hashWithSalt` f_TIncrement_row record   `hashWithSalt` f_TIncrement_columns record   `hashWithSalt` f_TIncrement_attributes record   `hashWithSalt` f_TIncrement_durability record
write_TIncrement oprot record = do
  writeStructBegin oprot "TIncrement"
  case f_TIncrement_row record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("row",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TIncrement_columns record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("columns",T_LIST,2)
    (let f = Vector.mapM_ (\_viter87 -> write_TColumnIncrement oprot _viter87) in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Vector.length _v); f _v;writeListEnd oprot})
    writeFieldEnd oprot}
  case f_TIncrement_attributes record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("attributes",T_MAP,4)
    (let {f [] = return (); f ((_kiter88,_viter89):t) = do {do {writeBinary oprot _kiter88;writeBinary oprot _viter89};f t}} in do {writeMapBegin oprot (T_STRING,T_STRING,fromIntegral $ Map.size _v); f (Map.toList _v);writeMapEnd oprot})
    writeFieldEnd oprot}
  case f_TIncrement_durability record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("durability",T_I32,5)
    writeI32 oprot (fromIntegral $ fromEnum _v)
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TIncrement_fields iprot record = do
  (_,_t91,_id92) <- readFieldBegin iprot
  if _t91 == T_STOP then return record else
    case _id92 of
      1 -> if _t91 == T_STRING then do
        s <- readBinary iprot
        read_TIncrement_fields iprot record{f_TIncrement_row=Just s}
        else do
          skip iprot _t91
          read_TIncrement_fields iprot record
      2 -> if _t91 == T_LIST then do
        s <- (let f n = Vector.replicateM (fromIntegral n) ((read_TColumnIncrement iprot)) in do {(_etype96,_size93) <- readListBegin iprot; f _size93})
        read_TIncrement_fields iprot record{f_TIncrement_columns=Just s}
        else do
          skip iprot _t91
          read_TIncrement_fields iprot record
      4 -> if _t91 == T_MAP then do
        s <- (let {f 0 = return []; f n = do {k <- readBinary iprot; v <- readBinary iprot;r <- f (n-1); return $ (k,v):r}} in do {(_ktype99,_vtype100,_size98) <- readMapBegin iprot; l <- f _size98; return $ Map.fromList l})
        read_TIncrement_fields iprot record{f_TIncrement_attributes=Just s}
        else do
          skip iprot _t91
          read_TIncrement_fields iprot record
      5 -> if _t91 == T_I32 then do
        s <- (do {i <- readI32 iprot; return $ toEnum $ fromIntegral i})
        read_TIncrement_fields iprot record{f_TIncrement_durability=Just s}
        else do
          skip iprot _t91
          read_TIncrement_fields iprot record
      _ -> do
        skip iprot _t91
        readFieldEnd iprot
        read_TIncrement_fields iprot record
read_TIncrement iprot = do
  _ <- readStructBegin iprot
  record <- read_TIncrement_fields iprot (TIncrement{f_TIncrement_row=Nothing,f_TIncrement_columns=Nothing,f_TIncrement_attributes=Nothing,f_TIncrement_durability=Nothing})
  readStructEnd iprot
  return record
data TScan = TScan{f_TScan_startRow :: Maybe ByteString,f_TScan_stopRow :: Maybe ByteString,f_TScan_columns :: Maybe (Vector.Vector TColumn),f_TScan_caching :: Maybe Int32,f_TScan_maxVersions :: Maybe Int32,f_TScan_timeRange :: Maybe TTimeRange,f_TScan_filterString :: Maybe ByteString,f_TScan_batchSize :: Maybe Int32,f_TScan_attributes :: Maybe (Map.HashMap ByteString ByteString)} deriving (Show,Eq,Typeable)
instance Hashable TScan where
  hashWithSalt salt record = salt   `hashWithSalt` f_TScan_startRow record   `hashWithSalt` f_TScan_stopRow record   `hashWithSalt` f_TScan_columns record   `hashWithSalt` f_TScan_caching record   `hashWithSalt` f_TScan_maxVersions record   `hashWithSalt` f_TScan_timeRange record   `hashWithSalt` f_TScan_filterString record   `hashWithSalt` f_TScan_batchSize record   `hashWithSalt` f_TScan_attributes record
write_TScan oprot record = do
  writeStructBegin oprot "TScan"
  case f_TScan_startRow record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("startRow",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TScan_stopRow record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("stopRow",T_STRING,2)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TScan_columns record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("columns",T_LIST,3)
    (let f = Vector.mapM_ (\_viter105 -> write_TColumn oprot _viter105) in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Vector.length _v); f _v;writeListEnd oprot})
    writeFieldEnd oprot}
  case f_TScan_caching record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("caching",T_I32,4)
    writeI32 oprot _v
    writeFieldEnd oprot}
  case f_TScan_maxVersions record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("maxVersions",T_I32,5)
    writeI32 oprot _v
    writeFieldEnd oprot}
  case f_TScan_timeRange record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("timeRange",T_STRUCT,6)
    write_TTimeRange oprot _v
    writeFieldEnd oprot}
  case f_TScan_filterString record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("filterString",T_STRING,7)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TScan_batchSize record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("batchSize",T_I32,8)
    writeI32 oprot _v
    writeFieldEnd oprot}
  case f_TScan_attributes record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("attributes",T_MAP,9)
    (let {f [] = return (); f ((_kiter106,_viter107):t) = do {do {writeBinary oprot _kiter106;writeBinary oprot _viter107};f t}} in do {writeMapBegin oprot (T_STRING,T_STRING,fromIntegral $ Map.size _v); f (Map.toList _v);writeMapEnd oprot})
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TScan_fields iprot record = do
  (_,_t109,_id110) <- readFieldBegin iprot
  if _t109 == T_STOP then return record else
    case _id110 of
      1 -> if _t109 == T_STRING then do
        s <- readBinary iprot
        read_TScan_fields iprot record{f_TScan_startRow=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      2 -> if _t109 == T_STRING then do
        s <- readBinary iprot
        read_TScan_fields iprot record{f_TScan_stopRow=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      3 -> if _t109 == T_LIST then do
        s <- (let f n = Vector.replicateM (fromIntegral n) ((read_TColumn iprot)) in do {(_etype114,_size111) <- readListBegin iprot; f _size111})
        read_TScan_fields iprot record{f_TScan_columns=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      4 -> if _t109 == T_I32 then do
        s <- readI32 iprot
        read_TScan_fields iprot record{f_TScan_caching=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      5 -> if _t109 == T_I32 then do
        s <- readI32 iprot
        read_TScan_fields iprot record{f_TScan_maxVersions=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      6 -> if _t109 == T_STRUCT then do
        s <- (read_TTimeRange iprot)
        read_TScan_fields iprot record{f_TScan_timeRange=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      7 -> if _t109 == T_STRING then do
        s <- readBinary iprot
        read_TScan_fields iprot record{f_TScan_filterString=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      8 -> if _t109 == T_I32 then do
        s <- readI32 iprot
        read_TScan_fields iprot record{f_TScan_batchSize=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      9 -> if _t109 == T_MAP then do
        s <- (let {f 0 = return []; f n = do {k <- readBinary iprot; v <- readBinary iprot;r <- f (n-1); return $ (k,v):r}} in do {(_ktype117,_vtype118,_size116) <- readMapBegin iprot; l <- f _size116; return $ Map.fromList l})
        read_TScan_fields iprot record{f_TScan_attributes=Just s}
        else do
          skip iprot _t109
          read_TScan_fields iprot record
      _ -> do
        skip iprot _t109
        readFieldEnd iprot
        read_TScan_fields iprot record
read_TScan iprot = do
  _ <- readStructBegin iprot
  record <- read_TScan_fields iprot (TScan{f_TScan_startRow=Nothing,f_TScan_stopRow=Nothing,f_TScan_columns=Nothing,f_TScan_caching=Nothing,f_TScan_maxVersions=Nothing,f_TScan_timeRange=Nothing,f_TScan_filterString=Nothing,f_TScan_batchSize=Nothing,f_TScan_attributes=Nothing})
  readStructEnd iprot
  return record
data TMutation = TMutation{f_TMutation_put :: Maybe TPut,f_TMutation_deleteSingle :: Maybe TDelete} deriving (Show,Eq,Typeable)
instance Hashable TMutation where
  hashWithSalt salt record = salt   `hashWithSalt` f_TMutation_put record   `hashWithSalt` f_TMutation_deleteSingle record
write_TMutation oprot record = do
  writeStructBegin oprot "TMutation"
  case f_TMutation_put record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("put",T_STRUCT,1)
    write_TPut oprot _v
    writeFieldEnd oprot}
  case f_TMutation_deleteSingle record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("deleteSingle",T_STRUCT,2)
    write_TDelete oprot _v
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TMutation_fields iprot record = do
  (_,_t124,_id125) <- readFieldBegin iprot
  if _t124 == T_STOP then return record else
    case _id125 of
      1 -> if _t124 == T_STRUCT then do
        s <- (read_TPut iprot)
        read_TMutation_fields iprot record{f_TMutation_put=Just s}
        else do
          skip iprot _t124
          read_TMutation_fields iprot record
      2 -> if _t124 == T_STRUCT then do
        s <- (read_TDelete iprot)
        read_TMutation_fields iprot record{f_TMutation_deleteSingle=Just s}
        else do
          skip iprot _t124
          read_TMutation_fields iprot record
      _ -> do
        skip iprot _t124
        readFieldEnd iprot
        read_TMutation_fields iprot record
read_TMutation iprot = do
  _ <- readStructBegin iprot
  record <- read_TMutation_fields iprot (TMutation{f_TMutation_put=Nothing,f_TMutation_deleteSingle=Nothing})
  readStructEnd iprot
  return record
data TRowMutations = TRowMutations{f_TRowMutations_row :: Maybe ByteString,f_TRowMutations_mutations :: Maybe (Vector.Vector TMutation)} deriving (Show,Eq,Typeable)
instance Hashable TRowMutations where
  hashWithSalt salt record = salt   `hashWithSalt` f_TRowMutations_row record   `hashWithSalt` f_TRowMutations_mutations record
write_TRowMutations oprot record = do
  writeStructBegin oprot "TRowMutations"
  case f_TRowMutations_row record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("row",T_STRING,1)
    writeBinary oprot _v
    writeFieldEnd oprot}
  case f_TRowMutations_mutations record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("mutations",T_LIST,2)
    (let f = Vector.mapM_ (\_viter128 -> write_TMutation oprot _viter128) in do {writeListBegin oprot (T_STRUCT,fromIntegral $ Vector.length _v); f _v;writeListEnd oprot})
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TRowMutations_fields iprot record = do
  (_,_t130,_id131) <- readFieldBegin iprot
  if _t130 == T_STOP then return record else
    case _id131 of
      1 -> if _t130 == T_STRING then do
        s <- readBinary iprot
        read_TRowMutations_fields iprot record{f_TRowMutations_row=Just s}
        else do
          skip iprot _t130
          read_TRowMutations_fields iprot record
      2 -> if _t130 == T_LIST then do
        s <- (let f n = Vector.replicateM (fromIntegral n) ((read_TMutation iprot)) in do {(_etype135,_size132) <- readListBegin iprot; f _size132})
        read_TRowMutations_fields iprot record{f_TRowMutations_mutations=Just s}
        else do
          skip iprot _t130
          read_TRowMutations_fields iprot record
      _ -> do
        skip iprot _t130
        readFieldEnd iprot
        read_TRowMutations_fields iprot record
read_TRowMutations iprot = do
  _ <- readStructBegin iprot
  record <- read_TRowMutations_fields iprot (TRowMutations{f_TRowMutations_row=Nothing,f_TRowMutations_mutations=Nothing})
  readStructEnd iprot
  return record
data TIOError = TIOError{f_TIOError_message :: Maybe Text} deriving (Show,Eq,Typeable)
instance Exception TIOError
instance Hashable TIOError where
  hashWithSalt salt record = salt   `hashWithSalt` f_TIOError_message record
write_TIOError oprot record = do
  writeStructBegin oprot "TIOError"
  case f_TIOError_message record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("message",T_STRING,1)
    writeString oprot _v
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TIOError_fields iprot record = do
  (_,_t140,_id141) <- readFieldBegin iprot
  if _t140 == T_STOP then return record else
    case _id141 of
      1 -> if _t140 == T_STRING then do
        s <- readString iprot
        read_TIOError_fields iprot record{f_TIOError_message=Just s}
        else do
          skip iprot _t140
          read_TIOError_fields iprot record
      _ -> do
        skip iprot _t140
        readFieldEnd iprot
        read_TIOError_fields iprot record
read_TIOError iprot = do
  _ <- readStructBegin iprot
  record <- read_TIOError_fields iprot (TIOError{f_TIOError_message=Nothing})
  readStructEnd iprot
  return record
data TIllegalArgument = TIllegalArgument{f_TIllegalArgument_message :: Maybe Text} deriving (Show,Eq,Typeable)
instance Exception TIllegalArgument
instance Hashable TIllegalArgument where
  hashWithSalt salt record = salt   `hashWithSalt` f_TIllegalArgument_message record
write_TIllegalArgument oprot record = do
  writeStructBegin oprot "TIllegalArgument"
  case f_TIllegalArgument_message record of {Nothing -> return (); Just _v -> do
    writeFieldBegin oprot ("message",T_STRING,1)
    writeString oprot _v
    writeFieldEnd oprot}
  writeFieldStop oprot
  writeStructEnd oprot
read_TIllegalArgument_fields iprot record = do
  (_,_t145,_id146) <- readFieldBegin iprot
  if _t145 == T_STOP then return record else
    case _id146 of
      1 -> if _t145 == T_STRING then do
        s <- readString iprot
        read_TIllegalArgument_fields iprot record{f_TIllegalArgument_message=Just s}
        else do
          skip iprot _t145
          read_TIllegalArgument_fields iprot record
      _ -> do
        skip iprot _t145
        readFieldEnd iprot
        read_TIllegalArgument_fields iprot record
read_TIllegalArgument iprot = do
  _ <- readStructBegin iprot
  record <- read_TIllegalArgument_fields iprot (TIllegalArgument{f_TIllegalArgument_message=Nothing})
  readStructEnd iprot
  return record


text:
import 'chrome://webui-test/mojo_webui_test_support.js';

import {InfoDialogElement} from 'chrome://new-tab-page/lazy_load.js';
import {assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js';

suite('NewTabPageModulesInfoDialogTest', () => {
  let infoDialog: InfoDialogElement;

  setup(() => {
    document.body.innerHTML = '';
    infoDialog = new InfoDialogElement();
    document.body.appendChild(infoDialog);
  });

  test('can open dialog', () => {
    assertFalse(infoDialog.$.dialog.open);
    infoDialog.showModal();
    assertTrue(infoDialog.$.dialog.open);
  });

  test('clicking close button closes cr dialog', () => {
    // Arrange.
    infoDialog.showModal();

    // Act.
    infoDialog.$.closeButton.click();

    // Assert.
    assertFalse(infoDialog.$.dialog.open);
  });
});

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Eddmash\PowerOrm\Checks;

/**
 * Class Debug.
 *
 * @since  1.0.0
 *
 * @author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
 */
class CheckDebug extends CheckMessage
{
    public function __construct($msg, $hint = null, $context = null, $id = null)
    {
        parent::__construct(CheckMessage::DEBUG, $msg, $hint, $context, $id);
    }
}


text:
using Budgerigar.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace WebApplication.Controllers {
    public class HomeController : Controller {
        public ActionResult Index() {
            return View();
        }

        public async Task<ActionResult> Over() {
            await Task.Delay(500);
            return View("index");
        }

        public ActionResult Under() {
            return View("index");
        }
    }
}


text:
package org.wso2.am.integration.ui.tests;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.am.integration.ui.tests.util.TestUtil;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.utils.CarbonUtils;

public class APIMANAGER3371BusinessInformationClearedWhenAPISavedButton extends APIMIntegrationUiTestBase {

	private WebDriver driver;
	private static final String API_DESCRIPTION = "Publish into Gateways";
	private static final String API_URL = "http://gdata.youtube.com/feeds/api/standardfeeds";
	private static final String API_METHOD = "/most_popular";
	private String accessHTTPURL;
	WebDriverWait wait;
	String carbonLogFilePath = CarbonUtils.getCarbonLogsPath() + "/wso2carbon.log";

	@BeforeClass(alwaysRun = true)
	public void setUp() throws Exception {
		super.init();
		driver = BrowserManager.getWebDriver();
		driver.get(getPublisherURL());
		wait = new WebDriverWait(driver, 60);

	}

	@Test(groups = "wso2.am", description = "publish api without environment tab selection")
	public void testPublishApiWithOutEnvironmentTabSelection() throws Exception {

		driver.findElement(By.id("username")).clear();
		driver.findElement(By.id("username")).sendKeys(gatewayContextMgt.getContextTenant().getContextUser().getUserName());
		driver.findElement(By.id("pass")).clear();
		driver.findElement(By.id("pass")).sendKeys(gatewayContextMgt.getContextTenant().getContextUser().getPassword());
		driver.findElement(By.id("loginButton")).click();
		wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Add")));
		driver.findElement(By.linkText("Add")).click();

		wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("create-new-api")));
		driver.findElement(By.id("create-new-api")).click();

		wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("designNewAPI")));
		driver.findElement(By.id("designNewAPI")).click();

		driver.findElement(By.id("name")).clear();
		driver.findElement(By.id("name")).sendKeys("APIMANAGER3371");
		driver.findElement(By.id("context")).clear();
		driver.findElement(By.id("context")).sendKeys("APIMANAGER3371");
		driver.findElement(By.id("version")).clear();
		driver.findElement(By.id("version")).sendKeys("1.0.0");
		driver.findElement(By.id("description")).clear();
		driver.findElement(By.id("description")).sendKeys(API_DESCRIPTION);
		driver.findElement(By.id("resource_url_pattern")).clear();
		driver.findElement(By.id("resource_url_pattern")).sendKeys("*");
		/*driver.findElement(By.id("inputResource")).clear();
		driver.findElement(By.id("inputResource")).sendKeys("default");*/
		driver.findElement(By.cssSelector("input.http_verb_select")).click();
		driver.findElement(By.id("add_resource")).click();
		driver.findElement(By.id("go_to_implement")).click();

		wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@value='#managed-api']")));
		driver.findElement(By.xpath("//div[@value='#managed-api']")).click();

		wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("go_to_manage")));
		driver.findElement(By.id("jsonform-0-elt-production_endpoints")).clear();
		driver.findElement(By.id("jsonform-0-elt-production_endpoints")).sendKeys(API_URL);
		driver.findElement(By.id("go_to_manage")).click();
		wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("publish_api")));
		driver.findElement(By.xpath("//button[@type='button']")).click();
		driver.findElement(By.xpath("//input[@value='Gold']")).click();
		driver.findElement(By.xpath("//form[@id='manage_form']/fieldset[3]/legend")).click();
		driver.findElement(By.id("bizOwner")).clear();
		driver.findElement(By.id("bizOwner")).sendKeys("abc");
		driver.findElement(By.id("bizOwnerMail")).clear();
		driver.findElement(By.id("bizOwnerMail")).sendKeys("abc@abc.com");
		driver.findElement(By.id("techOwner")).clear();
		driver.findElement(By.id("techOwner")).sendKeys("tes");
		driver.findElement(By.id("techOwnerMail")).clear();
		driver.findElement(By.id("techOwnerMail")).sendKeys("tec@tech.com");
		driver.findElement(By.id("publish_api")).click();
		driver.findElement(By.linkText("Edit")).click();
		/*wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input.btn.btn-primary")));
		driver.findElement(By.cssSelector("input.btn.btn-primary")).click();*/
		wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[@id='saveBtn']")));
		driver.findElement(By.xpath("//button[@id='saveBtn']")).click();
		driver.findElement(By.cssSelector("a.wizard-done")).click();
		driver.findElement(By.xpath("//div[@id='item-add']/center/ul/li[3]/a")).click();
		driver.findElement(By.xpath("//form[@id='manage_form']/fieldset[3]/legend")).click();
		Assert.assertEquals(driver.findElement(By.id("techOwner")).getAttribute("value"), "tes");
		Assert.assertEquals(driver.findElement(By.id("techOwnerMail")).getAttribute("value"), "tec@tech.com");
		Assert.assertEquals(driver.findElement(By.id("bizOwner")).getAttribute("value"), "abc");
		Assert.assertEquals(driver.findElement(By.id("bizOwnerMail")).getAttribute("value"), "abc@abc.com");
		driver.findElement(By.id("userMenu")).click();
		driver.findElement(By.cssSelector("button.btn.btn-danger")).click();
	}

	@AfterClass(alwaysRun = true)
	public void tearDown() throws Exception {
        TestUtil.cleanUp(gatewayContextMgt.getContextTenant().getContextUser().getUserName(),
                         gatewayContextMgt.getContextTenant().getContextUser().getPassword(),
                         storeUrls.getWebAppURLHttp(), publisherUrls.getWebAppURLHttp());
		driver.quit();
	}
}


text:
local function search (k, plist)
    for i=1, #plist do
       local v = plist[i][k]    -- try 'i'-th superclass
       if v then return v end
    end
end

function createClass (...)
    local c = {}      -- new class
    -- class will search for each method in the list of its
    -- parents (`arg' is the list of parents)
    setmetatable(c, {__index = function (t, k)
        return search(k, arg)
    end})

    -- prepare `c' to be the metatable of its instances
    c.__index = c

    -- define a new constructor for this new class
    function c:new (o)
        o = o or {}
        setmetatable(o, c)
        return o
    end

    -- return new class
        return c
end


text:
package org.baswell.easybeans;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Metadata for a MBean attribute.
 *
 */
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(value=RetentionPolicy.RUNTIME)
public @interface EasyBeanAttribute
{
  /**
   * The JMX attribute name. If not provided the name will be created from the {@link java.lang.reflect.Field} or
   * {@link java.lang.reflect.Method}.
   *
   * @see javax.management.openmbean.OpenMBeanAttributeInfo#getName()
   */
  String name() default "";

  /**
   * Optional description of this attribute.
   *
   * @see javax.management.openmbean.OpenMBeanAttributeInfo#getDescription()
   */
  String description() default "";

  /**
   * Forces this attribute to be read-only even if the field or setter is available to write to.
   */
  boolean readOnly() default false;
}


text:
package com.tle.webtests.remotetest.integration.moodle.tests;

import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

import com.tle.common.Check;
import com.tle.webtests.pageobject.integration.moodle.MoodleCoursePage;
import com.tle.webtests.pageobject.integration.moodle.MoodleEditResourcePage;
import com.tle.webtests.pageobject.integration.moodle.MoodleIndexPage;
import com.tle.webtests.pageobject.integration.moodle.MoodleLoginPage;
import com.tle.webtests.pageobject.integration.moodle.MoodleResourcePage;
import com.tle.webtests.pageobject.viewitem.DRMAgreementPage;
import com.tle.webtests.remotetest.integration.moodle.AbstractParallelMoodleTest;
import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class MoodleTest extends AbstractParallelMoodleTest {
  private static final String COURSE_NAME = "Test Course 1";
  private static final int WEEK = 2;

  @Override
  protected void prepareBrowserSession() {
    logon();
  }

  @Test
  public void itemWithApostrophe() {
    String fullName = "BasicUTF8Selection ' хцч with other characters";
    new MoodleLoginPage(context).load().logon("teacher", "``````");
    MoodleCoursePage course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);
    course.addItem(WEEK, fullName);
    assertTrue(course.hasResource(WEEK, fullName));
    course.deleteResource(WEEK, fullName);
  }

  @Test
  public void tokenOnAttachments() {

    String fullName = "BasicSelectionImage";
    String attachment = "google.png";

    new MoodleLoginPage(context).load().logon("teacher", "``````");
    MoodleCoursePage course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);
    course.addItem(WEEK, fullName, attachment);

    assertTrue(course.hasResource(WEEK, attachment));
    String contentUrl = course.clickResource(WEEK, attachment).getContentUrl();
    assertTrue(contentUrl.contains("token=teacher"));
    course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);
    course.deleteResource(WEEK, attachment);
  }

  @Test
  public void externalLinkViewer() {
    String fullName = "ExternalLink";
    String attachment = "http://dev.equella.com/";

    new MoodleLoginPage(context).load().logon("teacher", "``````");
    MoodleCoursePage course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);
    course.addItem(WEEK, fullName, attachment);
    assertTrue(course.hasResource(WEEK, attachment));

    MoodleResourcePage resourcePage = course.clickResource(WEEK, attachment);
    assertFalse(resourcePage.isUsingExternalUrlViewer());
    course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);

    MoodleEditResourcePage resource = course.editResource(WEEK, attachment);
    resource.setUrl(resource.getUrl() + "&.vi=externalLinkViewer");
    resource.setName(context.getFullName(fullName));
    course = resource.submit();

    course.hasResource(WEEK, context.getFullName(fullName));
    resourcePage = course.clickResource(WEEK, context.getFullName(fullName));

    assertTrue(resourcePage.isUsingExternalUrlViewer());

    course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);
    course.deleteResource(WEEK, context.getFullName(fullName));
  }

  @Test
  public void externalLinkPointsToItem() {
    String fullName = "ExternalLink";
    String attachment = "http://dev.equella.com/";

    new MoodleLoginPage(context).load().logon("teacher", "``````");
    MoodleCoursePage course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);
    course.addItem(WEEK, fullName, attachment);
    assertTrue(course.hasResource(WEEK, attachment));
    MoodleEditResourcePage resource = course.editResource(WEEK, attachment);
    resource.setName(context.getFullName(fullName));

    assertFalse(resource.getUrl().contains("google"));
    resource.submit();
  }

  @Test
  public void itemWithDRM() {
    // DTEC 14601
    String terms = "Agree to these terms if you ever want to see your item again";
    String fullName = "Basic DRM Item";
    new MoodleLoginPage(context).load().logon("teacher", "``````");
    MoodleCoursePage course = new MoodleIndexPage(context).load().clickCourse(COURSE_NAME);
    course.setEditing(true);
    course.addItemFromSearchResult(WEEK, fullName);
    assertTrue(course.hasResource(WEEK, fullName));

    MoodleResourcePage resource = course.clickResource(WEEK, fullName);
    DRMAgreementPage drmPage = resource.switchToItem(new DRMAgreementPage(context));
    assertTrue(drmPage.hasTerms(terms));
    course = drmPage.reject(course);

    assertTrue(course.hasResource(WEEK, fullName));
  }

  @BeforeMethod
  public void checkMoodleUrl() throws Exception {
    if (Check.isEmpty(context.getIntegUrl())) {
      throw new SkipException("Properties for moodle are not set up");
    }
  }

  @Override
  protected void cleanupAfterClass() throws Exception {
    MoodleCoursePage coursePage =
        new MoodleLoginPage(context).load().logon("admin", "admin").clickCourse(COURSE_NAME);
    coursePage.setEditing(true);
    coursePage.deleteAllForWeek(WEEK);
  }
}


text:
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;

namespace Gallio.Runtime.Security
{
    /// <summary>
    /// The Gallio.Runtime.Security namespace contains types for managing permissions
    /// and performing privilege elevation on demand.
    /// </summary>
    [CompilerGenerated]
    class NamespaceDoc
    {
    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Excel.Log;
using ICSharpCode.SharpZipLib.Zip;
using System.Collections;

namespace Excel.Core
{
	public class ZipWorker : IDisposable
	{
		#region Members and Properties

		private byte[] buffer;

		private bool disposed;
		private bool _isCleaned;

		private const string TMP = "TMP_Z";
		private const string FOLDER_xl = "xl";
		private const string FOLDER_worksheets = "worksheets";
		private const string FILE_sharedStrings = "sharedStrings.{0}";
		private const string FILE_styles = "styles.{0}";
		private const string FILE_workbook = "workbook.{0}";
		private const string FILE_sheet = "sheet{0}.{1}";
		private const string FOLDER_rels = "_rels";
		private const string FILE_rels = "workbook.{0}.rels";

		private string _tempPath;
		private string _tempEnv;
		private string _exceptionMessage;
		private string _xlPath;
		private string _format = "xml";

		private bool _isValid;
		//private bool _isBinary12Format;

		/// <summary>
		/// Gets a value indicating whether this instance is valid.
		/// </summary>
		/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
		public bool IsValid
		{
			get { return _isValid; }
		}

		/// <summary>
		/// Gets the temp path for extracted files.
		/// </summary>
		/// <value>The temp path for extracted files.</value>
		public string TempPath
		{
			get { return _tempPath; }
		}

		/// <summary>
		/// Gets the exception message.
		/// </summary>
		/// <value>The exception message.</value>
		public string ExceptionMessage
		{
			get { return _exceptionMessage; }
		}

		#endregion

		public ZipWorker()
		{
			_tempEnv = System.IO.Path.GetTempPath();
		}

		/// <summary>
		/// Extracts the specified zip file stream.
		/// </summary>
		/// <param name="fileStream">The zip file stream.</param>
		/// <returns></returns>
		public bool Extract(Stream fileStream)
		{
			if (null == fileStream) return false;

			CleanFromTemp(false);

			NewTempPath();

			_isValid = true;

			ZipFile zipFile = null;

			try
			{
				zipFile = new ZipFile(fileStream);

				IEnumerator enumerator = zipFile.GetEnumerator();

				while (enumerator.MoveNext())
				{
					ZipEntry entry = (ZipEntry)enumerator.Current;

					ExtractZipEntry(zipFile, entry);
				}
			}
			catch (Exception ex)
			{
				_isValid = false;
				_exceptionMessage = ex.Message;

				CleanFromTemp(true); //true tells CleanFromTemp not to raise an IO Exception if this operation fails. If it did then the real error here would be masked

			}
			finally
			{
				fileStream.Close();

				if (null != zipFile) zipFile.Close();
			}

			return _isValid ? CheckFolderTree() : false;
		}

		/// <summary>
		/// Gets the shared strings stream.
		/// </summary>
		/// <returns></returns>
		public Stream GetSharedStringsStream()
		{
			return GetStream(Path.Combine(_xlPath, string.Format(FILE_sharedStrings, _format)));
		}

		/// <summary>
		/// Gets the styles stream.
		/// </summary>
		/// <returns></returns>
		public Stream GetStylesStream()
		{
			return GetStream(Path.Combine(_xlPath, string.Format(FILE_styles, _format)));
		}

		/// <summary>
		/// Gets the workbook stream.
		/// </summary>
		/// <returns></returns>
		public Stream GetWorkbookStream()
		{
			return GetStream(Path.Combine(_xlPath, string.Format(FILE_workbook, _format)));
		}

		/// <summary>
		/// Gets the worksheet stream.
		/// </summary>
		/// <param name="sheetId">The sheet id.</param>
		/// <returns></returns>
		public Stream GetWorksheetStream(int sheetId)
		{
			return GetStream(Path.Combine(
				Path.Combine(_xlPath, FOLDER_worksheets),
				string.Format(FILE_sheet, sheetId, _format)));
		}

        public Stream GetWorksheetStream(string sheetPath)
        {
			//its possible sheetPath starts with /xl. in this case trim the /xl
	        if (sheetPath.StartsWith("/xl/"))
		        sheetPath = sheetPath.Substring(4);
            return GetStream(Path.Combine(_xlPath, sheetPath));
        }

		/// <summary>
		/// Gets the workbook rels stream.
		/// </summary>
		/// <returns></returns>
		public Stream GetWorkbookRelsStream()
		{
			return GetStream(Path.Combine(_xlPath, Path.Combine(FOLDER_rels, string.Format(FILE_rels, _format))));
		}

		private void CleanFromTemp(bool catchIoError)
		{
			if (string.IsNullOrEmpty(_tempPath)) return;

			_isCleaned = true;

			try
			{
				if (Directory.Exists(_tempPath))
				{
					Directory.Delete(_tempPath, true);
				}
			}
			catch (IOException ex)
			{
				//TODO: minimally add some logging so we know this happened. log4net?
				if (!catchIoError)
					throw;
			}

		}

		private void ExtractZipEntry(ZipFile zipFile, ZipEntry entry)
		{
			if (!entry.IsCompressionMethodSupported() || string.IsNullOrEmpty(entry.Name)) return;

			string tPath = Path.Combine(_tempPath, entry.Name);
			string path = entry.IsDirectory ? tPath : Path.GetDirectoryName(Path.GetFullPath(tPath));

			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
			}

			if (!entry.IsFile) return;

//			try
//			{
				using (FileStream stream = File.Create(tPath))
				{
					if (buffer == null)
					{
						buffer = new byte[0x1000];
					}

					using(Stream inputStream = zipFile.GetInputStream(entry))
					{
						int count;
						while ((count = inputStream.Read(buffer, 0, buffer.Length)) > 0)
						{
							stream.Write(buffer, 0, count);
						}
					}

					stream.Flush();
				}
//			}
//			catch
//			{
//				throw;
//			}
		}

		private void NewTempPath()
		{
		    var tempID = Guid.NewGuid().ToString("N");
            _tempPath = Path.Combine(_tempEnv, TMP + DateTime.Now.ToFileTimeUtc().ToString() + tempID);

			_isCleaned = false;

            LogManager.Log(this).Debug("Using temp path {0}", _tempPath);

			Directory.CreateDirectory(_tempPath);
		}

		private bool CheckFolderTree()
		{
			_xlPath = Path.Combine(_tempPath, FOLDER_xl);

			return Directory.Exists(_xlPath) &&
				Directory.Exists(Path.Combine(_xlPath, FOLDER_worksheets)) &&
				File.Exists(Path.Combine(_xlPath, FILE_workbook)) &&
				File.Exists(Path.Combine(_xlPath, FILE_styles));
		}

		private static Stream GetStream(string filePath)
		{
			if (File.Exists(filePath))
			{
				return File.Open(filePath, FileMode.Open, FileAccess.Read);
			}
			else
			{
				return null;
			}
		}

		#region IDisposable Members

		public void Dispose()
		{
			Dispose(true);

			GC.SuppressFinalize(this);
		}

		private void Dispose(bool disposing)
		{
			// Check to see if Dispose has already been called.
			if (!this.disposed)
			{
				if (disposing)
				{
					if (!_isCleaned)
						CleanFromTemp(false);
				}

				buffer = null;

				disposed = true;
			}
		}

		~ZipWorker()
		{
			Dispose(false);
		}

		#endregion
	}
}


text:
namespace
{

enum Status {
	NoPortsConnected = 0,
	Port0Connected = 1 << 1,
	Port1Connected = 1 << 2,
	StatusGood = Port0Connected | Port1Connected
};

//---------------------------------------------------------------------------

inline Status operator|(const Status &l, const Status &r)
{
	return Status(((int)l | (int)r));
}

//---------------------------------------------------------------------------

inline int operator&(const Status &l)
{
	return int(l);
}

//---------------------------------------------------------------------------

Status getFxStatus(const TRasterFxPort &port0, const TRasterFxPort &port1)
{
	Status status = NoPortsConnected;
	if (port0.isConnected())
		status = status | Port0Connected;
	if (port1.isConnected())
		status = status | Port1Connected;
	return status;
}

//---------------------------------------------------------------------------

void makeRectCoherent(TRectD &rect, const TPointD &pos)
{
	rect -= pos;
	rect.x0 = tfloor(rect.x0);
	rect.y0 = tfloor(rect.y0);
	rect.x1 = tceil(rect.x1);
	rect.y1 = tceil(rect.y1);
	rect += pos;
}
}

//===================================================================

//========================
//    Glow functions
//------------------------

namespace
{
template <typename T>
void fade(TRasterPT<T> ras, double fade, T color) //Why it is not in TRop..??
{
	if (fade <= 0.0)
		return;

	double maxChannelValueD = T::maxChannelValue;

	assert(fade <= 1.0);
	ras->lock();
	for (int j = 0; j < ras->getLy(); j++) {
		T *pix = ras->pixels(j);
		T *endPix = pix + ras->getLx();

		for (; pix < endPix; ++pix) {
			if (pix->m > 0) {
				if (pix->m == T::maxChannelValue) {
					pix->r = troundp(pix->r + fade * (color.r - pix->r));
					pix->g = troundp(pix->g + fade * (color.g - pix->g));
					pix->b = troundp(pix->b + fade * (color.b - pix->b));
					pix->m = troundp(pix->m + fade * (color.m - pix->m));
				} else {
					int val;
					double factor = pix->m / maxChannelValueD;

					val = troundp(pix->r + fade * (color.r * factor - pix->r));
					pix->r = (val > T::maxChannelValue) ? T::maxChannelValue : val;

					val = troundp(pix->g + fade * (color.g * factor - pix->g));
					pix->g = (val > T::maxChannelValue) ? T::maxChannelValue : val;

					val = troundp(pix->b + fade * (color.b * factor - pix->b));
					pix->b = (val > T::maxChannelValue) ? T::maxChannelValue : val;

					val = troundp(pix->m + fade * (color.m * factor - pix->m));
					pix->m = (val > T::maxChannelValue) ? T::maxChannelValue : val;
				}
			}
		}
	}

	ras->unlock();
}
}

//=====================================================================

//=================
//    Glow Fx
//-----------------

class GlowFx : public TBaseRasterFx
{
	FX_DECLARATION(GlowFx)

	TRasterFxPort m_lighted, m_light;
	TDoubleParamP m_value;
	TDoubleParamP m_brightness;
	TDoubleParamP m_fade;
	TPixelParamP m_color;

public:
	GlowFx() : m_value(10.0), m_brightness(100.0), m_color(TPixel::White), m_fade(0.0)
	{
		m_value->setMeasureName("fxLength");
		m_color->enableMatte(true);
		m_value->setValueRange(0, (std::numeric_limits<double>::max)());
		m_brightness->setValueRange(0, (std::numeric_limits<double>::max)());
		m_fade->setValueRange(0.0, 100.0);
		bindParam(this, "value", m_value);
		bindParam(this, "brightness", m_brightness);
		bindParam(this, "color", m_color);
		bindParam(this, "fade", m_fade);

		addInputPort("Light", m_light);
		addInputPort("Source", m_lighted);
	}

	//---------------------------------------------------------------------------

	~GlowFx()
	{
	}

	//---------------------------------------------------------------------------

	bool doGetBBox(double frame, TRectD &bbox, const TRenderSettings &info)
	{
		if (getActiveTimeRegion().contains(frame))
			if (m_light.isConnected()) {
				TRectD b0, b1;
				bool ret = m_light->doGetBBox(frame, b0, info);
				bbox = b0.enlarge(tceil(m_value->getValue(frame)));
				if (m_lighted.isConnected()) {
					ret = ret && m_lighted->doGetBBox(frame, b1, info);
					bbox += b1;
				}
				return ret;
			} else if (m_lighted.isConnected())
				return m_lighted->doGetBBox(frame, bbox, info);

		return false;
	}

	//---------------------------------------------------------------------------

	inline void buildLightRects(const TRectD &tileRect, TRectD &inRect, TRectD &outRect, double blur)
	{
		if (inRect != TConsts::infiniteRectD) //Could be, if the input light is a zerary Fx
			makeRectCoherent(inRect, tileRect.getP00());

		int blurI = tceil(blur);

		//It seems that the TRop::blur does wrong with these (cuts at the borders).
		//I don't know why - they would be best...
		//TRectD blurOutRect((lightRect).enlarge(blurI) * tileRect);
		//lightRect = ((tileRect).enlarge(blurI) * lightRect);

		//So we revert to the sum of the two
		outRect = inRect = ((tileRect).enlarge(blurI) * inRect) + ((inRect).enlarge(blurI) * tileRect);
	}

	//---------------------------------------------------------------------------

	void doCompute(TTile &tile, double frame, const TRenderSettings &ri)
	{
		Status status = getFxStatus(m_light, m_lighted);

		if (status & NoPortsConnected)
			//If no port, just do nothing :)
			return;

		//Calculate source
		if (status & Port1Connected)
			m_lighted->compute(tile, frame, ri);

		//Calculate light
		if (status & Port0Connected) {
			//Init light infos
			TDimension tileSize(tile.getRaster()->getSize());
			TRectD tileRect(tile.m_pos, TDimensionD(tileSize.lx, tileSize.ly));

			double scale = sqrt(fabs(ri.m_affine.det()));
			double blur = m_value->getValue(frame) * scale;

			//Build the light interesting rect
			TRectD lightRect, blurOutRect;
			m_light->getBBox(frame, lightRect, ri);

			buildLightRects(tileRect, lightRect, blurOutRect, blur);

			if ((lightRect.getLx() <= 0) || (lightRect.getLy() <= 0))
				return;
			if ((blurOutRect.getLx() <= 0) || (blurOutRect.getLy() <= 0))
				return;

			//Calculate the light tile
			TTile lightTile;
			TDimension lightSize(tround(lightRect.getLx()), tround(lightRect.getLy()));
			m_light->allocateAndCompute(lightTile, lightRect.getP00(), lightSize, tile.getRaster(), frame, ri);

			//Init glow parameters
			TPixel32 color = m_color->getValue(frame);
			double brightness = m_brightness->getValue(frame) / 100.0;
			double fade = m_fade->getValue(frame) / 100.0;

			//Now, apply the glow

			//First, deal with the fade
			{
				TRasterP light = lightTile.getRaster();
				TRaster32P light32 = light;
				TRaster64P light64 = light;
				if (light32)
					::fade(light32, fade, color);
				else if (light64)
					::fade(light64, fade, toPixel64(color));
				else
					assert(false);
			}

			//Then, build the blur
			TRasterP blurOut;
			if (blur > 0) {
				//Build a temporary output to the blur
				{
					TRasterP light(lightTile.getRaster());

					blurOut = light->create(
						tround(blurOutRect.getLx()),
						tround(blurOutRect.getLy()));

					//Apply the blur. Please note that SSE2 should not be used for now - I've seen it
					//doing strange things to the blur...
					TPointD displacement(lightRect.getP00() - blurOutRect.getP00());
					TRop::blur(blurOut, light, blur, tround(displacement.x), tround(displacement.y), false);
				}
			} else
				blurOut = lightTile.getRaster();

			//Apply the rgbm scale
			TRop::rgbmScale(blurOut, blurOut, 1, 1, 1, brightness);

			//Apply the add
			{
				TRectD interestingRect(tileRect * blurOutRect);

				TRect interestingTileRect(
					tround(interestingRect.x0 - tileRect.x0),
					tround(interestingRect.y0 - tileRect.y0),
					tround(interestingRect.x1 - tileRect.x0) - 1,
					tround(interestingRect.y1 - tileRect.y0) - 1);
				TRect interestingBlurRect(
					tround(interestingRect.x0 - blurOutRect.x0),
					tround(interestingRect.y0 - blurOutRect.y0),
					tround(interestingRect.x1 - blurOutRect.x0) - 1,
					tround(interestingRect.y1 - blurOutRect.y0) - 1);

				if ((interestingTileRect.getLx() <= 0) || (interestingTileRect.getLy() <= 0))
					return;
				if ((interestingBlurRect.getLx() <= 0) || (interestingBlurRect.getLy() <= 0))
					return;

				TRasterP tileInterestRas(tile.getRaster()->extract(interestingTileRect));
				TRasterP blurInterestRas(blurOut->extract(interestingBlurRect));
				TRop::add(blurInterestRas, tileInterestRas, tileInterestRas);
			}
		}
	}

	//---------------------------------------------------------------------------

	virtual void doDryCompute(TRectD &rect,
							  double frame,
							  const TRenderSettings &info)
	{
		Status status = getFxStatus(m_light, m_lighted);
		if (status & NoPortsConnected)
			return;

		if (status & Port1Connected)
			m_lighted->dryCompute(rect, frame, info);

		if (status & Port0Connected) {
			double scale = sqrt(fabs(info.m_affine.det()));
			double blur = m_value->getValue(frame) * scale;

			TRectD lightRect, blurOutRect;
			m_light->getBBox(frame, lightRect, info);

			buildLightRects(rect, lightRect, blurOutRect, blur);

			if ((lightRect.getLx() <= 0) || (lightRect.getLy() <= 0))
				return;
			if ((blurOutRect.getLx() <= 0) || (blurOutRect.getLy() <= 0))
				return;

			m_light->dryCompute(lightRect, frame, info);
		}
	}

	//---------------------------------------------------------------------------

	//Just like the blur
	bool canHandle(const TRenderSettings &info, double frame)
	{
		if (m_light.isConnected())
			return (m_value->getValue(frame) == 0) ? true : isAlmostIsotropic(info.m_affine);

		return true;
	}

	//---------------------------------------------------------------------------

	int getMemoryRequirement(const TRectD &rect, double frame, const TRenderSettings &info)
	{
		double scale = sqrt(fabs(info.m_affine.det()));
		double blur = m_value->getValue(frame) * scale;

		return TRasterFx::memorySize(rect.enlarge(blur), info.m_bpp);
	}

	//---------------------------------------------------------------------------

	TFxPort *getXsheetPort() const
	{
		return getInputPort(1);
	}
};

//==================================================================

FX_PLUGIN_IDENTIFIER(GlowFx, "glowFx")
//==================================================================


text:
Adding Pelican Plugins
######################
:date: 2016-12-02 18:38
:modified: 2016-12-02 18:38
:tags: python, pelican, github
:category: Web publishing
:slug: adding-pelican-plugins
:authors: Josh Morel
:summary: Step by step instructions for adding a plugin or two to your pelican static site
:series: Pelican

Background
----------

I've already written twice about `Pelican <http://docs.getpelican.com>`_ and how to use it to create and style your GitHub Personal Page. I'm going to continue with one more post before moving onto other things.

There's just so much more you can do with it through the smorgasbord of extensibility contained in the `Pelican plugins repo <https://github.com/getpelican/pelican-plugins>`_.

The two plugins I'll be covering here are:

* `series <https://github.com/getpelican/pelican-plugins/tree/master/series>`_: joins separate articles into a linkable series
* `tag cloud <https://github.com/getpelican/pelican-plugins/tree/master/tag_cloud>`_: presents article tags as a cloud of links, proportional in size to the number of times the tag is used

Installing
----------

The GitHub readme suggests cloning the repo and adding the path to your **pelicanconf.py** file. I'm doing something similar in principle but different in practice. I've made the repo a submodule of my source repo. This essentially clones it while also making it simple to reference no matter the device or platform I may be using.

.. code-block:: console

   cd /path/to/source
   git submodule add https://github.com/getpelican/pelican-plugins

Because the pelican-plugins repo itself is full of submodules, a second git command is required (there is no ``add --recursive``, at least not yet).

.. code-block:: console

   git submodule update --init --recursive

You should now have all the plugins you will ever need in the **pelican-plugins** sub-directory of your source repo. For more on working with submodules in your project see: https://git-scm.com/book/en/v2/Git-Tools-Submodules

Adding Plugins
--------------

Update the **pelicanconf.py** file with the following two lines.

.. code-block:: python

   PLUGIN_PATHS = ['pelican-plugins']
   PLUGINS = ['series', 'tag_cloud']

Of course, list only those specific plugins you want. How the plugins work is dependent on the templates and therefore the theme you have chosen. If your following along exactly you have **pelican-bootstrap3** which works nicely with both the **series** and **tag_cloud** plugins. If the plugin you want doesn't work with the theme you've adopted you will need to add custom `Jinja2 <http://jinja.pocoo.org/docs/dev/>`_ templates.

Plugins Example 1 - series
--------------------------

This plugin makes your articles part of a series. How this is presented is largely dependent on the pelican theme you are using. Currently, I'm using pelican-bootstrap3 which adds a nice element at the bottom of the article listing all previous and next articles in the series.

All you need to do is add the ``:series:`` element to your article metadata, for example:

.. code-block:: restructuredtext

   :series:  Pelican

The order is based on the article's ``:date:`` metadata but can be overridden using the ``:series_index:`` metadata element.

Plugins Example 2 - tag_cloud
-----------------------------

This plugin will create a "tag cloud" which provides a means to link articles by the ``:tags:`` metadata. The size of each link is presented in proportion to the number of articles with that tag.

By default in pelican-bootstrap3, the tag cloud is displayed as a list on the right sidebar.

To benefit simply add a comma-separated list of tags to each article's metadata, for example:

.. code-block:: restructuredtext

   :tags:  python, github, pelican

Next Steps
----------

This will be last article on Pelican for awhile. There is still much to explore in both creating and visiting Pelican sites but it's time to move on to covering something else.


text:
"""
These tests exposes lower level functions than needed -- see tests_multiple_queries for simpler constructions
using glm_target
"""
import numpy as np
from scipy.stats import norm as ndist

import regreg.api as rr

from ...tests.flags import SMALL_SAMPLES, SET_SEED
from ...tests.decorators import (wait_for_return_value,
                                        set_seed_iftrue,
                                        set_sampling_params_iftrue,
                                        register_report)
from ...tests.instance import logistic_instance
import selection.tests.reports as reports

from ..api import (randomization,
                   multiple_queries,
                   pairs_bootstrap_glm,
                   glm_group_lasso,
                   glm_greedy_step,
                   pairs_inactive_score_glm)
from ..glm import bootstrap_cov
from ...distributions.discrete_family import discrete_family
from ...sampling.langevin import projected_langevin
from ..target import reconstruct_internal

@register_report(['pvalue', 'active'])
@set_sampling_params_iftrue(SMALL_SAMPLES, ndraw=10, burnin=10)
@set_seed_iftrue(SET_SEED)
@wait_for_return_value()
def test_overall_null_two_queries(ndraw=10000, burnin=2000, nsim=None): # nsim needed for decorator
    s, n, p = 5, 200, 20

    randomizer = randomization.laplace((p,), scale=0.5)
    X, y, beta, _ = logistic_instance(n=n, p=p, s=s, rho=0.1, signal=7)

    nonzero = np.where(beta)[0]
    lam_frac = 1.

    loss = rr.glm.logistic(X, y)
    epsilon = 1.

    lam = lam_frac * np.mean(np.fabs(np.dot(X.T, np.random.binomial(1, 1. / 2, (n, 10000)))).max(0))
    W = np.ones(p)*lam
    W += np.arange(p) / 200
    W[0] = 0 # use at least some unpenalized
    penalty = rr.group_lasso(np.arange(p),
                             weights=dict(zip(np.arange(p), W)), lagrange=1.)
    # first randomization

    M_est1 = glm_group_lasso(loss, epsilon, penalty, randomizer)
    M_est1.solve()
    bootstrap_score1 = M_est1.setup_sampler()

    # second randomization -- a greedy step from LASSO

    active = M_est1.selection_variable['variables']
    inactive = ~active
    inactive_randomizer = randomization.laplace((inactive.sum(),), scale=0.5)

    step = glm_greedy_step(loss,
                           penalty,
                           active,
                           inactive,
                           inactive_randomizer)
    step.solve()
    bootstrap_score2 = step.setup_sampler()

    # we take target to be union of two active sets

    active = M_est1.selection_variable['variables'] + step.selection_variable['variables']

    if set(nonzero).issubset(np.nonzero(active)[0]):
        boot_target, target_observed = pairs_bootstrap_glm(loss, active)

        # target are all true null coefficients selected

        sampler = lambda : np.random.choice(n, size=(n,), replace=True)
        target_cov, cov1, cov2 = bootstrap_cov(sampler, boot_target, cross_terms=(bootstrap_score1, bootstrap_score2))

        active_set = np.nonzero(active)[0]
        inactive_selected = I = [i for i in np.arange(active_set.shape[0]) if active_set[i] not in nonzero]

        if not I:
            return None

        # is it enough only to bootstrap the inactive ones?
        # seems so...

        A1, b1 = M_est1.linear_decomposition(cov1[I], target_cov[I][:,I], target_observed[I])
        A2, b2 = step.linear_decomposition(cov2[I], target_cov[I][:,I], target_observed[I])

        target_inv_cov = np.linalg.inv(target_cov[I][:,I])

        initial_state = np.hstack([target_observed[I],
                                   M_est1.observed_opt_state,
                                   step.observed_opt_state])

        ntarget = len(I)
        target_slice = slice(0, ntarget)
        opt_slice1 = slice(ntarget, p + ntarget)
        opt_slice2 = slice(p + ntarget, 2*p + ntarget)

        def target_gradient(state):
            # with many samplers, we will add up the `target_slice` component
            # many target_grads
            # and only once do the Gaussian addition of full_grad

            target = state[target_slice]
            opt_state1 = state[opt_slice1]
            opt_state2 = state[opt_slice2]

            opt_linear1 = M_est1.opt_transform[0]
            arg1 = reconstruct_internal(target, (A1, b1)); grad1 = M_est1.grad_log_density(arg1, opt_state1)

            opt_linear2 = step.opt_transform[0]
            arg2 = reconstruct_internal(target, (A2, b2)); grad2 = step.grad_log_density(arg2, opt_state2)

            full_grad = np.zeros_like(state)
            full_grad[opt_slice1] = -opt_linear1.T.dot(grad1)
            full_grad[opt_slice2] = -opt_linear2.T.dot(grad2)
            full_grad[target_slice] -= A1.T.dot(grad1) + A2.T.dot(grad2)
            full_grad[target_slice] -= target_inv_cov.dot(target)

            return full_grad

        def target_projection(state):
            opt_state1 = state[opt_slice1]
            state[opt_slice1] = M_est1.projection(opt_state1)
            opt_state2 = state[opt_slice2]
            state[opt_slice2] = step.projection(opt_state2)
            return state

        target_langevin = projected_langevin(initial_state,
                                             target_gradient,
                                             target_projection,
                                             .5 / (2*p + 1))

        samples = []
        for i in range(ndraw + burnin):
            target_langevin.next()
            if i >= burnin:
                samples.append(target_langevin.state[target_slice].copy())

        test_stat = lambda x: np.linalg.norm(x)
        observed = test_stat(target_observed[I])
        sample_test_stat = np.array([test_stat(x) for x in samples])

        family = discrete_family(sample_test_stat, np.ones_like(sample_test_stat))
        pval = family.ccdf(0, observed)
        return pval, False


text:
package com.intellij.diff.tools.util;

import com.intellij.diff.util.DiffUtil;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionToolbar;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.ui.Divider;
import com.intellij.openapi.ui.Splitter;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.GridBag;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.CalledInAwt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;
import java.util.List;

public class DiffSplitter extends Splitter {
  @Nullable private Painter myPainter;
  @Nullable private AnAction myTopAction;
  @Nullable private AnAction myBottomAction;

  public DiffSplitter() {
    setDividerWidth(JBUI.scale(30));
  }

  @Override
  protected Divider createDivider() {
    return new DividerImpl() {
      @Override
      public void setOrientation(boolean isVerticalSplit) {
        removeAll();
        setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));

        List<JComponent> actionComponents = ContainerUtil.list(createActionComponent(myTopAction),
                                                               createActionComponent(myBottomAction));
        List<JComponent> syncComponents = DiffUtil.createSyncHeightComponents(actionComponents);

        GridBag bag = new GridBag();

        if (syncComponents.get(0) != null) {
          add(syncComponents.get(0), bag.nextLine());
          add(Box.createVerticalStrut(JBUI.scale(20)), bag.nextLine());
        }

        add(new JLabel(AllIcons.General.SplitGlueH), bag.nextLine());

        if (syncComponents.get(1) != null) {
          add(Box.createVerticalStrut(JBUI.scale(20)), bag.nextLine());
          add(syncComponents.get(1), bag.nextLine());
        }

        revalidate();
        repaint();
      }

      @Override
      protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (myPainter != null) myPainter.paint(g, this);
      }
    };
  }

  public void setTopAction(@Nullable AnAction value) {
    myTopAction = value;
    setOrientation(false);
  }

  public void setBottomAction(@Nullable AnAction value) {
    myBottomAction = value;
    setOrientation(false);
  }

  @CalledInAwt
  public void setPainter(@Nullable Painter painter) {
    myPainter = painter;
  }

  public void repaintDivider() {
    getDivider().repaint();
  }

  public interface Painter {
    void paint(@NotNull Graphics g, @NotNull JComponent divider);
  }

  @Nullable
  private static JComponent createActionComponent(@Nullable final AnAction action) {
    if (action == null) return null;

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("", new DefaultActionGroup(action), true);
    toolbar.setReservePlaceAutoPopupIcon(false);
    toolbar.getComponent().setCursor(Cursor.getDefaultCursor());
    return toolbar.getComponent();
  }
}


text:
Welcome to Failure's documentation!
=====================================

A python `package`_ that provides useful exception (aka failure) additions.

*Contents:*

.. toctree::
   :maxdepth: 3

   api/failure

   examples

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. _package: https://pypi.python.org/pypi/fasteners


text:
package com.sksamuel.elastic4s.examples

import com.sksamuel.elastic4s._
import com.sksamuel.elastic4s.analyzers.{AnalyzerDefinition, CustomAnalyzerDefinition, LengthTokenFilter, NGramTokenizer, PatternAnalyzerDefinition, PatternReplaceTokenFilter, SnowballAnalyzerDefinition, StandardTokenizer, StemmerTokenFilter, UniqueTokenFilter}
import com.sksamuel.elastic4s.mappings.FieldType.{IntegerType, StringType}

// examples of the count API in dot notation
class CreateIndexSqlDsl extends ElasticDsl {

  // create index with no mappings and with shards / replica sets
  create index "tweets" shards 3 replicas 4

  // create index with no mappings but refresh interval set
  create index "tweets" refreshInterval "5s"

  // create index with two mappings, each with two fields
  create index "index" mappings(
    "tweets" as(
      "name" typed StringType,
      "userId" typed IntegerType
      ),
    "users" as(
      "userId" typed IntegerType,
      "username" typed StringType
      )
    )

  // create index with copy_to functionaliy
  create index "tweets" mappings (
    "tweet" as (
      "title" typed StringType index "analyzed" copyTo("meta_data", "article_info")
      )
    )

  val analyzers: Seq[AnalyzerDefinition] = Seq(
    PatternAnalyzerDefinition("patternAnalyzer", regex = "[a-z]"),
    SnowballAnalyzerDefinition("mysnowball", lang = "english", stopwords = Seq("stop1", "stop2", "stop3")),
    CustomAnalyzerDefinition(
      "myAnalyzer1",
      StandardTokenizer("myTokenizer1", 900),
      LengthTokenFilter("myTokenFilter2", 0, max = 10),
      UniqueTokenFilter("myTokenFilter3", onlyOnSamePosition = true),
      StemmerTokenFilter("myFrenchStemmerTokenFilter", lang = "french"),
      PatternReplaceTokenFilter("prTokenFilter", "pattern", "rep")
    ),
    CustomAnalyzerDefinition(
      "myAnalyzer2",
      NGramTokenizer("myTokenizer5", minGram = 4, maxGram = 18, tokenChars = Seq("letter", "punctuation"))
    )
  )

  // create index "users" with custom analyzers
  create index "users" analysis analyzers
}


text:
$LOAD_PATH.unshift File.expand_path(__dir__)
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'simplecov'
SimpleCov.start
require 'rspec'
require 'webmock/rspec'
require 'omniauth'
require 'omniauth-vkontakte'

RSpec.configure do |config|
  config.include WebMock::API
  config.extend  OmniAuth::Test::StrategyMacros, type: :strategy
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
end


text:
import React, { Component } from 'react';
import Debug from 'debug';

import { getCodeEmbedsFromNotebook } from '../../../util/nbUtil';
import { MultiEmbedAnalytics } from '../../../models/insights/multiEmbedAnalytics';
import EventClusterChart from './EventClusterChart';

const debug = Debug('webbox:AnalyticsDashboard');

/**
 * ToDo: Subscribe to all embed ids. How can we handle the permissions? Server-side?
 * Plot all the events on a single graph? Maybe one series for one embed
 * Add test result plots for individual embeds or only one? Or maybe only for those with data
 *
 * @export
 * @class AnalyticsDashboard
 * @extends {Component}
 */
export default class AnalyticsDashboard extends Component {
  constructor(props) {
    super(props);

    this.state = {
      embeds: []
    };

    // Bindings
    this.onChange = this.onChange.bind(this);
  }

  componentWillMount() {
    let embeds = getCodeEmbedsFromNotebook(this.props.notebook);
    embeds = embeds.toArray();

    this.setState({
      embeds: embeds,
      analytics: new MultiEmbedAnalytics(embeds)
    });
    debug('Will mount with following embeds', embeds);
  }

  componentDidMount() {
    // Retrieve inital date and subscribe
    if (this.shouldRender() && this.state.analytics != null) {
      this.state.analytics.on('change', this.onChange);
      this.state.analytics.init();
    }
  }

  componentWillUnmount() {
    // Unsubscribe, ... ...
    if (this.state.analytics != null) {
      this.state.analytics.dispose();
    }
  }

  onChange() {
    this.forceUpdate();
  }

  shouldRender() {
    return window.__USER_DATA__ != null && window.__USER_DATA__.isAnonymous != null && window.__USER_DATA__.isAnonymous === false;
  }

  render() {

    if (this.shouldRender()) {
      let entries = this.state.analytics.getEntries();
      let children = [];

      entries.forEach((value, key) => {
        debug('Adding EventClusterChart for embed %s', key);
        let uniqueUsers = value.userMap.size;
        let metadata = value.metadata != null ? value.metadata : {name: 'Lade Daten...'};
        children.push(<EventClusterChart key={key} series={value.dateClustersToSeries()} />);
        children.push(
Beispiel: {metadata.name} (Events von {uniqueUsers} Benutzern) {key}
);
      });

      if (children.length === 0) {
        children.push(
Das Dokument enthält keine auswertbaren Beispiele.
);
      }

      return (

Statistiken

          {children}

      );
    } else {
      return null;
    }
  }
}


text:
namespace zombye {
    shadow_component::shadow_component(game& game, entity& owner, const glm::mat4& projection) noexcept
    : reflective{game, owner}, projection_{projection} {
        game_.rendering_system().register_component(this);
    }

    shadow_component::~shadow_component() {
        game_.rendering_system().unregister_component(this);
    }

    void shadow_component::register_at_script_engine(game& game) {
        auto& scripting_system = game.scripting_system();

        scripting_system.register_type<shadow_component>("shadow_component");

        scripting_system.register_member_function("entity_impl",
            "shadow_component& add_shadow_component(const glm::mat4& in)",
            +[](entity& owner, const glm::mat4& projection) -> shadow_component& {
                return owner.emplace<shadow_component>(projection);
            });
        scripting_system.register_member_function("entity_impl", "shadow_component@ get_shadow_component()",
            +[](entity& owner) { return owner.component<shadow_component>(); });
    }

    shadow_component::shadow_component(game& game, entity& owner) noexcept
    : reflective{game, owner}, projection_{1.f} {
        game_.rendering_system().register_component(this);
    }
}


text:
package org.jscep.client.inspect;

import java.security.cert.CertStore;

/**
 * Abstract factory for creating CertStoreInspector instances.
 */
public interface CertStoreInspectorFactory {
    /**
     * Inspects the given CertStore to extract an CertStoreInspector instance.
     *

     * This method will inspect the given CertStore with pre-configured
     * selectors to match RA certificates for encryption and verification, plus
     * the issuing CA certificate.
     *

     * If the CertStore only contains a single CA certificate, that certificate
     * will be used for all three roles.
     *
     * @param store
     *            the store to inspect.
     * @return the CertStoreInspector instance.
     */
    CertStoreInspector getInstance(CertStore store);
}


text:
package com.evolveum.midpoint.schema.constants;

import com.evolveum.midpoint.xml.ns._public.common.common_3.AreaCategoryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RelationKindType;
import org.jetbrains.annotations.NotNull;

import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Collection;

import static com.evolveum.midpoint.xml.ns._public.common.common_3.AreaCategoryType.*;
import static java.util.Collections.singletonList;

/**
 * Built-in (hardcoded) relations.
 *
 * Created by honchar.
 */
public enum RelationTypes {

	MEMBER(SchemaConstants.ORG_DEFAULT, "", RelationKindType.MEMBER, null, ADMINISTRATION, ORGANIZATION, SELF_SERVICE),
    MANAGER(SchemaConstants.ORG_MANAGER, "Manager", RelationKindType.MANAGER, singletonList(RelationKindType.MEMBER), ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
    META(SchemaConstants.ORG_META, "Meta", RelationKindType.META, null, POLICY),
    DEPUTY(SchemaConstants.ORG_DEPUTY, "Deputy", RelationKindType.DELEGATION, null /* no values */),
    APPROVER(SchemaConstants.ORG_APPROVER, "Approver", RelationKindType.APPROVER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
    OWNER(SchemaConstants.ORG_OWNER, "Owner", RelationKindType.OWNER, null, ADMINISTRATION, GOVERNANCE, ORGANIZATION, SELF_SERVICE),
    CONSENT(SchemaConstants.ORG_CONSENT, "Consent", RelationKindType.CONSENT, null, DATA_PROTECTION);

    private final QName relation;
    private final String headerLabel;
    private final RelationKindType defaultFor;
    @NotNull private final Collection<RelationKindType> kinds;
    private final AreaCategoryType[] categories;

    RelationTypes(QName relation, String headerLabel, RelationKindType defaultFor, Collection<RelationKindType> additionalKinds, AreaCategoryType... categories) {
        this.relation = relation;
        this.headerLabel = headerLabel;
        this.kinds = new ArrayList<>();
        if (defaultFor != null) {
            kinds.add(defaultFor);
        }
        if (additionalKinds != null) {
            kinds.addAll(additionalKinds);
        }
        this.defaultFor = defaultFor;
        this.categories = categories;
    }

    public QName getRelation() {
        return relation;
    }

    public String getHeaderLabel() {
        return headerLabel;
    }

    public String getLabelKey() {
    	return RelationTypes.class.getSimpleName() + "." + relation.getLocalPart();
    }

    public RelationKindType getDefaultFor() {
        return defaultFor;
    }

    @NotNull
    public Collection<RelationKindType> getKinds() {
        return kinds;
    }

    public AreaCategoryType[] getCategories() {
		return categories;
	}
}