text:
(function() {
  var add, backdropFilter, bckgrndImgOpts, boxdecorbreak, crispedges, cursorsGrab, cursorsNewer, decoration, devdaptation, elementFunction, feature, filterFunction, flexbox, fullscreen, gradients, grid, logicalProps, prefix, readOnly, resolution, result, sort, textAlignLast, textSizeAdjust, textSpacing, transforms3d, userSelectNone, writingMode,
    slice = [].slice;

  sort = function(array) {
    return array.sort(function(a, b) {
      var d;
      a = a.split(' ');
      b = b.split(' ');
      if (a[0] > b[0]) {
        return 1;
      } else if (a[0] < b[0]) {
        return -1;
      } else {
        d = parseFloat(a[1]) - parseFloat(b[1]);
        if (d > 0) {
          return 1;
        } else if (d < 0) {
          return -1;
        } else {
          return 0;
        }
      }
    });
  };

  feature = function(data, opts, callback) {
    var browser, match, need, ref, ref1, support, version, versions;
    if (!callback) {
      ref = [opts, {}], callback = ref[0], opts = ref[1];
    }
    match = opts.match || /\sx($|\s)/;
    need = [];
    ref1 = data.stats;
    for (browser in ref1) {
      versions = ref1[browser];
      for (version in versions) {
        support = versions[version];
        if (support.match(match)) {
          need.push(browser + ' ' + version);
        }
      }
    }
    return callback(sort(need));
  };

  result = {};

  prefix = function() {
    var data, i, j, k, len, name, names, results;
    names = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), data = arguments[j++];
    results = [];
    for (k = 0, len = names.length; k < len; k++) {
      name = names[k];
      result[name] = {};
      results.push((function() {
        var results1;
        results1 = [];
        for (i in data) {
          results1.push(result[name][i] = data[i]);
        }
        return results1;
      })());
    }
    return results;
  };

  add = function() {
    var data, j, k, len, name, names, results;
    names = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), data = arguments[j++];
    results = [];
    for (k = 0, len = names.length; k < len; k++) {
      name = names[k];
      results.push(result[name].browsers = sort(result[name].browsers.concat(data.browsers)));
    }
    return results;
  };

  module.exports = result;

  feature(require('caniuse-db/features-json/border-radius.json'), function(browsers) {
    return prefix('border-radius', 'border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', {
      mistakes: ['-khtml-', '-ms-', '-o-'],
      browsers: browsers,
      feature: 'border-radius'
    });
  });

  feature(require('caniuse-db/features-json/css-boxshadow.json'), function(browsers) {
    return prefix('box-shadow', {
      mistakes: ['-khtml-'],
      browsers: browsers,
      feature: 'css-boxshadow'
    });
  });

  feature(require('caniuse-db/features-json/css-animation.json'), function(browsers) {
    return prefix('animation', 'animation-name', 'animation-duration', 'animation-delay', 'animation-direction', 'animation-fill-mode', 'animation-iteration-count', 'animation-play-state', 'animation-timing-function', '@keyframes', {
      mistakes: ['-khtml-', '-ms-'],
      browsers: browsers,
      feature: 'css-animation'
    });
  });

  feature(require('caniuse-db/features-json/css-transitions.json'), function(browsers) {
    return prefix('transition', 'transition-property', 'transition-duration', 'transition-delay', 'transition-timing-function', {
      mistakes: ['-khtml-', '-ms-'],
      browsers: browsers,
      feature: 'css-transitions'
    });
  });

  feature(require('caniuse-db/features-json/transforms2d.json'), function(browsers) {
    return prefix('transform', 'transform-origin', {
      browsers: browsers,
      feature: 'transforms2d'
    });
  });

  transforms3d = require('caniuse-db/features-json/transforms3d.json');

  feature(transforms3d, function(browsers) {
    prefix('perspective', 'perspective-origin', {
      browsers: browsers,
      feature: 'transforms3d'
    });
    return prefix('transform-style', {
      mistakes: ['-ms-', '-o-'],
      browsers: browsers,
      feature: 'transforms3d'
    });
  });

  feature(transforms3d, {
    match: /y\sx|y\s#2/
  }, function(browsers) {
    return prefix('backface-visibility', {
      mistakes: ['-ms-', '-o-'],
      browsers: browsers,
      feature: 'transforms3d'
    });
  });

  gradients = require('caniuse-db/features-json/css-gradients.json');

  feature(gradients, {
    match: /y\sx/
  }, function(browsers) {
    return prefix('linear-gradient', 'repeating-linear-gradient', 'radial-gradient', 'repeating-radial-gradient', {
      props: ['background', 'background-image', 'border-image', 'mask', 'list-style', 'list-style-image', 'content', 'mask-image'],
      mistakes: ['-ms-'],
      browsers: browsers,
      feature: 'css-gradients'
    });
  });

  feature(gradients, {
    match: /a\sx/
  }, function(browsers) {
    browsers = browsers.map(function(i) {
      if (/op/.test(i)) {
        return i;
      } else {
        return i + " old";
      }
    });
    return add('linear-gradient', 'repeating-linear-gradient', 'radial-gradient', 'repeating-radial-gradient', {
      browsers: browsers,
      feature: 'css-gradients'
    });
  });

  feature(require('caniuse-db/features-json/css3-boxsizing.json'), function(browsers) {
    return prefix('box-sizing', {
      browsers: browsers,
      feature: 'css3-boxsizing'
    });
  });

  feature(require('caniuse-db/features-json/css-filters.json'), function(browsers) {
    return prefix('filter', {
      browsers: browsers,
      feature: 'css-filters'
    });
  });

  filterFunction = require('caniuse-db/features-json/css-filter-function.json');

  feature(filterFunction, function(browsers) {
    return prefix('filter-function', {
      props: ['background', 'background-image', 'border-image', 'mask', 'list-style', 'list-style-image', 'content', 'mask-image'],
      browsers: browsers,
      feature: 'css-filter-function'
    });
  });

  backdropFilter = require('caniuse-db/features-json/css-backdrop-filter.json');

  feature(backdropFilter, function(browsers) {
    return prefix('backdrop-filter', {
      browsers: browsers,
      feature: 'css-backdrop-filter'
    });
  });

  elementFunction = require('caniuse-db/features-json/css-element-function.json');

  feature(elementFunction, function(browsers) {
    return prefix('element', {
      props: ['background', 'background-image', 'border-image', 'mask', 'list-style', 'list-style-image', 'content', 'mask-image'],
      browsers: browsers,
      feature: 'css-element-function'
    });
  });

  feature(require('caniuse-db/features-json/multicolumn.json'), function(browsers) {
    prefix('columns', 'column-width', 'column-gap', 'column-rule', 'column-rule-color', 'column-rule-width', {
      browsers: browsers,
      feature: 'multicolumn'
    });
    return prefix('column-count', 'column-rule-style', 'column-span', 'column-fill', 'break-before', 'break-after', 'break-inside', {
      browsers: browsers,
      feature: 'multicolumn'
    });
  });

  userSelectNone = require('caniuse-db/features-json/user-select-none.json');

  feature(userSelectNone, function(browsers) {
    return prefix('user-select', {
      mistakes: ['-khtml-'],
      browsers: browsers,
      feature: 'user-select-none'
    });
  });

  flexbox = require('caniuse-db/features-json/flexbox.json');

  feature(flexbox, {
    match: /a\sx/
  }, function(browsers) {
    browsers = browsers.map(function(i) {
      if (/ie|firefox/.test(i)) {
        return i;
      } else {
        return i + " 2009";
      }
    });
    prefix('display-flex', 'inline-flex', {
      props: ['display'],
      browsers: browsers,
      feature: 'flexbox'
    });
    prefix('flex', 'flex-grow', 'flex-shrink', 'flex-basis', {
      browsers: browsers,
      feature: 'flexbox'
    });
    return prefix('flex-direction', 'flex-wrap', 'flex-flow', 'justify-content', 'order', 'align-items', 'align-self', 'align-content', {
      browsers: browsers,
      feature: 'flexbox'
    });
  });

  feature(flexbox, {
    match: /y\sx/
  }, function(browsers) {
    add('display-flex', 'inline-flex', {
      browsers: browsers,
      feature: 'flexbox'
    });
    add('flex', 'flex-grow', 'flex-shrink', 'flex-basis', {
      browsers: browsers,
      feature: 'flexbox'
    });
    return add('flex-direction', 'flex-wrap', 'flex-flow', 'justify-content', 'order', 'align-items', 'align-self', 'align-content', {
      browsers: browsers,
      feature: 'flexbox'
    });
  });

  feature(require('caniuse-db/features-json/calc.json'), function(browsers) {
    return prefix('calc', {
      props: ['*'],
      browsers: browsers,
      feature: 'calc'
    });
  });

  bckgrndImgOpts = require('caniuse-db/features-json/background-img-opts.json');

  feature(bckgrndImgOpts, function(browsers) {
    return prefix('background-clip', 'background-origin', 'background-size', {
      browsers: browsers,
      feature: 'background-img-opts'
    });
  });

  feature(require('caniuse-db/features-json/font-feature.json'), function(browsers) {
    return prefix('font-feature-settings', 'font-variant-ligatures', 'font-language-override', 'font-kerning', {
      browsers: browsers,
      feature: 'font-feature'
    });
  });

  feature(require('caniuse-db/features-json/border-image.json'), function(browsers) {
    return prefix('border-image', {
      browsers: browsers,
      feature: 'border-image'
    });
  });

  feature(require('caniuse-db/features-json/css-selection.json'), function(browsers) {
    return prefix('::selection', {
      selector: true,
      browsers: browsers,
      feature: 'css-selection'
    });
  });

  feature(require('caniuse-db/features-json/css-placeholder.json'), function(browsers) {
    browsers = browsers.map(function(i) {
      var name, ref, version;
      ref = i.split(' '), name = ref[0], version = ref[1];
      if (name === 'firefox' && parseFloat(version) <= 18) {
        return i + ' old';
      } else {
        return i;
      }
    });
    return prefix('::placeholder', {
      selector: true,
      browsers: browsers,
      feature: 'css-placeholder'
    });
  });

  feature(require('caniuse-db/features-json/css-hyphens.json'), function(browsers) {
    return prefix('hyphens', {
      browsers: browsers,
      feature: 'css-hyphens'
    });
  });

  fullscreen = require('caniuse-db/features-json/fullscreen.json');

  feature(fullscreen, function(browsers) {
    return prefix(':fullscreen', {
      selector: true,
      browsers: browsers,
      feature: 'fullscreen'
    });
  });

  feature(fullscreen, {
    match: /x(\s#2|$)/
  }, function(browsers) {
    return prefix('::backdrop', {
      selector: true,
      browsers: browsers,
      feature: 'fullscreen'
    });
  });

  feature(require('caniuse-db/features-json/css3-tabsize.json'), function(browsers) {
    return prefix('tab-size', {
      browsers: browsers,
      feature: 'css3-tabsize'
    });
  });

  feature(require('caniuse-db/features-json/intrinsic-width.json'), function(browsers) {
    return prefix('max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch', {
      props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size'],
      browsers: browsers,
      feature: 'intrinsic-width'
    });
  });

  cursorsNewer = require('caniuse-db/features-json/css3-cursors-newer.json');

  feature(cursorsNewer, function(browsers) {
    return prefix('zoom-in', 'zoom-out', {
      props: ['cursor'],
      browsers: browsers,
      feature: 'css3-cursors-newer'
    });
  });

  cursorsGrab = require('caniuse-db/features-json/css3-cursors-grab.json');

  feature(cursorsGrab, function(browsers) {
    return prefix('grab', 'grabbing', {
      props: ['cursor'],
      browsers: browsers,
      feature: 'css3-cursors-grab'
    });
  });

  feature(require('caniuse-db/features-json/css-sticky.json'), function(browsers) {
    return prefix('sticky', {
      props: ['position'],
      browsers: browsers,
      feature: 'css-sticky'
    });
  });

  feature(require('caniuse-db/features-json/pointer.json'), function(browsers) {
    return prefix('touch-action', {
      browsers: browsers,
      feature: 'pointer'
    });
  });

  decoration = require('caniuse-db/features-json/text-decoration.json');

  feature(decoration, function(browsers) {
    return prefix('text-decoration-style', 'text-decoration-color', 'text-decoration-line', {
      browsers: browsers,
      feature: 'text-decoration'
    });
  });

  feature(decoration, {
    match: /x.*#[23]/
  }, function(browsers) {
    return prefix('text-decoration-skip', {
      browsers: browsers,
      feature: 'text-decoration'
    });
  });

  textSizeAdjust = require('caniuse-db/features-json/text-size-adjust.json');

  feature(textSizeAdjust, function(browsers) {
    return prefix('text-size-adjust', {
      browsers: browsers,
      feature: 'text-size-adjust'
    });
  });

  feature(require('caniuse-db/features-json/css-masks.json'), function(browsers) {
    prefix('mask-clip', 'mask-composite', 'mask-image', 'mask-origin', 'mask-repeat', 'mask-border-repeat', 'mask-border-source', {
      browsers: browsers,
      feature: 'css-masks'
    });
    return prefix('mask', 'mask-position', 'mask-size', 'mask-border', 'mask-border-outset', 'mask-border-width', 'mask-border-slice', {
      browsers: browsers,
      feature: 'css-masks'
    });
  });

  feature(require('caniuse-db/features-json/css-clip-path.json'), function(browsers) {
    return prefix('clip-path', {
      browsers: browsers,
      feature: 'css-clip-path'
    });
  });

  boxdecorbreak = require('caniuse-db/features-json/css-boxdecorationbreak.json');

  feature(boxdecorbreak, function(browsers) {
    return prefix('box-decoration-break', {
      browsers: browsers,
      feature: 'css-boxdecorationbreak'
    });
  });

  feature(require('caniuse-db/features-json/object-fit.json'), function(browsers) {
    return prefix('object-fit', 'object-position', {
      browsers: browsers,
      feature: 'object-fit'
    });
  });

  feature(require('caniuse-db/features-json/css-shapes.json'), function(browsers) {
    return prefix('shape-margin', 'shape-outside', 'shape-image-threshold', {
      browsers: browsers,
      feature: 'css-shapes'
    });
  });

  feature(require('caniuse-db/features-json/text-overflow.json'), function(browsers) {
    return prefix('text-overflow', {
      browsers: browsers,
      feature: 'text-overflow'
    });
  });

  devdaptation = require('caniuse-db/features-json/css-deviceadaptation.json');

  feature(devdaptation, function(browsers) {
    return prefix('@viewport', {
      browsers: browsers,
      feature: 'css-deviceadaptation'
    });
  });

  resolution = require('caniuse-db/features-json/css-media-resolution.json');

  feature(resolution, {
    match: /( x($| )|a #3)/
  }, function(browsers) {
    return prefix('@resolution', {
      browsers: browsers,
      feature: 'css-media-resolution'
    });
  });

  textAlignLast = require('caniuse-db/features-json/css-text-align-last.json');

  feature(textAlignLast, function(browsers) {
    return prefix('text-align-last', {
      browsers: browsers,
      feature: 'css-text-align-last'
    });
  });

  crispedges = require('caniuse-db/features-json/css-crisp-edges.json');

  feature(crispedges, {
    match: /y x|a x #1/
  }, function(browsers) {
    return prefix('pixelated', {
      props: ['image-rendering'],
      browsers: browsers,
      feature: 'css-crisp-edges'
    });
  });

  feature(crispedges, {
    match: /a x #2/
  }, function(browsers) {
    return prefix('image-rendering', {
      browsers: browsers,
      feature: 'css-crisp-edges'
    });
  });

  logicalProps = require('caniuse-db/features-json/css-logical-props.json');

  feature(logicalProps, function(browsers) {
    return prefix('border-inline-start', 'border-inline-end', 'margin-inline-start', 'margin-inline-end', 'padding-inline-start', 'padding-inline-end', {
      browsers: browsers,
      feature: 'css-logical-props'
    });
  });

  feature(logicalProps, {
    match: /x\s#2/
  }, function(browsers) {
    return prefix('border-block-start', 'border-block-end', 'margin-block-start', 'margin-block-end', 'padding-block-start', 'padding-block-end', {
      browsers: browsers,
      feature: 'css-logical-props'
    });
  });

  feature(require('caniuse-db/features-json/css-appearance.json'), function(browsers) {
    return prefix('appearance', {
      browsers: browsers,
      feature: 'css-appearance'
    });
  });

  feature(require('caniuse-db/features-json/css-snappoints.json'), function(browsers) {
    return prefix('scroll-snap-type', 'scroll-snap-coordinate', 'scroll-snap-destination', 'scroll-snap-points-x', 'scroll-snap-points-y', {
      browsers: browsers,
      feature: 'css-snappoints'
    });
  });

  feature(require('caniuse-db/features-json/css-regions.json'), function(browsers) {
    return prefix('flow-into', 'flow-from', 'region-fragment', {
      browsers: browsers,
      feature: 'css-regions'
    });
  });

  feature(require('caniuse-db/features-json/css-image-set.json'), function(browsers) {
    return prefix('image-set', {
      props: ['background', 'background-image', 'border-image', 'mask', 'list-style', 'list-style-image', 'content', 'mask-image'],
      browsers: browsers,
      feature: 'css-image-set'
    });
  });

  writingMode = require('caniuse-db/features-json/css-writing-mode.json');

  feature(writingMode, {
    match: /a|x/
  }, function(browsers) {
    return prefix('writing-mode', {
      browsers: browsers,
      feature: 'css-writing-mode'
    });
  });

  feature(require('caniuse-db/features-json/css-cross-fade.json'), function(browsers) {
    return prefix('cross-fade', {
      props: ['background', 'background-image', 'border-image', 'mask', 'list-style', 'list-style-image', 'content', 'mask-image'],
      browsers: browsers,
      feature: 'css-cross-fade'
    });
  });

  readOnly = require('caniuse-db/features-json/css-read-only-write.json');

  feature(readOnly, function(browsers) {
    return prefix(':read-only', ':read-write', {
      selector: true,
      browsers: browsers,
      feature: 'css-read-only-write'
    });
  });

  feature(require('caniuse-db/features-json/text-emphasis.json'), function(browsers) {
    return prefix('text-emphasis', 'text-emphasis-position', 'text-emphasis-style', 'text-emphasis-color', {
      browsers: browsers,
      feature: 'text-emphasis'
    });
  });

  grid = require('caniuse-db/features-json/css-grid.json');

  feature(grid, function(browsers) {
    prefix('display-grid', 'inline-grid', {
      props: ['display'],
      browsers: browsers,
      feature: 'css-grid'
    });
    return prefix('grid-template-columns', 'grid-template-rows', 'grid-row-start', 'grid-column-start', 'grid-row-end', 'grid-column-end', 'grid-row', 'grid-column', {
      browsers: browsers,
      feature: 'css-grid'
    });
  });

  feature(grid, {
    match: /a x/
  }, function(browsers) {
    return prefix('justify-items', 'grid-row-align', {
      browsers: browsers,
      feature: 'css-grid'
    });
  });

  textSpacing = require('caniuse-db/features-json/css-text-spacing.json');

  feature(textSpacing, function(browsers) {
    return prefix('text-spacing', {
      browsers: browsers,
      feature: 'css-text-spacing'
    });
  });

  feature(require('caniuse-db/features-json/css-any-link.json'), function(browsers) {
    return prefix(':any-link', {
      selector: true,
      browsers: browsers,
      feature: 'css-any-link'
    });
  });

}).call(this);


text:
package org.apache.qpid.proton.codec.transport;

import java.util.Collection;

import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.UnsignedLong;
import org.apache.qpid.proton.amqp.transport.Flow;
import org.apache.qpid.proton.codec.AMQPType;
import org.apache.qpid.proton.codec.DecodeException;
import org.apache.qpid.proton.codec.Decoder;
import org.apache.qpid.proton.codec.DecoderImpl;
import org.apache.qpid.proton.codec.EncoderImpl;
import org.apache.qpid.proton.codec.EncodingCodes;
import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor;
import org.apache.qpid.proton.codec.TypeEncoding;
import org.apache.qpid.proton.codec.WritableBuffer;

public class FastPathFlowType implements AMQPType<Flow>, FastPathDescribedTypeConstructor<Flow> {

    private static final byte DESCRIPTOR_CODE = 0x13;

    private static final Object[] DESCRIPTORS =
    {
        UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:flow:list"),
    };

    private final FlowType flowType;

    public FastPathFlowType(EncoderImpl encoder) {
        this.flowType = new FlowType(encoder);
    }

    public EncoderImpl getEncoder() {
        return flowType.getEncoder();
    }

    public DecoderImpl getDecoder() {
        return flowType.getDecoder();
    }

    @Override
    public boolean encodesJavaPrimitive() {
        return false;
    }

    @Override
    public Class<Flow> getTypeClass() {
        return Flow.class;
    }

    @Override
    public TypeEncoding<Flow> getEncoding(Flow flow) {
        return flowType.getEncoding(flow);
    }

    @Override
    public TypeEncoding<Flow> getCanonicalEncoding() {
        return flowType.getCanonicalEncoding();
    }

    @Override
    public Collection<? extends TypeEncoding<Flow>> getAllEncodings() {
        return flowType.getAllEncodings();
    }

    @Override
    public Flow readValue() {
        DecoderImpl decoder = getDecoder();
        byte typeCode = decoder.getBuffer().get();

        @SuppressWarnings("unused")
        int size = 0;
        int count = 0;

        switch (typeCode) {
            case EncodingCodes.LIST0:
                // TODO - Technically invalid however old decoder also allowed this.
                break;
            case EncodingCodes.LIST8:
                size = ((int)decoder.getBuffer().get()) & 0xff;
                count = ((int)decoder.getBuffer().get()) & 0xff;
                break;
            case EncodingCodes.LIST32:
                size = decoder.getBuffer().getInt();
                count = decoder.getBuffer().getInt();
                break;
            default:
                throw new DecodeException("Incorrect type found in Flow encoding: " + typeCode);
        }

        if (count < 4) {
            throw new DecodeException("The outgoing-window field cannot be omitted");
        }

        try {
            return readFields(decoder, count);
        } catch (NullPointerException npe) {
            throw new DecodeException("Unexpected null value - mandatory field not set? (" + npe.getMessage() + ")", npe);
        }
    }

    private final Flow readFields(DecoderImpl decoder, int count) {
        Flow flow = new Flow();

        for (int index = 0; index < count; ++index) {
            switch (index) {
                case 0:
                    flow.setNextIncomingId(decoder.readUnsignedInteger(null));
                    break;
                case 1:
                    flow.setIncomingWindow(decoder.readUnsignedInteger(null));
                    break;
                case 2:
                    flow.setNextOutgoingId(decoder.readUnsignedInteger(null));
                    break;
                case 3:
                    flow.setOutgoingWindow(decoder.readUnsignedInteger(null));
                    break;
                case 4:
                    flow.setHandle(decoder.readUnsignedInteger(null));
                    break;
                case 5:
                    flow.setDeliveryCount(decoder.readUnsignedInteger(null));
                    break;
                case 6:
                    flow.setLinkCredit(decoder.readUnsignedInteger(null));
                    break;
                case 7:
                    flow.setAvailable(decoder.readUnsignedInteger(null));
                    break;
                case 8:
                    flow.setDrain(decoder.readBoolean(false));
                    break;
                case 9:
                    flow.setEcho(decoder.readBoolean(false));
                    break;
                case 10:
                    flow.setProperties(decoder.readMap());
                    break;
                default:
                    throw new IllegalStateException("To many entries in Flow encoding");
            }
        }

        return flow;
    }

    @Override
    public void skipValue() {
        getDecoder().readConstructor().skipValue();
    }

    @Override
    public void write(Flow flow) {
        WritableBuffer buffer = getEncoder().getBuffer();
        int count = getElementCount(flow);
        byte encodingCode = deduceEncodingCode(flow, count);

        buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR);
        buffer.put(EncodingCodes.SMALLULONG);
        buffer.put(DESCRIPTOR_CODE);
        buffer.put(encodingCode);

        final int fieldWidth;

        if (encodingCode == EncodingCodes.LIST8) {
            fieldWidth = 1;
        } else {
            fieldWidth = 4;
        }

        int startIndex = buffer.position();

        // Reserve space for the size and write the count of list elements.
        if (fieldWidth == 1) {
            buffer.put((byte) 0);
            buffer.put((byte) count);
        } else {
            buffer.putInt(0);
            buffer.putInt(count);
        }

        // Write the list elements and then compute total size written.
        for (int i = 0; i < count; ++i) {
            writeElement(flow, i);
        }

        // Move back and write the size
        int endIndex = buffer.position();
        int writeSize = endIndex - startIndex - fieldWidth;

        buffer.position(startIndex);
        if (fieldWidth == 1) {
            buffer.put((byte) writeSize);
        } else {
            buffer.putInt(writeSize);
        }
        buffer.position(endIndex);
    }

    private void writeElement(Flow flow, int index) {
        switch (index) {
            case 0:
                getEncoder().writeUnsignedInteger(flow.getNextIncomingId());
                break;
            case 1:
                getEncoder().writeUnsignedInteger(flow.getIncomingWindow());
                break;
            case 2:
                getEncoder().writeUnsignedInteger(flow.getNextOutgoingId());
                break;
            case 3:
                getEncoder().writeUnsignedInteger(flow.getOutgoingWindow());
                break;
            case 4:
                getEncoder().writeUnsignedInteger(flow.getHandle());
                break;
            case 5:
                getEncoder().writeUnsignedInteger(flow.getDeliveryCount());
                break;
            case 6:
                getEncoder().writeUnsignedInteger(flow.getLinkCredit());
                break;
            case 7:
                getEncoder().writeUnsignedInteger(flow.getAvailable());
                break;
            case 8:
                getEncoder().writeBoolean(flow.getDrain());
                break;
            case 9:
                getEncoder().writeBoolean(flow.getEcho());
                break;
            case 10:
                getEncoder().writeMap(flow.getProperties());
                break;
            default:
                throw new IllegalArgumentException("Unknown Flow value index: " + index);
        }
    }

    private int getElementCount(Flow flow) {
        if (flow.getProperties() != null) {
            return 11;
        } else if (flow.getEcho()) {
            return 10;
        } else if (flow.getDrain()) {
            return 9;
        } else if (flow.getAvailable() != null) {
            return 8;
        } else if (flow.getLinkCredit() != null) {
            return 7;
        } else if (flow.getDeliveryCount() != null) {
            return 6;
        } else if (flow.getHandle() != null) {
            return 5;
        } else {
            return 4;
        }
    }

    private byte deduceEncodingCode(Flow value, int elementCount) {
        if (value.getProperties() == null) {
            return EncodingCodes.LIST8;
        } else {
            return EncodingCodes.LIST32;
        }
    }

    public static void register(Decoder decoder, EncoderImpl encoder) {
        FastPathFlowType type = new FastPathFlowType(encoder);
        for(Object descriptor : DESCRIPTORS)
        {
            decoder.register(descriptor, (FastPathDescribedTypeConstructor<?>) type);
        }
        encoder.register(type);
    }
}

redpajama_set_name: RedPajamaGithub


text:
A lightweight 2D vector drawing framework using [vgcore](https://github.com/rhcad/vgcore) for iOS.
It uses the CoreGraphics and UIKit frameworks to render shapes and handle gestures.

[![Version](http://img.shields.io/cocoapods/v/TouchVG.svg)](http://cocoadocs.org/docsets/TouchVG/)
[![Platform](http://img.shields.io/cocoapods/p/TouchVG.svg)](http://cocoadocs.org/docsets/TouchVG/)
[![License](http://img.shields.io/cocoapods/l/TouchVG.svg)](LICENSE)

Features described in [Online document](http://touchvg.github.io). Please visit demo projects ([vgios-demo](https://github.com/rhcad/vgios-demo), [vgios_examples](https://github.com/rhcad/vgios_examples) and [iOSColorPad](https://github.com/rhcad/iOSColorPad) to see more examples.

![arch](http://touchvg.github.io/images/arch.svg)

![iphone1](http://touchvg.github.io/images/iphone1.png) | ![iphone2](http://touchvg.github.io/images/iphone2.png)

## License

This is an open source [BSD licensed](LICENSE) project. It uses the following open source projects:

- [vgcore](https://github.com/rhcad/vgcore) (BSD): Cross-platform vector drawing libraries using C++.
- [SVGKit](https://github.com/SVGKit/SVGKit) (MIT): Display and interact with SVG Images with CoreAnimation on iOS.
- [iOS-Universal-Library-Template](https://github.com/michaeltyson/iOS-Universal-Library-Template): Use it to create static library project.

## How to Contribute

Contributors and sponsors are welcome. You may translate, commit issues or pull requests on this Github site.
To contribute, please follow the branching model outlined here: [A successful Git branching model](http://nvie.com/posts/a-successful-git-branching-model/).

## Contributors

- [Zhang Yungui](https://github.com/rhcad)
- [Archer](https://github.com/a7ch3r)
- [ljlin](https://github.com/ljlin)
- [Pengjun](https://github.com/pengjun) / Line and triangle commands
- [Proteas](https://github.com/proteas)

# How to Compile

## Compile TouchVG with CocoaPods

Type `pod install` or `pod update --no-repo-update`, then open `TouchVG.xcworkspace` in Xcode, then build the `TouchVG` or `TouchVG-SVG` target.

  - Remove `libPods-TouchVG-TouchVG-SVG.a` and `libPods-TouchVG.a` from `Link Binary With Libraries`.
  - `libTouchVG.a` does not support SVG display.
  - `libTouchVG-SVG.a` can display SVG shapes using [SVGKit](https://github.com/SVGKit/SVGK).

## Compile TouchVG without CocoaPods

Alternatively, you can build as one of the following methods:

- Open `TouchVG/TouchVG.xcodeproj` in Xcode, then build the `TouchVG` or `TouchVG-SVG` target.

   - `libTouchVG.a` does not support SVG display.
   - `libTouchVG-SVG.a` can display SVG shapes using [SVGKit](https://github.com/SVGKit/SVGKit).

- Or type `./build.sh` to compile static libraries to the `output` directory.
  - Type `./build.sh -arch arm64` to make for iOS 64-bit.
  - Type `./build.sh clean` to remove object files.it).

## Use TouchVG with CocoaPods

TouchVG is available on [CocoaPods](http://cocoapods.org). Just add the following to your project Podfile:

```ruby
pod 'TouchVG'
```

Or use the develop version:

```ruby
pod 'TouchVG', :podspec => 'https://raw.githubusercontent.com/touchvg/vgios/develop/podspec/TouchVG.podspec'
```

Or add the following to use SVG rendering feature with [SVGKit](https://github.com/SVGKit/SVGKit):

```ruby
pod 'TouchVG-SVG', :podspec => 'https://raw.githubusercontent.com/touchvg/vgios/develop/podspec/TouchVG-SVG.podspec'
```

Then type `pod install` or `pod update --no-repo-update`. Need to copy `podspec/SVGKit.podspec` to `~/.cocoapods/repos/master/Specs/SVGKit/2.0/` to use the lastest version of SVGKit.

## Use TouchVG without CocoaPods

- Add `libTouchVG.a` and `libTouchVGCore.a` to your project, or set OTHER_LDFLAGS as `-lTouchVGCore -lTouchVG`.

- If the error `Undefined symbols for architecture ...in libTouchVGCore.a` occurs, then change the source file which uses TouchVG as *.mm rather than *.m to link with C++ classes.

# Add more shapes and commands

- You can use [newproj.py](https://github.com/rhcad/DemoCmds/blob/master/newproj.py) to create library project containing your own shapes and commands. So the TouchVG and TouchVGCore libraries does not require changes.

  - Checkout and enter [DemoCmds](https://github.com/rhcad/DemoCmds) directory, then type `python newproj.py YourCmds`:

     ```shell
     git clone https://github.com/rhcad/DemoCmds.git
     cd DemoCmds
     python newproj.py MyCmds
     ```


text:
//
//  WDAcceptPayment.h
//  acceptSDK
//
//  Created by Danko, Radoslav on 23/10/15.
//  Copyright © 2015 Wirecard. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "WDAcceptPayment.h"

/**
 *  @class WDAcceptPaymentDetail
 *  @brief Complete information about performed Payment
 **/
@interface WDAcceptPaymentDetail : WDAcceptObject<NSCoding>
/**
 */
@property (nonatomic) AcceptPaymentMethod paymentMethod;
/**
 */
@property (nonatomic) AcceptTransactionType transactionType;
/**
 */
@property (nonnull, nonatomic, retain) NSString *internalId;
/**
 */
@property (nonatomic) AcceptPaymentState status;
/**
 */
@property (nonnull, nonatomic, retain) NSDecimalNumber *amount;
/**
 */
@property (nullable, nonatomic, retain) NSDate *processedByGateway;
/**
 */
@property (nullable, nonatomic, retain) NSDate *lastUpdated;
/**
 */
@property (nullable, nonatomic, retain) NSString *gatewayReference;
/**
 */
@property (nonnull, nonatomic, retain) NSDate *initialized;
/**
 */
@property (nullable, nonatomic, retain) NSString *gateway;
/**
 */
@property (nullable, nonatomic, strong) NSString *technicalMessage;
/**
 */
@property (nullable, nonatomic, strong) NSArray * refundPayments;
/**
 */
@property (nullable, nonatomic, strong) NSArray * reversalPayments;
/**
 */
@property (nullable, nonatomic, strong) NSArray * autoResolvePayments;
/**
 */
-(NSString *_Nullable)statusDescription;
/**
 */
-(NSString *_Nullable)paymentMethodDescription;
/**
 */
-(BOOL)paymentStatusPositive;
/**
 */
-(BOOL)refundable;
/**
 */
-(BOOL)reversible;

@end


text:
module InfluxORM::Model
  def self.included(cls)
    cls.extend(ClassMethods)
  end

  module ClassMethods
    def table_name
      @table_name ||= name.gsub('::', '_').tableize
    end

    %w{
      count select where
      group_by fill order_by
      limit slimit offset soffset
    }.each do |mname|
      define_method mname do |*args|
        query.send(mname, *args)
      end
    end

    def insert(point_attrs)
      connection.insert(table_name, attrs_to_point(point_attrs))
    end

    # dependent class method: attrs_to_point
    def import(points_attrs)
      points = points_attrs.map do |point_attrs|
        r = attrs_to_point(point_attrs)
        r[:series] ||= table_name
        r
      end
      connection.import(points)
    end

    private

    def query
      InfluxORM::Query.new(self)
    end
  end
end


text:
<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{{ "/assets/css/main.css" | prepend: site.baseurl }}">


text:
package com.amazonaws.services.datasync.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role used to access an Amazon S3 bucket.
 *

 *

 * For detailed information about using such a role, see Creating a Location for Amazon S3 in the DataSync User
 * Guide.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class S3Config implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The ARN of the IAM role for accessing the S3 bucket.
     *

     */
    private String bucketAccessRoleArn;

    /**
     *

     * The ARN of the IAM role for accessing the S3 bucket.
     *

     *
     * @param bucketAccessRoleArn
     *        The ARN of the IAM role for accessing the S3 bucket.
     */

    public void setBucketAccessRoleArn(String bucketAccessRoleArn) {
        this.bucketAccessRoleArn = bucketAccessRoleArn;
    }

    /**
     *

     * The ARN of the IAM role for accessing the S3 bucket.
     *

     *
     * @return The ARN of the IAM role for accessing the S3 bucket.
     */

    public String getBucketAccessRoleArn() {
        return this.bucketAccessRoleArn;
    }

    /**
     *

     * The ARN of the IAM role for accessing the S3 bucket.
     *

     *
     * @param bucketAccessRoleArn
     *        The ARN of the IAM role for accessing the S3 bucket.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public S3Config withBucketAccessRoleArn(String bucketAccessRoleArn) {
        setBucketAccessRoleArn(bucketAccessRoleArn);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getBucketAccessRoleArn() != null)
            sb.append("BucketAccessRoleArn: ").append(getBucketAccessRoleArn());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof S3Config == false)
            return false;
        S3Config other = (S3Config) obj;
        if (other.getBucketAccessRoleArn() == null ^ this.getBucketAccessRoleArn() == null)
            return false;
        if (other.getBucketAccessRoleArn() != null && other.getBucketAccessRoleArn().equals(this.getBucketAccessRoleArn()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getBucketAccessRoleArn() == null) ? 0 : getBucketAccessRoleArn().hashCode());
        return hashCode;
    }

    @Override
    public S3Config clone() {
        try {
            return (S3Config) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.datasync.model.transform.S3ConfigMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
package com.legendshop.util.constant;

public enum TagTypeEnum implements StringEnum {
	INDEX;

	private final String _$2="INDEX";

	public String value() {
		return this._$2;
	}

	public static boolean instance(String paramString) {
		TagTypeEnum[] arrayOfTagTypeEnum1 = values();
		TagTypeEnum[] arrayOfTagTypeEnum2 = arrayOfTagTypeEnum1;
		int i = arrayOfTagTypeEnum2.length;
		for (int j = 0; j < i; ++j) {
			TagTypeEnum localTagTypeEnum = arrayOfTagTypeEnum2[j];
			if (localTagTypeEnum.name().equals(paramString))
				return true;
		}
		return false;
	}

	public static String getValue(String paramString) {
		TagTypeEnum[] arrayOfTagTypeEnum1 = values();
		TagTypeEnum[] arrayOfTagTypeEnum2 = arrayOfTagTypeEnum1;
		int i = arrayOfTagTypeEnum2.length;
		for (int j = 0; j < i; ++j) {
			TagTypeEnum localTagTypeEnum = arrayOfTagTypeEnum2[j];
			if (localTagTypeEnum.name().equals(paramString))
				return localTagTypeEnum.value();
		}
		return null;
	}
}


text:
package project2;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

import project2.SortedList.SortedIterator;

/**
 * @author Eddie Gurnee
 * @version 0.0.06 01/06/2014
 * @since 12/02/2013
 */
public class DataStructure {
	private final int DATA_SIZE = 100;
	private int studentPointer = 0;
	private DynamicStack deletedStack;

	public DataStructureRecord[] allTheData = new DataStructureRecord[this.DATA_SIZE];

	// firstname, lastname, id
	private SortedList[] theSortedKeys = new SortedList[3];

	public DataStructure() {
		for (int i = 0; i < this.theSortedKeys.length; i++) {
			this.theSortedKeys[i] = new SortedList();
		}
		this.deletedStack = new DynamicStack();
	}

	public boolean search(String tempID) {
		return this.theSortedKeys[2].find(tempID) != this.theSortedKeys[2]
				.size();
	}

	/**
	 * Given the name of a text file, attempts to insert the data of each
	 * student listed into the database.
	 *
	 * @param theFile
	 *            a String representation of a file to load student names from
	 */
	public void insertFromFile(String theFileString) {
		File theFile = new File(theFileString);

		if (theFile.exists()) {
			int fails = 0;
			Scanner dataInput = null;

			System.out.println("Loading file " + theFileString + ":");

			try {
				dataInput = new Scanner(new FileInputStream(theFile));
				while (dataInput.hasNext()) {
					if (this.studentPointer == this.DATA_SIZE) {
						System.out.println("This file has too much "
								+ "data for this database,");
						System.out.println("not all data was "
								+ "inserted properly.");
						break;
					}

					String tempfName = dataInput.next();
					String templName = dataInput.next();
					String tempid = dataInput.next();

					try {
						this.insert(tempfName, templName, tempid);
					} catch (IDAlreadyExistsException e) {
						System.out.println(e.getMessage());
						fails++;
					}
				}
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} finally {
				dataInput.close();
			}
			System.out.print(theFile + " loaded ");
			if (fails == 0) {
				System.out.println("successfully.");
			} else if (fails == 1) {
				System.out.println("with 1 failure.");
			} else {
				System.out.println("with " + fails + " failures.");
			}
			System.out.println();
		} else {
			System.out.println("The file " + theFileString
					+ " does not exist.\n");
		}
	}

	public void insert(String... data) throws IDAlreadyExistsException {
		if (this.search(data[2])) {
			throw new IDAlreadyExistsException(data[2]);
		}
		if (!data[0].equals("Tom") && data[1].equals("Riddle")) {
			this.allTheData[this.studentPointer] = new DataStructureRecord(
					data[0], data[1], data[2]);

			for (int i = 0; i < this.theSortedKeys.length; i++) {
				this.theSortedKeys[i].insert(new IndexRecord(data[i],
						this.studentPointer));
			}

			this.studentPointer++;
		} else {
			System.out.println("The Dark Lord has no"
					+ " place in my data structure.");
		}
	}

	public void view(String id) {
		System.out.println(this.allTheData[this.theSortedKeys[2].getRecord(id)
				.getRecordNumber()]);
	}

	public boolean delete(String id) {
		int deleteTarget = this.theSortedKeys[2].getRecord(id)
				.getRecordNumber();
		boolean error = false;

		for (int i = 0; i < this.theSortedKeys.length; i++) {
			if (!this.theSortedKeys[i].delete(this.allTheData[deleteTarget]
					.getData(i))) {
				error = true;
			}
		}

		return error;
	}

	public void listIt(int type, boolean direction) {
		SortedIterator i = this.theSortedKeys[type].iterator();
		if (direction) {
			i.restart();
			while (i.hasNext()) {
				System.out.println(this.allTheData[i.next().getRecordNumber()]);
			}
		} else {
			i.startAtEnd();
			while (i.hasPrev()) {
				System.out.println(this.allTheData[i.prev().getRecordNumber()]);
			}
		}
	}
}


text:
class Service::OpsGenie < Service::Base
  title "OpsGenie"

  password :api_key, :label => 'Add a new Crashlytics integration at https://www.opsgenie.com/integration?add=Crashlytics and paste the integration\'s API key here.',
    :placeholder => 'OpsGenie API key'

  def receive_issue_impact_change(payload)
    body = {
      :payload        => payload,
      :event          => 'issue_impact_change'
    }
    resp = post_to_opsgenie(config, body)
    if resp.success?
      log 'issue_impact_change successful'
    else
      display_error "OpsGenie issue creation failed - #{error_response_details(resp)}"
    end
  end

  def receive_verification
    body = {
      :event        => 'verification'
    }
    resp =  post_to_opsgenie(config, body)
    if resp.success?
      log('verification successful')
    else
      log "Receive verification failed, API key: #{config[:api_key]}, OpsGenie response: #{resp[:status]}"
      display_error 'Couldn\'t verify OpsGenie settings; please check your API key.'
    end
  end

  def post_to_opsgenie(config, body)
    http_post(url) do |req|
      req.body = body.to_json
      req.params['apiKey'] = config[:api_key]
    end
  end

  def url
    'https://api.opsgenie.com/v1/json/crashlytics'
  end
end


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { LineItemComponent } from './line-item.component';

describe('LineItemComponent', () => {
  let component: LineItemComponent;
  let fixture: ComponentFixture<LineItemComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ LineItemComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(LineItemComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main"><source path="C:\Users\PopTart\StudioProjects\JumpGo-Old1\app\src\androidTest\shaders"/></dataSet></merger>


text:
{% extends "base.html" %}

{% block search %} {% endblock %}


text:
Vivid is designed to be as straightforward to use as possible whilst still providing enough features to be useful.  It was originally concieved for displaying graphics and text on [Monochrome 1.3" 128x64 OLED graphic display from Adafruit](https://www.adafruit.com/products/938), which it does.

![4 x OLED display clock using Hershey vector fonts](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/vivid_clock.jpg)

The scope quickly expanded to include arbitrary transforms, basic colour compositing and alpha channels.  I even added [`vivid_png`](https://github.com/jamesotron/vivid_png.ex) for writing out PNG files.

## Adding `vivid` to your app

Edit your `mix.exs` and add [the current version of `vivid`](https://hex.pm/packages/vivid) to your `dependencies` list.

If you want to be able to render PNG files then you also want to add
[`vivid_png`](https://hex.pm/packages/vivid_png).

## General principals

Vivid tries to consistently reuse a bunch of principals thoughout the code base;

  * All "shape" types, e.g. boxes, circles and polygons have an `init` function which will generate the shape with as many sane defaults as possible.  The corresponding modules also contain functions for manipulating the contents of the shape without needing to know the internal structure of the type.  Vivid discourages the use of type structs directly as these are subject to change.

  * Most of the stuff you want to *do* with shapes, like render, transform or measure are implemented with Elixir protocols, meaning you can define your own shape types as required.

  * The `String.Chars` protocol has been implemented everywhere it makes sense, so that you can easily debug by just calling `to_string/1` or `IO.puts/1` on almost any type.

  * If you `use Vivid` at the top of your module it will automatically add aliases for all the core Vivid types into your local namespace. This can save a lot of typing, but otherwise doesn't do much.

## Basic shapes

Vivid implements a number of basic geometric primitives upon which you can compose your own shapes as needed.

### Point

The most basic type is the [`Point`](https://hexdocs.pm/vivid/Vivid.Point.html#content), which represents a location in 2 dimensional cartesian space (ie `x` and `y` offset).

    iex> use Vivid
    ...> Point.init(13, 27)
    #Vivid.Point<{13, 27}>
![point example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/point_example.png)

### Line

A [Line](https://hexdocs.pm/vivid/Vivid.Line.html#content) represents a straight line between to points, called `origin` and `termination` in Vivid parlance.

`Line` implements the `Enumerable` protocol.

    iex> use Vivid
    ...> Line.init(Point.init(13,27), Point.init(2,3))
    #Vivid.Line<[origin: #Vivid.Point<{13, 27}>, termination: #Vivid.Point<{2, 3}>]>
![line example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/line_example.png)

### Path

A [Path](https://hexdocs.pm/vivid/Vivid.Path.html#content) represents an aribitrary number of vertices (points) with lines connecting them.  A Path is different to a Polygon in that a Polygon is closed and a Path is open.

A Path must consist of at least two vertices.

`Path` implements the `Enumerable` and `Collectable` protocols so that you can use `Enum` and `Stream` to manipulate it.

    iex> use Vivid
    ...> Path.init([Point.init(13,27), Point.init(2,3), Point.init(27,13)])
    #Vivid.Path<[#Vivid.Point<{13, 27}>, #Vivid.Point<{2, 3}>, #Vivid.Point<{27, 13}>]>

![path example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/path_example.png)

### Polygon

A [Polygon](https://hexdocs.pm/vivid/Vivid.Polygon.html#content) also represents an arbitrary number of vertices (points) with lines connecting them, however a Polygon is a closed shape.  As such, polygon's must have at least three vertices.

`Polygon` implements the `Enumerable` and `Collectable` protocols so that you can use `Enum` and `Stream` to manipulate it.

    iex> use Vivid
    ...> Polygon.init([Point.init(13,27), Point.init(2,3), Point.init(27,13)])
    #Vivid.Polygon<[#Vivid.Point<{13, 27}>, #Vivid.Point<{2, 3}>, #Vivid.Point<{27, 13}>]>

![polygon example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/polygon_example.png)

### Box

A [Box](https://hexdocs.pm/vivid/Vivid.Box.html#content) is a special kind of Polygon where there are exactly four vertices and two lines are horizontal and two lines are vertical, i.e. a rectangle. But you knew that.

Because of the regular nature of rectangles they can be defined with only two points.  The first being the lower left corner and the second being the top right corner.

    iex> use Vivid
    ...> Box.init(Point.init(2,3), Point.init(13,27))
    #Vivid.Box<[bottom_left: #Vivid.Point<{2, 3}>, top_right: #Vivid.Point<{13, 27}>]>

![box example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/box_example.png)

### Circle

I'm sure you know what a [Circle](https://hexdocs.pm/vivid/Vivid.Circle.html#content) is.  It is initialised using a center point and a radius.

Circles are converted to polygons when transforming or rendering, so you can't always rely on being able to use the `Circle` API to manipulate existing shapes.

Often it may be necessary to convert it to a polygon manually before rendering so that you can control the number of vertices in the generated polygon.

    iex> use Vivid
    ...> Circle.init(Point.init(15,15), 10)
    #Vivid.Circle<[center: #Vivid.Point<{15, 15}>, radius: 10]>

![circle example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/circle_example.png)

### Arc

An [Arc](https://hexdocs.pm/vivid/Vivid.Arc.html#content), also known as a circle segment is a slice of a circle and initialised with a center point and radius much like a circle, however you also provide a start angle and a range (both in degrees) of arc that you wish to render.

Arcs are converted to paths when transforming or rendering, so you can't always rely on being able to use the `Arc` API to manipulate existing shapes.

You can optionally also specify the number of steps used during path generation in the initialiser.

    iex> use Vivid
    ...> Arc.init(Point.init(15,15), 45, 90)
    #Vivid.Arc<[center: #Vivid.Point<{15, 15}>, radius: 10, start_angle: 45, range: 90, steps: 12]>

![arc example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/arc_example.png)

### Group

A [Group](https://hexdocs.pm/vivid/Vivid.Group.html#content) allows for arbitrary composition of shapes into a single data structure.  It's not so much a shape itself, as a collection of other shapes.

`Group` also implements the `Enumerable` and `Collectable` protocols so that you can use `Enum` and `Stream` to create them.

    iex> use Vivid
    ...> box = Box.init(Point.init(2,3), Point.init(13,27))
    ...> circle = Circle.init(Point.init(15,15), 10)
    ...> Group.init([box, circle])
    #Vivid.Group<[#Vivid.Box<[bottom_left: #Vivid.Point<{2, 3}>, top_right: #Vivid.Point<{13, 27}>]>, #Vivid.Circle<[center: #Vivid.Point<{15, 15}>, radius: 10]>]>

![group example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/group_example.png)

## Colours

Vivid (currently) defines all colours in terms of the RGBA colourspace.  Create a new colour by passing red, green, blue and opacity values as integers or floats between `0` and `1`.

    iex> use Vivid
    ...> RGBA.init(0.75, 0.25, 0.5, 0.8)
    #Vivid.RGBA<{0.75, 0.25, 0.5, 0.8}>

![rgba example](https://raw.githubusercontent.com/jamesotron/vivid.ex/master/guides/images/rgba_example.png)

## Compositing

When you place two shapes on a buffer which overlap and where transparency is involved Vivid will use the "over" colour compositing algorithm.  See [Wikipedia's article on alpha compositing](https://en.wikipedia.org/wiki/Alpha_compositing) for more information.

### Frame

A [Frame](https://hexdocs.pm/vivid/Vivid.Frame.html#content) stores a stack of shapes and corresponding colours and is the only type that can truly be rendered into a buffer.

Shapes and colours are pushed onto the frame in pairs, and composited during the render pass.  `Frame` also implements the `Enumerable` and `Collectable` procotols meaning that you can use the `Enum` and `Stream` module to build frames.

Frames can be converted to buffers, which are the fully-rendered bitmap output, which is what you'll likely want to use for display.

    iex> use Vivid
    ...> Frame.init(30, 30, RGBA.init(1,0,0,1))
    #Vivid.Frame<[width: 30, height: 30, background_colour: #Vivid.RGBA<{1, 0, 0, 1}>]>

### Buffer

A [Buffer](https://hexdocs.pm/vivid/Vivid.Buffer.html#content) is used to render the contents of a `Frame` into a bitmap which can be displayed. `Buffer` implements the `Enumerable` protocol and emits a list of `RGBA` colours.

    iex> use Vivid
    ...> Frame.init(30, 30, RGBA.init(1,0,0,1))
    ...> |> Buffer.horizontal()
    #Vivid.Buffer<[rows: 30, columns: 30, size: 900]>


text:
/*
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license. See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.muc;

import net.java.sip.communicator.service.contactsource.*;

/**
 * Contact source service for chat rooms.
 *
 * @author Hristo Terezov
 */
public class ChatRoomContactSourceService
    implements ContactSourceService
{
    /**
     * Returns the type of this contact source.
     *
     * @return the type of this contact source
     */
    public int getType()
    {
        return CONTACT_LIST_TYPE;
    }

    /**
     * Returns a user-friendly string that identifies this contact source.
     *
     * @return the display name of this contact source
     */
    public String getDisplayName()
    {
        return MUCActivator.getResources().getI18NString(
            "service.gui.CHAT_ROOMS");
    }

    /**
     * Creates query for the given <tt>queryString</tt>.
     *
     * @param queryString the string to search for
     * @return the created query
     */
    @Override
    public ContactQuery createContactQuery(String queryString)
    {
        return createContactQuery(queryString, -1);
    }

    /**
     * Creates query for the given <tt>queryString</tt>.
     *
     * @param queryString the string to search for
     * @param contactCount the maximum count of result contacts
     * @return the created query
     */
    @Override
    public ContactQuery createContactQuery(String queryString, int contactCount)
    {
        if (queryString == null)
            queryString = "";

        ChatRoomQuery contactQuery
            = new ChatRoomQuery(queryString, this);

        return contactQuery;
    }

    /**
     * Returns the index of the contact source in the result list.
     *
     * @return the index of the contact source in the result list
     */
    @Override
    public int getIndex()
    {
        return 1;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="EggsToGo.Sample.Android">
	<uses-sdk android:minSdkVersion="14" />
	<application android:label="EggsToGo.Sample.Android"></application>
</manifest>


text:
angular.module('tracy-ui', ['ui.bootstrap','ui.router', 'ngStorage', 'ngResource', 'highcharts-ng', 'googlechart'])

	.config(function($stateProvider, $urlRouterProvider)
	{
        $urlRouterProvider.otherwise('/landing');
		$stateProvider
			.state('landing', {
				name: 'landing',
				url: '/landing',
				templateUrl: 'tracy-core/landing/landing.html'
			})

			.state('config', {
				name: 'config',
				url: '/config',
				templateUrl: 'tracy-core/config/config.html'
			})

			.state('task', {
				name: 'task',
				url: '/task?env&application&task&view',
				templateUrl: 'tracy-core/task/task.html'
			})

			.state('application', {
				name: 'application',
				url: '/application?env&application&view',
				templateUrl: 'tracy-core/application/application.html'
			})

            .state('timeline',{
                name: 'timeline',
                url:'/timeline/:sequenceId?env&application&task&earliest&latest&rtBelow&rtAbove',
                templateUrl:'tracy-core/tracy-modules/task-timeline/task-timeline.html'
            })
	});


text:
<?php

/**
 * @file
 * Coder format shell invocation script.
 *
 * @param $filepath
 *   One or more files or directories containing the source code to process. If
 *   a directory is given, all files in that directory are processed recursively.
 *   Each file will be replaced with the formatted source code. Each original
 *   file is automatically backup to <filename>.coder.orig.
 * @param --undo
 *   (optional) Restores already processed files from backups generated by Coder
 *   format. Automatically searches for the latest backup file
 *   ([filename].coder.orig) and each file is replaced with its original version.
 *
 * @usage
 *   php coder_format.php <file> [file] ...
 *   php coder_format.php <path> [path] ...
 *   php coder_format.php --undo <file> ...
 *   php coder_format.php --undo <path> ...
 *
 * @example
 *   php coder_format.php modules/node/node.module
 *   php coder_format.php index.php modules/node/node.module
 *   php coder_format.php /home/drupal
 *   php coder_format.php /home/drupal/includes /home/drupal/modules
 *   php coder_format.php --undo modules/node/node.module
 *   php coder_format.php --undo /home/drupal
 *
 * Windows users: Ensure to encapsulate filename arguments with double quotes.
 */

// We are on the command line, so output only real errors.
error_reporting(E_ERROR | E_WARNING | E_PARSE);

require_once realpath(dirname($_SERVER['PHP_SELF'])) . '/coder_format.inc';

if (!empty($_SERVER['argv'])) {
  // Remove self-reference.
  array_shift($_SERVER['argv']);

  // Process command-line arguments.
  $files    = array();
  $undo     = FALSE;

  for ($c = 0, $cc = count($_SERVER['argv']); $c < $cc; ++$c) {
    switch ($_SERVER['argv'][$c]) {
      case '--undo':
        $undo = TRUE;
        break;

      default:
        $files[] = $_SERVER['argv'][$c];
        break;
    }
  }

  foreach ($files as $file) {
    // If argument is a directory, process it recursively.
    if (is_dir($file)) {
      coder_format_recursive($file, $undo);
    }
    else {
      coder_format_file($file, $undo);
    }
  }
}

/**
 * @defgroup coder_format_file_functions
 * @{
 * These functions are copied from Drupal's file.inc. Almost all function calls
 * to other Drupal functions have been removed since they would always return
 * FALSE.
 */

define('FILE_CREATE_DIRECTORY', 1);
define('FILE_EXISTS_RENAME', 0);
define('FILE_EXISTS_REPLACE', 1);
define('FILE_EXISTS_ERROR', 2);

/**
 * Check that the directory exists and is writable. Directories need to
 * have execute permissions to be considered a directory by FTP servers, etc.
 *
 * @param $directory A string containing the name of a directory path.
 * @param $mode A Boolean value to indicate if the directory should be created
 *   if it does not exist or made writable if it is read-only.
 * @param $form_item An optional string containing the name of a form item that
 *   any errors will be attached to. This is useful for settings forms that
 *   require the user to specify a writable directory. If it can't be made to
 *   work, a form error will be set preventing them from saving the settings.
 * @return FALSE when directory not found, or TRUE when directory exists.
 */
function file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
  $directory = rtrim($directory, '/\\');

  // Check if directory exists.
  if (!is_dir($directory)) {
    // coder_format does not alter the filesystem. 23/01/2008 sun
    if (!file_exists($directory)) {
      drupal_set_message(t('The directory %directory does not exist.', array('%directory' => $directory)));
      return FALSE;
    }
  }

  // Check to see if the directory is writable.
  if (!is_writable($directory)) {
    // coder_format does not alter the filesystem. 23/01/2008 sun
    drupal_set_message(t('The directory %directory is not writable', array('%directory' => $directory)));
    return FALSE;
  }

  // coder_format is applied outside of Drupal in most cases. 23/01/2008 sun

  return TRUE;
}

/**
 * Checks path to see if it is a directory, or a dir/file.
 *
 * @param $path A string containing a file path. This will be set to the
 *   directory's path.
 * @return If the directory is not in a Drupal writable directory, FALSE is
 *   returned. Otherwise, the base name of the path is returned.
 */
function file_check_path(&$path) {
  // Check if path is a directory.
  // coder_format uses file_check_path() to check for files only. 26/01/2008 sun

  // Check if path is a possible dir/file.
  $filename = basename($path);
  $path = dirname($path);
  if (file_check_directory($path)) {
    return $filename;
  }

  return FALSE;
}

/**
 * Copies a file to a new location. This is a powerful function that in many ways
 * performs like an advanced version of copy().
 * - Checks if $source and $dest are valid and readable/writable.
 * - Performs a file copy if $source is not equal to $dest.
 * - If file already exists in $dest either the call will error out, replace the
 *   file or rename the file based on the $replace parameter.
 *
 * @param $source A string specifying the file location of the original file.
 *   This parameter will contain the resulting destination filename in case of
 *   success.
 * @param $dest A string containing the directory $source should be copied to.
 *   If this value is omitted, Drupal's 'files' directory will be used.
 * @param $replace Replace behavior when the destination file already exists.
 *   - FILE_EXISTS_REPLACE - Replace the existing file
 *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is unique
 *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
 * @return True for success, FALSE for failure.
 */
function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
  // $dest is almost always outside of Drupal. 23/01/2008 sun
  // $dest = file_create_path($dest);

  $directory = $dest;
  $basename = file_check_path($directory);

  // Make sure we at least have a valid directory.
  if ($basename === FALSE) {
    $source = is_object($source) ? $source->filepath : $source;
    drupal_set_message(t('The selected file %file could not be uploaded, because the destination %directory is not properly configured.', array('%file' => $source, '%directory' => $dest)), 'error');
    return 0;
  }

  // Removed upload handling. coder_format does not deal with uploads. 23/01/2008 sun

  $source = realpath($source);
  if (!file_exists($source)) {
    drupal_set_message(t('The selected file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.', array('%file' => $source)), 'error');
    return 0;
  }

  // If the destination file is not specified then use the filename of the source file.
  $basename = $basename ? $basename : basename($source);
  $dest = $directory . '/' . $basename;

  // Make sure source and destination filenames are not the same, makes no sense
  // to copy it if they are. In fact copying the file will most likely result in
  // a 0 byte file. Which is bad. Real bad.
  if ($source != realpath($dest)) {
    if (!$dest = file_destination($dest, $replace)) {
      drupal_set_message(t('The selected file %file could not be copied, because a file by that name already exists in the destination.', array('%file' => $source)), 'error');
      return FALSE;
    }

    if (!@copy($source, $dest)) {
      drupal_set_message(t('The selected file %file could not be copied.', array('%file' => $source)), 'error');
      return 0;
    }

    // Give everyone read access so that FTP'd users or
    // non-webserver users can see/read these files,
    // and give group write permissions so group members
    // can alter files uploaded by the webserver.
    @chmod($dest, 0664);
  }

  // Removed upload handling. coder_format does not deal with uploads. 23/01/2008 sun
  $source = $dest;

  return 1; // Everything went ok.
}

/**
 * Determines the destination path for a file depending on how replacement of
 * existing files should be handled.
 *
 * @param $destination A string specifying the desired path.
 * @param $replace Replace behavior when the destination file already exists.
 *   - FILE_EXISTS_REPLACE - Replace the existing file
 *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is
 *     unique
 *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
 * @return The destination file path or FALSE if the file already exists and
 *   FILE_EXISTS_ERROR was specified.
 */
function file_destination($destination, $replace) {
  if (file_exists($destination)) {
    switch ($replace) {
      case FILE_EXISTS_RENAME:
        $basename = basename($destination);
        $directory = dirname($destination);
        $destination = file_create_filename($basename, $directory);
        break;

      case FILE_EXISTS_ERROR:
        drupal_set_message(t('The selected file %file could not be copied, because a file by that name already exists in the destination.', array('%file' => $destination)), 'error');
        return FALSE;
    }
  }
  return $destination;
}

/**
 * Moves a file to a new location.
 * - Checks if $source and $dest are valid and readable/writable.
 * - Performs a file move if $source is not equal to $dest.
 * - If file already exists in $dest either the call will error out, replace the
 *   file or rename the file based on the $replace parameter.
 *
 * @param $source A string specifying the file location of the original file.
 *   This parameter will contain the resulting destination filename in case of
 *   success.
 * @param $dest A string containing the directory $source should be copied to.
 *   If this value is omitted, Drupal's 'files' directory will be used.
 * @param $replace Replace behavior when the destination file already exists.
 *   - FILE_EXISTS_REPLACE - Replace the existing file
 *   - FILE_EXISTS_RENAME - Append _{incrementing number} until the filename is unique
 *   - FILE_EXISTS_ERROR - Do nothing and return FALSE.
 * @return True for success, FALSE for failure.
 */
function file_move(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
  $path_original = is_object($source) ? $source->filepath : $source;

  if (file_copy($source, $dest, $replace)) {
    $path_current = is_object($source) ? $source->filepath : $source;

    if ($path_original == $path_current || file_delete($path_original)) {
      return 1;
    }
    drupal_set_message(t('The removal of the original file %file has failed.', array('%file' => $path_original)), 'error');
  }
  return 0;
}

/**
 * Create a full file path from a directory and filename. If a file with the
 * specified name already exists, an alternative will be used.
 *
 * @param $basename string filename
 * @param $directory string directory
 * @return
 */
function file_create_filename($basename, $directory) {
  $dest = $directory . '/' . $basename;

  if (file_exists($dest)) {
    // Destination file already exists, generate an alternative.
    // Always append '.coder.orig' (allows multiple undos). 23/01/2008 sun
    $name = $basename;

    $counter = 0;
    do {
      $dest = $directory . '/' . $name . str_repeat('.coder.orig', $counter++);
    } while (file_exists($dest));
  }

  return $dest;
}

/**
 * Delete a file.
 *
 * @param $path A string containing a file path.
 * @return TRUE for success, FALSE for failure.
 */
function file_delete($path) {
  if (is_file($path)) {
    return unlink($path);
  }
}

/**
 * Finds all files that match a given mask in a given directory.
 * Directories and files beginning with a period are excluded; this
 * prevents hidden files and directories (such as SVN working directories)
 * from being scanned.
 *
 * @param $dir
 *   The base directory for the scan, without trailing slash.
 * @param $mask
 *   The regular expression of the files to find.
 * @param $nomask
 *   An array of files/directories to ignore.
 * @param $callback
 *   The callback function to call for each match.
 * @param $recurse
 *   When TRUE, the directory scan will recurse the entire tree
 *   starting at the provided directory.
 * @param $key
 *   The key to be used for the returned array of files. Possible
 *   values are "filename", for the path starting with $dir,
 *   "basename", for the basename of the file, and "name" for the name
 *   of the file without an extension.
 * @param $min_depth
 *   Minimum depth of directories to return files from.
 * @param $depth
 *   Current depth of recursion. This parameter is only used internally and should not be passed.
 *
 * @return
 *   An associative array (keyed on the provided key) of objects with
 *   "path", "basename", and "name" members corresponding to the
 *   matching files.
 */
function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS', '.svn', '.git'), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0) {
  $key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename');
  $files = array();

  if (is_dir($dir) && $handle = opendir($dir)) {
    while ($file = readdir($handle)) {
      if (!in_array($file, $nomask) && $file[0] != '.') {
        if (is_dir("$dir/$file") && $recurse) {
          // Give priority to files in this folder by merging them in after any subdirectory files.
          $files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files);
        }
        elseif ($depth >= $min_depth && ereg($mask, $file)) {
          // Always use this match over anything already set in $files with the same $$key.
          $filename = "$dir/$file";
          $basename = basename($file);
          $name = substr($basename, 0, strrpos($basename, '.'));
          $files[$$key] = new stdClass();
          $files[$$key]->filename = $filename;
          $files[$$key]->basename = $basename;
          $files[$$key]->name = $name;
          if ($callback) {
            $callback($filename);
          }
        }
      }
    }

    closedir($handle);
  }

  return $files;
}

/**
 * @} End of "defgroup coder_format_file_functions".
 */

/**
 * @defgroup coder_format_stub_functions
 * @{
 */
function t($string, $args = 0) {
  if (!$args) {
    return $string;
  }
  else {
    return strtr($string, $args);
  }
}

function drupal_set_message($message = NULL, $type = 'status') {
  if ($type == 'error') {
    echo str_repeat('-', 80);
    echo "\nERROR: $message\n";
    echo str_repeat('-', 80);
    echo "\n";
  }
  else {
    echo "$message\n";
  }
}

/**
 * @} End of "defgroup coder_format_stub_functions".
 */


text:
var make = function make(localRuntime) {
    localRuntime.Native = localRuntime.Native || {};
    localRuntime.Native.Renderer = localRuntime.Native.Renderer || {};

    var toHtml = require('vdom-to-html');

    return {
        'toHtml': toHtml
    };
};

Elm.Native = Elm.Native || {};
Elm.Native.Renderer = Elm.Native.Renderer || {};
Elm.Native.Renderer.make = make;


text:
package spinoco.protocol.mgcp

/**
  * Created by pach on 09/03/17.
  */
case class RequestedEvent(event: EventSpecification, action: List[RequestedEventAction])

object RequestedEventAction {

  case object NotifyImmediately extends RequestedEventAction
  case object Accumulate extends RequestedEventAction
  case object TreatByDigitMap extends RequestedEventAction
  case object Swap extends RequestedEventAction
  case object Ignore extends RequestedEventAction
  case object KeepActive extends RequestedEventAction
  case class EmbeddedRequest(
    requests: List[RequestedEvent]
    , signalled: List[ParametrizedEvent]
    , digitMap: Option[String]
  ) extends RequestedEventAction

}

sealed trait RequestedEventAction


text:
package lists

type Model struct {
	ID          string
	Name        string
	Description string
	IsAdmin     bool
	Nb          int
}

func NewModel(nb int) Model {
	return Model{
		ID:          "blabla",
		Name:        "blibliblibli",
		Description: "blublublublublublublublublublublublu",
		IsAdmin:     false,
		Nb:          nb,
	}
}

func NewModelPtr(nb int) *Model {
	result := NewModel(nb)
	return &result
}

//
// ModelValues
//

type ModelValues []Model

func (l ModelValues) append(m Model) ModelValues {
	return append(l, m)
}

func (l *ModelValues) appendInPlace(m Model) {
	*l = append(*l, m)
}

//
// ModelPtrs
//

type ModelPtrs []*Model

func (l ModelPtrs) append(m *Model) ModelPtrs {
	return append(l, m)
}

func (l *ModelPtrs) appendInPlace(m *Model) {
	*l = append(*l, m)
}


text:
package org.sakaiproject.entitybroker.impl;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import lombok.extern.slf4j.Slf4j;

import org.sakaiproject.entitybroker.EntityBroker;
import org.sakaiproject.entitybroker.EntityReference;
import org.sakaiproject.entitybroker.EntityView;
import org.sakaiproject.entitybroker.entityprovider.EntityProviderManager;
import org.sakaiproject.entitybroker.entityprovider.capabilities.ActionsExecutable;
import org.sakaiproject.entitybroker.entityprovider.extension.ActionReturn;
import org.sakaiproject.entitybroker.entityprovider.extension.BrowseEntity;
import org.sakaiproject.entitybroker.entityprovider.extension.EntityData;
import org.sakaiproject.entitybroker.entityprovider.extension.PropertiesProvider;
import org.sakaiproject.entitybroker.entityprovider.extension.QuerySearch;
import org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite;
import org.sakaiproject.entitybroker.entityprovider.extension.SearchContent;
import org.sakaiproject.entitybroker.entityprovider.extension.SearchProvider;
import org.sakaiproject.entitybroker.entityprovider.extension.SearchResults;
import org.sakaiproject.entitybroker.entityprovider.extension.TagSearchService;
import org.sakaiproject.entitybroker.entityprovider.search.Search;
import org.sakaiproject.entitybroker.providers.ExternalIntegrationProvider;
import org.sakaiproject.entitybroker.util.EntityResponse;

/**
 * The default implementation of the EntityBroker interface
 *
 * @author Aaron Zeckoski (aaron@caret.cam.ac.uk)
 * @author Antranig Basman (antranig@caret.cam.ac.uk)
 */
@Slf4j
public class EntityBrokerImpl implements EntityBroker, PropertiesProvider {

    public void init() {
        // setup the external providers
        if (externalIntegrationProvider != null) {
            SearchProvider searchProvider = externalIntegrationProvider.findService(SearchProvider.class);
            if (searchProvider != null) {
                this.searchProvider = searchProvider;
            }
        }
    }

    /**
     * Empty constructor
     */
    protected EntityBrokerImpl() { }

    /**
     * Minimal constructor
     */
    public EntityBrokerImpl(EntityProviderManager entityProviderManager,
            EntityBrokerManagerImpl entityBrokerManager,
            RequestStorageWrite requestStorageWrite) {
        super();
        this.entityProviderManager = entityProviderManager;
        this.entityBrokerManager = entityBrokerManager;
        this.requestStorage = requestStorageWrite;
    }

    /**
     * Full constructor with optional pieces
     */
    public EntityBrokerImpl(EntityProviderManager entityProviderManager,
            EntityBrokerManagerImpl entityBrokerManager,
            RequestStorageWrite requestStorageWrite,
            PropertiesProvider propertiesProvider,
            TagSearchService tagSearchService) {
        super();
        this.entityProviderManager = entityProviderManager;
        this.entityBrokerManager = entityBrokerManager;
        this.requestStorage = requestStorageWrite;
        this.propertiesProvider = propertiesProvider;
        this.tagSearchService = tagSearchService;
    }

    private EntityProviderManager entityProviderManager;
    public void setEntityProviderManager(EntityProviderManager entityProviderManager) {
        this.entityProviderManager = entityProviderManager;
    }

    private EntityBrokerManagerImpl entityBrokerManager;
    public void setEntityBrokerManager(EntityBrokerManagerImpl entityBrokerManager) {
        this.entityBrokerManager = entityBrokerManager;
    }

    private RequestStorageWrite requestStorage;
    public void setRequestStorage(RequestStorageWrite requestStorage) {
        this.requestStorage = requestStorage;
    }

    private ExternalIntegrationProvider externalIntegrationProvider;
    public void setExternalIntegrationProvider(
            ExternalIntegrationProvider externalIntegrationProvider) {
        this.externalIntegrationProvider = externalIntegrationProvider;
    }

    // OPTIONAL Data Storage providers
    private PropertiesProvider propertiesProvider;
    public void setPropertiesProvider(PropertiesProvider propertiesProvider) {
        this.propertiesProvider = propertiesProvider;
    }

    private TagSearchService tagSearchService;
    public void setTagSearchService(TagSearchService tagSearchService) {
        this.tagSearchService = tagSearchService;
    }

    private SearchProvider searchProvider;
    public void setSearchProvider(SearchProvider searchProvider) {
        this.searchProvider = searchProvider;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#entityExists(java.lang.String)
     */
    public boolean entityExists(String reference) {
        EntityReference ref = entityBrokerManager.parseReference(reference);
        boolean exists = entityBrokerManager.entityExists(ref);
        return exists;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#getEntityURL(java.lang.String)
     */
    public String getEntityURL(String reference) {
        String URL = entityBrokerManager.getEntityURL(reference, null, null);
        return URL;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#getEntityURL(java.lang.String, java.lang.String, java.lang.String)
     */
    public String getEntityURL(String reference, String viewKey, String extension) {
        String URL = entityBrokerManager.getEntityURL(reference, viewKey, extension);
        return URL;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#getEntityView(java.lang.String, java.lang.String, java.lang.String)
     */
    public EntityView getEntityView(String reference, String viewKey, String extension) {
        EntityReference ref = parseReference(reference);
        EntityView ev = entityBrokerManager.makeEntityView(ref, viewKey, extension);
        return ev;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#isPrefixRegistered(java.lang.String)
     */
    public boolean isPrefixRegistered(String prefix) {
        boolean registered = false;
        if (entityProviderManager.getProviderByPrefix(prefix) != null) {
            registered = true;
        }
        return registered;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#getRegisteredPrefixes()
     */
    public Set<String> getRegisteredPrefixes() {
        Set<String> prefixes = entityProviderManager.getRegisteredPrefixes();
        return prefixes;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#parseReference(java.lang.String)
     */
    public EntityReference parseReference(String reference) {
        EntityReference ref = entityBrokerManager.parseReference(reference);
        return ref;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#fireEvent(java.lang.String, java.lang.String)
     */
    public void fireEvent(String eventName, String reference) {
        if (eventName == null || "".equals(eventName)) {
            throw new IllegalArgumentException("Cannot fire event if name is null or empty");
        }
        if (reference == null || "".equals(reference)) {
            throw new IllegalArgumentException("Cannot fire event if reference is null or empty");
        }
        if (entityBrokerManager.getExternalIntegrationProvider() != null) {
            String refName = reference;
            try {
                // parse the reference string to validate it and remove any extra bits
                EntityReference ref = entityBrokerManager.parseReference(reference);
                if (ref != null) {
                    refName = ref.toString();
                } else {
                    // fallback to simple parsing
                    refName = new EntityReference(reference).toString();
                }
            } catch (Exception e) {
                refName = reference;
                log.warn("Invalid reference ({}) for eventName ({}), could not parse the reference correctly, continuing to create event with original reference", reference, eventName);
            }
            // had to take out the exists check because it makes firing events for removing entities very annoying -AZ
            entityBrokerManager.getExternalIntegrationProvider().fireEvent(eventName, refName);
        } else {
            log.warn("No external system to handle events: event not fired: {}:{}", eventName, reference);
        }
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#fireEntityRequest(java.lang.String, java.lang.String, java.lang.String, java.util.Map, java.lang.Object)
     */
    public EntityResponse fireEntityRequest(String reference, String viewKey, String format,
            Map<String, String> params, Object entity) {
        if (entityBrokerManager.getEntityRESTProvider() != null) {
            return entityBrokerManager.getEntityRESTProvider().handleEntityRequest(reference, viewKey, format, params, entity);
        } else {
            throw new UnsupportedOperationException("No provider to handle fireEntityRequest for ("+reference+","+viewKey+","+format+")");
        }
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#fetchEntity(java.lang.String)
     */
    public Object fetchEntity(String reference) {
        Object entity = null;
        EntityReference ref = entityBrokerManager.parseReference(reference);
        if (ref == null) {
            // not handled in EB so attempt to parse out a prefix and try to get entity from the external system
            if (entityBrokerManager.getExternalIntegrationProvider() != null) {
                entityBrokerManager.getExternalIntegrationProvider().fetchEntity(reference);
            }
        } else {
            // this is a registered prefix
            entity = entityBrokerManager.fetchEntity(ref);
        }
        return entity;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#getEntity(java.lang.String)
     */
    public EntityData getEntity(String reference) {
        EntityReference ref = entityBrokerManager.parseReference(reference);
        return entityBrokerManager.getEntityData(ref);
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#fetchEntities(java.lang.String, org.sakaiproject.entitybus.entityprovider.search.Search, java.util.Map)
     */
    public List<?> fetchEntities(String prefix, Search search, Map<String, Object> params) {
        EntityReference ref = new EntityReference(prefix, "");
        List<?> l = null;
        try {
            requestStorage.setRequestValues(params);
            if (params == null) { params = new HashMap<String, Object>(); }
            l = entityBrokerManager.fetchEntities(ref, search, params);
        } finally {
            requestStorage.reset();
        }
        return l;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#getEntities(java.lang.String, org.sakaiproject.entitybus.entityprovider.search.Search, java.util.Map)
     */
    public List<EntityData> getEntities(String prefix, Search search, Map<String, Object> params) {
        EntityReference ref = new EntityReference(prefix, "");
        List<EntityData> data = null;
        try {
            requestStorage.setRequestValues(params);
            if (params == null) { params = new HashMap<String, Object>(); }
            data = entityBrokerManager.getEntitiesData(ref, search, params);
        } finally {
            requestStorage.reset();
        }
        return data;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#browseEntities(java.lang.String, org.sakaiproject.entitybus.entityprovider.search.Search, java.lang.String, java.lang.String, java.util.Map)
     */
    public List<EntityData> browseEntities(String prefix, Search search,
            String userReference, String associatedReference, String parentReference, Map<String, Object> params) {
        EntityReference parentRef = null;
        if (parentReference != null) {
            parentRef = entityBrokerManager.parseReference(parentReference);
        }
        List<EntityData> data = null;
        try {
            requestStorage.setRequestValues(params);
            if (params == null) { params = new HashMap<String, Object>(); }
            data = entityBrokerManager.browseEntities(prefix, search, userReference, associatedReference, parentRef, params);
        } finally {
            requestStorage.reset();
        }
        return data;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybus.EntityBroker#getBrowseableEntities(java.lang.String)
     */
    public List<BrowseEntity> getBrowseableEntities(String parentPrefix) {
        List<BrowseEntity> l = entityBrokerManager.getBrowseableEntities(parentPrefix);
        return l;
    }

    /* (non-Javadoc)
     * @see org.sakaiproject.entitybroker.entityprovider.extension.LearningTrackingProvider#registerStatement(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Float)
     */
    public void registerStatement(String prefix, String actorEmail, String verbStr, String objectURI, Boolean resultSuccess, Float resultScaledScore) {
        externalIntegrationProvider.registerStatement(prefix, actorEmail, verbStr, objectURI, resultSuccess, resultScaledScore);
    }

    public void formatAndOutputEntity(String reference, String format, List<?> entities,
            OutputStream output, Map<String, Object> params) {
        EntityReference ref = entityBrokerManager.parseReference(reference);
        if (ref == null) {
            throw new IllegalArgumentException("Cannot output formatted entity, entity reference is invalid: " + reference);
        }
        if (entityBrokerManager.getEntityRESTProvider() != null) {
            try {
                requestStorage.setRequestValues(params);
                // convert entities to entity data list
                List<EntityData> data = entityBrokerManager.convertToEntityData(entities, ref);
                if (params == null) { params = new HashMap<String, Object>(); }
                entityBrokerManager.getEntityRESTProvider().formatAndOutputEntity(ref, format, data, output, params);
            } finally {
                requestStorage.reset();
            }
        } else {
            throw new UnsupportedOperationException("No provider to handle formatAndOutputEntity for ("+reference+","+format+")");
        }
    }

    public Object translateInputToEntity(String reference, String format, InputStream input,
            Map<String, Object> params) {
        EntityReference ref = entityBrokerManager.parseReference(reference);
        if (ref == null) {
            throw new IllegalArgumentException("Cannot output formatted entity, entity reference is invalid: " + reference);
        }
        Object entity = null;
        if (entityBrokerManager.getEntityRESTProvider() != null) {
            try {
                requestStorage.setRequestValues(params);
                if (params == null) { params = new HashMap<String, Object>(); }
                entity = entityBrokerManager.getEntityRESTProvider().translateInputToEntity(ref, format, input, params);
            } finally {
                requestStorage.reset();
            }
        } else {
            throw new UnsupportedOperationException("No provider to handle translateInputToEntity for ("+reference+","+format+")");
        }
        return entity;
    }

    public ActionReturn executeCustomAction(String reference, String action,
            Map<String, Object> params, OutputStream outputStream) {
        EntityReference ref = entityBrokerManager.parseReference(reference);
        if (ref == null) {
            throw new IllegalArgumentException("Invalid entity reference, no provider found to handle this ref: " + reference);
        }
        ActionsExecutable actionProvider = entityProviderManager.getProviderByPrefixAndCapability(ref.getPrefix(), ActionsExecutable.class);
        if (actionProvider == null) {
            throw new IllegalArgumentException("The provider for prefix ("+ref.getPrefix()+") cannot handle custom actions");
        }
        ActionReturn ar = null;
        if (entityBrokerManager.getEntityRESTProvider() != null) {
            try {
                requestStorage.setRequestValues(params);
                if (params == null) { params = new HashMap<String, Object>(0); }
                EntityView view = entityBrokerManager.parseEntityURL(reference);
                ar = entityBrokerManager.getEntityRESTProvider().handleCustomActionExecution(actionProvider, ref, action, params, outputStream, view, null);
                // populate the entity data
                if (ar != null) {
                    if (ar.entitiesList != null) {
                        entityBrokerManager.populateEntityData(ar.entitiesList);
                    } else if (ar.entityData != null) {
                        entityBrokerManager.populateEntityData( new EntityData[] {ar.entityData} );
                    }
                }
            } finally {
                requestStorage.reset();
            }
        } else {
            throw new UnsupportedOperationException("No provider to handle executeCustomAction for ("+reference+","+action+")");
        }
        return ar;
    }

    // PROPERTIES

    public List<String> findEntityRefs(String[] prefixes, String[] name, String[] searchValue,
            boolean exactMatch) {
        if (propertiesProvider != null) {
            return propertiesProvider.findEntityRefs(prefixes, name, searchValue, exactMatch);
        } else {
            log.warn("No propertiesProvider defined");
            return new ArrayList<String>();
        }
    }

    public Map<String, String> getProperties(String reference) {
        if (propertiesProvider != null) {
            return propertiesProvider.getProperties(reference);
        } else {
            log.warn("No propertiesProvider defined");
            return new HashMap<String, String>(0);
        }
    }

    public String getPropertyValue(String reference, String name) {
        if (propertiesProvider != null) {
            return propertiesProvider.getPropertyValue(reference, name);
        } else {
            log.warn("No propertiesProvider defined");
            return null;
        }
    }

    public void setPropertyValue(String reference, String name, String value) {
        if (propertiesProvider != null) {
            propertiesProvider.setPropertyValue(reference, name, value);
        } else {
            log.warn("No propertiesProvider defined");
        }
    }

    // TAGS

    public List<EntityData> findEntitesByTags(String[] tags, String[] prefixes,
            boolean matchAll, Search search, Map<String, Object> params) {
        if (tagSearchService != null) {
            requestStorage.setRequestValues(params);
            List<EntityData> results = tagSearchService.findEntitesByTags(tags, prefixes, matchAll, search);
            requestStorage.reset();
            return results;
        } else {
            log.warn("No tagSearchService defined");
            return new ArrayList<EntityData>();
        }
    }

    public List<String> getTagsForEntity(String reference) {
        if (tagSearchService != null) {
            return tagSearchService.getTagsForEntity(reference);
        } else {
            log.warn("No tagSearchService defined");
            return new ArrayList<String>();
        }
    }

    public void removeTagsFromEntity(String reference, String[] tags) {
        if (tagSearchService != null) {
            tagSearchService.removeTagsFromEntity(reference, tags);
        } else {
            log.warn("No tagSearchService defined");
        }
    }

    public void addTagsToEntity(String reference, String[] tags) {
        if (tagSearchService != null) {
            tagSearchService.addTagsToEntity(reference, tags);
        } else {
            log.warn("No tagSearchService defined");
        }
    }

    public void setTagsForEntity(String reference, String[] tags) {
        if (tagSearchService != null) {
            tagSearchService.setTagsForEntity(reference, tags);
        } else {
            log.warn("No tagSearchService defined");
        }
    }

    /**
     * @deprecated use {@link #getTagsForEntity(String)}
     */
    public Set<String> getTags(String reference) {
        if (tagSearchService != null) {
            return new HashSet<String>( tagSearchService.getTagsForEntity(reference) );
        } else {
            log.warn("No tagSearchService defined");
            return new HashSet<String>();
        }
    }

    /**
     * @deprecated use {@link #setTagsForEntity(String, String[])}
     */
    public void setTags(String reference, String[] tags) {
        if (tagSearchService != null) {
            tagSearchService.setTagsForEntity(reference, tags);
        } else {
            log.warn("No tagSearchService defined");
        }
    }

    /**
     * @deprecated use {@link #findEntitesByTags(String[], String[], boolean, Search)}
     */
    public List<String> findEntityRefsByTags(String[] tags) {
        if (tagSearchService != null) {
            ArrayList<String> refs = new ArrayList<String>();
            List<EntityData> results = tagSearchService.findEntitesByTags(tags, null, false, null);
            for (EntityData entitySearchResult : results) {
                refs.add( entitySearchResult.getEntityReference() );
            }
            return refs;
        } else {
            log.warn("No tagSearchService defined");
            return new ArrayList<String>();
        }
    }

    // SEARCH methods

    public boolean add(String reference, SearchContent content) {
        if (searchProvider != null) {
            return searchProvider.add(reference, content);
        }
        log.warn("No searchProvider defined");
        return false;
    }

    public boolean remove(String reference) {
        if (searchProvider != null) {
            return searchProvider.remove(reference);
        }
        log.warn("No searchProvider defined");
        return false;
    }

    public SearchResults search(QuerySearch query) {
        if (searchProvider != null) {
            return searchProvider.search(query);
        }
        log.warn("No searchProvider defined");
        return null;
    }

    public void resetSearchIndexes(String context) {
        if (searchProvider != null) {
            searchProvider.resetSearchIndexes(context);
        }
    }

}


text:
@interface Peyar : NSObject

@property(nonatomic, assign) NSInteger peyarId;
@property(nonatomic, strong) NSString *name;
@property(nonatomic, strong) NSString *meaning;
@property(nonatomic, assign) NSInteger gender;
@property(nonatomic, strong) NSString *source;
@property(nonatomic, strong) NSString *prefix;

@end