text:
<!DOCTYPE html>

    <title> Flipkart Alerts </title>

    <link href="css/style.css" rel="stylesheet" type="text/css">
    <link href="css/jquery-ui.css" rel="stylesheet" type="text/css">
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">

    <fieldset>
        <legend>Geting Started</legend>

A Scheduled Rule comprises of many parts.

To explain each component, lets consider a requirement where a team needs to be alerted whenever the number of 500 exceptions cross 50 in a span of 5 minutes.

Lets assume that the count of these exceptions are being pushed into Graphite, which would act as a data source while defining the rule.

                Rule Name

This is the name of the rule.
 Lets name it 500Count.

                Team Name

Since we need to monitor the number of 500s on the website, team name can be Website

Team Name is used to group rules.

Data Series

Data Series is a placeholder where you define how you would pull the raw data from any data source.

                Source

This is the name of the data source as defined in Alertz. The name maps to the source connection details for the particular instance of graphite.

In this case w3.graphite represents the instance of graphite at http://w3-api3.nm.flipkart.com/

                Query

The query on Graphite that gives the number of 500s in the last 5 minutes.

from=-6min&until=-1min&target=*.w3.website.core_metrics.500Error._all.Count.per_min.

                Name

An alias for the query.

Lets call it 500CountCurrent

Variables

Variables are custom metrics as defined by the user. These are derived from the data pulled from the data source. These variables will be further used for writing checks.

                Name

This is a Computed metric. Lets call it 500CountSum.

Subsequently it can be accessed as $500CountSum in the checks

                Value

 Alert Service offers default metrics out of the box. You can use any of these to derive the variable value

$min.500CountCurrent

$max.500CountCurrent

$first.500CountCurrent

$last.500CountCurrent

$stdDev.500CountCurrent

$avg.500CountCurrent

$median.500CountCurrent

$sum.500CountCurrent

$75thPercentile.500CountCurrent

$99thPercentile.500CountCurrent

$sum.500CountCurrent

$count.500CountCurrent

Additionally, you can use another variable here.

Here we need $sum.500CountCurrent

You can add any arithmetic operation here.
Example: ($first.500CountCurrent+ $last.500CountCurrent)/2

Checks

This is where you define the threshold.

                Description

Content here will be sent out when there is a breach.

The current 500 count for the last 5 min is $500CountSum

                Boolean Expression

Alert Service uses jexl to evaluate expressions. If this expression is evaluated as true, an alert is raised.

$500CountSum > 50

                Alert Level

Currently Alertz supports alert levels as described in nagios.

0: Info

1: Warning

2: Critical

Schedule

This describes the scheduling details for the rule.

                Start Date

The date when the rule should be first triggered.

2013-07-01

                End Date

The date when the rule should be last triggered.

2015-07-01

                Interval

How often should the rule be triggered

5m

Other examples:

1s runs the rule every second

1m runs the rule every minute

1h runs the rule every hour

1d runs the rule every day

    </fieldset>

redpajama_set_name: RedPajamaGithub


text:
.class public Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;
.super Landroid/widget/FrameLayout;
.source "ActionBarView.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/actionbarsherlock/internal/widget/ActionBarView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "HomeView"
.end annotation

# instance fields
.field private mIconView:Landroid/widget/ImageView;

.field private mUpView:Landroid/view/View;

.field private mUpWidth:I

# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 1211
    const/4 v0, 0x0

    invoke-direct {p0, p1, v0}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 1212
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;

    .prologue
    .line 1215
    invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 1216
    return-void
.end method

# virtual methods
.method public dispatchHoverEvent(Landroid/view/MotionEvent;)Z
    .locals 1
    .param p1, "event"    # Landroid/view/MotionEvent;

    .prologue
    .line 1246
    invoke-virtual {p0, p1}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->onHoverEvent(Landroid/view/MotionEvent;)Z

    move-result v0

    return v0
.end method

.method public dispatchPopulateAccessibilityEvent(Landroid/view/accessibility/AccessibilityEvent;)Z
    .locals 1
    .param p1, "event"    # Landroid/view/accessibility/AccessibilityEvent;

    .prologue
    .line 1228
    invoke-virtual {p0, p1}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->onPopulateAccessibilityEvent(Landroid/view/accessibility/AccessibilityEvent;)V

    .line 1229
    const/4 v0, 0x1

    return v0
.end method

.method public getLeftOffset()I
    .locals 2

    .prologue
    .line 1256
    iget-object v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v0}, Landroid/view/View;->getVisibility()I

    move-result v0

    const/16 v1, 0x8

    if-ne v0, v1, :cond_0

    iget v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpWidth:I

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method protected onFinishInflate()V
    .locals 1

    .prologue
    .line 1251
    sget v0, Lcom/actionbarsherlock/R$id;->abs__up:I

    invoke-virtual {p0, v0}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    .line 1252
    sget v0, Lcom/actionbarsherlock/R$id;->abs__home:I

    invoke-virtual {p0, v0}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    iput-object v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    .line 1253
    return-void
.end method

.method protected onLayout(ZIIII)V
    .locals 15
    .param p1, "changed"    # Z
    .param p2, "l"    # I
    .param p3, "t"    # I
    .param p4, "r"    # I
    .param p5, "b"    # I

    .prologue
    .line 1304
    sub-int v12, p5, p3

    div-int/lit8 v11, v12, 0x2

    .line 1306
    .local v11, "vCenter":I
    const/4 v8, 0x0

    .line 1307
    .local v8, "upOffset":I
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v12}, Landroid/view/View;->getVisibility()I

    move-result v12

    const/16 v13, 0x8

    if-eq v12, v13, :cond_0

    .line 1308
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v12}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v7

    check-cast v7, Landroid/widget/FrameLayout$LayoutParams;

    .line 1309
    .local v7, "upLp":Landroid/widget/FrameLayout$LayoutParams;
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v12}, Landroid/view/View;->getMeasuredHeight()I

    move-result v6

    .line 1310
    .local v6, "upHeight":I
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v12}, Landroid/view/View;->getMeasuredWidth()I

    move-result v10

    .line 1311
    .local v10, "upWidth":I
    div-int/lit8 v12, v6, 0x2

    sub-int v9, v11, v12

    .line 1312
    .local v9, "upTop":I
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    const/4 v13, 0x0

    add-int v14, v9, v6

    invoke-virtual {v12, v13, v9, v10, v14}, Landroid/view/View;->layout(IIII)V

    .line 1313
    iget v12, v7, Landroid/widget/FrameLayout$LayoutParams;->leftMargin:I

    add-int/2addr v12, v10

    iget v13, v7, Landroid/widget/FrameLayout$LayoutParams;->rightMargin:I

    add-int v8, v12, v13

    .line 1315
    add-int p2, p2, v8

    .line 1317
    .end local v6    # "upHeight":I
    .end local v7    # "upLp":Landroid/widget/FrameLayout$LayoutParams;
    .end local v9    # "upTop":I
    .end local v10    # "upWidth":I
    :cond_0
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    invoke-virtual {v12}, Landroid/widget/ImageView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v3

    check-cast v3, Landroid/widget/FrameLayout$LayoutParams;

    .line 1318
    .local v3, "iconLp":Landroid/widget/FrameLayout$LayoutParams;
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    invoke-virtual {v12}, Landroid/widget/ImageView;->getMeasuredHeight()I

    move-result v1

    .line 1319
    .local v1, "iconHeight":I
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    invoke-virtual {v12}, Landroid/widget/ImageView;->getMeasuredWidth()I

    move-result v5

    .line 1320
    .local v5, "iconWidth":I
    sub-int v12, p4, p2

    div-int/lit8 v0, v12, 0x2

    .line 1321
    .local v0, "hCenter":I
    iget v12, v3, Landroid/widget/FrameLayout$LayoutParams;->leftMargin:I

    div-int/lit8 v13, v5, 0x2

    sub-int v13, v0, v13

    invoke-static {v12, v13}, Ljava/lang/Math;->max(II)I

    move-result v12

    add-int v2, v8, v12

    .line 1322
    .local v2, "iconLeft":I
    iget v12, v3, Landroid/widget/FrameLayout$LayoutParams;->topMargin:I

    div-int/lit8 v13, v1, 0x2

    sub-int v13, v11, v13

    invoke-static {v12, v13}, Ljava/lang/Math;->max(II)I

    move-result v4

    .line 1323
    .local v4, "iconTop":I
    iget-object v12, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    add-int v13, v2, v5

    add-int v14, v4, v1

    invoke-virtual {v12, v2, v4, v13, v14}, Landroid/widget/ImageView;->layout(IIII)V

    .line 1324
    return-void
.end method

.method protected onMeasure(II)V
    .locals 13
    .param p1, "widthMeasureSpec"    # I
    .param p2, "heightMeasureSpec"    # I

    .prologue
    .line 1261
    iget-object v1, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    const/4 v3, 0x0

    const/4 v5, 0x0

    move-object v0, p0

    move v2, p1

    move v4, p2

    invoke-virtual/range {v0 .. v5}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->measureChildWithMargins(Landroid/view/View;IIII)V

    .line 1262
    iget-object v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v0}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v10

    check-cast v10, Landroid/widget/FrameLayout$LayoutParams;

    .line 1263
    .local v10, "upLp":Landroid/widget/FrameLayout$LayoutParams;
    iget v0, v10, Landroid/widget/FrameLayout$LayoutParams;->leftMargin:I

    iget-object v1, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v1}, Landroid/view/View;->getMeasuredWidth()I

    move-result v1

    add-int/2addr v0, v1

    iget v1, v10, Landroid/widget/FrameLayout$LayoutParams;->rightMargin:I

    add-int/2addr v0, v1

    iput v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpWidth:I

    .line 1264
    iget-object v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v0}, Landroid/view/View;->getVisibility()I

    move-result v0

    const/16 v1, 0x8

    if-ne v0, v1, :cond_0

    const/4 v3, 0x0

    .line 1265
    .local v3, "width":I
    :goto_0
    iget v0, v10, Landroid/widget/FrameLayout$LayoutParams;->topMargin:I

    iget-object v1, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    invoke-virtual {v1}, Landroid/view/View;->getMeasuredHeight()I

    move-result v1

    add-int/2addr v0, v1

    iget v1, v10, Landroid/widget/FrameLayout$LayoutParams;->bottomMargin:I

    add-int v6, v0, v1

    .line 1266
    .local v6, "height":I
    iget-object v1, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    const/4 v5, 0x0

    move-object v0, p0

    move v2, p1

    move v4, p2

    invoke-virtual/range {v0 .. v5}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->measureChildWithMargins(Landroid/view/View;IIII)V

    .line 1267
    iget-object v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    invoke-virtual {v0}, Landroid/widget/ImageView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v9

    check-cast v9, Landroid/widget/FrameLayout$LayoutParams;

    .line 1268
    .local v9, "iconLp":Landroid/widget/FrameLayout$LayoutParams;
    iget v0, v9, Landroid/widget/FrameLayout$LayoutParams;->leftMargin:I

    iget-object v1, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    invoke-virtual {v1}, Landroid/widget/ImageView;->getMeasuredWidth()I

    move-result v1

    add-int/2addr v0, v1

    iget v1, v9, Landroid/widget/FrameLayout$LayoutParams;->rightMargin:I

    add-int/2addr v0, v1

    add-int/2addr v3, v0

    .line 1269
    iget v0, v9, Landroid/widget/FrameLayout$LayoutParams;->topMargin:I

    iget-object v1, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    .line 1270
    invoke-virtual {v1}, Landroid/widget/ImageView;->getMeasuredHeight()I

    move-result v1

    add-int/2addr v0, v1

    iget v1, v9, Landroid/widget/FrameLayout$LayoutParams;->bottomMargin:I

    add-int/2addr v0, v1

    .line 1269
    invoke-static {v6, v0}, Ljava/lang/Math;->max(II)I

    move-result v6

    .line 1272
    invoke-static {p1}, Landroid/view/View$MeasureSpec;->getMode(I)I

    move-result v11

    .line 1273
    .local v11, "widthMode":I
    invoke-static {p2}, Landroid/view/View$MeasureSpec;->getMode(I)I

    move-result v7

    .line 1274
    .local v7, "heightMode":I
    invoke-static {p1}, Landroid/view/View$MeasureSpec;->getSize(I)I

    move-result v12

    .line 1275
    .local v12, "widthSize":I
    invoke-static {p2}, Landroid/view/View$MeasureSpec;->getSize(I)I

    move-result v8

    .line 1277
    .local v8, "heightSize":I
    sparse-switch v11, :sswitch_data_0

    .line 1288
    :goto_1
    sparse-switch v7, :sswitch_data_1

    .line 1299
    :goto_2
    invoke-virtual {p0, v3, v6}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->setMeasuredDimension(II)V

    .line 1300
    return-void

    .line 1264
    .end local v3    # "width":I
    .end local v6    # "height":I
    .end local v7    # "heightMode":I
    .end local v8    # "heightSize":I
    .end local v9    # "iconLp":Landroid/widget/FrameLayout$LayoutParams;
    .end local v11    # "widthMode":I
    .end local v12    # "widthSize":I
    :cond_0
    iget v3, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpWidth:I

    goto :goto_0

    .line 1279
    .restart local v3    # "width":I
    .restart local v6    # "height":I
    .restart local v7    # "heightMode":I
    .restart local v8    # "heightSize":I
    .restart local v9    # "iconLp":Landroid/widget/FrameLayout$LayoutParams;
    .restart local v11    # "widthMode":I
    .restart local v12    # "widthSize":I
    :sswitch_0
    invoke-static {v3, v12}, Ljava/lang/Math;->min(II)I

    move-result v3

    .line 1280
    goto :goto_1

    .line 1282
    :sswitch_1
    move v3, v12

    .line 1283
    goto :goto_1

    .line 1290
    :sswitch_2
    invoke-static {v6, v8}, Ljava/lang/Math;->min(II)I

    move-result v6

    .line 1291
    goto :goto_2

    .line 1293
    :sswitch_3
    move v6, v8

    .line 1294
    goto :goto_2

    .line 1277
    nop

    :sswitch_data_0
    .sparse-switch
        -0x80000000 -> :sswitch_0
        0x40000000 -> :sswitch_1
    .end sparse-switch

    .line 1288
    :sswitch_data_1
    .sparse-switch
        -0x80000000 -> :sswitch_2
        0x40000000 -> :sswitch_3
    .end sparse-switch
.end method

.method public onPopulateAccessibilityEvent(Landroid/view/accessibility/AccessibilityEvent;)V
    .locals 3
    .param p1, "event"    # Landroid/view/accessibility/AccessibilityEvent;

    .prologue
    .line 1234
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0xe

    if-lt v1, v2, :cond_0

    .line 1235
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->onPopulateAccessibilityEvent(Landroid/view/accessibility/AccessibilityEvent;)V

    .line 1237
    :cond_0
    invoke-virtual {p0}, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->getContentDescription()Ljava/lang/CharSequence;

    move-result-object v0

    .line 1238
    .local v0, "cdesc":Ljava/lang/CharSequence;
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-nez v1, :cond_1

    .line 1239
    invoke-virtual {p1}, Landroid/view/accessibility/AccessibilityEvent;->getText()Ljava/util/List;

    move-result-object v1

    invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 1241
    :cond_1
    return-void
.end method

.method public setIcon(Landroid/graphics/drawable/Drawable;)V
    .locals 1
    .param p1, "icon"    # Landroid/graphics/drawable/Drawable;

    .prologue
    .line 1223
    iget-object v0, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mIconView:Landroid/widget/ImageView;

    invoke-virtual {v0, p1}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 1224
    return-void
.end method

.method public setUp(Z)V
    .locals 2
    .param p1, "isUp"    # Z

    .prologue
    .line 1219
    iget-object v1, p0, Lcom/actionbarsherlock/internal/widget/ActionBarView$HomeView;->mUpView:Landroid/view/View;

    if-eqz p1, :cond_0

    const/4 v0, 0x0

    :goto_0
    invoke-virtual {v1, v0}, Landroid/view/View;->setVisibility(I)V

    .line 1220
    return-void

    .line 1219
    :cond_0
    const/16 v0, 0x8

    goto :goto_0
.end method


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview Imports text files in the Linux event trace format into the
 * Tracemodel. This format is output both by sched_trace and by Linux's perf
 * tool.
 *
 * This importer assumes the events arrive as a string. The unit tests provide
 * examples of the trace format.
 *
 * Linux scheduler traces use a definition for 'pid' that is different than
 * tracing uses. Whereas tracing uses pid to identify a specific process, a pid
 * in a linux trace refers to a specific thread within a process. Within this
 * file, we the definition used in Linux traces, as it improves the importing
 * code's readability.
 */
'use strict';

base.require('tracing.trace_model');
base.require('tracing.color_scheme');
base.require('tracing.importer.linux_perf.bus_parser');
base.require('tracing.importer.linux_perf.clock_parser');
base.require('tracing.importer.linux_perf.cpufreq_parser');
base.require('tracing.importer.linux_perf.disk_parser');
base.require('tracing.importer.linux_perf.drm_parser');
base.require('tracing.importer.linux_perf.exynos_parser');
base.require('tracing.importer.linux_perf.gesture_parser');
base.require('tracing.importer.linux_perf.i915_parser');
base.require('tracing.importer.linux_perf.mali_parser');
base.require('tracing.importer.linux_perf.power_parser');
base.require('tracing.importer.linux_perf.sched_parser');
base.require('tracing.importer.linux_perf.sync_parser');
base.require('tracing.importer.linux_perf.workqueue_parser');
base.require('tracing.importer.linux_perf.android_parser');
base.require('tracing.importer.linux_perf.kfunc_parser');
base.require('tracing.importer.linux_perf.irq_parser');
base.require('tracing.importer.linux_perf.memreclaim_parser');

base.exportTo('tracing.importer', function() {
  /**
   * Represents the scheduling state for a single thread.
   * @constructor
   */
  function CpuState(cpu) {
    this.cpu = cpu;
  }

  CpuState.prototype = {
    __proto__: Object.prototype,

    /**
     * Switches the active pid on this Cpu. If necessary, add a Slice
     * to the cpu representing the time spent on that Cpu since the last call to
     * switchRunningLinuxPid.
     */
    switchRunningLinuxPid: function(importer, prevState, ts, pid, comm, prio) {
      // Generate a slice if the last active pid was not the idle task
      if (this.lastActivePid !== undefined && this.lastActivePid != 0) {
        var duration = ts - this.lastActiveTs;
        var thread = importer.threadsByLinuxPid[this.lastActivePid];
        var name;
        if (thread)
          name = thread.userFriendlyName;
        else
          name = this.lastActiveComm;

        var slice = new tracing.trace_model.Slice(
            '', name,
            tracing.getStringColorId(name),
            this.lastActiveTs,
            {
              comm: this.lastActiveComm,
              tid: this.lastActivePid,
              prio: this.lastActivePrio,
              stateWhenDescheduled: prevState
            },
            duration);
        this.cpu.slices.push(slice);
      }

      this.lastActiveTs = ts;
      this.lastActivePid = pid;
      this.lastActiveComm = comm;
      this.lastActivePrio = prio;
    }
  };

  /**
   * Imports linux perf events into a specified model.
   * @constructor
   */
  function LinuxPerfImporter(model, events) {
    this.importPriority = 2;
    this.model_ = model;
    this.events_ = events;
    this.clockSyncRecords_ = [];
    this.cpuStates_ = {};
    this.wakeups_ = [];
    this.kernelThreadStates_ = {};
    this.buildMapFromLinuxPidsToThreads();
    this.lineNumberBase = 0;
    this.lineNumber = -1;
    this.pseudoThreadCounter = 1;
    this.parsers_ = [];
    this.eventHandlers_ = {};
  }

  var TestExports = {};

  // Matches the trace record in 3.2 and later with the print-tgid option:
  //          <idle>-0    0 [001] d...  1.23: sched_switch
  //
  // A TGID (Thread Group ID) is basically what the Linux kernel calls what
  // userland refers to as a process ID (as opposed to a Linux pid, which is
  // what userland calls a thread ID).
  var lineREWithTGID = new RegExp(
      '^\\s*(.+)-(\\d+)\\s+\\(\\s*(\\d+|-+)\\)\\s\\[(\\d+)\\]' +
      '\\s+[dX.][N.][Hhs.][0-9a-f.]' +
      '\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$');
  var lineParserWithTGID = function(line) {
    var groups = lineREWithTGID.exec(line);
    if (!groups) {
      return groups;
    }

    var tgid = groups[3];
    if (tgid[0] === '-')
      tgid = undefined;

    return {
      threadName: groups[1],
      pid: groups[2],
      tgid: tgid,
      cpuNumber: groups[4],
      timestamp: groups[5],
      eventName: groups[6],
      details: groups[7]
    };
  };
  TestExports.lineParserWithTGID = lineParserWithTGID;

  // Matches the default trace record in 3.2 and later (includes irq-info):
  //          <idle>-0     [001] d...  1.23: sched_switch
  var lineREWithIRQInfo = new RegExp(
      '^\\s*(.+)-(\\d+)\\s+\\[(\\d+)\\]' +
      '\\s+[dX.][N.][Hhs.][0-9a-f.]' +
      '\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$');
  var lineParserWithIRQInfo = function(line) {
    var groups = lineREWithIRQInfo.exec(line);
    if (!groups) {
      return groups;
    }
    return {
      threadName: groups[1],
      pid: groups[2],
      cpuNumber: groups[3],
      timestamp: groups[4],
      eventName: groups[5],
      details: groups[6]
    };
  };
  TestExports.lineParserWithIRQInfo = lineParserWithIRQInfo;

  // Matches the default trace record pre-3.2:
  //          <idle>-0     [001]  1.23: sched_switch
  var lineREWithLegacyFmt =
      /^\s*(.+)-(\d+)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/;
  var lineParserWithLegacyFmt = function(line) {
    var groups = lineREWithLegacyFmt.exec(line);
    if (!groups) {
      return groups;
    }
    return {
      threadName: groups[1],
      pid: groups[2],
      cpuNumber: groups[3],
      timestamp: groups[4],
      eventName: groups[5],
      details: groups[6]
    };
  };
  TestExports.lineParserWithLegacyFmt = lineParserWithLegacyFmt;

  // Matches the trace_event_clock_sync record
  //  0: trace_event_clock_sync: parent_ts=19581477508
  var traceEventClockSyncRE = /trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;
  TestExports.traceEventClockSyncRE = traceEventClockSyncRE;

  // Some kernel trace events are manually classified in slices and
  // hand-assigned a pseudo PID.
  var pseudoKernelPID = 0;

  /**
   * Deduce the format of trace data. Linix kernels prior to 3.3 used one
   * format (by default); 3.4 and later used another.  Additionally, newer
   * kernels can optionally trace the TGID.
   *
   * @return {function} the function for parsing data when the format is
   * recognized; otherwise null.
   */
  function autoDetectLineParser(line) {
    if (line[0] == '{')
      return false;
    if (lineREWithTGID.test(line))
      return lineParserWithTGID;
    if (lineREWithIRQInfo.test(line))
      return lineParserWithIRQInfo;
    if (lineREWithLegacyFmt.test(line))
      return lineParserWithLegacyFmt;
    return null;
  };
  TestExports.autoDetectLineParser = autoDetectLineParser;

  /**
   * Guesses whether the provided events is a Linux perf string.
   * Looks for the magic string "# tracer" at the start of the file,
   * or the typical task-pid-cpu-timestamp-function sequence of a typical
   * trace's body.
   *
   * @return {boolean} True when events is a linux perf array.
   */
  LinuxPerfImporter.canImport = function(events) {
    if (!(typeof(events) === 'string' || events instanceof String))
      return false;

    if (LinuxPerfImporter._extractEventsFromSystraceHTML(events, false).ok)
      return true;

    if (/^# tracer:/.test(events))
      return true;

    var m = /^(.+)\n/.exec(events);
    if (m)
      events = m[1];
    if (autoDetectLineParser(events))
      return true;

    return false;
  };

  LinuxPerfImporter._extractEventsFromSystraceHTML = function(
      incoming_events, produce_result) {
    var failure = {ok: false};
    if (produce_result === undefined)
      produce_result = true;

    if (/^<!DOCTYPE HTML>/.test(incoming_events) == false)
      return failure;
    var lines = incoming_events.split('\n');
    var cur_line = 1;
    function advanceToLineMatching(regex) {
      for (; cur_line < lines.length; cur_line++) {
        if (regex.test(lines[cur_line]))
          return true;
      }
      return false;
    }

    // Try to find the data...
    if (!advanceToLineMatching(/^  <script>$/))
      return failure;
    if (!advanceToLineMatching(/^  var linuxPerfData = "\\$/))
      return failure;
    var events_begin_at_line = cur_line + 1;

    if (!advanceToLineMatching(/^  <\/script>$/))
      return failure;
    var events_end_at_line = cur_line;

    if (!advanceToLineMatching(/^<\/body>$/))
      return failure;
    if (!advanceToLineMatching(/^<\/html>$/))
      return failure;

    var raw_events = lines.slice(events_begin_at_line,
                                 events_end_at_line);
    function endsWith(str, suffix) {
      return str.indexOf(suffix, str.length - suffix.length) !== -1;
    }
    function stripSuffix(str, suffix) {
      if (!endsWith(str, suffix))
        return str;
      return str.substring(str, str.length - suffix.length);
    }

    // Strip off escaping in the file needed to preserve linebreaks.
    var events = [];
    if (produce_result) {
      for (var i = 0; i < raw_events.length; i++) {
        var event = raw_events[i];
        event = stripSuffix(event, '\\n\\');
        events.push(event);
      }
    } else {
      events = [raw_events[raw_events.length - 1]];
    }

    // Last event ends differently. Strip that off too,
    // treating absence of that trailing stirng as a failure.
    var oldLastEvent = events[events.length - 1];
    var newLastEvent = stripSuffix(oldLastEvent, '\\n";');
    if (newLastEvent == oldLastEvent)
      return failure;
    events[events.length - 1] = newLastEvent;

    return {ok: true,
      lines: produce_result ? events : undefined,
      events_begin_at_line: events_begin_at_line};
  };

  LinuxPerfImporter.prototype = {
    __proto__: Object.prototype,

    extractSubtrace: function() {
      return undefined;
    },

    get model() {
      return this.model_;
    },

    /**
     * Precomputes a lookup table from linux pids back to existing
     * Threads. This is used during importing to add information to each
     * thread about whether it was running, descheduled, sleeping, et
     * cetera.
     */
    buildMapFromLinuxPidsToThreads: function() {
      this.threadsByLinuxPid = {};
      this.model_.getAllThreads().forEach(
          function(thread) {
            this.threadsByLinuxPid[thread.tid] = thread;
          }.bind(this));
    },

    /**
     * @return {CpuState} A CpuState corresponding to the given cpuNumber.
     */
    getOrCreateCpuState: function(cpuNumber) {
      if (!this.cpuStates_[cpuNumber]) {
        var cpu = this.model_.kernel.getOrCreateCpu(cpuNumber);
        this.cpuStates_[cpuNumber] = new CpuState(cpu);
      }
      return this.cpuStates_[cpuNumber];
    },

    /**
     * @return {TimelinThread} A thread corresponding to the kernelThreadName.
     */
    getOrCreateKernelThread: function(kernelThreadName, pid, tid) {
      if (!this.kernelThreadStates_[kernelThreadName]) {
        var thread = this.model_.getOrCreateProcess(pid).getOrCreateThread(tid);
        thread.name = kernelThreadName;
        this.kernelThreadStates_[kernelThreadName] = {
          pid: pid,
          thread: thread,
          openSlice: undefined,
          openSliceTS: undefined
        };
        this.threadsByLinuxPid[pid] = thread;
      }
      return this.kernelThreadStates_[kernelThreadName];
    },

    /**
     * @return {TimelinThread} A pseudo thread corresponding to the
     * threadName.  Pseudo threads are for events that we want to break
     * out to a separate timeline but would not otherwise happen.
     * These threads are assigned to pseudoKernelPID and given a
     * unique (incrementing) TID.
     */
    getOrCreatePseudoThread: function(threadName) {
      var thread = this.kernelThreadStates_[threadName];
      if (!thread) {
        thread = this.getOrCreateKernelThread(threadName, pseudoKernelPID,
            this.pseudoThreadCounter);
        this.pseudoThreadCounter++;
      }
      return thread;
    },

    /**
     * Imports the data in this.events_ into model_.
     */
    importEvents: function(isSecondaryImport) {
      this.createParsers();
      this.importCpuData();
      if (!this.alignClocks(isSecondaryImport))
        return;
      this.buildMapFromLinuxPidsToThreads();
      this.buildPerThreadCpuSlicesFromCpuState();
    },

    /**
     * Called by the Model after all other importers have imported their
     * events.
     */
    finalizeImport: function() {
    },

    /**
     * Called by the model to join references between objects, after final model
     * bounds have been computed.
     */
    joinRefs: function() {
    },

    /**
     * Builds the cpuSlices array on each thread based on our knowledge of what
     * each Cpu is doing.  This is done only for Threads that are
     * already in the model, on the assumption that not having any traced data
     * on a thread means that it is not of interest to the user.
     */
    buildPerThreadCpuSlicesFromCpuState: function() {
      // Push the cpu slices to the threads that they run on.
      for (var cpuNumber in this.cpuStates_) {
        var cpuState = this.cpuStates_[cpuNumber];
        var cpu = cpuState.cpu;

        for (var i = 0; i < cpu.slices.length; i++) {
          var slice = cpu.slices[i];

          var thread = this.threadsByLinuxPid[slice.args.tid];
          if (!thread)
            continue;
          if (!thread.tempCpuSlices)
            thread.tempCpuSlices = [];
          thread.tempCpuSlices.push(slice);
        }
      }

      for (var i in this.wakeups_) {
        var wakeup = this.wakeups_[i];
        var thread = this.threadsByLinuxPid[wakeup.tid];
        if (!thread)
          continue;
        thread.tempWakeups = thread.tempWakeups || [];
        thread.tempWakeups.push(wakeup);
      }

      // Create slices for when the thread is not running.
      var runningId = tracing.getColorIdByName('running');
      var runnableId = tracing.getColorIdByName('runnable');
      var sleepingId = tracing.getColorIdByName('sleeping');
      var ioWaitId = tracing.getColorIdByName('iowait');
      this.model_.getAllThreads().forEach(function(thread) {
        if (thread.tempCpuSlices === undefined)
          return;
        var origSlices = thread.tempCpuSlices;
        delete thread.tempCpuSlices;

        origSlices.sort(function(x, y) {
          return x.start - y.start;
        });

        var wakeups = thread.tempWakeups || [];
        delete thread.tempWakeups;
        wakeups.sort(function(x, y) {
          return x.ts - y.ts;
        });

        // Walk the slice list and put slices between each original slice to
        // show when the thread isn't running.
        var slices = [];

        if (origSlices.length) {
          var slice = origSlices[0];

          if (wakeups.length && wakeups[0].ts < slice.start) {
            var wakeup = wakeups.shift();
            var wakeupDuration = slice.start - wakeup.ts;
            var args = {'wakeup from tid': wakeup.fromTid};
            slices.push(new tracing.trace_model.Slice(
                '', 'Runnable', runnableId, wakeup.ts, args, wakeupDuration));
          }

          slices.push(new tracing.trace_model.Slice('', 'Running', runningId,
              slice.start, {}, slice.duration));
        }

        var wakeup = undefined;
        for (var i = 1; i < origSlices.length; i++) {
          var prevSlice = origSlices[i - 1];
          var nextSlice = origSlices[i];
          var midDuration = nextSlice.start - prevSlice.end;
          while (wakeups.length && wakeups[0].ts < nextSlice.start) {
            var w = wakeups.shift();
            if (wakeup === undefined && w.ts > prevSlice.end) {
              wakeup = w;
            }
          }

          // Push a sleep slice onto the slices list, interrupting it with a
          // wakeup if appropriate.
          var pushSleep = function(title, id) {
            if (wakeup !== undefined) {
              midDuration = wakeup.ts - prevSlice.end;
            }
            slices.push(new tracing.trace_model.Slice(
                '', title, id, prevSlice.end, {}, midDuration));
            if (wakeup !== undefined) {
              var wakeupDuration = nextSlice.start - wakeup.ts;
              var args = {'wakeup from tid': wakeup.fromTid};
              slices.push(new tracing.trace_model.Slice(
                  '', 'Runnable', runnableId, wakeup.ts, args, wakeupDuration));
              wakeup = undefined;
            }
          };

          if (prevSlice.args.stateWhenDescheduled == 'S') {
            pushSleep('Sleeping', sleepingId);
          } else if (prevSlice.args.stateWhenDescheduled == 'R' ||
                     prevSlice.args.stateWhenDescheduled == 'R+') {
            slices.push(new tracing.trace_model.Slice(
                '', 'Runnable', runnableId, prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 'D') {
            pushSleep('Uninterruptible Sleep', ioWaitId);
          } else if (prevSlice.args.stateWhenDescheduled == 'T') {
            slices.push(new tracing.trace_model.Slice('', '__TASK_STOPPED',
                ioWaitId, prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 't') {
            slices.push(new tracing.trace_model.Slice('', 'debug', ioWaitId,
                prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 'Z') {
            slices.push(new tracing.trace_model.Slice('', 'Zombie', ioWaitId,
                prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 'X') {
            slices.push(new tracing.trace_model.Slice('', 'Exit Dead', ioWaitId,
                prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 'x') {
            slices.push(new tracing.trace_model.Slice('', 'Task Dead', ioWaitId,
                prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 'K') {
            slices.push(new tracing.trace_model.Slice('', 'Wakekill', ioWaitId,
                prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 'W') {
            slices.push(new tracing.trace_model.Slice('', 'Waking', ioWaitId,
                prevSlice.end, {}, midDuration));
          } else if (prevSlice.args.stateWhenDescheduled == 'D|K') {
            pushSleep('Uninterruptible Sleep | WakeKill', ioWaitId);
          } else if (prevSlice.args.stateWhenDescheduled == 'D|W') {
            pushSleep('Uninterruptible Sleep | Waking', ioWaitId);
          } else {
            slices.push(new tracing.trace_model.Slice('', 'UNKNOWN', ioWaitId,
                prevSlice.end, {}, midDuration));
            this.model_.importErrors.push('Unrecognized sleep state: ' +
                prevSlice.args.stateWhenDescheduled);
          }

          slices.push(new tracing.trace_model.Slice('', 'Running', runningId,
              nextSlice.start, {}, nextSlice.duration));
        }
        thread.cpuSlices = slices;
      }, this);
    },

    /**
     * Walks the slices stored on this.cpuStates_ and adjusts their timestamps
     * based on any alignment metadata we discovered.
     */
    alignClocks: function(isSecondaryImport) {
      if (this.clockSyncRecords_.length == 0) {
        // If this is a secondary import, and no clock syncing records were
        // found, then abort the import. Otherwise, just skip clock alignment.
        if (!isSecondaryImport)
          return true;

        // Remove the newly imported CPU slices from the model.
        this.abortImport();
        return false;
      }

      // Shift all the slice times based on the sync record.
      var sync = this.clockSyncRecords_[0];
      // NB: parentTS of zero denotes no times-shift; this is
      // used when user and kernel event clocks are identical.
      if (sync.parentTS == 0 || sync.parentTS == sync.perfTS)
        return true;
      var timeShift = sync.parentTS - sync.perfTS;
      for (var cpuNumber in this.cpuStates_) {
        var cpuState = this.cpuStates_[cpuNumber];
        var cpu = cpuState.cpu;

        for (var i = 0; i < cpu.slices.length; i++) {
          var slice = cpu.slices[i];
          slice.start = slice.start + timeShift;
          slice.duration = slice.duration;
        }

        for (var counterName in cpu.counters) {
          var counter = cpu.counters[counterName];
          for (var sI = 0; sI < counter.timestamps.length; sI++)
            counter.timestamps[sI] = (counter.timestamps[sI] + timeShift);
        }
      }
      for (var kernelThreadName in this.kernelThreadStates_) {
        var kthread = this.kernelThreadStates_[kernelThreadName];
        var thread = kthread.thread;
        thread.shiftTimestampsForward(timeShift);
      }
      return true;
    },

    /**
     * Removes any data that has been added to the model because of an error
     * detected during the import.
     */
    abortImport: function() {
      if (this.pushedEventsToThreads)
        throw new Error('Cannot abort, have alrady pushedCpuDataToThreads.');

      for (var cpuNumber in this.cpuStates_)
        delete this.model_.kernel.cpus[cpuNumber];
      for (var kernelThreadName in this.kernelThreadStates_) {
        var kthread = this.kernelThreadStates_[kernelThreadName];
        var thread = kthread.thread;
        var process = thread.parent;
        delete process.threads[thread.tid];
        delete this.model_.processes[process.pid];
      }
      this.model_.importErrors.push(
          'Cannot import kernel trace without a clock sync.');
    },

    /**
     * Creates an instance of each registered linux perf event parser.
     * This allows the parsers to register handlers for the events they
     * understand.  We also register our own special handlers (for the
     * timestamp synchronization markers).
     */
    createParsers: function() {
      // Instantiate the parsers; this will register handlers for known events
      var parserConstructors =
          tracing.importer.linux_perf.Parser.getSubtypeConstructors();
      for (var i = 0; i < parserConstructors.length; ++i) {
        var parserConstructor = parserConstructors[i];
        this.parsers_.push(new parserConstructor(this));
      }

      this.registerEventHandler('tracing_mark_write:trace_event_clock_sync',
          LinuxPerfImporter.prototype.traceClockSyncEvent.bind(this));
      this.registerEventHandler('tracing_mark_write',
          LinuxPerfImporter.prototype.traceMarkingWriteEvent.bind(this));
      // NB: old-style trace markers; deprecated
      this.registerEventHandler('0:trace_event_clock_sync',
          LinuxPerfImporter.prototype.traceClockSyncEvent.bind(this));
      this.registerEventHandler('0',
          LinuxPerfImporter.prototype.traceMarkingWriteEvent.bind(this));
    },

    /**
     * Registers a linux perf event parser used by importCpuData.
     */
    registerEventHandler: function(eventName, handler) {
      // TODO(sleffler) how to handle conflicts?
      this.eventHandlers_[eventName] = handler;
    },

    /**
     * Records the fact that a pid has become runnable. This data will
     * eventually get used to derive each thread's cpuSlices array.
     */
    markPidRunnable: function(ts, pid, comm, prio, fromPid) {
      // The the pids that get passed in to this function are Linux kernel
      // pids, which identify threads.  The rest of trace-viewer refers to
      // these as tids, so the change of nomenclature happens in the following
      // construction of the wakeup object.
      this.wakeups_.push({ts: ts, tid: pid, fromTid: fromPid});
    },

    importError: function(message) {
      this.model_.importErrors.push(
          'Line ' + (this.lineNumberBase + this.lineNumber + 1) +
          ': ' + message);
    },

    /**
     * Processes a trace_event_clock_sync event.
     */
    traceClockSyncEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
      var event = /parent_ts=(\d+\.?\d*)/.exec(eventBase.details);
      if (!event)
        return false;

      this.clockSyncRecords_.push({
        perfTS: ts,
        parentTS: event[1] * 1000
      });
      return true;
    },

    /**
     * Processes a trace_marking_write event.
     */
    traceMarkingWriteEvent: function(eventName, cpuNumber, pid, ts, eventBase,
                                     threadName) {
      var event = /^\s*(\w+):\s*(.*)$/.exec(eventBase.details);
      if (!event) {
        // Check if the event matches events traced by the Android framework
        var tag = eventBase.details.substring(0, 2);
        if (tag == 'B|' || tag == 'E' || tag == 'E|' || tag == 'C|' ||
            tag == 'S|' || tag == 'F|') {
          eventBase.subEventName = 'android';
        } else {
          return false;
        }
      } else {
        eventBase.subEventName = event[1];
        eventBase.details = event[2];
      }

      var writeEventName = eventName + ':' + eventBase.subEventName;
      var handler = this.eventHandlers_[writeEventName];
      if (!handler) {
        this.importError('Unknown trace_marking_write event ' + writeEventName);
        return true;
      }
      return handler(writeEventName, cpuNumber, pid, ts, eventBase, threadName);
    },

    /**
     * Walks the this.events_ structure and creates Cpu objects.
     */
    importCpuData: function() {
      var extractResult = LinuxPerfImporter._extractEventsFromSystraceHTML(
          this.events_, true);
      if (extractResult.ok) {
        this.lineNumberBase = extractResult.events_begin_at_line;
        this.lines_ = extractResult.lines;
      } else {
        this.lineNumberBase = 0;
        this.lines_ = this.events_.split('\n');
      }

      var lineParser = null;
      for (this.lineNumber = 0;
           this.lineNumber < this.lines_.length;
          ++this.lineNumber) {
        var line = this.lines_[this.lineNumber];
        if (line.length == 0 || /^#/.test(line))
          continue;
        if (lineParser == null) {
          lineParser = autoDetectLineParser(line);
          if (lineParser == null) {
            this.importError('Cannot parse line: ' + line);
            continue;
          }
        }
        var eventBase = lineParser(line);
        if (!eventBase) {
          this.importError('Unrecognized line: ' + line);
          continue;
        }

        var pid = parseInt(eventBase.pid);
        var cpuNumber = parseInt(eventBase.cpuNumber);
        var ts = parseFloat(eventBase.timestamp) * 1000;
        var eventName = eventBase.eventName;

        var handler = this.eventHandlers_[eventName];
        if (!handler) {
          this.importError('Unknown event ' + eventName + ' (' + line + ')');
          continue;
        }
        if (!handler(eventName, cpuNumber, pid, ts, eventBase))
          this.importError('Malformed ' + eventName + ' event (' + line + ')');
      }
    }
  };

  tracing.TraceModel.registerImporter(LinuxPerfImporter);

  return {
    LinuxPerfImporter: LinuxPerfImporter,
    _LinuxPerfImporterTestExports: TestExports
  };

});


text:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
	http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  <display-name>Web Application</display-name>
  <servlet>
    <servlet-name>ShowServlet</servlet-name>
    <servlet-class>org.lxp.company.servlet.ShowServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ShowServlet</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <listener>
    <listener-class>org.quartz.ee.servlet.QuartzInitializerListener</listener-class>
  </listener>
  <welcome-file-list>
    <welcome-file>/</welcome-file>
  </welcome-file-list>
</web-app>


text:
module ApplicationHelper

  def setPlacemarkViewStatus
    if @story.user_id != current_or_guest_user.id
      @placemarks_owner_class = 'not-owner'
    end
    if @placemarks.none?
    	@no_placemarks = true
    	@placemarks_link_class = 'disabled'
    end
  end

end


text:
var restify = require('restify'),
    config = require('../config'),
    port = process.env.NODE_PORT || config.port;

//
// Credits
// https://github.com/dresende/node-orm2/blob/master/examples/anontxt/app/controllers/_helpers.js
//

function formatErrors(errorsIn) {
  var errors = {};
  var a, e;

  for (a = 0; a < errorsIn.length; a++) {
    e = errorsIn[a];

    errors[e.property] = errors[e.property] || [];
    errors[e.property].push(e.msg);
  }
  return errors;
}

function listFeeds(req, res, next) {
  req.models.feed.all(function(err, feeds) {
    if (err) {
      return next(err);
    }

    res.send(feeds);
    next();
  });
}

function getFeed(req, res, next) {
  req.models.feed.get(req.params.id, function(err, feed) {
    if (err) {
      return next(err);
    }

    res.send(feed);
    next();
  });
}

function createFeed(req, res, next) {
  req.models.feed.create(req.body, function(err, feed) {
    if (err) {
      if (Array.isArray(err)) {
        return res.send(200, {
          errors: formatErrors(err)
        });
      } else {
        return next(err);
      }
    }

    res.send(feed);
    next();
  });
}

function updateFeed(req, res, next) {
  req.models.feed.get(req.params.id, function(err, feed) {
    if (err) {
      if (Array.isArray(err)) {
        return res.send(200, {
          errors: formatErrors(err)
        });
      } else {
        return next(err);
      }
    }

    feed.save(req.body, function(err) {
      if (err) {
        return next(err);
      }

      res.send(feed);
      next();
    });
  });
}

function destroyFeed(req, res, next) {
  req.models.feed.get(req.params.id, function(err, feed) {
    if (err) {
      return next(err);
    }

    feed.remove(function(err) {
      if (err) {
        return next(err);
      }

      res.send(feed);
      next();
    });
  });
}

function listArticles(req, res, next) {
  var Article = req.models.article,
      page = req.query.page,
      query = {};

  if (req.params.feed_id) {
    query.feed_id = parseInt(req.params.feed_id, 10);
  }

  Article.find(query).pages(function(err, pages) {
    if (page < 1) {
      page = 1;
    }

    if (page > pages) {
      page = pages;
    }

    Article.page(page).find(query).order("-published_at").run(function(err, articles) {
      if (err) {
        return next(err);
      }

      res.send(articles);
      next();
    });
  });
}

function getArticle(req, res, next) {
  req.models.article.get(req.params.id, function(err, article) {
    if (err) {
      return next(err);
    }

    res.send(article);
    next();
  });
}

function createServer(db) {
  var server = restify.createServer({
    name: 'dat-rss',
    version: '1.0.0'
  });

  server.pre(restify.pre.pause());
  server.pre(restify.pre.sanitizePath());
  server.pre(restify.pre.userAgentConnection());

  server.use(restify.CORS());
  server.use(restify.dateParser());
  server.use(restify.queryParser());
  server.use(restify.gzipResponse());
  server.use(restify.bodyParser());

  server.use(function(req, res, next) {
    req.models = db.models;
    next();
  });

  server.get('/feeds', listFeeds);
  server.head('/feeds', listFeeds);
  server.get('/feeds/:id', getFeed);
  server.head('/feeds/:id', getFeed);
  server.post('/feeds', createFeed);
  server.put('/feeds/:id', updateFeed);
  server.del('/feeds/:id', destroyFeed);

  server.get('/articles', listArticles);
  server.head('/articles', listArticles);
  server.get('/articles/:id', getArticle);
  server.head('/articles/:id', getArticle);

  server.get('/feeds/:feed_id/articles', listArticles);
  server.head('/feeds/:feed_id/articles', listArticles);
  server.get('/feeds/:feed_id/articles/:id', getArticle);
  server.head('/feeds/:feed_id/articles/:id', getArticle);

  server.get(/\/?.*/, restify.serveStatic({
    directory: './public',
    default: 'index.html'
  }));

  server.on('after', function(req, res, route, err) {
    var latency = Date.now() - req.time();

    console.log('%s %s %s %sms - %s', req.method, req.url, res.statusCode, latency, res.get('Content-Length'));
  });

  server.listen(port, function(err) {
    if (err) {
      throw err;
    }

    console.log('%s listening at %s', server.name, server.url);
  });
}

module.exports = createServer;


text:
'use strict';

/**
 * @ngdoc function
 * @name simpleStepperWebuiApp.controller:inboundRules
 * @description
 * # MainCtrl
 * Controller of the simpleStepperWebuiApp
 */
angular.module('simpleStepperWebuiApp')
  .controller('InboundRulesCtrl', ['$scope', '$http', 'apiEndpoint', function ($scope, $http, apiEndpoint) {
    $scope.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];
    $scope.inboundRules = {};
    $http.get(
        apiEndpoint + '/inboundRules'
      )
      .success(function (data) {
        $scope.inboundRules = data;
      })
      .error(function (data) {
        $scope.inboundRules = data;
      });
  }]);


text:
package org.agileclick.genorm.plugins.dbsupport;

import org.agileclick.genorm.CreatePlugin;
import org.agileclick.genorm.TemplateHelper;
import org.antlr.stringtemplate.*;
import java.io.*;
import org.dom4j.*;
import java.util.*;
import org.agileclick.genorm.Table;
import org.agileclick.genorm.ForeignKeySet;

public class Postgres implements CreatePlugin
	{
	private TemplateHelper m_helper;

	public void init(Element pluginElement, Properties config)
		{
		m_helper = new TemplateHelper();
		}

	public String getFieldEscapeString() { return ("\\\""); }

	public String getCreateSQL(Table table)
		{
		String sql = "";
		try
			{
			StringTemplateGroup tGroup = m_helper.loadTemplateGroup("templates/postgres_create.st");
			StringTemplate createTemplate = tGroup.getInstanceOf("tableCreate");

			Map<String, Object> attributes = new HashMap<String, Object>();
			attributes.put("table", table);
			attributes.putAll(table.getProperties());

			createTemplate.setAttributes(attributes);
			sql = createTemplate.toString().trim();
			}
		catch (IOException ioe)
			{
			ioe.printStackTrace();
			}

		return (sql);
		}

	public String getConstraintSQL(ForeignKeySet keySet)
		{
		String sql = "";
		try
			{
			StringTemplateGroup tGroup = m_helper.loadTemplateGroup("templates/postgres_create.st");
			StringTemplate createTemplate = tGroup.getInstanceOf("fkeyConstraint");

			Map<String, Object> attributes = new HashMap<String, Object>();
			attributes.put("keyset", keySet);

			createTemplate.setAttributes(attributes);
			sql = createTemplate.toString().trim();
			}
		catch (IOException ioe)
			{
			ioe.printStackTrace();
			}

		return (sql);
		}
	}


text:
// Copyright (c) Christof Senn. All rights reserved. See license.txt in the project root for license information.

namespace Remote.Linq.Tests.Serialization.Expressions
{
    using System;
    using System.Linq.Expressions;
    using Xunit;
    using RemoteExpression = Remote.Linq.Expressions.Expression;

    public abstract class When_using_IfElseExpressions
    {
        public class With_binary_formatter : When_using_IfElseExpressions
        {
            public With_binary_formatter()
                : base(BinarySerializationHelper.Clone)
            {
            }
        }

        public class With_data_contract_serializer : When_using_IfElseExpressions
        {
            public With_data_contract_serializer()
                : base(DataContractSerializationHelper.CloneExpression)
            {
            }
        }

        public class With_newtonsoft_json_serializer : When_using_IfElseExpressions
        {
            public With_newtonsoft_json_serializer()
                : base(x => (RemoteExpression)NewtonsoftJsonSerializationHelper.Clone(x, x.GetType()))
            {
            }
        }

        public class With_system_text_json_serializer : When_using_IfElseExpressions
        {
            public With_system_text_json_serializer()
                : base(x => (RemoteExpression)SystemTextJsonSerializationHelper.Clone(x, x.GetType()))
            {
            }
        }

#if NETFRAMEWORK
        public class With_net_data_contract_serializer : When_using_IfElseExpressions
        {
            public With_net_data_contract_serializer()
                : base(NetDataContractSerializationHelper.Clone)
            {
            }
        }
#endif // NETFRAMEWORK

        public class With_protobuf_net_serializer : When_using_IfElseExpressions
        {
            public With_protobuf_net_serializer()
                : base(ProtobufNetSerializationHelper.Clone)
            {
            }
        }

        public class With_xml_serializer : When_using_IfElseExpressions
        {
            public With_xml_serializer()
                : base(XmlSerializationHelper.CloneExpression)
            {
            }
        }

        private readonly Expression _originalExpression;

        private readonly RemoteExpression _remoteExpression;

        private readonly RemoteExpression _serializedRemoteExpression;

        protected When_using_IfElseExpressions(Func<RemoteExpression, RemoteExpression> serialize)
        {
            var expression = Expression.IfThenElse(
                Expression.MakeBinary(ExpressionType.LessThan, Expression.Constant(5), Expression.Constant(2)),
                Expression.Throw(Expression.New(typeof(Exception).GetConstructor(new[] { typeof(string) }), Expression.Constant("The condition is true."))),
                Expression.Throw(Expression.New(typeof(Exception).GetConstructor(new[] { typeof(string) }), Expression.Constant("The condition is false."))));

            _originalExpression = expression;

            _remoteExpression = expression.ToRemoteLinqExpression();

            _serializedRemoteExpression = serialize(_remoteExpression);
        }

        [Fact]
        public void Expression_result_should_be_equal()
        {
            static void Execute(Expression expression) => Expression.Lambda<Action>(expression).Compile()();

            Assert.Throws<Exception>(() => Execute(_originalExpression)).Message.ShouldMatch("The condition is false.");

            Assert.Throws<Exception>(() => Execute(_remoteExpression.ToLinqExpression())).Message.ShouldMatch("The condition is false.");

            Assert.Throws<Exception>(() => Execute(_serializedRemoteExpression.ToLinqExpression())).Message.ShouldMatch("The condition is false.");
        }
    }
}


text:
package com.jmolsmobile.landscapevideocapture.configuration;

import android.support.test.runner.AndroidJUnit4;

import com.jmolsmobile.landscapevideocapture.configuration.PredefinedCaptureConfigurations.CaptureQuality;
import com.jmolsmobile.landscapevideocapture.configuration.PredefinedCaptureConfigurations.CaptureResolution;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertEquals;

@RunWith(AndroidJUnit4.class)
public class CaptureConfigurationTest {

    @Test
    public void defaultConfiguration() throws Exception {
        final CaptureConfiguration config = new CaptureConfiguration();

        checkConfiguration(config, CaptureResolution.RES_720P.width, CaptureResolution.RES_720P.height,
                CaptureResolution.RES_720P.getBitrate(CaptureQuality.HIGH), CaptureConfiguration.NO_DURATION_LIMIT,
                CaptureConfiguration.NO_FILESIZE_LIMIT);
    }

    @Test
    public void predefinedConfiguration() throws Exception {
        final CaptureConfiguration config = new CaptureConfiguration(CaptureResolution.RES_2160P, CaptureQuality.LOW);

        checkConfiguration(config, CaptureResolution.RES_2160P.width, CaptureResolution.RES_2160P.height,
                CaptureResolution.RES_2160P.getBitrate(CaptureQuality.LOW), CaptureConfiguration.NO_DURATION_LIMIT,
                CaptureConfiguration.NO_FILESIZE_LIMIT);
    }

    @Test
    public void predefinedConfigurationWithSizeDuration() throws Exception {
        final CaptureConfiguration config = new CaptureConfiguration(CaptureResolution.RES_1080P,
                CaptureQuality.MEDIUM, 50, 10);

        checkConfiguration(config, CaptureResolution.RES_1080P.width, CaptureResolution.RES_1080P.height,
                CaptureResolution.RES_1080P.getBitrate(CaptureQuality.MEDIUM), 50 * 1000, 10 * 1024 * 1024);
    }

    @Test
    public void configurationWithHeightWidthBitrate() throws Exception {
        final CaptureConfiguration config = new CaptureConfiguration(200, 300, 5000000);

        checkConfiguration(config, 200, 300, 5000000, CaptureConfiguration.NO_DURATION_LIMIT,
                CaptureConfiguration.NO_FILESIZE_LIMIT);
    }

    @Test
    public void configurationWithHeightWidthBitrateSizeDuration() throws Exception {
        final CaptureConfiguration config = new CaptureConfiguration(200, 300, 5000000, 1, 100);

        checkConfiguration(config, 200, 300, 5000000, 1 * 1000, 100 * 1024 * 1024);
    }

    private void checkConfiguration(final CaptureConfiguration config, int width, int height, int bitrate,
                                    int duration, int filesize) {
        assertEquals(config.getVideoWidth(), width);
        assertEquals(config.getVideoHeight(), height);
        assertEquals(config.getVideoBitrate(), bitrate);
        assertEquals(config.getMaxCaptureDuration(), duration);
        assertEquals(config.getMaxCaptureFileSize(), filesize);
    }
}


text:
typedef struct jumpnrun_shot {
  rectangle old_box;
  rectangle current_box;
  vec2d     inertia;
  uint8_t   tick;
} jumpnrun_shot;

enum {
  JUMPNRUN_SHOT_EXTENT = 3,
  JUMPNRUN_SHOT_TICKS_PER_FRAME = 36,
  JUMPNRUN_SHOT_FRAMES = 2
};

static inline bool jumpnrun_shot_spawned(jumpnrun_shot const *shot) { return fixed_point_ne(shot->inertia.x, FIXED_INT(0)); }
static inline void jumpnrun_shot_despawn(jumpnrun_shot       *shot) { shot->inertia.x = FIXED_INT(0); }

void jumpnrun_shot_process(jumpnrun_shot *shot);

#endif


text:
"""foo URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from __future__ import annotations

from django.conf import settings
from django.contrib import admin
from django.urls import include
from django.urls import path

urlpatterns = [
    path("polls/", include("polls.urls")),
    path("admin/", admin.site.urls),
]

if settings.DEBUG:
    import debug_toolbar

    urlpatterns = [
        path("__debug__/", include(debug_toolbar.urls)),
    ] + urlpatterns


text:
import assert from 'assert';

import * as humansCollection from './../helper/humans-collection';
import * as schemaObjects from '../helper/schema-objects';
import * as util from '../../dist/lib/util';
import * as RxDocument from '../../dist/lib/RxDocument';
import * as ChangeEventBuffer from '../../dist/lib/ChangeEventBuffer';

describe('ChangeEventBuffer.test.js', () => {
    describe('basic', () => {
        it('should contains some events', async() => {
            const col = await humansCollection.create(10);
            assert.equal(col._changeEventBuffer.buffer.length, 10);
            col.database.destroy();
        });
        it('should delete older events when buffer get over limit', async() => {
            const col = await humansCollection.create(0);
            col._changeEventBuffer.limit = 10;
            await Promise.all(
                new Array(11).fill(0).map(() => col.insert(schemaObjects.human()))
            );
            assert.equal(col._changeEventBuffer.buffer.length, 10);

            await Promise.all(
                new Array(11).fill(0).map(() => col.insert(schemaObjects.human()))
            );
            assert.equal(col._changeEventBuffer.buffer.length, 10);

            col.database.destroy();
        });
        it('check if correct events get removed', async() => {
            const col = await humansCollection.create(0);
            col._changeEventBuffer.limit = 10;

            await Promise.all(
                new Array(11).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            const last = schemaObjects.human();
            await col.insert(last);
            const lastBufferEvent = col._changeEventBuffer.buffer[col._changeEventBuffer.buffer.length - 1];
            assert.equal(last.passportId, lastBufferEvent.data.v.passportId);

            col.database.destroy();
        });
    });
    describe('.getArrayIndexByPointer()', () => {
        it('throw if pointer is no more in buffer (too low)', async() => {
            const col = await humansCollection.create(0);
            col._changeEventBuffer.limit = 10;
            await Promise.all(
                new Array(11).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            await util.assertThrowsAsync(
                () => col._changeEventBuffer.getArrayIndexByPointer(0),
                Error,
                'lowest'
            );

            await Promise.all(
                new Array(11).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            await util.assertThrowsAsync(
                () => col._changeEventBuffer.getArrayIndexByPointer(10),
                Error,
                'lowest'
            );

            col.database.destroy();
        });
        it('return the right pointer', async() => {
            const col = await humansCollection.create(0);
            let got;
            col._changeEventBuffer.limit = 10;

            await Promise.all(
                new Array(10).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            await util.assertThrowsAsync(
                () => col._changeEventBuffer.getArrayIndexByPointer(0),
                Error,
                'lowest'
            );

            await Promise.all(
                new Array(10).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            got = col._changeEventBuffer.getArrayIndexByPointer(15);
            assert.equal(got, 4);

            await Promise.all(
                new Array(10).fill(0).map(() => col.insert(schemaObjects.human()))
            );
            got = col._changeEventBuffer.getArrayIndexByPointer(25);
            assert.equal(got, 4);

            got = col._changeEventBuffer.getArrayIndexByPointer(21);
            assert.equal(got, 0);

            col.database.destroy();
        });
        it('return the correct pointer', async() => {
            const col = await humansCollection.create(10);
            col._changeEventBuffer.limit = 10;

            const lastDoc = schemaObjects.human();
            await col.insert(lastDoc);

            const gotIndex = col._changeEventBuffer.getArrayIndexByPointer(col._changeEventBuffer.counter);
            assert.equal(col._changeEventBuffer.buffer[gotIndex].data.v.firstName, lastDoc.firstName);

            col.database.destroy();
        });
    });
    describe('.runFrom()', () => {
        it('should run from correctly', async() => {
            const col = await humansCollection.create(0);
            col._changeEventBuffer.limit = 10;

            await Promise.all(
                new Array(10).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            const evs = [];
            col._changeEventBuffer.runFrom(1, function(cE) {
                evs.push(cE);
            });
            assert.equal(evs.length, 10);
            evs.forEach(cE => assert.equal(cE.constructor.name, 'RxChangeEvent'));

            col.database.destroy();
        });
        it('should throw if pointer to low', async() => {
            const col = await humansCollection.create(0);
            col._changeEventBuffer.limit = 10;

            await Promise.all(
                new Array(30).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            const evs = [];
            assert.throws(() => col._changeEventBuffer.runFrom(5, function(cE) {
                evs.push(cE);
            }), Error);

            col.database.destroy();
        });
    });
    describe('.getFrom()', () => {
        it('should getFrom correctly', async() => {
            const col = await humansCollection.create(0);
            col._changeEventBuffer.limit = 10;

            await Promise.all(
                new Array(10).fill(0).map(() => col.insert(schemaObjects.human()))
            );

            const evs = col._changeEventBuffer.getFrom(1);
            assert.equal(evs.length, 10);
            evs.forEach(cE => assert.equal(cE.constructor.name, 'RxChangeEvent'));

            col.database.destroy();
        });
        it('should run correct on remove', async() => {
            const col = await humansCollection.create(0);
            const q = col.find();
            await q.exec();
            await col.insert(schemaObjects.human());
            await q.exec();

            // remove the doc
            const doc = await col.findOne().exec();
            await doc.remove();
            await util.waitUntil(() => col._changeEventBuffer.counter == 2);

            const evs = col._changeEventBuffer.getFrom(q._latestChangeEvent + 1);
            assert.equal(evs.length, 1);
            assert.equal(evs[0].data.op, 'REMOVE');

            col.database.destroy();
        });
    });
    describe('.reduceByLastOfDoc()', () => {
        it('should only have the last changeEvent for the doc', async() => {
            const col = await humansCollection.create(5);
            const q = col.find();
            await q.exec();
            const oneDoc = await col.findOne().exec();
            let newVal = 0;
            while (newVal < 5) {
                newVal++;
                oneDoc.age = newVal;
                await oneDoc.save();
            }
            const allEvents = q.collection._changeEventBuffer.getFrom(1);
            const reduced = q.collection._changeEventBuffer.reduceByLastOfDoc(allEvents);

            assert.equal(reduced.length, 5);
            const lastEvent = reduced.find(cE => cE.data.doc == oneDoc.getPrimary());
            assert.equal(lastEvent.data.v.age, 5);
            col.database.destroy();
        });

    });

});


text:
window.angular.module("plunker.addthis", [

])

.directive("addthisToolbox", ["$document", "$location", "$timeout", "$window", function ($document, $location, $timeout, $window) {
  window.addthis_config = {
    data_track_clickback: false,
    data_track_addressbar: false,
  }

  return {
    restrict: "A",
    link: function ($scope, $element, $attrs) {
      $timeout(function () {
        if (!$window.addthis_config) $window.addthis_config = {};
        if (!$window.addthis_share) $window.addthis_share = {};

        if ($window.addthis) {
          var config = {
            ui_click: true,
            data_track_clickback: false,
            data_track_addressbar: false,
          };
          var sharing = {
            url: ($attrs.addthisPath ? $location.protocol() + "://" + $location.host() + ($location.port() ? ":" + $location.port() : "") + $attrs.addthisPath : $attrs.addthisUrl) || $location.absUrl(),
            title: $attrs.addthisTitle || $attrs.addthisDescription || $document[0].title,
            description: $attrs.addthisDescription || $attrs.addthisTitle || "",
            templates: {
              twitter: "'{{title}}' on @plnkrco: {{url}}",
            },
          };

          $element.addClass("addthis_sharing_toolbox");

          $window.addthis.toolbox($element[0], config, sharing);

        }
      });

      angular.element($document[0].body).on("click", "#at3win a, #at3lb a, #at20mc a", function (e) {
        console.log("E", e);

        e.stopPropagation();
        e.preventDefault();
      });
    }
  }
}])

;


text:
package eu.darken.myolib.processor.classifier;

import eu.darken.myolib.processor.DataPacket;

/**
 * https://github.com/thalmiclabs/myo-bluetooth/blob/master/myohw.h#L345
 */
public class ClassifierEvent extends DataPacket {
    /**
     * Types of classifier events.
     */
    public enum Type {
        ARM_SYNCED((byte) 0x01), ARM_UNSYNCED((byte) 0x02), POSE((byte) 0x03), UNLOCKED((byte) 0x04), LOCKED((byte) 0x05), SYNC_FAILED((byte) 0x06), WARM_UP_RESULT((byte) 0x07);
        private final byte mValue;

        Type(byte value) {
            mValue = value;
        }

        public byte getValue() {
            return mValue;
        }
    }

    private final Type mType;

    protected ClassifierEvent(DataPacket packet, Type type) {
        super(packet.getDeviceAddress(), packet.getTimeStamp());
        mType = type;
    }

    public Type getType() {
        return mType;
    }

}


text:
Parallax Template

A modern responsive front-end framework based on Material Design

          Get Started

<img src="<?=base_url();?>assets/images/background3.jpg" alt="Unsplashed background img 1">


text:
namespace
{
std::vector<char> CreateSoftmaxTfLiteModel(tflite::BuiltinOperator softmaxOperatorCode,
                                           tflite::TensorType tensorType,
                                           const std::vector <int32_t>& tensorShape,
                                           float beta)
{
    using namespace tflite;
    flatbuffers::FlatBufferBuilder flatBufferBuilder;

    std::vector<flatbuffers::Offset<tflite::Buffer>> buffers;
    buffers.push_back(CreateBuffer(flatBufferBuilder, flatBufferBuilder.CreateVector({})));

    std::array<flatbuffers::Offset<Tensor>, 2> tensors;
    tensors[0] = CreateTensor(flatBufferBuilder,
                              flatBufferBuilder.CreateVector<int32_t>(tensorShape.data(),
                                                                      tensorShape.size()),
                              tensorType,
                              0);
    tensors[1] = CreateTensor(flatBufferBuilder,
                              flatBufferBuilder.CreateVector<int32_t>(tensorShape.data(),
                                                                      tensorShape.size()),
                              tensorType,
                              0);

    const std::vector<int32_t> operatorInputs({0});
    const std::vector<int32_t> operatorOutputs({1});

    flatbuffers::Offset<Operator> softmaxOperator;
    flatbuffers::Offset<flatbuffers::String> modelDescription;
    flatbuffers::Offset<OperatorCode> operatorCode;

    switch (softmaxOperatorCode)
    {
        case tflite::BuiltinOperator_SOFTMAX:
            softmaxOperator =
                CreateOperator(flatBufferBuilder,
                               0,
                               flatBufferBuilder.CreateVector<int32_t>(operatorInputs.data(), operatorInputs.size()),
                               flatBufferBuilder.CreateVector<int32_t>(operatorOutputs.data(), operatorOutputs.size()),
                               BuiltinOptions_SoftmaxOptions,
                               CreateSoftmaxOptions(flatBufferBuilder, beta).Union());
                modelDescription = flatBufferBuilder.CreateString("ArmnnDelegate: Softmax Operator Model");
                operatorCode = CreateOperatorCode(flatBufferBuilder,
                                 tflite::BuiltinOperator_SOFTMAX);
            break;
        case tflite::BuiltinOperator_LOG_SOFTMAX:
            softmaxOperator =
                CreateOperator(flatBufferBuilder,
                               0,
                               flatBufferBuilder.CreateVector<int32_t>(operatorInputs.data(), operatorInputs.size()),
                               flatBufferBuilder.CreateVector<int32_t>(operatorOutputs.data(), operatorOutputs.size()),
                               BuiltinOptions_LogSoftmaxOptions,
                               CreateLogSoftmaxOptions(flatBufferBuilder).Union());
                flatBufferBuilder.CreateString("ArmnnDelegate: Log-Softmax Operator Model");
            operatorCode = CreateOperatorCode(flatBufferBuilder,
                                              tflite::BuiltinOperator_LOG_SOFTMAX);
            break;
        default:
            break;
    }
    const std::vector<int32_t> subgraphInputs({0});
    const std::vector<int32_t> subgraphOutputs({1});
    flatbuffers::Offset<SubGraph> subgraph =
        CreateSubGraph(flatBufferBuilder,
                       flatBufferBuilder.CreateVector(tensors.data(), tensors.size()),
                       flatBufferBuilder.CreateVector<int32_t>(subgraphInputs.data(), subgraphInputs.size()),
                       flatBufferBuilder.CreateVector<int32_t>(subgraphOutputs.data(), subgraphOutputs.size()),
                       flatBufferBuilder.CreateVector(&softmaxOperator, 1));
    flatbuffers::Offset<Model> flatbufferModel =
        CreateModel(flatBufferBuilder,
                    TFLITE_SCHEMA_VERSION,
                    flatBufferBuilder.CreateVector(&operatorCode, 1),
                    flatBufferBuilder.CreateVector(&subgraph, 1),
                    modelDescription,
                    flatBufferBuilder.CreateVector(buffers.data(), buffers.size()));
    flatBufferBuilder.Finish(flatbufferModel);
    return std::vector<char>(flatBufferBuilder.GetBufferPointer(),
                             flatBufferBuilder.GetBufferPointer() + flatBufferBuilder.GetSize());
}

void SoftmaxTest(tflite::BuiltinOperator softmaxOperatorCode,
                 tflite::TensorType tensorType,
                 std::vector<armnn::BackendId>& backends,
                 std::vector<int32_t>& shape,
                 std::vector<float>& inputValues,
                 std::vector<float>& expectedOutputValues,
                 float beta = 0)
{
    using namespace tflite;
    std::vector<char> modelBuffer = CreateSoftmaxTfLiteModel(softmaxOperatorCode,
                                                             tensorType,
                                                             shape,
                                                             beta);

    const Model* tfLiteModel = GetModel(modelBuffer.data());
    // Create TfLite Interpreters
    std::unique_ptr<Interpreter> armnnDelegateInterpreter;
    CHECK(InterpreterBuilder(tfLiteModel, ::tflite::ops::builtin::BuiltinOpResolver())
                  (&armnnDelegateInterpreter) == kTfLiteOk);
    CHECK(armnnDelegateInterpreter != nullptr);
    CHECK(armnnDelegateInterpreter->AllocateTensors() == kTfLiteOk);

    std::unique_ptr<Interpreter> tfLiteInterpreter;
    CHECK(InterpreterBuilder(tfLiteModel, ::tflite::ops::builtin::BuiltinOpResolver())
                  (&tfLiteInterpreter) == kTfLiteOk);
    CHECK(tfLiteInterpreter != nullptr);
    CHECK(tfLiteInterpreter->AllocateTensors() == kTfLiteOk);

    // Create the ArmNN Delegate
    armnnDelegate::DelegateOptions delegateOptions(backends);
    std::unique_ptr<TfLiteDelegate, decltype(&armnnDelegate::TfLiteArmnnDelegateDelete)>
        theArmnnDelegate(armnnDelegate::TfLiteArmnnDelegateCreate(delegateOptions),
                         armnnDelegate::TfLiteArmnnDelegateDelete);
    CHECK(theArmnnDelegate != nullptr);
    // Modify armnnDelegateInterpreter to use armnnDelegate
    CHECK(armnnDelegateInterpreter->ModifyGraphWithDelegate(theArmnnDelegate.get()) == kTfLiteOk);

    // Set input data
    auto tfLiteDelegateInputId = tfLiteInterpreter->inputs()[0];
    auto tfLiteInterpreterInputData = tfLiteInterpreter->typed_tensor<float>(tfLiteDelegateInputId);
    for (unsigned int i = 0; i < inputValues.size(); ++i)
    {
        tfLiteInterpreterInputData[i] = inputValues[i];
    }

    auto armnnDelegateInputId = armnnDelegateInterpreter->inputs()[0];
    auto armnnDelegateInputData = armnnDelegateInterpreter->typed_tensor<float>(armnnDelegateInputId);
    for (unsigned int i = 0; i < inputValues.size(); ++i)
    {
        armnnDelegateInputData[i] = inputValues[i];
    }
    // Run EnqueWorkload
    CHECK(tfLiteInterpreter->Invoke() == kTfLiteOk);
    CHECK(armnnDelegateInterpreter->Invoke() == kTfLiteOk);

    // Compare output data
    auto tfLiteInterpreterOutputId = tfLiteInterpreter->outputs()[0];
    auto tfLiteInterpreterOutputData = tfLiteInterpreter->typed_tensor<float>(tfLiteInterpreterOutputId);
    auto armnnDelegateOutputId = armnnDelegateInterpreter->outputs()[0];
    auto armnnDelegateOutputData = armnnDelegateInterpreter->typed_tensor<float>(armnnDelegateOutputId);

    for (size_t i = 0; i < inputValues.size(); ++i)
    {
         CHECK(armnnUtils::within_percentage_tolerance(expectedOutputValues[i], armnnDelegateOutputData[i], 0.1));
         CHECK(armnnUtils::within_percentage_tolerance(tfLiteInterpreterOutputData[i],
                                                       armnnDelegateOutputData[i], 0.1));
    }
}

/// Convenience function to run softmax and log-softmax test cases
/// \param operatorCode tflite::BuiltinOperator_SOFTMAX or tflite::BuiltinOperator_LOG_SOFTMAX
/// \param backends armnn backends to target
/// \param beta multiplicative parameter to the softmax function
/// \param expectedOutput to be checked against transformed input
void SoftmaxTestCase(tflite::BuiltinOperator operatorCode,
                     std::vector<armnn::BackendId> backends, float beta, std::vector<float> expectedOutput) {
    std::vector<float> input = {
        1.0, 2.5, 3.0, 4.5, 5.0,
        -1.0, -2.5, -3.0, -4.5, -5.0};
    std::vector<int32_t> shape = {2, 5};

    SoftmaxTest(operatorCode,
                tflite::TensorType_FLOAT32,
                backends,
                shape,
                input,
                expectedOutput,
                beta);
}

} // anonymous namespace


text:
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->

        <title>Fixed Top Navbar Example for Bootstrap</title>

        <!-- Bootstrap core CSS -->
        <link href="pipiwyg-accrue/css/bootstrap.min.css" rel="stylesheet">

        <link href="//fonts.googleapis.com/css?family=Archivo+Narrow" rel="stylesheet" type="text/css">

        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
        <link href="pipiwyg-accrue/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="pipiwyg-accrue/css/accrue-navbar-fixed-top.css" rel="stylesheet">

        <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
        <!--[if lt IE 9]><script src="pipiwyg-accrue/js/ie8-responsive-file-warning.js"></script><![endif]-->
        <script src="pipiwyg-accrue/js/ie-emulation-modes-warning.js"></script>

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>

        @yield('document-body')

        <!-- Bootstrap core JavaScript
        ================================================== -->
        <!-- Placed at the end of the document so the pages load faster -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="pipiwyg-accrue/js/jquery.min.js"><\/script>')</script>
        <script src="pipiwyg-accrue/js/bootstrap.min.js"></script>
        <script src="pipiwyg-accrue/js/accrue.js"></script>
        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
        <script src="pipiwyg-accrue/js/ie10-viewport-bug-workaround.js"></script>

    </body>
</html>


text:
using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

	// Use this for initialization
	public void Initialize(){
	}
}


text:
    <button class="btn btn-default pager-left" ng-click="selectPrevWeek($event)">

    </button>

			            {{::week.date | date: 'MMM'}}

						{{::week.date | date: 'd'}}

    <button class="btn btn-default pager-right" ng-click="selectNextWeek($event)">

    </button>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;

namespace FormFactory.Tests
{
    public class InheritanceTests
    {
        [Test]
        public void FindsInheritedProperties()
        {
            var model = new InhertitingClass();
            var propertyVmsUsingReflection = FF.GetPropertyVmsUsingReflection(model, typeof(object)).ToList();
            Assert.IsNotNull(propertyVmsUsingReflection.SingleOrDefault(_ => _.Name == nameof(BaseClass.BaseClassStringProperty)), $"Inherited property '{nameof(BaseClass.BaseClassStringProperty)}' missing.");
        }

        class BaseClass
        {
            public string BaseClassStringProperty { get; set; }
        }

        class InhertitingClass : BaseClass
        {
            public string InheritingClassStringProperty { get; set; }
        }
    }
}


text:
package otto

import (
	"math"
	"math/rand"
)

// Math

func builtinMath_abs(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Abs(number))
}

func builtinMath_acos(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Acos(number))
}

func builtinMath_asin(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Asin(number))
}

func builtinMath_atan(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Atan(number))
}

func builtinMath_atan2(call FunctionCall) Value {
	y := call.Argument(0).float64()
	if math.IsNaN(y) {
		return NaNValue()
	}
	x := call.Argument(1).float64()
	if math.IsNaN(x) {
		return NaNValue()
	}
	return toValue_float64(math.Atan2(y, x))
}

func builtinMath_cos(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Cos(number))
}

func builtinMath_ceil(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Ceil(number))
}

func builtinMath_exp(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Exp(number))
}

func builtinMath_floor(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Floor(number))
}

func builtinMath_log(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Log(number))
}

func builtinMath_max(call FunctionCall) Value {
	switch len(call.ArgumentList) {
	case 0:
		return negativeInfinityValue()
	case 1:
		return toValue_float64(call.ArgumentList[0].float64())
	}
	result := call.ArgumentList[0].float64()
	if math.IsNaN(result) {
		return NaNValue()
	}
	for _, value := range call.ArgumentList[1:] {
		value := value.float64()
		if math.IsNaN(value) {
			return NaNValue()
		}
		result = math.Max(result, value)
	}
	return toValue_float64(result)
}

func builtinMath_min(call FunctionCall) Value {
	switch len(call.ArgumentList) {
	case 0:
		return positiveInfinityValue()
	case 1:
		return toValue_float64(call.ArgumentList[0].float64())
	}
	result := call.ArgumentList[0].float64()
	if math.IsNaN(result) {
		return NaNValue()
	}
	for _, value := range call.ArgumentList[1:] {
		value := value.float64()
		if math.IsNaN(value) {
			return NaNValue()
		}
		result = math.Min(result, value)
	}
	return toValue_float64(result)
}

func builtinMath_pow(call FunctionCall) Value {
	// TODO Make sure this works according to the specification (15.8.2.13)
	x := call.Argument(0).float64()
	y := call.Argument(1).float64()
	if math.Abs(x) == 1 && math.IsInf(y, 0) {
		return NaNValue()
	}
	return toValue_float64(math.Pow(x, y))
}

func builtinMath_random(call FunctionCall) Value {
	return toValue_float64(rand.Float64())
}

func builtinMath_round(call FunctionCall) Value {
	number := call.Argument(0).float64()
	value := math.Floor(number + 0.5)
	if value == 0 {
		value = math.Copysign(0, number)
	}
	return toValue_float64(value)
}

func builtinMath_sin(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Sin(number))
}

func builtinMath_sqrt(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Sqrt(number))
}

func builtinMath_tan(call FunctionCall) Value {
	number := call.Argument(0).float64()
	return toValue_float64(math.Tan(number))
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import Model.HibernateUtil;
import Model.Sucursales;
import Model.Usuarios;
import View.Login;
import View.ModuloCliente.PrincipalCliente;
import View.ModuloProducto.PrincipalProducto;
import View.ModuloProveedor.PrincipalProveedor;
import View.ModuloVentas.PrincipalVentas;
import View.Principal;
import java.util.List;
import javax.swing.JOptionPane;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

/*
 *
 * @author Hector Campos Alonso
 * @since 07/07/2013
 * @version 1.0
 */
public class UsuarioController
{

    /*Este metodo permite registrar a un nuevo usuario
     */
    public static boolean CreateUsuario(String username, String password
            ,String Tipo , String Pregunta,String respuesta, Sucursales sucursal)
    {
        Session sesion = HibernateUtil.getSessionFactory().openSession();
        sesion.beginTransaction();
        try {
            Usuarios usuario = new Usuarios();
            usuario.setUsername(username);
            usuario.setPassword(password);
            usuario.setTipo(Tipo);
            usuario.setPreguntaSeguridad(Pregunta);
            usuario.setRespuesta(respuesta);
            usuario.setSucursales(sucursal);
            sesion.save(usuario);
            sesion.getTransaction().commit();
            return true;
        } catch (Exception e) {
            sesion.getTransaction().rollback();
            System.out.println(e.getMessage());
            return false;
        }

    }
    /*Este metodo permite eliminar un usuario
     * por medio de una busqueda de id
     */
    public static boolean DeleteUsuario (int usuario)
    {
        Session sesion = HibernateUtil.getSessionFactory().openSession();
        sesion.getTransaction().begin();
        try {
            Usuarios busqueda = (Usuarios)sesion.createCriteria(Usuarios.class).add(Restrictions
                    .eq("clave", usuario)).uniqueResult();
            if(busqueda!=null)
            {
                sesion.delete(busqueda);
                sesion.getTransaction().commit();
            }else{
                JOptionPane.showMessageDialog(null, "Error no existe el usuario", "Error"
                        ,JOptionPane.ERROR_MESSAGE);
            }
            return true;
        } catch (Exception e) {
            System.out.println(e.getMessage());
            sesion.getTransaction().rollback();
            return false;
        }
    }

    public static boolean UpdateUsuario(String usuario, String password,String tipo ,String pregunta
            ,String respuesta, Sucursales sucursal)
    {
        Session sesion = HibernateUtil.getSessionFactory().openSession();
        sesion.beginTransaction();
        try {
            Usuarios busqueda = (Usuarios) sesion.createCriteria(Usuarios.class).add(Restrictions.eq
                    ("username", usuario)).uniqueResult();
            if(busqueda!=null){
                busqueda.setUsername(usuario);
                busqueda.setPassword(password);
                busqueda.setTipo(tipo);
                busqueda.setPreguntaSeguridad(pregunta);
                busqueda.setRespuesta(respuesta);
                busqueda.setSucursales(sucursal);
                sesion.update(busqueda);
                sesion.getTransaction().commit();
                return true;
            }else{
                JOptionPane.showMessageDialog(null, "El usuario "+usuario+ " no existe"
                    ,"Usuario no encontrado", JOptionPane.ERROR_MESSAGE);
                sesion.getTransaction().rollback();
                return false;
            }
        } catch (Exception e)
        {
            System.out.println(e.getMessage());
            sesion.getTransaction().rollback();
            return false;
        }
    }

    public static List<Usuarios> ShowUsuarios()
    {
        Session sesion=HibernateUtil.getSessionFactory().openSession();
         List<Usuarios> resultado= sesion.createCriteria(Usuarios.class).list();
        return  resultado;
    }

    public static Usuarios UnicoUsuario(String usuario)
    {
        Session session =HibernateUtil.getSessionFactory().openSession();
                 Usuarios busqueda=(Usuarios)session.createCriteria(Usuarios.class)
                         .add(Restrictions.eq("username", usuario)).uniqueResult();
                 return busqueda;
    }
    public static Usuarios IdUsuario(int usuario)
    {
        Session session =HibernateUtil.getSessionFactory().openSession();
                 Usuarios busqueda=(Usuarios)session.createCriteria(Usuarios.class)
                         .add(Restrictions.eq("clave", usuario)).uniqueResult();
                 return busqueda;
    }
    public boolean usuario(String usuario){
        return false;

    }
    public static boolean Login (String username, String password)
    {
        Session sesion = HibernateUtil.getSessionFactory().openSession();
        Usuarios busqueda = (Usuarios) sesion.createCriteria(Usuarios.class).add(Restrictions.
                eq("username", username)).uniqueResult();
        if(busqueda!=null)
        {
            //Indica que se encontro y que si es el mismo usuario con la misma contraseña
            if(busqueda.getPassword().equals(password))
            {

                new Principal().setVisible(true);
                Principal.tipo=busqueda.getTipo();
                JOptionPane.showMessageDialog(null, "Bienvenido: "+busqueda.getUsername());
                Login n = new Login();
                n.dispose();
                return true;
            }
            else
            {
                JOptionPane.showMessageDialog(null, "Verique que "
                    + "que haya escrito bien su contraseña"
                    ,"Contraseña no Valida", JOptionPane.ERROR_MESSAGE);
                return false;
            }
            //Busqueda
        }
        else
        {
            JOptionPane.showMessageDialog(null, "El usuario "+username+ " no existe"+ "\n Verique que "
                    + "que haya escrito bien el usuario"
                    ,"Usuario no encontrado", JOptionPane.ERROR_MESSAGE);
            return false;
        }
    }

    public static void Permisos(String username)
    {
        Session sesion = HibernateUtil.getSessionFactory().openSession();
        Usuarios busqueda = (Usuarios) sesion.createCriteria(Usuarios.class).add(Restrictions.eq
                ("username", username)).uniqueResult();

    }

   public static List<Usuarios> Busqueda(String usuario)
    {
        Session sesion=HibernateUtil.getSessionFactory().openSession();
         List<Usuarios> resultado= sesion.createCriteria(Usuarios.class)
                 .add(Restrictions.like("username", "%"+usuario+"%"))
                 .list();
        return (List<Usuarios>) resultado;
    }

}


text:
var scroungejs = require('scroungejs'),
    startutils = require('./startutil');

startutils.createFileIfNotExist({
  pathSrc : './test/indexSrc.html',
  pathFin : './test/index.html'
}, function (err, res) {
  if (err) return console.log(err);

  var scroungeTestOpts,
      scroungeMinOpts,
      scroungeUnminOpts;

  scroungeTestOpts = {
    inputPath : [
      './test/testbuildSrc',
      './node_modules',
      './plugin',
      './beast.js'
    ],
    outputPath : './test/testbuildFin',
    isRecursive : true,
    isSourcePathUnique : true,
    isCompressed : true,
    isConcatenated : true,
    basepage : './test/index.html'
  };

  scroungeMinOpts = Object.create(scroungeTestOpts);
  scroungeMinOpts.basepage = '';
  scroungeMinOpts.trees = ["beast.full.js"];
  scroungeMinOpts.outputPath = './beast.min.js';
  scroungeMinOpts.isCompressed = true;
  scroungeMinOpts.isConcatenated = true;
  scroungeMinOpts.isLines = false;

  scroungeUnminOpts = Object.create(scroungeTestOpts);
  scroungeUnminOpts.basepage = '';
  scroungeUnminOpts.trees = ["beast.full.js"];
  scroungeUnminOpts.outputPath = './beast.unmin.js';
  scroungeUnminOpts.isCompressed = false;
  scroungeUnminOpts.isConcatenated = true;

  scroungejs.build(scroungeTestOpts, function (err, res) {
    if (err) return console.log(err);

    // build a minified version
    scroungejs.build(scroungeMinOpts, function (err, res) {
      if (err) return console.log(err);

      // build a minified version
      scroungejs.build(scroungeUnminOpts, function (err, res) {
        if (err) return console.log(err);
        console.log('done');
      });
    });
  });

});


text:
/* Generated By:JJTree: Do not edit this line. ASTDescribe.java */

package org.eclipse.rdf4j.query.parser.sparql.ast;

public class ASTDescribe extends SimpleNode {

	private boolean wildcard = false;

	public ASTDescribe(int id) {
		super(id);
	}

	public ASTDescribe(SyntaxTreeBuilder p, int id) {
		super(p, id);
	}

	@Override
	public Object jjtAccept(SyntaxTreeBuilderVisitor visitor, Object data) throws VisitorException {
		return visitor.visit(this, data);
	}

	public boolean isWildcard() {
		return wildcard;
	}

	public void setWildcard(boolean wildcard) {
		this.wildcard = wildcard;
	}

	@Override
	public String toString() {
		String result = super.toString();

		if (wildcard) {
			result += " (*)";
		}

		return result;
	}
}


text:
package org.batfish.z3.node;

public class UnsatExpr extends Statement {
   @Override
   public void print(StringBuilder sb, int indent) {
      sb.append("unsat");
   }
}


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

<TITLE>
org.apache.fop.afp.ptoca (Apache FOP 1.0 API)
</TITLE>

<META NAME="keywords" CONTENT="org.apache.fop.afp.ptoca package">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

org.apache.fop.afp.ptoca

Interfaces

PtocaConstants

PtocaProducer

Classes

LineDataInfoProducer

PtocaBuilder

TextDataInfoProducer