text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>DRDSP: include/DRDSP/dynamics/rk4.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

DRDSP

Dimensionality Reduction for Dynamical Systems with Parameters

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

 All Classes Namespaces Functions Variables Typedefs

include

DRDSP

dynamics

rk4.h

    1 #ifndef INCLUDED_DYNAMICS_RK4

    2 #define INCLUDED_DYNAMICS_RK4

    3

    4 namespace DRDSP {

    5     template<typename F>

    6     struct RK4 {

    7         typedef double Time;

    8         typedef typename F::State State;

    9         F f;

   10

   11         explicit RK4( const F& f ) : f(f) {}

   12

   13         void Integrate( State& x, double& t, double dt ) {

   14             double halfdt = 0.5 * dt;

   15

   16             RKt[0] = f( x, t );

   17             RKt[1] = f( x + halfdt * RKt[0], t + halfdt );

   18             RKt[2] = f( x + halfdt * RKt[1], t + halfdt );

   19             RKt[3] = f( x + dt * RKt[2], t + dt );

   20

   21             x += ( RKt[0] + 2.0 * RKt[1] + 2.0 * RKt[2] + RKt[3] ) * (dt / 6.0);

   22             t += dt;

   23         }

   24

   25         // Autonomous version

   26         void Integrate( State& x, double dt ) {

   27             double halfdt = 0.5 * dt;

   28

   29             RKt[0] = f( x );

   30             RKt[1] = f( x + halfdt * RKt[0] );

   31             RKt[2] = f( x + halfdt * RKt[1] );

   32             RKt[3] = f( x + dt * RKt[2] );

   33

   34             x += ( RKt[0] + 2.0 * RKt[1] + 2.0 * RKt[2] + RKt[3] ) * (dt / 6.0);

   35         }

   36

   37     protected:

   38         State RKt[4];

   39     };

   40 }

   41

   42 #endif

DRDSP::RK4

Definition: rk4.h:6

<address class="footer">
Generated on Sat Oct 25 2014 21:51:17 for DRDSP by

 1.8.5
</address>


text:
from glad.lang.common.loader import BaseLoader
from glad.lang.c.loader import LOAD_OPENGL_DLL, LOAD_OPENGL_DLL_H, LOAD_OPENGL_GLAPI_H

_WGL_LOADER = \
    LOAD_OPENGL_DLL % {'pre':'static', 'init':'open_gl',
                       'proc':'get_proc', 'terminate':'close_gl'} + '''
int gladLoadWGL(HDC hdc) {
    int status = 0;

    if(open_gl()) {
        status = gladLoadWGLLoader((GLADloadproc)get_proc, hdc);
        close_gl();
    }

    return status;
}
'''

_WGL_HEADER = '''
#ifndef WINAPI
# ifndef WIN32_LEAN_AND_MEAN
#  define WIN32_LEAN_AND_MEAN 1
# endif
# include <windows.h>
#endif

#include <glad/glad.h>

#ifndef __glad_wglext_h_

#ifdef __wglext_h_
#error WGL header already included, remove this include, glad already provides it
#endif

#define __glad_wglext_h_
#define __wglext_h_

#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef void* (* GLADloadproc)(const char *name);
''' + LOAD_OPENGL_GLAPI_H

_WGL_HEADER_LOADER = '''
GLAPI int gladLoadWGL(HDC hdc);
''' + LOAD_OPENGL_DLL_H

_WGL_HEADER_END = '''
#ifdef __cplusplus
}
#endif

#endif
'''

_WGL_HAS_EXT = '''
static HDC GLADWGLhdc = (HDC)INVALID_HANDLE_VALUE;

static void get_exts(void) {
}

static int has_ext(const char *ext) {
    const char *terminator;
    const char *loc;
    const char *extensions;

    if(wglGetExtensionsStringEXT == NULL && wglGetExtensionsStringARB == NULL)
        return 0;

    if(wglGetExtensionsStringARB == NULL || GLADWGLhdc == INVALID_HANDLE_VALUE)
        extensions = wglGetExtensionsStringEXT();
    else
        extensions = wglGetExtensionsStringARB(GLADWGLhdc);

    if(extensions == NULL || ext == NULL)
        return 0;

    while(1) {
        loc = strstr(extensions, ext);
        if(loc == NULL)
            break;

        terminator = loc + strlen(ext);
        if((loc == extensions || *(loc - 1) == ' ') &&
            (*terminator == ' ' || *terminator == '\\0'))
        {
            return 1;
        }
        extensions = terminator;
    }

    return 0;
}
'''

class WGLCLoader(BaseLoader):
    def write(self, fobj, apis):
        if not self.disabled:
            fobj.write(_WGL_LOADER)

    def write_begin_load(self, fobj):
        fobj.write('\twglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)load("wglGetExtensionsStringARB");\n')
        fobj.write('\twglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)load("wglGetExtensionsStringEXT");\n')
        fobj.write('\tif(wglGetExtensionsStringARB == NULL && wglGetExtensionsStringEXT == NULL) return 0;\n')

    def write_end_load(self, fobj):
        fobj.write('\treturn 1;\n')

    def write_find_core(self, fobj):
        fobj.write('\tGLADWGLhdc = hdc;\n')

    def write_has_ext(self, fobj):
        fobj.write(_WGL_HAS_EXT)

    def write_header(self, fobj):
        fobj.write(_WGL_HEADER)
        if not self.disabled:
            fobj.write(_WGL_HEADER_LOADER)

    def write_header_end(self, fobj):
        fobj.write(_WGL_HEADER_END)

redpajama_set_name: RedPajamaGithub


text:
 Featured Projects

 Sealyzer

 Modular Adwords Management Site

A SEA web site modules about Google Adwords campaign management. It is developed by remote working for a foreign company.

    Check it out

 Sağlık Gözcüsü [Health Watcher]

 Product Ingredient Checker for User's Health

A mobile app for analyzing packed products' (food,cosmetics,cleaning product) ingredients for healthing side. It processes user taken product photo and shows that product is harmful or not. It aimed that moving away user from harmful products.

    Mail me For Check it out


text:
alter group
===========

Syntax:

	alter group `groupname` set <option>

Valid options are *expression* and *name*.

set expression
--------------
Change the regular expression for a group.

Example:

	# Create group `linux`
	create group `linux` for /linux.*/

	# Change expression so we will match case insensitive
	alter group `linux` set expression /linux.*/i

set name
--------
Change the name for a group.

>**Note**
>
>This statement expects a normal string using single or double quotes.
>The reason is that 'set name' expects a string and not a group.

Example:

	# Rename group `linux` to `ubuntu`
	alter group `linux` set name 'ubuntu'


text:
package org.robolectric.shadows;

import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;
import org.robolectric.res.PreferenceNode;
import org.robolectric.res.ResName;
import org.robolectric.shadows.util.PreferenceBuilder;

import static org.robolectric.Shadows.shadowOf;

/**
 * Shadow for {@link android.preference.PreferenceActivity}.
 */
@Implements(PreferenceActivity.class)
public class ShadowPreferenceActivity extends ShadowActivity {
  private int preferencesResId = -1;
  private PreferenceScreen preferenceScreen;
  private final PreferenceBuilder preferenceBuilder = new PreferenceBuilder();

  @RealObject
  private PreferenceActivity realOject;

  @Implementation
  public void addPreferencesFromResource(int preferencesResId) {
    this.preferencesResId = preferencesResId;
    preferenceScreen = inflatePreferences(preferencesResId);
    ((PreferenceActivity)realActivity).setPreferenceScreen(preferenceScreen);
  }

  private PreferenceScreen inflatePreferences(int preferencesResId) {
    ResName resName = shadowOf(realOject.getAssets()).getResourceLoader().getResourceIndex().getResName(preferencesResId);
    String qualifiers = shadowOf(realOject.getResources().getConfiguration()).getQualifiers();
    PreferenceNode preferenceNode = shadowOf(realOject.getAssets()).getResourceLoader().getPreferenceNode(resName, qualifiers);
    try {
      return (PreferenceScreen) preferenceBuilder.inflate(preferenceNode, realActivity, null);
    } catch (Exception e) {
      throw new RuntimeException("error inflating " + resName, e);
    }
  }

  public int getPreferencesResId() {
    return preferencesResId;
  }

  @Implementation
  public PreferenceScreen getPreferenceScreen() {
    return preferenceScreen;
  }

  @Implementation
  public Preference findPreference(CharSequence key) {
    return preferenceScreen.findPreference(key);
  }
}


text:
const express = require('express');
const sendErrorResponse = require('./utils').sendErrorResponse;
const replace_id = require('./utils').replace_id;
const ObjectID = require('mongodb').ObjectID;
const indicative = require('indicative');
const verifyToken = require('./verify-token');
const verifyRole = require('./verify-role');

const router = express.Router();

// Posts API Feature
router.get('/', async(req, res) => {
    try{
        const posts = await req.app.locals.db.collection('posts').find().toArray();
        res.json(posts.map(p => replace_id(p)));
    } catch(err) {
        sendErrorResponse(req, res, 500, `Server error: ${err.message}`, err);
    }
});
router.get('/:id', async (req, res) => {
    const params = req.params;
    try {
        await indicative.validator.validate(params, { id: 'required|regex:^[0-9a-f]{24}$' });
        const post = await req.app.locals.db.collection('posts').findOne({ _id: new ObjectID(req.params.id) });
        if (!post) {
            sendErrorResponse(req, res, 404, `Post with ID=${req.params.id} does not exist`);
            return;
        }
        res.json(post);
    } catch (errors) {
        sendErrorResponse(req, res, 400, `Invalid post data: ${errors.map(e => e.message).join(', ')}`, errors);
    }
});

router.post('/', function(req, res) {
    const post = req.body;
    indicative.validator.validate(post, {
        // id: 'required|regex:^[0-9a-f]{24}',
        title: 'required|string|min:3|max:60',
        text: 'string|max:120',
        authorId: 'required|regex:^[0-9a-f]{24}',
        content: 'string',
        imageUrl: 'url',
        categories: 'array',
        'categories.*': 'string',
        keywords: 'array',
        'keywords.*': 'string'
    }).then(() => {
        req.app.locals.db.collection('posts').insertOne(post).then(r => {
            if (r.result.ok && r.insertedCount === 1) {
                replace_id(post);
                console.log(`Created post: ${post.id}: ${post.title}`);
                res.status(201).location(`/posts/${post.id}`).json(post);
            } else {
                sendErrorResponse(req, res, 500, `Server error: ${err.message}`, err);
            }
        }).catch(err => {
            console.error(`Unable to create post: ${post.id}: ${post.title}.`);
            console.error(err);
            sendErrorResponse(req, res, 500, `Server error: ${err.message}`, err);
        });
    }).catch(errors => {
        sendErrorResponse(req, res, 400, `Invalid post data: ${errors.map(e => e.message).join(', ')}`, errors);
    });
});

router.put('/:id', verifyToken, verifyRole(['Author','Admin']), async (req, res) => {
    const old = await req.app.locals.db.collection('posts').findOne({ _id: new ObjectID(req.params.id) });
    if (!old) {
        sendErrorResponse(req, res, 404, `Post with ID=${req.params.id} does not exist`);
        return;
    }
    const post = req.body;
    if (old._id.toString() !== post.id) {
        sendErrorResponse(req, res, 400, `Post ID=${post.id} does not match URL ID=${req.params.id}`);
        return;
    }
    try {
        await indicative.validator.validate(post, {
            id: 'required|regex:^[0-9a-f]{24}',
            title: 'required|string|min:3|max:60',
            text: 'string|max:120',
            authorId: 'required|regex:^[0-9a-f]{24}',
            content: 'string',
            imageUrl: 'url',
            categories: 'array',
            'categories.*': 'string',
            keywords: 'array',
            'keywords.*': 'string'
        });
        try {
            r = await req.app.locals.db.collection('posts').updateOne({ _id: new ObjectID(req.params.id) }, { $set: post });
            if (r.result.ok) {
                console.log(`Updated post: ${JSON.stringify(post)}`);
                if (r.modifiedCount === 0) {
                    console.log(`The old and the new posts are the same.`);
                }
                res.json(post);
            } else {
                sendErrorResponse(req, res, 500, `Unable to update post: ${post.id}: ${post.title}`);
            }
        } catch (err) {
            console.log(`Unable to update post: ${post.id}: ${post.title}`);
            console.error(err);
            sendErrorResponse(req, res, 500, `Server error: ${err.message}`, err);
        }
    } catch (errors) {
        sendErrorResponse(req, res, 400, `Invalid post data: ${errors.map(e => e.message).join(', ')}`, errors);
    }
});

router.delete('/:id', async (req, res) => {
    const params = req.params;
    try {
        await indicative.validator.validate(params, { id: 'required|regex:^[0-9a-f]{24}$' });
        const old = await req.app.locals.db.collection('posts').findOne({ _id: new ObjectID(req.params.id) });
        if (!old) {
            sendErrorResponse(req, res, 404, `Post with ID=${req.params.id} does not exist`);
            return;
        }
        replace_id(old)
        const r = await req.app.locals.db.collection('posts').deleteOne({ _id: new ObjectID(req.params.id) });
        if(r.result.ok && r.deletedCount === 1) {
            console.log(`Deleted post: ${old.id}: ${old.title}`);
            res.json(old);
        } else {
            console.log(`Unable to delete post: ${post.id}: ${post.title}`);
            sendErrorResponse(req, res, 500, `Unable to delete post: ${old.id}: ${old.title}`);
        }
    } catch (errors) {
        sendErrorResponse(req, res, 400, `Invalid post data: ${errors.map(e => e.message).join(', ')}`, errors);
    }
});

module.exports = router;


text:
var InternetCtrl = function(API, Config) {
  this.api = API;
  this.config = Config;
  this.queryText = "";
  this.userText = "";
  this.provider = this.api.providers[0];
  this.useSMS = false;
};

InternetCtrl.prototype.doRequest = function() {
  if(this.config.useSMS) this.sendSMS();
  else this.sendHTML();
};

InternetCtrl.prototype.sendHTML = function() {
    var self = this;
    this.api.getQuery(this.provider, this.userText, function(data) {
      self.queryText = data.content;
      console.log(data);
    });
}

InternetCtrl.prototype.sendSMS = function() {
  var self = this;
  this.api.getQuerySMS(this.provider, this.userText, function() {
    self.queryText = "SMS should arrive in any moment now!";
  },
  function(err) {
    self.queryText = err;
  });
}

var PayCtrl = function(API, Config) {
  this.api = API;
  this.config = Config;
  this.amount = 0;
  this.payee = "";
  this.queryText = this.config.PAYEES[0];
};

PayCtrl.prototype.pay = function() {
  if(this.config.useSMS) this.paySMS();
  else this.payHTML();
}

PayCtrl.prototype.payHTML = function() {
    var self = this;
    this.api.pay(this.payee, this.amount, function(data) {
      self.queryText = data.content;
      console.log(data);
    });
}

PayCtrl.prototype.paySMS = function() {
  var self = this;
  this.api.paySMS(this.payee, this.amount, function() {
    self.queryText = "SMS should arrive in any moment now!";
  },
  function(err) {
    self.queryText = err;
  });
}

var ConfigCtrl = function(Config) {
  this.config = Config;
  this.tel = this.config.MY_PHONE;
  this.useSMS = this.config.USE_SMS;
};

ConfigCtrl.prototype.save = function() {
  this.config.MY_PHONE = this.tel;
  this.config.USE_SMS = this.useSMS;
  this.config.updatePayees();
}

angular.module('starter.controllers', ['ui.router'])
.controller('InternetCtrl', ['API', 'Config', InternetCtrl])
.controller('PayCtrl', ['API', 'Config', PayCtrl])
.controller('ConfigCtrl', ['Config', ConfigCtrl]);


text:
package com.jetbrains.python.quickFixes;

import com.intellij.testFramework.TestDataPath;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyQuickFixTestCase;
import com.jetbrains.python.inspections.PyCallingNonCallableInspection;

@TestDataPath("$CONTENT_ROOT/../testData/quickFixes/PyRemoveCallQuickFixTest/")
public class PyRemoveCallQuickFixTest extends PyQuickFixTestCase {

  public void testExpression() {
    doQuickFixTest(PyCallingNonCallableInspection.class, PyBundle.message("QFIX.NAME.remove.call"));
  }

  public void testDecorator() {
    doQuickFixTest(PyCallingNonCallableInspection.class, PyBundle.message("QFIX.NAME.remove.call"));
  }

  public void testClass() {
    doQuickFixTest(PyCallingNonCallableInspection.class, PyBundle.message("QFIX.NAME.remove.call"));
  }

}


text:
package mycode.seiyugoods.source.callable;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import mycode.seiyugoods.source.CallableSource;
import mycode.seiyugoods.source.polling.SeiyuCategoryMembers;
import mycode.seiyugoods.source.instant.SeiyuTemplateIncludePages;
import mycode.seiyugoods.Utility;
import mycode.seiyugoods.source.instant.AdultSeiyuCategoryMembers;
import org.apache.camel.Body;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CategoryAndTemplateSeiyu extends CallableSource {

    @Autowired
    SeiyuTemplateIncludePages stip;
    @Autowired
    AdultSeiyuCategoryMembers ascm;
    @Autowired
    SeiyuCategoryMembers scm;

    @Override
    public Map<String, Object> call(@Body Map<Class, Long> map) throws IOException {
        stip.ready();
        Set<String> attrSet1 = new Utility().getAttrSet(stip.getMapList(), "title");
        ascm.ready();
        Set<String> attrSet2 = new Utility().getAttrSet(ascm.getMapList(), "title");

        Optional scmCache = scm.getCache(map, "mapList");
        if (scmCache.isPresent()) {
            updateTimeStamp(map, SeiyuCategoryMembers.class);
            Map<String, Object> result = new HashMap<>();
            result.put("mapList", ((List<Map<String, String>>) scmCache.get()).stream()
                    .filter((m)
                            -> attrSet1.contains(m.get("title")))
                    .filter((m)
                            -> !attrSet2.contains(m.get("title")))
                    .map((m) -> {
                        //System.out.println(this.getClass().getSimpleName() + " added: " + m);
                        return new HashMap<>(m);
                    })
                    .collect(Collectors.toList()));
            return result;
        }
        return null;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DisasterReport.Web.SignalR.HubData
{
    public class ChatMessageInputHub
    {
        public virtual Guid FromerId { get; set; }
        public virtual Guid ToerId { get; set; }
        public virtual DateTime Time { get; set; }
        public virtual String Content { get; set; }
    }
}


text:
package pl.jft.rest.tests;

import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import pl.jft.rest.model.Issue;

import java.io.IOException;
import java.util.Set;

/**
 * Created by nishi on 2017-02-05.
 */
public class RestTests extends TestBase {

  @BeforeMethod
  public void ensurePreconditions() throws IOException {
    Set<Issue> issues = app.issue().all();
    for (Issue issue: issues) {
      skipIfNotFixed(issue.getId());
    }
  }

  @Test
  public void testCreateIssue() throws IOException {
    Set<Issue> oldIssues = app.issue().all();
    Issue newIssue = new Issue().withSubject( "Test issue" ).withDescription( "New test issue" );
    int issueId = app.issue().create( newIssue );
    Set<Issue> newIssues = app.issue().all();
    oldIssues.add(newIssue.withId(issueId));
    Assert.assertEquals(newIssues, oldIssues);
  }

}


text:
<?php

if(!defined('BASEPATH'))
    die;

class Setting extends MY_Controller
{
    function __construct(){
        parent::__construct();

    }

    public function index(){
        if(!$this->user)
            return $this->redirect('/admin/me/login?next=' . uri_string());

        $params = array(
            'title' => _l('My Setting'),
            'success' => false
        );

        $this->load->library('SiteForm', '', 'form');
        $this->form->setForm('/admin/me/setting');
        $this->form->setObject($this->user);

        if(!($user=$this->form->validate($this->user)))
            return $this->respond('me/setting', $params);

        if($user !== true){

            // user name
            if(array_key_exists('name', $user)){
                $exists_user = $this->User->getBy('name', $user['name']);
                if($exists_user->id != $this->user->id)
                    $this->form->setError('name', 'The name already exists');
            }

            // user email
            if(array_key_exists('email', $user)){
                $exists_user = $this->User->getBy('email', $user['email']);
                if($exists_user && $exists_user->id != $this->user->id)
                    $this->form->setError('email', 'The email already exists');
            }

            if(array_key_exists('password', $user)){
                if($user['password'])
                    $user['password'] = password_hash($user['password'], PASSWORD_DEFAULT);
                else{
                    unset($user['password']);
                    if(!count($user))
                        $user = true;
                }
            }
        }

        if(!$this->form->errors){
            $params['success'] = true;

            if($user !== true){
                $this->User->set($this->user->id, $user);
                $this->event->me->updated($this->user, $user);
            }
        }

        $this->respond('me/setting', $params);
    }
}


text:
static int array_error(const char *fmt, ...) __attribute__((format (printf, 1, 2)));

static int
array_error_default(char const *fmt, va_list args) {
    char fmtbuf[strlen(fmt) + 2];
    strcpy(fmtbuf, fmt);
    strcat(fmtbuf, "\n");
    return vfprintf(stderr, fmt, args);
}

static int (*array_errfunc)(char const *fmt, va_list args) = array_error_default;

static int
array_error(const char *fmt, ...) {
    va_list args;
    va_start(args, fmt);
    int len = array_errfunc(fmt, args);
    va_end(args);
    return len;
}

array_t *
array_alloc(size_t element_size, size_t initial_count) {
    array_t *array = calloc(1, sizeof(array_t));
    array->alloced = ALLOC_MAGIC;
    array_init(array, element_size, initial_count);
    return array;
}

size_t array_count(array_t const *array) { return array->e_end; }
size_t array_capacity(array_t const *array) { return array->e_all; }
size_t array_element_size(array_t const *array) { return array->e_size; }
size_t array_chunk_size(array_t const *array) { return array->e_inc; }

#define BOUNDS_FAIL 1
#define BOUNDS_OK   0

static int
array_check_bounds(array_t *array, size_t index, size_t within) {
    if (index >= (array->e_end + within)) {
        array_error("array bounds error: %zu (of %zu elements)", index, array->e_end);
        return BOUNDS_FAIL;
    }
    return BOUNDS_OK;
}

void
array_free(array_t *array) {
    if (array != NULL) {
        // deallocate the array data
        if (array->data != NULL) {
            free(array->data);
            array->e_all = array->e_end = 0;
            array->data = (void **)0;
        }
        // deallocate the array struct if we originally allocated it
        if (array->alloced == ALLOC_MAGIC) {
            array->alloced = 0;
            free(array);
        }
    }
}

static int
array_check_alloc(array_t *array, size_t elements) {
    if (elements <= 0)
        elements = 1;
    // Is array large enough to handle <element> elements?
    size_t count = array->e_all;
    while (count <= array->e_end + elements)
        count += array->e_inc; // Add a block and retest
    if (count > array->e_all) {
        void *buf = realloc(array->data, count * array->e_size);
        if (buf == NULL) {
            array_error("array_check_alloc reallocation failure(%d): %s", errno, strerror(errno));
            return -1;
        }
        array->data = buf;
        size_t added = count - array->e_all;
        memset(array->data + array->e_all * array->e_size, '\0', added * array->e_size);
        array->e_all = count;
    }
    return 0;
}

int
array_init(array_t *array, size_t element_size, size_t initial_count) {
    array->e_size = element_size;
    array->e_all = array->e_end = 0;
    array->e_inc = initial_count ? initial_count : 8;
    array->data = NULL;
    return array_check_alloc(array, 0);
}

void
array_seterrfunc(int (*errfunc)(char const *fmt, va_list args)) {
    array_errfunc = errfunc;
}

void *
array_get(array_t *array, size_t index) {
    if (array_check_bounds(array, index, 0) == BOUNDS_FAIL)
        return NULL;
    return array->data + index * array->e_size;
}

void *
array_put(array_t *array, void const *element, size_t at) {
    void *ptr = array_get(array, at);
    if (ptr != NULL)
        memmove(ptr, element, array->e_size);
    return ptr;
}

void *
array_new(array_t *array) {
    array_check_alloc(array, 1);
    size_t index = array->e_end++;
    return array_get(array, index);
}

void *
array_new_at(array_t *array, size_t index) {
    if (array_check_bounds(array, index, 1) == BOUNDS_FAIL)
        return NULL;
    // do this first, in case the array needs to move (via realloc)
    array_check_alloc(array, 1);
    void *ptr = array->data + index * array->e_size;
    if (ptr != NULL) {
        size_t to_move = array->e_end - index;
        if (to_move > 0)
            memmove(ptr + array->e_size, ptr, array->e_size * to_move);
        ++array->e_end;
        memset(ptr, '\0', array->e_size);
    }
    return ptr;
}

void *
array_append(array_t *array, void const *element) {
    void *ptr = array_new(array);
    if (ptr != NULL)
        memcpy(ptr, element, array->e_size);
    return ptr;
}

void *
array_insert(array_t *array, void const *element, size_t at) {
    void *ptr = array_new_at(array, at);
    if (ptr != NULL)
        memcpy(ptr, element, array->e_size);
    return ptr;
}

size_t
array_index(array_t *array, void *ptr) {
    if (ptr < array->data || ptr > (array->data + (array->e_size * array->e_end)))
        return (size_t)-1;
    return (ptr - array->data) / array->e_size;
}

size_t
array_delete(array_t *array, size_t at) {
    if (array_check_bounds(array, at, 0) == BOUNDS_OK) {
        if (at < --array->e_end) {
            void *ptr = array_get(array, at);
            size_t to_move = array->e_end - at;
            if (to_move > 0)
                memmove(ptr, ptr + array->e_size, to_move * array->e_size);
        }
        return array->e_end;
    }
    return (size_t)-1;
}


text:
class ConstructorsConfiguration {
	int x;
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public ConstructorsConfiguration(final int x) {
		this.x = x;
	}
}


text:
module CurrentLanguage
  def current_language
    return 'en' if cookies[:googtrans].nil?
    cookies[:googtrans].split('/').last
  end
end


text:
A simple Chrome extension for bypassing the oversea limitation of TVB.com.

Installing this extension, you agree that it is only for study purposes and its authors take no responsibilities for any consequences.

You can download the Chrome extension (crx) file from  http://bit.ly/Unblock-TVB-crx

    Copyright (C) 2012 Bo Zhu http://zhuzhu.org

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.


text:
package org.appenders.log4j2.elasticsearch.metrics;

import org.junit.jupiter.api.Test;

import java.util.Random;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

public class SuppliedMetricTest {

    @Test
    public void retainsOriginalKey() {

        // given
        final Metric.Key expectedKey = new Metric.Key("test-component", "test-metric", "noop");

        // when
        final Metric metric = new SuppliedMetric(expectedKey, () -> 0L);

        // then
        assertSame(expectedKey, metric.getKey());

    }

    @Test
    public void storesHaveNoEffect() {

        // given
        final Metric.Key expectedKey = new Metric.Key("test-component", "test-metric", "noop");
        final long expectedValue = new Random().nextLong();

        final Metric metric = new SuppliedMetric(expectedKey, () -> expectedValue);

        final MetricCollector metricCollector = mock(MetricCollector.class);

        // when
        metric.store(1);
        metric.store(1L);
        metric.accept(metricCollector);

        // then
        verify(metricCollector).collect(eq(expectedKey), eq(expectedValue));

    }

    @Test
    public void resetHasNoSideEffect() {

        // given
        final Metric.Key expectedKey = new Metric.Key("test-component", "test-metric", "noop");
        final long expectedValue = new Random().nextLong();

        final Metric metric = new SuppliedMetric(expectedKey, () -> expectedValue);

        final MetricCollector metricCollector = mock(MetricCollector.class);

        // when
        metric.store(1);
        metric.store(1L);

        metric.reset();
        assertEquals(metric.getValue(), expectedValue);

        metric.accept(metricCollector);

        // then
        assertEquals(metric.getValue(), expectedValue);
        verify(metricCollector).collect(eq(expectedKey), eq(expectedValue));

    }

    @Test
    public void resetReturnsZero() {

        // given
        final Metric.Key expectedKey = new Metric.Key("test-component", "test-metric", "noop");
        final long expectedValue = new Random().nextLong();

        final Metric metric = new SuppliedMetric(expectedKey, () -> expectedValue);

        // when
        metric.store(1);
        metric.store(1L);
        final long result = metric.reset();

        // then
        assertEquals(0L, result);

    }

    @Test
    public void valueIsAlwaysSupplied() {

        // given
        final Metric.Key expectedKey = new Metric.Key("test-component", "test-metric", "noop");
        final long expectedValue = new Random().nextLong();

        final Metric metric = new SuppliedMetric(expectedKey, () -> expectedValue);

        final MetricCollector metricCollector = mock(MetricCollector.class);

        // when
        metric.accept(metricCollector);
        metric.accept(metricCollector);
        metric.accept(metricCollector);

        // then
        verify(metricCollector, times(3)).collect(eq(expectedKey), eq(expectedValue));

    }

}


text:
const NSString * const kMNCLogInternalDontOutputMe = @"don't output me";

static BOOL MNCTypeCodeIsCharArray(const char *typeCode);
static NSString *MNCStringFromBoolOrCharValue(BOOL boolOrCharvalue);
static NSString *MNCStringFromFourCharCodeOrUnsignedInt32(FourCharCode fourcc);
static NSString *MNCStringFromNSDecimalWithCurrentLocal(NSDecimal dcm);
static NSString *MNCStringFromTypeAndValue(const char * typeCode, void * value);

NSString *_MNCLogToString(NSString *file, unsigned int line, ...)
{
    va_list ap;
    va_start(ap, line);

    NSMutableString *msg = [NSMutableString stringWithFormat:@"[%@:%u]", file, line];

    while (true) {
        char *argumentTypeEncoding = va_arg(ap, char *);
        char *argumentName = va_arg(ap, char *);
        void *argument = va_arg(ap, void *);

        if (*(void **)argument == (__bridge void *)kMNCLogInternalDontOutputMe) {
            break;
        }

        // special case inline strings
        if ((strcmp(argumentTypeEncoding, @encode(id)) == 0) && (strncmp(argumentName, "@\"", 2) == 0)) {
            [msg appendFormat:@" %@", *(void **)argument];
        } else {
            NSString *stringRepresentation = MNCStringFromTypeAndValue(argumentTypeEncoding,  argument);
            [msg appendFormat:@" %s = %@", argumentName, stringRepresentation];
        }
    }

    va_end(ap);

    return msg;
}

NS_INLINE BOOL MNCTypeCodeIsCharArray(const char *typeCode)
{
    unsigned long lastCharOffset = strlen(typeCode) - 1;
    unsigned long secondToLastCharOffset = lastCharOffset - 1 ;

    BOOL isCharArray = typeCode[0] == '[' && typeCode[secondToLastCharOffset] == 'c' && typeCode[lastCharOffset] == ']';
    if(isCharArray) {
        // check if typeCode conforms to regexp: \[ (\d)+ c \]
        for(int i = 1; i < secondToLastCharOffset; i++) {
            if (!isdigit(typeCode[i])) {
                isCharArray = NO;
                break;
            }
        }
    }
    return isCharArray;
}

//since BOOL is #defined as a signed char, we treat the value as
//a BOOL if it is exactly YES or NO, and a char otherwise.
NS_INLINE NSString* MNCStringFromBoolOrCharValue(BOOL boolOrCharvalue)
{
    if(boolOrCharvalue == YES)
        return @"YES";
    if(boolOrCharvalue == NO)
        return @"NO";
    return [NSString stringWithFormat:@"'%c'", boolOrCharvalue];
}

NS_INLINE NSString *MNCStringFromFourCharCodeOrUnsignedInt32(FourCharCode fourcc)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat"
    return [NSString stringWithFormat:@"%u ('%u%u%u%u')",
            fourcc,
            (fourcc >> 24) & 0xFF,
            (fourcc >> 16) & 0xFF,
            (fourcc >> 8) & 0xFF,
            fourcc & 0xFF];
#pragma clang diagnostic pop
}

NS_INLINE NSString *MNCStringFromNSDecimalWithCurrentLocal(NSDecimal dcm)
{
    return NSDecimalString(&dcm, [NSLocale currentLocale]);
}

NS_INLINE NSString * MNCStringFromTypeAndValue(const char * typeCode, void * value)
{
#define IF_TYPE_MATCHES_INTERPRET_WITH(typeToMatch,func) \
if (strcmp(typeCode, @encode(typeToMatch)) == 0) \
return (func)(*(typeToMatch*)value)

#if	TARGET_OS_IPHONE
    IF_TYPE_MATCHES_INTERPRET_WITH(CGPoint,NSStringFromCGPoint);
    IF_TYPE_MATCHES_INTERPRET_WITH(CGSize,NSStringFromCGSize);
    IF_TYPE_MATCHES_INTERPRET_WITH(CGRect,NSStringFromCGRect);
    IF_TYPE_MATCHES_INTERPRET_WITH(UIOffset,NSStringFromUIOffset);
    IF_TYPE_MATCHES_INTERPRET_WITH(UIEdgeInsets,NSStringFromUIEdgeInsets);
#else
    IF_TYPE_MATCHES_INTERPRET_WITH(NSPoint,NSStringFromPoint);
    IF_TYPE_MATCHES_INTERPRET_WITH(NSSize,NSStringFromSize);
    IF_TYPE_MATCHES_INTERPRET_WITH(NSRect,NSStringFromRect);
#endif
    IF_TYPE_MATCHES_INTERPRET_WITH(NSRange,NSStringFromRange);
    IF_TYPE_MATCHES_INTERPRET_WITH(Class,NSStringFromClass);
    IF_TYPE_MATCHES_INTERPRET_WITH(SEL,NSStringFromSelector);
    IF_TYPE_MATCHES_INTERPRET_WITH(BOOL,MNCStringFromBoolOrCharValue);
    IF_TYPE_MATCHES_INTERPRET_WITH(NSDecimal,MNCStringFromNSDecimalWithCurrentLocal);

#define IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(typeToMatch,formatString) \
if (strcmp(typeCode, @encode(typeToMatch)) == 0) \
return [NSString stringWithFormat:(formatString), (*(typeToMatch*)value)]

    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(CFStringRef,@"%@"); //CFStringRef is toll-free bridged to NSString*
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(CFArrayRef,@"%@"); //CFArrayRef is toll-free bridged to NSArray*
    IF_TYPE_MATCHES_INTERPRET_WITH(FourCharCode, MNCStringFromFourCharCodeOrUnsignedInt32);
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(long long,@"%lld");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(unsigned long long,@"%llu");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(float,@"%f");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(double,@"%f");

    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(short,@"%hi");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(unsigned short,@"%hu");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(int,@"%i");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(unsigned, @"%u");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(long,@"%li");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(long double,@"%Lf"); //WARNING on older versions of OS X, @encode(long double) == @encode(double)

    //C-strings
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(char*, @"%s");
    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(const char*, @"%s");
    if(MNCTypeCodeIsCharArray(typeCode))
        return [NSString stringWithFormat:@"%s", (char*)value];

    // objc object
    if (strcmp(typeCode, @encode(id)) == 0)
        return [NSString stringWithFormat:(@"%@"), (*(__unsafe_unretained id *)value)];

    IF_TYPE_MATCHES_INTERPRET_WITH_FORMAT(void*,@"(void*)%p");

    //This is a hack to print out CLLocationCoordinate2D, without needing to #import <CoreLocation/CoreLocation.h>
    //A CLLocationCoordinate2D is a struct made up of 2 doubles.
    //We detect it by hard-coding the result of @encode(CLLocationCoordinate2D).
    //We get at the fields by treating it like an array of doubles, which it is identical to in memory.
    if(strcmp(typeCode, "{?=dd}")==0)//@encode(CLLocationCoordinate2D)
        return [NSString stringWithFormat:@"{latitude=%g,longitude=%g}",((double*)value)[0],((double*)value)[1]];

    //we don't know how to convert this typecode into an NSString
    return nil;
}


text:
package org.semanticweb.HermiT.reasoner;

import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLDataProperty;

public class DatatypesTest extends AbstractReasonerTest {

    public DatatypesTest(String name) {
        super(name);
    }

    public void testNotXsdString() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) Declaration(Datatype(:dt))"
                + "SubClassOf(:A ObjectIntersectionOf( DataMinCardinality( 2 :dp xsd:string ) DataMaxCardinality( 1 :dp xsd:string ) )) "
                + "ClassAssertion(:A :a)"
                + "DatatypeDefinition(:dt DatatypeRestriction(xsd:string xsd:pattern \"[AB]+\"^^rdf:PlainLiteral)) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testdateTimeTimezones() throws Exception {
        String axioms = "Declaration(DataProperty(:birthDate))" + LB
                + "Declaration(NamedIndividual(:Peter))" + LB
                + "FunctionalDataProperty(:birthDate)" + LB
                + "DataPropertyAssertion(:birthDate :Peter \"1956-06-25T04:00:00-05:00\"^^xsd:dateTime)" + LB
                + "DataPropertyAssertion(:birthDate :Peter \"1956-06-25T10:00:00+01:00\"^^xsd:dateTime)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeDef5() throws Exception {
        String axioms = "Declaration(Datatype(:newDT))"
                + "DatatypeDefinition(:newDT DatatypeRestriction(xsd:integer xsd:minInclusive \"15\"^^xsd:integer))"
                + "DataPropertyRange(:dp DataComplementOf(:newDT))"
                + "DataPropertyAssertion(:dp :a \"16\"^^xsd:integer)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testNominalsAndDatatypesFromAlan() throws Exception {
        String axioms = "Declaration(DataProperty(:dp))" + LB
                + "Declaration(NamedIndividual(:a))" + LB
                + "Declaration(NamedIndividual(:b))" + LB
                + "EquivalentClasses(owl:Thing ObjectOneOf(:b :a))" + LB
                + "DataPropertyAssertion(:dp :b \"42\"^^xsd:integer)" + LB
                + "DataPropertyAssertion(:dp :b \"44\"^^xsd:integer)" + LB
                + "DataPropertyAssertion(:dp :b \"43\"^^xsd:integer)";
        loadReasonerWithAxioms(axioms);
        assertTrue(m_reasoner.isConsistent());
    }

    public void testDifferentLexicalForms() throws Exception {
        String axioms = "Declaration(DataProperty(:dp)) Declaration(NamedIndividual(:a))"
                + "DataPropertyAssertion(:dp :a \"1\"^^xsd:integer)"
                + "DataPropertyAssertion(:dp :a \"1\"^^xsd:short)"
                + "FunctionalDataProperty(:dp)";
        loadReasonerWithAxioms(axioms);
        assertTrue(m_reasoner.isConsistent());
    }

    public void testLiteralCustomDatatype() throws Exception {
        String axioms = "Declaration(Datatype(:MyDatatype))"
                + "Declaration(NamedIndividual(:a))"
                + "Declaration(DataProperty(:dp))"
                + "DatatypeDefinition(:MyDatatype DataOneOf(\"1\"^^xsd:string \"1\"^^xsd:integer))"
                + "DataPropertyAssertion(:dp :a \"1\"^^:MyDatatype)";
        try {
            loadReasonerWithAxioms(axioms);
            fail();
        } catch (RuntimeException e) {
        }
    }

    public void testINF() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"Infinity\"^^xsd:double)))"
                + "SubClassOf(:A DataSomeValuesFrom(:dp rdfs:Literal))"
                + "ClassAssertion(:A :a)"
                + "NegativeDataPropertyAssertion(:dp :a \"Infinity\"^^xsd:double)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testFreshEntitiesQuery() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A))"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        OWLDataProperty dp = m_dataFactory.getOWLDataProperty(IRI.create(NS + "dp"));
        OWLDataProperty dp2 = m_dataFactory.getOWLDataProperty(IRI.create(NS + "dp2"));
        assertTrue(m_reasoner.getSubDataProperties(dp, false).containsEntity(m_dataFactory.getOWLBottomDataProperty()));
        assertTrue(m_reasoner.getSuperDataProperties(dp, false).containsEntity(m_dataFactory.getOWLTopDataProperty()));
        assertFalse(m_reasoner.getSuperDataProperties(dp, false).containsEntity(dp2));
        assertFalse(m_reasoner.getSubDataProperties(dp, false).containsEntity(dp2));
    }

    public void testParsingError() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3\"^^xsd:integer \"4a\"^^xsd:int))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"2\"^^xsd:short \"3\"^^xsd:integer)))"
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataComplementOf(DataOneOf(\"3\"^^xsd:integer))) :a)";
        try {
            loadReasonerWithAxioms(axioms);
            fail();
        } catch (RuntimeException e) {
        }
    }

    public void testStringAbbreviation() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "DataPropertyAssertion(:dp :a \"abc\"^^xsd:string)"
                + "DataPropertyAssertion(:dp :a \"abc\")"
                + "ClassAssertion(DataMaxCardinality(1 :dp) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testLangAbbreviation() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:dp)) DataPropertyAssertion(:dp :a \"abc@es\"^^rdf:PlainLiteral)"
                + "DataPropertyAssertion(:dp :a \"abc\"@es)"
                + "ClassAssertion(DataMaxCardinality(1 :dp) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDatatypesUnsat1() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) SubClassOf(:A DataAllValuesFrom(:dp xsd:string)) "
                + "SubClassOf(:A DataSomeValuesFrom(:dp xsd:integer)) "
                + "ClassAssertion(:A :a) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypesUnsat2() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:Eighteen)) Declaration(DataProperty(:hasAge)) "
                + "SubClassOf(DataHasValue(:hasAge \"18\"^^xsd:integer) :Eighteen) "
                + "ClassAssertion(DataHasValue(:hasAge \"18\"^^xsd:integer) :a) "
                + "ClassAssertion(ObjectComplementOf(:Eighteen) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypesUnsat3() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:hasAge)) DataPropertyRange(:hasAge xsd:integer) "
                + "ClassAssertion(DataHasValue(:hasAge \"aString\"^^xsd:string) :a) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypesUnsat4() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:dp)) FunctionalDataProperty(:hasAge) "
                + "ClassAssertion(DataHasValue(:hasAge \"18\"^^xsd:integer) :a) "
                + "ClassAssertion(DataHasValue(:hasAge \"19\"^^xsd:integer) :a) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypesSat() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) SubClassOf(:A DataHasValue(:dp \"18\"^^xsd:integer)) "
                + "ClassAssertion(:A :a) "
                + "ClassAssertion(DataAllValuesFrom(:dp xsd:integer) :a) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testMinInclusiveMaxInclusive() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) SubClassOf(:A DataSomeValuesFrom(:dp DatatypeRestriction(xsd:integer xsd:minInclusive \"18\"^^xsd:integer))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:integer xsd:maxInclusive \"10\"^^xsd:integer))) "
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDisjointDPsUnsat() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp1)) Declaration(DataProperty(:dp2)) "
                + "DisjointDataProperties(:dp1 :dp2) "
                + "DataPropertyAssertion(:dp1 :a \"10\"^^xsd:integer)"
                + "SubClassOf(:A DataSomeValuesFrom(:dp2 DatatypeRestriction(xsd:integer xsd:minInclusive \"10\"^^xsd:integer xsd:maxInclusive \"10\"^^xsd:integer)))"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDisjointDPsUnsatStrings() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp1)) Declaration(DataProperty(:dp2)) "
                + "DisjointDataProperties(:dp1 :dp2) "
                + "DataPropertyAssertion(:dp1 :a \"ab\"^^xsd:string)"
                + "DataPropertyAssertion(:dp1 :a \"ac\"^^xsd:string)"
                + "SubClassOf(:A DataSomeValuesFrom(:dp2 DataOneOf(\"ab\"^^xsd:string \"ac\"^^xsd:string)))"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDisjointDPsSatInteger() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp1)) Declaration(DataProperty(:dp2)) "
                + "DisjointDataProperties(:dp1 :dp2) "
                + "DataPropertyAssertion(:dp1 :a \"10\"^^xsd:integer)"
                + "SubClassOf(:A DataSomeValuesFrom(:dp2 DatatypeRestriction(xsd:integer xsd:minInclusive \"18\"^^xsd:integer xsd:maxInclusive \"18\"^^xsd:integer)))"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testAllValuesFromInteger1() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3\"^^xsd:integer \"4\"^^xsd:integer))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"2\"^^xsd:integer \"3\"^^xsd:integer)))"
                + "SubClassOf(:A DataSomeValuesFrom(:dp DatatypeRestriction(xsd:integer xsd:minInclusive \"4\"^^xsd:integer)))"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testAllValuesFromInteger2() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3\"^^xsd:integer \"4\"^^xsd:integer))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"2\"^^xsd:integer \"3\"^^xsd:integer)))"
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataComplementOf(DataOneOf(\"3\"^^xsd:integer))) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testAllValuesFromMixed1() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3.0\"^^xsd:decimal \"4\"^^xsd:integer))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3.0\"^^xsd:decimal)))"
                + "SubClassOf(:A DataSomeValuesFrom(:dp DatatypeRestriction(xsd:integer xsd:maxInclusive \"3\"^^xsd:short)))"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testAllValuesFromMixed2() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3.0\"^^xsd:double \"4\"^^xsd:integer))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"2\"^^xsd:integer \"3.0\"^^xsd:decimal)))"
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataComplementOf(DataOneOf(\"3\"^^xsd:integer))) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testAllValuesFromDifferentTypes1() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3\"^^xsd:integer \"4\"^^xsd:int))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"2\"^^xsd:short \"3\"^^xsd:integer)))"
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataComplementOf(DataOneOf(\"3\"^^xsd:integer))) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testAllValuesFromDifferentTypes2() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp xsd:byte)) "
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataOneOf(\"6542145\"^^xsd:integer)) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testAllValuesFromDifferentTypes3() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3\"^^xsd:integer \"4\"^^xsd:int))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"2\"^^xsd:short \"3\"^^xsd:int)))"
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataOneOf(\"3\"^^xsd:integer)) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testNegZero1Integer() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"0\"^^xsd:integer))) "
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataOneOf(\"-0\"^^xsd:integer)) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testNegZero2Integer() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp owl:real)) "
                + "ClassAssertion(:A :a)"
                + "ClassAssertion(DataSomeValuesFrom(:dp DataOneOf(\"-0\"^^xsd:integer)) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testIntPlusDecimal() throws Exception {
        // forall :dp integer >= 5 <=7
        // forall :dp decimal >=6 <=6.8
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:byte xsd:minInclusive \"4.5\"^^xsd:decimal xsd:maxInclusive \"7\"^^xsd:short))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:decimal xsd:minInclusive \"6.0\"^^xsd:decimal xsd:maxInclusive \"6.8\"^^xsd:decimal))) "
                + "ClassAssertion(:A :a) "
                + "ClassAssertion(DataSomeValuesFrom(:dp rdfs:Literal) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testIntPlusDecimal2() throws Exception {
        // forall :dp integer >= 5 <=7
        // forall :dp decimal >=6.0 <=6.8
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:byte xsd:minInclusive \"4.5\"^^xsd:decimal xsd:maxInclusive \"7\"^^xsd:short))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:decimal xsd:minInclusive \"6.0\"^^xsd:decimal xsd:maxInclusive \"6.8\"^^xsd:decimal))) "
                + "SubClassOf(:A DataSomeValuesFrom(:dp owl:real))"
                + "ClassAssertion(:A :a) "
                + "NegativeDataPropertyAssertion(:dp :a \"6\"^^xsd:unsignedInt) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDecimals() throws Exception {
        // forall :dp decimal >= 5 <=7.2
        // forall :dp decimal >=6.0 <=6.8
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:decimal xsd:minInclusive \"5\"^^xsd:byte xsd:maxInclusive \"7.2\"^^xsd:decimal))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:decimal xsd:minInclusive \"6.0\"^^xsd:decimal xsd:maxInclusive \"6.8\"^^xsd:decimal))) "
                + "SubClassOf(:A DataSomeValuesFrom(:dp owl:real))"
                + "ClassAssertion(:A :a) "
                + "NegativeDataPropertyAssertion(:dp :a \"6\"^^xsd:unsignedInt) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDecimalPlusOWLreal() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp owl:real)) "
                + "SubClassOf(:A DataSomeValuesFrom(:dp DataOneOf(\"-22.5\"^^xsd:decimal \"-0\"^^xsd:integer)))"
                + "ClassAssertion(:A :a) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDecimalPlusInteger() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp xsd:integer)) "
                + "SubClassOf(:A DataSomeValuesFrom(:dp DataOneOf(\"-2.2\"^^xsd:decimal \"-0\"^^xsd:integer)))"
                + "ClassAssertion(:A :a) "
                + "NegativeDataPropertyAssertion(:dp :a \"0\"^^xsd:unsignedInt) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDifferentOneOfs() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DataOneOf(\"3.0\"^^xsd:decimal \"3\"^^xsd:integer)))"
                + "ClassAssertion(DataMinCardinality(2 :dp) :a) "
                + "ClassAssertion(:A :a) ";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testFloatZeros() throws Exception {
        // +0 and -0 are not equal
        String axioms = "Declaration(NamedIndividual(:Meg)) Declaration(DataProperty(:numberOfChildren)) "
                + "DataPropertyAssertion(:numberOfChildren :Meg \"+0.0\"^^xsd:float) "
                + "DataPropertyAssertion(:numberOfChildren :Meg \"-0.0\"^^xsd:float) "
                + "FunctionalDataProperty(:numberOfChildren)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testFloatEnumInconsistent() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:dp)) "
                + "ClassAssertion(DataSomeValuesFrom( :dp DatatypeRestriction( "
                + "xsd:float xsd:minExclusive \"0.0\"^^xsd:float "
                + "xsd:maxExclusive \"1.401298464324817e-45\"^^xsd:float)) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testRationals1() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:dp)) "
                + "ClassAssertion(DataAllValuesFrom(:dp "
                + "owl:rational) :a) "
                + "ClassAssertion(DataMinCardinality(2 :dp) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testRationals2() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:dp)) "
                + "ClassAssertion(DataAllValuesFrom(:dp "
                + "DataOneOf(\"1/2\"^^owl:rational \"0.5\"^^xsd:decimal)) :a)"
                + "ClassAssertion(DataMinCardinality(2 :dp) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testRationals3() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:dp)) "
                + "ClassAssertion(DataAllValuesFrom(:dp "
                + "DataOneOf(\"1/3\"^^owl:rational \"0.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333\"^^xsd:decimal)) :a)"
                + "ClassAssertion(DataMinCardinality(2 :dp) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDateTime1() throws Exception {
        String axioms = "SubClassOf(:A DataSomeValuesFrom(:dp DatatypeRestriction(xsd:dateTime xsd:minInclusive \"2008-10-08T20:44:11.656+01:00\"^^xsd:dateTime))) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:dateTime xsd:maxInclusive \"2008-10-08T20:44:11.656+01:00\"^^xsd:dateTime))) "
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDateTime2() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(DataProperty(:dp)) "
                + "SubClassOf(:A DataHasValue(:dp \"2007-10-08T20:44:11.656+01:00\"^^xsd:dateTime)) "
                + "SubClassOf(:A DataAllValuesFrom(:dp DatatypeRestriction(xsd:dateTime xsd:minInclusive \"2008-07-08T20:44:11.656+01:00\"^^xsd:dateTime xsd:maxInclusive \"2008-10-08T20:44:11.656+01:00\"^^xsd:dateTime))) "
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testSelfInequality() throws Exception {
        String axioms = "Declaration(NamedIndividual(:a)) Declaration(Class(:A)) Declaration(DataProperty(:dp1)) Declaration(DataProperty(:dp2)) Declaration(DataProperty(:dp3)) "
                + "DisjointDataProperties(:dp1 :dp2) "
                + "SubDataPropertyOf(:dp3 :dp1) "
                + "SubDataPropertyOf(:dp3 :dp2) "
                + "SubClassOf(:A DataSomeValuesFrom(:dp3 rdfs:Literal))"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeDef1() throws Exception {
        String axioms = "Declaration(Datatype(:SSN))"
                + "DatatypeDefinition(:SSN DatatypeRestriction(xsd:string xsd:pattern \"[0-9]{3}-[0-9]{2}-[0-9]{4}\"))"
                + "DataPropertyRange(:hasSSN :SSN)"
                + "DataPropertyAssertion(:hasSSN :Peter \"123-45-6789\")";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDatatypeDef2() throws Exception {
        String axioms = "Declaration(Datatype(:SSN))"
                + "DatatypeDefinition(:SSN DatatypeRestriction(xsd:string xsd:pattern \"[0-9]{3}-[0-9]{2}-[0-9]{4}\"))"
                + "DataPropertyRange(:hasSSN :SSN)"
                + "DataPropertyAssertion(:hasSSN :Peter \"13-42-64\")";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeDef3() throws Exception {
        String axioms = "Declaration(Datatype(:newDT))"
                + "DatatypeDefinition(:newDT DatatypeRestriction(xsd:integer xsd:minInclusive \"15\"^^xsd:integer))"
                + "DataPropertyRange(:dp :newDT)"
                + "DataPropertyAssertion(:dp :a \"13\"^^xsd:integer)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeDef4() throws Exception {
        String axioms = "Declaration(Datatype(:newDT))"
                + "DatatypeDefinition(:newDT DatatypeRestriction(xsd:integer xsd:minInclusive \"15\"^^xsd:integer))"
                + "DataPropertyRange(:dp DataComplementOf(:newDT))"
                + "DataPropertyAssertion(:dp :a \"13\"^^xsd:integer)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDatatypeDef6() throws Exception {
        String axioms = "Declaration(Datatype(:newDT))"
                + "DatatypeDefinition(:newDT DataComplementOf(DatatypeRestriction(xsd:integer xsd:minInclusive \"15\"^^xsd:integer)))"
                + "DataPropertyRange(:dp DataComplementOf(:newDT))"
                + "DataPropertyAssertion(:dp :a \"16\"^^xsd:integer)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDatatypeUnion1() throws Exception {
        String axioms = "SubClassOf(owl:Thing DataAllValuesFrom(:dp DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger)))"
                + "ClassAssertion(DataMinCardinality(2 :dp rdfs:Literal) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeUnion2() throws Exception {
        String axioms = "SubClassOf(owl:Thing DataAllValuesFrom(:dp DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger)))"
                + "ClassAssertion(DataMinCardinality(1 :dp rdfs:Literal) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDatatypeUnion3() throws Exception {
        String axioms = "SubClassOf(owl:Thing DataAllValuesFrom(:dp DataUnionOf(DataOneOf(\"abc\") DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger))))"
                + "ClassAssertion(DataMinCardinality(2 :dp rdfs:Literal) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDatatypeUnion4() throws Exception {
        String axioms = "SubClassOf(owl:Thing DataAllValuesFrom(:dp DataUnionOf(DataOneOf(\"abc\") DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger))))"
                + "ClassAssertion(DataMinCardinality(3 :dp rdfs:Literal) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeUnionIntersection1() throws Exception {
        String axioms = "SubClassOf(owl:Thing DataAllValuesFrom(:dp DataComplementOf(DataUnionOf(DataOneOf(\"abc\") DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger)))))"
                + "ClassAssertion(DataMinCardinality(3 :dp rdfs:Literal) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testDatatypeUnionIntersection2() throws Exception {
        String axioms = "SubClassOf(DataSomeValuesFrom(:dp DataUnionOf(DataOneOf(\"abc\") DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger))) :A)"
                + "DataPropertyAssertion(:dp :a \"0\"^^xsd:integer)"
                + "ClassAssertion(ObjectComplementOf(:A) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeUnionIntersection3() throws Exception {
        String axioms = "SubClassOf(DataSomeValuesFrom(:dp DataUnionOf(DataOneOf(\"abc\") DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger))) :A)"
                + "DataPropertyAssertion(:dp :a \"abc\"^^xsd:string)"
                + "ClassAssertion(ObjectComplementOf(:A) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }

    public void testDatatypeUnionIntersection4() throws Exception {
        String axioms = "SubClassOf(DataSomeValuesFrom(:dp DataUnionOf(DataOneOf(\"abc\") DataIntersectionOf(xsd:nonNegativeInteger xsd:nonPositiveInteger))) :A)"
                + "DataPropertyAssertion(:dp :a \"5\"^^xsd:integer)"
                + "ClassAssertion(ObjectComplementOf(:A) :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(true);
    }

    public void testNegativeDPAssertions() throws Exception {
        String axioms = "SubClassOf(:A DataSomeValuesFrom(:dp DataOneOf(\"5\"^^xsd:integer)))"
                + "NegativeDataPropertyAssertion(:dp :a \"5\"^^xsd:integer)"
                + "ClassAssertion(:A :a)";
        loadReasonerWithAxioms(axioms);
        assertABoxSatisfiable(false);
    }
}


text:
for file in ./target/*
do
  echo $file
  ./node_modules/.bin/gzip-size $file
done


text:
<?php use_helper('I18N', 'rtAdmin') ?>

<?php echo __('Listing Shop Categories') ?>

<?php slot('rt-tools') ?>
<?php include_partial('rtAdmin/standard_modal_tools', array('object' => new rtShopCategory))?>
<?php end_slot(); ?>

<?php include_partial('rtAdmin/flashes') ?>

      <?php echo __('Title') ?>
      <?php echo __('Published') ?>
      <?php echo __('Version') ?>
      <?php echo __('Created at') ?>

    <?php foreach ($rt_shop_categorys as $rt_shop_category): ?>
    <tr class="rt-admin-tree rt-admin-tree-level-<?php echo $rt_shop_category->level ?>">
      <a href="<?php echo url_for('rtShopCategoryAdmin/edit?id='.$rt_shop_category->getId()) ?>"><?php echo $rt_shop_category->getTitle() ?>

        <?php echo rt_nice_boolean($rt_shop_category->getPublished()) ?>

<?php echo $rt_shop_category->getId() ?>

      <?php echo link_to_if($rt_shop_category->version > 1, $rt_shop_category->version, 'rtShopCategoryAdmin/versions?id='.$rt_shop_category->getId()) ?>
      <?php echo $rt_shop_category->getCreatedAt() ?>

<?php echo rt_button_show(url_for('rtShopCategoryAdmin/show?id='.$rt_shop_category->getId())) ?>

<?php echo rt_button_edit(url_for('rtShopCategoryAdmin/edit?id='.$rt_shop_category->getId())) ?>

<?php echo rt_button_delete(url_for('rtShopCategoryAdmin/delete?id='.$rt_shop_category->getId())) ?>

          <?php if($rt_shop_category->getNode()->isRoot()): ?>

<?php echo rt_ui_button(__('tree'), 'rtShopCategoryAdmin/tree' . '?root=' . $rt_shop_category->getRootId(), 'arrow-1-e') ?>

          <?php endif; ?>

    <?php endforeach; ?>


text:
package sun.nio.cs.ext;

import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;

public class JIS_X_0208
    extends Charset
{

    public JIS_X_0208() {
        super("x-JIS0208", ExtendedCharsets.aliasesFor("x-JIS0208"));
    }

    public boolean contains(Charset cs) {
        return (cs instanceof JIS_X_0208);
    }

    public CharsetDecoder newDecoder() {
        return new Decoder(this);
    }

    public CharsetEncoder newEncoder() {
        return new JIS_X_0208_Encoder(this);
    }

    private static class Decoder extends JIS_X_0208_Decoder {
        protected char decodeSingle(int b) {
            return DoubleByteDecoder.REPLACE_CHAR;
        }

        public Decoder(Charset cs) {
            super(cs);
        }
    }
}


text:
package org.zaproxy.zap.view.panelsearch;

public interface SearchQuery {
    boolean match(String value);
}


text:
module IssueTemplateSettingsHelper
end


text:
// NotesProc.h: interface for the CPSTProc class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PSTPROC_H__8CD32256_505C_4973_9A04_DBC9BF1C4FA2__INCLUDED_)
#define AFX_PSTPROC_H__8CD32256_505C_4973_9A04_DBC9BF1C4FA2__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define DATEMASK_DWK_ALL			_T("DWK, DD MMM YYYY HH:MI:SS TZHH")
#define DATEMASK_DWK2				_T("DWK MMM DD HH:MI:SS YYYY")
#define DATEMASK_YYYYMMDDHHMI		_T("YYYYMMDDHHMI")
#define DATEMASK_YYYYMMDDHHMISS		_T("YYYYMMDDHHMISS")

#define MODIFIER_BASE64				_T("base64")
#define MODIFIER_SMTPLOOKUP			_T("smtpLookup")

#define PSTMASK _T("*.pst")

#define BUFFER_SIZE 8192
#define ENTRY_LEN 256

class CPST2MBOXApp;
class CMailbox;
class CObjectArray;
class CMessageItem;
class CList;

typedef struct {
	unsigned long totalBytesProcessed;
	FILE *outputFile;
} CallBackData;

class CPSTProc
{
public:
	CPSTProc();
	virtual ~CPSTProc();

	int Start(_TCHAR* exec, CPST2MBOXApp *theApp);
	int PerformMigration(char *dbFullPath);
	int PerformMigrationLocal(_TCHAR *inputDir);
	int PerformOneMailboxMigration(LPMAPISESSION pses, LPMDB pmdb, const _TCHAR *pstFile, const _TCHAR *outputdir,
		UINT *totalFiles = NULL, UINT *totalFilesError = NULL);
//	char* ResolveEntry(DBHANDLE hDB, char* token, const _TCHAR* resolveDocField, const _TCHAR* resolveDocForm,
//							   const _TCHAR* resolveDocLookupField, int* retCode);
//	STATUS near pascal GetUniqueFileName(char *Drive, char *Ext,
//                                        char *FileName);
	HRESULT ResolveFolders(LPMAPISESSION pSes, LPMDB pmdb, LPMAPIFOLDER lpfRootF, _TCHAR *rootFolderName,
									_TCHAR *output_dir,
								  CObjectArray& resolvedFolders,
								  UINT *totalMsgs, UINT *totalMsgsDone,
								  UINT *totalMsgsSkipped, UINT *totalMsgsError);
	void FilterFolders(CObjectArray& resolvedFolders, _TCHAR const *requestedFolders);
	HRESULT ProcessOneSkippedFolder(LPMDB pmdb, _TCHAR *fullFolderName,
									UINT *totalFolderMsgsSkipped);
	HRESULT ProcessOneFolder(LPMAPISESSION pSes, LPMDB pmdb,
		_TCHAR *folderName, _TCHAR *output_dir,
		UINT *totalFolderMsgs, UINT *totalFolderMsgsDone,
		UINT *totalFolderMsgsSkipped, UINT *totalFolderMsgsError);
	HRESULT ProcessOneMessage(LPMESSAGE lpMsg, FILE *f);
	HRESULT ApplyTransformers(LPMESSAGE lpMsg,  const _TCHAR *name,
		const _TCHAR *value, FILE *outputFile);

	HRESULT ProcessBody(LPMESSAGE lpMsg, FILE* outputFile);
	HRESULT ProcessAttachments(LPMESSAGE lpMsg, FILE* outputFile);
	HRESULT PutTextHeader(LPMESSAGE lpMsg, FILE *outputFile);
	HRESULT PutFileHeader(LPMESSAGE lpMsg, FILE *outputFile);
	HRESULT PutFilesFooter(LPMESSAGE lpMsg, FILE *outputFile);

/*
	void PutMessageSender(NOTEHANDLE hNote, LPMESSAGE lpMessage, LPSPropValue pMessagePropValues, UINT *c);
	void PutMessageRecipients(NOTEHANDLE hNote, LPMESSAGE lpMessage, LPSPropValue pMessagePropValues, UINT *c);
	STATUS ProcessBody(NOTEHANDLE hNote, LPMESSAGE lpMessage, UINT *NumNotesEncrypt);
	STATUS ProcessAttachments(NOTEHANDLE hNote, LPMESSAGE lpMessage, UINT *NumNotesEncrypt);
	void PutFileHeader(NOTEHANDLE hNote, BLOCKID value_blockid, FILE *outputFile);
	void PutFilesFooter(NOTEHANDLE hNote, FILE *outputFile);
	void PutTextHeader(NOTEHANDLE hNote, FILE *outputFile);
	STATUS ApplyTransformers(NOTEHANDLE hNote, CMessageItem *item,
		LPMESSAGE lpMessage, LPSPropValue pMessagePropValues, UINT *c,
		BLOCKID *value_blockid = NULL);
	bool IsDateInRange(DBHANDLE hDB, NOTEHANDLE hNote, _TCHAR const *dateFilterField,
								_TCHAR const *dateFilterAfter, _TCHAR const *dateFilterBefore,
								_TCHAR const *dateMask);
*/
	void parseSMTPFile(const _TCHAR *smtpAddrFile, const _TCHAR *smtpPartsSep);
	void DoSmtpLookup(_TCHAR *field_text, WORD *field_len);

protected:
	bool m_verbose;
	_TCHAR m_language[3];
	_TCHAR m_server[256];
	_TCHAR m_basedn[512];
	_TCHAR m_filter[256];
	_TCHAR m_container[512];
	_TCHAR m_groupcontainer[512];
	_TCHAR m_pstfilePassword[128];
	_TCHAR m_inputdir[512];
	_TCHAR m_logFile[512];
	unsigned int m_logSizeWrap;
	_TCHAR m_outputdir[512];
	_TCHAR m_onlyPSTFile[512];
	_TCHAR m_smtpAddrFile[256];
	_TCHAR m_smtpPartsSep[32];
	bool m_appendLogFile;

	CPST2MBOXApp *theParentApp;

	CMailbox *mailbox;
	CList *listSuppl;
	CList *smtpAdr;

public:
	// Get/Set m_language
	_TCHAR const * GetLanguage();
	void SetLanguage(const _TCHAR *language);

	// Get/Set m_server
	_TCHAR const * GetServer();
	void SetServer(const _TCHAR *server);

	// Get/Set m_filter
	_TCHAR const * GetFilter();
	void SetFilter(const _TCHAR *filter);

	// Get/Set m_container
	_TCHAR const * GetContainer();
	void SetContainer(const _TCHAR *container);

	// Get/Set m_groupcontainer
	_TCHAR const * GetGroupContainer();
	void SetGroupContainer(const _TCHAR *groupcontainer);

	// Get/Set m_idfilePassword
	_TCHAR const * GetPSTFilePassword();
	void SetPSTFilePassword(const _TCHAR *idFilePassword);

	// Get/Set m_inputdir
	_TCHAR const * GetInputDir();
	void SetInputDir(const _TCHAR *inputDir);

	// Get/Set m_logFile
	_TCHAR const * GetLogFile();
	void SetLogFile(const _TCHAR *logFile);

	// Get/Set m_logSizeWrap
	unsigned int GetLogSizeWrap();
	void SetLogSizeWrap(unsigned int logSizeWrap);

	// Get/Set m_outputdir
	_TCHAR const * GetOutputDir();
	void SetOutputDir(const _TCHAR *outputDir);

	// Get/Set m_onlyNSFFile
	_TCHAR const * GetOnlyPSTFile();
	void SetOnlyPSTFile(const _TCHAR *onlyNSFFile);

	// Get/Set m_smtpAddrFile
	_TCHAR const * GetSmtpAddrFile();
	void SetSmtpAddrFile(const _TCHAR *smtpAddrFile);

	// Get/Set m_smtpPartsSep
	_TCHAR const * GetSmtpPartsSep();
	void SetSmtpPartsSep(const _TCHAR *smtpPartsSep);

	// Get/Set m_verbose
	bool const GetVerbose();
	void SetVerbose(const bool verbose);

	// Get/Set m_appendLogFile
	bool const GetAppendLogFile();
	void SetAppendLogFile(const bool appendLogFile);

	int CreateOutlookFile(_TCHAR *targetdir, const _TCHAR *name, int how, bool splitName = TRUE, _TCHAR *nsfFile = NULL);

private:
	void GetPSTMask(_TCHAR *pstmask);
	ULONG GetXMLPropTagValue(const _TCHAR *propTag);
	bool IsIgnoredFolder(_TCHAR *ignoredFolders, _TCHAR *folderName);
	bool IsIgnoredMessageForm(_TCHAR *messageForms, char *messageFormCh);
//	STATUS RetrieveFirstLastDomainFromSent(HANDLE hMessageFile, _TCHAR *firstLast);
	void SetRecipient(CMessageItem *item, LPMESSAGE lpMessage, char *field_text, char *email, LPSPropValue pMessagePropValues, UINT *c);

};

#endif // !defined(AFX_PSTPROC_H__8CD32256_505C_4973_9A04_DBC9BF1C4FA2__INCLUDED_)


text:
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

    <script src="2DGeometryStructure.js"></script>
</body>
</html>


text:
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
import urllib2
import ambari_simplejson as json # simplejson is much faster comparing to Python 2.6 json module and has the same functions set.
from resource_management.core import shell
from resource_management.core.logger import Logger
from resource_management.libraries.functions.get_user_call_output import get_user_call_output

def get_value_from_jmx(qry, property, security_enabled, run_user, is_https_enabled, last_retry=True):
  try:
    if security_enabled:
      cmd = ['curl', '--negotiate', '-u', ':', '-s']
    else:
      cmd = ['curl', '-s']

    if is_https_enabled:
      cmd.append("-k")

    cmd.append(qry)

    _, data, _ = get_user_call_output(cmd, user=run_user, quiet=False)

    if data:
      data_dict = json.loads(data)
      return data_dict["beans"][0][property]
  except:
    if last_retry:
      Logger.logger.exception("Getting jmx metrics from NN failed. URL: " + str(qry))
    return None


text:
export const GET_ORDERS = 'orders/GET_ORDERS'
export const GET_CURRENT_ORDER = 'orders/GET_CURRENT_ORDER'

const getters = {
  [GET_ORDERS](state) {
    return state.orders
  },

  [GET_CURRENT_ORDER](state) {
    return state.currentOrder
  }
}

export default getters


text:
using System.Reflection;
using Raccoon.Data.Parsers;

namespace Raccoon.Data {
    public partial class DataContract {
        public class Property {
            public Property(
                PropertyInfo info,
                DataFieldAttribute attribute,
                FontCase defaultFieldNameCase
            ) {
                if (info == null) {
                    throw new System.ArgumentNullException(nameof(info));
                }

                if (attribute == null) {
                    throw new System.ArgumentNullException(nameof(attribute));
                }

                Info = info;
                Attribute = attribute;

                SubDataContractDescriptor
                    = info.PropertyType.GetCustomAttribute<DataContractAttribute>(true);

                if (SubDataContractDescriptor != null) {
                    SubDataContract = new DataContract(Info.PropertyType, SubDataContractDescriptor);
                } else {
                    SubDataContract = null;
                }

                FontCase fontCase;
                if (Attribute.Case == FontCase.None) {
                    fontCase = defaultFieldNameCase;
                } else {
                    fontCase = Attribute.Case;
                }

                DisplayName = fontCase.Apply(Info.Name, true);
                IdentifyName = DisplayName.RemoveAll(' ');
            }

            public string DisplayName { get; }
            public string IdentifyName { get; }

            /// <summary>
            /// Property received a value.
            /// </summary>
            public bool ReceivedValue { get; private set; }

            public PropertyInfo Info { get; }
            public DataFieldAttribute Attribute { get; }
            public DataContractAttribute SubDataContractDescriptor { get; }
            public DataContract SubDataContract { get; }

            public bool HasName(string name) {
                return IdentifyName.Equals(name, System.StringComparison.InvariantCultureIgnoreCase);
            }

            public void SetValue(object target, ValueToken token) {
                token.SetPropertyValue(target, Info);
                ReceivedValue = true;
            }

            public void MarkAsReceivedValue() {
                ReceivedValue = true;
            }

            public void Verify(object target, DataOperation parentOperation = DataOperation.None) {
                if ((Attribute.Required | parentOperation).Has(DataOperation.Load)
                 && !ReceivedValue
                ) {
                    // a load operation was expected to succeed, no value was received

                    throw DataVerificationFailedException.Property(this);
                }

                if (SubDataContract != null) {
                    try {
                        SubDataContract.Verify(
                            Info.GetValue(target),
                            Attribute.Required | parentOperation
                        );
                    } catch (DataVerificationFailedException ex) {
                        throw new DataVerificationFailedException($"At {nameof(Property)} ({Info.PropertyType.ToString()})", ex);
                    }
                }
            }
        }
    }
}


text:
package api

import (
	"bytes"
	"encoding/json"
	"fmt"
	"github.com/bbbacsa/deploy.io/constants"
	"io/ioutil"
	"net/http"
	"net/url"
)

type Host struct {
	ID         string `json:"_id"`
	Name       string
	URL        string
	Size       int64
	IPAddress  string `json:"ipv4_address"`
	Port       int64
	ClientKey  string `json:"client_key"`
	ClientCert string `json:"client_cert"`
}

type HTTPClient struct {
	BaseURL  string
	Username string
	Key    string
}

type AuthResponse struct {
  Session struct {
    Username string
  	Key      string
  }
}

func (client *HTTPClient) GetAuthKey(username string, password string) (string, string, error) {
	resp, err := http.PostForm(client.BaseURL+"/login",
		url.Values{"username": {username}, "password": {password}})

	if err != nil {
		return "", "", err
	}
	defer resp.Body.Close()

	var authResponse AuthResponse
	if err := DecodeResponse(resp, &authResponse); err != nil {
		return "", "", err
	}

	return authResponse.Session.Username, authResponse.Session.Key, nil
}

func (client *HTTPClient) GetHosts() ([]*Host, error) {
	req, err := http.NewRequest("GET", client.BaseURL+"/hosts", nil)
	if err != nil {
		return nil, err
	}

	var hosts struct {
	  Data []*Host
	}
	if err := client.DoRequest(req, &hosts); err != nil {
		return nil, err
	}
	return hosts.Data, nil
}

func (client *HTTPClient) GetHost(name string) (*Host, error) {
	req, err := http.NewRequest("GET", client.BaseURL+"/hosts/"+name, nil)
	if err != nil {
		return nil, err
	}
	var host Host
	if err := client.DoRequest(req, &host); err != nil {
		return nil, err
	}
	return &host, nil
}

func (client *HTTPClient) CreateHost(name string, ramInMB int) (*Host, error) {
	v := make(map[string]interface{})
	v["name"] = name
	v["size"] = ramInMB
	body, err := json.Marshal(v)
	if err != nil {
		return nil, err
	}

	req, err := http.NewRequest("POST", client.BaseURL+"/hosts", bytes.NewReader(body))
	if err != nil {
		return nil, err
	}

	var host Host
	if err := client.DoRequest(req, &host); err != nil {
		return nil, err
	}
	return &host, nil
}

func (client *HTTPClient) DeleteHost(id string) error {
	req, err := http.NewRequest("DELETE", client.BaseURL+"/hosts/"+id, nil)
	if err != nil {
		return err
	}
	if err := client.DoRequest(req, nil); err != nil {
		return err
	}

	return nil
}

func (client *HTTPClient) DoRequest(req *http.Request, v interface{}) error {
	cl := &http.Client{}
	req.SetBasicAuth(client.Username, client.Key)
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("User-Agent", fmt.Sprintf("deploy.io/%s", constants.Version))
	resp, err := cl.Do(req)
	if err != nil {
		return err
	}
	if err := DecodeResponse(resp, v); err != nil {
		return err
	}
	return nil
}

func DecodeResponse(resp *http.Response, v interface{}) error {
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return err
	}

	if resp.StatusCode < 200 || resp.StatusCode >= 400 {
		explanation := string(body)
		var jsonError map[string]interface{}

		if err := json.Unmarshal(body, &jsonError); err == nil {
			if jsonError["detail"] != nil {
				explanation = jsonError["detail"].(string)
			}
		}

		return fmt.Errorf("The Deploy.IO API returned an error: %s", explanation)
	}

	if v != nil {
		if err := json.Unmarshal(body, &v); err != nil {
			return err
		}
	}

	return nil
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="cn.kukool.downloadertest" >

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service android:name="cn.kukool.downloader.service.DownloadService"
            android:exported="false" android:permission="android.permission.INTERNET">
            <intent-filter>
                <action android:name="cn.kukool.downloader.downloadservice" />
            </intent-filter>
        </service>
    </application>

</manifest>


text:
layout: post
microblog: true
date: 2017-07-07 14:32 +0300
guid: http://desparoz.micro.blog/2017/07/07/t883287609035956224.html
---
Website still down.  Hopefully will be able to fix it over the weekend


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Reflection;

namespace Microsoft.CodeAnalysis.CommandLine
{
    internal class DesktopBuildClient : BuildClient
    {
        private readonly RequestLanguage _language;
        private readonly CompileFunc _compileFunc;
        private readonly IAnalyzerAssemblyLoader _analyzerAssemblyLoader;

        /// <summary>
        /// When set it overrides all timeout values in milliseconds when communicating with the server.
        /// </summary>
        internal int? TimeoutOverride { get; set; }

        internal DesktopBuildClient(RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader)
        {
            _language = language;
            _compileFunc = compileFunc;
            _analyzerAssemblyLoader = analyzerAssemblyLoader;
        }

        internal static int Run(IEnumerable<string> arguments, RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader)
        {
            var client = new DesktopBuildClient(language, compileFunc, analyzerAssemblyLoader);
            var clientDir = AppContext.BaseDirectory;
            var sdkDir = GetRuntimeDirectoryOpt();
            var workingDir = Directory.GetCurrentDirectory();
            var tempDir = BuildServerConnection.GetTempPath(workingDir);
            var buildPaths = new BuildPaths(clientDir: clientDir, workingDir: workingDir, sdkDir: sdkDir, tempDir: tempDir);
            var originalArguments = GetCommandLineArgs(arguments).ToArray();
            return client.RunCompilation(originalArguments, buildPaths).ExitCode;
        }

        internal static string GetRuntimeDirectoryOpt()
        {
            Type runtimeEnvironmentType = Roslyn.Utilities.ReflectionUtilities.TryGetType(
                "System.Runtime.InteropServices.RuntimeEnvironment, " +
                "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");

            return (string)runtimeEnvironmentType
                ?.GetTypeInfo()
                .GetDeclaredMethod("GetRuntimeDirectory")
                ?.Invoke(obj: null, parameters: null);
        }

        protected override int RunLocalCompilation(string[] arguments, BuildPaths buildPaths, TextWriter textWriter)
        {
            return _compileFunc(arguments, buildPaths, textWriter, _analyzerAssemblyLoader);
        }

        protected override Task<BuildResponse> RunServerCompilation(
            List<string> arguments,
            BuildPaths buildPaths,
            string sessionKey,
            string keepAlive,
            string libDirectory,
            CancellationToken cancellationToken)
        {
            return RunServerCompilationCore(_language, arguments, buildPaths, sessionKey, keepAlive, libDirectory, TimeoutOverride, TryCreateServer, cancellationToken);
        }

        public static Task<BuildResponse> RunServerCompilation(
            RequestLanguage language,
            List<string> arguments,
            BuildPaths buildPaths,
            string keepAlive,
            string libEnvVariable,
            CancellationToken cancellationToken)
        {
            var pipeNameOpt = BuildServerConnection.GetPipeNameForPathOpt(buildPaths.ClientDirectory);

            return RunServerCompilationCore(
                language,
                arguments,
                buildPaths,
                pipeNameOpt,
                keepAlive,
                libEnvVariable,
                timeoutOverride: null,
                tryCreateServerFunc: BuildServerConnection.TryCreateServerCore,
                cancellationToken: cancellationToken);
        }

        private static Task<BuildResponse> RunServerCompilationCore(
            RequestLanguage language,
            List<string> arguments,
            BuildPaths buildPaths,
            string pipeName,
            string keepAlive,
            string libEnvVariable,
            int? timeoutOverride,
            Func<string, string, bool> tryCreateServerFunc,
            CancellationToken cancellationToken)
        {
            var alt = new BuildPathsAlt(
                buildPaths.ClientDirectory,
                buildPaths.WorkingDirectory,
                buildPaths.SdkDirectory,
                buildPaths.TempDirectory);

            return BuildServerConnection.RunServerCompilationCore(
                language,
                arguments,
                alt,
                pipeName,
                keepAlive,
                libEnvVariable,
                timeoutOverride,
                tryCreateServerFunc,
                cancellationToken);
        }

        /// <summary>
        /// Create a new instance of the server process, returning true on success
        /// and false otherwise.
        /// </summary>
        protected virtual bool TryCreateServer(string clientDir, string pipeName)
        {
            return BuildServerConnection.TryCreateServerCore(clientDir, pipeName);
        }

        /// <summary>
        /// Given the full path to the directory containing the compiler exes,
        /// retrieves the name of the pipe for client/server communication on
        /// that instance of the compiler.
        /// </summary>
        protected override string GetSessionKey(BuildPaths buildPaths)
        {
            return BuildServerConnection.GetPipeNameForPathOpt(buildPaths.ClientDirectory);
        }
    }
}