text:
(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(factory) :
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory());
}(this, (function () { 'use strict';

  const addEventListener = 'addEventListener';

  const removeEventListener = 'removeEventListener';

  const supportPassive = (() => {
    let result = false;
    try {
      const opts = Object.defineProperty({}, 'passive', {
        get() {
          result = true;
          return result;
        },
      });
      document[addEventListener]('DOMContentLoaded', function wrap() {
        document[removeEventListener]('DOMContentLoaded', wrap, opts);
      }, opts);
    } catch (e) {
      throw Error('Passive events are not supported');
    }

    return result;
  })();

  // general event options

  var passiveHandler = supportPassive ? { passive: true } : false;

  const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend';

  const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style;

  const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration';

  const transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty';

  function getElementTransitionDuration(element) {
    const computedStyle = getComputedStyle(element);
    const propertyValue = computedStyle[transitionProperty];
    const durationValue = computedStyle[transitionDuration];
    const durationScale = durationValue.includes('ms') ? 1 : 1000;
    const duration = supportTransition && propertyValue && propertyValue !== 'none'
      ? parseFloat(durationValue) * durationScale : 0;

    return !Number.isNaN(duration) ? duration : 0;
  }

  function emulateTransitionEnd(element, handler) {
    let called = 0;
    const endEvent = new Event(transitionEndEvent);
    const duration = getElementTransitionDuration(element);

    if (duration) {
      element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) {
        if (e.target === element) {
          handler.apply(element, [e]);
          element.removeEventListener(transitionEndEvent, transitionEndWrapper);
          called = 1;
        }
      });
      setTimeout(() => {
        if (!called) element.dispatchEvent(endEvent);
      }, duration + 17);
    } else {
      handler.apply(element, [endEvent]);
    }
  }

  function queryElement(selector, parent) {
    const lookUp = parent && parent instanceof Element ? parent : document;
    return selector instanceof Element ? selector : lookUp.querySelector(selector);
  }

  function addClass(element, classNAME) {
    element.classList.add(classNAME);
  }

  function hasClass(element, classNAME) {
    return element.classList.contains(classNAME);
  }

  function removeClass(element, classNAME) {
    element.classList.remove(classNAME);
  }

  const ariaHidden = 'aria-hidden';

  const dataBsToggle = 'data-bs-toggle';

  const dataBsDismiss = 'data-bs-dismiss';

  const fadeClass = 'fade';

  const showClass = 'show';

  const ariaModal = 'aria-modal';

  function bootstrapCustomEvent(namespacedEventType, eventProperties) {
    const OriginalCustomEvent = new CustomEvent(namespacedEventType, { cancelable: true });

    if (eventProperties instanceof Object) {
      Object.keys(eventProperties).forEach((key) => {
        Object.defineProperty(OriginalCustomEvent, key, {
          value: eventProperties[key],
        });
      });
    }
    return OriginalCustomEvent;
  }

  const dataBsTarget = 'data-bs-target';

  const dataBsParent = 'data-bs-parent';

  const dataBsContainer = 'data-bs-container';

  function getTargetElement(element) {
    return queryElement(element.getAttribute(dataBsTarget) || element.getAttribute('href'))
          || element.closest(element.getAttribute(dataBsParent))
          || queryElement(element.getAttribute(dataBsContainer));
  }

  const fixedTopClass = 'fixed-top';

  const fixedBottomClass = 'fixed-bottom';

  const stickyTopClass = 'sticky-top';

  const fixedItems = Array.from(document.getElementsByClassName(fixedTopClass))
    .concat(Array.from(document.getElementsByClassName(fixedBottomClass)))
    .concat(Array.from(document.getElementsByClassName(stickyTopClass)))
    .concat(Array.from(document.getElementsByClassName('is-fixed')));

  function resetScrollbar() {
    const bd = document.body;
    bd.style.paddingRight = '';
    bd.style.overflow = '';

    if (fixedItems.length) {
      fixedItems.forEach((fixed) => {
        fixed.style.paddingRight = '';
        fixed.style.marginRight = '';
      });
    }
  }

  function measureScrollbar() {
    const windowWidth = document.documentElement.clientWidth;
    return Math.abs(window.innerWidth - windowWidth);
  }

  function setScrollbar(scrollbarWidth, overflow) {
    const bd = document.body;
    const bdStyle = getComputedStyle(bd);
    const bodyPad = parseInt(bdStyle.paddingRight, 10);
    const isOpen = bdStyle.overflow === 'hidden';
    const sbWidth = isOpen && bodyPad ? 0 : scrollbarWidth;

    if (overflow) {
      bd.style.overflow = 'hidden';
      bd.style.paddingRight = `${bodyPad + sbWidth}px`;

      if (fixedItems.length) {
        fixedItems.forEach((fixed) => {
          const isSticky = hasClass(fixed, stickyTopClass);
          const itemPadValue = getComputedStyle(fixed).paddingRight;
          fixed.style.paddingRight = `${parseInt(itemPadValue, 10) + sbWidth}px`;
          if (isSticky) {
            const itemMValue = getComputedStyle(fixed).marginRight;
            fixed.style.marginRight = `${parseInt(itemMValue, 10) - sbWidth}px`;
          }
        });
      }
    }
  }

  function reflow(element) {
    return element.offsetHeight;
  }

  const modalOpenClass = 'modal-open';
  const modalBackdropClass = 'modal-backdrop';
  const modalActiveSelector = `.modal.${showClass}`;
  const offcanvasActiveSelector = `.offcanvas.${showClass}`;

  const overlay = document.createElement('div');
  overlay.setAttribute('class', `${modalBackdropClass}`);

  function getCurrentOpen() {
    return queryElement(`${modalActiveSelector},${offcanvasActiveSelector}`);
  }

  function appendOverlay(hasFade) {
    document.body.appendChild(overlay);
    if (hasFade) addClass(overlay, fadeClass);
  }

  function showOverlay() {
    addClass(overlay, showClass);
    reflow(overlay);
  }

  function hideOverlay() {
    removeClass(overlay, showClass);
  }

  function removeOverlay() {
    const bd = document.body;
    const currentOpen = getCurrentOpen();

    if (!currentOpen) {
      removeClass(overlay, fadeClass);
      removeClass(bd, modalOpenClass);
      bd.removeChild(overlay);
      resetScrollbar();
    }
  }

  function setFocus(element) {
    element.focus();
  }

  function isVisible(element) {
    return getComputedStyle(element).visibility !== 'hidden'
      && element.offsetParent !== null;
  }

  function normalizeValue(value) {
    if (value === 'true') {
      return true;
    }

    if (value === 'false') {
      return false;
    }

    if (!Number.isNaN(+value)) {
      return +value;
    }

    if (value === '' || value === 'null') {
      return null;
    }

    // string / function / Element / Object
    return value;
  }

  function normalizeOptions(element, defaultOps, inputOps, ns) {
    const normalOps = {};
    const dataOps = {};
    const data = { ...element.dataset };

    Object.keys(data)
      .forEach((k) => {
        const key = k.includes(ns)
          ? k.replace(ns, '').replace(/[A-Z]/, (match) => match.toLowerCase())
          : k;

        dataOps[key] = normalizeValue(data[k]);
      });

    Object.keys(inputOps)
      .forEach((k) => {
        inputOps[k] = normalizeValue(inputOps[k]);
      });

    Object.keys(defaultOps)
      .forEach((k) => {
        if (k in inputOps) {
          normalOps[k] = inputOps[k];
        } else if (k in dataOps) {
          normalOps[k] = dataOps[k];
        } else {
          normalOps[k] = defaultOps[k];
        }
      });

    return normalOps;
  }

  /* Native JavaScript for Bootstrap 5 | Base Component
  ----------------------------------------------------- */

  class BaseComponent {
    constructor(name, target, defaults, config) {
      const self = this;
      const element = queryElement(target);

      if (element[name]) element[name].dispose();
      self.element = element;

      if (defaults && Object.keys(defaults).length) {
        self.options = normalizeOptions(element, defaults, (config || {}), 'bs');
      }
      element[name] = self;
    }

    dispose(name) {
      const self = this;
      self.element[name] = null;
      Object.keys(self).forEach((prop) => { self[prop] = null; });
    }
  }

  /* Native JavaScript for Bootstrap 5 | Modal
  -------------------------------------------- */

  // MODAL PRIVATE GC
  // ================
  const modalString = 'modal';
  const modalComponent = 'Modal';
  const modalSelector = `.${modalString}`;
  // const modalActiveSelector = `.${modalString}.${showClass}`;
  const modalToggleSelector = `[${dataBsToggle}="${modalString}"]`;
  const modalDismissSelector = `[${dataBsDismiss}="${modalString}"]`;
  const modalStaticClass = `${modalString}-static`;
  const modalDefaultOptions = {
    backdrop: true, // boolean|string
    keyboard: true, // boolean
  };

  // MODAL CUSTOM EVENTS
  // ===================
  const showModalEvent = bootstrapCustomEvent(`show.bs.${modalString}`);
  const shownModalEvent = bootstrapCustomEvent(`shown.bs.${modalString}`);
  const hideModalEvent = bootstrapCustomEvent(`hide.bs.${modalString}`);
  const hiddenModalEvent = bootstrapCustomEvent(`hidden.bs.${modalString}`);

  // MODAL PRIVATE METHODS
  // =====================
  function setModalScrollbar(self) {
    const { element, scrollbarWidth } = self;
    const bd = document.body;
    const html = document.documentElement;
    const bodyOverflow = html.clientHeight !== html.scrollHeight
                      || bd.clientHeight !== bd.scrollHeight;
    const modalOverflow = element.clientHeight !== element.scrollHeight;

    if (!modalOverflow && scrollbarWidth) {
      element.style.paddingRight = `${scrollbarWidth}px`;
    }
    setScrollbar(scrollbarWidth, (modalOverflow || bodyOverflow));
  }

  function toggleModalDismiss(self, add) {
    const action = add ? addEventListener : removeEventListener;
    window[action]('resize', self.update, passiveHandler);
    self.element[action]('click', modalDismissHandler);
    document[action]('keydown', modalKeyHandler);
  }

  function toggleModalHandler(self, add) {
    const action = add ? addEventListener : removeEventListener;
    const { triggers } = self;

    if (triggers.length) {
      triggers.forEach((btn) => btn[action]('click', modalClickHandler));
    }
  }

  function afterModalHide(self) {
    const { triggers } = self;
    removeOverlay();
    self.element.style.paddingRight = '';
    self.isAnimating = false;

    if (triggers.length) {
      const visibleTrigger = triggers.find((x) => isVisible(x));
      if (visibleTrigger) setFocus(visibleTrigger);
    }
  }

  function afterModalShow(self) {
    const { element, relatedTarget } = self;
    setFocus(element);
    self.isAnimating = false;

    toggleModalDismiss(self, 1);

    shownModalEvent.relatedTarget = relatedTarget;
    element.dispatchEvent(shownModalEvent);
  }

  function beforeModalShow(self) {
    const { element, hasFade } = self;
    element.style.display = 'block';

    setModalScrollbar(self);
    if (!queryElement(modalActiveSelector)) {
      document.body.style.overflow = 'hidden';
      addClass(document.body, modalOpenClass);
    }

    addClass(element, showClass);
    element.removeAttribute(ariaHidden);
    element.setAttribute(ariaModal, true);

    if (hasFade) emulateTransitionEnd(element, () => afterModalShow(self));
    else afterModalShow(self);
  }

  function beforeModalHide(self, force) {
    const {
      element, relatedTarget, hasFade,
    } = self;
    const currentOpen = getCurrentOpen();

    element.style.display = '';

    // force can also be the transitionEvent object, we wanna make sure it's not
    // call is not forced and overlay is visible
    if (!force && hasFade && hasClass(overlay, showClass)
      && !currentOpen) { // AND no modal is visible
      hideOverlay();
      emulateTransitionEnd(overlay, () => afterModalHide(self));
    } else {
      afterModalHide(self);
    }

    toggleModalDismiss(self);

    hiddenModalEvent.relatedTarget = relatedTarget;
    element.dispatchEvent(hiddenModalEvent);
  }

  // MODAL EVENT HANDLERS
  // ====================
  function modalClickHandler(e) {
    const { target } = e;
    const trigger = target.closest(modalToggleSelector);
    const element = getTargetElement(trigger);
    const self = element && element[modalComponent];

    if (trigger.tagName === 'A') e.preventDefault();

    if (self.isAnimating) return;

    self.relatedTarget = trigger;

    self.toggle();
  }

  function modalKeyHandler({ which }) {
    const element = queryElement(modalActiveSelector);
    const self = element[modalComponent];
    const { options, isAnimating } = self;
    if (!isAnimating // modal has no animations running
      && options.keyboard && which === 27 // the keyboard option is enabled and the key is 27
      && hasClass(element, showClass)) { // the modal is not visible
      self.relatedTarget = null;
      self.hide();
    }
  }

  function modalDismissHandler(e) {
    const element = this;
    const self = element[modalComponent];

    if (self.isAnimating) return;

    const { isStatic, modalDialog } = self;
    const { target } = e;
    const selectedText = document.getSelection().toString().length;
    const targetInsideDialog = modalDialog.contains(target);
    const dismiss = target.closest(modalDismissSelector);

    if (isStatic && !targetInsideDialog) {
      addClass(element, modalStaticClass);
      self.isAnimating = true;
      emulateTransitionEnd(modalDialog, () => staticTransitionEnd(self));
    } else if (dismiss || (!selectedText && !isStatic && !targetInsideDialog)) {
      self.relatedTarget = dismiss || null;
      self.hide();
      e.preventDefault();
    }
  }

  function staticTransitionEnd(self) {
    const duration = getElementTransitionDuration(self.modalDialog) + 17;
    removeClass(self.element, modalStaticClass);
    // user must wait for zoom out transition
    setTimeout(() => { self.isAnimating = false; }, duration);
  }

  // MODAL DEFINITION
  // ================
  class Modal extends BaseComponent {
    constructor(target, config) {
      super(modalComponent, target, modalDefaultOptions, config);

      // bind
      const self = this;

      // the modal
      const { element } = self;

      // the modal-dialog
      self.modalDialog = queryElement(`.${modalString}-dialog`, element);

      // modal can have multiple triggering elements
      self.triggers = Array.from(document.querySelectorAll(modalToggleSelector))
        .filter((btn) => getTargetElement(btn) === element);

      // additional internals
      self.isStatic = self.options.backdrop === 'static';
      self.hasFade = hasClass(element, fadeClass);
      self.isAnimating = false;
      self.scrollbarWidth = measureScrollbar();
      self.relatedTarget = null;

      // attach event listeners
      toggleModalHandler(self, 1);

      // bind
      self.update = self.update.bind(self);
    }

    // MODAL PUBLIC METHODS
    // ====================
    toggle() {
      const self = this;
      if (hasClass(self.element, showClass)) self.hide();
      else self.show();
    }

    show() {
      const self = this;
      const {
        element, isAnimating, hasFade, relatedTarget,
      } = self;
      let overlayDelay = 0;

      if (hasClass(element, showClass) && !isAnimating) return;

      showModalEvent.relatedTarget = relatedTarget || null;
      element.dispatchEvent(showModalEvent);
      if (showModalEvent.defaultPrevented) return;

      self.isAnimating = true;

      // we elegantly hide any opened modal/offcanvas
      const currentOpen = getCurrentOpen();
      if (currentOpen && currentOpen !== element) {
        const that = currentOpen[modalComponent]
          ? currentOpen[modalComponent]
          : currentOpen.Offcanvas;
        that.hide();
      }

      if (!queryElement(`.${modalBackdropClass}`)) {
        appendOverlay(hasFade);
      }
      overlayDelay = getElementTransitionDuration(overlay);

      if (!hasClass(overlay, showClass)) {
        showOverlay();
      }

      if (!currentOpen) {
        setTimeout(() => beforeModalShow(self), overlayDelay);
      } else beforeModalShow(self);
    }

    hide(force) {
      const self = this;
      const {
        element, isAnimating, hasFade, relatedTarget,
      } = self;
      if (!hasClass(element, showClass) && !isAnimating) return;

      hideModalEvent.relatedTarget = relatedTarget || null;
      element.dispatchEvent(hideModalEvent);
      if (hideModalEvent.defaultPrevented) return;

      self.isAnimating = true;
      removeClass(element, showClass);
      element.setAttribute(ariaHidden, true);
      element.removeAttribute(ariaModal);

      if (hasFade && force !== 1) {
        emulateTransitionEnd(element, () => beforeModalHide(self));
      } else {
        beforeModalHide(self, force);
      }
    }

    update() {
      const self = this;

      if (hasClass(self.element, showClass)) setModalScrollbar(self);
    }

    dispose() {
      const self = this;
      self.hide(1); // forced call

      toggleModalHandler(self);

      super.dispose(modalComponent);
    }
  }

  Modal.init = {
    component: modalComponent,
    selector: modalSelector,
    constructor: Modal,
  };

  return Modal;

})));


text:
package notaql.parser;

import notaql.parser.antlr.NotaQL2Parser;
import org.antlr.v4.runtime.*;
import org.apache.commons.lang3.StringEscapeUtils;

import java.util.Collections;
import java.util.List;

/**
 * This class handles basic error output and stops the parser
 */
public class NotaQLErrorListener extends BaseErrorListener {
    private Parser parser;

    public NotaQLErrorListener(Parser parser) {
        this.parser = parser;
    }

    @Override
    public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
        String token = "UNKNOWN";
        if(offendingSymbol instanceof CommonToken) {
            try {
                token = parser.getTokenNames()[((CommonToken) offendingSymbol).getType()];
            } catch (ArrayIndexOutOfBoundsException ignored) {

            }
        }

        final List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
        Collections.reverse(stack);
        System.err.println("rule stack: " + stack);
        printContextStack(((Parser) recognizer).getContext());

        throw new IllegalStateException(parser.getClass().getName() + " failed to parse at line " + line + " at character " + charPositionInLine + " due to " + msg + "; Offending symbol: " + offendingSymbol.getClass().toString() + ": " + token, e);
    }

    public static void printContextStack(ParserRuleContext ctx) {
        if(ctx.getParent() != null)
            printContextStack(ctx.getParent());
        System.err.println("context: " + ctx.getText() + " (" + ctx.getClass().toString() + ")");
    }
}

redpajama_set_name: RedPajamaGithub


text:
import uuid
from datetime import datetime

from flask.ext.login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash

from . import db, login_manager

def create_only_slug(form):
    if form.slug.data == "":
        slug = str(datetime.now())[0:10] + "-" + str(uuid.uuid4())[0:4]
    else:
        slug = form.slug.data
    return slug

# 用户数据模型
class User(UserMixin, db.Document):
    """
    admin test count
    User(username="admin", password="admin", email="admin@admin.com", url="admin.admin",screenName="admin", group="administrator").save()
    """
    username = db.StringField(max_length=25, required=True, unique=True)
    password = db.StringField()
    password_hash = db.StringField(max_length=128, required=True)
    email = db.EmailField(required=True, unique=True, default="")
    url = db.StringField(max_length=30, default="")
    screenName = db.StringField(max_length=25, default="")
    group = db.StringField(default='subscriber', choices=["administrator", "editor", "subscriber"])

    meta = {
        'indexes': [
            'username',
            'email'
        ]
    }

    def clean(self):
        self.password_hash = generate_password_hash(self.password)
        self.password = None

    def verify_password(self, password):
        return check_password_hash(self.password_hash, password)

    def set_and_save(self, form):
        self.username = form.username.data
        self.email = form.email.data
        self.password = form.password.data
        self.url = form.url.data
        self.screenName = form.screenName.data
        self.group = form.group.data
        self.save()

@login_manager.user_loader
def user_load(user_id):
    return User.objects(id=user_id).first()

# 评论数据模型
class Comment(db.EmbeddedDocument):
    """
    comment1 = Comment(author_name="lleohao", content="good post")
    """
    author_name = db.StringField(required=True)
    author_email = db.StringField()
    author_url = db.StringField()
    created = db.DateTimeField(default=datetime.now, required=True)
    content = db.StringField(required=True)

# 分类数据模型
class Category(db.Document):
    """
    Category(name="默认分类", slug="normal", description="这是系统默认的分类")
    Category(name="Python", slug="python", description="").save()
    """
    name = db.StringField(required=True, unique=True)
    slug = db.StringField(required=True, unique=True)
    description = db.StringField()

    meta = {
        'indexes': [
            'name',
            '$name',
            '#name'
        ]
    }

    def set_val(self, form):
        self.name = form.name.data
        self.slug = form.slug.data
        self.description = form.description.data

# 内容数据模型
class Content(db.DynamicDocument):
    """
    post = Content(title="test post", slug="test", status=True, type="post")
    """
    created = db.DateTimeField(default=datetime.now, required=True)
    title = db.StringField(max_length=255, required=True)
    slug = db.StringField(max_length=255, required=True, unique=True)
    category = db.ReferenceField(Category)
    tags = db.ListField(db.StringField())
    md_text = db.StringField()
    html_text = db.StringField()
    description = db.StringField()
    author = db.StringField()
    status = db.BooleanField(default=False)
    type = db.StringField(choices=["post", "page"])
    comments = db.ListField(db.EmbeddedDocumentField(Comment))
    meta = {
        'indexes': [
            'status',
            'category',
            'type'
        ],
        'ordering': [
            '-created'
        ]
    }

    def set_val(self, form, author, html_text, type):
        self.created = datetime.now()
        self.title = form.title.data
        self.slug = create_only_slug(form)
        self.md_text = form.content.data
        self.html_text = html_text
        self.author = author
        if type == 'post':
            if form.tags.data is not "":
                self.tags = form.tags.data.split(",")
            else:
                self.tags = []
            self.category = Category.objects(slug=form.category.data).first()
        else:
            self.tags = None
            self.category = None

    def clean(self):
        op = Options.objects().first()
        self.description = op.title + " - " + op.description + " - " + self.md_text[0:150]

# 网站设置属性数据模型
class Options(db.Document):
    url = db.StringField(required=True)
    title = db.StringField(required=True)
    keyword = db.StringField()
    description = db.StringField()
    duoshuo_name = db.StringField(default="")

    # 做为自增长 id 用
    # 暂不需要
    comment_index = db.IntField(default=0, required=True)
    content_index = db.IntField(default=0)

    def set_and_save(self, form):
        self.url = form.url.data
        self.title = form.title.data
        self.keyword = form.keyword.data
        self.description = form.description.data
        self.duoshuo_name = form.duoshuo_name.data
        self.save()


text:
<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\LoginForm */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\widgets\Spaceless;
use backend\assets\AppAsset;

$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">

    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>

<?php $this->beginBody() ?>
<?php Spaceless::begin(); ?>

Yii CMS 后台管理系统

后台登录

        <?php $form = ActiveForm::begin(['id' => 'login-form']); ?>

        <?= $form->field($model, 'username', ['template' => '{input}', 'inputOptions' => ['placeholder' => '电子邮箱']])->textInput(['autofocus' => true]) ?>

        <?= $form->field($model, 'password', ['template' => '{input}', 'inputOptions' => ['placeholder' => '密码']])->passwordInput() ?>

                <?= $form->field($model, 'rememberMe')->checkbox() ?>

                <?= Html::submitButton('登录', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']) ?>

        <?php ActiveForm::end(); ?>

<?php Spaceless::end(); ?>
<?php $this->endBody() ?>

<?php $this->endPage() ?>


text:
package net.ssehub.easy.instantiation.core.model.vilTypes;

import java.util.Collections;
import java.util.HashSet;
import java.util.Random;

/**
 * Just some constants.
 *
 * @author Holger Eichelberger
 */
public class Constants {

    public static final Random RANDOM = new Random();

    public static final String GETTER_PREFIX = "get";

    public static final String QUALIFICATION_SEPARATOR = "::";

    public static final String COLON = ":";

    public static final String DECLARATOR_SEPARATOR = "|";

    public static final String ITER_CALL = "->";

    public static final String ASSIGNMENT = "=";

    public static final String ADDITION = "+";

    public static final String SUBTRACTION = "-";

    public static final String MULTIPLICATION = "*";

    public static final String DIVISION = "/";

    public static final String EQUALITY = "==";

    public static final String UNEQUALITY = "!=";

    public static final String UNEQUALITY_ALIAS = "<>";

    public static final String NEGATION = "!";

    public static final String NEGATION_ALIAS = "not";

    public static final String LESS_THEN = "<";

    public static final String LESS_THEN_EQUALS = LESS_THEN + ASSIGNMENT;

    public static final String GREATER_THEN = ">";

    public static final String GREATER_THEN_EQUALS = GREATER_THEN + ASSIGNMENT;

    public static final String TYPE_ITERATOR = "Iterator";

    public static final String TYPE_STRING = "String";

    public static final String TYPE_REAL = "Real";

    public static final String TYPE_INTEGER = "Integer";

    public static final String TYPE_BOOLEAN = "Boolean";

    public static final String ARRAY_ACCESS = "[]";

    public static final String IMPLICIT_PARENT_PARAMETER_NAME = "$parent";

    public static final String IMPLICIT_PATHS_PARAMETER_NAME = "$paths";

    public static final String IMPLICIT_TERMINATOR_NAME = "$terminator";

    public static final java.util.Set<String> IMPLICIT_PARAMETER;

    static {
        java.util.Set<String> tmp = new HashSet<String>();
        tmp.add(IMPLICIT_PARENT_PARAMETER_NAME);
        tmp.add(IMPLICIT_PATHS_PARAMETER_NAME);
        tmp.add(IMPLICIT_TERMINATOR_NAME);
        IMPLICIT_PARAMETER = Collections.unmodifiableSet(tmp);
    }
}


text:
/* SWEN20003 Object Oriented Software Development
 * player Racing Game
 * Author: <Lawrence Kuoch> <lkuoch>
 */

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.tiled.TiledMap;

/** Represents the entire game world.
 * (Designed to be instantiated just once for the whole game).
 * The player (you) control the player
 */
public class World
{
	/** Constants */
	private final int delta = 1;
	private final int stoppingFriction  = 1;

	// The finish line coordinates
	private final int finishLine = 1000;
	private boolean   crossLine  = false;

	private int layerIndex = 0;
	private int ranking    = 1; // Default ranking of player
	private int finishPlace;    // Race finish position

	/** Initialized class variables */
	private TiledMap background;
	private Camera   camera;
	private Panel    panel;

	// Players
	private Kart  player;
	private Kart  bot1;
	private Kart  bot2;
	private Kart  bot3;

	// Items
	private Item tomato;
	private Item oilcan;
	private Item boost;

	/** ArrayLists */
	// Store the waypoints into a array list
	private ArrayList<Point2D> waypoints    = new ArrayList<Point2D>();
	// Store the karts into a array list
	private ArrayList<Kart>    kartlist     = new ArrayList<Kart>();
	// Store the itmes into a array list
	private ArrayList<Item>    itemlist     = new ArrayList<Item>();
	// Store the hazards created in each item into a hazard list
	private ArrayList<Hazard>  hazardlist   = new ArrayList<Hazard>();

	// END VARIABLE DECLARATIONS

    /** Create a new World object. */
    public World() throws SlickException
    {
    	/** Initialise the following in the world */
    	initialiseWayPoints();
    	initialiseItemLocations();
        initialiseBackground();
        initialiseKarts();
        initialiseCamera();
        initialisePanel();
    }

    /** Update the game state for a frame.
     * @param rotate_dir The player's direction of rotation
     *      (-1 for anti-clockwise, 1 for clockwise, or 0).
     * @param move_dir The player's movement in the car's axis (-1, 0 or 1).
     * @param delta Time passed since last frame (milliseconds).
     */
    public void update(double rotate_dir, double move_dir, boolean use_item) throws SlickException
    {
    	// Move the karts
    	moveKarts(rotate_dir, move_dir, use_item);

    	// Update the hazards
    	updateHazards();

    	// Update the camera onto the player position
    	updateCamera();

    	// Update the ranking on the panel to show the player's position in the race if they haven't finished
    	updateRanking();
    }

	/** Render the entire screen, so it reflects the current game state.
     * @param g The Slick graphics object, used for drawing.
     */
    public void render(Graphics g) throws SlickException
    {
    	renderBackground();
    	renderItems();
    	renderKarts();
    	renderHazards();
    	renderPositions(g);
    }

    // -----------------Initialisation functions-----------------------------------------------------------------------------------

    /** Initialise the waypoints from a file */
    public void initialiseWayPoints()
    {
    	try
    	{
    		File file = new File(AssetLocations.waypointAssetLocation); // Reading in the file
    		Scanner scanner = new Scanner(file);
    		int count = 1;

    		// While there is a valid input
    		while(scanner.hasNextLine())
    		{
    			String line = scanner.nextLine();
    			String array[] = line.split(","); // Coordinates separated by a delimitter
    			Point2D waypoint = new Point2D ("Waypoint:" + count, Integer.parseInt(array[0].trim()), Integer.parseInt(array[1].trim()));
    			this.waypoints.add(waypoint);
    			count++;
    		}
    		scanner.close();
    	} catch (FileNotFoundException e) // Checking for exceptions
    	{
    		e.printStackTrace();
    	}
    }

    /** Initialise the item locations from a file
     * @throws SlickException */
    public void initialiseItemLocations() throws SlickException
    {
    	try
    	{
    		File file = new File(AssetLocations.itemLocaleAssetLocation); // Reading in the file
    		Scanner scanner = new Scanner(file);

    		while(scanner.hasNextLine())
    		{
    			String itemName = scanner.next().toLowerCase();
    			String line = scanner.nextLine();
    			String array[] = line.split(","); // Coordinates separated by a delimitter
    			Point2D itemlocale = new Point2D (itemName, Integer.parseInt(array[0].trim()), Integer.parseInt(array[1].trim()));

    			// Store the corresponding items into the appropriate Arraylist for that item
    			if(itemName.equals(AssetLocations.oilcanName))
    			{
    				oilcan = new OilcanItem(AssetLocations.oilcanAssetLocation, AssetLocations.oilcanName, itemlocale);
    				itemlist.add(oilcan);
    			}

    			else if(itemName.equals(AssetLocations.tomatoName))
    			{
    				tomato = new TomatoItem(AssetLocations.tomatoAssetLocation, AssetLocations.tomatoName, itemlocale);
    				itemlist.add(tomato);
    			}

    			else if(itemName.equals(AssetLocations.boostName))
    			{
    				boost = new BoostItem(AssetLocations.boostAssetLocation, AssetLocations.boostName, itemlocale);
    				itemlist.add(boost);
    			}

    			// Item name in the file not defined
    			else
    				System.err.println("Unrecognised item: " + itemName );
    		}
    		scanner.close();
    	} catch (FileNotFoundException e){ // Checking for exceptions
    		e.printStackTrace();
    	}
    }

    /** Initialise the background */
    public void initialiseBackground() throws SlickException
    {
    	background = new TiledMap(AssetLocations.backgroundAssetLocation, Game.ASSETS_PATH);
    }

    /** Initialise the karts to appear in the world */
    public void initialiseKarts() throws SlickException
    {
    	// Donkey
    	player = new Player(AssetLocations.donkeyAssetLocation, AssetLocations.donkeyName);
    	kartlist.add(player);
    	// Elephant
    	bot1   = new Elephant(AssetLocations.elephantAssetLocation, AssetLocations.elephantName, waypoints);
    	kartlist.add(bot1);
    	// Dog
    	bot2   = new Dog(AssetLocations.dogAssetLocation, AssetLocations.dogName, waypoints);
    	kartlist.add(bot2);
    	// Octopus
    	bot3   = new Octopus(AssetLocations.octopusAssetLocation, AssetLocations.octopusName, waypoints);
    	kartlist.add(bot3);
    }

    /** Initialise the camera to appear in the world */
    public void initialiseCamera() throws SlickException
    {
    	// Camera will tag on the player's position
    	camera = new Camera(Player.StartX, Player.StartY, background.getTileWidth(), background.getTileHeight(),
    			            Game.SCREENWIDTH, Game.SCREENHEIGHT);
    }

    /** Initialise the panel to appear on the screen */
    public void initialisePanel() throws SlickException
    {
    	panel = new Panel();
    }

    // -----------------Update functions-----------------------------------------------------------------------------------

    /** Update the hazards */
    public void updateHazards()
    {
    	for(Hazard h: hazardlist)
    		h.update(this);
	}

    /** Update the camera */
	public void updateCamera()
	{
		camera.update((int)player.getPosX(), (int)player.getPosY());
	}

	/** Update the ranking */
	public void updateRanking()
	{
		if(!crossLine)
			ranking = ((Player) player).updateRank(player.getPosY(), bot1.getPosY(), bot2.getPosY(), bot3.getPosY(), ranking);

	}

    /** Method to move the karts
     * @throws SlickException */
    public void moveKarts(double rotate_dir, double move_dir, boolean use_item) throws SlickException
    {
    	/** Iterating through all the karts */
    	for(Kart k: this.kartlist)
    	{
    		// PlayerKart
    		if(k.getClass().equals(player.getClass()))
    			((Player)k).update(this, rotate_dir, move_dir, delta, use_item);

    		// Computer Kart
    		else
    			((AIKart)k).move(this, delta);
    	}
	}

    // -----------------Utility functions-----------------------------------------------------------------------------------

    /** Check if the given kart is going to colide with any other kart at this position **/
    public boolean didCrash(Kart k)
    {
    	for(Kart other: this.getKartlist())
    	{
    		if((other != k) && (k.collides(other)))
    		{
    			return true;
    		}
    	}
    	return false;
    }

    /** Check if a kart collided with a object */
    public boolean didKartCollide(GameObject object)
    {
    	for(Kart k: kartlist)
    	{
    		if(k.collides(object))
    		{
    			return true;
    		}
    	}

    	return false;
    }

    /** Check if a position is blocked **/
    public boolean blockedAt(float x, float y)
    {
    	return getFriction(x, y) == stoppingFriction;
    }

    /** Function to get the friction for the player position */
    public double getFriction(float PosX, float PosY)
    {
    	int TileX = (int) (PosX / background.getTileWidth());
    	int TileY = (int) (PosY / background.getTileHeight());

    	int groundType = background.getTileId(TileX, TileY, layerIndex);
    	String frictionProperty = background.getTileProperty(groundType, AssetLocations.friction, null);
    	double friction = Double.parseDouble(frictionProperty);

    	return friction;
    }

   // -----------------Render functions-----------------------------------------------------------------------------------

    /** Render the background */
    public void renderBackground()
    {
    	background.render(camera.getOffsetX(), camera.getOffsetY(), camera.getSx(), camera.getSy(),
    			          background.getTileWidth(), background.getTileHeight());
    }

    /** Render the in game items */
    public void renderItems()
    {
    	for(Item items: itemlist)
    	{
    		items.render(camera);
    	}
    }

    /** Render the different types of karts */
    public void renderKarts()
    {
    	for(Kart karts : kartlist)
    		karts.render(camera);
    }

    /** Render the hazards if a item is used */
    public void renderHazards()
    {
        	for(Hazard hazards : hazardlist)
        		hazards.render(camera);
    }

    /** Render the status positions of the karts */
    public void renderPositions(Graphics g)
    {
    	if(this.player.getPosY() > this.finishLine)
    	{
    		this.crossLine = false;
    		panel.render(g, ranking, ((Player) player).getPlayerItem());
    	}
    	else
    	{
    		this.crossLine = true;
    		panel.render(g, ranking, ((Player) player).getPlayerItem());
    		finishPlace = ranking;
    		g.drawString("Game Over !\n You came " +
					  Panel.ordinal(finishPlace) , WorldCoordinates.GameOver.getPosX(), WorldCoordinates.GameOver.getPosY());
    	}
    }
  //----------------------------------------------------GETTERS AND SETTERS--------------------------------------------------------------//

    public ArrayList<Point2D> getWaypoints()
    {
    	return this.waypoints;
    }

    public ArrayList<Kart> getKartlist()
    {
    	return this.kartlist;
    }

    public ArrayList<Hazard> getHazardlist()
    {
    	return this.hazardlist;
    }

    public ArrayList<Item> getItemlist()
    {
    	return this.itemlist;
    }

	public boolean getCrossLine()
	{
		return this.crossLine;
	}

	public Kart getPlayer()
	{
		return this.player;
	}

	public Camera getCamera()
	{
		return this.camera;
	}
}


text:
package tp4.aed;

import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.print.*;

/**
 * La clase GraphicsConsole representa una ventana de trabajo
 * sencilla para que un programa basado en consola est�ndar
 * pueda visualizar objetos gr�ficos elementales como cuadrados,
 * elipses, c�rculos, l�neas, etc. Tambi�n puede desplegar cadenas
 * de caracteres en fuentes diversas, y gestionar el color de los
 * objetos mostrados - [Versi�n 1.0].
 *
 * A partir de esta versi�n 1.1, se agrega tambi�n la funcionalidad de poder
 * desplegar una imagen que exista previamente en un archivo, y una opci�n de
 * men� que permite imprimir lo que se haya dibujado, en una sola hoja. La
 * impresi�n se recomienda con orientaci�n apaisada. Para imprimir en una sola
 * p�gina, la clase toma la gr�fica que se haya generado, y crea una imagen
 * para imprimir a una escala tal que pueda entrar en el �rea imprimible de la
 * p�gina, por lo cual es posible que la impresi�n produzca alg�n efecto de
 * estiramiento de la imagen con respecto a la que se ve en pantalla - [Versi�n 1.1].
 *
 * Se agrega un simple m�todo clear() que permite limpiar el contenido completo
 * del �rea de dibujo - [Versi�n 1.1.1].
 *
 * @author Ing. Valerio Frittelli.
 * @version Junio de 2011 - Versi�n 1.1.1.
 */
public class GraphicsConsole extends JFrame
{
    // atributo static: gestionado via Singleton Pattern.
    private static GraphicsConsole gc = new GraphicsConsole();

    // el objeto donde se har�n los dibujos...
    private Lienzo lienzo;

    // un objeto imagen para usar como doble buffer...
    private Image db;

    // el contenedor gr�fico del doble buffer...
    private Graphics cg;

    // las dimensiones de la pantalla al correr el programa...
    private Dimension dim;

    //********************************************************
    //************************************ M�todos privados...
    //********************************************************

    // constructor privado... Singleton Pattern.
    private GraphicsConsole()
    {
        super( "Consola Gr�fica - Versi�n 1.1.1" );
        this.setDefaultCloseOperation( JFrame.HIDE_ON_CLOSE );
        this.setMenu();
        this.setInitialLook();
        this.initGraphicArea();
        this.initButton();
    }

    // crea, activa y controla el men� superior de opciones.
    private void setMenu()
    {
         // activamos la barra del men� superior...
         JMenuBar  barra = new JMenuBar();
         this.setJMenuBar( barra );

         // agregamos opciones horizontales en la barra del men�...
         JMenu file = new JMenu( "File" );
         JMenu help = new JMenu( "Help" );
         barra.add( file );
         barra.add( help );

         // agregamos los items de opciones en cada opci�n horizontal...
         JMenuItem exit = new JMenuItem ( "Hide" );
         JMenuItem about = new JMenuItem ( "About" );
         JMenuItem print = new JMenuItem ( "Print..." );
         file.add( print );
         file.add( exit );
         help.add( about );

         // notificaciones de captura de eventos...
         exit.addActionListener( new ActionListener()
                                 {
                                    public void actionPerformed( ActionEvent e )
                                    {
                                        doExit( );
                                    }
                                 }
         );

         about.addActionListener( new ActionListener()
                                  {
                                    public void actionPerformed( ActionEvent e )
                                    {
                                        doHelp();
                                    }
                                  }
         );

         print.addActionListener( new ActionListener()
                                  {
                                    public void actionPerformed( ActionEvent e )
                                    {
                                        doPrint();
                                    }
                                  }
         );

    }

    // configura el tama�o y la posici�n inicial de la ventana...
    private void setInitialLook()
    {
         // tomamos la configuraci�n actual de la pantalla...
         Toolkit kit = Toolkit.getDefaultToolkit();
         dim = kit.getScreenSize();
         int alto = dim.height;
         int ancho = dim.width;

         // fijamos el ancho, el alto y las coordenadas de arranque...
         this.setSize ( ancho / 2, alto / 2 );
         this.setLocation( ancho / 4, alto / 4);
    }

    // inicializa el �rea de dibujo de la ventana, agregando un tapiz blanco...
    private void initGraphicArea()
    {
        int alto = dim.height;
        int ancho = dim.width;

        lienzo = new Lienzo();
        db = new BufferedImage( ancho, alto, BufferedImage.TYPE_INT_ARGB );
        cg = db.getGraphics();
        cg.setColor( Color.white );
        cg.fillRect( 0, 0, ancho, alto );
        Container c = getContentPane();
        c.add( lienzo );
    }

    // agrega y configura el bot�n de salida de la ventana
    private void initButton()
    {
         JButton out = new JButton( "Hide" );
         out.addActionListener( new ActionListener()
                                {
                                   public void actionPerformed( ActionEvent e )
                                   {
                                      doExit();
                                   }
                                }
         );

         JPanel jp = new JPanel();
         jp.add( out );

         Container c = this.getContentPane();
         c.add( BorderLayout.SOUTH, jp );
    }

    // cierra la ventana...
    private void doExit()
    {
        this.setVisible( false );
    }

    // muestra una ventanita con datos generales...
    private void doHelp()
    {
        String cad = "GraphicsConsole - Versi�n 1.1.1 - Junio de 2011";
        cad += "\nPowered by Ing. Valerio Frittelli";
        JOptionPane.showMessageDialog( this, cad );
    }

    // activa un proceso de impresi�n...
    private void doPrint()
    {
        // una clase local al m�todo... para controlar la impresi�n...
        class PrintHandler implements Printable
        {
            public int print( Graphics g, PageFormat pf, int pi ) throws PrinterException
            {
                if( pi >= 1 ) return Printable.NO_SUCH_PAGE;
                Graphics2D g2 = ( Graphics2D ) g;
                g2.translate( pf.getImageableX(), pf.getImageableY() );
                Image img = db.getScaledInstance( (int) pf.getImageableWidth(), (int) pf.getImageableHeight(), Image.SCALE_AREA_AVERAGING );
                g2.drawImage( img, 0, 0, GraphicsConsole.this );
                return Printable.PAGE_EXISTS;
            }
        }

        // ajustar configuraci�n de la p�gina... se recomienda impresi�n apaisada...
        PageFormat pf = new PageFormat ();
        pf.setOrientation( PageFormat.LANDSCAPE );

        PrintHandler ph = new PrintHandler();
        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setPrintable( ph, pf );

        // mostrar cuadro de impresi�n, y si todo est� bien, imprimir...
        if( pj.printDialog() )
        {
            try
            {
                pj.print();
            }
            catch( Exception ex )
            {
                ex.printStackTrace();
            }
        }
    }

    //********************************************************
    //************************ M�todos p�blicos y est�ticos...
    //********************************************************

    /**
     *  Obtiene el �nico objeto existente de la clase GraphicsConsole.
     *  Se aplica el patr�n Singleton.
     *  @return el �nico objeto GraphicsConsole que la clase permite crear.
     */
    public static GraphicsConsole getInstance()
    {
        return gc;
    }

    /**
     * Emite un sonido de atenci�n.
     */
    public static void beep()
    {
        Toolkit.getDefaultToolkit().beep();
    }

    /**
     * Provoca una pausa de "milis" milisegundos en la ejecuci�n del programa.
     * @param milis la cantidad de milisegundos que durar� la pausa en la ejecuci�n.
     */
    public static void delay( long milis )
    {
        try
        {
            Thread.sleep( milis );
        }
        catch( InterruptedException e )
        {
        }
    }

    //********************************************************
    //************************************ M�todos p�blicos...
    //********************************************************

    /**
     * Borra el contenido completo del �rea de dibujo. El �rea ser� rellenada con
     * el color blanco.
     */
    public void clear()
    {
        int anc = ( (BufferedImage) db).getWidth();
        int alt = ( (BufferedImage) db).getHeight();
        cg.setColor( Color.white );
        this.clearRect( 0, 0, anc, alt );
    }

    /**
     * Borra el contenido del �rea rectangular especificada por los par�metros.
     * Los l�mites izquierdo y derecho del �rea rectangular a limpiar son (x) y
     * (x + width) respectivamente. Los l�mites superior e inferior del rect�ngulo
     * son (y) y (y + height) respectivamente. Note que el �rea ser� rellenada con
     * el color usado hasta ese momento como color de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     */
    public void clearRect( int x, int y, int width, int height )
    {
        cg.fillRect( x, y, width, height );
        lienzo.repaint( x, y, x + width, y + height );
    }

    /**
     * Copia el contenido del �rea en el rect�ngulo indicado, hacia otra �rea
     * desplazada en dx y dy pixels. El desplazamiento se har� de arriba hacia
     * abajo y hacia la derecha. Si se desea un desplazamiento hacia arriba o
     * hacia la izquierda, especifique valores negativos para dx y dy.
     * Los l�mites izquierdo y derecho del �rea rectangular a copiar son (x) y
     * (x + width) respectivamente. Los l�mites superior e inferior del rect�ngulo
     * son (y) y (y + height) respectivamente.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     * @param dx desplazamiento horizontal para copiar los pixels.
     * @param dy desplazamiento vertical para copiar los pixels.
     */
    public void copyArea( int x, int y, int width, int height, int dx, int dy )
    {
        cg.copyArea( x, y, width, height, dx, dy );
        lienzo.repaint( );
    }

    /**
     * Dibuja el contorno de un rect�ngulo con bordes trabajados para simular un
     * efecto de sobre relieve (raised = true) o bajo relieve (raised = false).
     * Los l�mites izquierdo y derecho del rect�ngulo son (x) y (x + width)
     * respectivamente, aunque gr�ficamente el rect�ngulo acupar� un �rea que
     * llegar� hasta (width + 1) y (height + 1). Los l�mites superior e inferior
     * del rect�ngulo son (y) y (y + height) respectivamente. El color usado ser�
     * el que en ese momento est� fijado como color de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     * @param raised un boolean para indicar si el rect�ngulo debe aparecer elevado o
     * hundido en la ventana.
     */
    public void draw3DRect( int x, int y, int width, int height, boolean raised )
    {
        cg.draw3DRect( x, y, width, height, raised );
        lienzo.repaint( x, y, x + width + 1, y + height + 1 );
    }

    /**
     * Dibuja el contorno de un arco circular o el�ptico, dentro de los l�mites
     * del rect�ngulo indicado. Los l�mites izquierdo y derecho del rect�ngulo
     * son (x) y (x + width) respectivamente. Los l�mites superior e inferior
     * del rect�ngulo son (y) y (y + height) respectivamente. El arco comienza
     * a dibujarse desde el �ngulo indicado por (startAngle) y proseguir� hasta
     * barrer un �ngulo equivalente a (arcAngle). El color usado ser� el que en
     * ese momento est� fijado como color de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     * @param startAngle el �ngulo de inicio del arco a dibujar.
     * @param arcAngle el �ngulo que ser� barrido por el arco.
     */
    public void drawArc( int x, int y, int width, int height, int startAngle, int arcAngle )
    {
        cg.drawArc( x, y, width, height, startAngle, arcAngle );
        lienzo.repaint( x, y, x + width + 1, y + height );
    }

    /**
     * Despliega tanto como sea posible una imagen, comenzando desde el punto
     * superior izquierdo cuyas coordenadas son (x, y). Si el m�todo logr� cargar
     * la imagen completamente, retorna true. Si no logr� cargar por completo la
     * imagen, retorna false. El par�metro img indica el nombre del archivo que
     * contiene a la imagen (que puede ser de tipo img, jpeg o png). Si no se indica
     * la ruta de directorios de ese archivo, se supondr� que el mismo est� en la
     * carpeta del proyecto.
     * @param img el nombre del archivo que contiene a la imagen.
     * @param x coordenada de columna del punto superior izquierdo de la imagen.
     * @param y coordenada de fila del punto superior izquierdo.
     */
    public boolean drawImage( String img, int x, int y )
    {
        Toolkit kit = Toolkit.getDefaultToolkit();
        Image image = kit.createImage( img );
        this.setIconImage( image );
        boolean ok = cg.drawImage( image, x, y, null );
        lienzo.repaint( x, y, image.getWidth(this), image.getHeight(this) );
        this.setIconImage( null );
        return ok;
    }

    /**
     * Despliega tanto como sea posible una imagen, comenzando desde el punto
     * superior izquierdo cuyas coordenadas son (x, y). Si el m�todo logr� cargar
     * la imagen completamente, retorna true. Si no logr� cargar por completo la
     * imagen, retorna false. El par�metro img indica el nombre del archivo que
     * contiene a la imagen que puede ser de tipo img, jpeg o png). Si no se indica
     * la ruta de directorios de ese archivo, se supondr� que el mismo est� en la
     * carpeta del proyecto.
     * @param img el nombre del archivo que contiene a la imagen.
     * @param x coordenada de columna del punto superior izquierdo de la imagen.
     * @param y coordenada de fila del punto superior izquierdo.
     * @param width el ancho del rect�ngulo que contendr� a la imagen.
     * @param height el alto del rect�ngulo.
     */
    public boolean drawImage( String img, int x, int y, int width, int height )
    {
        Toolkit kit = Toolkit.getDefaultToolkit();
        Image image = kit.createImage( img );
        this.setIconImage( image );
        boolean ok = cg.drawImage( image, x, y, width, height, this );
        lienzo.repaint( x, y, width, height );
        this.setIconImage( null );
        return ok;
    }

    /**
     * Dibuja una l�nea, comenzando desde el punto (x1, y1) y terminando en el
     * punto (x2, y2). El color usado ser� el que en ese momento est� fijado como
     * color de dibujo para la ventana.
     * @param x1 coordenada de columna del punto inicial de la l�nea.
     * @param y1 coordenada de fila del punto inicial.
     * @param x2 coordenada de columna del punto final de la l�nea.
     * @param y2 coordenada de fila del punto final.
     */
    public void drawLine( int x1, int y1, int x2, int y2 )
    {
        cg.drawLine( x1, y1, x2, y2 );
        lienzo.repaint( x1, y1, x2 - x1, y2 - y1 );
    }

    /**
     * Dibuja el contorno de un c�rculo o de una elipse, inscripta en el rect�ngulo
     * dado. Los l�mites izquierdo y derecho del rect�ngulo son (x) y (x + width)
     * respectivamente. Los l�mites superior e inferior del rect�ngulo son (y) y
     * (y + height) respectivamente. El color usado ser� el que en ese momento est�
     * fijado como color de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     */
    public void drawOval( int x, int y, int width, int height )
    {
        cg.drawOval( x, y, width, height );
        lienzo.repaint( x, y, x + width, y + height );
    }

    /**
     * Dibuja un pol�gono cerrado con (n) puntos a modo de v�rtices. Las
     * coordenadas (x, y) de cada uno de los (n) puntos est�n dadas por los
     * arreglos (xPoints) e (yPoints). Autom�ticamente ser� trazada una l�nea
     * para unir el �ltimo punto con el primero, salvo que se trate del mismo
     * punto. El color usado ser� el que en ese momento est� fijado como color
     * de dibujo para la ventana.
     * @param xPoints un arreglo con los valores de las coordenadas de columna de
     * los puntos v�rtice del pol�gono.
     * @param yPoints un arreglo con los valores de las coordenadas de fila de
     * los puntos v�rtice del pol�gono.
     * @param n la cantidad de puntos a usar para dibujar el poligono.
     */
    public void drawPolygon( int[] xPoints, int[] yPoints, int n )
    {
        cg.drawPolygon( xPoints, yPoints, n );
        lienzo.repaint();
    }

    /**
     * Dibuja el contorno de un rect�ngulo. Los l�mites izquierdo y derecho del
     * rect�ngulo son (x) y (x + width) respectivamente. Los l�mites superior e
     * inferior del rect�ngulo son (y) y (y + height) respectivamente. El color
     * usado ser� el que en ese momento est� fijado como color de dibujo para
     * la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     */
    public void drawRect( int x, int y, int width, int height )
    {
        cg.drawRect( x, y, width, height );
        lienzo.repaint( x, y, x + width, y + height );
    }

    /**
     * Dibuja el contorno de un rect�ngulo con bordes redondeados. Los l�mites
     * izquierdo y derecho del rect�ngulo son (x) y (x + width) respectivamente.
     * Los l�mites superior e inferior del rect�ngulo son (y) y (y + height)
     * respectivamente. El color usado ser� el que en ese momento est� fijado
     * como color de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     * @param arcWidth di�metro horizontal del arco usado en cada esquina.
     * @param arcHeight di�metro vertical del arco usado en cada esquina.
     */
    public void drawRoundRect( int x, int y, int width, int height, int arcWidth, int arcHeight )
    {
        cg.drawRoundRect( x, y, width, height, arcWidth, arcHeight );
        lienzo.repaint( x, y, x + width, y + height );
    }

    /**
     * Dibuja (muestra...) el contenido de la cadena (s) usando la fuente y el color
     * actualmente activados en la ventana. La l�nea base del caracter m�s a la izquierda
     * de la cadena se ubicar� en la posici�n (x, y).
     * @param s la cadena a dibujar.
     * @param x la coordenada x (columna).
     * @param y la coordenada y (fila).
     */
    public void drawString( String s, int x, int y )
    {
        FontMetrics fm = cg.getFontMetrics();
        Rectangle2D sb = fm.getStringBounds( s, cg );

        cg.drawString( s, x, y );

        int cx = ( int ) sb.getX();
        int cy = ( int ) sb.getY();
        int ancho = cx + ( int ) sb.getWidth();
        int alto = cy + ( int ) sb.getHeight();
        lienzo.repaint( cx, cy, ancho, alto );
    }

    /**
     * Dibuja y rellena (pinta por dentro) un rect�ngulo con bordes trabajados
     * para simular un efecto de sobre relieve (raised = true) o bajo relieve
     * (raised = false). Los l�mites izquierdo y derecho del rect�ngulo son (x)
     * y (x + width) respectivamente, aunque gr�ficamente el rect�ngulo acupar� un
     * �rea que llegar� hasta (width + 1) y (height + 1). Los l�mites superior e
     * inferior del rect�ngulo son (y) y (y + height) respectivamente. El color
     * usado ser� el que en ese momento est� fijado como color de dibujo para la
     * ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     * @param raised un boolean para indicar si el rect�ngulo debe aparecer elevado o
     * hundido en la ventana.
     */
    public void fill3DRect( int x, int y, int width, int height, boolean raised )
    {
        cg.fill3DRect( x, y, width, height, raised );
        lienzo.repaint( x - 1, y - 1, x + width + 1, y + height + 1 );
    }

    /**
     * Dibuja y rellena un arco circular o el�ptico, dentro de los l�mites del
     * rect�ngulo indicado. Los l�mites izquierdo y derecho del rect�ngulo son (x)
     * y (x + width) respectivamente. Los l�mites superior e inferior del rect�ngulo
     * son (y) y (y + height) respectivamente. El arco comienza a dibujarse desde el
     * �ngulo indicado por (startAngle) y proseguir� hasta barrer un �ngulo equivalente
     * a (arcAngle). El color usado ser� el que en ese momento est� fijado como color
     * de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     * @param startAngle el �ngulo de inicio del arco a dibujar.
     * @param arcAngle el �ngulo que ser� barrido por el arco.
     */
    public void fillArc( int x, int y, int width, int height, int startAngle, int arcAngle )
    {
        cg.fillArc( x, y, width, height, startAngle, arcAngle );
        lienzo.repaint( x, y, x + width + 1, y + height );
    }

    /**
     * Dibuja un c�rculo o una elipse, pintada por dentro e inscripta en el rect�ngulo
     * dado. Los l�mites izquierdo y derecho del rect�ngulo son (x) y (x + width)
     * respectivamente. Los l�mites superior e inferior del rect�ngulo son (y) y
     * (y + height) respectivamente. El color usado ser� el que en ese momento est�
     * fijado como color de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     */
    public void fillOval( int x, int y, int width, int height )
    {
        cg.fillOval( x, y, width, height );
        lienzo.repaint( x, y, x + width, y + height );
    }

    /**
     * Dibuja un pol�gono cerrado y pintado por dentro con (n) puntos a modo
     * de v�rtices. Las coordenadas (x, y) de cada uno de los (n) puntos est�n
     * dadas por los arreglos (xPoints) e (yPoints). Autom�ticamente ser� trazada
     * una l�nea para unir el �ltimo punto con el primero, salvo que se trate del
     * mismo punto. El color usado ser� el que en ese momento est� fijado como color
     * de dibujo para la ventana.
     * @param xPoints un arreglo con los valores de las coordenadas de columna de
     * los puntos v�rtice del pol�gono.
     * @param yPoints un arreglo con los valores de las coordenadas de fila de
     * los puntos v�rtice del pol�gono.
     * @param n la cantidad de puntos a usar para dibujar el poligono.
     */
    public void fillPolygon( int[] xPoints, int[] yPoints, int n )
    {
        cg.fillPolygon( xPoints, yPoints, n );
        lienzo.repaint();
    }

    /**
     * Dibuja un rect�ngulo pintado por dentro. Los l�mites izquierdo y derecho del
     * rect�ngulo son (x) y (x + width) respectivamente. Los l�mites superior e
     * inferior del rect�ngulo son (y) y (y + height) respectivamente. El color
     * usado ser� el que en ese momento est� fijado como color de dibujo para
     * la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     */
    public void fillRect( int x, int y, int width, int height )
    {
        cg.fillRect( x, y, width, height );
        lienzo.repaint( x, y, x + width, y + height );
    }

    /**
     * Dibuja un rect�ngulo pintado por dentro, con los bordes redondeados. Los
     * l�mites izquierdo y derecho del rect�ngulo son (x) y (x + width)
     * respectivamente. Los l�mites superior e inferior del rect�ngulo son (y)
     * y (y + height) respectivamente. El color usado ser� el que en ese momento
     * est� fijado como color de dibujo para la ventana.
     * @param x coordenada de columna del punto superior izquierdo del rect�ngulo.
     * @param y coordenada de fila del punto superior izquierdo del rect�ngulo.
     * @param width ancho (en pixels) del rect�ngulo.
     * @param height alto (en pixels) del rect�ngulo.
     * @param arcWidth di�metro horizontal del arco usado en cada esquina.
     * @param arcHeight di�metro vertical del arco usado en cada esquina.
     */
    public void fillRoundRect( int x, int y, int width, int height, int arcWidth, int arcHeight )
    {
        cg.fillRoundRect( x, y, width, height, arcWidth, arcHeight );
        lienzo.repaint( x, y, x + width, y + height );
    }

    /**
     * Retorna el color actualmente usado en esta ventana.
     * @return un objeto Color que representa al color actual.
     */
    public Color getColor()
    {
        return cg.getColor();
    }

    /**
     * Retorna la fuente de caracteres actualmente usada en esta ventana.
     * @return un objeto Font que representa a la fuente actual.
     */
    public Font getFont()
    {
        return cg.getFont();
    }

    /**
     * Retorna las m�tricas de la fuente de caracteres actualmente usada en
     * esta ventana.
     * @return un objeto FontMetrics que permite acceder a las propiedades de la
     * fuente actual.
     */
    public FontMetrics getFontMetrics()
    {
        return cg.getFontMetrics();
    }

    /**
     * Cambia el color de dibujo. El color usado desde la invocaci�n a este m�todo
     * en adelante, ser� el color (c) tomado como par�metro.
     * @param c el nuevo color a usar.
     */
    public void setColor(  Color c )
    {
        cg.setColor( c );
    }

    /**
     * Cambia el tipo de fuente usado para mostrar texto en esta ventana.
     * @param f un objeto representando a la nueva fuente.
     */
    public void setFont( Font f )
    {
        cg.setFont( f );
    }

    /**
     * Cambia origen de coordenadas del contexto gr�fico usado, de forma que el
     * nuevo origen coincidir� con (x, y). Todas las coordenadas usadas de aqu�
     * en adelante ser�n relativas al nuevo origen.
     * @param x la coordenada x del nuevo origen.
     * @param y la coordenada x del nuevo origen.
     */
    public void translate( int x, int y )
    {
        cg.translate( x, y );
    }

    //********************************************************
    //************************************* Clases privadas...
    //********************************************************

    // clase usada para representar al lienzo de dibujo usado
    // para el doble buffering, y permitir un manejo adecuado
    // del m�todo paintComponent()
    private class Lienzo extends JPanel
    {
        public Lienzo()
        {
            setBackground( Color.white );
        }

        public void paintComponent( Graphics g )
        {
            super.paintComponent( g );
            Graphics2D g2 = ( Graphics2D ) g;
            g2.drawImage( db, 0, 0, this );
        }
    }
}


text:
<?php

namespace uk\ac\ox\oppf\www\WSPlate;

class CapturePointList
{

    /**
     * @var CaptureProfile $plateCaptureProfile
     * @access public
     */
    public $plateCaptureProfile = null;

    /**
     * @var ArrayCapturePoint $capturePoints
     * @access public
     */
    public $capturePoints = null;

    /**
     * @var CaptureProfile $dropLocationProfile
     * @access public
     */
    public $dropLocationProfile = null;

}


text:
using BigBook;
using BigBook.Tests.BaseClasses;
using System;
using System.Linq;
using System.Text;
using Xunit;

namespace BigBook.Tests.ExtensionMethods
{
    public class GenericObjectExtensionsTests : TestBaseClass
    {
        protected override System.Type ObjectType { get; set; } = null;

        [Fact]
        public void Execute1()
        {
            Func<int> Temp = () => 1;
            Temp.Execute();
        }

        [Fact]
        public void Execute2()
        {
            Action Temp = Test;
            Assert.Throws<Exception>(() => Temp.Execute());
        }

        [Fact]
        public void If()
        {
            var Temp = new MyTestClass();
            Assert.Same(Temp, Temp.Check(x => x.B == 10));
            Assert.NotSame(Temp, Temp.Check(x => x.B == 1));
        }

        [Fact]
        public void IsDefault()
        {
            Assert.False(new DateTime(1999, 1, 1).Is(default(DateTime)));
            object TestObject = null;
            Assert.True(TestObject.Is(default(object)));
        }

        [Fact]
        public void IsNull()
        {
            Assert.False(new DateTime(1999, 1, 1).Is(default(DateTime)));
            object TestObject = null;
            Assert.True(TestObject.Is(default(object)));
        }

        [Fact]
        public void IsNullOrDBNull()
        {
            Assert.False(new DateTime(1999, 1, 1).Is(default(DateTime)));
            object TestObject = null;
            Assert.True(TestObject.Is(default(object)));
            Assert.True(DBNull.Value.Is(DBNull.Value));
        }

        [Fact]
        public void NotIf()
        {
            var Temp = new MyTestClass();
            Assert.NotSame(Temp, Temp.Check(x => x.B != 10));
            Assert.Same(Temp, Temp.Check(x => x.B != 1));
        }

        [Fact]
        public void NullCheck()
        {
            object TestObject = new DateTime(1999, 1, 1);
            Assert.Equal(TestObject, TestObject.Check());
            Assert.Same(TestObject, TestObject.Check());
            TestObject = null;
            Assert.Equal(new DateTime(1999, 1, 2), TestObject.Check(new DateTime(1999, 1, 2)));
            Assert.Equal(new DateTime(1999, 1, 2), TestObject.Check(x => x != null, new DateTime(1999, 1, 2)));
        }

        [Fact]
        public void ThrowIf()
        {
            object TempObject = null;
            Assert.Throws<ArgumentNullException>(() => TempObject.ThrowIf(x => x == null, new ArgumentNullException("TempName")));
            TempObject.ThrowIf(x => x != null, new ArgumentNullException("TempName"));
        }

        [Fact]
        public void ThrowIfDefault()
        {
            Assert.Throws<ArgumentNullException>(() => default(DateTime).ThrowIfDefault("TempName"));
            Assert.Throws<ArgumentNullException>(() => default(DateTime).ThrowIfDefault(new ArgumentNullException("TempName")));
        }

        [Fact]
        public void ThrowIfFalse()
        {
            Assert.Throws<Exception>(() => "ASDF".ThrowIfNot(x => string.IsNullOrEmpty(x), new Exception()));
            "ASDF".ThrowIfNot(x => !string.IsNullOrEmpty(x), new Exception());
        }

        [Fact]
        public void ThrowIfNotDefault()
        {
            default(DateTime).ThrowIfNotDefault("TempName");
            default(DateTime).ThrowIfNotDefault(new ArgumentNullException("TempName"));
        }

        [Fact]
        public void ThrowIfNotNull()
        {
            object TempObject = null;
            TempObject.ThrowIfNotNull("TempName");
            TempObject.ThrowIfNotNull(new ArgumentNullException("TempName"));
        }

        [Fact]
        public void ThrowIfNotNullOrDBNull()
        {
            DBNull.Value.ThrowIfNotNull("TempName");
            object TempObject = null;
            TempObject.ThrowIfNotNull("TempName");
            DBNull.Value.ThrowIfNotNull(new ArgumentNullException("TempName"));
            TempObject.ThrowIfNotNull(new ArgumentNullException("TempName"));
        }

        [Fact]
        public void ThrowIfNotNullOrEmpty()
        {
            const string TempObject = "";
            TempObject.ThrowIfNotNullOrEmpty("TempName");
            TempObject.ThrowIfNotNullOrEmpty(new ArgumentNullException("TempName"));
        }

        [Fact]
        public void ThrowIfNull()
        {
            object TempObject = null;
            Assert.Throws<ArgumentNullException>(() => TempObject.ThrowIfNull("TempName"));
            Assert.Throws<ArgumentNullException>(() => TempObject.ThrowIfNull(new ArgumentNullException("TempName")));
        }

        [Fact]
        public void ThrowIfNullOrDBNull()
        {
            Assert.Throws<ArgumentNullException>(() => DBNull.Value.ThrowIfNull("TempName"));
            object TempObject = null;
            Assert.Throws<ArgumentNullException>(() => TempObject.ThrowIfNull("TempName"));
            Assert.Throws<ArgumentNullException>(() => DBNull.Value.ThrowIfNull(new ArgumentNullException("TempName")));
            Assert.Throws<ArgumentNullException>(() => TempObject.ThrowIfNull(new ArgumentNullException("TempName")));
        }

        [Fact]
        public void ThrowIfNullOrEmpty()
        {
            const string TempObject = "";
            Assert.Throws<ArgumentNullException>(() => TempObject.ThrowIfNullOrEmpty("TempName"));
            Assert.Throws<ArgumentNullException>(() => TempObject.ThrowIfNullOrEmpty(new ArgumentNullException("TempName")));
        }

        [Fact]
        public void ThrowIfTrue()
        {
            "ASDF".ThrowIf(x => string.IsNullOrEmpty(x), new Exception());
            Assert.Throws<Exception>(() => "ASDF".ThrowIf(x => !string.IsNullOrEmpty(x), new Exception()));
        }

        [Fact]
        public void Times()
        {
            Assert.Equal(new int[] { 0, 1, 2, 3, 4 }.ToList(), 5.Times(x => x));
            var Builder = new StringBuilder();
            5.Times(x => { Builder.Append(x); });
            Assert.Equal("01234", Builder.ToString());
        }

        private void Test() => throw new Exception();

        private enum TestEnum
        {
            Value1 = 0,
            Value2,
            Value3
        }
    }

    internal class MyTestClass
    {
        public MyTestClass()
        {
            B = 10;
        }

        public int B { get; set; }
    }
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

			<title>Docs For Class Dwoo_ITemplate</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>

Interface Dwoo_ITemplate

Description

					Description |
															Methods (details)

interface that represents a dwoo template

This software is provided 'as-is', without any express or implied warranty.  In no event will the authors be held liable for any damages arising from the use of this software.

author: Jordi Boggiano <j.boggiano@seld.be>

version: 1.1.0

copyright: Copyright (c) 2008, Jordi Boggiano

link: http://dwoo.org/

date: 2009-07-18

license: Modified BSD License

			Located in /Dwoo/ITemplate.php (line 17)

Method Summary

			Description |
												Methods (details)

					static 						Dwoo_ITemplate|null|false
										templateFactory
											(Dwoo $dwoo, mixed $resourceId, [int $cacheTime = null], [string $cacheId = null], [string $compileId = null], [Dwoo_ITemplate $parentTemplate = null])

											mixed
										cache
											(Dwoo $dwoo, string $output)

											bool
										clearCache
											(Dwoo $dwoo, [int $olderThan = -1])

											string|bool
										getCachedTemplate
											(Dwoo $dwoo)

											int|null
										getCacheTime
										()

											string
										getCompiledTemplate
											(Dwoo $dwoo, [Dwoo_ICompiler $compiler = null])

											Dwoo_ICompiler
										getCompiler
										()

											string
										getIsModifiedCode
										()

											string
										getName
										()

											string|false
										getResourceIdentifier
										()

											string
										getResourceName
										()

											string
										getSource
										()

											string
										getUid
										()

											void
										setCacheTime
											([int $seconds = null])

Methods

			Description |
																Methods (details)

		static templateFactory (line 149)

returns a new template object from the given resource identifier, null if no include is  possible (resource not found), or false if include is not permitted by this resource type

this method should also check if $dwoo->getSecurityPolicy() is null or not and do the  necessary permission checks if required, if the security policy prevents the template  generation it should throw a new Dwoo_Security_Exception with a relevant message

access: public

		static Dwoo_ITemplate|null|false

			templateFactory

					(Dwoo $dwoo, mixed $resourceId, [int $cacheTime = null], [string $cacheId = null], [string $compileId = null], [Dwoo_ITemplate $parentTemplate = null])

				mixed
				$resourceId: the resource identifier

				int
				$cacheTime: duration of the cache validity for this template,                           if null it defaults to the Dwoo instance that will                           render this template

				string
				$cacheId: the unique cache identifier of this page or anything else that                            makes this template's content unique, if null it defaults                            to the current url

				string
				$compileId: the unique compiled identifier, which is used to distinguish this                              template from others, if null it defaults to the filename+bits of the path

				Dwoo_ITemplate
				$parentTemplate: the template that is requesting a new template object (through                                              an include, extends or any other plugin)

				Dwoo
				$dwoo

		cache (line 56)

caches the provided output into the cache file

return: full path of the cached file or false upon failure

access: public

		mixed

			cache

					(Dwoo $dwoo, string $output)

				Dwoo
				$dwoo: the dwoo instance that requests it

				string
				$output: the template output

		clearCache (line 65)

clears the cached template if it's older than the given time

return: true if the cache was not present or if it was deleted, false if it remains there

access: public

		bool

			clearCache

					(Dwoo $dwoo, [int $olderThan = -1])

				Dwoo
				$dwoo: the dwoo instance that was used to cache that template

				int
				$olderThan: minimum time (in seconds) required for the cache to be cleared

		getCachedTemplate (line 47)

returns the cached template output file name, true if it's cache-able but not cached  or false if it's not cached

access: public

		string|bool

			getCachedTemplate

					(Dwoo $dwoo)

				Dwoo
				$dwoo: the dwoo instance that requests it

		getCacheTime (line 26)

returns the cache duration for this template

defaults to null if it was not provided

access: public

		int|null

			getCacheTime

				()

		getCompiledTemplate (line 74)

returns the compiled template file name

access: public

		string

			getCompiledTemplate

					(Dwoo $dwoo, [Dwoo_ICompiler $compiler = null])

				Dwoo
				$dwoo: the dwoo instance that requests it

				Dwoo_ICompiler
				$compiler: the compiler that must be used

		getCompiler (line 117)

returns the compiler used by this template, if it was just compiled, or null

access: public

		Dwoo_ICompiler

			getCompiler

				()

		getIsModifiedCode (line 126)

returns some php code that will check if this template has been modified or not

if the function returns null, the template will be instanciated and then the Uid checked

access: public

		string

			getIsModifiedCode

				()

		getName (line 81)

returns the template name

access: public

		string

			getName

				()

		getResourceIdentifier (line 95)

returns the resource identifier for this template or false if it has no identifier

access: public

		string|false

			getResourceIdentifier

				()

		getResourceName (line 88)

returns the resource name for this template class

access: public

		string

			getResourceName

				()

		getSource (line 102)

returns the template source of this template

access: public

		string

			getSource

				()

		getUid (line 110)

returns an unique string identifying the current version of this template,  for example a timestamp of the last modified date or a hash of the template source

access: public

		string

			getUid

				()

		setCacheTime (line 38)

sets the cache duration for this template

can be used to set it after the object is created if you did not provide  it in the constructor

access: public

		void

			setCacheTime

					([int $seconds = null])

				int
				$seconds: duration of the cache validity for this template, if  null it defaults to the Dwoo instance's cache time. 0 = disable and  -1 = infinite cache

		Documentation generated on Sun, 07 Feb 2010 17:53:50 +0000 by phpDocumentor 1.4.0


text:
package net.xisberto.magicmuzei.ui;

import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatDelegate;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

import net.xisberto.magicmuzei.R;

public class SettingsActivity extends PreferenceActivity {

    private SettingsFragment settingsFragment;
    private AppCompatDelegate mDelegate;

    public AppCompatDelegate getDelegate() {
        if (mDelegate == null) {
            mDelegate = AppCompatDelegate.create(this, null);
        }
        return mDelegate;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        getDelegate().installViewFactory();
        getDelegate().onCreate(savedInstanceState);
        super.onCreate(savedInstanceState);

        if (savedInstanceState != null) {
            settingsFragment = (SettingsFragment)
                    getFragmentManager().findFragmentById(android.R.id.content);
        } else {
            settingsFragment = new SettingsFragment();
            getFragmentManager().beginTransaction()
                    .add(android.R.id.content, settingsFragment)
                    .commit();
        }

        getDelegate().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        getDelegate().onPostCreate(savedInstanceState);
    }

    @Override
    public void setContentView(int layoutResID) {
        getDelegate().setContentView(layoutResID);
    }

    @Override
    public void setContentView(View view) {
        getDelegate().setContentView(view);
    }

    @Override
    public void setContentView(View view, ViewGroup.LayoutParams params) {
        getDelegate().setContentView(view, params);
    }

    @Override
    protected void onTitleChanged(CharSequence title, int color) {
        super.onTitleChanged(title, color);
        getDelegate().setTitle(title);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        getDelegate().onConfigurationChanged(newConfig);
    }

    @Override
    protected void onPostResume() {
        super.onPostResume();
        getDelegate().onPostResume();
    }

    @Override
    protected void onStop() {
        super.onStop();
        getDelegate().onStop();
    }

    @Override
    public void invalidateOptionsMenu() {
        getDelegate().invalidateOptionsMenu();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        getDelegate().onDestroy();
    }

    @Override
    public void addContentView(View view, ViewGroup.LayoutParams params) {
        getDelegate().addContentView(view, params);
    }

    @NonNull
    @Override
    public MenuInflater getMenuInflater() {
        return getDelegate().getMenuInflater();
    }

    public static class SettingsFragment extends PreferenceFragment {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setRetainInstance(true);
            addPreferencesFromResource(R.xml.preferences);
        }
    }
}


text:
#ifndef GHPIEMODELMAPPER_H
#define GHPIEMODELMAPPER_H
#include "ringqt.h"
#include <QtCharts>
extern "C" {
#include "ring.h"
}

class GHPieModelMapper : public QtCharts::QHPieModelMapper
{

  Q_OBJECT

  public:

    struct VM *pVM;

    struct List *pParaList;

    char ccolumnCountChangedEvent[RINGQT_EVENT_SIZE];
    char cfirstColumnChangedEvent[RINGQT_EVENT_SIZE];
    char clabelsRowChangedEvent[RINGQT_EVENT_SIZE];
    char cmodelReplacedEvent[RINGQT_EVENT_SIZE];
    char cseriesReplacedEvent[RINGQT_EVENT_SIZE];
    char cvaluesRowChangedEvent[RINGQT_EVENT_SIZE];

    GHPieModelMapper(QObject *parent,VM *pVM );

    ~GHPieModelMapper();

    void geteventparameters(void) ;

    void setcolumnCountChangedEvent(const char *cStr);
    void setfirstColumnChangedEvent(const char *cStr);
    void setlabelsRowChangedEvent(const char *cStr);
    void setmodelReplacedEvent(const char *cStr);
    void setseriesReplacedEvent(const char *cStr);
    void setvaluesRowChangedEvent(const char *cStr);

    const char *getcolumnCountChangedEvent(void);
    const char *getfirstColumnChangedEvent(void);
    const char *getlabelsRowChangedEvent(void);
    const char *getmodelReplacedEvent(void);
    const char *getseriesReplacedEvent(void);
    const char *getvaluesRowChangedEvent(void);

  public slots:

    void columnCountChangedSlot();
    void firstColumnChangedSlot();
    void labelsRowChangedSlot();
    void modelReplacedSlot();
    void seriesReplacedSlot();
    void valuesRowChangedSlot();

};

#endif


text:
<?php

namespace AppBundle\Model;

use AppBundle\Model\om\BaseReportEntry;

class ReportEntry extends BaseReportEntry
{
	public $value;

	public $Parent;

    /**
     * return the string representation of this object
     *
     * @return string The value of the 'name' column
     */
    public function __toString()
    {
        return (string) str_repeat('_', abs($this->getLevel())).$this->getNo().' '.substr($this->getName(),0,50);
    }
}


text:
require "docker_helper"

### DOCKER_IMAGE ###############################################################

describe "Docker image", :test => :docker_image do
  # Default Serverspec backend
  before(:each) { set :backend, :docker }

  ### DOCKER_IMAGE #############################################################

  describe docker_image(ENV["DOCKER_IMAGE"]) do
    # Execute Serverspec commands locally
    before(:each) { set :backend, :exec }
    it { is_expected.to exist }
  end

  ### OS #######################################################################

  describe "Operating system" do
    context "family" do
      subject { os[:family] }
      it { is_expected.to eq("alpine") }
    end
  end

  ### PACKAGES #################################################################

  describe "Packages" do

    # [package, version, installer]
    packages = [
      "git",
      "make",
      "nmap",
      "nmap-nping",
      "nmap-nselibs",
      "nmap-scripts",
      "openssh-client",
      ["ruby",                    ENV["RUBY_VERSION"]],
      ["ruby-io-console",         ENV["RUBY_VERSION"]],
      ["ruby-irb",                ENV["RUBY_VERSION"]],
      ["ruby-rdoc",               ENV["RUBY_VERSION"]],
      ["docker-api",              ENV["GEM_DOCKER_API_VERSION"],  "gem"],
      ["rspec",                   ENV["GEM_RSPEC_VERSION"],       "gem"],
      ["specinfra",               ENV["GEM_SPECINFRA_VERSION"],   "gem"],
      ["serverspec",              ENV["GEM_SERVERSPEC_VERSION"],  "gem"],
    ]

    packages.each do |package, version, installer|
      describe package(package) do
        it { is_expected.to be_installed }                        if installer.nil? && version.nil?
        it { is_expected.to be_installed.with_version(version) }  if installer.nil? && ! version.nil?
        it { is_expected.to be_installed.by(installer) }          if ! installer.nil? && version.nil?
        it { is_expected.to be_installed.by(installer).with_version(version) } if ! installer.nil? && ! version.nil?
      end
    end
  end

  ### COMMANDS #################################################################

  describe "Commands" do

    # [command, version, args]
    commands = [
      ["/usr/bin/docker",         ENV["DOCKER_VERSION"]],
      ["/usr/bin/docker-compose", ENV["DOCKER_COMPOSE_VERSION"]],
    ]

    commands.each do |command, version, args|
      describe "Command \"#{command}\"" do
        subject { file(command) }
        let(:version_regex) { /\W#{version}\W/ }
        let(:version_cmd) { "#{command} #{args.nil? ? "--version" : "#{args}"}" }
        it "should be installed#{version.nil? ? nil : " with version \"#{version}\""}" do
          expect(subject).to exist
          expect(subject).to be_executable
          expect(command(version_cmd).stdout).to match(version_regex) unless version.nil?
        end
      end
    end
  end

  ### FILES ####################################################################

  describe "Files" do

    # [file, mode, user, group, [expectations]]
    files = [
      ["/docker-entrypoint.sh", 755, "root", "root", [:be_file]],
    ]

    files.each do |file, mode, user, group, expectations|
      expectations ||= []
      context file(file) do
        it { is_expected.to exist }
        it { is_expected.to be_file }       if expectations.include?(:be_file)
        it { is_expected.to be_directory }  if expectations.include?(:be_directory)
        it { is_expected.to be_mode(mode) } unless mode.nil?
        it { is_expected.to be_owned_by(user) } unless user.nil?
        it { is_expected.to be_grouped_into(group) } unless group.nil?
        its(:sha256sum) do
          is_expected.to eq(
              Digest::SHA256.file("rootfs/#{subject.name}").to_s
          )
        end if expectations.include?(:eq_sha256sum)
      end
    end
  end

  ##############################################################################

end

################################################################################


text:
namespace fractal {
	namespace fscene {
		class TimerObject : public fractal::fscene::Object {
		public:
			TimerObject(const std::string& name);
			virtual ~TimerObject();

			virtual bool initialize();
			void update();
			virtual bool shutdown();

			float getTotalTime() const;

			inline float getDeltaTime() const {
				return static_cast<float>(m_deltaTime);
			}

			void reset();

		private:
			void start();
			void stop();

			bool m_stopped;

			Uint64 m_baseTime;
			Uint64 m_pauseTime;
			Uint64 m_stopTime;
			Uint64 m_previousTime;
			Uint64 m_currentTime;

			double m_secondsPerCount;
			double m_deltaTime;
		};
	}
}

#endif // !_TIMEROBJECT_H


text:
using namespace ArduinoJson;
using namespace ArduinoJson::Internals;

void JsonParser::skipSpaces() {
  while (isspace(*_ptr)) _ptr++;
}

bool JsonParser::skip(char charToSkip) {
  skipSpaces();
  if (*_ptr != charToSkip) return false;
  _ptr++;
  skipSpaces();
  return true;
}

bool JsonParser::skip(const char *wordToSkip) {
  const char *charToSkip = wordToSkip;
  while (*charToSkip && *_ptr == *charToSkip) {
    charToSkip++;
    _ptr++;
  }
  return *charToSkip == '\0';
}

void JsonParser::parseAnythingTo(JsonVariant &destination) {
  if (_nestingLimit == 0) return;
  _nestingLimit--;

  skipSpaces();

  switch (*_ptr) {
    case '[':
      destination = parseArray();
      break;

    case '{':
      destination = parseObject();
      break;

    case 't':
    case 'f':
      parseBooleanTo(destination);
      break;

    case '-':
    case '.':
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      parseNumberTo(destination);
      break;

    case 'n':
      parseNullTo(destination);
      break;

    case '\'':
    case '\"':
      destination = parseString();
      break;
  }

  _nestingLimit++;
}

JsonArray &JsonParser::parseArray() {
  // Create an empty array
  JsonArray &array = _buffer->createArray();

  // Check opening braket
  if (!skip('[')) goto ERROR_MISSING_BRACKET;
  if (skip(']')) goto SUCCESS_EMPTY_ARRAY;

  // Read each value
  for (;;) {
    // 1 - Parse value
    JsonVariant &value = array.add();
    parseAnythingTo(value);
    if (!value.success()) goto ERROR_INVALID_VALUE;

    // 2 - More values?
    if (skip(']')) goto SUCCES_NON_EMPTY_ARRAY;
    if (!skip(',')) goto ERROR_MISSING_COMMA;
  }

SUCCESS_EMPTY_ARRAY:
SUCCES_NON_EMPTY_ARRAY:
  return array;

ERROR_INVALID_VALUE:
ERROR_MISSING_BRACKET:
ERROR_MISSING_COMMA:
  return JsonArray::invalid();
}

JsonObject &JsonParser::parseObject() {
  // Create an empty object
  JsonObject &object = _buffer->createObject();

  // Check opening brace
  if (!skip('{')) goto ERROR_MISSING_BRACE;
  if (skip('}')) goto SUCCESS_EMPTY_OBJECT;

  // Read each key value pair
  for (;;) {
    // 1 - Parse key
    const char *key = parseString();
    if (!key) goto ERROR_INVALID_KEY;
    if (!skip(':')) goto ERROR_MISSING_COLON;

    // 2 - Parse value
    JsonVariant &value = object.add(key);
    parseAnythingTo(value);
    if (!value.success()) goto ERROR_INVALID_VALUE;

    // 3 - More keys/values?
    if (skip('}')) goto SUCCESS_NON_EMPTY_OBJECT;
    if (!skip(',')) goto ERROR_MISSING_COMMA;
  }

SUCCESS_EMPTY_OBJECT:
SUCCESS_NON_EMPTY_OBJECT:
  return object;

ERROR_INVALID_KEY:
ERROR_INVALID_VALUE:
ERROR_MISSING_BRACE:
ERROR_MISSING_COLON:
ERROR_MISSING_COMMA:
  return JsonObject::invalid();
}

void JsonParser::parseBooleanTo(JsonVariant &destination) {
  if (skip("true"))
    destination = true;
  else if (skip("false"))
    destination = false;
  else
    destination = JsonVariant::invalid();
}

void JsonParser::parseNumberTo(JsonVariant &destination) {
  char *endOfLong;
  long longValue = strtol(_ptr, &endOfLong, 10);
  char stopChar = *endOfLong;

  // Could it be a floating point value?
  bool couldBeFloat = stopChar == '.' || stopChar == 'e' || stopChar == 'E';

  if (couldBeFloat) {
    // Yes => parse it as a double
    double doubleValue = strtod(_ptr, &_ptr);
    // Count the decimal digits
    uint8_t decimals = static_cast<uint8_t>(_ptr - endOfLong - 1);
    // Set the variant as a double
    destination.set(doubleValue, decimals);
  } else {
    // No => set the variant as a long
    _ptr = endOfLong;
    destination = longValue;
  }
}

void JsonParser::parseNullTo(JsonVariant &destination) {
  const char *NULL_STRING = NULL;
  if (skip("null"))
    destination = NULL_STRING;
  else
    destination = JsonVariant::invalid();
}

const char *JsonParser::parseString() {
  return QuotedString::extractFrom(_ptr, &_ptr);
}


text:
package java.util

trait Map[K, V] {
  def size(): Int
  def isEmpty(): Boolean
  def containsKey(key: Any): Boolean
  def containsValue(value: Any): Boolean
  def get(key: Any): V
  def put(key: K, value: V): V
  def remove(key: Any): V
  def putAll(m: Map[_ <: K, _ <: V]): Unit
  def clear(): Unit
  def keySet(): Set[K]
  def values(): Collection[V]
  def entrySet(): Set[Map.Entry[K, V]]
  def equals(o: Any): Boolean
  def hashCode(): Int
}

object Map {

  trait Entry[K, V] {
    def getKey(): K
    def getValue(): V
    def setValue(value: V): V
    def equals(o: Any): Boolean
    def hashCode(): Int
  }

}