text:
.class synthetic Lcom/android/internal/telephony/uicc/SIMRecords$1;
.super Ljava/lang/Object;
.source "SIMRecords.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/internal/telephony/uicc/SIMRecords;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1008
    name = null
.end annotation

# static fields
.field static final synthetic $SwitchMap$com$android$internal$telephony$uicc$SIMRecords$GetSpnFsmState:[I

# direct methods
.method static constructor <clinit>()V
    .locals 3

    .prologue
    .line 2735
    invoke-static {}, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->values()[Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;

    move-result-object v0

    array-length v0, v0

    new-array v0, v0, [I

    sput-object v0, Lcom/android/internal/telephony/uicc/SIMRecords$1;->$SwitchMap$com$android$internal$telephony$uicc$SIMRecords$GetSpnFsmState:[I

    :try_start_0
    sget-object v0, Lcom/android/internal/telephony/uicc/SIMRecords$1;->$SwitchMap$com$android$internal$telephony$uicc$SIMRecords$GetSpnFsmState:[I

    sget-object v1, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->INIT:Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;

    invoke-virtual {v1}, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->ordinal()I

    move-result v1

    const/4 v2, 0x1

    aput v2, v0, v1
    :try_end_0
    .catch Ljava/lang/NoSuchFieldError; {:try_start_0 .. :try_end_0} :catch_3

    :goto_0
    :try_start_1
    sget-object v0, Lcom/android/internal/telephony/uicc/SIMRecords$1;->$SwitchMap$com$android$internal$telephony$uicc$SIMRecords$GetSpnFsmState:[I

    sget-object v1, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->READ_SPN_3GPP:Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;

    invoke-virtual {v1}, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->ordinal()I

    move-result v1

    const/4 v2, 0x2

    aput v2, v0, v1
    :try_end_1
    .catch Ljava/lang/NoSuchFieldError; {:try_start_1 .. :try_end_1} :catch_2

    :goto_1
    :try_start_2
    sget-object v0, Lcom/android/internal/telephony/uicc/SIMRecords$1;->$SwitchMap$com$android$internal$telephony$uicc$SIMRecords$GetSpnFsmState:[I

    sget-object v1, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->READ_SPN_CPHS:Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;

    invoke-virtual {v1}, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->ordinal()I

    move-result v1

    const/4 v2, 0x3

    aput v2, v0, v1
    :try_end_2
    .catch Ljava/lang/NoSuchFieldError; {:try_start_2 .. :try_end_2} :catch_1

    :goto_2
    :try_start_3
    sget-object v0, Lcom/android/internal/telephony/uicc/SIMRecords$1;->$SwitchMap$com$android$internal$telephony$uicc$SIMRecords$GetSpnFsmState:[I

    sget-object v1, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->READ_SPN_SHORT_CPHS:Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;

    invoke-virtual {v1}, Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->ordinal()I

    move-result v1

    const/4 v2, 0x4

    aput v2, v0, v1
    :try_end_3
    .catch Ljava/lang/NoSuchFieldError; {:try_start_3 .. :try_end_3} :catch_0

    :goto_3
    return-void

    :catch_0
    move-exception v0

    goto :goto_3

    :catch_1
    move-exception v0

    goto :goto_2

    :catch_2
    move-exception v0

    goto :goto_1

    :catch_3
    move-exception v0

    goto :goto_0
.end method


text:
#include "sqliteInt.h"

/*
** Delete a linked list of TriggerStep structures.
*/
void sqliteDeleteTriggerStep(TriggerStep *pTriggerStep){
  while( pTriggerStep ){
    TriggerStep * pTmp = pTriggerStep;
    pTriggerStep = pTriggerStep->pNext;

    if( pTmp->target.dyn ) sqliteFree((char*)pTmp->target.z);
    sqliteExprDelete(pTmp->pWhere);
    sqliteExprListDelete(pTmp->pExprList);
    sqliteSelectDelete(pTmp->pSelect);
    sqliteIdListDelete(pTmp->pIdList);

    sqliteFree(pTmp);
  }
}

/*
** This is called by the parser when it sees a CREATE TRIGGER statement
** up to the point of the BEGIN before the trigger actions.  A Trigger
** structure is generated based on the information available and stored
** in pParse->pNewTrigger.  After the trigger actions have been parsed, the
** sqliteFinishTrigger() function is called to complete the trigger
** construction process.
*/
void sqliteBeginTrigger(
  Parse *pParse,      /* The parse context of the CREATE TRIGGER statement */
  Token *pName,       /* The name of the trigger */
  int tr_tm,          /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
  int op,             /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
  IdList *pColumns,   /* column list if this is an UPDATE OF trigger */
  SrcList *pTableName,/* The name of the table/view the trigger applies to */
  int foreach,        /* One of TK_ROW or TK_STATEMENT */
  Expr *pWhen,        /* WHEN clause */
  int isTemp          /* True if the TEMPORARY keyword is present */
){
  Trigger *nt;
  Table   *tab;
  char *zName = 0;        /* Name of the trigger */
  sqlite *db = pParse->db;
  int iDb;                /* When database to store the trigger in */
  DbFixer sFix;

  /* Check that:
  ** 1. the trigger name does not already exist.
  ** 2. the table (or view) does exist in the same database as the trigger.
  ** 3. that we are not trying to create a trigger on the sqlite_master table
  ** 4. That we are not trying to create an INSTEAD OF trigger on a table.
  ** 5. That we are not trying to create a BEFORE or AFTER trigger on a view.
  */
  if( sqlite_malloc_failed ) goto trigger_cleanup;
  assert( pTableName->nSrc==1 );
  if( db->init.busy
   && sqliteFixInit(&sFix, pParse, db->init.iDb, "trigger", pName)
   && sqliteFixSrcList(&sFix, pTableName)
  ){
    goto trigger_cleanup;
  }
  tab = sqliteSrcListLookup(pParse, pTableName);
  if( !tab ){
    goto trigger_cleanup;
  }
  iDb = isTemp ? 1 : tab->iDb;
  if( iDb>=2 && !db->init.busy ){
    sqliteErrorMsg(pParse, "triggers may not be added to auxiliary "
       "database %s", db->aDb[tab->iDb].zName);
    goto trigger_cleanup;
  }

  zName = sqliteStrNDup(pName->z, pName->n);
  sqliteDequote(zName);
  if( sqliteHashFind(&(db->aDb[iDb].trigHash), zName,pName->n+1) ){
    sqliteErrorMsg(pParse, "trigger %T already exists", pName);
    goto trigger_cleanup;
  }
  if( sqliteStrNICmp(tab->zName, "sqlite_", 7)==0 ){
    sqliteErrorMsg(pParse, "cannot create trigger on system table");
    pParse->nErr++;
    goto trigger_cleanup;
  }
  if( tab->pSelect && tr_tm != TK_INSTEAD ){
    sqliteErrorMsg(pParse, "cannot create %s trigger on view: %S",
        (tr_tm == TK_BEFORE)?"BEFORE":"AFTER", pTableName, 0);
    goto trigger_cleanup;
  }
  if( !tab->pSelect && tr_tm == TK_INSTEAD ){
    sqliteErrorMsg(pParse, "cannot create INSTEAD OF"
        " trigger on table: %S", pTableName, 0);
    goto trigger_cleanup;
  }
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code = SQLITE_CREATE_TRIGGER;
    const char *zDb = db->aDb[tab->iDb].zName;
    const char *zDbTrig = isTemp ? db->aDb[1].zName : zDb;
    if( tab->iDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
    if( sqliteAuthCheck(pParse, code, zName, tab->zName, zDbTrig) ){
      goto trigger_cleanup;
    }
    if( sqliteAuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(tab->iDb), 0, zDb)){
      goto trigger_cleanup;
    }
  }
#endif

  /* INSTEAD OF triggers can only appear on views and BEGIN triggers
  ** cannot appear on views.  So we might as well translate every
  ** INSTEAD OF trigger into a BEFORE trigger.  It simplifies code
  ** elsewhere.
  */
  if (tr_tm == TK_INSTEAD){
    tr_tm = TK_BEFORE;
  }

  /* Build the Trigger object */
  nt = (Trigger*)sqliteMalloc(sizeof(Trigger));
  if( nt==0 ) goto trigger_cleanup;
  nt->name = zName;
  zName = 0;
  nt->table = sqliteStrDup(pTableName->a[0].zName);
  if( sqlite_malloc_failed ) goto trigger_cleanup;
  nt->iDb = iDb;
  nt->iTabDb = tab->iDb;
  nt->op = op;
  nt->tr_tm = tr_tm;
  nt->pWhen = sqliteExprDup(pWhen);
  nt->pColumns = sqliteIdListDup(pColumns);
  nt->foreach = foreach;
  sqliteTokenCopy(&nt->nameToken,pName);
  assert( pParse->pNewTrigger==0 );
  pParse->pNewTrigger = nt;

trigger_cleanup:
  sqliteFree(zName);
  sqliteSrcListDelete(pTableName);
  sqliteIdListDelete(pColumns);
  sqliteExprDelete(pWhen);
}

/*
** This routine is called after all of the trigger actions have been parsed
** in order to complete the process of building the trigger.
*/
void sqliteFinishTrigger(
  Parse *pParse,          /* Parser context */
  TriggerStep *pStepList, /* The triggered program */
  Token *pAll             /* Token that describes the complete CREATE TRIGGER */
){
  Trigger *nt = 0;          /* The trigger whose construction is finishing up */
  sqlite *db = pParse->db;  /* The database */
  DbFixer sFix;

  if( pParse->nErr || pParse->pNewTrigger==0 ) goto triggerfinish_cleanup;
  nt = pParse->pNewTrigger;
  pParse->pNewTrigger = 0;
  nt->step_list = pStepList;
  while( pStepList ){
    pStepList->pTrig = nt;
    pStepList = pStepList->pNext;
  }
  if( sqliteFixInit(&sFix, pParse, nt->iDb, "trigger", &nt->nameToken)
          && sqliteFixTriggerStep(&sFix, nt->step_list) ){
    goto triggerfinish_cleanup;
  }

  /* if we are not initializing, and this trigger is not on a TEMP table,
  ** build the sqlite_master entry
  */
  if( !db->init.busy ){
    static VdbeOpList insertTrig[] = {
      { OP_NewRecno,   0, 0,  0          },
      { OP_String,     0, 0,  "trigger"  },
      { OP_String,     0, 0,  0          },  /* 2: trigger name */
      { OP_String,     0, 0,  0          },  /* 3: table name */
      { OP_Integer,    0, 0,  0          },
      { OP_String,     0, 0,  0          },  /* 5: SQL */
      { OP_MakeRecord, 5, 0,  0          },
      { OP_PutIntKey,  0, 0,  0          },
    };
    int addr;
    Vdbe *v;

    /* Make an entry in the sqlite_master table */
    v = sqliteGetVdbe(pParse);
    if( v==0 ) goto triggerfinish_cleanup;
    sqliteBeginWriteOperation(pParse, 0, 0);
    sqliteOpenMasterTable(v, nt->iDb);
    addr = sqliteVdbeAddOpList(v, ArraySize(insertTrig), insertTrig);
    sqliteVdbeChangeP3(v, addr+2, nt->name, 0);
    sqliteVdbeChangeP3(v, addr+3, nt->table, 0);
    sqliteVdbeChangeP3(v, addr+5, pAll->z, pAll->n);
    if( nt->iDb==0 ){
      sqliteChangeCookie(db, v);
    }
    sqliteVdbeAddOp(v, OP_Close, 0, 0);
    sqliteEndWriteOperation(pParse);
  }

  if( !pParse->explain ){
    Table *pTab;
    sqliteHashInsert(&db->aDb[nt->iDb].trigHash,
                     nt->name, strlen(nt->name)+1, nt);
    pTab = sqliteLocateTable(pParse, nt->table, db->aDb[nt->iTabDb].zName);
    assert( pTab!=0 );
    nt->pNext = pTab->pTrigger;
    pTab->pTrigger = nt;
    nt = 0;
  }

triggerfinish_cleanup:
  sqliteDeleteTrigger(nt);
  sqliteDeleteTrigger(pParse->pNewTrigger);
  pParse->pNewTrigger = 0;
  sqliteDeleteTriggerStep(pStepList);
}

/*
** Make a copy of all components of the given trigger step.  This has
** the effect of copying all Expr.token.z values into memory obtained
** from sqliteMalloc().  As initially created, the Expr.token.z values
** all point to the input string that was fed to the parser.  But that
** string is ephemeral - it will go away as soon as the sqlite_exec()
** call that started the parser exits.  This routine makes a persistent
** copy of all the Expr.token.z strings so that the TriggerStep structure
** will be valid even after the sqlite_exec() call returns.
*/
static void sqlitePersistTriggerStep(TriggerStep *p){
  if( p->target.z ){
    p->target.z = sqliteStrNDup(p->target.z, p->target.n);
    p->target.dyn = 1;
  }
  if( p->pSelect ){
    Select *pNew = sqliteSelectDup(p->pSelect);
    sqliteSelectDelete(p->pSelect);
    p->pSelect = pNew;
  }
  if( p->pWhere ){
    Expr *pNew = sqliteExprDup(p->pWhere);
    sqliteExprDelete(p->pWhere);
    p->pWhere = pNew;
  }
  if( p->pExprList ){
    ExprList *pNew = sqliteExprListDup(p->pExprList);
    sqliteExprListDelete(p->pExprList);
    p->pExprList = pNew;
  }
  if( p->pIdList ){
    IdList *pNew = sqliteIdListDup(p->pIdList);
    sqliteIdListDelete(p->pIdList);
    p->pIdList = pNew;
  }
}

/*
** Turn a SELECT statement (that the pSelect parameter points to) into
** a trigger step.  Return a pointer to a TriggerStep structure.
**
** The parser calls this routine when it finds a SELECT statement in
** body of a TRIGGER.
*/
TriggerStep *sqliteTriggerSelectStep(Select *pSelect){
  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
  if( pTriggerStep==0 ) return 0;

  pTriggerStep->op = TK_SELECT;
  pTriggerStep->pSelect = pSelect;
  pTriggerStep->orconf = OE_Default;
  sqlitePersistTriggerStep(pTriggerStep);

  return pTriggerStep;
}

/*
** Build a trigger step out of an INSERT statement.  Return a pointer
** to the new trigger step.
**
** The parser calls this routine when it sees an INSERT inside the
** body of a trigger.
*/
TriggerStep *sqliteTriggerInsertStep(
  Token *pTableName,  /* Name of the table into which we insert */
  IdList *pColumn,    /* List of columns in pTableName to insert into */
  ExprList *pEList,   /* The VALUE clause: a list of values to be inserted */
  Select *pSelect,    /* A SELECT statement that supplies values */
  int orconf          /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
){
  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
  if( pTriggerStep==0 ) return 0;

  assert(pEList == 0 || pSelect == 0);
  assert(pEList != 0 || pSelect != 0);

  pTriggerStep->op = TK_INSERT;
  pTriggerStep->pSelect = pSelect;
  pTriggerStep->target  = *pTableName;
  pTriggerStep->pIdList = pColumn;
  pTriggerStep->pExprList = pEList;
  pTriggerStep->orconf = orconf;
  sqlitePersistTriggerStep(pTriggerStep);

  return pTriggerStep;
}

/*
** Construct a trigger step that implements an UPDATE statement and return
** a pointer to that trigger step.  The parser calls this routine when it
** sees an UPDATE statement inside the body of a CREATE TRIGGER.
*/
TriggerStep *sqliteTriggerUpdateStep(
  Token *pTableName,   /* Name of the table to be updated */
  ExprList *pEList,    /* The SET clause: list of column and new values */
  Expr *pWhere,        /* The WHERE clause */
  int orconf           /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
){
  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
  if( pTriggerStep==0 ) return 0;

  pTriggerStep->op = TK_UPDATE;
  pTriggerStep->target  = *pTableName;
  pTriggerStep->pExprList = pEList;
  pTriggerStep->pWhere = pWhere;
  pTriggerStep->orconf = orconf;
  sqlitePersistTriggerStep(pTriggerStep);

  return pTriggerStep;
}

/*
** Construct a trigger step that implements a DELETE statement and return
** a pointer to that trigger step.  The parser calls this routine when it
** sees a DELETE statement inside the body of a CREATE TRIGGER.
*/
TriggerStep *sqliteTriggerDeleteStep(Token *pTableName, Expr *pWhere){
  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));
  if( pTriggerStep==0 ) return 0;

  pTriggerStep->op = TK_DELETE;
  pTriggerStep->target  = *pTableName;
  pTriggerStep->pWhere = pWhere;
  pTriggerStep->orconf = OE_Default;
  sqlitePersistTriggerStep(pTriggerStep);

  return pTriggerStep;
}

/*
** Recursively delete a Trigger structure
*/
void sqliteDeleteTrigger(Trigger *pTrigger){
  if( pTrigger==0 ) return;
  sqliteDeleteTriggerStep(pTrigger->step_list);
  sqliteFree(pTrigger->name);
  sqliteFree(pTrigger->table);
  sqliteExprDelete(pTrigger->pWhen);
  sqliteIdListDelete(pTrigger->pColumns);
  if( pTrigger->nameToken.dyn ) sqliteFree((char*)pTrigger->nameToken.z);
  sqliteFree(pTrigger);
}

/*
 * This function is called to drop a trigger from the database schema.
 *
 * This may be called directly from the parser and therefore identifies
 * the trigger by name.  The sqliteDropTriggerPtr() routine does the
 * same job as this routine except it take a spointer to the trigger
 * instead of the trigger name.
 *
 * Note that this function does not delete the trigger entirely. Instead it
 * removes it from the internal schema and places it in the trigDrop hash
 * table. This is so that the trigger can be restored into the database schema
 * if the transaction is rolled back.
 */
void sqliteDropTrigger(Parse *pParse, SrcList *pName){
  Trigger *pTrigger;
  int i;
  const char *zDb;
  const char *zName;
  int nName;
  sqlite *db = pParse->db;

  if( sqlite_malloc_failed ) goto drop_trigger_cleanup;
  assert( pName->nSrc==1 );
  zDb = pName->a[0].zDatabase;
  zName = pName->a[0].zName;
  nName = strlen(zName);
  for(i=0; i<db->nDb; i++){
    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */
    if( zDb && sqliteStrICmp(db->aDb[j].zName, zDb) ) continue;
    pTrigger = sqliteHashFind(&(db->aDb[j].trigHash), zName, nName+1);
    if( pTrigger ) break;
  }
  if( !pTrigger ){
    sqliteErrorMsg(pParse, "no such trigger: %S", pName, 0);
    goto drop_trigger_cleanup;
  }
  sqliteDropTriggerPtr(pParse, pTrigger, 0);

drop_trigger_cleanup:
  sqliteSrcListDelete(pName);
}

/*
** Drop a trigger given a pointer to that trigger.  If nested is false,
** then also generate code to remove the trigger from the SQLITE_MASTER
** table.
*/
void sqliteDropTriggerPtr(Parse *pParse, Trigger *pTrigger, int nested){
  Table   *pTable;
  Vdbe *v;
  sqlite *db = pParse->db;

  assert( pTrigger->iDb<db->nDb );
  if( pTrigger->iDb>=2 ){
    sqliteErrorMsg(pParse, "triggers may not be removed from "
       "auxiliary database %s", db->aDb[pTrigger->iDb].zName);
    return;
  }
  pTable = sqliteFindTable(db, pTrigger->table,db->aDb[pTrigger->iTabDb].zName);
  assert(pTable);
  assert( pTable->iDb==pTrigger->iDb || pTrigger->iDb==1 );
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code = SQLITE_DROP_TRIGGER;
    const char *zDb = db->aDb[pTrigger->iDb].zName;
    const char *zTab = SCHEMA_TABLE(pTrigger->iDb);
    if( pTrigger->iDb ) code = SQLITE_DROP_TEMP_TRIGGER;
    if( sqliteAuthCheck(pParse, code, pTrigger->name, pTable->zName, zDb) ||
      sqliteAuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
      return;
    }
  }
#endif

  /* Generate code to destroy the database record of the trigger.
  */
  if( pTable!=0 && !nested && (v = sqliteGetVdbe(pParse))!=0 ){
    int base;
    static VdbeOpList dropTrigger[] = {
      { OP_Rewind,     0, ADDR(9),  0},
      { OP_String,     0, 0,        0}, /* 1 */
      { OP_Column,     0, 1,        0},
      { OP_Ne,         0, ADDR(8),  0},
      { OP_String,     0, 0,        "trigger"},
      { OP_Column,     0, 0,        0},
      { OP_Ne,         0, ADDR(8),  0},
      { OP_Delete,     0, 0,        0},
      { OP_Next,       0, ADDR(1),  0}, /* 8 */
    };

    sqliteBeginWriteOperation(pParse, 0, 0);
    sqliteOpenMasterTable(v, pTrigger->iDb);
    base = sqliteVdbeAddOpList(v,  ArraySize(dropTrigger), dropTrigger);
    sqliteVdbeChangeP3(v, base+1, pTrigger->name, 0);
    if( pTrigger->iDb==0 ){
      sqliteChangeCookie(db, v);
    }
    sqliteVdbeAddOp(v, OP_Close, 0, 0);
    sqliteEndWriteOperation(pParse);
  }

  /*
   * If this is not an "explain", then delete the trigger structure.
   */
  if( !pParse->explain ){
    const char *zName = pTrigger->name;
    int nName = strlen(zName);
    if( pTable->pTrigger == pTrigger ){
      pTable->pTrigger = pTrigger->pNext;
    }else{
      Trigger *cc = pTable->pTrigger;
      while( cc ){
        if( cc->pNext == pTrigger ){
          cc->pNext = cc->pNext->pNext;
          break;
        }
        cc = cc->pNext;
      }
      assert(cc);
    }
    sqliteHashInsert(&(db->aDb[pTrigger->iDb].trigHash), zName, nName+1, 0);
    sqliteDeleteTrigger(pTrigger);
  }
}

/*
** pEList is the SET clause of an UPDATE statement.  Each entry
** in pEList is of the format <id>=<expr>.  If any of the entries
** in pEList have an <id> which matches an identifier in pIdList,
** then return TRUE.  If pIdList==NULL, then it is considered a
** wildcard that matches anything.  Likewise if pEList==NULL then
** it matches anything so always return true.  Return false only
** if there is no match.
*/
static int checkColumnOverLap(IdList *pIdList, ExprList *pEList){
  int e;
  if( !pIdList || !pEList ) return 1;
  for(e=0; e<pEList->nExpr; e++){
    if( sqliteIdListIndex(pIdList, pEList->a[e].zName)>=0 ) return 1;
  }
  return 0;
}

/* A global variable that is TRUE if we should always set up temp tables for
 * for triggers, even if there are no triggers to code. This is used to test
 * how much overhead the triggers algorithm is causing.
 *
 * This flag can be set or cleared using the "trigger_overhead_test" pragma.
 * The pragma is not documented since it is not really part of the interface
 * to SQLite, just the test procedure.
*/
int always_code_trigger_setup = 0;

/*
 * Returns true if a trigger matching op, tr_tm and foreach that is NOT already
 * on the Parse objects trigger-stack (to prevent recursive trigger firing) is
 * found in the list specified as pTrigger.
 */
int sqliteTriggersExist(
  Parse *pParse,          /* Used to check for recursive triggers */
  Trigger *pTrigger,      /* A list of triggers associated with a table */
  int op,                 /* one of TK_DELETE, TK_INSERT, TK_UPDATE */
  int tr_tm,              /* one of TK_BEFORE, TK_AFTER */
  int foreach,            /* one of TK_ROW or TK_STATEMENT */
  ExprList *pChanges      /* Columns that change in an UPDATE statement */
){
  Trigger * pTriggerCursor;

  if( always_code_trigger_setup ){
    return 1;
  }

  pTriggerCursor = pTrigger;
  while( pTriggerCursor ){
    if( pTriggerCursor->op == op &&
	pTriggerCursor->tr_tm == tr_tm &&
	pTriggerCursor->foreach == foreach &&
	checkColumnOverLap(pTriggerCursor->pColumns, pChanges) ){
      TriggerStack * ss;
      ss = pParse->trigStack;
      while( ss && ss->pTrigger != pTrigger ){
	ss = ss->pNext;
      }
      if( !ss )return 1;
    }
    pTriggerCursor = pTriggerCursor->pNext;
  }

  return 0;
}

/*
** Convert the pStep->target token into a SrcList and return a pointer
** to that SrcList.
**
** This routine adds a specific database name, if needed, to the target when
** forming the SrcList.  This prevents a trigger in one database from
** referring to a target in another database.  An exception is when the
** trigger is in TEMP in which case it can refer to any other database it
** wants.
*/
static SrcList *targetSrcList(
  Parse *pParse,       /* The parsing context */
  TriggerStep *pStep   /* The trigger containing the target token */
){
  Token sDb;           /* Dummy database name token */
  int iDb;             /* Index of the database to use */
  SrcList *pSrc;       /* SrcList to be returned */

  iDb = pStep->pTrig->iDb;
  if( iDb==0 || iDb>=2 ){
    assert( iDb<pParse->db->nDb );
    sDb.z = pParse->db->aDb[iDb].zName;
    sDb.n = strlen(sDb.z);
    pSrc = sqliteSrcListAppend(0, &sDb, &pStep->target);
  } else {
    pSrc = sqliteSrcListAppend(0, &pStep->target, 0);
  }
  return pSrc;
}

/*
** Generate VDBE code for zero or more statements inside the body of a
** trigger.
*/
static int codeTriggerProgram(
  Parse *pParse,            /* The parser context */
  TriggerStep *pStepList,   /* List of statements inside the trigger body */
  int orconfin              /* Conflict algorithm. (OE_Abort, etc) */
){
  TriggerStep * pTriggerStep = pStepList;
  int orconf;

  while( pTriggerStep ){
    int saveNTab = pParse->nTab;

    orconf = (orconfin == OE_Default)?pTriggerStep->orconf:orconfin;
    pParse->trigStack->orconf = orconf;
    switch( pTriggerStep->op ){
      case TK_SELECT: {
	Select * ss = sqliteSelectDup(pTriggerStep->pSelect);
	assert(ss);
	assert(ss->pSrc);
	sqliteSelect(pParse, ss, SRT_Discard, 0, 0, 0, 0);
	sqliteSelectDelete(ss);
	break;
      }
      case TK_UPDATE: {
        SrcList *pSrc;
        pSrc = targetSrcList(pParse, pTriggerStep);
        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPush, 0, 0);
        sqliteUpdate(pParse, pSrc,
		sqliteExprListDup(pTriggerStep->pExprList),
		sqliteExprDup(pTriggerStep->pWhere), orconf);
        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPop, 0, 0);
        break;
      }
      case TK_INSERT: {
        SrcList *pSrc;
        pSrc = targetSrcList(pParse, pTriggerStep);
        sqliteInsert(pParse, pSrc,
          sqliteExprListDup(pTriggerStep->pExprList),
          sqliteSelectDup(pTriggerStep->pSelect),
          sqliteIdListDup(pTriggerStep->pIdList), orconf);
        break;
      }
      case TK_DELETE: {
        SrcList *pSrc;
        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPush, 0, 0);
        pSrc = targetSrcList(pParse, pTriggerStep);
        sqliteDeleteFrom(pParse, pSrc, sqliteExprDup(pTriggerStep->pWhere));
        sqliteVdbeAddOp(pParse->pVdbe, OP_ListPop, 0, 0);
        break;
      }
      default:
        assert(0);
    }
    pParse->nTab = saveNTab;
    pTriggerStep = pTriggerStep->pNext;
  }

  return 0;
}

/*
** This is called to code FOR EACH ROW triggers.
**
** When the code that this function generates is executed, the following
** must be true:
**
** 1. No cursors may be open in the main database.  (But newIdx and oldIdx
**    can be indices of cursors in temporary tables.  See below.)
**
** 2. If the triggers being coded are ON INSERT or ON UPDATE triggers, then
**    a temporary vdbe cursor (index newIdx) must be open and pointing at
**    a row containing values to be substituted for new.* expressions in the
**    trigger program(s).
**
** 3. If the triggers being coded are ON DELETE or ON UPDATE triggers, then
**    a temporary vdbe cursor (index oldIdx) must be open and pointing at
**    a row containing values to be substituted for old.* expressions in the
**    trigger program(s).
**
*/
int sqliteCodeRowTrigger(
  Parse *pParse,       /* Parse context */
  int op,              /* One of TK_UPDATE, TK_INSERT, TK_DELETE */
  ExprList *pChanges,  /* Changes list for any UPDATE OF triggers */
  int tr_tm,           /* One of TK_BEFORE, TK_AFTER */
  Table *pTab,         /* The table to code triggers from */
  int newIdx,          /* The indice of the "new" row to access */
  int oldIdx,          /* The indice of the "old" row to access */
  int orconf,          /* ON CONFLICT policy */
  int ignoreJump       /* Instruction to jump to for RAISE(IGNORE) */
){
  Trigger * pTrigger;
  TriggerStack * pTriggerStack;

  assert(op == TK_UPDATE || op == TK_INSERT || op == TK_DELETE);
  assert(tr_tm == TK_BEFORE || tr_tm == TK_AFTER );

  assert(newIdx != -1 || oldIdx != -1);

  pTrigger = pTab->pTrigger;
  while( pTrigger ){
    int fire_this = 0;

    /* determine whether we should code this trigger */
    if( pTrigger->op == op && pTrigger->tr_tm == tr_tm &&
        pTrigger->foreach == TK_ROW ){
      fire_this = 1;
      pTriggerStack = pParse->trigStack;
      while( pTriggerStack ){
        if( pTriggerStack->pTrigger == pTrigger ){
	  fire_this = 0;
	}
        pTriggerStack = pTriggerStack->pNext;
      }
      if( op == TK_UPDATE && pTrigger->pColumns &&
          !checkColumnOverLap(pTrigger->pColumns, pChanges) ){
        fire_this = 0;
      }
    }

    if( fire_this && (pTriggerStack = sqliteMalloc(sizeof(TriggerStack)))!=0 ){
      int endTrigger;
      SrcList dummyTablist;
      Expr * whenExpr;
      AuthContext sContext;

      dummyTablist.nSrc = 0;

      /* Push an entry on to the trigger stack */
      pTriggerStack->pTrigger = pTrigger;
      pTriggerStack->newIdx = newIdx;
      pTriggerStack->oldIdx = oldIdx;
      pTriggerStack->pTab = pTab;
      pTriggerStack->pNext = pParse->trigStack;
      pTriggerStack->ignoreJump = ignoreJump;
      pParse->trigStack = pTriggerStack;
      sqliteAuthContextPush(pParse, &sContext, pTrigger->name);

      /* code the WHEN clause */
      endTrigger = sqliteVdbeMakeLabel(pParse->pVdbe);
      whenExpr = sqliteExprDup(pTrigger->pWhen);
      if( sqliteExprResolveIds(pParse, &dummyTablist, 0, whenExpr) ){
        pParse->trigStack = pParse->trigStack->pNext;
        sqliteFree(pTriggerStack);
        sqliteExprDelete(whenExpr);
        return 1;
      }
      sqliteExprIfFalse(pParse, whenExpr, endTrigger, 1);
      sqliteExprDelete(whenExpr);

      sqliteVdbeAddOp(pParse->pVdbe, OP_ContextPush, 0, 0);
      codeTriggerProgram(pParse, pTrigger->step_list, orconf);
      sqliteVdbeAddOp(pParse->pVdbe, OP_ContextPop, 0, 0);

      /* Pop the entry off the trigger stack */
      pParse->trigStack = pParse->trigStack->pNext;
      sqliteAuthContextPop(&sContext);
      sqliteFree(pTriggerStack);

      sqliteVdbeResolveLabel(pParse->pVdbe, endTrigger);
    }
    pTrigger = pTrigger->pNext;
  }

  return 0;
}

redpajama_set_name: RedPajamaGithub


text:
package control

import (
	"fmt"
	"io"
	"net/textproto"
	"sync"
)

// Conn is the connection to the Tor control port.
type Conn struct {
	// DebugWriter is the writer that debug logs for this library (not Tor
	// itself) will be written to. If nil, no debug logs are generated/written.
	DebugWriter io.Writer

	// This is the underlying connection.
	conn *textproto.Conn

	// This is set lazily by ProtocolInfo().
	protocolInfo *ProtocolInfo

	// True if Authenticate has been called successfully.
	Authenticated bool

	// The lock fot eventListeners
	eventListenersLock sync.RWMutex
	// The value slices can be traversed outside of lock, they are completely
	// replaced on change, never mutated. But the map itself must be locked on
	// when reading or writing.
	eventListeners map[EventCode][]chan<- Event

	// This mutex is locked on when an entire response needs to be read. It
	// helps synchronize accesses to the response by the asynchronous response
	// listeners and the synchronous responses.
	readLock sync.Mutex
}

// NewConn creates a Conn from the given textproto connection.
func NewConn(conn *textproto.Conn) *Conn {
	return &Conn{
		conn:           conn,
		eventListeners: map[EventCode][]chan<- Event{},
	}
}

func (c *Conn) sendRequestIgnoreResponse(format string, args ...interface{}) error {
	_, err := c.SendRequest(format, args...)
	return err
}

// SendRequest sends a synchronous request to Tor and awaits the response. If
// the response errors, the error result will be set, but the response will be
// set also. This is usually not directly used by callers, but instead called by
// higher-level methods.
func (c *Conn) SendRequest(format string, args ...interface{}) (*Response, error) {
	if c.debugEnabled() {
		c.debugf("Write line: %v", fmt.Sprintf(format, args...))
	}
	id, err := c.conn.Cmd(format, args...)
	if err != nil {
		return nil, err
	}
	c.readLock.Lock()
	defer c.readLock.Unlock()
	c.conn.StartResponse(id)
	defer c.conn.EndResponse(id)
	// Get the first non-async response
	var resp *Response
	for {
		if resp, err = c.ReadResponse(); err != nil || !resp.IsAsync() {
			break
		}
		c.relayAsyncEvents(resp)
	}
	if err == nil && !resp.IsOk() {
		err = resp.Err
	}
	return resp, err
}

// Close sends a QUIT and closes the underlying Tor connection. This does not
// error if the QUIT is not accepted but does relay any error that occurs while
// closing the underlying connection.
func (c *Conn) Close() error {
	// Ignore the response and ignore the error
	c.Quit()
	return c.conn.Close()
}

func (c *Conn) debugEnabled() bool {
	return c.DebugWriter != nil
}

func (c *Conn) debugf(format string, args ...interface{}) {
	if w := c.DebugWriter; w != nil {
		fmt.Fprintf(w, format+"\n", args...)
	}
}

func (*Conn) protoErr(format string, args ...interface{}) textproto.ProtocolError {
	return textproto.ProtocolError(fmt.Sprintf(format, args...))
}


text:
<?php

namespace Skonsoft\Bundle\LookForTravelerBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class TripType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('startDate','date',array(
                'widget' => 'single_text',
                'format' => 'dd/MM/yyyy',
                'attr' => array('class' => 'datepicker')
            ))
            ->add('startTime','time',array(
                'widget' => 'single_text',
                'attr' => array('class' => 'timepicker-default input-small')
            ))
            ->add('returnDate')
            ->add('price')
            ->add('description')
            ->add('startPlace')
            ->add('returnPlace')
            ->add('status')
            ->add('authorizedCategoryTraveler')
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Skonsoft\Bundle\LookForTravelerBundle\Entity\Trip'
        ));
    }

    public function getName()
    {
        return 'skonsoft_bundle_lookfortravelerbundle_triptype';
    }
}


text:
var AREA_OF_INFLUENCE_TYPES = require('../../../../../../../../javascripts/cartodb3/editor/layers/layer-content-views/analyses/analysis-form-models/area-of-influence-types');

describe('editor/layers/layer-content-views/analyses/analysis-form-models/area-of-influence-types', function () {
  AREA_OF_INFLUENCE_TYPES.forEach(function (d) {
    it('should have a type', function () {
      expect(d.type).toEqual(jasmine.any(String));
    });

    describe('area-of-influence type ' + d.type, function () {
      it('should have a label', function () {
        expect(d.label).toEqual(jasmine.any(String));
      });

      it('should have parametersDataFields defined with which schema props to use', function () {
        expect(d.parametersDataFields).toEqual(jasmine.any(String), 'on the format of "source,type,some_other,…"');
        expect(d.parametersDataFields).not.toContain(' ', 'the parametersDataFields must not contain any spaces');
      });

      it('should have a parse function', function () {
        expect(d.parse).toEqual(jasmine.any(Function));
        expect(d.parse.length).toEqual(1, 'should take one argument, which is the attrs from the analysis-definition-node-model');
      });

      it('should have a formatAttrs function', function () {
        expect(d.formatAttrs).toEqual(jasmine.any(Function));
        expect(d.formatAttrs.length).toEqual(1, 'should take one argument of the area-of-influence-form-model');
      });
    });
  });
});


text:
CVAPI(cv::Algorithm*) core_Algorithm_new()
{
    return new cv::Algorithm();
}
CVAPI(void) core_Algorithm_delete(cv::Algorithm *obj)
{
    delete obj;
}

CVAPI(cv::Ptr<cv::Algorithm>*) core_Algorithm_create(const char *name)
{
    cv::Ptr<cv::Algorithm> al = cv::Algorithm::_create(name);
    return al.empty() ? NULL : clone( al );
}

CVAPI(cv::Ptr<cv::Algorithm>*) core_Ptr_Algorithm_new(cv::Algorithm *rawPtr)
{
	return new cv::Ptr<cv::Algorithm>(rawPtr);
}
CVAPI(void) core_Ptr_Algorithm_delete(cv::Ptr<cv::Algorithm> *ptr)
{
	delete ptr;
}
CVAPI(cv::Algorithm*) core_Ptr_Algorithm_obj(cv::Ptr<cv::Algorithm> *ptr)
{
	return ptr->obj;
}

CVAPI(void) core_Algorithm_name(cv::Algorithm *obj, char *buf, int bufLength)
{
    std::string name = reinterpret_cast<cv::FeatureDetector*>(obj)->name();
    copyString(name, buf, bufLength);
}

CVAPI(int) core_Algorithm_getInt(cv::Algorithm *obj, const char *name)
{
	return obj->getInt(name);
}
CVAPI(double) core_Algorithm_getDouble(cv::Algorithm *obj, const char *name)
{
	return obj->getDouble(name);
}
CVAPI(int) core_Algorithm_getBool(cv::Algorithm *obj, const char *name)
{
	return obj->getBool(name) ? 1 : 0;
}
CVAPI(void) core_Algorithm_getString(cv::Algorithm *obj, const char *name,
                                     char *buf, int bufLength)
{
	std::string result = obj->getString(name);
	copyString(result, buf, bufLength);
}
CVAPI(cv::Mat*) core_Algorithm_getMat(cv::Algorithm *obj, const char *name)
{
	const cv::Mat &mat = obj->getMat(name);
	return new cv::Mat(mat);
}
CVAPI(void) core_Algorithm_getMatVector(cv::Algorithm *obj, const char *name,
                                        std::vector<cv::Mat>* outVec)
{
	std::vector<cv::Mat> vec = obj->getMatVector(name);
	std::copy(vec.begin(), vec.end(), std::back_inserter(*outVec));
}
CVAPI(cv::Ptr<cv::Algorithm>*) core_Algorithm_getAlgorithm(cv::Algorithm *obj, const char *name)
{
    return clone( obj->getAlgorithm(name) );
}

CVAPI(void) core_Algorithm_setInt(cv::Algorithm *obj, const char *name, int value)
{
	obj->set(name, value);
}
CVAPI(void) core_Algorithm_setDouble(cv::Algorithm *obj, const char *name, double value)
{
	obj->set(name, value);
}
CVAPI(void) core_Algorithm_setBool(cv::Algorithm *obj, const char *name, bool value)
{
	obj->set(name, value);
}
CVAPI(void) core_Algorithm_setString(cv::Algorithm *obj, const char *name, const char *value)
{
	std::string str(value);
	obj->set(name, str);
}
CVAPI(void) core_Algorithm_setMat(cv::Algorithm *obj, const char *name, const cv::Mat *value)
{
	obj->set(name, *value);
}
CVAPI(void) core_Algorithm_setMatVector(cv::Algorithm *obj, const char *name,
                                        cv::Mat **value, int valueLength)
{
    std::vector<cv::Mat> valueVec(valueLength);
    for (int i = 0; i < valueLength; i++)
    {
        valueVec[i] = *(value[i]);
    }
	obj->set(name, valueVec);
}
CVAPI(void) core_Algorithm_setAlgorithm(cv::Algorithm *obj, const char *name,
                                        cv::Algorithm *value)
{
    cv::Ptr<cv::Algorithm> ptr(value);
    ptr.addref();
	obj->set(name, ptr);
}

CVAPI(void) core_Algorithm_paramHelp(cv::Algorithm *obj, const char *name,
                                     char *buf, char *bufLength)
{
    std::string str = obj->paramHelp(name);
    std::strncpy(buf, str.c_str(), (size_t)(bufLength-1));
}
CVAPI(int) core_Algorithm_paramType(cv::Algorithm *obj, const char* name)
{
    return obj->paramType(name);
}
CVAPI(void) core_Algorithm_getParams(cv::Algorithm *obj, std::vector<std::string> *names)
{
    obj->getParams(*names);
}

CVAPI(void) core_Algorithm_getList(std::vector<std::string> *algorithms)
{
    cv::Algorithm::getList(*algorithms);
}
CVAPI(cv::AlgorithmInfo*) core_Algorithm_info(cv::Algorithm *obj)
{
    return obj->info();
}

#endif


text:
package org.jetbrains.plugins.groovy.lang.psi.impl.statements;

import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.ResolveState;
import com.intellij.psi.scope.ElementClassHint;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrCatchClause;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrOpenBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;

/**
 * @author ilyas
 */
public class GrCatchClauseImpl extends GroovyPsiElementImpl implements GrCatchClause {
  public GrCatchClauseImpl(@NotNull ASTNode node) {
    super(node);
  }

  @Override
  public void accept(GroovyElementVisitor visitor) {
    visitor.visitCatchClause(this);
  }

  public String toString() {
    return "Catch clause";
  }

  @Override
  @Nullable
  public GrParameter getParameter() {
    return findChildByClass(GrParameter.class);
  }

  @Override
  public GrOpenBlock getBody() {
    return findChildByClass(GrOpenBlock.class);
  }

  @Override
  public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
    if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;

    GrParameter parameter = getParameter();
    return parameter == null || ResolveUtil.processElement(processor, parameter, state);
  }

  @Override
  public GrParameter[] getParameters() {
    final GrParameter parameter = getParameter();
    return parameter != null ? new GrParameter[]{parameter} : GrParameter.EMPTY_ARRAY;
  }

  @Override
  public GrParameterList getParameterList() {
    return null;
  }

  @Override
  public boolean isVarArgs() {
    throw new IncorrectOperationException("Catch clause cannot have varargs");
  }

  @Override
  public PsiElement getRParenth() {
    return findChildByType(GroovyTokenTypes.mRPAREN);
  }

  @Override
  public PsiElement getLBrace() {
    return findChildByType(GroovyTokenTypes.mLCURLY);
  }
}


text:
using namespace pwiz::util;
using namespace pwiz::proteome;
using namespace pwiz::data;

ostream* os_ = 0;

void testWriteRead(const Serializer_FASTA::Config& config)
{
    ProteomeData pd;
    examples::initializeTiny(pd);

    Serializer_FASTA serializer(config);

    ostringstream oss;
    serializer.write(oss, pd, NULL);

    if (os_) *os_ << "oss:\n" << oss.str() << endl;

    shared_ptr<istringstream> iss(new istringstream(oss.str()));
    ProteomeData pd2;
    serializer.read(iss, pd2);

    Diff<ProteomeData, DiffConfig> diff(pd, pd2);
    if (os_ && diff) *os_ << diff << endl;
    unit_assert(!diff);
}

void testWriteRead()
{
    if (os_) *os_ << "testWriteRead() MemoryIndex" << endl;
    Serializer_FASTA::Config config;
    testWriteRead(config);

    if (os_) *os_ << "testWriteRead() BinaryIndexStream" << endl;
    shared_ptr<stringstream> indexStringStream(new stringstream);
    config.indexPtr.reset(new BinaryIndexStream(indexStringStream));
    testWriteRead(config);
}

void testThreadSafetyWorker(pair<boost::barrier*, ProteomeData*>* args)
{
    args->first->wait(); // wait until all threads have started

    try
    {
        testWriteRead();

        for (int i=0; i < 3; ++i)
        {
            for (size_t j=0; j < args->second->proteinListPtr->size(); ++j)
                unit_assert(args->second->proteinListPtr->protein(j)->index == j);
        }
    }
    catch (exception& e)
    {
        cerr << "Exception in worker thread: " << e.what() << endl;
    }
    catch (...)
    {
        cerr << "Unhandled exception in worker thread." << endl;
    }
}

void testThreadSafety(const int& testThreadCount)
{
    ProteomeData pd;
    examples::initializeTiny(pd);

    boost::barrier testBarrier(testThreadCount);
    boost::thread_group testThreadGroup;
    for (int i=0; i < testThreadCount; ++i)
        testThreadGroup.add_thread(new boost::thread(&testThreadSafetyWorker, new pair<boost::barrier*, ProteomeData*>(&testBarrier, &pd)));
    testThreadGroup.join_all();
}

void testDuplicateId()
{
    ProteomeData pd;
    pd.id = "tiny";

    shared_ptr<ProteinListSimple> proteinListPtr(new ProteinListSimple);
    pd.proteinListPtr = proteinListPtr;

    proteinListPtr->proteins.push_back(ProteinPtr(new Protein("ABC123", 0, "One two three.", "ELVISLIVES")));
    proteinListPtr->proteins.push_back(ProteinPtr(new Protein("ZEBRA", 1, "Has stripes:", "BLACKANDWHITE")));
    proteinListPtr->proteins.push_back(ProteinPtr(new Protein("DEFCON42", 2, "", "DNTPANIC")));
    proteinListPtr->proteins.push_back(ProteinPtr(new Protein("ZEBRA", 1, "Black and white", "STRIPES")));

    Serializer_FASTA serializer;

    ostringstream oss;
    serializer.write(oss, pd, NULL);

    if (os_) *os_ << "oss:\n" << oss.str() << endl;

    shared_ptr<istringstream> iss(new istringstream(oss.str()));
    ProteomeData pd2;

    unit_assert_throws_what(serializer.read(iss, pd2), runtime_error,
                            "[ProteinList_FASTA::createIndex] duplicate protein id \"ZEBRA\"");
}

int main(int argc, char* argv[])
{
    TEST_PROLOG(argc, argv)

    try
    {
        if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
        testWriteRead();
        testThreadSafety(2);
        testThreadSafety(4);
        testThreadSafety(8);
        testDuplicateId();
    }
    catch (exception& e)
    {
        TEST_FAILED(e.what())
    }
    catch (...)
    {
        TEST_FAILED("Caught unknown exception.")
    }

    TEST_EPILOG
}


text:
/**
 * @overview
 * The wren programming language in your browser!
 * <br>
 *
 * @example
 * import * as Wren from "../out/wren.js";
 *
 * let vm = new Wren.VM({
 *   resolveModuleFn     : function(importer, name) {...},
 *   loadModuleFn        : function(name) {...},
 *   bindForeignMethodFn : function(moduleName, className, isStatic, signature) {...},
 *   bindForeignClassFn  : function(moduleName, className) {...},
 *   writeFn             : function(toLog) {...},
 *   errorFn             : function(errorType, moduleName, line, msg) {...}
 * });
 *
 * vm.interpret("main", `
 *   System.print("Hello from Wren!")
 * `);
 */

/**
 * wrenjs is an ES6 module.
 *
 * @example
 * import * as Wren from "./path/to/wren.js";
 *
 * @module Wren
 */

import libwren from './generated/libwren.js';

/*
* 'libwren' represents our connection to the Wren C API, through emscripten's ccall function.
* We attach an empty object to it so that we can store and lookup JS Wren.VMs from C and JS.
*/
var Module = libwren();
Module._VMs = {};
Module._values = [];

/**
* Get the current wren version number.
*
* Can be used to range checks over versions.
* @return {number} A monotonically increasing numeric representation of the
*                  version number.
*/
export function getVersionNumber() {
  let result = Module.ccall('wrenGetVersionNumber',
      'number',
      [], []
  );

  return result;
}

/**
* The type of error returned by the [VM].
* @property {number} COMPILE A syntax or resolution error detected at compile time.
* @property {number} RUNTIME The error message for a runtime error.
* @property {number} STACK_TRACE One entry of a runtime error's stack trace.
*/
export var ErrorType = {
  COMPILE:      0,
  RUNTIME:      1,
  STACK_TRACE:  2
}

/**
* The result of a VM interpreting wren source.
* @property {number} SUCCESS the VM interpreted the source without error.
* @property {number} COMPILE_ERROR the VM experienced a compile error.
* @property {number} RUNTIME_ERROR the VM experienced a runtime error.
*/
export var Result = {
  SUCCESS:        0,
  COMPILE_ERROR:  1,
  RUNTIME_ERROR:  2
}

/**
* A single virtual machine for executing Wren code.
*/
export class VM {

    /**
    * Creates a new Wren virtual machine using the given [configuration].
    * If [configuration] is undefined, uses a default
    * configuration.
    * @param {Object} configuration
    * an object containing any or all of the following properties:
    * resolveModuleFn, loadModuleFn, bindForeignMethodFn, bindForeignClassFn,
    * writeFn, errorFn.
    *
    * let vm = new Wren.VM({
    *   resolveModuleFn     : function(importer, name) {...},
    *   loadModuleFn        : function(name) {...},
    *   bindForeignMethodFn : function(moduleName, className, isStatic, signature) {...},
    *   bindForeignClassFn  : function(moduleName, className) {...},
    *   writeFn             : function(toLog) {...},
    *   errorFn             : function(errorType, moduleName, line, msg) {...}
    * });
    */
    constructor(config) {
        // Replaces wrenInitConfiguration
        let default_config = {
            resolveModuleFn     : VM.defaultResolveModuleFn,
            loadModuleFn        : VM.defaultLoadModuleFn,
            bindForeignMethodFn : VM.defaultBindForeignMethodFn,
            bindForeignClassFn  : VM.defaultBindForeignClassFn,
            writeFn             : VM.defaultWriteFn,
            errorFn             : VM.defaultErrorFn
        }
        this.config = Object.assign(default_config, config);

        this._pointer = Module.ccall('shimNewVM',
          'number',
          [],[]
        );

        Module._VMs[this._pointer] = this;

        this._foreignClasses = {};
    }

    // Defaults //
    static defaultResolveModuleFn(importer, name) {
        return name;
    }

    static defaultLoadModuleFn(name) {
        return null;
    }

    static defaultBindForeignMethodFn(moduleName, className, isStatic, signature) {
        return null;
    }

    static defaultBindForeignClassFn(moduleName, className) {
        return null;
    }

    static defaultWriteFn(toLog) {
        let str = 'WRENJS: ';
        console.log(str + toLog);
    }

    static defaultErrorFn(errorType, moduleName, line, msg) {
        let str = 'WRENJS: ';
        if (errorType == 0) {
          console.warn(
              str + "["+moduleName+" line " +line+ "] [Error] "+msg+"\n"
          );
        }
        if (errorType == 1) {
          console.warn(
              str + "["+moduleName+" line "+line+"] in "+msg+"\n"
          );
        }
        if (errorType == 2) {
          console.warn(
              str + "[Runtime Error] "+msg+"\n"
          );
        }
    }

    /*
    * The following methods are called from C, and should not be relied upon in
    * the JS context.
    * --------------------------------------------------------------------------
    */

    _resolveModuleFn(importer, name) {
        return this.config.resolveModuleFn(importer, name);
    }

    _loadModuleFn(name) {
        return this.config.loadModuleFn(name);
    }

    _bindForeignMethod(moduleName, className, isStatic, signature) {
        // This should return a function looking for a Wren.VM as its only arg.
        let method = this.config.bindForeignMethodFn(moduleName, className,
          isStatic, signature
        );

        if (method == null) {
          return null;
        }

        // The wren C api expects a function looking for a pointer as its arg.
        let vm = this;
        let wrappedMethod = function(pointer) {
          method(vm);
        }
        return wrappedMethod;
    }

    _bindForeignClass(moduleName, className) {
        var methods =  this.config.bindForeignClassFn(moduleName, className);

        if (methods == null) {
          return null;
        }

        // Similar to the bindForeignMethod fn above, C expects to pass these
        // a pointer to the VM, and we need to convert that to a JS Wren.VM
        let vm = this;

        return {
            allocate: function() {
                methods.allocate(vm);
            },
            finalize: function() {
                methods.finalize(vm);

                let pointer = Module.ccall('wrenGetSlotForeign',
                  'number',
                  ['number', 'number'],
                  [vm._pointer, 0]
                );

                delete vm._foreignClasses[pointer];
            }
        }
    }

    _write(text) {
        this.config.writeFn(text);
    }

    _error(errorType, moduleName, line, msg) {
        this.config.errorFn(errorType, moduleName, line, msg);
    }

    /*
    * The following methods are implementations of the Wren C API, callable
    * from the JS context.
    * --------------------------------------------------------------------------
    */

    /**
    * Disposes of all resources in use by the VM.
    */
    free() {
        Module.ccall('wrenFreeVM',
          null,
          ['number'],
          [this._pointer]
        );
        delete VM[this._pointer]
        this._pointer = undefined;
    }

    /**
    * Immediately run the garbage collector to free unused memory.
    */
    collectGarbage() {
        Module.ccall('wrenCollectGarbage',
          null,
          ['number'],
          [this._pointer]
        );
    }

    /**
    * Runs [source], a string of Wren source code in a new fiber in [vm] in the
    * context of resolved [moduleName].
    * @return {string} whether the result was a success or an error.
    * @param {string} moduleName the name of the wren module.
    * @param {string} src the wren source code to interpret
    */
    interpret(moduleName, src) {
        let result = Module.ccall('wrenInterpret',
            'number',
            ['number', 'string', 'string'],
            [this._pointer, moduleName, src]);

        return result;
    }

    /**
    * Creates a handle that can be used to invoke a method with [signature] on
    * using a receiver and arguments that are set up on the stack.
    *
    * This handle can be used repeatedly to directly invoke that method from JS
    * code using [call].
    *
    * When you are done with this handle, it must be released using
    * [releaseHandle].
    * @return {number} a handle for use with [VM.call].
    * @param {string} signature a string depicting the signature of a wren method.
    */
    makeCallHandle(signature) {
        let handle = Module.ccall('wrenMakeCallHandle',
          'number',
          ['number', 'string'],
          [this._pointer, signature]
        );
        return handle;
    }

    /**
    * Calls [method], using the receiver and arguments previously set up on the
    * stack.
    *
    * [method] must have been created by a call to [makeCallHandle]. The
    * arguments to the method must be already on the stack. The receiver should be
    * in slot 0 with the remaining arguments following it, in order. It is an
    * error if the number of arguments provided does not match the method's
    * signature.
    *
    * After this returns, you can access the return value from slot 0 on the stack.
    * @return {string} whether the result was a success or error.
    * @param {number} method the handle returned from makeCallHandle.
    */
    call(method) {
        let result = Module.ccall('wrenCall',
          'number',
          ['number', 'number'],
          [this._pointer, method]
        );

        return result;
    }

    /**
    * Releases the reference stored in [handle]. After calling this, [handle] can
    * no longer be used.
    * @param {number} handle the handle returned from makeCallHandle.
    */
    releaseHandle(handle) {
        Module.ccall('wrenReleaseHandle',
          null,
          ['number', 'number'],
          [this._pointer, 'handle']
        );
    }

    /**
    * Returns the number of slots available to the current foreign method.
    * @return {number} the number of slots.
    */
    getSlotCount() {
        let count = Module.ccall('wrenGetSlotCount',
          'number',
          ['number'],
          [this._pointer]
        );
        return count;
    }

    /**
    * Ensures that the foreign method stack has at least [numSlots] available for
    * use, growing the stack if needed.
    *
    * Does not shrink the stack if it has more than enough slots.
    *
    * It is an error to call this from a finalizer.
    * @param {number} numSlots the number of slots needed.
    */
    ensureSlots(numSlots) {
        Module.ccall('wrenEnsureSlots',
          null,
          ['number', 'number'],
          [this._pointer, numSlots]
        );
    }

    /**
    * Gets the type of the object in [slot].
    * @return {string} the type of the object.
    * @param {number} slot the index of the slot.
    */
    getSlotType(slot) {
        let t = Module.ccall('wrenGetSlotType',
          'number',
          ['number', 'number'],
          [this._pointer, slot]
        );

        let types = [
          'WREN_TYPE_BOOL',
          'WREN_TYPE_NUM',
          'WREN_TYPE_FOREIGN',
          'WREN_TYPE_LIST',
          'WREN_TYPE_MAP',
          'WREN_TYPE_NULL',
          'WREN_TYPE_STRING',
          'WREN_TYPE_UNKNOWN'
        ]; // TODO: pull out into an enum.

        return types[t];
    }

    /**
    * Reads a boolean value from [slot].
    *
    * It is an error to call this if the slot does not contain a boolean value.
    * @return {boolean} the value stored in the slot.
    * @param {number} slot the index of the slot.
    */
    getSlotBool(slot) {
        let boolean = Module.ccall('wrenGetSlotBool',
          'boolean',
          ['number', 'number'],
          [this._pointer, slot]
        );
        return boolean;
    }

    /**
    * Reads a byte array from [slot].
    *
    * The memory for the returned string is owned by Wren. You can inspect it
    * while in your foreign method, but cannot keep a pointer to it after the
    * function returns, since the garbage collector may reclaim it.
    *
    * Returns a pointer to the first byte of the array and fill [length] with the
    * number of bytes in the array. TODO: does it?
    *
    * It is an error to call this if the slot does not contain a string.
    * @return {string} the bytes as a string.
    * @param {number} slot the index of the slot.
    * @param {number} length the length of the bytes.
    */
    getSlotBytes(slot, length) {
        let bytes = Module.ccall('wrenGetSlotBytes',
          'string',
          ['number', 'number', 'number'],
          [this._pointer, slot, length]
        );
        return bytes;
    }

    /**
    * Reads a number from [slot].
    *
    * It is an error to call this if the slot does not contain a number.
    * @return {number} the value stored in the slot.
    * @param {number} slot the index of the slot.
    */
    getSlotDouble(slot) {
        let double = Module.ccall('wrenGetSlotDouble',
          'number',
          ['number', 'number'],
          [this._pointer, slot]
        );
        return double;
    }

    /**
    * Reads a foreign object from [slot] and returns a pointer to the foreign data
    * stored with it.
    *
    * It is an error to call this if the slot does not contain an instance of a
    * foreign class.
    * @return {Object} the JavaScript Object stored in the slot.
    * @param {number} slot the index of the slot.
    */
    getSlotForeign(slot) {
        let pointer = Module.ccall('wrenGetSlotForeign',
          'number',
          ['number', 'number'],
          [this._pointer, slot]
        );

        return this._foreignClasses[pointer];
    }

    /**
    * Reads a string from [slot].
    *
    * The memory for the returned string is owned by Wren. You can inspect it
    * while in your foreign method, but cannot keep a pointer to it after the
    * function returns, since the garbage collector may reclaim it.
    * TODO: Is it?
    *
    * It is an error to call this if the slot does not contain a string.
    * @return {string} the string stored in the slot.
    * @param {number} slot the index of the slot.
    */
    getSlotString(slot) {
        let string = Module.ccall('wrenGetSlotString',
          'string',
          ['number', 'number'],
          [this._pointer, slot]
        );
        return string;
    }

    /**
    * Creates a handle for the value stored in [slot].
    *
    * This will prevent the object that is referred to from being garbage collected
    * until the handle is released by calling [releaseHandle()].
    * @return {number} a handle for use with [VM.call].
    * @param {number} slot the index of the slot.
    */
    getSlotHandle(slot) {
        let handle = Module.ccall('wrenGetSlotHandle',
          'number',
          ['number', 'number'],
          [this._pointer, slot]
        );
        return handle;
    }

    /**
    * Stores the boolean [value] in [slot].
    * @param {number} slot the index of the slot.
    * @param {boolean} value the boolean to store.
    */
    setSlotBool(slot, value) {
        Module.ccall('wrenSetSlotBool',
          null,
          ['number', 'number', 'boolean'],
          [this._pointer, slot, value]
        );
    }

    /**
    * Stores the array [length] of [bytes] in [slot].
    *
    * The bytes are copied to a new string within Wren's heap, so you can free
    * memory used by them after this is called.
    * @param {number} slot the index of the slot.
    * @param {string} bytes the bytes to store.
    * @param {number} length the length of the bytes.
    */
    setSlotBytes(slot, bytes, length) {
        Module.ccall('wrenSetSlotBytes',
          null,
          ['number', 'number', 'string', 'number'],
          [this._pointer, slot, bytes, length]
        );
    }

    /**
    * Stores the numeric [value] in [slot].
    * @param {number} slot the index of the slot.
    * @param {number} value the value to store.
    */
    setSlotDouble(slot, value) {
        Module.ccall('wrenSetSlotDouble',
          null,
          ['number', 'number', 'number'],
          [this._pointer, slot, value]
        );
    }

    /**
    * Creates a new instance of the foreign class stored in [classSlot] with [size]
    * bytes of raw storage and places the resulting object in [slot].
    *
    * This does not invoke the foreign class's constructor on the new instance. If
    * you need that to happen, call the constructor from Wren, which will then
    * call the allocator foreign method. In there, call this to create the object
    * and then the constructor will be invoked when the allocator returns.
    *
    * @return {Object} the same foreignObject you passed in.
    * @param {number} slot the index of the slot.
    * @param {number} classSlot the slot containing the foreign class.
    * @param {Object} foreignObject a JavaScript class.
    */
    setSlotNewForeign(slot, classSlot, foreignObject) {
        let pointer = Module.ccall('wrenSetSlotNewForeign',
          'number',
          ['number', 'number', 'number', 'number'],
          [this._pointer, slot, classSlot, 0]
        );

        this._foreignClasses[pointer] = foreignObject;

        return foreignObject;
    }

    /**
    * Stores a new empty list in [slot].
    * @param {number} slot the index of the slot.
    */
    setSlotNewList(slot) {
        Module.ccall('wrenSetSlotNewList',
          null,
          ['number', 'number'],
          [this._pointer, slot]
        );
    }

    /**
    * Stores a new empty map in [slot].
    * @param {number} slot the index of the slot.
    */
    setSlotNewMap(slot) {
        Module.ccall('wrenSetSlotNewMap',
          null,
          ['number', 'number'],
          [this._pointer, slot]
        );
    }

    /**
    * Stores null in [slot].
    * @param {number} slot the index of the slot.
    */
    setSlotNull(slot) {
        Module.ccall('wrenSetSlotNull',
          null,
          ['number', 'number'],
          [this._pointer, slot]
        );
    }

    /**
    * Stores the string [text] in [slot].
    *
    * The [text] is copied to a new string within Wren's heap, so you can free
    * memory used by it after this is called. The length is calculated using
    * [strlen()]. If the string may contain any null bytes in the middle, then you
    * should use [setSlotBytes()] instead.
    * @param {number} slot the index of the slot.
    * @param {string} text the string to store.
    */
    setSlotString(slot, text) {
        Module.ccall('wrenSetSlotString',
          null,
          ['number', 'number', 'string'],
          [this._pointer, slot, text]
        );
    }

    /**
    * Stores the value captured in [handle] in [slot].
    *
    * This does not release the handle for the value.
    * @param {number} slot the index of the slot.
    * @param {number} handle a handle returned from makeCallHandle.
    */
    setSlotHandle(slot, handle) {
        Module.ccall('wrenSetSlotHandle',
          null,
          ['number', 'number', 'number'],
          [this._pointer, slot, handle]
        );
    }

    /**
    * Returns the number of elements in the list stored in [slot].
    * @return {number} the number of elements in the list.
    * @param {number} slot the index of the slot.
    */
    getListCount(slot) {
        let count = Module.ccall('wrenGetListCount',
          'number',
          ['number', 'number'],
          [this._pointer, slot]
        );
        return count;
    }

    /**
    * Reads element [index] from the list in [listSlot] and stores it in
    * [elementSlot].
    * @param {number} listSlot
    * @param {number} index
    * @param {number} elementSlot
    */
    getListElement(listSlot, index, elementSlot) {
        Module.ccall('wrenGetListElement',
          null,
          ['number', 'number', 'number', 'number'],
          [this._pointer, listSlot, index, elementSlot]
        );
    }

    /**
    * Sets the value stored at [index] in the list at [listSlot],
    * to the value from [elementSlot].
    * @param {number} listSlot
    * @param {number} index
    * @param {number} elementSlot
    */
    setListElement(listSlot, index, elementSlot) {
        Module.ccall('wrenSetListElement',
          null,
          ['number', 'number', 'number', 'number'],
          [this._pointer, listSlot, index, elementSlot]
        );
    }

    /**
    * Takes the value stored at [elementSlot] and inserts it into the list stored
    * at [listSlot] at [index].
    *
    * As in Wren, negative indexes can be used to insert from the end. To append
    * an element, use `-1` for the index.
    * @param {number} listSlot
    * @param {number} index
    * @param {number} elementSlot
    */
    insertInList(listSlot, index, elementSlot) {
        Module.ccall('wrenInsertInList',
          null,
          ['number', 'number', 'number', 'number'],
          [this._pointer, listSlot, index, elementSlot]
        );
    }

    /**
    * Returns the number of entries in the map stored in [slot].
    * @return {number} the number of entries in the map.
    * @param {number} slot the index of the slot.
    */
    getMapCount(slot) {
        let count = Module.ccall('wrenGetMapCount',
          'number',
          ['number', 'number'],
          [this._pointer, slot]
        );
        return count;
    }

    /**
    * Returns true if the key in [keySlot] is found in the map placed in [mapSlot].
    * @return {boolean} whether the map contains the key.
    * @param {number} mapSlot a slot containing the map.
    * @param {number} keySlot a slot containing the key.
    */
    getMapContainsKey(mapSlot, keySlot) {
        let boolean = Module.ccall('wrenGetMapContainsKey',
          'boolean',
          ['number', 'number', 'number'],
          [this._pointer, mapSlot, keySlot]
        );
        return boolean;
    }

    /**
    * Retrieves a value with the key in [keySlot] from the map in [mapSlot] and
    * stores it in [valueSlot].
    * @param {number} mapSlot a slot containing the map.
    * @param {number} keySlot a slot containing the key.
    * @param {number} valueSlot a slot to place the value.
    */
    getMapValue(mapSlot, keySlot, valueSlot) {
        Module.ccall('wrenGetMapValue',
          null,
          ['number', 'number', 'number', 'number'],
          [this._pointer, mapSlot, keySlot, valueSlot]
        );
    }

    /**
    * Takes the value stored at [valueSlot] and inserts it into the map stored
    * at [mapSlot] with key [keySlot].
    * @param {number} mapSlot a slot containing the map.
    * @param {number} keySlot a slot containing the key to add.
    * @param {number} valueSlot a slot containing the key's value.
    */
    setMapValue(mapSlot, keySlot, valueSlot) {
        Module.ccall('wrenSetMapValue',
          null,
          ['number', 'number', 'number', 'number'],
          [this._pointer, mapSlot, keySlot, valueSlot]
        );
    }

    /**
    * Removes a value from the map in [mapSlot], with the key from [keySlot],
    * and place it in [removedValueSlot]. If not found, [removedValueSlot] is
    * set to null, the same behaviour as the Wren Map API.
    * @param {number} mapSlot a slot containing the map.
    * @param {number} keySlot a slot containing the key to remove.
    * @param {number} removedValueSlot a slot to contain the removed value.
    */
    removeMapValue(mapSlot, keySlot, removedValueSlot) {
        Module.ccall('wrenRemoveMapValue',
          null,
          ['number', 'number', 'number', 'number'],
          [this._pointer, mapSlot, keySlot, removedValueSlot]
        );
    }

    /**
    * Looks up the top level variable with [name] in resolved [moduleName] and stores
    * it in [slot].
    * @param {string} moduleName the name of the wren moduleName.
    * @param {string} name the name of the variable.
    * @param {number} slot the index of the slot.
    */
    getVariable(moduleName, name, slot) {
        Module.ccall('wrenGetVariable',
          null,
          ['number', 'string', 'string', 'number'],
          [this._pointer, moduleName, name, slot]
        );
    }

    /**
    * Looks up the top level variable with [name] in resolved [moduleName],
    * returns false if not found. The module must be imported at the time,
    * use wrenHasModule to ensure that before calling.
    * @return {boolean} whether the variable exists in module.
    * @param {string} moduleName the name of the wren module.
    * @param {string} name the name of the variable.
    */
    hasVariable(moduleName, name) {
        let boolean = Module.ccall('wrenHasVariable',
          'boolean',
          ['number', 'string', 'string'],
          [this._pointer, moduleName, name]
        );
        return boolean;
    }

    /**
    * Returns true if [moduleName] has been imported/resolved before, false if not.
    * @return {boolean} whether the module has been imported/resolved before.
    * @param {string} moduleName the name of the wren module.
    */
    hasModule(moduleName) {
        let boolean = Module.ccall('wrenHasModule',
          'boolean',
          ['number', 'string'],
          [this._pointer, moduleName]
        );
        return boolean;
    }

    /**
    * Sets the current fiber to be aborted, and uses the value in [slot] as the
    * runtime error object.
    * @param {number} slot the index of the slot.
    */
    abortFiber(slot) {
        Module.ccall('wrenAbortFiber',
          null,
          ['number', 'number'],
          [this._pointer, slot]
        );
    }

    // The following APIs are not implemented.
    //getUserData() {}
    //setUserData(userData) {}
}


text:
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;

namespace EduHub.Data.Entities
{
    /// <summary>
    /// CASES21 MESSAGES
    /// </summary>
    [GeneratedCode("EduHub Data", "0.9")]
    public sealed partial class KMSG : EduHubEntity
    {

        /// <inheritdoc />
        public override DateTime? EntityLastModified
        {
            get
            {
                return LW_DATE;
            }
        }

        #region Field Properties

        /// <summary>
        /// Prime key
        /// </summary>
        public int KMSGKEY { get; internal set; }

        /// <summary>
        /// Send Date
        /// </summary>
        public DateTime? SEND_DATE { get; internal set; }

        /// <summary>
        /// Message Subject
        /// [Alphanumeric (100)]
        /// </summary>
        public string SUBJECT { get; internal set; }

        /// <summary>
        /// Message Body
        /// [Memo]
        /// </summary>
        public string MESSAGE { get; internal set; }

        /// <summary>
        /// Expiry date
        /// </summary>
        public DateTime? EXPIRY { get; internal set; }

        /// <summary>
        /// Frequency (Number of days)
        /// </summary>
        public short? FREQUENCY { get; internal set; }

        /// <summary>
        /// Last write date
        /// </summary>
        public DateTime? LW_DATE { get; internal set; }

        /// <summary>
        /// Last write time
        /// </summary>
        public short? LW_TIME { get; internal set; }

        /// <summary>
        /// Last write user
        /// [Uppercase Alphanumeric (128)]
        /// </summary>
        public string LW_USER { get; internal set; }

        #endregion

    }
}


text:
[Release Tag](https://github.com/nock/nock/releases/tag/v10.0.0)

### Breaking changes

Support for Node < 6 was dropped.

To upgrade Nock, ensure your version of Node is also updated.
At the time of release, Node 6.x, 8.x, and 9.x were supported.


text:
require 'grape/middleware/base'

module Grape
  module Middleware
    module Versioner
      # This middleware sets various version related rack environment variables
      # based on the uri path and removes the version substring from the uri
      # path. If the version substring does not match any potential initialized
      # versions, a 404 error is thrown.
      #
      # Example: For a uri path
      #   /v1/resource
      #
      # The following rack env variables are set and path is rewritten to
      # '/resource':
      #
      #   env['api.version'] => 'v1'
      #
      class Path < Base
        def default_options
          {
            pattern: /.*/i
          }
        end

        def before
          path = env[Grape::Http::Headers::PATH_INFO].dup

          if prefix && path.index(prefix) == 0 # rubocop:disable all
            path.sub!(prefix, '')
            path = Grape::Router.normalize_path(path)
          end

          pieces = path.split('/')
          potential_version = pieces[1]
          return unless potential_version =~ options[:pattern]
          throw :error, status: 404, message: '404 API Version Not Found' if options[:versions] && !options[:versions].find { |v| v.to_s == potential_version }
          env[Grape::Env::API_VERSION] = potential_version
        end

        private

        def prefix
          Grape::Router.normalize_path(options[:prefix].to_s) if options[:prefix]
        end
      end
    end
  end
end


text:
// Generated from ./SPARQL.g4 by ANTLR 4.7.2

#pragma once

#include "antlr4-runtime.h"
#include "SPARQLVisitor.h"

/**
 * This class provides an empty implementation of SPARQLVisitor, which can be
 * extended to create a visitor which only needs to handle a subset of the available methods.
 */
class  SPARQLBaseVisitor : public SPARQLVisitor {
public:

  virtual antlrcpp::Any visitEntry(SPARQLParser::EntryContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitQueryUnit(SPARQLParser::QueryUnitContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitQuery(SPARQLParser::QueryContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitUpdateUnit(SPARQLParser::UpdateUnitContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPrologue(SPARQLParser::PrologueContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBaseDecl(SPARQLParser::BaseDeclContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPrefixDecl(SPARQLParser::PrefixDeclContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitSelectquery(SPARQLParser::SelectqueryContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitSubSelect(SPARQLParser::SubSelectContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitSelectClause(SPARQLParser::SelectClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitExpressionAsVar(SPARQLParser::ExpressionAsVarContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitConstructquery(SPARQLParser::ConstructqueryContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDescribequery(SPARQLParser::DescribequeryContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitAskquery(SPARQLParser::AskqueryContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDatasetClause(SPARQLParser::DatasetClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDefaultGraphClause(SPARQLParser::DefaultGraphClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNamedGraphClause(SPARQLParser::NamedGraphClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitSourceSelector(SPARQLParser::SourceSelectorContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitWhereClause(SPARQLParser::WhereClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitSolutionModifier(SPARQLParser::SolutionModifierContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGroupClause(SPARQLParser::GroupClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGroupCondition(SPARQLParser::GroupConditionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitHavingClause(SPARQLParser::HavingClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitHavingCondition(SPARQLParser::HavingConditionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitOrderClause(SPARQLParser::OrderClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitOrderCondition(SPARQLParser::OrderConditionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitLimitoffsetClauses(SPARQLParser::LimitoffsetClausesContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitLimitClause(SPARQLParser::LimitClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitOffsetClause(SPARQLParser::OffsetClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitValuesClause(SPARQLParser::ValuesClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitUpdate(SPARQLParser::UpdateContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitUpdate1(SPARQLParser::Update1Context *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitLoad(SPARQLParser::LoadContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitClear(SPARQLParser::ClearContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDrop(SPARQLParser::DropContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitCreate(SPARQLParser::CreateContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitAdd(SPARQLParser::AddContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitMove(SPARQLParser::MoveContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitCopy(SPARQLParser::CopyContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitInsertData(SPARQLParser::InsertDataContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDeleteData(SPARQLParser::DeleteDataContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDeleteWhere(SPARQLParser::DeleteWhereContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitModify(SPARQLParser::ModifyContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDeleteClause(SPARQLParser::DeleteClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitInsertClause(SPARQLParser::InsertClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitUsingClause(SPARQLParser::UsingClauseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphOrDefault(SPARQLParser::GraphOrDefaultContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphRef(SPARQLParser::GraphRefContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphRefAll(SPARQLParser::GraphRefAllContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitQuadPattern(SPARQLParser::QuadPatternContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitQuadData(SPARQLParser::QuadDataContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitQuads(SPARQLParser::QuadsContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitQuadsNotTriples(SPARQLParser::QuadsNotTriplesContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitTriplesTemplate(SPARQLParser::TriplesTemplateContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGroupGraphPattern(SPARQLParser::GroupGraphPatternContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGroupGraphPatternSub(SPARQLParser::GroupGraphPatternSubContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphPatternTriplesBlock(SPARQLParser::GraphPatternTriplesBlockContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitTriplesBlock(SPARQLParser::TriplesBlockContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphPatternNotTriples(SPARQLParser::GraphPatternNotTriplesContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitOptionalGraphPattern(SPARQLParser::OptionalGraphPatternContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphGraphPattern(SPARQLParser::GraphGraphPatternContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitServiceGraphPattern(SPARQLParser::ServiceGraphPatternContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBind(SPARQLParser::BindContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitInlineData(SPARQLParser::InlineDataContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDataBlock(SPARQLParser::DataBlockContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitInlineDataOnevar(SPARQLParser::InlineDataOnevarContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitInlineDataFull(SPARQLParser::InlineDataFullContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDataBlockValue(SPARQLParser::DataBlockValueContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitMinusGraphPattern(SPARQLParser::MinusGraphPatternContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGroupOrUnionGraphPattern(SPARQLParser::GroupOrUnionGraphPatternContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitFilter(SPARQLParser::FilterContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitConstraint(SPARQLParser::ConstraintContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitFunctionCall(SPARQLParser::FunctionCallContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitArgList(SPARQLParser::ArgListContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitExpressionList(SPARQLParser::ExpressionListContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitConstructTemplate(SPARQLParser::ConstructTemplateContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitConstructTriples(SPARQLParser::ConstructTriplesContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitTriplesSameSubject(SPARQLParser::TriplesSameSubjectContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPropertyList(SPARQLParser::PropertyListContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPropertyListNotEmpty(SPARQLParser::PropertyListNotEmptyContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitVerb(SPARQLParser::VerbContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitObjectList(SPARQLParser::ObjectListContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitObject(SPARQLParser::ObjectContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitTriplesSameSubjectpath(SPARQLParser::TriplesSameSubjectpathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPropertyListpath(SPARQLParser::PropertyListpathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPropertyListpathNotEmpty(SPARQLParser::PropertyListpathNotEmptyContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitVerbpathOrSimple(SPARQLParser::VerbpathOrSimpleContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitVerbpath(SPARQLParser::VerbpathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitVerbSimple(SPARQLParser::VerbSimpleContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitObjectListpath(SPARQLParser::ObjectListpathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitObjectpath(SPARQLParser::ObjectpathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPath(SPARQLParser::PathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathAlternative(SPARQLParser::PathAlternativeContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathSequence(SPARQLParser::PathSequenceContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathElt(SPARQLParser::PathEltContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathEltOrInverse(SPARQLParser::PathEltOrInverseContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathMod(SPARQLParser::PathModContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathPrimary(SPARQLParser::PathPrimaryContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathNegatedPropertySet(SPARQLParser::PathNegatedPropertySetContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPathOneInPropertySet(SPARQLParser::PathOneInPropertySetContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitTriplesNode(SPARQLParser::TriplesNodeContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBlankNodepropertyList(SPARQLParser::BlankNodepropertyListContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitTriplesNodepath(SPARQLParser::TriplesNodepathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBlankNodepropertyListpath(SPARQLParser::BlankNodepropertyListpathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitCollection(SPARQLParser::CollectionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitCollectionpath(SPARQLParser::CollectionpathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphNode(SPARQLParser::GraphNodeContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphNodepath(SPARQLParser::GraphNodepathContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitVarOrTerm(SPARQLParser::VarOrTermContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitVarOrIri(SPARQLParser::VarOrIriContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitVar(SPARQLParser::VarContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitGraphTerm(SPARQLParser::GraphTermContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitExpression(SPARQLParser::ExpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitConditionalOrexpression(SPARQLParser::ConditionalOrexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitConditionalAndexpression(SPARQLParser::ConditionalAndexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitValueLogical(SPARQLParser::ValueLogicalContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitRelationalexpression(SPARQLParser::RelationalexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNumericexpression(SPARQLParser::NumericexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitAdditiveexpression(SPARQLParser::AdditiveexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitMultiplicativeexpression(SPARQLParser::MultiplicativeexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitUnaryexpression(SPARQLParser::UnaryexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPrimaryexpression(SPARQLParser::PrimaryexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBrackettedexpression(SPARQLParser::BrackettedexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPredSet(SPARQLParser::PredSetContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBuiltInCall(SPARQLParser::BuiltInCallContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitRegexexpression(SPARQLParser::RegexexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitSubstringexpression(SPARQLParser::SubstringexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitStrReplaceexpression(SPARQLParser::StrReplaceexpressionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitExistsFunc(SPARQLParser::ExistsFuncContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNotexistsFunc(SPARQLParser::NotexistsFuncContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitAggregate(SPARQLParser::AggregateContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitIriOrFunction(SPARQLParser::IriOrFunctionContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitRDFLiteral(SPARQLParser::RDFLiteralContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNumericLiteral(SPARQLParser::NumericLiteralContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNumericLiteralUnsigned(SPARQLParser::NumericLiteralUnsignedContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNumericLiteralPositive(SPARQLParser::NumericLiteralPositiveContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNumericLiteralNegative(SPARQLParser::NumericLiteralNegativeContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNum_integer(SPARQLParser::Num_integerContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNum_decimal(SPARQLParser::Num_decimalContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitNum_double(SPARQLParser::Num_doubleContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitInteger_positive(SPARQLParser::Integer_positiveContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDecimal_positive(SPARQLParser::Decimal_positiveContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDouble_positive(SPARQLParser::Double_positiveContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitInteger_negative(SPARQLParser::Integer_negativeContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDecimal_negative(SPARQLParser::Decimal_negativeContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitDouble_negative(SPARQLParser::Double_negativeContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBooleanLiteral(SPARQLParser::BooleanLiteralContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitString(SPARQLParser::StringContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitIri(SPARQLParser::IriContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitPrefixedName(SPARQLParser::PrefixedNameContext *ctx) override {
    return visitChildren(ctx);
  }

  virtual antlrcpp::Any visitBlankNode(SPARQLParser::BlankNodeContext *ctx) override {
    return visitChildren(ctx);
  }

};


text:
<?php
namespace CoreXEngine\Cache\Backend;

use CoreXEngine\Cache\Backend\Cache;
use CoreXEngine\Cache\AccessException;
use CoreXEngine\Cache\Exception;
use \InvalidArgumentException;
use \SQLite3;

require_once __DIR__ . "/Cache.php";
require_once __DIR__ . "/../AccessException.php";

/**
 * Cache implementation wrapped around a SQLite3 database.
 * @category CoreXEngine
 * @package CoreXEngine\Cache\Backend
 * @author Levente Polyak <levente@leventepolyak.de>
 */
class SQLite implements Cache {
	/**
	 * Stores the database we use for caching.
	 * @var \SQLite3
	 */
	protected $database;

	/**
	 * Stores the table name we use for caching.
	 * @var string
	 */
	protected $table;

	/**
	 * Creates a new cache object by passing a SQLite3 database. It tries to create the cache
	 * table if it does not yet exists. Its important the the sqlite database is not read-only
	 * else you may get a AccessException if trying to do a write operation.
	 * @param \SQlite3 $database the SQLite database we want to store in
	 * @param string $table default 'cache' name of the table inside the SQLite database
	 * @throws \InvalidArgumentException if we add some evil arguments
	 * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
	 * @throws CoreXEngine\Cache\Exception for no special typed problem
	 */
	public function __construct( SQLite3 $database, $table = 'cache' ) {
		if ( ! (string) $table ) {
			throw new InvalidArgumentException("Argument $table is not valid table name.");
		}
		@$database->exec("CREATE TABLE IF NOT EXISTS $table (
			c_key TEXT PRIMARY KEY NOT NULL,
			c_value BLOB NOT NULL,
			c_ttl INTEGER
		)");
		$this->database = $database;
		$this->table = $table;
		$this->checkError();
	}

	/**
	 * Set a key value pair with ttl. Entries that are already stored under this
	 * key will be overwritten. It uses the local time() to store the ttl.
	 * @param string $key the key identifier
	 * @param mixed $value the value to store
	 * @param integer $ttl default 0 zero to not expire else ttl
	 * @return boolean TRUE on success or FALSE on failure
	 * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
	 * @throws CoreXEngine\Cache\Exception for no special typed problem
	 */
	public function set ( $key, $value, $ttl = 0 ) {
		$statement = $this->database->prepare("REPLACE INTO {$this->table} (c_key, c_value, c_ttl) VALUES (:key, :value, :ttl)");
		$statement->bindValue(':key', $key, SQLITE3_TEXT);
		$statement->bindValue(':value', serialize($value), SQLITE3_BLOB);
		$statement->bindValue(':ttl', $ttl ? time()+$ttl : null, SQLITE3_INTEGER);
		$result = @$statement->execute();
		$this->checkError();
		return true;
	}

	/**
	 * Retrieve value by key from the cache. If the entry is out-dated it will perform a
	 * delete operation to clean the table.
	 * @param string $key the key identifier
	 * @return mixed the stored value or NULL
	 * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
	 * @throws CoreXEngine\Cache\Exception for no special typed problem
	 */
	public function get ( $key ) {
		@$this->database->exec('BEGIN TRANSACTION');
		$this->checkError();
		$statement = $this->database->prepare("SELECT c_value, c_ttl FROM {$this->table} WHERE c_key = :key");
		$statement->bindValue(':key', $key, SQLITE3_TEXT);
		$result = @$statement->execute();
		$this->checkError();
		$result = $result->fetchArray(SQLITE3_ASSOC);
		if ( $result['c_ttl'] && $result['c_ttl'] <= time() ) {
			$statement = $this->database->prepare("DELETE FROM {$this->table} WHERE c_key = :key");
			$statement->bindValue(':key', $key, SQLITE3_TEXT);
			@$statement->execute();
			$this->checkError();
			$result = null;
		}
		@$this->database->exec('COMMIT TRANSACTION');
		$this->checkError();
		return $result ? unserialize($result['c_value']) : null;
	}

	/**
	 * Delete item by key from the cache.
	 * @param string $key the key identifier
	 * @return boolean TRUE on success
	 * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
	 * @throws CoreXEngine\Cache\Exception for no special typed problem
	 */
	public function delete ( $key ) {
		$statement = $this->database->prepare("DELETE FROM {$this->table} WHERE c_key = :key");
		$statement->bindValue(':key', $key, SQLITE3_TEXT);
		@$statement->execute();
		$this->checkError();
		return true;
	}

	/**
	 * Flush the whole cache storage.
	 * @return boolean TRUE on success
	 * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
	 * @throws CoreXEngine\Cache\Exception for no special typed problem
	 */
	public function flush ( ) {
		@$this->database->exec("DELETE FROM {$this->table}");
		$this->checkError();
		return true;
	}

	/**
	 * Clean up outdated entries by checking against the ttl.
	 * @return boolean TRUE on success
	 * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
	 * @throws CoreXEngine\Cache\Exception for no special typed problem
	 */
	public function clean ( ) {
		$statement = $this->database->prepare("DELETE FROM {$this->table} WHERE c_ttl IS NOT NULL AND c_ttl < :ttl");
		$statement->bindValue(':ttl', time(), SQLITE3_INTEGER);
		@$statement->execute();
		$this->checkError();
		return true;
	}

	/**
	 * Checks the last error code and decide if and what kind of exception to throw.
	 * @return true if nothing is wrong
	 * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
	 * @throws CoreXEngine\Cache\Exception for no special typed problem
	 */
	protected function checkError ( ) {
		switch ( ($code = $this->database->lastErrorCode( )) ) {
			case 8:
				throw new AccessException($this->database->lastErrorMsg(), $this->database->lastErrorCode());
				break;
			default:
				if(0 < $code) throw new Exception($this->database->lastErrorMsg(), $this->database->lastErrorCode());
		}
		return true;
	}
}