text:
<!DOCTYPE html>

    <meta charset="UTF-8">

Example pages

First run grunt then browse http://localhost:8080

minimal (just logs events)

minimal with full jquery (just logs events)

maximal (implements all model functions)

redpajama_set_name: RedPajamaGithub


text:
package org.spongepowered.common.mixin.core.block;

import net.minecraft.world.level.block.Block;
import org.spongepowered.api.data.type.DyeColor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.common.bridge.block.DyeColorBlockBridge;

import java.util.Optional;

import javax.annotation.Nullable;

@Mixin(value = {
        Block.Properties.class,
        Block.class
})
public abstract class DyeColorBlockPropertiesMixin implements DyeColorBlockBridge {

    @Nullable private DyeColor impl$dyeColor;

    @Override
    public void bridge$setDyeColor(DyeColor dyeColor) {
        this.impl$dyeColor = dyeColor;
    }

    @Override
    public Optional<DyeColor> bridge$getDyeColor() {
        return Optional.ofNullable(this.impl$dyeColor);
    }

}


text:
class AddReferenceToItem < ActiveRecord::Migration
  def change
    add_reference :items, :user, index: true
  end
end


text:
import { fail } from '../util/assert';
import { DocumentKey } from './document_key';
var Document = /** @class */ (function () {
    function Document(key, version, data, options) {
        this.key = key;
        this.version = version;
        this.data = data;
        this.hasLocalMutations = options.hasLocalMutations;
    }
    Document.prototype.field = function (path) {
        return this.data.field(path);
    };
    Document.prototype.fieldValue = function (path) {
        var field = this.field(path);
        return field ? field.value() : undefined;
    };
    Document.prototype.value = function () {
        return this.data.value();
    };
    Document.prototype.equals = function (other) {
        return (other instanceof Document &&
            this.key.equals(other.key) &&
            this.version.equals(other.version) &&
            this.data.equals(other.data) &&
            this.hasLocalMutations === other.hasLocalMutations);
    };
    Document.prototype.toString = function () {
        return ("Document(" + this.key + ", " + this.version + ", " + this.data.toString() + ", " +
            ("{hasLocalMutations: " + this.hasLocalMutations + "})"));
    };
    Document.compareByKey = function (d1, d2) {
        return DocumentKey.comparator(d1.key, d2.key);
    };
    Document.compareByField = function (field, d1, d2) {
        var v1 = d1.field(field);
        var v2 = d2.field(field);
        if (v1 !== undefined && v2 !== undefined) {
            return v1.compareTo(v2);
        }
        else {
            return fail("Trying to compare documents on fields that don't exist");
        }
    };
    return Document;
}());
export { Document };
/**
 * A class representing a deleted document.
 * Version is set to 0 if we don't point to any specific time, otherwise it
 * denotes time we know it didn't exist at.
 */
var NoDocument = /** @class */ (function () {
    function NoDocument(key, version) {
        this.key = key;
        this.version = version;
    }
    NoDocument.prototype.toString = function () {
        return "NoDocument(" + this.key + ", " + this.version + ")";
    };
    NoDocument.prototype.equals = function (other) {
        return (other && other.version.equals(this.version) && other.key.equals(this.key));
    };
    NoDocument.compareByKey = function (d1, d2) {
        return DocumentKey.comparator(d1.key, d2.key);
    };
    return NoDocument;
}());
export { NoDocument };

//# sourceMappingURL=document.js.map


text:
package info.dourok.lruimage.progress;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;

public class SingleHorizontalProgressDrawable extends ProgressDrawableBase {

    private static final float PROGRESS_INTRINSIC_HEIGHT_DP = 3.2f;
    private static final RectF RECT_BOUND = new RectF(-180, -1, 180, 1);

    private int mProgressIntrinsicHeight;
    private int mProgressIntrinsicWidth;
    private float mTrackAlpha;

    public SingleHorizontalProgressDrawable(Context context) {
        super(context);
        float density = context.getResources().getDisplayMetrics().density;
        mProgressIntrinsicHeight = Math.round(PROGRESS_INTRINSIC_HEIGHT_DP * density);
        mProgressIntrinsicWidth = mProgressIntrinsicHeight * 12;
        mTrackAlpha = getFloatFromAttrRes(android.R.attr.disabledAlpha, context);
    }

    public static float getFloatFromAttrRes(int attrRes, Context context) {
        TypedArray a = context.obtainStyledAttributes(new int[]{attrRes});
        try {
            return a.getFloat(0, 0);
        } finally {
            a.recycle();
        }
    }

    @Override
    public int getIntrinsicHeight() {

        return mProgressIntrinsicHeight;
    }

    @Override
    public int getIntrinsicWidth() {
        return mProgressIntrinsicWidth;
    }

    protected boolean onLevelChange(int level) {
        invalidateSelf();
        return true;
    }

    protected void onPreparePaint(Paint paint) {
        paint.setStyle(Paint.Style.FILL);
    }

    @Override
    protected void onDraw(Canvas canvas, int width, int height, Paint paint) {
        canvas.scale(width / RECT_BOUND.width(), height / RECT_BOUND.height());
        canvas.translate(RECT_BOUND.width() / 2, RECT_BOUND.height() / 2);

        paint.setAlpha(Math.round(mAlpha * mTrackAlpha));
        drawTrackRect(canvas, paint);
        paint.setAlpha(mAlpha);
        drawProgressRect(canvas, paint);
    }

    private static void drawTrackRect(Canvas canvas, Paint paint) {
        canvas.drawRect(RECT_BOUND, paint);
    }

    private void drawProgressRect(Canvas canvas, Paint paint) {

        int level = getLevel();
        if (level == 0) {
            return;
        }
        int saveCount = canvas.save();
        canvas.scale((float) level / LEVEL_MAX, 1, RECT_BOUND.left, 0);
        canvas.drawRect(RECT_BOUND, paint);
        canvas.restoreToCount(saveCount);
    }

}


text:
<?php

include_once(PS_ADMIN_DIR.'/tabs/AdminFeaturesValues.php');

class AdminFeatures extends AdminTab
{
	public function __construct()
	{
		$this->adminFeaturesValues = new AdminFeaturesValues();
		$this->table = 'feature';
		$this->className = 'Feature';
		$this->lang = true;
		$this->edit = true;
		$this->delete = true;

		$this->fieldsDisplay = array(
			'name' => array('title' => $this->l('Name'), 'width' => 128),
			'value' => array('title' => $this->l('Values'), 'width' => 255, 'orderby' => false, 'search' => false));

		parent::__construct();
	}

	public function display()
	{
		global $currentIndex;

		if ((isset($_POST['submitAddfeature_value']) AND sizeof($this->adminFeaturesValues->_errors))
			OR isset($_GET['updatefeature_value']) OR isset($_GET['addfeature_value']))
		{
			$this->adminFeaturesValues->displayForm($this->token);
			echo '

token.'"> '.$this->l('Back to the features list').'
';
		}
		else
			parent::display();
	}

	/* Report to AdminTab::displayList() for more details */
	public function displayList()
	{
		global $currentIndex;

		echo '

			table.'&token='.$this->token.'"> '.$this->l('Add a new feature').'

			token.'"> '.$this->l('Add a new feature value').'

		'.$this->l('Click on a feature name to view its values and then click again if you want to hide them.').'

';

		$this->displayListHeader();
		echo '<input type="hidden" name="groupid" value="0">';

		if (!sizeof($this->_list))
			echo '
_list).'">'.$this->l('No features found.').'
';

		$irow = 0;
		foreach ($this->_list AS $tr)
		{
			$id = (int)($tr['id_'.$this->table]);
			echo '

				<input type="checkbox" name="'.$this->table.'Box[]" value="'.$id.'" class="noborder" />
				'.$tr['name'].'

							<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'feature_value'.$id.'Box[]\', this.checked)" />
							'.$this->l('Value').'
							'.$this->l('Actions').'

';
			$features = FeatureValue::getFeatureValuesWithLang((int)(Configuration::get('PS_LANG_DEFAULT')), $id);
			foreach ($features AS $feature)
			{
				echo '

					<input type="checkbox" name="feature_value'.$id.'Box[]" value="'.$feature['id_feature_value'].'" class="noborder" />
					'.$feature['value'].'

						token.'">
						l('Edit').'" title="'.$this->l('Edit').'" />
						token.'"
						onclick="return confirm(\''.$this->l('Delete value', __CLASS__, true, false).' #'.$feature['id_feature_value'].'?\');">
						l('Delete').'" title="'.$this->l('Delete').'" />

';
			}
			if (!sizeof($features))
				echo '

'.$this->l('No values defined').'
';
			echo '

<input type="Submit" class="button" name="submitDelfeature_value" value="'.$this->l('Delete selection').'"
					onclick="changeFormParam(this.form, \'?tab=AdminFeatures\', '.$id.'); return confirm(\''.$this->l('Delete selected items?', __CLASS__, true, false).'\');" />

						';

			echo '

					table.'='.$id.'&update'.$this->table.'&token='.$this->token.'">
					l('Edit').'" title="'.$this->l('Edit').'" />
					table.'='.$id.'&delete'.$this->table.'&token='.$this->token.'" onclick="return confirm(\''.$this->l('Delete item', __CLASS__, true, false).' #'.$id.'?\');">
					l('Delete').'" title="'.$this->l('Delete').'" />

';
		}

		$this->displayListFooter();

	}

	public function displayForm($isMainTab = true)
	{
		global $currentIndex;
		parent::displayForm();

		if (!($obj = $this->loadObject(true)))
			return;

		echo '

'.$this->l('Add a new feature').'

		<form action="'.$currentIndex.'&token='.$this->token.'"" method="post">
		'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
			<fieldset class="width2">
				<legend>'.$this->l('Add a new feature').'</legend>
				'.$this->l('Name:').'

';
		foreach ($this->_languages AS $language)
			echo '

_defaultFormLanguage ? 'block' : 'none').'; float: left;">
						<input size="33" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /> *
						'.$this->l('Invalid characters:').' <>;=#{}

				';
		$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'flag_fields', 'name', false, true);
		echo '

				'.Module::hookExec('featureForm', array('id_feature' => $obj->id)).'

					<input type="submit" value="'.$this->l('   Save   ').'" name="submitAdd'.$this->table.'" class="button" />

* '.$this->l('Required field').'

			</fieldset>
		</form>';
	}

	public function displayErrors()
	{
		$this->adminFeaturesValues->displayErrors();
		parent::displayErrors();
	}

	public function postProcess()
	{
		global $cookie, $currentIndex;
		$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
		$this->adminFeaturesValues->postProcess($this->token);

		Module::hookExec('postProcessFeature',
		array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessFeature to stop saving process

		if (Tools::getValue('submitDel'.$this->table))
		{
			if ($this->tabAccess['delete'] === '1')
			{
				if (isset($_POST[$this->table.'Box']))
				{
					$object = new $this->className();
					if ($object->deleteSelection($_POST[$this->table.'Box']))
						Tools::redirectAdmin($currentIndex.'&conf=2'.'&token='.$this->token);
					$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
				}
				else
					$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
			}
			else
				$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
		}
		else
			parent::postProcess();
	}
}


text:
package ru.dgolubets.jsmoduleloader.conversions

import java.util.concurrent.CompletableFuture
import java.util.function.BiConsumer

import ru.dgolubets.jsmoduleloader.japi.ScriptModule
import ru.dgolubets.jsmoduleloader.{api, japi}

import scala.concurrent.{Future, Promise}
import scala.language.implicitConversions

/**
 * Implicit conversions to and from Java.
 */
object JavaConversions {

  implicit def asJavaFuture[T](future: Future[T]): CompletableFuture[T] = {

    import scala.concurrent.ExecutionContext.Implicits.global

    val javaFuture = new CompletableFuture[T]
    future.map { module =>
      javaFuture.complete(module)
    } recover {
      case err => javaFuture.completeExceptionally(err)
    }
    javaFuture
  }

  implicit def asScalaFuture[T](future: CompletableFuture[T]): Future[T] = {
    val promise = Promise[T]()

    future.whenComplete(new BiConsumer[T, Throwable] {
      override def accept(t: T, u: Throwable): Unit =
        if(u != null) promise.failure(u)
        else promise.success(t)
    })

    promise.future
  }

  implicit def asScalaScriptModuleReader(reader: japi.readers.ScriptModuleReader): api.readers.ScriptModuleReader =
    new ScalaScriptModuleReaderWrapper(reader)

  implicit def asJavaScriptModuleReader(reader: api.readers.ScriptModuleReader): japi.readers.ScriptModuleReader =
    new JavaScriptModuleReaderWrapper(reader)

  implicit def asJavaScriptModule(module: api.ScriptModule): japi.ScriptModule =
    new ScriptModule(module.value)

}


text:
<?php

include_once('../adodb-time.inc.php');
adodb_date_test();
?>
<?php
//require("adodb-time.inc.php");

$datestring = "2063-12-24"; // string normally from mySQL
$stringArray = explode("-", $datestring);
$date = adodb_mktime(0,0,0,$stringArray[1],$stringArray[2],$stringArray[0]);

$convertedDate = adodb_date("d-M-Y", $date); // converted string to UK style date

echo( "Original: $datestring<br>" );
echo( "Converted: $convertedDate" ); //why is string returned as one day (3 not 4) less for this example??


text:
package org.elasticsearch.action.admin.cluster.snapshots.status;

import org.elasticsearch.Version;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentParserUtils;

import java.io.IOException;

public class SnapshotStats implements Streamable, ToXContentObject {

    private long startTime;
    private long time;
    private int incrementalFileCount;
    private int totalFileCount;
    private int processedFileCount;
    private long incrementalSize;
    private long totalSize;
    private long processedSize;

    SnapshotStats() {
    }

    SnapshotStats(long startTime, long time,
                  int incrementalFileCount, int totalFileCount, int processedFileCount,
                  long incrementalSize, long totalSize, long processedSize) {
        this.startTime = startTime;
        this.time = time;
        this.incrementalFileCount = incrementalFileCount;
        this.totalFileCount = totalFileCount;
        this.processedFileCount = processedFileCount;
        this.incrementalSize = incrementalSize;
        this.totalSize = totalSize;
        this.processedSize = processedSize;
    }

    /**
     * Returns time when snapshot started
     */
    public long getStartTime() {
        return startTime;
    }

    /**
     * Returns snapshot running time
     */
    public long getTime() {
        return time;
    }

    /**
     * Returns incremental file count of the snapshot
     */
    public int getIncrementalFileCount() {
        return incrementalFileCount;
    }

    /**
     * Returns total number of files in the snapshot
     */
    public int getTotalFileCount() {
        return totalFileCount;
    }

    /**
     * Returns number of files in the snapshot that were processed so far
     */
    public int getProcessedFileCount() {
        return processedFileCount;
    }

    /**
     * Return incremental files size of the snapshot
     */
    public long getIncrementalSize() {
        return incrementalSize;
    }

    /**
     * Returns total size of files in the snapshot
     */
    public long getTotalSize() {
        return totalSize;
    }

    /**
     * Returns total size of files in the snapshot that were processed so far
     */
    public long getProcessedSize() {
        return processedSize;
    }

    public static SnapshotStats readSnapshotStats(StreamInput in) throws IOException {
        SnapshotStats stats = new SnapshotStats();
        stats.readFrom(in);
        return stats;
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        out.writeVLong(startTime);
        out.writeVLong(time);

        out.writeVInt(incrementalFileCount);
        out.writeVInt(processedFileCount);

        out.writeVLong(incrementalSize);
        out.writeVLong(processedSize);

        if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
            out.writeVInt(totalFileCount);
            out.writeVLong(totalSize);
        }
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        startTime = in.readVLong();
        time = in.readVLong();

        incrementalFileCount = in.readVInt();
        processedFileCount = in.readVInt();

        incrementalSize = in.readVLong();
        processedSize = in.readVLong();

        if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
            totalFileCount = in.readVInt();
            totalSize = in.readVLong();
        } else {
            totalFileCount = incrementalFileCount;
            totalSize = incrementalSize;
        }
    }

    static final class Fields {
        static final String STATS = "stats";

        static final String INCREMENTAL = "incremental";
        static final String PROCESSED = "processed";
        static final String TOTAL = "total";

        static final String FILE_COUNT = "file_count";
        static final String SIZE = "size";
        static final String SIZE_IN_BYTES = "size_in_bytes";

        static final String START_TIME_IN_MILLIS = "start_time_in_millis";
        static final String TIME_IN_MILLIS = "time_in_millis";
        static final String TIME = "time";

        // BWC
        static final String NUMBER_OF_FILES = "number_of_files";
        static final String PROCESSED_FILES = "processed_files";
        static final String TOTAL_SIZE = "total_size";
        static final String TOTAL_SIZE_IN_BYTES = "total_size_in_bytes";
        static final String PROCESSED_SIZE_IN_BYTES = "processed_size_in_bytes";
        static final String PROCESSED_SIZE = "processed_size";

    }

    @Override
    public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
        builder.startObject();
        {
            builder.startObject(Fields.INCREMENTAL);
            {
                builder.field(Fields.FILE_COUNT, getIncrementalFileCount());
                builder.humanReadableField(Fields.SIZE_IN_BYTES, Fields.SIZE, new ByteSizeValue(getIncrementalSize()));
            }
            builder.endObject();

            if (getProcessedFileCount() != getIncrementalFileCount()) {
                builder.startObject(Fields.PROCESSED);
                {
                    builder.field(Fields.FILE_COUNT, getProcessedFileCount());
                    builder.humanReadableField(Fields.SIZE_IN_BYTES, Fields.SIZE, new ByteSizeValue(getProcessedSize()));
                }
                builder.endObject();
            }

            builder.startObject(Fields.TOTAL);
            {
                builder.field(Fields.FILE_COUNT, getTotalFileCount());
                builder.humanReadableField(Fields.SIZE_IN_BYTES, Fields.SIZE, new ByteSizeValue(getTotalSize()));
            }
            builder.endObject();

            // timings stats
            builder.field(Fields.START_TIME_IN_MILLIS, getStartTime());
            builder.humanReadableField(Fields.TIME_IN_MILLIS, Fields.TIME, new TimeValue(getTime()));

            // BWC part
            builder.field(Fields.NUMBER_OF_FILES, getIncrementalFileCount());
            builder.field(Fields.PROCESSED_FILES, getProcessedFileCount());
            builder.humanReadableField(Fields.TOTAL_SIZE_IN_BYTES, Fields.TOTAL_SIZE, new ByteSizeValue(getIncrementalSize()));
            builder.humanReadableField(Fields.PROCESSED_SIZE_IN_BYTES, Fields.PROCESSED_SIZE, new ByteSizeValue(getProcessedSize()));
            // BWC part ends
        }
        return builder.endObject();
    }

    public static SnapshotStats fromXContent(XContentParser parser) throws IOException {
        // Parse this old school style instead of using the ObjectParser since there's an impedance mismatch between how the
        // object has historically been written as JSON versus how it is structured in Java.
        XContentParser.Token token = parser.currentToken();
        if (token == null) {
            token = parser.nextToken();
        }
        XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation);
        long startTime = 0;
        long time = 0;
        int incrementalFileCount = 0;
        int totalFileCount = 0;
        int processedFileCount = 0;
        long incrementalSize = 0;
        long totalSize = 0;
        long processedSize = 0;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            XContentParserUtils.ensureExpectedToken(XContentParser.Token.FIELD_NAME, token, parser::getTokenLocation);
            String currentName = parser.currentName();
            token = parser.nextToken();
            if (currentName.equals(Fields.INCREMENTAL)) {
                XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation);
                while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
                    XContentParserUtils.ensureExpectedToken(XContentParser.Token.FIELD_NAME, token, parser::getTokenLocation);
                    String innerName = parser.currentName();
                    token = parser.nextToken();
                    if (innerName.equals(Fields.FILE_COUNT)) {
                        XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                        incrementalFileCount = parser.intValue();
                    } else if (innerName.equals(Fields.SIZE_IN_BYTES)) {
                        XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                        incrementalSize = parser.longValue();
                    } else {
                        // Unknown sub field, skip
                        if (token == XContentParser.Token.START_OBJECT || token == XContentParser.Token.START_ARRAY) {
                            parser.skipChildren();
                        }
                    }
                }
            } else if (currentName.equals(Fields.PROCESSED)) {
                XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation);
                while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
                    XContentParserUtils.ensureExpectedToken(XContentParser.Token.FIELD_NAME, token, parser::getTokenLocation);
                    String innerName = parser.currentName();
                    token = parser.nextToken();
                    if (innerName.equals(Fields.FILE_COUNT)) {
                        XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                        processedFileCount = parser.intValue();
                    } else if (innerName.equals(Fields.SIZE_IN_BYTES)) {
                        XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                        processedSize = parser.longValue();
                    } else {
                        // Unknown sub field, skip
                        if (token == XContentParser.Token.START_OBJECT || token == XContentParser.Token.START_ARRAY) {
                            parser.skipChildren();
                        }
                    }
                }
            } else if (currentName.equals(Fields.TOTAL)) {
                XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, token, parser::getTokenLocation);
                while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
                    XContentParserUtils.ensureExpectedToken(XContentParser.Token.FIELD_NAME, token, parser::getTokenLocation);
                    String innerName = parser.currentName();
                    token = parser.nextToken();
                    if (innerName.equals(Fields.FILE_COUNT)) {
                        XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                        totalFileCount = parser.intValue();
                    } else if (innerName.equals(Fields.SIZE_IN_BYTES)) {
                        XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                        totalSize = parser.longValue();
                    } else {
                        // Unknown sub field, skip
                        if (token == XContentParser.Token.START_OBJECT || token == XContentParser.Token.START_ARRAY) {
                            parser.skipChildren();
                        }
                    }
                }
            } else if (currentName.equals(Fields.START_TIME_IN_MILLIS)) {
                XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                startTime = parser.longValue();
            } else if (currentName.equals(Fields.TIME_IN_MILLIS)) {
                XContentParserUtils.ensureExpectedToken(XContentParser.Token.VALUE_NUMBER, token, parser::getTokenLocation);
                time = parser.longValue();
            } else {
                // Unknown field, skip
                if (token == XContentParser.Token.START_OBJECT || token == XContentParser.Token.START_ARRAY) {
                    parser.skipChildren();
                }
            }
        }
        return new SnapshotStats(startTime, time, incrementalFileCount, totalFileCount, processedFileCount, incrementalSize, totalSize,
            processedSize);
    }

    void add(SnapshotStats stats) {
        incrementalFileCount += stats.incrementalFileCount;
        totalFileCount += stats.totalFileCount;
        processedFileCount += stats.processedFileCount;

        incrementalSize += stats.incrementalSize;
        totalSize += stats.totalSize;
        processedSize += stats.processedSize;

        if (startTime == 0) {
            // First time here
            startTime = stats.startTime;
            time = stats.time;
        } else {
            // The time the last snapshot ends
            long endTime = Math.max(startTime + time, stats.startTime + stats.time);

            // The time the first snapshot starts
            startTime = Math.min(startTime, stats.startTime);

            // Update duration
            time = endTime - startTime;
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SnapshotStats that = (SnapshotStats) o;

        if (startTime != that.startTime) return false;
        if (time != that.time) return false;
        if (incrementalFileCount != that.incrementalFileCount) return false;
        if (totalFileCount != that.totalFileCount) return false;
        if (processedFileCount != that.processedFileCount) return false;
        if (incrementalSize != that.incrementalSize) return false;
        if (totalSize != that.totalSize) return false;
        return processedSize == that.processedSize;
    }

    @Override
    public int hashCode() {
        int result = (int) (startTime ^ (startTime >>> 32));
        result = 31 * result + (int) (time ^ (time >>> 32));
        result = 31 * result + incrementalFileCount;
        result = 31 * result + totalFileCount;
        result = 31 * result + processedFileCount;
        result = 31 * result + (int) (incrementalSize ^ (incrementalSize >>> 32));
        result = 31 * result + (int) (totalSize ^ (totalSize >>> 32));
        result = 31 * result + (int) (processedSize ^ (processedSize >>> 32));
        return result;
    }
}


text:
<!DOCTYPE html>

    <title>
        Pop PHP Framework : Documentation
    </title>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="author" content="Pop PHP Framework" />
    <meta name="keywords" content="pop php framework, php, php framework, php library, documentation" />
    <meta name="description" content="This is the Pop PHP Framework documentation." />
    <meta name="robots" content="all" />

    <link rel="stylesheet" type="text/css" href="http://www.popphp.org/css/docs.css" />

Pop PHP Framework

Documentation : Graph

            Home

            Il componente grafico consente per la funzionalità grafica robusto che può utilizzare uno dei componenti predefiniti grafici come immagini, Svg e Pdf per disegnare grafici in una varietà di formati. È possibile definire una vasta gamma di attributi grafici per creare ed eseguire il rendering grafici a linee, istogrammi e grafici a torta. Dal momento che l'API tra le diverse componenti grafici è standard, è molto facile da scambiare tra diversi file e formati di immagine in cui per produrre un grafico.

use Pop\Color\Space\Rgb,
    Pop\Graph\Graph;

$x = array('1995', '2000', '2005', '2010', '2015');
$y = array('0M', '50M', '100M', '150M', '200M');

$data = array(
    array(1995, 0),
    array(1997, 35),
    array(1998, 25),
    array(2002, 100),
    array(2004, 84),
    array(2006, 98),
    array(2007, 76),
    array(2010, 122),
    array(2012, 175),
    array(2015, 162)
);

$graph = new Graph(array(
    'filename' => 'graph.gif',
    'width'    => 640,
    'height'   => 480
));

$graph->addFont('../assets/fonts/times.ttf')
      ->setFontColor(new Rgb(128, 128, 128))
      ->setFillColor(new Rgb(10, 125, 210))
      ->showY(true)
      ->showText(true)
      ->createLineGraph($data, $x, $y)
      ->output();

            © 2009-2014 Moc 10 Media, LLC. All Rights Reserved.