text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <xorg-server.h>
#include "xf86Module.h"

#include <X11/Xatom.h>
#include <xf86.h>
#include <xf86Xinput.h>
#include <exevents.h>

#include "synaptics.h"
#include "synapticsstr.h"
#include "synaptics-properties.h"

#ifndef XATOM_FLOAT
#define XATOM_FLOAT "FLOAT"
#endif

#ifndef XI_PROP_PRODUCT_ID
#define XI_PROP_PRODUCT_ID "Device Product ID"
#endif

#ifndef XI_PROP_DEVICE_NODE
#define XI_PROP_DEVICE_NODE "Device Node"
#endif

static Atom float_type;

Atom prop_edges = 0;
Atom prop_finger = 0;
Atom prop_tap_time = 0;
Atom prop_tap_move = 0;
Atom prop_tap_durations = 0;
Atom prop_clickpad = 0;
Atom prop_tap_fast = 0;
Atom prop_middle_timeout = 0;
Atom prop_twofinger_pressure = 0;
Atom prop_twofinger_width = 0;
Atom prop_scrolldist = 0;
Atom prop_scrolledge = 0;
Atom prop_scrolltwofinger = 0;
Atom prop_speed = 0;
Atom prop_edgemotion_pressure = 0;
Atom prop_edgemotion_speed = 0;
Atom prop_edgemotion_always = 0;
Atom prop_buttonscroll = 0;
Atom prop_buttonscroll_repeat = 0;
Atom prop_buttonscroll_time = 0;
Atom prop_off = 0;
Atom prop_lockdrags = 0;
Atom prop_lockdrags_time = 0;
Atom prop_tapaction = 0;
Atom prop_clickaction = 0;
Atom prop_circscroll = 0;
Atom prop_circscroll_dist = 0;
Atom prop_circscroll_trigger = 0;
Atom prop_circpad = 0;
Atom prop_palm = 0;
Atom prop_palm_dim = 0;
Atom prop_coastspeed = 0;
Atom prop_pressuremotion = 0;
Atom prop_pressuremotion_factor = 0;
Atom prop_grab = 0;
Atom prop_gestures = 0;
Atom prop_capabilities = 0;
Atom prop_resolution = 0;
Atom prop_area = 0;
Atom prop_softbutton_areas = 0;
Atom prop_noise_cancellation = 0;
Atom prop_product_id = 0;
Atom prop_device_node = 0;

static Atom
InitTypedAtom(DeviceIntPtr dev, char *name, Atom type, int format, int nvalues,
              int *values)
{
    int i;
    Atom atom;
    uint8_t val_8[9];           /* we never have more than 9 values in an atom */
    uint16_t val_16[9];
    uint32_t val_32[9];
    pointer converted;

    for (i = 0; i < nvalues; i++) {
        switch (format) {
        case 8:
            val_8[i] = values[i];
            break;
        case 16:
            val_16[i] = values[i];
            break;
        case 32:
            val_32[i] = values[i];
            break;
        }
    }

    switch (format) {
    case 8:
        converted = val_8;
        break;
    case 16:
        converted = val_16;
        break;
    case 32:
        converted = val_32;
        break;
    }

    atom = MakeAtom(name, strlen(name), TRUE);
    XIChangeDeviceProperty(dev, atom, type, format, PropModeReplace, nvalues,
                           converted, FALSE);
    XISetDevicePropertyDeletable(dev, atom, FALSE);
    return atom;
}

static Atom
InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values)
{
    return InitTypedAtom(dev, name, XA_INTEGER, format, nvalues, values);
}

static Atom
InitFloatAtom(DeviceIntPtr dev, char *name, int nvalues, float *values)
{
    Atom atom;

    atom = MakeAtom(name, strlen(name), TRUE);
    XIChangeDeviceProperty(dev, atom, float_type, 32, PropModeReplace,
                           nvalues, values, FALSE);
    XISetDevicePropertyDeletable(dev, atom, FALSE);
    return atom;
}

static void
InitSoftButtonProperty(InputInfoPtr pInfo)
{
    SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
    SynapticsParameters *para = &priv->synpara;
    int values[8];

    values[0] = para->softbutton_areas[0][0];
    values[1] = para->softbutton_areas[0][1];
    values[2] = para->softbutton_areas[0][2];
    values[3] = para->softbutton_areas[0][3];
    values[4] = para->softbutton_areas[1][0];
    values[5] = para->softbutton_areas[1][1];
    values[6] = para->softbutton_areas[1][2];
    values[7] = para->softbutton_areas[1][3];
    prop_softbutton_areas =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 8, values);
}

void
InitDeviceProperties(InputInfoPtr pInfo)
{
    SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
    SynapticsParameters *para = &priv->synpara;
    int values[9];              /* we never have more than 9 values in an atom */
    float fvalues[4];           /* never have more than 4 float values */

    float_type = XIGetKnownProperty(XATOM_FLOAT);
    if (!float_type) {
        float_type = MakeAtom(XATOM_FLOAT, strlen(XATOM_FLOAT), TRUE);
        if (!float_type) {
            xf86IDrvMsg(pInfo, X_ERROR, "Failed to init float atom. "
                        "Disabling property support.\n");
            return;
        }
    }

    values[0] = para->left_edge;
    values[1] = para->right_edge;
    values[2] = para->top_edge;
    values[3] = para->bottom_edge;

    prop_edges = InitAtom(pInfo->dev, SYNAPTICS_PROP_EDGES, 32, 4, values);

    values[0] = para->finger_low;
    values[1] = para->finger_high;
    values[2] = para->finger_press;

    prop_finger = InitAtom(pInfo->dev, SYNAPTICS_PROP_FINGER, 32, 3, values);
    prop_tap_time =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_TIME, 32, 1, &para->tap_time);
    prop_tap_move =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_MOVE, 32, 1, &para->tap_move);

    values[0] = para->single_tap_timeout;
    values[1] = para->tap_time_2;
    values[2] = para->click_time;

    prop_tap_durations =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_DURATIONS, 32, 3, values);
    prop_clickpad =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_CLICKPAD, 8, 1, &para->clickpad);
    prop_tap_fast =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_FAST, 8, 1, &para->fast_taps);
    prop_middle_timeout =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_MIDDLE_TIMEOUT, 32, 1,
                 &para->emulate_mid_button_time);
    prop_twofinger_pressure =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_TWOFINGER_PRESSURE, 32, 1,
                 &para->emulate_twofinger_z);
    prop_twofinger_width =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_TWOFINGER_WIDTH, 32, 1,
                 &para->emulate_twofinger_w);

    values[0] = para->scroll_dist_vert;
    values[1] = para->scroll_dist_horiz;
    prop_scrolldist =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_SCROLL_DISTANCE, 32, 2, values);

    values[0] = para->scroll_edge_vert;
    values[1] = para->scroll_edge_horiz;
    values[2] = para->scroll_edge_corner;
    prop_scrolledge =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_SCROLL_EDGE, 8, 3, values);
    values[0] = para->scroll_twofinger_vert;
    values[1] = para->scroll_twofinger_horiz;
    prop_scrolltwofinger =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_SCROLL_TWOFINGER, 8, 2, values);

    fvalues[0] = para->min_speed;
    fvalues[1] = para->max_speed;
    fvalues[2] = para->accl;
    fvalues[3] = para->trackstick_speed;
    prop_speed = InitFloatAtom(pInfo->dev, SYNAPTICS_PROP_SPEED, 4, fvalues);

    values[0] = para->edge_motion_min_z;
    values[1] = para->edge_motion_max_z;
    prop_edgemotion_pressure =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_EDGEMOTION_PRESSURE, 32, 2, values);

    values[0] = para->edge_motion_min_speed;
    values[1] = para->edge_motion_max_speed;
    prop_edgemotion_speed =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_EDGEMOTION_SPEED, 32, 2, values);
    prop_edgemotion_always =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_EDGEMOTION, 8, 1,
                 &para->edge_motion_use_always);

    if (priv->has_scrollbuttons) {
        values[0] = para->updown_button_scrolling;
        values[1] = para->leftright_button_scrolling;
        prop_buttonscroll =
            InitAtom(pInfo->dev, SYNAPTICS_PROP_BUTTONSCROLLING, 8, 2, values);

        values[0] = para->updown_button_repeat;
        values[1] = para->leftright_button_repeat;
        prop_buttonscroll_repeat =
            InitAtom(pInfo->dev, SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT, 8, 2,
                     values);
        prop_buttonscroll_time =
            InitAtom(pInfo->dev, SYNAPTICS_PROP_BUTTONSCROLLING_TIME, 32, 1,
                     &para->scroll_button_repeat);
    }

    prop_off =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_OFF, 8, 1, &para->touchpad_off);
    prop_lockdrags =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_LOCKED_DRAGS, 8, 1,
                 &para->locked_drags);
    prop_lockdrags_time =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_LOCKED_DRAGS_TIMEOUT, 32, 1,
                 &para->locked_drag_time);

    memcpy(values, para->tap_action, MAX_TAP * sizeof(int));
    prop_tapaction =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_TAP_ACTION, 8, MAX_TAP, values);

    memcpy(values, para->click_action, MAX_CLICK * sizeof(int));
    prop_clickaction =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_CLICK_ACTION, 8, MAX_CLICK, values);

    prop_circscroll =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_SCROLLING, 8, 1,
                 &para->circular_scrolling);

    fvalues[0] = para->scroll_dist_circ;
    prop_circscroll_dist =
        InitFloatAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_SCROLLING_DIST, 1,
                      fvalues);

    prop_circscroll_trigger =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_SCROLLING_TRIGGER, 8, 1,
                 &para->circular_trigger);
    prop_circpad =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_PAD, 8, 1,
                 &para->circular_pad);
    prop_palm =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_PALM_DETECT, 8, 1,
                 &para->palm_detect);

    values[0] = para->palm_min_width;
    values[1] = para->palm_min_z;

    prop_palm_dim =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_PALM_DIMENSIONS, 32, 2, values);

    fvalues[0] = para->coasting_speed;
    fvalues[1] = para->coasting_friction;
    prop_coastspeed =
        InitFloatAtom(pInfo->dev, SYNAPTICS_PROP_COASTING_SPEED, 2, fvalues);

    values[0] = para->press_motion_min_z;
    values[1] = para->press_motion_max_z;
    prop_pressuremotion =
        InitTypedAtom(pInfo->dev, SYNAPTICS_PROP_PRESSURE_MOTION, XA_CARDINAL,
                      32, 2, values);

    fvalues[0] = para->press_motion_min_factor;
    fvalues[1] = para->press_motion_max_factor;

    prop_pressuremotion_factor =
        InitFloatAtom(pInfo->dev, SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 2,
                      fvalues);

    prop_grab =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_GRAB, 8, 1,
                 &para->grab_event_device);

    values[0] = para->tap_and_drag_gesture;
    prop_gestures = InitAtom(pInfo->dev, SYNAPTICS_PROP_GESTURES, 8, 1, values);

    values[0] = priv->has_left;
    values[1] = priv->has_middle;
    values[2] = priv->has_right;
    values[3] = priv->has_double;
    values[4] = priv->has_triple;
    values[5] = priv->has_pressure;
    values[6] = priv->has_width;
    prop_capabilities =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_CAPABILITIES, 8, 7, values);

    values[0] = para->resolution_vert;
    values[1] = para->resolution_horiz;
    prop_resolution =
        InitAtom(pInfo->dev, SYNAPTICS_PROP_RESOLUTION, 32, 2, values);

    values[0] = para->area_left_edge;
    values[1] = para->area_right_edge;
    values[2] = para->area_top_edge;
    values[3] = para->area_bottom_edge;
    prop_area = InitAtom(pInfo->dev, SYNAPTICS_PROP_AREA, 32, 4, values);

    if (para->clickpad)
        InitSoftButtonProperty(pInfo);

    values[0] = para->hyst_x;
    values[1] = para->hyst_y;
    prop_noise_cancellation = InitAtom(pInfo->dev,
                                       SYNAPTICS_PROP_NOISE_CANCELLATION, 32, 2,
                                       values);

    /* only init product_id property if we actually know them */
    if (priv->id_vendor || priv->id_product) {
        values[0] = priv->id_vendor;
        values[1] = priv->id_product;
        prop_product_id =
            InitAtom(pInfo->dev, XI_PROP_PRODUCT_ID, 32, 2, values);
    }

    if (priv->device) {
        prop_device_node =
            MakeAtom(XI_PROP_DEVICE_NODE, strlen(XI_PROP_DEVICE_NODE), TRUE);
        XIChangeDeviceProperty(pInfo->dev, prop_device_node, XA_STRING, 8,
                               PropModeReplace, strlen(priv->device),
                               (pointer) priv->device, FALSE);
        XISetDevicePropertyDeletable(pInfo->dev, prop_device_node, FALSE);
    }

}

int
SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
            BOOL checkonly)
{
    InputInfoPtr pInfo = dev->public.devicePrivate;
    SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
    SynapticsParameters *para = &priv->synpara;
    SynapticsParameters tmp;

    /* If checkonly is set, no parameters may be changed. So just let the code
     * change temporary variables and forget about it. */
    if (checkonly) {
        tmp = *para;
        para = &tmp;
    }

    if (property == prop_edges) {
        INT32 *edges;

        if (prop->size != 4 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        edges = (INT32 *) prop->data;
        if (edges[0] > edges[1] || edges[2] > edges[3])
            return BadValue;

        para->left_edge = edges[0];
        para->right_edge = edges[1];
        para->top_edge = edges[2];
        para->bottom_edge = edges[3];

    }
    else if (property == prop_finger) {
        INT32 *finger;

        if (prop->size != 3 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        finger = (INT32 *) prop->data;
        if (finger[0] > finger[1])
            return BadValue;

        para->finger_low = finger[0];
        para->finger_high = finger[1];
        para->finger_press = finger[2];

    }
    else if (property == prop_tap_time) {
        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        para->tap_time = *(INT32 *) prop->data;

    }
    else if (property == prop_tap_move) {
        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        para->tap_move = *(INT32 *) prop->data;
    }
    else if (property == prop_tap_durations) {
        INT32 *timeouts;

        if (prop->size != 3 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        timeouts = (INT32 *) prop->data;

        para->single_tap_timeout = timeouts[0];
        para->tap_time_2 = timeouts[1];
        para->click_time = timeouts[2];
    }
    else if (property == prop_clickpad) {
        BOOL value;

        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        value = *(BOOL *) prop->data;
        if (!para->clickpad && value && !prop_softbutton_areas)
            InitSoftButtonProperty(pInfo);
        else if (para->clickpad && !value && prop_softbutton_areas) {
            XIDeleteDeviceProperty(dev, prop_softbutton_areas, FALSE);
            prop_softbutton_areas = 0;
        }

        para->clickpad = *(BOOL *) prop->data;
    }
    else if (property == prop_tap_fast) {
        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        para->fast_taps = *(BOOL *) prop->data;

    }
    else if (property == prop_middle_timeout) {
        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        para->emulate_mid_button_time = *(INT32 *) prop->data;
    }
    else if (property == prop_twofinger_pressure) {
        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        para->emulate_twofinger_z = *(INT32 *) prop->data;
    }
    else if (property == prop_twofinger_width) {
        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        para->emulate_twofinger_w = *(INT32 *) prop->data;
    }
    else if (property == prop_scrolldist) {
        INT32 *dist;

        if (prop->size != 2 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        dist = (INT32 *) prop->data;
        if (dist[0] == 0 || dist[1] == 0)
            return BadValue;

        if (para->scroll_dist_vert != dist[0]) {
            para->scroll_dist_vert = dist[0];
#ifdef HAVE_SMOOTH_SCROLL
            SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
                              para->scroll_dist_vert, 0);
#endif
        }
        if (para->scroll_dist_horiz != dist[1]) {
            para->scroll_dist_horiz = dist[1];
#ifdef HAVE_SMOOTH_SCROLL
            SetScrollValuator(dev, priv->scroll_axis_horiz,
                              SCROLL_TYPE_HORIZONTAL, para->scroll_dist_horiz,
                              0);
#endif
        }
    }
    else if (property == prop_scrolledge) {
        CARD8 *edge;

        if (prop->size != 3 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        edge = (BOOL *) prop->data;
        para->scroll_edge_vert = edge[0];
        para->scroll_edge_horiz = edge[1];
        para->scroll_edge_corner = edge[2];
    }
    else if (property == prop_scrolltwofinger) {
        CARD8 *twofinger;

        if (prop->size != 2 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        twofinger = (BOOL *) prop->data;
        para->scroll_twofinger_vert = twofinger[0];
        para->scroll_twofinger_horiz = twofinger[1];
    }
    else if (property == prop_speed) {
        float *speed;

        if (prop->size != 4 || prop->format != 32 || prop->type != float_type)
            return BadMatch;

        speed = (float *) prop->data;
        para->min_speed = speed[0];
        para->max_speed = speed[1];
        para->accl = speed[2];
        para->trackstick_speed = speed[3];

    }
    else if (property == prop_edgemotion_pressure) {
        CARD32 *pressure;

        if (prop->size != 2 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        pressure = (CARD32 *) prop->data;
        if (pressure[0] > pressure[1])
            return BadValue;

        para->edge_motion_min_z = pressure[0];
        para->edge_motion_max_z = pressure[1];

    }
    else if (property == prop_edgemotion_speed) {
        CARD32 *speed;

        if (prop->size != 2 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        speed = (CARD32 *) prop->data;
        if (speed[0] > speed[1])
            return BadValue;

        para->edge_motion_min_speed = speed[0];
        para->edge_motion_max_speed = speed[1];

    }
    else if (property == prop_edgemotion_always) {
        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        para->edge_motion_use_always = *(BOOL *) prop->data;

    }
    else if (property == prop_buttonscroll) {
        BOOL *scroll;

        if (!priv->has_scrollbuttons)
            return BadMatch;

        if (prop->size != 2 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        scroll = (BOOL *) prop->data;
        para->updown_button_scrolling = scroll[0];
        para->leftright_button_scrolling = scroll[1];

    }
    else if (property == prop_buttonscroll_repeat) {
        BOOL *repeat;

        if (!priv->has_scrollbuttons)
            return BadMatch;

        if (prop->size != 2 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        repeat = (BOOL *) prop->data;
        para->updown_button_repeat = repeat[0];
        para->leftright_button_repeat = repeat[1];
    }
    else if (property == prop_buttonscroll_time) {
        if (!priv->has_scrollbuttons)
            return BadMatch;

        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        para->scroll_button_repeat = *(INT32 *) prop->data;

    }
    else if (property == prop_off) {
        CARD8 off;

        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        off = *(CARD8 *) prop->data;

        if (off > 2)
            return BadValue;

        para->touchpad_off = off;
    }
    else if (property == prop_gestures) {
        BOOL *gestures;

        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        gestures = (BOOL *) prop->data;
        para->tap_and_drag_gesture = gestures[0];
    }
    else if (property == prop_lockdrags) {
        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        para->locked_drags = *(BOOL *) prop->data;
    }
    else if (property == prop_lockdrags_time) {
        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        para->locked_drag_time = *(INT32 *) prop->data;
    }
    else if (property == prop_tapaction) {
        int i;
        CARD8 *action;

        if (prop->size > MAX_TAP || prop->format != 8 ||
            prop->type != XA_INTEGER)
            return BadMatch;

        action = (CARD8 *) prop->data;

        for (i = 0; i < MAX_TAP; i++)
            para->tap_action[i] = action[i];
    }
    else if (property == prop_clickaction) {
        int i;
        CARD8 *action;

        if (prop->size > MAX_CLICK || prop->format != 8 ||
            prop->type != XA_INTEGER)
            return BadMatch;

        action = (CARD8 *) prop->data;

        for (i = 0; i < MAX_CLICK; i++)
            para->click_action[i] = action[i];
    }
    else if (property == prop_circscroll) {
        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        para->circular_scrolling = *(BOOL *) prop->data;

    }
    else if (property == prop_circscroll_dist) {
        float circdist;

        if (prop->size != 1 || prop->format != 32 || prop->type != float_type)
            return BadMatch;

        circdist = *(float *) prop->data;
        if (circdist == 0)
            return BadValue;

        para->scroll_dist_circ = circdist;
    }
    else if (property == prop_circscroll_trigger) {
        int trigger;

        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        trigger = *(CARD8 *) prop->data;
        if (trigger > 8)
            return BadValue;

        para->circular_trigger = trigger;

    }
    else if (property == prop_circpad) {
        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        para->circular_pad = *(BOOL *) prop->data;
    }
    else if (property == prop_palm) {
        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        para->palm_detect = *(BOOL *) prop->data;
    }
    else if (property == prop_palm_dim) {
        INT32 *dim;

        if (prop->size != 2 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        dim = (INT32 *) prop->data;

        para->palm_min_width = dim[0];
        para->palm_min_z = dim[1];
    }
    else if (property == prop_coastspeed) {
        float *coast_speeds;

        if (prop->size != 2 || prop->format != 32 || prop->type != float_type)
            return BadMatch;

        coast_speeds = (float *) prop->data;
        para->coasting_speed = coast_speeds[0];
        para->coasting_friction = coast_speeds[1];
    }
    else if (property == prop_pressuremotion) {
        CARD32 *press;

        if (prop->size != 2 || prop->format != 32 || prop->type != XA_CARDINAL)
            return BadMatch;

        press = (CARD32 *) prop->data;
        if (press[0] > press[1])
            return BadValue;

        para->press_motion_min_z = press[0];
        para->press_motion_max_z = press[1];
    }
    else if (property == prop_grab) {
        if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
            return BadMatch;

        para->grab_event_device = *(BOOL *) prop->data;
    }
    else if (property == prop_capabilities) {
        /* read-only */
        return BadValue;
    }
    else if (property == prop_resolution) {
        /* read-only */
        return BadValue;
    }
    else if (property == prop_area) {
        INT32 *area;

        if (prop->size != 4 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        area = (INT32 *) prop->data;
        if ((((area[0] != 0) && (area[1] != 0)) && (area[0] > area[1])) ||
            (((area[2] != 0) && (area[3] != 0)) && (area[2] > area[3])))
            return BadValue;

        para->area_left_edge = area[0];
        para->area_right_edge = area[1];
        para->area_top_edge = area[2];
        para->area_bottom_edge = area[3];
    }
    else if (property == prop_softbutton_areas) {
        int *areas;

        if (prop->size != 8 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        areas = (int *) prop->data;
        if (!SynapticsIsSoftButtonAreasValid(areas))
            return BadValue;

        memcpy(para->softbutton_areas[0], areas, 4 * sizeof(int));
        memcpy(para->softbutton_areas[1], areas + 4, 4 * sizeof(int));
    }
    else if (property == prop_noise_cancellation) {
        INT32 *hyst;

        if (prop->size != 2 || prop->format != 32 || prop->type != XA_INTEGER)
            return BadMatch;

        hyst = (INT32 *) prop->data;
        if (hyst[0] < 0 || hyst[1] < 0)
            return BadValue;
        para->hyst_x = hyst[0];
        para->hyst_y = hyst[1];
    }
    else if (property == prop_product_id || property == prop_device_node)
        return BadValue;        /* read-only */

    return Success;
}


text:
xmpipe
======

XMPP library using simple-PIPE package

redpajama_set_name: RedPajamaGithub


text:
package inmem

import (
	"context"
	"fmt"
	"io"
	"sync"
	"sync/atomic"

	"github.com/open-policy-agent/opa/storage"
	"github.com/open-policy-agent/opa/util"
)

// New returns an empty in-memory store.
func New() storage.Store {
	return &store{
		data:     map[string]interface{}{},
		triggers: map[*handle]storage.TriggerConfig{},
		policies: map[string][]byte{},
	}
}

// NewFromObject returns a new in-memory store from the supplied data object.
func NewFromObject(data map[string]interface{}) storage.Store {
	db := New()
	ctx := context.Background()
	txn, err := db.NewTransaction(ctx, storage.WriteParams)
	if err != nil {
		panic(err)
	}
	if err := db.Write(ctx, txn, storage.AddOp, storage.Path{}, data); err != nil {
		panic(err)
	}
	if err := db.Commit(ctx, txn); err != nil {
		panic(err)
	}
	return db
}

// NewFromReader returns a new in-memory store from a reader that produces a
// JSON serialized object. This function is for test purposes.
func NewFromReader(r io.Reader) storage.Store {
	d := util.NewJSONDecoder(r)
	var data map[string]interface{}
	if err := d.Decode(&data); err != nil {
		panic(err)
	}
	return NewFromObject(data)
}

type store struct {
	rmu      sync.RWMutex                      // reader-writer lock
	wmu      sync.Mutex                        // writer lock
	xid      uint64                            // last generated transaction id
	data     map[string]interface{}            // raw data
	policies map[string][]byte                 // raw policies
	triggers map[*handle]storage.TriggerConfig // registered triggers
}

type handle struct {
	db *store
}

func (db *store) NewTransaction(_ context.Context, params ...storage.TransactionParams) (storage.Transaction, error) {
	var write bool
	var context *storage.Context
	if len(params) > 0 {
		write = params[0].Write
		context = params[0].Context
	}
	xid := atomic.AddUint64(&db.xid, uint64(1))
	if write {
		db.wmu.Lock()
	} else {
		db.rmu.RLock()
	}
	return newTransaction(xid, write, context, db), nil
}

func (db *store) Commit(ctx context.Context, txn storage.Transaction) error {
	underlying, err := db.underlying(txn)
	if err != nil {
		return err
	}
	if underlying.write {
		db.rmu.Lock()
		event := underlying.Commit()
		db.runOnCommitTriggers(ctx, txn, event)
		// Mark the transaction stale after executing triggers so they can
		// perform store operations if needed.
		underlying.stale = true
		db.rmu.Unlock()
		db.wmu.Unlock()
	} else {
		db.rmu.RUnlock()
	}
	return nil
}

func (db *store) Abort(_ context.Context, txn storage.Transaction) {
	underlying, err := db.underlying(txn)
	if err != nil {
		panic(err)
	}
	underlying.stale = true
	if underlying.write {
		db.wmu.Unlock()
	} else {
		db.rmu.RUnlock()
	}
}

func (db *store) ListPolicies(_ context.Context, txn storage.Transaction) ([]string, error) {
	underlying, err := db.underlying(txn)
	if err != nil {
		return nil, err
	}
	return underlying.ListPolicies(), nil
}

func (db *store) GetPolicy(_ context.Context, txn storage.Transaction, id string) ([]byte, error) {
	underlying, err := db.underlying(txn)
	if err != nil {
		return nil, err
	}
	return underlying.GetPolicy(id)
}

func (db *store) UpsertPolicy(_ context.Context, txn storage.Transaction, id string, bs []byte) error {
	underlying, err := db.underlying(txn)
	if err != nil {
		return err
	}
	return underlying.UpsertPolicy(id, bs)
}

func (db *store) DeletePolicy(_ context.Context, txn storage.Transaction, id string) error {
	underlying, err := db.underlying(txn)
	if err != nil {
		return err
	}
	if _, err := underlying.GetPolicy(id); err != nil {
		return err
	}
	return underlying.DeletePolicy(id)
}

func (db *store) Register(_ context.Context, txn storage.Transaction, config storage.TriggerConfig) (storage.TriggerHandle, error) {
	underlying, err := db.underlying(txn)
	if err != nil {
		return nil, err
	}
	if !underlying.write {
		return nil, &storage.Error{
			Code:    storage.InvalidTransactionErr,
			Message: "triggers must be registered with a write transaction",
		}
	}
	h := &handle{db}
	db.triggers[h] = config
	return h, nil
}

func (db *store) Read(_ context.Context, txn storage.Transaction, path storage.Path) (interface{}, error) {
	underlying, err := db.underlying(txn)
	if err != nil {
		return nil, err
	}
	return underlying.Read(path)
}

func (db *store) Write(_ context.Context, txn storage.Transaction, op storage.PatchOp, path storage.Path, value interface{}) error {
	underlying, err := db.underlying(txn)
	if err != nil {
		return err
	}
	val := util.Reference(value)
	if err := util.RoundTrip(val); err != nil {
		return err
	}
	return underlying.Write(op, path, *val)
}

func (h *handle) Unregister(_ context.Context, txn storage.Transaction) {
	underlying, err := h.db.underlying(txn)
	if err != nil {
		panic(err)
	}
	if !underlying.write {
		panic(&storage.Error{
			Code:    storage.InvalidTransactionErr,
			Message: "triggers must be unregistered with a write transaction",
		})
	}
	delete(h.db.triggers, h)
}

func (db *store) runOnCommitTriggers(ctx context.Context, txn storage.Transaction, event storage.TriggerEvent) {
	for _, t := range db.triggers {
		t.OnCommit(ctx, txn, event)
	}
}

func (db *store) underlying(txn storage.Transaction) (*transaction, error) {
	underlying, ok := txn.(*transaction)
	if !ok {
		return nil, &storage.Error{
			Code:    storage.InvalidTransactionErr,
			Message: fmt.Sprintf("unexpected transaction type %T", txn),
		}
	}
	if underlying.db != db {
		return nil, &storage.Error{
			Code:    storage.InvalidTransactionErr,
			Message: "unknown transaction",
		}
	}
	if underlying.stale {
		return nil, &storage.Error{
			Code:    storage.InvalidTransactionErr,
			Message: "stale transaction",
		}
	}
	return underlying, nil
}

const rootMustBeObjectMsg = "root must be object"
const rootCannotBeRemovedMsg = "root cannot be removed"

func invalidPatchError(f string, a ...interface{}) *storage.Error {
	return &storage.Error{
		Code:    storage.InvalidPatchErr,
		Message: fmt.Sprintf(f, a...),
	}
}


text:
@interface JxbHttpCell : UITableViewCell

- (void)setTitle:(NSString*)title value:(NSString*)value;

-(void)setModel:(JxbHttpModel *)model;
@end


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GlyssenEngineTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("FCBH-SIL")]
[assembly: AssemblyProduct("GlyssenEngineTests")]
[assembly: AssemblyCopyright("Copyright © 2020 Faith Comes By Hearing and SIL International")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("aa6a1cfd-60a1-4f19-b88e-ca7758e2b4de")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("GlyssenTests")]


text:
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- | This library lets you push metric samples to a broadcast channel.
-- Consumers can then persist the metrics samples as they wish.
-- ekg-push is based heavily off of the ekg-statsd package which
-- can be found at: https://github.com/tibbe/ekg-statsd
--
-- Example usage:
--
-- > main = do
-- >     store <- newStore
-- >     push <- forkPush defaultPushOptions store
-- >     ch <- subscribe push
-- >     sample <- consume ch
-- >     putStrLn $ show sample
--
-- You probably want to include some of the predefined metrics defined
-- in the ekg-core package, by calling e.g. the 'registerGcStats'
-- function defined in that package.
module System.Remote.Monitoring.Push
    (
      Push
    , PushChan
    , PushOptions(..)
    , pushThreadId
    , forkPush
    , defaultPushOptions
    , subscribe
    , consume
    ) where

import Control.Concurrent (ThreadId, myThreadId, threadDelay, throwTo)
import Control.Concurrent.Chan (Chan, newChan, writeChan, readChan, dupChan)
import qualified Data.HashMap.Strict as M
import Data.Int (Int64)
import qualified Data.Text as T
import Data.Time.Clock.POSIX (getPOSIXTime)
import qualified System.Metrics as Metrics

#if __GLASGOW_HASKELL__ >= 706
import Control.Concurrent (forkFinally)
#else
import Control.Concurrent (forkIO)
import Control.Exception (SomeException, mask, try)
import Prelude hiding (catch)
#endif

-- | A handle that can be used to control the push sync thread.
-- Created by 'forkPush'.
data Push = Push
    { threadId :: {-# UNPACK #-} !ThreadId
    , mainCh :: Chan (Metrics.Sample)
    }

-- | A new PushChan is created on every call to subscribe.
-- This is essentially a dupChan of our main channel (mainCh).
data PushChan = PushChan
    { ch :: PushChanType }

type PushChanType = Chan Metrics.Sample

-- | The thread ID of the push sync thread. You can stop the sync by
-- killing this thread (i.e. by throwing it an asynchronous
-- exception.)
pushThreadId :: Push -> ThreadId
pushThreadId = threadId

-- | Options to control how to connect to the push server and how
-- often to flush metrics. The flush interval should be shorter than
-- the flush interval push itself uses to flush data to its
-- backends.
data PushOptions = PushOptions
    {
      -- | Data push interval, in ms.
      flushInterval :: !Int

      -- | Print debug output to stderr.
    , debug :: !Bool

      -- | Prefix to add to all metric names.
    , prefix :: !T.Text

      -- | Suffix to add to all metric names. This is particularly
      -- useful for sending per host stats by settings this value to:
      -- @takeWhile (/= \'.\') \<$\> getHostName@, using @getHostName@
      -- from the @Network.BSD@ module in the network package.
    , suffix :: !T.Text
    }

-- | Defaults:
--
-- * @flushInterval@ = @1000@
--
-- * @debug@ = @False@
defaultPushOptions :: PushOptions
defaultPushOptions = PushOptions
    { flushInterval = 1000
    , debug         = False
    , prefix        = ""
    , suffix        = ""
    }

-- | Create a thread that periodically flushes the metrics in the
-- store to push.
forkPush :: PushOptions  -- ^ Options
           -> Metrics.Store  -- ^ Metric store
           -> IO Push      -- ^ Push sync handle
forkPush opts store = do
    me <- myThreadId
    ch <- newChan
    tid <- forkFinally (loop ch store emptySample opts) $ \ r -> do
        case r of
            Left e  -> throwTo me e
            Right _ -> return ()
    return $ Push tid ch
    where
        emptySample = M.empty

loop :: PushChanType -- ^ ekg-push clients subscribe to this channel
     -> Metrics.Store   -- ^ Metric Store
     -> Metrics.Sample  -- ^ Last sampled metrics
     -> PushOptions  -- ^ Options
     -> IO ()
loop ch store lastSample opts = do
    start <- time
    sample <- Metrics.sampleAll store
    let !diff = diffSamples opts lastSample sample
    writeChan ch diff -- Write the Metrics.Sample to our broadcast channel.
    end <- time
    threadDelay (flushInterval opts * 1000 - fromIntegral (end - start))
    loop ch store sample opts

-- | Subscribe to the push broadcast channel.
subscribe :: Push -> IO PushChan
subscribe Push{..} = do
    ch' <- dupChan mainCh
    return $ PushChan {
        ch = ch'
    }

-- | Consume a Metrics.Sample message from a subscribed channel.
consume :: PushChan -> IO Metrics.Sample
consume PushChan{..} = readChan ch

-- | Microseconds since epoch.
time :: IO Int64
time = (round . (* 1000000.0) . toDouble) `fmap` getPOSIXTime
  where toDouble = realToFrac :: Real a => a -> Double

diffSamples :: PushOptions -> Metrics.Sample -> Metrics.Sample -> Metrics.Sample
diffSamples opts prev curr = M.foldlWithKey' combine M.empty curr
  where
    combine m name new = case M.lookup name prev of
        Just old -> case diffMetric old new of
            Just val -> M.insert name' val m
            Nothing  -> m
        _        -> M.insert name' new m
        where
            name' = T.append (prefix opts) (T.append name (suffix opts))

    diffMetric :: Metrics.Value -> Metrics.Value -> Maybe Metrics.Value
    diffMetric (Metrics.Counter n1) (Metrics.Counter n2)
        | n1 == n2  = Nothing
        | otherwise = Just $! Metrics.Counter $ n2 - n1
    diffMetric (Metrics.Gauge n1) (Metrics.Gauge n2)
        | n1 == n2  = Nothing
        | otherwise = Just $ Metrics.Gauge n2
    diffMetric (Metrics.Label n1) (Metrics.Label n2)
        | n1 == n2  = Nothing
        | otherwise = Just $ Metrics.Label n2
    -- Distributions are assumed to be non-equal.
    diffMetric _ _  = Nothing

------------------------------------------------------------------------
-- Backwards compatibility shims

#if __GLASGOW_HASKELL__ < 706
forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
forkFinally action and_then =
  mask $ \restore ->
    forkIO $ try (restore action) >>= and_then
#endif


text:
#ifndef HTMLShadowElement_h
#define HTMLShadowElement_h

#include "InsertionPoint.h"
#include <wtf/Forward.h>

namespace WebCore {

class HTMLShadowElement : public InsertionPoint {
public:
    static PassRefPtr<HTMLShadowElement> create(const QualifiedName&, Document*);

    virtual ~HTMLShadowElement();

    virtual const AtomicString& select() const;
    virtual bool isSelectValid() OVERRIDE { return true; }
    virtual const CSSSelectorList& selectorList() { return emptySelectorList(); }

protected:
    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    virtual void removedFrom(ContainerNode*) OVERRIDE;

private:
    HTMLShadowElement(const QualifiedName&, Document*);

    static const CSSSelectorList& emptySelectorList();

    bool m_registeredWithShadowRoot;
};

inline bool isHTMLShadowElement(const Node* node)
{
    ASSERT(node);
    return node->hasTagName(HTMLNames::shadowTag);
}

inline HTMLShadowElement* toHTMLShadowElement(Node* node)
{
    ASSERT(!node || isHTMLShadowElement(node));
    return static_cast<HTMLShadowElement*>(node);
}

inline const HTMLShadowElement* toHTMLShadowElement(const Node* node)
{
    ASSERT(!node || isHTMLShadowElement(node));
    return static_cast<const HTMLShadowElement*>(node);
}

} // namespace WebCore

#endif // HTMLShadowElement_h


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<TITLE>
XML Standard API: Class  Validator
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

javax.xml.validation

Class  Validator

java.lang.Object
  |
  +--javax.xml.validation.Validator

public abstract class Validator
extends java.lang.Object

A processor that checks an XML document against Schema.

 A validator is a thread-unsafe and non-reentrant object.
 In other words, it is the application's responsibility to make
 sure that one Validator object is not used from
 more than one thread at any given time, and while the <tt>validate</tt>
 method is invoked, applications may not recursively call
 the <tt>validate</tt> method.

 Note that while the validate(javax.xml.transform.Source) and validate(javax.xml.transform.Source, javax.xml.transform.Result)
 methods take a Source instance, the Source
 instance must be a SAXSource, DOMSource, StAXSource or StreamSource.

Since:
1.5

Version:
$Revision: 888884 $, $Date: 2009-12-09 12:36:46 -0500 (Wed, 09 Dec 2009) $

Author:
Kohsuke Kawaguchi

Constructor Summary

protected
Validator()

          Constructor for derived classes.

Method Summary

abstract  ErrorHandler
getErrorHandler()

          Gets the current ErrorHandler set to this Validator.

 boolean
getFeature(java.lang.String name)

          Look up the value of a feature flag.

 java.lang.Object
getProperty(java.lang.String name)

          Look up the value of a property.

abstract  LSResourceResolver
getResourceResolver()

          Gets the current LSResourceResolver set to this Validator.

abstract  void
reset()

          Reset this Validator to its original configuration.

abstract  void
setErrorHandler(ErrorHandler errorHandler)

          Sets the ErrorHandler to receive errors encountered
 during the validate method invocation.

 void
setFeature(java.lang.String name,
           boolean value)

          Set the value of a feature flag.

 void
setProperty(java.lang.String name,
            java.lang.Object object)

          Set the value of a property.

abstract  void
setResourceResolver(LSResourceResolver resourceResolver)

          Sets the LSResourceResolver to customize
 resource resolution while in a validation episode.

 void
validate(Source source)

          Validates the specified input.

abstract  void
validate(Source source,
         Result result)

          Validates the specified input and send the augmented validation
 result to the specified output.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

Validator

protected Validator()

Constructor for derived classes.

 The constructor does nothing.

 Derived classes must create Validator objects that have
 <tt>null</tt> ErrorHandler and
 <tt>null</tt> LSResourceResolver.

Method Detail

reset

public abstract void reset()

Reset this Validator to its original configuration.

Validator is reset to the same state as when it was created with
 Schema.newValidator().
 reset() is designed to allow the reuse of existing Validators
 thus saving resources associated with the creation of new Validators.

The reset Validator is not guaranteed to have the same LSResourceResolver or ErrorHandler
 Objects, e.g. Object.equals(Object obj).  It is guaranteed to have a functionally equal
 LSResourceResolver and ErrorHandler.

validate

public void validate(Source source)
              throws SAXException,
                     java.io.IOException

Validates the specified input.

 This is just a convenience method of:

 validate(source,null);

See Also:
setErrorHandler(ErrorHandler)

validate

public abstract void validate(Source source,
                              Result result)
                       throws SAXException,
                              java.io.IOException

Validates the specified input and send the augmented validation
 result to the specified output.

 This method places the following restrictions on the types of
 the Source/Result accepted.

Source/Result accepted:

   SAXSource
   DOMSource
   StAXSource
   StreamSource

   <tt>null</tt>
   OK
   OK
   OK
   OK

   SAXResult
   OK
   Err
   Err
   Err

   DOMResult
   Err
   OK
   Err
   Err

   StAXResult
   Err
   Err
   OK
   Err

   StreamResult
   Err
   Err
   Err
   OK

 To validate one Source into another kind of Result, use the identity transformer
 (see TransformerFactory.newTransformer()).

 Errors found during the validation is sent to the specified
 ErrorHandler.

 If a document is valid, or if a document contains some errors
 but none of them were fatal and the ErrorHandler didn't
 throw any exception, then the method returns normally.

Parameters:
source - XML to be validated. Must not be null.
result - The Result object that receives (possibly augmented)
      XML. This parameter can be null if the caller is not interested
      in it.

      Note that when a DOMResult is used,
      a validator might just pass the same DOM node from
      DOMSource to
      DOMResult
      (in which case <tt>source.getNode()==result.getNode()</tt>),
      it might copy the entire DOM tree, or it might alter the
      node given by the source.
Throws:
java.lang.IllegalArgumentException - If the Result type doesn't match the Source type,
      or if the specified source is not a
      SAXSource,
      DOMSource,
      StAXSource or
      StreamSource.
SAXException - If the ErrorHandler throws a SAXException or
      if a fatal error is found and the ErrorHandler returns
      normally.
java.io.IOException - If the validator is processing a
      SAXSource and the
      underlying XMLReader throws an
      IOException.
java.lang.NullPointerException - If the <tt>source</tt> parameter is null.
See Also:
validate(Source)

setErrorHandler

public abstract void setErrorHandler(ErrorHandler errorHandler)

Sets the ErrorHandler to receive errors encountered
 during the validate method invocation.

 Error handler can be used to customize the error handling process
 during a validation. When an ErrorHandler is set,
 errors found during the validation will be first sent
 to the ErrorHandler.

 The error handler can abort further validation immediately
 by throwing SAXException from the handler. Or for example
 it can print an error to the screen and try to continue the
 validation by returning normally from the ErrorHandler

 If any Throwable is thrown from an ErrorHandler,
 the caller of the validate method will be thrown
 the same Throwable object.

 Validator is not allowed to
 throw SAXException without first reporting it to
 ErrorHandler.

 When the ErrorHandler is null, the implementation will
 behave as if the following ErrorHandler is set:

 class DraconianErrorHandler implements ErrorHandler {
     public void fatalError( SAXParseException e ) throws SAXException {
         throw e;
     }
     public void error( SAXParseException e ) throws SAXException {
         throw e;
     }
     public void warning( SAXParseException e ) throws SAXException {
         // noop
     }
 }

 When a new Validator object is created, initially
 this field is set to null.

Parameters:
errorHandler - A new error handler to be set. This parameter can be null.

getErrorHandler

public abstract ErrorHandler getErrorHandler()

Gets the current ErrorHandler set to this Validator.

Returns:
This method returns the object that was last set through
      the setErrorHandler(ErrorHandler) method, or null
      if that method has never been called since this Validator
      has created.
See Also:
setErrorHandler(ErrorHandler)

setResourceResolver

public abstract void setResourceResolver(LSResourceResolver resourceResolver)

Sets the LSResourceResolver to customize
 resource resolution while in a validation episode.

 Validator uses a LSResourceResolver
 when it needs to locate external resources while a validation,
 although exactly what constitutes "locating external resources" is
 up to each schema language.

 When the LSResourceResolver is null, the implementation will
 behave as if the following LSResourceResolver is set:

 class DumbLSResourceResolver implements LSResourceResolver {
     public LSInput resolveResource(
         String publicId, String systemId, String baseURI) {

         return null; // always return null
     }
 }

 If a LSResourceResolver throws a RuntimeException
  (or instances of its derived classes),
 then the Validator will abort the parsing and
 the caller of the validate method will receive
 the same RuntimeException.

 When a new Validator object is created, initially
 this field is set to null.

Parameters:
resourceResolver - A new resource resolver to be set. This parameter can be null.

getResourceResolver

public abstract LSResourceResolver getResourceResolver()

Gets the current LSResourceResolver set to this Validator.

Returns:
This method returns the object that was last set through
      the setResourceResolver(LSResourceResolver) method, or null
      if that method has never been called since this Validator
      has created.
See Also:
setErrorHandler(ErrorHandler)

getFeature

public boolean getFeature(java.lang.String name)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException

Look up the value of a feature flag.

The feature name is any fully-qualified URI.  It is
 possible for a Validator to recognize a feature name but
 temporarily be unable to return its value.
 Some feature values may be available only in specific
 contexts, such as before, during, or after a validation.

Implementors are free (and encouraged) to invent their own features,
 using names built on their own URIs.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
Returns:
The current value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature
            value can't be assigned or retrieved.
SAXNotSupportedException - When the
            Validator recognizes the feature name but
            cannot determine its value at this time.
java.lang.NullPointerException - When the name parameter is null.
See Also:
setFeature(String, boolean)

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException

Set the value of a feature flag.

 Feature can be used to control the way a Validator
 parses schemas, although Validators are not required
 to recognize any specific property names.

The feature name is any fully-qualified URI.  It is
 possible for a Validator to expose a feature value but
 to be unable to change the current value.
 Some feature values may be immutable or mutable only
 in specific contexts, such as before, during, or after
 a validation.

Parameters:
name - The feature name, which is a non-null fully-qualified URI.
value - The requested value of the feature (true or false).
Throws:
SAXNotRecognizedException - If the feature
            value can't be assigned or retrieved.
SAXNotSupportedException - When the
            Validator recognizes the feature name but
            cannot set the requested value.
java.lang.NullPointerException - When the name parameter is null.
See Also:
getFeature(String)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object object)
                 throws SAXNotRecognizedException,
                        SAXNotSupportedException

Set the value of a property.

The property name is any fully-qualified URI.  It is
 possible for a Validator to recognize a property name but
 to be unable to change the current value.
 Some property values may be immutable or mutable only
 in specific contexts, such as before, during, or after
 a validation.

Validators are not required to recognize setting
 any specific property names.

Parameters:
name - The property name, which is a non-null fully-qualified URI.
object - The requested value for the property.
Throws:
SAXNotRecognizedException - If the property
            value can't be assigned or retrieved.
SAXNotSupportedException - When the
            Validator recognizes the property name but
            cannot set the requested value.
java.lang.NullPointerException - When the name parameter is null.

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws SAXNotRecognizedException,
                                    SAXNotSupportedException

Look up the value of a property.

The property name is any fully-qualified URI.  It is
 possible for a Validator to recognize a property name but
 temporarily be unable to return its value.
 Some property values may be available only in specific
 contexts, such as before, during, or after a validation.

Validators are not required to recognize any specific
 property names.

Implementors are free (and encouraged) to invent their own properties,
 using names built on their own URIs.

Parameters:
name - The property name, which is a non-null fully-qualified URI.
Returns:
The current value of the property.
Throws:
SAXNotRecognizedException - If the property
            value can't be assigned or retrieved.
SAXNotSupportedException - When the
            XMLReader recognizes the property name but
            cannot determine its value at this time.
java.lang.NullPointerException - When the name parameter is null.
See Also:
setProperty(String, Object)

      Overview
      Package
    Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.


text:
import * as _ from 'lodash';

const WidgetChartPieComponent: ng.IComponentOptions = {
  template: require('./widget-chart-pie.html'),
  bindings: {
    data: '<'
  },
  require: {
    parent: '^gvWidget'
  },
  controller: function() {
    this.$onChanges = function(changes) {
      if (changes.data) {
        let data = changes.data.currentValue;
        let values = [];

        let total = _.reduce(data.values, function(sum: number, val: number) {
          return sum + val;
        }, 0);

        let idx = 0;
        let that = this;
        _.forEach(data.values, function(value) {
          let percentage = _.round(value / total * 100);
          values.push({
            name: that.parent.widget.chart.labels[idx], // + ': (' + percentage + '%) ' + value + ' hits',
            y: percentage,
            color: that.parent.widget.chart.colors[idx]
          });
          idx++;
        });

        this.results = {
          chart: {
            plotBackgroundColor: null,
            plotBorderWidth: 0,
            plotShadow: false
          },
          plotOptions: {
            pie: {
              dataLabels: {
                enabled: true,
                distance: -50,
                style: {
                  fontWeight: 'bold',
                  color: 'white'
                }
              },
              startAngle: -90,
              endAngle: 90,
              center: ['50%', '75%']
            }
          },
          tooltip: {
            pointFormat: '{series.name}: {point.percentage:.1f}%'
          },
          title: {
            text: '
' + total +'
 hits',
            align: 'center',
            verticalAlign: 'middle',
            y: 40
          },
          series: [{
            name: 'Percent hits',
            innerSize: '50%',
            data: values
          }]
        };
      }
    };
  }
};

export default WidgetChartPieComponent;


text:
/*
* PluginStepExecutionItemImpl.java
*
* User: Greg Schueler greg@dtosolutions.com
* Created: 11/13/12 2:30 PM
*
*/
package com.dtolabs.rundeck.execution;

import com.dtolabs.rundeck.core.execution.ConfiguredStepExecutionItem;
import com.dtolabs.rundeck.core.execution.HandlerExecutionItem;
import com.dtolabs.rundeck.core.execution.HasFailureHandler;
import com.dtolabs.rundeck.core.execution.StepExecutionItem;

import java.util.*;

/**
 * PluginStepExecutionItemImpl base implementation of a StepExecutionItem that supports PluginStepItem configuration,
 * and HandlerExecutionItem handler properties.
 *
 * @author Greg Schueler greg@dtosolutions.com
 */
public class PluginStepExecutionItemImpl implements StepExecutionItem, ConfiguredStepExecutionItem, HandlerExecutionItem,
                                                    HasFailureHandler {
    private String type;
    private Map stepConfiguration;
    private boolean keepgoingOnSuccess;
    private StepExecutionItem failureHandler;

    public PluginStepExecutionItemImpl(final String type,
                                       final Map stepConfiguration,
                                       final boolean keepgoingOnSuccess,
                                       final StepExecutionItem failureHandler) {
        this.type = type;
        this.stepConfiguration = stepConfiguration;
        this.keepgoingOnSuccess = keepgoingOnSuccess;
        this.failureHandler = failureHandler;
    }

    public Map getStepConfiguration() {
        return stepConfiguration;
    }

    public void setStepConfiguration(final Map stepConfiguration) {
        this.stepConfiguration = stepConfiguration;
    }

    public String getType() {
        return type;
    }

    public void setType(final String type) {
        this.type = type;
    }

    public boolean isKeepgoingOnSuccess() {
        return keepgoingOnSuccess;
    }

    public void setKeepgoingOnSuccess(final boolean keepgoingOnSuccess) {
        this.keepgoingOnSuccess = keepgoingOnSuccess;
    }

    public StepExecutionItem getFailureHandler() {
        return failureHandler;
    }

    public void setFailureHandler(StepExecutionItem failureHandler) {
        this.failureHandler = failureHandler;
    }

    @Override
    public String toString() {
        return "StepExecutionItem{" +
               "type='" + type + '\'' +
               ", keepgoingOnSuccess=" + keepgoingOnSuccess +
               ", hasFailureHandler=" + (null!=failureHandler) +
               '}';
    }
}


text:
__author__ = 'sergey'

"""
Class for LZMA compression helper
"""

from dedupsqlfs.compression import BaseCompression

class LzmaCompression(BaseCompression):

    _method_name = "xz"

    _minimal_size = 69

    _has_comp_level_options = True

    def getFastCompressionOptions(self):
        return {
            "preset": 0,
        }

    def getNormCompressionOptions(self):
        return {
            "preset": 4,
        }

    def getBestCompressionOptions(self):
        return {
            "preset": 9,
        }

    def getDefaultCompressionOptions(self):
        return {
            "preset": 2,
        }

    def getCustomCompressionOptions(self):
        try:
            level = int(self._custom_comp_level)
            if level < 0:
                level = 0
            elif level > 9:
                level = 9
            opts = {
                "preset": level,
            }
        except:
            opts = False
            pass
        return opts

    pass


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/menu_btn_new"
            android:layout_width="90dp"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:layout_margin="5dp"
            android:background="@drawable/record_new" />

        <Button
            android:id="@+id/menu_btn_view"
            android:layout_width="90dp"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:layout_margin="5dp"
            android:background="@drawable/view" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/menu_btn_upload"
            android:layout_width="90dp"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:layout_margin="5dp"
            android:background="@drawable/upload" />

        <Button
            android:id="@+id/menu_btn_setting"
            android:layout_width="90dp"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:layout_margin="5dp"
            android:background="@drawable/setting" />

    </LinearLayout>

    <ListView
        android:id="@+id/healthrecord_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:background="#E6E6E6"
        >
    </ListView>

    </LinearLayout>

</FrameLayout>


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;

namespace Microsoft.IdentityModel.Xml
{
    /// <summary>
    /// Represents the IssuerSerial property of X509Data as per:  https://www.w3.org/TR/2001/PR-xmldsig-core-20010820/#sec-X509Data
    /// </summary>
    public class IssuerSerial
    {
        /// <summary>
        /// Gets the IssuerName of the IssuerSerial.
        /// </summary>
        public string IssuerName { get; }

        /// <summary>
        /// Gets the SerialNumber of the IssuerSerial.
        /// </summary>
        public string SerialNumber { get; }

        /// <summary>
        /// Creates an IssuerSerial using the specified IssuerName and SerialNumber.
        /// </summary>
        public IssuerSerial(string issuerName, string serialNumber)
        {
            IssuerName = issuerName;
            SerialNumber = serialNumber;
        }

        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            return obj is IssuerSerial serial &&
                string.Equals(IssuerName, serial.IssuerName, StringComparison.OrdinalIgnoreCase) &&
                string.Equals(SerialNumber, serial.SerialNumber, StringComparison.OrdinalIgnoreCase);
        }

        /// <inheritdoc/>
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = -1073543679;
                hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(IssuerName);
                hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(SerialNumber);
                return hashCode;
            }
        }
    }
}


text:
package tech.aroma.data.memory;

import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import com.google.common.collect.Sets;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import tech.aroma.thrift.authentication.AuthenticationToken;
import tech.aroma.thrift.exceptions.InvalidArgumentException;
import tech.aroma.thrift.exceptions.InvalidTokenException;
import tech.aroma.thrift.generators.TokenGenerators;
import tech.sirwellington.alchemy.annotations.testing.TimeSensitive;
import tech.sirwellington.alchemy.test.junit.runners.*;

import static java.time.Instant.now;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
import static tech.sirwellington.alchemy.generator.AlchemyGenerator.Get.one;
import static tech.sirwellington.alchemy.generator.StringGenerators.hexadecimalString;
import static tech.sirwellington.alchemy.generator.TimeGenerators.futureInstants;
import static tech.sirwellington.alchemy.test.junit.ThrowableAssertion.*;

/**
 *
 * @author SirWellington
 */
@Repeat(100)
@RunWith(AlchemyTestRunner.class)
public class MemoryTokenRepositoryTest
{

    private MemoryTokenRepository repository;

    private AuthenticationToken token;

    @GenerateList(AuthenticationToken.class)
    private List<AuthenticationToken> tokens;

    private String tokenId;
    private String ownerId;

    @Before
    public void setUp()
    {
        repository = new MemoryTokenRepository();

        token =  TokenGenerators.authenticationTokens().get();
        tokenId = token.getTokenId();
        ownerId = token.getOwnerId();

        tokens.forEach(t -> t.setOwnerId(ownerId));

        Instant timeOfExpiration = one(futureInstants()).plus(1, ChronoUnit.HOURS);
        token.setTimeOfExpiration(timeOfExpiration.toEpochMilli());
        tokens.forEach(t -> t.setTimeOfExpiration(timeOfExpiration.toEpochMilli()));
    }

    @Test
    public void testDoesTokenExist() throws Exception
    {
        assertThat(repository.containsToken(tokenId), is(false));

        repository.saveToken(token);
        assertThat(repository.containsToken(tokenId), is(true));
    }

    @DontRepeat
    @Test
    public void testDoesTokenExistWithBadArgs() throws Exception
    {
        assertThrows(() -> repository.containsToken(""))
            .isInstanceOf(InvalidArgumentException.class);
    }

//    @Repeat(10)
    @DontRepeat
    @TimeSensitive
    @Test
    public void testDoesTokenExistWhenTokenExpired() throws Exception
    {
        token.setTimeOfExpiration(now().plusSeconds(1).toEpochMilli());
        repository.saveToken(token);

        Thread.sleep(1000);
        assertThat(repository.containsToken(tokenId), is(false));
    }

    @Test
    public void testGetToken() throws Exception
    {
        assertThrows(() -> repository.getToken(tokenId))
            .isInstanceOf(InvalidTokenException.class);

        repository.saveToken(token);

        AuthenticationToken result = repository.getToken(tokenId);
        assertThat(result, is(token));
    }

    @DontRepeat
    @Test
    public void testGetTokenWithBadArgs() throws Exception
    {
        assertThrows(() -> repository.getToken(""))
            .isInstanceOf(InvalidArgumentException.class);
    }

    @DontRepeat
    @TimeSensitive
    @Test
    public void testGetTokenWhenTokenExpired() throws Exception
    {
        token.setTimeOfExpiration(now().plusSeconds(1).toEpochMilli());
        repository.saveToken(token);

        Thread.sleep(1500);
        assertThrows(() -> repository.getToken(tokenId))
            .isInstanceOf(InvalidTokenException.class);
    }

    @Test
    public void testSaveToken() throws Exception
    {
        repository.saveToken(token);

        AuthenticationToken result = repository.getToken(tokenId);
        assertThat(result, is(token));
    }

    @DontRepeat
    @Test
    public void testSaveTokenWithBadArgs() throws Exception
    {
        assertThrows(() -> repository.saveToken(null))
            .isInstanceOf(InvalidTokenException.class);

        //Missing Owner ID
        token.setOwnerId("");

        assertThrows(() -> repository.saveToken(token))
            .isInstanceOf(InvalidTokenException.class);

        //Missing Token ID
        token.setOwnerId(ownerId);
        token.setTokenId("");

        assertThrows(() -> repository.saveToken(token))
            .isInstanceOf(InvalidTokenException.class);

        //Missing Token Type
        token.setTokenId(tokenId);
        token.setTokenType(null);

        assertThrows(() -> repository.saveToken(token))
            .isInstanceOf(InvalidTokenException.class);

    }

    @Test
    public void testGetTokensBelongingTo() throws Exception
    {
        for (AuthenticationToken token : tokens)
        {
            repository.saveToken(token);
        }

        List<AuthenticationToken> result = repository.getTokensBelongingTo(ownerId);
        Set<AuthenticationToken> expected = Sets.newHashSet(tokens);
        Set<AuthenticationToken> resultSet = Sets.newHashSet(result);
        assertThat(resultSet, is(expected));
    }

    @Test
    public void testGetTokensWhenNoneExistForOwner() throws Exception
    {
        String ownerId = one(hexadecimalString(10));
        List<AuthenticationToken> result = repository.getTokensBelongingTo(ownerId);
        assertThat(result, notNullValue());
        assertThat(result.isEmpty(), is(true));
    }

    @DontRepeat
    @Test
    public void testGetTokensBelongingToWithBadArgs() throws Exception
    {
        assertThrows(() -> repository.getTokensBelongingTo(""))
            .isInstanceOf(InvalidArgumentException.class);
    }

    @Test
    public void testDeleteToken() throws Exception
    {
        repository.saveToken(token);
        assertThat(repository.containsToken(tokenId), is(true));

        repository.deleteToken(tokenId);
        assertThat(repository.containsToken(tokenId), is(false));
    }

    @DontRepeat
    @Test
    public void testDeleteTokenWithBadArgs() throws Exception
    {
        assertThrows(() -> repository.deleteToken(""))
            .isInstanceOf(InvalidArgumentException.class);
    }

    @Test
    public void testDeleteTokenWhenTokenDoesNotExist() throws Exception
    {
        repository.deleteToken(tokenId);
    }

    @Test
    public void testDoesTokenBelongTo() throws Exception
    {
        repository.saveToken(token);

        boolean result = repository.doesTokenBelongTo(tokenId, ownerId);
        assertThat(result, is(true));
    }

    @Test
    public void testDoesTokenBelongToWhenTokenDoesNotExist() throws Exception
    {
        assertThrows(() -> repository.doesTokenBelongTo(tokenId, ownerId))
            .isInstanceOf(InvalidTokenException.class);
    }

    @Test
    public void testDoesTokenBelongToWhenNoMatch() throws Exception
    {
        repository.saveToken(token);

        String otherOwnerId = one(hexadecimalString(20));
        boolean result = repository.doesTokenBelongTo(tokenId, otherOwnerId);
        assertThat(result, is(false));
    }

    @DontRepeat
    @Test
    public void testDoesTokenBelongToWithBadArgs() throws Exception
    {
        assertThrows(() -> repository.doesTokenBelongTo("", ownerId))
            .isInstanceOf(InvalidArgumentException.class);

        assertThrows(() -> repository.doesTokenBelongTo(tokenId, ""))
            .isInstanceOf(InvalidArgumentException.class);

    }

    @Test
    public void testDeleteTokens() throws Exception
    {
        for (AuthenticationToken token : tokens)
        {
            repository.saveToken(token);
        }

        List<String> tokenIds = tokens.stream()
            .map(AuthenticationToken::getTokenId)
            .collect(Collectors.toList());

        for (String tokenId : tokenIds)
        {
            assertThat(repository.containsToken(tokenId), is(true));
        }

        repository.deleteTokens(tokenIds);

        for (String tokenId : tokenIds)
        {
            assertThat(repository.containsToken(tokenId), is(false));
        }

        List<AuthenticationToken> tokensBelongingTo = repository.getTokensBelongingTo(ownerId);
        assertThat(tokensBelongingTo, is(empty()));
    }

    @DontRepeat
    @Test
    public void testDeleteTokensWithBadArgs() throws Exception
    {
        assertThrows(() -> repository.deleteTokens(null))
            .isInstanceOf(InvalidArgumentException.class);
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>G-Index</title>
<meta name="date" content="2015-12-03">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G I J L M N O P R S T V W X Y

G

getAddButton() - Method in class AddPlaceCityView

getAddButton() - Method in class EditPlaceCityView

getAddPeople() - Method in class MainView

Gets the Add Button for the People Column for the Action Listener.

getAddPlace() - Method in class MainView

Gets the Add Button for the Place Column for the Action Listener.

getAddSeasonCancelButton() - Method in class AddSeasonView

getAddSeasonOKButton() - Method in class AddSeasonView

getAddTeam() - Method in class MainView

Gets the Add Button for the Team Column for the Action Listener.

getBaseSelected() - Method in class DegreeSelectionView

getBirthDateText() - Method in class AddPersonView

getBirthDateText() - Method in class EditPersonView

getCancelButton() - Method in class AddPersonCityView

getCancelButton() - Method in class AddPersonStateView

getCancelButton() - Method in class AddPersonView

getCancelButton() - Method in class AddPlaceCityView

getCancelButton() - Method in class AddPlaceStateView

getCancelButton() - Method in class EditPersonCityView

getCancelButton() - Method in class EditPersonStateView

getCancelButton() - Method in class EditPersonView

getCancelButton() - Method in class EditPlaceCityView

getCancelButton() - Method in class EditPlaceStateView

getCityButton() - Method in class AddPersonView

getCityButton() - Method in class EditPersonView

getCityLatitudeField() - Method in class EditPlaceCityView

getCityListComboBox() - Method in class AddPersonCityView

getCityListComboBox() - Method in class EditPersonCityView

getCityLongitudeField() - Method in class EditPlaceCityView

getCityName() - Method in class AddPlaceCityView

getCityName() - Method in class City

Gets and returns the city.

getCityName() - Method in class EditPlaceCityView

getCityNameField() - Method in class EditPlaceCityView

getCityOfBirth() - Method in class Person

Gets the cityOfBirth City Object, used for testing purposes

getClear() - Method in class MainView

getCommaName() - Method in class Person

Gets fullName, used for testing purposes

getDateOfBirth() - Method in class Person

getDateOfDeath() - Method in class Person

getDegreeOfSeparation() - Method in class MainView

getDeletePeople() - Method in class MainView

Gets the Delete Button for the People Column for the Action Listener.

getDeletePlace() - Method in class MainView

Gets the Delete Button for the Place Column for the Action Listener.

getDeleteTeam() - Method in class MainView

Gets the Delete Button for the Team Column for the Action Listener.

getEditPeople() - Method in class MainView

Gets the Edit Button for the People Column for the Action Listener.

getEditPlace() - Method in class MainView

Gets the Edit Button for the Place Column for the Action Listener.

getEditTeam() - Method in class MainView

Gets the Edit Button for the Team Column for the Action Listener.

getExport() - Method in class MainView

getFirstName() - Method in class Person

Gets first Name, used for testing purposes

getIdentification() - Method in class Identification

getImport() - Method in class MainView

getJListOfCities() - Static method in class DataBase

getJListOfIdentifications() - Static method in class DataBase

getJListOfPersons() - Static method in class DataBase

getJListOfStates() - Static method in class DataBase

getLastName() - Method in class Person

Gets last Name, used for testing purposes

getLatitude() - Method in class AddPlaceCityView

getLatitude() - Method in class City

Get and return the latitude of the city.

getLatitude() - Method in class EditPlaceCityView

getListOfCities() - Method in class State

Returns the list of cities that is needed when searching through an entire state.

getLoad() - Method in class MainView

getLongitude() - Method in class AddPlaceCityView

getLongitude() - Method in class City

Get and return the longitude of the city.

getLongitude() - Method in class EditPlaceCityView

getMap() - Method in class MainView

Gets the JMenuItem for the Location Selection of the Graph Menu for the Action Listener.

getMembersForSaving() - Method in class Season

getMiddleName() - Method in class Person

Gets middle Name, used for testing purposes

getModel() - Method in class Controller

Gets the Model that will or is being affiliated with the Controller.

getModel() - Method in class WriteAndReadFile

getNeighbors() - Method in class Person

getOKButton() - Method in class AddPersonCityView

getOKButton() - Method in class AddPersonStateView

getOKButton() - Method in class AddPersonView

getOKButton() - Method in class AddPlaceStateView

getOkButton() - Method in class DegreeSelectionView

getOKButton() - Method in class EditPersonCityView

getOKButton() - Method in class EditPersonStateView

getOKButton() - Method in class EditPersonView

getOKButton() - Method in class EditPlaceStateView

getPeopleList() - Method in class MainView

getPeopleListModel() - Method in class MainView

getPersonDeathText() - Method in class AddPersonView

getPersonDeathText() - Method in class EditPersonView

getPersonNameText() - Method in class AddPersonView

getPersonNameText() - Method in class EditPersonView

getPieChart() - Method in class MainView

Gets the JMenuItem for the Age Selection of the Graph Menu for the Action Listener.

getPlaceList() - Method in class MainView

getPlaceListModel() - Method in class MainView

getRosterMap() - Method in class Season

Allows other classes to access the roster of people.

getSave() - Method in class MainView

getSeasonList() - Method in class Identification

getSeasonList() - Method in class MainView

getSeasonList() - Method in class Person

getSeasonListModel() - Method in class MainView

getShortestPath(Person, int) - Method in class Person

getShouldEdit() - Method in class City

getShouldEdit() - Method in class Person

getShouldEdit() - Method in class Season

getState() - Method in class City

Get and return the state of a Person

getStateButton() - Method in class AddPersonView

getStateButton() - Method in class EditPersonView

getStateName() - Method in class City

getStateName() - Method in class State

Get and return the state Name

getStateOfBirth() - Method in class Person

Gets the stateOfBirth State object, used for testing purposes

getStateSelected() - Method in class AddPersonView

getStateSelected() - Method in class AddPlaceStateView

getStateSelected() - Method in class EditPersonView

getStateSelected() - Method in class EditPlaceStateView

getStateViewComboBox() - Method in class AddPersonStateView

getStateViewComboBox() - Method in class AddPlaceStateView

getStateViewComboBox() - Method in class EditPersonStateView

getStateViewComboBox() - Method in class EditPlaceStateView

getTargetSelected() - Method in class DegreeSelectionView

getTeamCity() - Method in class Season

Allows other classes to access the team city.

getTeamID() - Method in class TeamIDView

getTeamIDCancelButton() - Method in class TeamIDView

getTeamIDOKButton() - Method in class TeamIDView

getTeamName() - Method in class Season

Allows other classes to access the team name.

getTextName() - Method in class Person

getYear() - Method in class Season

getYearSelectionButton() - Method in class AddSeasonView

getYearSelectionCancelButton() - Method in class YearSelectionView

getYearSelectionOKButton() - Method in class YearSelectionView

graph - Variable in class MainView

A B C D E F G I J L M N O P R S T V W X Y

Skip navigation links

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
layout: post
title: Why Latin!?!
date: 2011-06-04 17:44
author: netravnen
comments: true
categories: [latin, Random, tattoo, wierd]
---

Put "AD ASTRA PER ASPERA" thorugh Google Translate


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hdat/hdatspsubsys.H $                                 */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2017                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

/**
 *  @file hdatspsubsys.H
 *
 *  @brief This file contains the class definition for the service processor
 *         subsystem object.
 *
 */

#ifndef HDATSPSUBSYS_H
#define HDATSPSUBSYS_H

/*--------------------------------------------------------------------------*/
/* Includes                                                                 */
/*--------------------------------------------------------------------------*/
#include <stdint.h>              // standard types
#include <hdat/hdat.H>                // HDAT header type definitions
#include "hdathdif.H"            // HdatHdif base class definition
#include <hdat/hdat_reasoncodes.H>

namespace HDAT
{

/*--------------------------------------------------------------------------*/
/* Type definitions                                                         */
/*--------------------------------------------------------------------------*/

/** @enum hdatSpStatus
 *        Status of a service procesor card
 */
enum hdatSpStatus
{
    HDAT_SP_INSTALLED  = 0x8000,  // service processor is installed
    HDAT_SP_FUNCTIONAL = 0x4000,  // service processor is functional
    HDAT_SP_PRIMARY    = 0x2000   // this is the primary service processor
};

// The number of data pointers in hdatDataPtrs (defined in hdatspsubsys.C)
#define HDAT_SPSUBSYS_NUM_DATA_PTRS 8

/** @brief eye catcher for the HDIF header for the SP subsystem data area
 */
const char HDAT_STRUCT_NAME[] = "SPINFO";

/** @brief Structure version number
 */
const uint16_t HDAT_SP_SUBSYS_VERSION = 0x0021;

/** @brief Structure definition for service processor hardware and software.
    Reserved bytes are added to make the structure a multiple of 4 bytes.
    Adjust the reserved size as necessary if new members are added to this
    structure.
 */
struct hdatSpImpl_t
{
    uint16_t hdatHdwVer;    // 0x0000 Hardware version
    uint16_t hdatSftVer;    // 0x0002 Software version
    uint16_t hdatStatus;    // 0x0004 SP functionality/status
    uint8_t  hdatChipVer;   // 0x0006 SP chip DD level
    uint8_t  hdatReserved1; // 0x0007 padding for alignment
    char     hdatBmcFamily[64];  // 0x0008 bmc family
} __attribute__ ((packed));

/** @brief Structure for uart interrupt info
*/
struct uartIntData_t
{
     uint8_t hdatUARTIntrNum;// UART Interrupt number
     uint8_t hdatTriggerType;// UART interrupt trigger type
     uint8_t hdatResrved2[2];// Reserved
};

/** @brief Structure for Bulk Transfer Interrupt info
*/

struct btIntData_t
{
     uint8_t hdatSMSAttnIntrNum;
     uint8_t hdatBMCtoHostRespIntrNum;
     uint8_t hdatReserved[2];
};

/** @brief Structure definition for the I/O path to the service processor
 */
struct hdatSpIoPath_t
{
    uint16_t     hdatPathType;          // 0x0000 I/O path type
    uint16_t     hdatLinkStatus;        // 0x0002 PSI Link status
    uint8_t      hdatML2ChipVer;        // 0x0004 Chip DD level of ML2 controller
    uint8_t      hdatResvd[3];          // 0x0005 Reserved
    uint32_t     hdatProcChipId;        // 0x0008 Processor chip id
    uint32_t     hdatLPCHCBarIOAdrSpc;  // 0x000C LPCHC BAR for I/O Adr Space
    uint32_t     hdatLPCHCBarMemAdrSpc; // 0x0010 LPCHC BAR for MemAdr Space
    uint32_t     hdatLPCHCBarFwAdrSpc;  // 0x0014 LPCHC BAR for FW Adr Space
    uint32_t     hdatLPCHCBarIntRegSpc; // 0x0018 LPCHC BAR for Internal Reg Space
    uint32_t     hdatReserved1;         // 0x001C Reserved
    uint64_t     hdatBarOfUARTDev;      // 0x0020 BAR of UART device on LPC bus
    uint32_t     hdatSizeofUARTAdrSpc;  // 0x0028 Size of UART device adr space
    uint32_t     hdatUARTFreqHz;        // 0x002C Clock Frequcny of UART buad clock
    uint32_t     hdatCurUARTDevBaudRate;// 0x0030 Current Baud rate of UART device
    uartIntData_t  hdatUARTInterruptDetails; // 0x0034 UART interrupt details
    btIntData_t    hdatBTInterruptDetails;   // 0x0048 Bulk Tansfer Interrupt Details
} __attribute__ ((packed));

#define HDAT_NON_FUNCTIONAL 0 // PSI link is not functional
#define HDAT_CURRENT_LINK   1 // This FSP's current functional link
#define HDAT_CANDIDATE_LINK 2 // Candidate link if current link fails

/** @brief Structure definition for the service processor memory
 */
struct hdatSpMem_t
{
    uint32_t deprecated1[5];  // Deprecated in latest spec 9.13c
    uint32_t hdatHostRamSize;  // 0x0014 Size of host private NVRAM
    uint32_t deprecated2[2];    // Deprecated in latest spec 9.13c
} __attribute__ ((packed));

/** @enum hdatSpSubSysDataPtrs
 *        Constants for the internal data pointers that are added to the base
 *        class
 */
enum hdatSpSubSysDataPtrs
{
    HDAT_SPSUBSYS_FRU_ID     = 0,
    HDAT_SPSUBSYS_KWD        = 1,
    HDAT_SPSUBSYS_IMPL       = 2,
    HDAT_SPSUBSYS_DEPRECATED = 3,
    HDAT_SPSUBSYS_MEMORY     = 4,
    HDAT_SPSUBSYS_IO_PATH    = 5,
    HDAT_SPSUBSYS_RESERVED1  = 6,
    HDAT_SPSUBSYS_RESERVED2  = 7,
    HDAT_SPSUBSYS_LAST       = 8
};

const uint32_t HDAT_MAX_NUM_IO_PATHS = 32;
const uint16_t HDAT_LPC_PATH_TYPE = 3;
const uint32_t HDAT_NUM_IO_PATHS_FOR_BMC = 1;
const uint32_t LPC_PATH_FRU_CNT_FOR_BMC = 2;

/*-----------------------------------------------------------------------------*/
/* C++ class definition                                                        */
/*-----------------------------------------------------------------------------*/

/** Begin Class Description
 *
 * @brief  The HdatSpSubsys class is used to construct objects that describe
 *         the service processor hardware and software.
 *
 * Description: This class defines a specialized object.  It is not intended
 *              that anyone can create an object of this type.  In particular,
 *              the object is built only in the hdatstep process when the step
 *              that builds hypervisor data structures is run.
 *
 *              The real purpose of the object is to create the service processor
 *              subsystem structure as defined by the PHYP Initialization architecture
 *              This data structure is eventually DMA'd to main memory.  The
 *              class is not defined to be a general purpose interface for
 *              building this object by anyone other than the hdatstep process.
 *
 * Thread safety:  An HdatSpSubsys object is not thread safe.  That is, a single
 *                 object cannot be shared and used concurrently by
 *                 multiple threads at the same time.  An object can be used by
 *                 multiple threads if the threads serialize access.  And of
 *                 course, each thread can use its own object with no concerns
 *                 about what other threads are doing.
 *
 * Signal handler usage: This class is not intended to be used in a signal handler
 *                       and nothing has been done to try and make it safe to use
 *                       in a signal handler.
 *
 * End Class Description
 */
class HdatSpSubsys : public HdatHdif
{
    public:

	/**
         * @brief Construct an HdatSpSubsys object.
         *
         *       This is the constructor for the HdatSpSubsys object.
         *
         *       If you are constructing this object on the heap by using new, then
         *       you must check the pointer returned from new to see if it is null.
         *       If it is null, new failed to allocate storage and the constructor
         *       was not called.  If it is not null, then you must check o_errlHndl
         *       to see if the constructor ran successfully.  If o_errlHndl indicates
         *       an error was reported by the constructor, new has already allocated
         *       heap storage and the object must be deleted in order to free the
         *       heap storage.
         *
         * @pre None
         *
         * @post An HdatSpSubsys object has been constructed.  Heap storage has been allocated.
         *
         * @param o_errlHndl   - output parameter - If any errors occur, the HdatSpSubsys object
         *                       is NOT constructed and errors are returned in this parameter
         * @param i_resourceId - input parameter - The resource id of the service processor FRU
         * @param i_msAddr     - input parameter - The main memory address that the service
         *                       processor subsystem structure will be DMA'd to.
         *
         * @return A null error log handle if successful, else the return code pointed
         *         to by o_errlHndl contains one of:
         *
         * @retval HDAT_REGISTRY_ERROR
         * @retval HDAT_OTHER_COMP_ERROR
         */
        HdatSpSubsys(errlHndl_t &o_errlHndl,
                        hdatMsAddr_t &io_msAddr);

        /**
         * @brief HdatSpSubsys object destructor
         *
         *        This is the destructor for an HdatSpSubsys object.  Any heap storage
         *        allocated for the object is dallocated.
         *
         * @pre No preconditions exist
         *
         * @post The HdatSpSubsys object has been destroyed and can no longer be used.
         *
         */
        virtual ~HdatSpSubsys();
        /**
         * @brief member function to get the size of sp sub sys structure
         *
         *        Getter for iv_size
         */
         uint32_t getSpSubSysStructSize();

        /**
        * @brief function to fill internal data pointers.
        *
        * @return A null error handle if successfull
        */
        errlHndl_t hdatFillDataPtrs();

    private:
       /** Object Instance Data
         *
         * @li iv_msAddr         - Mainstore phyisical address
         * @li iv_kwdSize        - size of the ASCII keyword
         * @li iv_kwd            - ptr to storage which holds the ASCII keyword
         * @li iv_fru            - FRU Id information
         * @li iv_impl           - hardware/software implementation
         * @li iv_mem            - FSP memory information
         * @li iv_ioPathArrayHdr - I/O path array header
         * @li iv_ioPathArray    - I/O path(s) to the FSP card
         * @li iv_spSubsys       - virtual address for SP sub sys data
         * @li iv_size           - size of the sp sub sys total structure
         */
        uint64_t             iv_msAddr;
        uint32_t             iv_kwdSize;
        char                *iv_kwd;
        hdatFruId_t          iv_fru;
        hdatSpImpl_t         iv_impl;
        hdatSpMem_t          iv_mem;
        hdatHDIFDataArray_t  iv_ioPathArrayHdr;
        hdatSpIoPath_t      *iv_ioPathArray;
        uint8_t             *iv_spSubsys;
        uint32_t             iv_size;
        uint32_t             iv_numOfIoPaths;

        /** Class (static) Data
         *
         * Only one copy of this data exists in a process.
         *
         * @li cv_actualCnt - a count of how many HdatSpSubsys objects are created
         */
        static uint32_t   cv_actualCnt;

}; // end of HdatSpSubsys class

/**
 * @brief This routine Loads SP Sub sys information.
 *
 * @param io_msAddr    - input parameter - Mainstore address for SP subsys to write
 * @param o_spSubsysCnt   - output parameter - Count of SP Sub sys structures
 *
 * @return A null error log handle if successful, else the return code pointed
 *         to by errlHndl_t contains one of:
 *
 * @retval
 */

errlHndl_t HdatLoadSpSubSys(hdatMsAddr_t &i_msAddr,
            uint32_t &o_spSubSysTotalSize , uint32_t &o_spSubsysCnt);

}
#endif // HDATSPSUBSYS_H


text:
/**
 * This file provides the styles for general tabs.
 */

.dokuwiki .tabs > ul,
.dokuwiki ul.tabs {
    padding: 0;
    margin: 0;
    overflow: hidden;
    position: relative;
}
/* border underneath */
.dokuwiki .tabs > ul:after,
.dokuwiki ul.tabs:after {
    position: absolute;
    content: "";
    width: 100%;
    bottom: 0;
    left: 0;
    border-bottom: 1px solid @ini_border;
    z-index: 1;
}

.dokuwiki .tabs > ul li,
.dokuwiki ul.tabs li {
    float: left;
    padding: 0;
    margin: 0;
    list-style: none;
}
[dir=rtl] .dokuwiki .tabs > ul li,
[dir=rtl] .dokuwiki ul.tabs li {
    float: right;
}

.dokuwiki .tabs > ul li a,
.dokuwiki ul.tabs li strong,
.dokuwiki ul.tabs li a {
    display: inline-block;
    padding: .3em .8em;
    margin: 0 0 0 .3em;
    background-color: @ini_background_neu;
    color: @ini_text;
    border: 1px solid @ini_border;
    border-radius: .5em .5em 0 0;
    position: relative;
    z-index: 0;
}
[dir=rtl] .dokuwiki .tabs > ul li a,
[dir=rtl] .dokuwiki ul.tabs li strong,
[dir=rtl] .dokuwiki ul.tabs li a {
    margin: 0 .3em 0 0;
}

.dokuwiki ul.tabs li strong {
    font-weight: normal;
}

.dokuwiki ul.tabs li a:link,
.dokuwiki ul.tabs li a:visited {
}
.dokuwiki .tabs > ul li a:hover,
.dokuwiki .tabs > ul li a:active,
.dokuwiki .tabs > ul li a:focus,
.dokuwiki .tabs > ul li .curid a,
.dokuwiki .tabs > ul .active a,
.dokuwiki ul.tabs li a:hover,
.dokuwiki ul.tabs li a:active,
.dokuwiki ul.tabs li a:focus,
.dokuwiki ul.tabs li strong {
    background-color: @ini_background_alt;
    color: @ini_text;
    text-decoration: none;
    font-weight: normal;
}

.dokuwiki .tabs > ul li .curid a,
.dokuwiki .tabs > ul li .active a,
.dokuwiki ul.tabs li strong {
    z-index: 2;
    border-bottom-color: @ini_background_alt;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://jboss.org/schema/seam/pages"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.org/schema/seam/pages http://jboss.org/schema/seam/pages-2.3.xsd"
    no-conversation-view-id="/home.xhtml" login-required="true"
    view-id="/client/updateClient.xhtml">

    <restrict>#{s:hasPermission('client', 'access')}</restrict>

    <param name="inum" value="#{updateClientAction.inum}" required="true" />

    <action execute="#{updateClientAction.update}" if="#{updateClientAction.client == null}" on-postback="false" />

    <rewrite pattern="/client/manage/update/{inum}" />

    <navigation from-action="#{updateClientAction.update}">
        <rule if-outcome="success">
            <begin-conversation join="true" flush-mode="manual" />
            <render view-id="/client/updateClient.xhtml" />
        </rule>

        <rule if-outcome="no_permissions">
            <end-conversation />
            <redirect view-id="/home.xhtml">
                <message severity="ERROR">You don't have permissions to modify client</message>
            </redirect>
        </rule>

        <rule if-outcome="failure">
            <end-conversation />
            <redirect view-id="/client/clientInventory.xhtml">
                <message severity="ERROR">Failed to find client</message>
            </redirect>
        </rule>
    </navigation>

    <navigation from-action="#{updateClientAction.save}">
        <rule if-outcome="success">
            <redirect view-id="/client/updateClient.xhtml">
                <message severity="INFO">Client '#{updateClientAction.client.displayName}' updated successfully</message>
                <param name="inum" value="#{updateClientAction.inum}" />
            </redirect>
        </rule>

        <rule if-outcome="failure">
            <end-conversation />
            <redirect view-id="/client/clientInventory.xhtml">
                <message severity="ERROR">Failed to update client '#{updateScopeAction.scope.displayName}'</message>
            </redirect>
        </rule>
    </navigation>

    <navigation from-action="#{updateClientAction.cancel}">
        <end-conversation />
        <redirect view-id="/client/clientInventory.xhtml">
            <message severity="INFO">Client '#{updateClientAction.client.displayName}' not updated</message>
            <param name="searchPattern" value="#{updateClientAction.client.inum}" />
        </redirect>
    </navigation>

    <navigation from-action="#{cc.attrs.deleteMethod}">
        <rule if-outcome="success">
            <end-conversation />
            <redirect view-id="/client/clientInventory.xhtml">
                <message severity="INFO">Client '#{updateClientAction.client.displayName}' removed successfully</message>
            </redirect>
        </rule>

        <rule if-outcome="failure">
            <end-conversation />
            <redirect view-id="/client/clientInventory.xhtml">
                <message severity="INFO">Failed to remove client '#{updateClientAction.client.displayName}'</message>
            </redirect>
        </rule>
    </navigation>

</page>