text:
Views
=====

**Views** within a window are used to layout controls or other views.

Note: a Panel view is a collapsable view.

Collection View
---------------

A [**collection** view](../nimx/collection_view.nim) will layout a collection (sequence) of items in a direction of either left-to-right or top-down,
where items is a pre-defined size on the screen.

Each item is wrapped in a subview.

[See Test 7 code](../test/sample07_collections.nim)

Expanding View
--------------

An [**expanding** view](../nimx/expanding_view.nim) has a button that can be clicked to expand the view to display (or hide) the full content of the view.

A simple example:
```
import nimx / [ expanding_view, window, text_field ]

runApplication:
  let w = newWindow(newRect(50, 50, 500, 120))
  let ev1 = newExpandingView(newRect(0, 0, 500, 120), hasOffset = true)
  ev1.title = "My Exanding View"
  ev1.titleBarColor = newColor(0.1, 0.1, 0.6)
  ev1.expand()
  ev1.backgroundColor = newColor(0.95, 0.95, 0.95)
  ev1.contentView.backgroundColor = newColor(0.88, 0.88, 0.95)
  ev1.addContent(newLabel(nil, newPoint(0,0), newSize(150,26), "This is a Label"))
  let tf1 = newTextField(nil, newPoint(0,0), newSize(200,26), "This is a TextField")
  tf1.multiline = false
  ev1.addContent(tf1)
  w.addSubView(ev1)
```

[Also see Test 11 code](../test/sample11_expanded_views.nim)

Form View
---------

A **form** view lays out a specified number of label/Text_Field pairs.  The labels and values of the Text Fields can then be set with the `setValue()`
or retrieved with the `inputValue()` procs.

Currently, to have different input types other than a Text Field would require overloading the [FormView definition](../nimx/form_view.nim).

Horizontal List View
--------------------

A scrollable [horizontal list](../nimx/horizontal_list_view.nim) of views

Image View
----------

[Image view](../nimx/image_view.nim) is a view for drawing static images.

Filling rules:
 - **NoFill** is drawn from the top-left corner with its size
 - **Stretch** is stretched to the view size
 - **Tile** all of the view
 - **FitWidth** to the view's width
 - **FitHeight** to the view's height
 - **NinePartImage**

Inspector View
--------------

A vertical layout [view](../nimx/inspector_view.nim) for inspecting object properties.

Outline View
------------

An [**Outline** view](../nimx/outline_view.nim) allows dragging of child elements to different levels of a hierarchical list.

Panel View
----------

A collapseable [view](../nimx/panel_view.nim) that allows the showing/hiding of its content.

The [inspector Panel](../nimx/inspector_panel.nim) is collapseable Inspector View.

Scroll View
-----------

[See the main test code](../test/main.nim)

Split View
-----------

A [view](../nimx/split_view.nim) with a movable divider between sections for resizing the sub-views.

```
import nimx / [ window, layout, button, text_field, split_view, scroll_view, context ]

let red = newColor(1, 0, 0)
let blue = newColor(0, 0, 1)
let yellow = newColor(1, 1, 0)

runApplication:
    let w = newWindow(newRect(50, 50, 500, 150))
    w.makeLayout: # DSL follows
      - SplitView:
        frame == inset(super, 10)

        - ScrollView:
          backgroundColor: blue
          size >= [200, 500]
          - View:
            backgroundColor: red
            size == [100, 900]

        - View:
          backgroundColor: yellow
          width >= 100
```

Stack View
----------

A [vertical linear](../nimx/stack_view.nim) view.

Table View
----------

A [table or grid](../nimx/table_view.nim) view, with controls/view arranged in a rows and columns.


text:
using System;

namespace RoomAliveToolkit.Images
{
    unsafe public class ShortImage : UnmanagedImage
    {
        protected ushort* data;

        public ShortImage(int width, int height)
            : base(width, height, sizeof(short))
        {
            data = (ushort*)dataIntPtr.ToPointer();
            //Zero();
        }

        public ShortImage(int width, int height, IntPtr dataIntPtr)
            : base(width, height, dataIntPtr, sizeof(short))
        {
            data = (ushort*)dataIntPtr.ToPointer();
        }

        public ushort* Data(int x, int y)
        {
            return &data[width * y + x];
        }

        public ushort this[int x, int y]
        {
            get { return data[y * width + x]; }
            set { data[y * width + x] = value; }
        }

        public ushort this[int i]
        {
            get { return data[i]; }
            set { data[i] = value; }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.microsoft.azure.servicebus.primitives;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.UUID;

public final class StringUtil {
    public static final String EMPTY = "";
    private static final Charset UTF8_CHAR_SET = StandardCharsets.UTF_8;

    public static boolean isNullOrEmpty(String string) {
        return (string == null || string.isEmpty());
    }

    public static boolean isNullOrWhiteSpace(String string) {
        if (string == null) {
            return true;
        }

        for (int index = 0; index < string.length(); index++) {
            if (!Character.isWhitespace(string.charAt(index))) {
                return false;
            }
        }

        return true;
    }

    public static String getShortRandomString() {
        return getRandomString().substring(0, 6);
    }

    public static String getRandomString() {
        return UUID.randomUUID().toString();
    }

    static String convertBytesToString(byte[] bytes) {
        return new String(bytes, UTF8_CHAR_SET);
    }

    static byte[] convertStringToBytes(String string) {
        return string.getBytes(UTF8_CHAR_SET);
    }
}


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".InstallationActivity">

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|top"
        android:text="What service provider is best?"
        android:id="@+id/ask_service_provider_text"
        android:textAppearance="?android:attr/textAppearanceLarge" />

        <Spinner
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/service_provider_spinner"
            android:layout_below="@+id/ask_service_provider_text"
            android:layout_centerHorizontal="true" />

    </RelativeLayout>

</FrameLayout>


text:
package com.github.kpavlov.selenide;

import org.junit.Test;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.open;

public class GoogleTest {

    @Test
    public void shouldOpenGoogle() {
        System.out.println("GoogleTest.shouldOpenGoogle");
        open("https://google.com/");
        $("title").has(text("Google"));
    }

}


text:
<?php
class NewsItemsController extends AppController
{
	var $name = 'NewsItems';

	var $paginate = array(
		'limit' => 3,
		'order' => array(
			'NewsItem.date' => 'desc'));

	function index()
	{
		$this->set('news_items', $this->paginate('NewsItem'));
	}

	function view($id=null)
	{
		$this->NewsItem->id = $id;
		$this->set('news_item', $this->NewsItem->read());
	}

	function add()
	{
		if (!empty($this->data)) {
			if ($this->NewsItem->save($this->data)) {
				$this->flash('News item has been added.', '/news_items/');
			}
		}
	}

	function delete($id)
	{
		$this->NewsItem->del($id);
		$this->flash('News item has been deleted.', '/news_items/');
	}

	function edit($id=null)
	{
		$this->NewsItem->id = $id;
		if (empty($this->data)) { // Load data.
			$this->data = $this->NewsItem->read();
			$this->set('news_item', $this->data);
		} else { // Save data.
			if ($this->NewsItem->save($this->data)) {
				$this->flash('News item updated.', '/news_items/');
			}
		}
	}
}
?>


text:
layout: article
title: "Killer clown"
excerpt: "PaperFaces portrait of a killer clown drawn with Paper by 53 on an iPad."
image:
  feature: paperfaces-killer-clown-lg.jpg
  thumb: paperfaces-killer-clown-150.jpg
category: paperfaces
tags: [portrait, illustration, paper by 53, black and white, sktchy]
---

PaperFaces portrait of a killer clown inspired by a photograph on Sktchy.

{% include paperfaces-boilerplate-2.html %}

Work in progress screen captures Made with Paper.


text:
package org.apache.drill.exec.work.batch;

import java.util.concurrent.atomic.AtomicInteger;

import org.apache.drill.exec.ops.FragmentContext;
import org.apache.drill.exec.proto.BitControl.Collector;

public class MergingCollector extends AbstractDataCollector{

  public MergingCollector(AtomicInteger parentAccounter, Collector collector, FragmentContext context) {
    super(parentAccounter, 1, collector, collector.getIncomingMinorFragmentCount(), context);
  }

  @Override
  protected RawBatchBuffer getBuffer(int minorFragmentId) {
    return buffers[0];
  }
}


text:
Incidents Content Area

      To change the content of this section, you will make edits to the incidents.html file located in the /js/views folder.


text:
<md-sidenav class="md-sidenav-right md-whiteframe-z2" md-component-id="right">
  <md-toolbar class="md-theme-light">

      <md-button ng-click="vm.close()"
          class="md-icon-button"
          aria-label="Menu">
          <md-icon>close</md-icon>
        </md-button>

      User Menu

  </md-toolbar>

  <md-content layout-padding>
      <form layout="column" ng-submit="vm.login()" ng-if="!vm.authenticated">
          <md-input-container>
            Email
            <input type="email" id="emailInput"
                   ng-model="vm.user.email" md-autofocus>
          </md-input-container>
          <md-input-container>
            Password
            <input type="password" id="passInput"
                   ng-model="vm.user.password">
          </md-input-container>
          <md-input-container ng-if="vm.register">
            Confirm Password
            <input type="password" id="passInput2"
                   ng-model="vm.user.password2">
          </md-input-container>

          <md-switch ng-model="vm.register" aria-label="Register" class="md-warn">
            Register
          </md-switch>

          <md-button type="submit" class="md-raised md-primary" ng-disabled="vm.loading || !vm.user.email && !vm.user.password" aria-label="Login">

              {{ (vm.register)?'Register':'Login' }}

          </md-button>
        </form>

        <form layout="column" ng-submit="vm.logout()" ng-if="vm.authenticated">
          <md-subheader>Logged in as {{vm.user.email}}</md-subheader>
          <md-button type="submit" class="md-raised md-primary" ng-disabled="vm.loading" aria-label="Logout">

              Logout

          </md-button>
        </form>

        <md-button ng-if="vm.authenticated" class="md-raised" ng-href="/#/create" ng-click="vm.close()">Create Post</md-button>

  </md-content>

</md-sidenav>


text:
~/deploy-proxmox/env_a_zuzu.sh
~/deploy-proxmox/install_utils.sh
sudo ~/deploy-proxmox/install_swapfile.sh
sudo ~/deploy-proxmox/install_tzone.sh

echo -e "

Il faut se déconnecter afin que les modfis soient prises en compte !

"


text:
package models

import (
	"log"
	"labix.org/v2/mgo"
	"labix.org/v2/mgo/bson"
)

// Structure that the routes will be represented by
type Route struct {
	Description string
	Name        string
	From        string
	To          string
}

// Load all of the routes from the database
func LoadRoutes() []Route {
	result := []Route{}
	fn := executeFunc(func(collection *mgo.Collection) {
		err := collection.Find(bson.M{}).All(&result)
		if err != nil { panic(err) }
	})
	execute(fn, ROUTE_COLLECTION)
	return result
}

// Finds the document in the collection for the given document name
// Returns the route if found, otherwise returns a blank route structure
func FindRoute(name string) Route {
	result := Route{}
	fn := executeFunc(func(collection *mgo.Collection) {
		err := collection.Find(bson.M{"name": name}).One(&result)
		if err != nil {
			result = Route{}
			log.Printf("Route '%v' not found. Error: %v", name, err)
		}
	})
	execute(fn, ROUTE_COLLECTION)
	return result
}

func FindRouteByFrom(from string) (Route, error) {
	result := Route{}
	var err error = nil
	fn := executeFunc(func(collection *mgo.Collection) {
		err = collection.Find(bson.M{"from": from}).One(&result)
		if err != nil {
			log.Printf("Route '%v' not found. Error: %v", from, err)
		}
	})
	execute(fn, ROUTE_COLLECTION)
	return result, err
}

// Create a route from the provided route structure
// Returns true if the route was created successfully, or false if it already exists
func CreateRoute(route Route) bool {
	created := false
	checkRoute := FindRoute(route.Name)
	if checkRoute.Name == "" {
		fn := executeFunc(func(collection *mgo.Collection) {
			err := collection.Insert(&route)
			if err != nil { panic(err) }
			log.Printf("Route created '%v'", route.Name)
			created = true
		})
		execute(fn, ROUTE_COLLECTION)
	}
	return created
}

// Delete the route from the database with the given route name
// Returns a true if successful or false if the route could not be found
func DeleteRoute(name string) bool {
	deleted := false
	fn := executeFunc(func(collection *mgo.Collection) {
		err := collection.Remove(bson.M{"name": name})
		if err != nil { panic(err) }
		log.Printf("Route deleted '%v'", name)
		deleted = true
	})
	execute(fn, ROUTE_COLLECTION)
	return deleted
}


text:
<?php
namespace elnebuloso\Flex\Random\Text;

/**
 * Class RandomChar
 *
 * @author Jeff Tunessen <jeff.tunessen@gmail.com>
 */
class RandomChar
{
    /**
     * returns random char
     *
     * @return string
     */
    public static function get()
    {
        $chars = range('a', 'z');
        shuffle($chars);

        return $chars[0];
    }
}


text:
package mysql

import (
	"database/sql"
	"time"

	"github.com/cloudbirds/comments/closure-comments/store"
)

type commentStore struct {
	db *sql.DB
}

// New creates a new comment.
func (s *commentStore) New(entityID, authorID int64, content string) (int64, error) {
	now := time.Now()

	tx, err := s.db.Begin()
	if err != nil {
		return 0, err
	}

	res, err := tx.Exec(`INSERT INTO comments(entity_id, author_id, content, created_at) VALUES(?, ?, ?, ?)`, entityID, authorID, content, now)
	if err != nil {
		tx.Rollback()
		return 0, err
	}

	id, err := res.LastInsertId()
	if err != nil {
		tx.Rollback()
		return 0, err
	}

	_, err = tx.Exec(`UPDATE entities SET last_comment_at=?, comment_count=comment_count+1 WHERE id=?`, now, entityID)
	if err != nil {
		tx.Rollback()
		return 0, err
	}

	err = tx.Commit()
	if err != nil {
		tx.Rollback()
		return 0, err
	}

	return id, nil
}

const selectFromCommets = `SELECT id, entity_id, author_id, content, created_at FROM comments`

func (s *commentStore) scanComment(scanner scanner) (*store.Comment, error) {
	c := &store.Comment{}
	err := scanner.Scan(&c.ID, &c.EntityID, &c.AuthorID, &c.Content, &c.CreatedAt)
	if err == sql.ErrNoRows {
		return nil, store.ErrNotFound
	}
	if err != nil {
		return nil, err
	}
	return c, nil
}

// Get finds a comment by id
func (s *commentStore) Get(id int64) (*store.Comment, error) {
	row := s.db.QueryRow(selectFromCommets+` WHERE deleted=false AND id=?`, id)
	return s.scanComment(row)
}

// GetByEntity finds comments by entityID
func (s *commentStore) GetByEntity(entityID int64, offset, limit int) ([]*store.Comment, int, error) {
	var count int
	err := s.db.QueryRow(`SELECT count(*) from comments where deleted=false and entity_id=?`, entityID).Scan(&count)

	if limit <= 0 || offset > count {
		return []*store.Comment{}, count, nil
	}

	rows, err := s.db.Query(selectFromCommets+` where deleted=false and entity_id=? order by created_at, id limit ? offset ?`, entityID, limit, offset)
	if err != nil {
		return nil, 0, err
	}
	defer rows.Close()

	comments := []*store.Comment{}
	for rows.Next() {
		comment, err := s.scanComment(rows)
		if err != nil {
			return nil, 0, err
		}
		comments = append(comments, comment)
	}
	if err = rows.Err(); err != nil {
		return nil, 0, err
	}

	return comments, count, nil
}

// SetContent updates comment.Content value.
func (s *commentStore) SetContent(id int64, content string) error {
	_, err := s.db.Exec(`UPDATE comments SET content=? WHERE id=?`, content, id)
	return err
}

// Delete soft-deletes a comment.
func (s *commentStore) Delete(id int64) error {
	tx, err := s.db.Begin()
	if err != nil {
		return err
	}

	_, err = tx.Exec(`UPDATE comments SET deleted=true WHERE id=?`, id)
	if err != nil {
		tx.Rollback()
		return err
	}

	_, err = tx.Exec(`
		UPDATE entities e
			SET last_comment_at=(SELECT MAX(created_at) FROM comments c WHERE c.entity_id=e.id AND c.deleted=false),
			comment_count=e.comment_count-1
		WHERE e.id=(SELECT entity_id FROM comments WHERE id=?)`, id)
	if err != nil {
		tx.Rollback()
		return err
	}

	err = tx.Commit()
	if err != nil {
		tx.Rollback()
		return err
	}

	return nil
}


text:
(function(angular, _) {
    // var HomeControllers = angular.module('HomeControllers', []);

    // HomeControllers.controller('mainHomeCtrl', ['$scope', mainHomeCtrl]);

    // /**
    //  * Controllers definition
    //  */

    // *
    //  * mainHomeCtrl
    //  * @param  {[type]} $scope [description]
    //  * @return {[type]}        [description]

    // function mainHomeCtrl($scope) {
    // 	$scope.messsage = 'Hello world';
    // }
})(angular, _);


text:
namespace ofx {

    class TraverseBase
    {
    public:
        typedef std::stack<Poco::DirectoryIterator> Stack;
        typedef std::pointer_to_unary_function<const Stack&, Poco::UInt16> DepthFunPtr;

        enum { D_INFINITE = 0 };
        /// Constant for infinite traverse depth.

        TraverseBase(DepthFunPtr depthDeterminer, Poco::UInt16 maxDepth = D_INFINITE);

    protected:
        bool isFiniteDepth();

        DepthFunPtr _depthDeterminer;
        Poco::UInt16 _maxDepth;

        Poco::DirectoryIterator _itEnd;

    private:
        TraverseBase();
        TraverseBase(const TraverseBase&);
        TraverseBase& operator= (const TraverseBase&);
    };

    class ChildrenFirstTraverse : public TraverseBase
    {
    public:
        ChildrenFirstTraverse(DepthFunPtr depthDeterminer, Poco::UInt16 maxDepth = D_INFINITE);

        const std::string next(Stack* itStack, bool* isFinished);

    private:
        ChildrenFirstTraverse();
        ChildrenFirstTraverse(const ChildrenFirstTraverse&);
        ChildrenFirstTraverse& operator= (const ChildrenFirstTraverse&);
    };

    class SiblingsFirstTraverse : public TraverseBase
    {
    public:
        SiblingsFirstTraverse(
                              DepthFunPtr depthDeterminer, Poco::UInt16 maxDepth = D_INFINITE);

        const std::string next(Stack* itStack, bool* isFinished);

    private:
        SiblingsFirstTraverse();
        SiblingsFirstTraverse(const SiblingsFirstTraverse&);
        SiblingsFirstTraverse& operator= (const SiblingsFirstTraverse&);

        std::stack< std::queue<std::string> > _dirsStack;
    };

} // namespace Poco

#endif // Foundation_RecursiveDirectoryIteratorStategies_INCLUDE


text:
package org.df4j.jdkflow;

import java.util.concurrent.Executor;
import java.util.concurrent.Flow;
import java.util.concurrent.SubmissionPublisher;
import java.util.function.Function;

public class TransformProcessor<S,T> extends SubmissionPublisher<T>
   implements Flow.Processor<S,T> {
   final Function<? super S, ? extends T> function;
   Flow.Subscription subscription;
   TransformProcessor(Executor executor, int maxBufferCapacity,
                      Function<? super S, ? extends T> function) {
     super(executor, maxBufferCapacity);
     this.function = function;
   }
   public void onSubscribe(Flow.Subscription subscription) {
     (this.subscription = subscription).request(1);
   }
   public void onNext(S item) {
     subscription.request(1);
     submit(function.apply(item));
   }
   public void onError(Throwable ex) { closeExceptionally(ex); }
   public void onComplete() { close(); }
}


text:
// Copyright 2018 The Bazel Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.devtools.build.lib.syntax;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.events.Location.LineAndColumn;
import com.google.devtools.build.lib.syntax.Debuggable.ReadyToPause;
import com.google.devtools.build.lib.syntax.Debuggable.Stepping;
import com.google.devtools.build.lib.syntax.Environment.LexicalFrame;
import com.google.devtools.build.lib.vfs.PathFragment;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests of {@link Environment}s implementation of {@link Debuggable}. */
@RunWith(JUnit4.class)
public class EnvironmentDebuggingTest {

  private static Environment newEnvironment() {
    Mutability mutability = Mutability.create("test");
    return Environment.builder(mutability).useDefaultSemantics().build();
  }

  /** Enter a dummy function scope with the given name, and the current environment's globals. */
  private static void enterFunctionScope(Environment env, String functionName, Location location) {
    FuncallExpression ast = new FuncallExpression(Identifier.of("test"), ImmutableList.of());
    ast.setLocation(location);
    env.enterScope(
        new BaseFunction(functionName) {},
        LexicalFrame.create(env.mutability()),
        ast,
        env.getGlobals());
  }

  @Test
  public void testListFramesFromGlobalFrame() throws Exception {
    Environment env = newEnvironment();
    env.update("a", 1);
    env.update("b", 2);
    env.update("c", 3);

    ImmutableList<DebugFrame> frames = env.listFrames(Location.BUILTIN);

    assertThat(frames).hasSize(1);
    assertThat(frames.get(0))
        .isEqualTo(
            DebugFrame.builder()
                .setFunctionName("<top level>")
                .setLocation(Location.BUILTIN)
                .setGlobalBindings(ImmutableMap.of("a", 1, "b", 2, "c", 3))
                .build());
  }

  @Test
  public void testListFramesFromChildFrame() throws Exception {
    Environment env = newEnvironment();
    env.update("a", 1);
    env.update("b", 2);
    env.update("c", 3);
    Location funcallLocation =
        Location.fromPathAndStartColumn(
            PathFragment.create("foo/bar"), 0, 0, new LineAndColumn(12, 0));
    enterFunctionScope(env, "function", funcallLocation);
    env.update("a", 4); // shadow parent frame var
    env.update("y", 5);
    env.update("z", 6);

    ImmutableList<DebugFrame> frames = env.listFrames(Location.BUILTIN);

    assertThat(frames).hasSize(2);
    assertThat(frames.get(0))
        .isEqualTo(
            DebugFrame.builder()
                .setFunctionName("function")
                .setLocation(Location.BUILTIN)
                .setLexicalFrameBindings(ImmutableMap.of("a", 4, "y", 5, "z", 6))
                .setGlobalBindings(ImmutableMap.of("a", 1, "b", 2, "c", 3))
                .build());
    assertThat(frames.get(1))
        .isEqualTo(
            DebugFrame.builder()
                .setFunctionName("<top level>")
                .setLocation(funcallLocation)
                .setGlobalBindings(ImmutableMap.of("a", 1, "b", 2, "c", 3))
                .build());
  }

  @Test
  public void testStepIntoFunction() {
    Environment env = newEnvironment();

    ReadyToPause predicate = env.stepControl(Stepping.INTO);
    enterFunctionScope(env, "function", Location.BUILTIN);

    assertThat(predicate.test(env)).isTrue();
  }

  @Test
  public void testStepIntoFallsBackToStepOver() {
    // test that when stepping into, we'll fall back to stopping at the next statement in the
    // current frame
    Environment env = newEnvironment();

    ReadyToPause predicate = env.stepControl(Stepping.INTO);

    assertThat(predicate.test(env)).isTrue();
  }

  @Test
  public void testStepIntoFallsBackToStepOut() {
    // test that when stepping into, we'll fall back to stopping when exiting the current frame
    Environment env = newEnvironment();
    enterFunctionScope(env, "function", Location.BUILTIN);

    ReadyToPause predicate = env.stepControl(Stepping.INTO);
    env.exitScope();

    assertThat(predicate.test(env)).isTrue();
  }

  @Test
  public void testStepOverFunction() {
    Environment env = newEnvironment();

    ReadyToPause predicate = env.stepControl(Stepping.OVER);
    enterFunctionScope(env, "function", Location.BUILTIN);

    assertThat(predicate.test(env)).isFalse();
    env.exitScope();
    assertThat(predicate.test(env)).isTrue();
  }

  @Test
  public void testStepOverFallsBackToStepOut() {
    // test that when stepping over, we'll fall back to stopping when exiting the current frame
    Environment env = newEnvironment();
    enterFunctionScope(env, "function", Location.BUILTIN);

    ReadyToPause predicate = env.stepControl(Stepping.OVER);
    env.exitScope();

    assertThat(predicate.test(env)).isTrue();
  }

  @Test
  public void testStepOutOfInnerFrame() {
    Environment env = newEnvironment();
    enterFunctionScope(env, "function", Location.BUILTIN);

    ReadyToPause predicate = env.stepControl(Stepping.OUT);

    assertThat(predicate.test(env)).isFalse();
    env.exitScope();
    assertThat(predicate.test(env)).isTrue();
  }

  @Test
  public void testStepOutOfOutermostFrame() {
    Environment env = newEnvironment();

    assertThat(env.stepControl(Stepping.OUT)).isNull();
  }

  @Test
  public void testStepControlWithNoSteppingReturnsNull() {
    Environment env = newEnvironment();

    assertThat(env.stepControl(Stepping.NONE)).isNull();
  }

  @Test
  public void testEvaluateVariableInScope() throws Exception {
    Environment env = newEnvironment();
    env.update("a", 1);

    Object result = env.evaluate("a");

    assertThat(result).isEqualTo(1);
  }

  @Test
  public void testEvaluateVariableNotInScopeFails() throws Exception {
    Environment env = newEnvironment();
    env.update("a", 1);

    try {
      env.evaluate("b");
      fail();
    } catch (EvalException e) {
      assertThat(e).hasMessageThat().isEqualTo("name 'b' is not defined");
    }
  }

  @Test
  public void testEvaluateExpressionOnVariableInScope() throws Exception {
    Environment env = newEnvironment();
    env.update("a", "string");

    Object result = env.evaluate("a.startswith(\"str\")");

    assertThat(result).isEqualTo(Boolean.TRUE);
  }
}


text:
package Mod.Block;

import Mod.Lib.Refrence;
import Mod.Main.Main;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;

public class ModBlockSilverOre extends Block{

	public ModBlockSilverOre(int par1) {
		super(par1, Material.rock);
		this.setCreativeTab(Main.CreativeTab);
		this.setHardness(46);
		this.setUnlocalizedName("SilverOre");
	}

	   @SideOnly(Side.CLIENT)
	   public void registerIcons(IconRegister par1IconRegister)
	   {
		   this.blockIcon = par1IconRegister.registerIcon(Refrence.Mod_Id + ":SilverOre");

	   }

}


text:
package org.apache.geode.distributed;

import static org.apache.geode.internal.logging.log4j.custom.CustomConfiguration.*;
import static org.assertj.core.api.Assertions.*;
import static org.junit.Assert.*;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.SystemOutRule;
import org.junit.experimental.categories.Category;

import org.apache.geode.internal.process.ProcessStreamReader;
import org.apache.geode.internal.process.ProcessType;
import org.apache.geode.internal.process.ProcessUtils;
import org.apache.geode.test.junit.categories.IntegrationTest;

/**
 * Integration tests for launching a Server in a forked process with custom logging configuration
 */
@Category(IntegrationTest.class)
public class ServerLauncherRemoteWithCustomLoggingIntegrationTest
    extends AbstractServerLauncherRemoteIntegrationTestCase {

  private File customConfigFile;

  @Rule
  public SystemOutRule systemOutRule = new SystemOutRule().enableLog();

  @Before
  public void setUpLocatorLauncherRemoteWithCustomLoggingIntegrationTest() throws Exception {
    this.customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());
  }

  @Test
  public void testStartUsesCustomLoggingConfiguration() throws Throwable {
    // build and start the server
    final List<String> jvmArguments = getJvmArguments();

    final List<String> command = new ArrayList<String>();
    command
        .add(new File(new File(System.getProperty("java.home"), "bin"), "java").getCanonicalPath());
    for (String jvmArgument : jvmArguments) {
      command.add(jvmArgument);
    }
    command.add("-D" + ConfigurationFactory.CONFIGURATION_FILE_PROPERTY + "="
        + this.customConfigFile.getCanonicalPath());
    command.add("-cp");
    command.add(System.getProperty("java.class.path"));
    command.add(ServerLauncher.class.getName());
    command.add(ServerLauncher.Command.START.getName());
    command.add(getUniqueName());
    command.add("--disable-default-server");
    command.add("--redirect-output");

    this.process = new ProcessBuilder(command).directory(new File(this.workingDirectory)).start();
    this.processOutReader =
        new ProcessStreamReader.Builder(this.process).inputStream(this.process.getInputStream())
            .inputListener(new ToSystemOut()).build().start();
    this.processErrReader =
        new ProcessStreamReader.Builder(this.process).inputStream(this.process.getErrorStream())
            .inputListener(new ToSystemOut()).build().start();

    int pid = 0;
    this.launcher = new ServerLauncher.Builder()
        .setWorkingDirectory(this.temporaryFolder.getRoot().getCanonicalPath()).build();
    try {
      waitForServerToStart();

      // validate the pid file and its contents
      this.pidFile = new File(this.temporaryFolder.getRoot(), ProcessType.SERVER.getPidFileName());
      assertTrue(this.pidFile.exists());
      pid = readPid(this.pidFile);
      assertTrue(pid > 0);
      assertTrue(ProcessUtils.isProcessAlive(pid));

      final String logFileName = getUniqueName() + ".log";
      assertTrue("Log file should exist: " + logFileName,
          new File(this.temporaryFolder.getRoot(), logFileName).exists());

      // check the status
      final ServerLauncher.ServerState serverState = this.launcher.status();
      assertNotNull(serverState);
      assertEquals(AbstractLauncher.Status.ONLINE, serverState.getStatus());

      assertThat(systemOutRule.getLog())
          .contains("log4j.configurationFile = " + this.customConfigFile.getCanonicalPath());
      assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);

    } catch (Throwable e) {
      this.errorCollector.addError(e);
    }

    // stop the server
    try {
      assertEquals(AbstractLauncher.Status.STOPPED, this.launcher.stop().getStatus());
      waitForPidToStop(pid);
    } catch (Throwable e) {
      this.errorCollector.addError(e);
    }
  }

  private static class ToSystemOut implements ProcessStreamReader.InputListener {
    @Override
    public void notifyInputLine(String line) {
      System.out.println(line);
    }
  }
}


text:
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;

Cu.import('resource://gre/modules/XPCOMUtils.jsm');

Cu.import('chrome://greasemonkey-modules/content/GM_setClipboard.js');
Cu.import('chrome://greasemonkey-modules/content/installPolicy.js');
Cu.import('chrome://greasemonkey-modules/content/ipcscript.js');
Cu.import('chrome://greasemonkey-modules/content/menucommand.js');
Cu.import('chrome://greasemonkey-modules/content/miscapis.js');
Cu.import('chrome://greasemonkey-modules/content/sandbox.js');
Cu.import('chrome://greasemonkey-modules/content/scriptProtocol.js');
Cu.import('chrome://greasemonkey-modules/content/documentObserver.js');
Cu.import('chrome://greasemonkey-modules/content/util.js');

// Register with process script. Don't import all the vars into the local scope.
Cu.import('chrome://greasemonkey-modules/content/processScript.js', {}
    ).addFrame(this);

// \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //

var gScope = this;
var gStripUserPassRegexp = new RegExp('(://)([^:/]+)(:[^@/]+)?@');

// \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //

function contentObserver(win) {
  if (!GM_util.getEnabled()) return;

  var doc = win.document;
  var url = doc.documentURI;
  if (!GM_util.isGreasemonkeyable(url)) return;

  // Listen for whichever kind of load event arrives first.
  win.addEventListener('DOMContentLoaded', contentLoad, true);
  win.addEventListener('load', contentLoad, true);

  runScripts('document-start', win);
};

// \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //

function browserLoad(aEvent) {
  var contentWin = aEvent.target.defaultView;
  var href = contentWin.location.href;

  if (href.match(/^about:(blank|reader)/)) {
    // #1696: document-element-inserted doesn't see about:blank
    runScripts('document-start', contentWin);
    runScripts('document-end', contentWin);
    runScripts('document-idle', contentWin);
  }

  gScope.sendAsyncMessage("greasemonkey:DOMContentLoaded", {
    "contentType": contentWin.document.contentType,
    "href": href
  });
}

function contentLoad(aEvent) {
  var contentWin = aEvent.target.defaultView;

  // Now that we've seen any first load event, stop listening for any more.
  contentWin.removeEventListener('DOMContentLoaded', contentLoad, true);
  contentWin.removeEventListener('load', contentLoad, true);

  runScripts('document-end', contentWin);
  GM_util.timeout(function() { runScripts('document-idle', contentWin); }, 50);
}

function createScriptFromObject(aObject) {
  var script = Object.create(IPCScript.prototype);
  // TODO: better way for this? Object.create needs property descriptors.
  for (var key in aObject) {
    script[key] = aObject[key];
  }
  return script;
};

function injectDelayedScript(aMessage) {
  var windowId = aMessage.data.windowId;
  var windowMediator = Components
      .classes['@mozilla.org/appshell/window-mediator;1']
      .getService(Components.interfaces.nsIWindowMediator);
  var win = windowMediator.getOuterWindowWithId(windowId);

  if (!win) {
    dump('Couldn\'t find window with (outer?) ID ' + windowId + '!\n');
  } else {
    var script = createScriptFromObject(aMessage.data.script);
    injectScripts([script], win);
  }
};

function injectScripts(aScripts, aContentWin) {
  try {
    aContentWin.QueryInterface(Ci.nsIDOMChromeWindow);
    // Never ever inject scripts into a chrome context window.
    return;
  } catch(e) {
    // Ignore, it's good if we can't QI to a chrome window.
  }

  var url = urlForWin(aContentWin);
  var winIsTop = windowIsTop(aContentWin);

  for (var i = 0, script = null; script = aScripts[i]; i++) {
    if (script.noframes && !winIsTop) continue;
    var sandbox = createSandbox(script, aContentWin, url, gScope);
    runScriptInSandbox(script, sandbox);
  }
}

function loadFailedScript(aMessage) {
  var url = aMessage.data.url;
  var loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
  var referer = aMessage.data.referer
      && GM_util.uriFromUrl(aMessage.data.referer);
  var postData = null;
  var headers = null;

  var webNav = docShell.QueryInterface(Ci.nsIWebNavigation);

  ignoreNextScript();
  webNav.loadURI(url, loadFlags, referer, postData, headers);
}

function contextMenuStart(aMessage) {
  var culprit = aMessage.objects.culprit;

  while (culprit && culprit.tagName && culprit.tagName.toLowerCase() != "a") {
    culprit = culprit.parentNode;
  }

  aMessage.target.sendAsyncMessage(
      "greasemonkey:context-menu-end", {"href": culprit.href});
}

function newScriptLoadStart(aMessage) {
  aMessage.target.sendAsyncMessage(
      "greasemonkey:newscript-load-end", {"href": content.location.href});
}

function runScripts(aRunWhen, aContentWin) {
  var url = urlForWin(aContentWin);
  if (!GM_util.isGreasemonkeyable(url)) return;

  var scripts = IPCScript.scriptsForUrl(
      url, aRunWhen, GM_util.windowId(aContentWin, 'outer'));
  injectScripts(scripts, aContentWin);
}

function urlForWin(aContentWin) {
  // See #1970
  // When content does (e.g.) history.replacestate() in an inline script,
  // the location.href changes between document-start and document-end time.
  // But the content can call replacestate() much later, too.  The only way to
  // be consistent is to ignore it.  Luckily, the  document.documentURI does
  // _not_ change, so always use it when deciding whether to run scripts.
  var url = aContentWin.document.documentURI;
  // But ( #1631 ) ignore user/pass in the URL.
  return url.replace(gStripUserPassRegexp, '$1');
}

function windowIsTop(aContentWin) {
  try {
    aContentWin.QueryInterface(Ci.nsIDOMWindow);
    if (aContentWin.frameElement) return false;
  } catch (e) {
    var url = 'unknown';
    try {
      url = aContentWin.location.href;
    } catch (e) { }
    // Ignore non-DOM-windows.
    dump('Could not QI window to nsIDOMWindow at\n' + url + ' ?!\n');
  }
  return true;
};

function windowCreated() {
  onNewDocument(content, contentObserver);
}

// \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //

addEventListener('DOMContentLoaded', browserLoad);
addEventListener('DOMWindowCreated', windowCreated);

if (content) windowCreated();

addMessageListener('greasemonkey:inject-delayed-script', injectDelayedScript);
addMessageListener('greasemonkey:load-failed-script', loadFailedScript);
addMessageListener('greasemonkey:menu-command-list', function(aMessage) {
  MenuCommandListRequest(content, aMessage);
});
addMessageListener('greasemonkey:menu-command-run', function(aMessage) {
  MenuCommandRun(content, aMessage);
});
addMessageListener("greasemonkey:context-menu-start", contextMenuStart);
addMessageListener("greasemonkey:newscript-load-start", newScriptLoadStart);

initInstallPolicy();
initScriptProtocol();


text:
/**
 * @file functional.h
 * @author Sean Massung
 *
 * All files in META are dual-licensed under the MIT and NCSA licenses. For more
 * details, consult the file LICENSE.mit and LICENSE.ncsa in the root of the
 * project.
 */

#ifndef META_UTIL_FUNCTIONAL_H_
#define META_UTIL_FUNCTIONAL_H_

#include <algorithm>
#include <functional>
#include <map>

namespace meta
{
namespace functional
{

/**
 * Memoizes a std::function.
 * @param fun The std::function to be memoized
 * @return a memoized version of the parameter
 */
template <class Result, class... Args>
std::function<Result(Args...)> memoize(std::function<Result(Args...)> fun)
{
    return [fun](Args... args)
    {
        static std::map<std::tuple<Args...>, Result> map_;
        auto it = map_.find(std::make_tuple(args...));
        if (it != map_.end())
            return it->second;
        return map_[std::make_tuple(args...)] = fun(args...);
    };
}

/**
 * Obtains the argument that maximizes the output of a function on a
 * sequence.
 *
 * @param begin The beginning iterator
 * @param end The ending iterator
 * @param fn The function to apply to each element
 */
template <class Iter, class Function>
Iter argmax(Iter begin, Iter end, Function&& fn)
{
    using T = decltype(*begin);
    return std::max_element(begin, end, [&](const T& a, const T& b)
    {
        return fn(a) < fn(b);
    });
}

}
}
#endif


text:
TYLayoutHelper
===========

*View the [source of this content](https://github.com/TekYin/MordinSolus/tree/master/TYLayoutHelper).*

TYLayoutHelper used to help you layouting views on a container.

Usage
-------------------------

Init TYLayoutHelper by passing the container with all the views you want to sort and layout.

```objective-c
TYLayoutHelper *lh = [[TYLayoutHelper alloc] initWithContainer:self.uContainer padding:CGBorderMake(0, 0, 0, 0) orientation:TYLayoutOrientationHorizontal];
```

>__note__ : CGBorder are struct with 4 variables (left, right, top, bottom) and can be created with ```CGBorderMake(CGFloat left, CGFloat right, CGFloat top, CGFloat bottom)```

There are 2 extra parameter to help you with customization.
 + padding : put extra space between container border and subviews.
 + orientation : set the layout orientation (__TYLayoutOrientationHorizontal__ or __TYLayoutOrientationVertical__)

and then add the items you want to sort with

```objective-c
[lh addMemberWithView:view align:TYLayoutAlignCenter margin:CGBorderMake(2, 2, 2, 2)];
````
Parameters :
 + view : view you want to sort
 + align : placement align to container (__TYLayoutAlignLeftOrTop__, __TYLayoutAlignCenter__, __TYLayoutAlignRightOrTop__)
 + margin : put extra space outside the view

and finally call ```[lh doReLayoutWithAnimation:YES duration:1];``` to do the re-layout with animation, or just call ```[lh doReLayout];``` to re-layout without animation.

Extra usage
---------------------------

+ ```- (TYLayoutHelper *)randomizeMember;```
Randomize member to scramble the position index
+ ```- (CGSize)getContentBounds;```
Get total size of the view including padding and margin, used in UIScrollView contentSize


text:
/*jshint node:true*/
"use strict";
var data;
(function (data) {
    'use strict';
    function getPeople() {
        var people = [
            { id: 1, firstName: 'John', lastName: 'Papa', age: 27, location: 'Florida' },
            { id: 2, firstName: 'Ward', lastName: 'Bell', age: 31, location: 'California' },
            { id: 3, firstName: 'Colleen', lastName: 'Jones', age: 21, location: 'New York' },
            { id: 4, firstName: 'Madelyn', lastName: 'Green', age: 18, location: 'North Dakota' },
            { id: 5, firstName: 'Ella', lastName: 'Jobs', age: 18, location: 'South Dakota' },
            { id: 6, firstName: 'Landon', lastName: 'Gates', age: 11, location: 'South Carolina' },
            { id: 7, firstName: 'Haley', lastName: 'Guthrie', age: 35, location: 'Wyoming' },
            { id: 8, firstName: 'Aaron', lastName: 'Jinglehiemer', age: 22, location: 'Utah' }
        ];
        return people;
    }
    data.getPeople = getPeople;
    ;
})(data || (data = {}));
module.exports = data;
//# sourceMappingURL=data.js.map


text:
This python code is designed to run in a browser.

https://www.brython.info/

There is no '__init__.py' file by design.


text:
"""
     A simple scheduler plugin that returns a random plan
"""

import time
import random
from simoorg.plugins.scheduler.BaseScheduler import BaseScheduler

class NonDeterministicScheduler(BaseScheduler):
    """
        Non deterministic scheduler class
    """
    def __init__(self, destiny_object, verbose=False, debug=False):
        """
            Init function for the class
            Args:
                destiny_object - A dict containing the destiny
                    section of the fate book
                verbose - verbosity flag
                debug - debug flag
            Returns:
                None
            Raise:
                None
        """
        BaseScheduler.__init__(self, destiny_object)
        self.verbose = verbose
        self.debug = debug

        self.destiny_object = destiny_object

        # this will contain randomly generated plan for each failure
        self.plan = []

        self.generate_plan()

    def generate_plan(self):
        """
            Generates a plan by selecting random trigger time
            for random failures
            Args:
                None
            Return:
                None
            Raise:
                ValueError if 'max_gap < min_gap'
        """
        if self.debug:
            print ('[VERBOSE INFO]: Generating plan for the NonDeterministic'
                   ' scheduler: ')

        current_timestamp = int(time.time())
        trigger_time = current_timestamp
        planning_completed = False
        failure_list = self.get_failures().keys()
        random.shuffle(failure_list)
        while not planning_completed:
            for failure_name in failure_list:
                min_gap = get_min_gap_between_failures()
                max_gap = get_max_gap_between_failures()
                if max_gap < min_gap:
                    raise ValueError('max_gap %d cannot be lower than min_gap %d' % (min_gap, max_gap))

                random_step = random.randint(self.
                                             get_min_gap_between_failures(),
                                             self.
                                             get_max_gap_between_failures())
                if self.debug:
                    print ('[DEBUG INFO]: randomstep is:',
                           random_step, 'minutes')
                trigger_time = trigger_time + random_step * 60
                if (trigger_time > self.get_total_run_duration() * 60 +
                        current_timestamp):
                    planning_completed = True
                    break
                self.plan.append({failure_name: trigger_time})
                if self.debug:
                    print ('[DEBUG INFO]: Plan item added: ',
                           {failure_name: trigger_time})

        if self.debug:
            print '[VERBOSE INFO]: NonDeterministic plan has been generated'


text:
package extendonlyclient

import (
	yarpc "go.uber.org/yarpc"
	transport "go.uber.org/yarpc/api/transport"
	thrift "go.uber.org/yarpc/encoding/thrift"
	baseserviceclient "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/common/baseserviceclient"
	reflect "reflect"
)

// Interface is a client for the ExtendOnly service.
type Interface interface {
	baseserviceclient.Interface
}

// New builds a new client for the ExtendOnly service.
//
// 	client := extendonlyclient.New(dispatcher.ClientConfig("extendonly"))
func New(c transport.ClientConfig, opts ...thrift.ClientOption) Interface {
	return client{
		c: thrift.New(thrift.Config{
			Service:      "ExtendOnly",
			ClientConfig: c,
		}, opts...),
		nwc: thrift.NewNoWire(thrift.Config{
			Service:      "ExtendOnly",
			ClientConfig: c,
		}, opts...),

		Interface: baseserviceclient.New(
			c,
			append(
				opts,
				thrift.Named("ExtendOnly"),
			)...,
		),
	}
}

func init() {
	yarpc.RegisterClientBuilder(
		func(c transport.ClientConfig, f reflect.StructField) Interface {
			return New(c, thrift.ClientBuilderOptions(c, f)...)
		},
	)
}

type client struct {
	baseserviceclient.Interface

	c   thrift.Client
	nwc thrift.NoWireClient
}


text:
<?

 include("../../lib/config.inc.php");
include("../../lib/session.inc.php");
$navigation = "../" . $session_design_path . "/nav.inc.php";?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $go_info["theme"]["charset"]; ?>">
<link href="../design/default/style.css" rel="stylesheet" type="text/css">
<title>nav frame</title>

<STYLE type='text/css'>
<!--
<? include("../$session_style_path/style.css.php")?>
// -->
</STYLE>
</head>

<body topmargin="0" leftmargin="0" bgcolor="<? echo $session_nav_hcolour?>">

<? include("$navigation")?>

</body>

</html>


text:
package com.kogitune.launcher3;

import android.app.Activity;

public class WidgetAdder extends Activity {

}


text:
#include "test.h" // Brings in the GTest framework
#include "tixicpp.h"

#define EXPECT_TIXI_ERROR(RC, cmd)          \
    ASSERT_THROW(cmd, tixi::TixiError);     \
    try {                                   \
        cmd;                                \
    }                                       \
    catch (tixi::TixiError const & err) {   \
        EXPECT_EQ(RC, err.returnCode());    \
    }

static TixiDocumentHandle documentHandle = -1;

TEST(CppWrapper, createDocumentInvalidRootNodeName)
{
    std::string rootElementName = "1";
    EXPECT_TIXI_ERROR( INVALID_XML_NAME, documentHandle =  tixi::TixiCreateDocument( rootElementName ) );
}

TEST(CppWrapper, createDocumentAddCPACSHeader)
{
  std::string rootElementName = "rootElement";
  std::string cpacsName = "cpacsName";
  std::string cpacsCreator = "cpacsCreator";
  std::string      version = "cpacsVersion";
  std::string cpacsVersion = "2.0";
  std::string cpacsDescription = "cpacsDescription";
  std::string text;

  ASSERT_NO_THROW( documentHandle = tixi::TixiCreateDocument( rootElementName ) );
  ASSERT_NO_THROW( tixi::TixiAddCpacsHeader( documentHandle, cpacsName, cpacsCreator, version, cpacsDescription, cpacsVersion ) );

  // Now check the different header values
  ASSERT_NO_THROW( text = tixi::TixiGetTextElement( documentHandle, "/rootElement/header/name" ) );
  EXPECT_STREQ(cpacsName.c_str(), text.c_str());

  ASSERT_NO_THROW( text = tixi::TixiGetTextElement( documentHandle, "/rootElement/header/creator") );
  EXPECT_STREQ(cpacsCreator.c_str(), text.c_str());

  ASSERT_NO_THROW( text = tixi::TixiGetTextElement( documentHandle, "/rootElement/header/version") );
  EXPECT_STREQ(version.c_str(), text.c_str());

  ASSERT_NO_THROW( text = tixi::TixiGetTextElement( documentHandle, "/rootElement/header/cpacsVersion") );
  EXPECT_STREQ(cpacsVersion.c_str(), text.c_str());

  ASSERT_NO_THROW( text = tixi::TixiGetTextElement( documentHandle, "/rootElement/header/description") );
  EXPECT_STREQ(cpacsDescription.c_str(), text.c_str());
}

TEST(CppWrapper, importFromString)
{
    std::string s = "<?xml version=\"1.0\" encoding=\"utf-8\"?><root/>";
    TixiDocumentHandle handle;
    ASSERT_NO_THROW( handle = tixi::TixiImportFromString(s) );
}

TEST(CppWrapper, exportAsString)
{
    std::string xmlFilename = "TestData/in.xml";
    ASSERT_NO_THROW( documentHandle=tixi::TixiOpenDocument(xmlFilename) );

    std::string text;
    std::string text2;
    ASSERT_NO_THROW( text=tixi::TixiExportDocumentAsString(documentHandle) );
    EXPECT_TIXI_ERROR( INVALID_HANDLE, text2=tixi::TixiExportDocumentAsString(-1) );
}

TEST(CppWrapper, getAttributeNames)
{
    TixiDocumentHandle documentHandle;
    std::string xmlFilename = "TestData/in.xml";
    ASSERT_NO_THROW( documentHandle=tixi::TixiOpenDocument(xmlFilename) );

    std::vector<std::string> attributeNames;
    ASSERT_NO_THROW( attributeNames=tixi::TixiGetAttributeNames(documentHandle, "/plane/aPoint[1]") );
    EXPECT_EQ( 2,        attributeNames.size());
    EXPECT_EQ( "system", attributeNames[0]);
    EXPECT_EQ( "type",   attributeNames[1]);
}

TEST(CppWrapper, getAttribute)
{
    std::string xmlFilename = "TestData/in.xml";
    ASSERT_NO_THROW( documentHandle=tixi::TixiOpenDocument(xmlFilename) );

    std::string text;
    double numberd = 0.;
    int numberi = 0;
    bool mybool = false;

    EXPECT_TIXI_ERROR( INVALID_HANDLE,          text = tixi::TixiGetTextAttribute(-1, "plane/name", "non_existing_attribute") );
    EXPECT_TIXI_ERROR( ATTRIBUTE_NOT_FOUND,     text = tixi::TixiGetAttribute<std::string>(documentHandle, "/plane/wings/wing[1]", "non_existing_attribute") );
    EXPECT_TIXI_ERROR( ELEMENT_PATH_NOT_UNIQUE, text = tixi::TixiGetAttribute<std::string>(documentHandle, "/plane/wings/wing", "position") );

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( text=tixi::TixiGetAttribute<std::string>( documentHandle,  "/plane/wings", "numberOfWings" ) );
    EXPECT_EQ( "2", text);

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( numberd=tixi::TixiGetAttribute<double>( documentHandle, "/plane/coordinateOrigin", "scaling" ) );
    EXPECT_NEAR(1.3456, numberd, 1e-10);

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( numberi=tixi::TixiGetAttribute<int>( documentHandle,  "/plane/wings", "numberOfWings" ) );
    EXPECT_EQ( 2, numberi);

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( mybool=tixi::TixiGetAttribute<bool>( documentHandle, "/plane/wings/wing[1]", "top" ) );
    ASSERT_TRUE(mybool);

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( mybool=tixi::TixiGetAttribute<bool>( documentHandle, "/plane/wings/wing[2]", "top" ) );
    ASSERT_FALSE(mybool);
}

TEST(CppWrapper, checkRemoveAttribute){
    ASSERT_NO_THROW( documentHandle=tixi::TixiOpenDocument("TestData/in.xml") );
    EXPECT_TRUE(tixi::TixiCheckAttribute( documentHandle, "/plane/wings", "numberOfWings") );
    ASSERT_NO_THROW( tixi::TixiRemoveAttribute( documentHandle, "/plane/wings", "numberOfWings" ) );
    EXPECT_FALSE(tixi::TixiCheckAttribute( documentHandle, "/plane/wings", "numberOfWings"));
}

TEST(CppWrapper, getElement)
{
    ASSERT_NO_THROW( documentHandle=tixi::TixiOpenDocument("TestData/in.xml") );

    std::string text;
    double numberd;
    int numberi;
    bool myBool = false;

    /*--------------------------------------------------------------------*/
    EXPECT_TIXI_ERROR( INVALID_HANDLE,          text=tixi::TixiGetElement<std::string>( -1            , "/plane/name/pp"       ) );
    EXPECT_TIXI_ERROR( ELEMENT_NOT_FOUND,       text=tixi::TixiGetElement<std::string>( documentHandle, "/plane/name/pp"       ) );
    EXPECT_TIXI_ERROR( INVALID_XPATH,           text=tixi::TixiGetElement<std::string>( documentHandle, "cc/plane/na|<<me/pp"  ) );
    EXPECT_TIXI_ERROR( ELEMENT_PATH_NOT_UNIQUE, text=tixi::TixiGetElement<std::string>( documentHandle, "/plane/wings/wing"    ) );

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( text=tixi::TixiGetElement<std::string>( documentHandle, "/plane/empty" ) );
    EXPECT_STREQ( "", text.c_str() );

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( text=tixi::TixiGetElement<std::string>( documentHandle, "/plane/name" ) );
    EXPECT_STREQ( "Junkers JU 52", text.c_str() );

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( numberd=tixi::TixiGetElement<double>( documentHandle, "/plane/wings/wing[1]/centerOfGravity/x" ) );
    EXPECT_NEAR( 30.0, numberd, 1e-10 );

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( numberi=tixi::TixiGetElement<int>( documentHandle, "/plane/numberOfPassengers" ) );
    EXPECT_EQ( 57, numberi );

    /*--------------------------------------------------------------------*/
    ASSERT_NO_THROW( myBool=tixi::TixiGetElement<bool>( documentHandle, "/plane/bool/aBool1" ) );
    EXPECT_TRUE( myBool );
}

TEST(CppWrapper, checkRemoveElement){
    ASSERT_NO_THROW( documentHandle=tixi::TixiOpenDocument("TestData/in.xml") );
    EXPECT_TRUE( tixi::TixiCheckElement( documentHandle, "/plane/aPoint/point/z") );
    ASSERT_NO_THROW( tixi::TixiRemoveElement( documentHandle, "/plane/aPoint/point/z" ) );
    EXPECT_FALSE( tixi::TixiCheckElement( documentHandle, "/plane/aPoint/point/z") );
}

TEST(CppWrapper, saveAttribute){

    std::string rootElementName = "rootElement";
    ASSERT_NO_THROW( documentHandle = tixi::TixiCreateDocument( rootElementName ) );
    ASSERT_NO_THROW( tixi::TixiCreateElement(documentHandle, "/rootElement/element") );

    ASSERT_NO_THROW( tixi::TixiSaveAttribute( documentHandle, "/rootElement/element", "sattribute", "stringAttribute") );
    ASSERT_NO_THROW( tixi::TixiSaveAttribute( documentHandle, "/rootElement/element", "dattribute", 3.14159) );
    ASSERT_NO_THROW( tixi::TixiSaveAttribute( documentHandle, "/rootElement/element", "iattribute", 4711) );
    ASSERT_NO_THROW( tixi::TixiSaveAttribute( documentHandle, "/rootElement/element", "battribute", true) );
}

TEST(CppWrapper, saveElement){

    const std::string rootElementName = "rootElement";
    ASSERT_NO_THROW( documentHandle = tixi::TixiCreateDocument(rootElementName) );

    ASSERT_NO_THROW( tixi::TixiSaveElement(documentHandle, "/" + rootElementName + "/cselement", "cstringElement") );
    ASSERT_NO_THROW( tixi::TixiSaveElement(documentHandle, "/" + rootElementName + "/selement", std::string("stringElement")) );
    ASSERT_NO_THROW( tixi::TixiSaveElement(documentHandle, "/" + rootElementName + "/delement", 3.14159) );
    ASSERT_NO_THROW( tixi::TixiSaveElement(documentHandle, "/" + rootElementName + "/ielement", 4711) );
    ASSERT_NO_THROW( tixi::TixiSaveElement(documentHandle, "/" + rootElementName + "/belement", true) );
}

TEST(CppWrapper, getNamedChildrenCount){
    ASSERT_NO_THROW( documentHandle=tixi::TixiOpenDocument("TestData/in.xml") );

    int count=-1;

    ASSERT_NO_THROW( count = tixi::TixiGetNamedChildrenCount( documentHandle, "/plane/wings/this_child_does_not_exist") );
    EXPECT_EQ( 0, count );

    ASSERT_NO_THROW( count = tixi::TixiGetNamedChildrenCount( documentHandle, "/plane/wings") );
    EXPECT_EQ( 1, count );

    ASSERT_NO_THROW( count = tixi::TixiGetNamedChildrenCount( documentHandle, "/plane/wings/wing") );
    EXPECT_EQ( 2, count );
}

TEST(CppWrapper, getChildElementPaths) {
    ASSERT_NO_THROW(documentHandle = tixi::TixiOpenDocument("TestData/in.xml"));

    std::vector<std::string> childPaths;
    ASSERT_NO_THROW(childPaths = tixi::TixiGetChildElementPaths(documentHandle, "/plane/wings"));
    EXPECT_EQ(2, childPaths.size());
    EXPECT_EQ("/plane/wings/wing[1]", childPaths[0]);
    EXPECT_EQ("/plane/wings/wing[2]", childPaths[1]);

    ASSERT_NO_THROW(childPaths = tixi::TixiGetChildElementPaths(documentHandle, "/plane/coordinateOrigin"));
    EXPECT_EQ(3, childPaths.size());
    EXPECT_EQ("/plane/coordinateOrigin/x[1]", childPaths[0]);
    EXPECT_EQ("/plane/coordinateOrigin/y[1]", childPaths[1]);
    EXPECT_EQ("/plane/coordinateOrigin/z[1]", childPaths[2]);

    ASSERT_NO_THROW(childPaths = tixi::TixiGetChildElementPaths(documentHandle, "/plane/coordinateOrigin/x"));
    EXPECT_EQ(0, childPaths.size());
}


text:
<?php
if (!class_exists('Tax_CTP_Filter')){
  /**
    * Tax CTP Filter Class
    * Simple class to add custom taxonomy dropdown to a custom post type admin edit list
    * @author Ohad Raz <admin@bainternet.info>
    * @version 0.1
    */
    class Tax_CTP_Filter
    {
        /**
         * __construct
         * @author Ohad Raz <admin@bainternet.info>
         * @since 0.1
         * @param array $cpt [description]
         */
        function __construct($cpt = array()){
            $this->cpt = $cpt;
            // Adding a Taxonomy Filter to Admin List for a Custom Post Type
            add_action( 'restrict_manage_posts', array($this,'my_restrict_manage_posts' ));
        }

        /**
         * my_restrict_manage_posts  add the slelect dropdown per taxonomy
         * @author Ohad Raz <admin@bainternet.info>
         * @since 0.1
         * @return void
         */
        public function my_restrict_manage_posts() {
            // only display these taxonomy filters on desired custom post_type listings
            global $typenow;
            $types = array_keys($this->cpt);
            if (in_array($typenow, $types)) {
                // create an array of taxonomy slugs you want to filter by - if you want to retrieve all taxonomies, could use get_taxonomies() to build the list
                $filters = $this->cpt[$typenow];
                foreach ($filters as $tax_slug) {
                    // retrieve the taxonomy object
                    $tax_obj = get_taxonomy($tax_slug);
                    $tax_name = $tax_obj->labels->name;

                    // output html for taxonomy dropdown filter
                    echo "<select name='".strtolower($tax_slug)."' id='".strtolower($tax_slug)."' class='postform'>";
                    echo "<option value=''>Show All $tax_name</option>";
                    $this->generate_taxonomy_options($tax_slug,0,0,(isset($_GET[strtolower($tax_slug)])? $_GET[strtolower($tax_slug)] : null));
                    echo "</select>";
                }
            }
        }

        /**
         * generate_taxonomy_options generate dropdown
         * @author Ohad Raz <admin@bainternet.info>
         * @since 0.1
         * @param  string  $tax_slug
         * @param  string  $parent
         * @param  integer $level
         * @param  string  $selected
         * @return void
         */
        public function generate_taxonomy_options($tax_slug, $parent = '', $level = 0,$selected = null) {
            $args = array('show_empty' => 1);
            if(!is_null($parent)) {
                $args = array('parent' => $parent);
            }
            $terms = get_terms($tax_slug,$args);
            $tab='';
            for($i=0;$i<$level;$i++){
                $tab.='--';
            }

            foreach ($terms as $term) {
                // output each select option line, check against the last $_GET to show the current option selected
                echo '<option value='. $term->slug, $selected == $term->slug ? ' selected="selected"' : '','>' .$tab. $term->name .' (' . $term->count .')</option>';
                $this->generate_taxonomy_options($tax_slug, $term->term_id, $level+1,$selected);
            }

        }
    }//end class
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.IO;

namespace CJia.PIVAS.Presenters.DataManage
{
    /// <summary>
    /// ÐÞ¸ÄÓû§ÐÅÏ¢P²ã
    /// </summary>
    public class EditUserPresenter:PIVAS.Tools.Presenter<CJia.PIVAS.Models.DataManage.EditUserModel,CJia.PIVAS.Views.DataManage.IEditUserView>
    {
        /// <summary>
        /// ¹¹Ôì·½·¨
        /// </summary>
        /// <param name="view"></param>
        public EditUserPresenter(Views.DataManage.IEditUserView view)
            : base(view)
        {
            this.View.OnUpdateUser += View_OnUpdateUser;
            this.View.OnCheckPwd += View_OnCheckPwd;
        }

        /// <summary>
        /// ÅжϾÉÃÜÂëÊÇ·ñÕýÈ·
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void View_OnCheckPwd(object sender, Views.DataManage.EditUsereventArgs e)
        {
            bool isOldPwdOk = this.Model.CheckOldPwd(e.OldPwd,e.UserId);
            this.View.ExeIsPwdOk(isOldPwdOk);
        }

        /// <summary>
        /// Ð޸ĸöÈËϸϸ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void View_OnUpdateUser(object sender, Views.DataManage.EditUsereventArgs e)
        {
            bool isUpdate = this.Model.UpdateUser(e.NewPwd,e.UserId);
            if (isUpdate)
            {
                //this.View.ShowMessage("Ð޸ijɹ¦");
                this.View.CloseWindow();
            }
            else
            {
                this.View.ShowMessage("ÐÞ¸Äʧ°Ü");
            }
        }

        protected override void OnInitView()
        {

        }

    }
}


text:
package org.onosproject.pcepio.types;

import java.util.LinkedList;
import java.util.ListIterator;

import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.exceptions.PcepParseException;
import org.onosproject.pcepio.protocol.PcepVersion;

import com.google.common.base.MoreObjects;

public class PcepRsvpUserErrorSpec implements PcepRsvpErrorSpec {

    /*
        RSVP error spec object header.
        0             1              2             3
    +-------------+-------------+-------------+-------------+
    |       Length (bytes)      |  Class-Num  |   C-Type    |
    +-------------+-------------+-------------+-------------+
    |                                                       |
    //                  (Object contents)                   //
    |                                                       |
    +-------------+-------------+-------------+-------------+

    Ref : USER_ERROR_SPEC @ RFC5284.
    USER_ERROR_SPEC object: Class = 194, C-Type = 1

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +---------------+---------------+---------------+---------------+
    |                       Enterprise Number                       |
    +---------------+---------------+---------------+---------------+
    |    Sub Org    |  Err Desc Len |        User Error Value       |
    +---------------+---------------+---------------+---------------+
    |                                                               |
    ~                       Error Description                       ~
    |                                                               |
    +---------------+---------------+---------------+---------------+
    |                                                               |
    ~                     User-Defined Subobjects                   ~
    |                                                               |
    +---------------+---------------+---------------+---------------+
     */

    public static final byte CLASS_NUM = (byte) 0xc2;
    public static final byte CLASS_TYPE = 0x01;

    private PcepRsvpSpecObjHeader objHeader;
    private int enterpriseNum;
    private byte subOrg;
    private byte errDescLen;
    private short userErrorValue;
    private byte[] errDesc;
    private LinkedList<PcepValueType> llRsvpUserSpecSubObj;

    /**
     * Default constructor.
     *
     * @param objHeader pcep rsvp spec object header
     * @param enterpriseNum enterprise number
     * @param subOrg organization identifier value
     * @param errDescLen error description length
     * @param userErrorValue user error value
     * @param errDesc error description
     * @param llRsvpUserSpecSubObj list of subobjects
     */
    public PcepRsvpUserErrorSpec(PcepRsvpSpecObjHeader objHeader, int enterpriseNum, byte subOrg, byte errDescLen,
            short userErrorValue, byte[] errDesc, LinkedList<PcepValueType> llRsvpUserSpecSubObj) {
        this.objHeader = objHeader;
        this.enterpriseNum = enterpriseNum;
        this.subOrg = subOrg;
        this.errDescLen = errDescLen;
        this.userErrorValue = userErrorValue;
        this.errDesc = errDesc;
        this.llRsvpUserSpecSubObj = llRsvpUserSpecSubObj;
    }

    @Override
    public int write(ChannelBuffer cb) {
        int objLenIndex = objHeader.write(cb);
        cb.writeInt(enterpriseNum);
        cb.writeByte(subOrg);
        cb.writeByte(errDescLen);
        cb.writeShort(userErrorValue);
        cb.writeBytes(errDesc);

        if (null != llRsvpUserSpecSubObj) {

            ListIterator<PcepValueType> listIterator = llRsvpUserSpecSubObj.listIterator();

            while (listIterator.hasNext()) {
                PcepValueType tlv = listIterator.next();
                if (null == tlv) {
                    continue;
                }
                tlv.write(cb);
                // need to take care of padding
                int pad = tlv.getLength() % 4;
                if (0 != pad) {
                    pad = 4 - pad;
                    for (int i = 0; i < pad; ++i) {
                        cb.writeByte((byte) 0);
                    }
                }
            }
        }
        short objLen = (short) (cb.writerIndex() - objLenIndex);
        cb.setShort(objLenIndex, objLen);
        return objLen;
    }

    /**
     * Reads the channel buffer and returns object of PcepRsvpErrorSpec.
     *
     * @param cb of type channel buffer
     * @return object of PcepRsvpErrorSpec
     * @throws PcepParseException when expected object is not received
     */
    public static PcepRsvpErrorSpec read(ChannelBuffer cb) throws PcepParseException {
        PcepRsvpSpecObjHeader objHeader;
        int enterpriseNum;
        byte subOrg;
        byte errDescLen;
        short userErrorValue;
        byte[] errDesc;
        LinkedList<PcepValueType> llRsvpUserSpecSubObj = null;

        objHeader = PcepRsvpSpecObjHeader.read(cb);

        if (CLASS_NUM != objHeader.getObjClassNum() || CLASS_TYPE != objHeader.getObjClassType()) {
            throw new PcepParseException("Expected PcepRsvpUserErrorSpec object.");
        }
        enterpriseNum = cb.readInt();
        subOrg = cb.readByte();
        errDescLen = cb.readByte();
        userErrorValue = cb.readShort();
        errDesc = new byte[errDescLen];
        cb.readBytes(errDesc, 0, errDescLen);

        llRsvpUserSpecSubObj = parseErrSpecSubObj(cb);

        return new PcepRsvpUserErrorSpec(objHeader, enterpriseNum, subOrg, errDescLen, userErrorValue, errDesc,
                llRsvpUserSpecSubObj);
    }

    private static LinkedList<PcepValueType> parseErrSpecSubObj(ChannelBuffer cb) throws PcepParseException {
        LinkedList<PcepValueType> llRsvpUserSpecSubObj = new LinkedList<PcepValueType>();
        while (0 < cb.readableBytes()) {
            PcepValueType tlv = null;
            short hType = cb.readShort();
            int iValue = 0;
            //short hLength = cb.readShort();
            switch (hType) {
            case AutonomousSystemTlv.TYPE:
                iValue = cb.readInt();
                tlv = new AutonomousSystemTlv(iValue);
                break;
            default:
                throw new PcepParseException("Unsupported Sub TLV type :" + hType);
            }
            llRsvpUserSpecSubObj.add(tlv);
        }
        return llRsvpUserSpecSubObj;
    }

    @Override
    public PcepVersion getVersion() {
        return PcepVersion.PCEP_1;
    }

    @Override
    public short getType() {
        return StatefulRsvpErrorSpecTlv.TYPE;
    }

    @Override
    public short getLength() {
        return objHeader.getObjLen();
    }

    @Override
    public byte getClassNum() {
        return CLASS_NUM;
    }

    @Override
    public byte getClassType() {
        return CLASS_TYPE;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(getClass())
                .add("enterpriseNumber:", enterpriseNum)
                .add("subOrganization:", subOrg)
                .add("errDescLength:", errDescLen)
                .add("userErrorValue:", userErrorValue)
                .add("errDesc:", errDesc)
                .add("RsvpUserSpecSubObject:", llRsvpUserSpecSubObj)
                .toString();
    }
}


text:
This is a very simple example to demonstrate how OmniAuth::PAM can be used within a
primitive [Sinatra][] application.

You can start it by doing:

```bash
sudo apt-get install bundler # or: sudo gem install bundler
bundle install --path vendor/bundle
bundle exec rackup
```

Preferably from within the Vagrantfile included in the root of the repository.

## Usage

1. Go to http://localhost:9292
2. You'll be redirected to a login page.
3. Enter a system user account (for example: vagrant/vagrant).
4. Then, you'll be redirected to another page listing the auth hash details.

[Sinatra]: http://www.sinatrarb.com


text:
export default Em.ObjectController.extend({
    save: function(){
        return this.get('model').save();
    }
});


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__int_fgets_multiply_84_bad.cpp
Label Definition File: CWE191_Integer_Underflow__int.label.xml
Template File: sources-sinks-84_bad.tmpl.cpp
*/
/*
 * @description
 * CWE: 191 Integer Underflow
 * BadSource: fgets Read data from the console using fgets()
 * GoodSource: Set data to a small, non-zero number (negative two)
 * Sinks: multiply
 *    GoodSink: Ensure there will not be an underflow before multiplying data by 2
 *    BadSink : If data is negative, multiply by 2, which can cause an underflow
 * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use
 *
 * */
#ifndef OMITBAD

#include "std_testcase.h"
#include "CWE191_Integer_Underflow__int_fgets_multiply_84.h"

#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)

namespace CWE191_Integer_Underflow__int_fgets_multiply_84
{
CWE191_Integer_Underflow__int_fgets_multiply_84_bad::CWE191_Integer_Underflow__int_fgets_multiply_84_bad(int dataCopy)
{
    data = dataCopy;
    {
        char inputBuffer[CHAR_ARRAY_SIZE] = "";
        /* POTENTIAL FLAW: Read data from the console using fgets() */
        if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL)
        {
            /* Convert to int */
            data = atoi(inputBuffer);
        }
        else
        {
            printLine("fgets() failed.");
        }
    }
}

CWE191_Integer_Underflow__int_fgets_multiply_84_bad::~CWE191_Integer_Underflow__int_fgets_multiply_84_bad()
{
    if(data < 0) /* ensure we won't have an overflow */
    {
        /* POTENTIAL FLAW: if (data * 2) < INT_MIN, this will underflow */
        int result = data * 2;
        printIntLine(result);
    }
}
}
#endif /* OMITBAD */


text:
<?php

/**
 * @todo Rewrite this bitch. Add default tables and rows with the right interfaces.
 * @todo See if the db design needs some love and attention.
 * @todo group inheritance
 */

/**
 * @see Zym_Acl_Abstract
 */
require_once 'Zym/Acl.php';

/**
 * @see Zend_Acl_Resource
 */
require_once 'Zend/Acl/Resource.php';

/**
 * @see Zend_Acl_Role
 */
require_once 'Zend/Acl/Role.php';

/**
 * @author     Jurrien Stutterheim
 * @category   Zym
 * @package    Zym_Acl
 * @copyright  Copyright (c) 2008 Zym. (http://www.zym-project.com/)
 * @license    http://www.zym-project.com/license    New BSD License
 */
class Zym_Acl_Config extends Zym_Acl
{
    /**
     * Setup the acl object using a config file.
     *
     * @param Zend_Config $config
     * @return Zym_Acl_Config
     */
    public function setup(Zend_Config $config)
    {
        $this->_setupRoles($config->roles);
        $this->_setupResources($config->resources);
        $this->_setupRules($config->rules);

        return $this;
    }

    /**
     * Setup acl roles
     *
     * @param Zend_Config $roles
     * @return Zym_Acl_Config
     */
    protected function _setupRoles(Zend_Config $roles)
    {
        foreach ($roles as $role) {
            $this->_loadRole($roles, $role);
        }

        return $this;
    }

    /**
     * Load a role
     *
     * @param Zend_Config $roles
     * @param Zend_Config $role
     */
    protected function _loadRole(Zend_Config $roles, Zend_Config $role = null)
    {
        $parents = null;

        if (isset($role->parents) && !empty($role->parents))  {
            $parents = array();

            foreach ($role->parents as $parent) {
                if (!$this->hasRole($parent->id)) {
                    $this->_loadRole($roles, $parent);
                }

                $parents[] = new Zend_Acl_Role($parent->id);
            }
        }

        if (!$this->hasRole($role->id)) {
            $this->addRole(new Zend_Acl_Role($role->id), $parents);
        }
    }

    /**
     * Setup acl rules
     *
     * @param Zend_Config $rules
     * @return Zym_Acl_Config
     */
    protected function _setupRules(Zend_Config $rules)
    {
        foreach ($rules as $rule) {
            $role = null;
            $resources = null;

            if (!empty($rule->role)) {
                $role = new Zend_Acl_Role($rule->role);
            }

            if (isset($rule->resources)) {
                $resources = array();

                foreach ($resources as $resource) {
                    $resources[] = new Zend_Acl_Resource($resource->id);
                }
            }

            if (!isset($rule->action) || $rule->action == 'deny') {
                $this->deny($role, $resources);
            } else {
                $this->allow($role, $resources);
            }
        }

        return $this;
    }

    /**
     * Setup the acl resources
     *
     * @param Zend_Config $resources
     * @return Zym_Acl_Config
     */
    protected function _setupResources(Zend_Config $resources)
    {
        foreach ($resources as $resource) {
            $parent = null;

            if (!empty($resource->parent)) {
                 $parent = new Zend_Acl_Resourc($resource->parent->id);
            }

            $this->add(new Zend_Acl_Resource($resource->id), $parent);
        }

        return $this;
    }
}


text:
<!--
  ~ Copyright 2020 Stéphane Baiget
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<merge
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:orientation="vertical"
    tools:parentTag="android.widget.LinearLayout"
    >

    <ImageView
        android:id="@+id/errorImage"
        android:layout_width="96dp"
        android:layout_height="96dp"
        android:layout_gravity="center"
        android:importantForAccessibility="no"
        android:tint="?colorAccent"
        app:srcCompat="@drawable/ic_error_outline_black_24dp"
        />

    <TextView
        android:id="@id/errorMessage"
        style="?textAppearanceBody1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="@dimen/margin_padding_size_large"
        tools:text="@string/error_general"
        />

    <com.google.android.material.button.MaterialButton
        android:id="@id/errorAction"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:padding="@dimen/margin_padding_size_medium"
        android:text="@string/error_retry_action"
        />
</merge>


text:
namespace coding
{
namespace traits
{
namespace impl
{
template <typename T>
auto is_iterable_checker(int) -> decltype(
  std::begin(std::declval<T>()),
  std::end(std::declval<T>()),
  ++std::declval<decltype(std::begin(std::declval<T>())) &>(),
  std::true_type {});

template <typename T>
std::false_type is_iterable_checker(...);

template <typename T>
auto is_dynamic_sequence_checker(int) -> decltype(
  std::declval<T &>().resize(0),
  std::declval<T &>()[0],
  std::true_type {});

template <typename T>
std::false_type is_dynamic_sequence_checker(...);
}  // namespace impl

template <typename T>
using is_iterable = decltype(impl::is_iterable_checker<T>(0));

template <typename T>
using is_dynamic_sequence = decltype(impl::is_dynamic_sequence_checker<T>(0));
}  // namespace traits

template <typename T>
using EnableIfIterable = std::enable_if_t<traits::is_iterable<T>::value>;

template <typename T>
using EnableIfNotIterable = std::enable_if_t<!traits::is_iterable<T>::value>;

template <typename T>
using EnableIfEnum = std::enable_if_t<std::is_enum<T>::value>;

template <typename T>
using EnableIfNotEnum = std::enable_if_t<!std::is_enum<T>::value>;

template <typename T>
using EnableIfVectorOrDeque = std::enable_if_t<traits::is_dynamic_sequence<T>::value &&
                                               !std::is_same<std::string, T>::value>;

template <typename T>
using EnableIfNotVectorOrDeque = std::enable_if_t<!traits::is_dynamic_sequence<T>::value>;

template<typename Sink>
class SerializerJson
{
public:
  explicit SerializerJson(Sink & sink) : m_sink(sink) {}

  virtual ~SerializerJson()
  {
    std::unique_ptr<char, JSONFreeDeleter> buffer(json_dumps(m_json.get(), 0));
    m_sink.Write(buffer.get(), strlen(buffer.get()));
  }

  template <typename T>
  void ToJsonObjectOrValue(T const & value, char const * name)
  {
    if (name != nullptr)
    {
      ToJSONObject(*m_json, name, value);
    }
    else if (json_is_array(m_json))
    {
      auto json = ToJSON(value);
      json_array_append_new(m_json.get(), json.release());
    }
    else
    {
      ASSERT(false, ("Unsupported JSON structure"));
    }
  }

  void operator()(bool const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(uint8_t const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(uint32_t const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(uint64_t const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(int8_t const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(int32_t const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(int64_t const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(double const d, char const * name = nullptr) { ToJsonObjectOrValue(d, name); }
  void operator()(std::string const & s, char const * name = nullptr) { ToJsonObjectOrValue(s, name); }

  template <typename R, EnableIfNotIterable<R> * = nullptr, EnableIfNotEnum<R> * = nullptr>
  void operator()(R const & r, char const * name = nullptr)
  {
    NewScopeWith(base::NewJSONObject(), name, [this, &r] { r.Visit(*this); });
  }

  template <typename T, EnableIfIterable<T> * = nullptr>
  void operator()(T const & src, char const * name = nullptr)
  {
    NewScopeWith(base::NewJSONArray(), name, [this, &src] {
      for (auto const & v : src)
        (*this)(v);
    });
  }

  template <typename R>
  void operator()(std::unique_ptr<R> const & r, char const * name = nullptr)
  {
    NewScopeWith(base::NewJSONObject(), name, [this, &r] {
      CHECK(r, ());
      r->Visit(*this);
    });
  }

  template <typename R>
  void operator()(std::shared_ptr<R> const & r, char const * name = nullptr)
  {
    NewScopeWith(base::NewJSONObject(), name, [this, &r] {
      CHECK(r, ());
      r->Visit(*this);
    });
  }

  void operator()(std::chrono::system_clock::time_point const & t, char const * name = nullptr)
  {
    (*this)(static_cast<uint64_t>(t.time_since_epoch().count()), name);
  }

  template <typename T, EnableIfEnum<T> * = nullptr>
  void operator()(T const & t, char const * name = nullptr)
  {
    (*this)(static_cast<std::underlying_type_t<T>>(t), name);
  }

  void operator()(m2::PointD const & p, char const * name = nullptr)
  {
    NewScopeWith(base::NewJSONObject(), name, [this, &p] {
      (*this)(p.x, "x");
      (*this)(p.y, "y");
    });
  }

  void operator()(ms::LatLon const & ll, char const * name = nullptr)
  {
    NewScopeWith(base::NewJSONObject(), name, [this, &ll] {
      (*this)(ll.m_lat, "lat");
      (*this)(ll.m_lon, "lon");
    });
  }

  template <typename Key, typename Value>
  void operator()(std::pair<Key, Value> const & p, char const * name = nullptr)
  {
    NewScopeWith(base::NewJSONObject(), name, [this, &p] {
      (*this)(p.first, "key");
      (*this)(p.second, "value");
    });
  }

  template <typename Optional>
  void operator()(Optional const & opt, Optional const &, char const * name = nullptr)
  {
    (*this)(opt, name);
  }

protected:
  template <typename Fn>
  void NewScopeWith(base::JSONPtr json_object, char const * name, Fn && fn)
  {
    base::JSONPtr safe_json = std::move(m_json);
    m_json = std::move(json_object);

    auto rollback = [this, &safe_json, name]()
    {
      if (safe_json == nullptr)
        return;

      if (json_is_array(safe_json))
        json_array_append_new(safe_json.get(), m_json.release());
      else if (json_is_object(safe_json))
        json_object_set_new(safe_json.get(), name, m_json.release());

      m_json = std::move(safe_json);
    };
    SCOPE_GUARD(rollbackJson, rollback);

    fn();
  }

  base::JSONPtr m_json = nullptr;
  Sink & m_sink;
};

class DeserializerJson
{
public:
  DECLARE_EXCEPTION(Exception, RootException);

  template <typename Source,
            typename std::enable_if<!std::is_convertible<Source, std::string>::value,
                                    Source>::type * = nullptr>
  explicit DeserializerJson(Source & source)
  {
    auto const size = static_cast<size_t>(source.Size());
    std::string src(size, '\0');
    source.Read(static_cast<void *>(&src[0]), size);
    m_jsonObject.ParseFrom(src);
    m_json = m_jsonObject.get();
  }

  explicit DeserializerJson(std::string const & source)
    : m_jsonObject(source), m_json(m_jsonObject.get())
  {
  }

  explicit DeserializerJson(json_t * json) : m_json(json) {}

  template <typename T>
  void FromJsonObjectOrValue(T & s, char const * name)
  {
    if (name != nullptr)
      FromJSONObject(m_json, name, s);
    else
      FromJSON(m_json, s);
  }

  void operator()(bool & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(uint8_t & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(uint32_t & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(uint64_t & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(int8_t & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(int32_t & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(int64_t & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(double & d, char const * name = nullptr) { FromJsonObjectOrValue(d, name); }
  void operator()(std::string & s, char const * name = nullptr) { FromJsonObjectOrValue(s, name); }

  template <typename T, EnableIfVectorOrDeque<T> * = nullptr>
  void operator()(T & dest, char const * name = nullptr)
  {
    json_t * outerContext = SaveContext(name);

    if (!json_is_array(m_json))
      MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array."));

    dest.resize(json_array_size(m_json));
    for (size_t index = 0; index < dest.size(); ++index)
    {
      json_t * context = SaveContext();
      m_json = json_array_get(context, index);
      (*this)(dest[index]);
      RestoreContext(context);
    }

    RestoreContext(outerContext);
  }

  template <typename T, class H = std::hash<T>>
  void operator()(std::unordered_set<T, H> & dest, char const * name = nullptr)
  {
    json_t * outerContext = SaveContext(name);

    if (!json_is_array(m_json))
      MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array."));

    T tmp;
    size_t const size = json_array_size(m_json);
    dest.reserve(size);
    for (size_t index = 0; index < size; ++index)
    {
      json_t * context = SaveContext();
      m_json = json_array_get(context, index);
      (*this)(tmp);
      dest.insert(tmp);
      RestoreContext(context);
    }

    RestoreContext(outerContext);
  }

  template <typename T, size_t N>
  void operator()(std::array<T, N> & dst, char const * name = nullptr)
  {
    json_t * outerContext = SaveContext(name);

    if (!json_is_array(m_json))
    {
      MYTHROW(base::Json::Exception,
              ("The field", name, "must contain a json array.", json_dumps(m_json, 0)));
    }

    if (N != json_array_size(m_json))
    {
      MYTHROW(base::Json::Exception, ("The field", name, "must contain a json array of size", N,
                                      "but size is", json_array_size(m_json)));
    }

    for (size_t index = 0; index < N; ++index)
    {
      json_t * context = SaveContext();
      m_json = json_array_get(context, index);
      (*this)(dst[index]);
      RestoreContext(context);
    }

    RestoreContext(outerContext);
  }

  template <typename Key, typename T>
  void operator()(std::map<Key, T> & dst, char const * name = nullptr)
  {
    json_t * outerContext = SaveContext(name);

    if (!json_is_array(m_json))
    {
      MYTHROW(base::Json::Exception,
              ("The field", name, "must contain a json array.", json_dumps(m_json, 0)));
    }

    size_t const size = json_array_size(m_json);
    for (size_t index = 0; index < size; ++index)
    {
      json_t * context = SaveContext();
      m_json = json_array_get(context, index);
      std::pair<Key, T> tmp;
      (*this)(tmp);
      dst.insert(tmp);
      RestoreContext(context);
    }

    RestoreContext(outerContext);
  }

  template <typename Key, typename Value>
  void operator()(std::pair<Key, Value> & dst, char const * name = nullptr)
  {
    json_t * outerContext = SaveContext(name);
    (*this)(dst.first, "key");
    (*this)(dst.second, "value");
    RestoreContext(outerContext);
  }

  template <typename R, EnableIfNotEnum<R> * = nullptr, EnableIfNotVectorOrDeque<R> * = nullptr>
  void operator()(R & r, char const * name = nullptr)
  {
    json_t * context = SaveContext(name);
    r.Visit(*this);
    RestoreContext(context);
  }

  template <typename R>
  void operator()(std::unique_ptr<R> & r, char const * name = nullptr)
  {
    json_t * context = SaveContext(name);
    if (!r)
      r = std::make_unique<R>();
    r->Visit(*this);
    RestoreContext(context);
  }

  template <typename R>
  void operator()(std::shared_ptr<R> & r, char const * name = nullptr)
  {
    json_t * context = SaveContext(name);
    if (!r)
      r = std::make_shared<R>();
    r->Visit(*this);
    RestoreContext(context);
  }

  void operator()(std::chrono::system_clock::time_point & dst, char const * name = nullptr)
  {
    uint64_t t = 0;
    FromJSONObject(m_json, name, t);

    std::chrono::system_clock::time_point::duration d(t);

    dst = std::chrono::system_clock::time_point(d);
  }

  template <typename T, EnableIfEnum<T> * = nullptr>
  void operator()(T & t, char const * name = nullptr)
  {
    using UnderlyingType = std::underlying_type_t<T>;
    UnderlyingType res;
    FromJSONObject(m_json, name, res);
    t = static_cast<T>(res);
  }

  void operator()(m2::PointD & p, char const * name = nullptr)
  {
    json_t * outerContext = SaveContext(name);
    (*this)(p.x, "x");
    (*this)(p.y, "y");
    RestoreContext(outerContext);
  }

  void operator()(ms::LatLon & ll, char const * name = nullptr)
  {
    json_t * outerContext = SaveContext(name);
    (*this)(ll.m_lat, "lat");
    (*this)(ll.m_lon, "lon");
    RestoreContext(outerContext);
  }

  template <typename Optional>
  void operator()(Optional & opt, Optional const & defaultValue, char const * name = nullptr)
  {
    auto json = base::GetJSONOptionalField(m_json, name);
    if (!json)
    {
      opt = defaultValue;
      return;
    }

    (*this)(opt, name);
  }

protected:
  json_t * SaveContext(char const * name = nullptr)
  {
    json_t * context = m_json;
    if (name)
      m_json = base::GetJSONObligatoryField(context, name);
    return context;
  }

  void RestoreContext(json_t * context)
  {
    if (context)
      m_json = context;
  }

  base::Json m_jsonObject;
  json_t * m_json = nullptr;
};
}  // namespace coding


text:
if is_mode("debug") then

    -- enable the debug symbols
    set_symbols("debug")

    -- disable optimization
    set_optimize("none")
end

-- the release mode
if is_mode("release") then

    -- set the symbols visibility: hidden
    set_symbols("hidden")

    -- enable fastest optimization
    set_optimize("fastest")

    -- strip all symbols
    set_strip("all")
end

-- add target
target("add")

    -- set kind
    set_kind("static")

    -- add files
    add_files("src/add.c")

-- add target
target("sub")

    -- set kind
    set_kind("static")

    -- add files
    add_files("src/sub.c")

-- add target
target("mul")

    -- set kind
    set_kind("static")

    -- add deps
    add_deps("add", "sub")

    -- add files
    add_files("src/mul.c")
    add_files("build/libadd.a")
    add_files("build/libsub.a")

    -- add link directory
    add_linkdirs("$(buildir)")


text:
from signpy.core.DataRecorder import DataRecorder

dr = DataRecorder()
dr.begin_recording()


text:
from pandocfilters import *
import re
from links_processing import *

def extract_file_marker(key, value):
    """Extract the file marker (if exists) from the given Pandoc object

    Arguments:
    key - key of the Pandoc object
    value - value of the Pandoc object
    """
    if key == 'RawInline' and value[0] == 'html':
        match = re.match(r'^<md2pdf:file:(.*)/>$', value[1])
        if match is not None:
            return match.group(1)
        else:
            return None
    else:
        return None

def html_inline_filter(value,markdown_filepath,generate_anchor):
    anchor_id_prefix = slugify_string(markdown_filepath)

    anchor_regexes = [
        r'<a[ \t]+name="(.*)"[ \t]*>',
        r'<a[ \t]+name="(.*)"[ \t]*/>'
    ]

    inline_html = value[1]

    for anchor_regex in anchor_regexes:
        match = re.match(anchor_regex,inline_html,re.IGNORECASE)
        if match is not None:
            if generate_anchor == True:
                return RawInline('tex',generate_latex_anchor(anchor_id_prefix + slugify_string(match.group(1))))
            else:
                return RawInline('tex',generate_latex_label(anchor_id_prefix + slugify_string(match.group(1))))

    return None

def header_filter(value,format,meta,markdown_filepath):
    """Filter applied by Pandoc to headers"""
    anchor_id_prefix = slugify_string(markdown_filepath)

    # Generate a LaTeX anchor fo the header
    latex_anchor = generate_latex_label(make_header_id_unique(generate_pandoc_header_slug(markdown_filepath, stringify(value[2])), header_filter.used_ids))

    # Process header children using the right filter.
    header_content = walk(value[2], header_children_filter, format, meta)

    # Replace the old header with a new one with its children processed and
    # an added LaTeX anchor.
    return Header(
        value[0],
        value[1],
        header_content + [RawInline('tex',latex_anchor)]
    )
header_filter.used_ids = {}

def header_children_filter(key, value, format, meta):
    """Filter applied by Pandoc to the children of all headers"""
    if key == 'Code':
        # Aparently, Pandoc does not like code inside headers. We turn code
        # into plain strings.
        return Emph([Str(value[1])])
    elif key == 'RawInline' and value[0] == 'html':
        return html_inline_filter(value,pandoc_filter.current_file,False)
    else:
        return None

def pandoc_filter(key, value, format, meta):
    """Filter applied by Pandoc when converting from Mardown to PDF"""
    if key == 'Link':
        value[1][0] = process_link_destination(value[1][0], pandoc_filter.current_file)
        if len(value[1][0]) == 0:
            print_warning(
                "Found empty link ([%s]()) in file [%s]" %
                (stringify(value[0]), pandoc_filter.current_file)
            )
        # Process link children in AST tree
        value[0] = walk(value[0],pandoc_filter,format,meta)
        return Link(value[0],value[1])
    elif key == 'Image':
        src_image_path = value[1][0]
        value[1][0] = make_image_path_absolute(value[1][0], pandoc_filter.current_file)
        if is_image_broken(value[1][0]):
            print_warning(
                (
                'Ignoring local image not found [%s] in file [%s]' +
                '- Warning added to PDF'
                ) % (
                    unicode(src_image_path).encode('utf-8'),
                    unicode(pandoc_filter.current_file).encode('utf-8')
                )
            )
            return RawInline('tex', print_image_not_found(src_image_path.encode('utf-8')))
        else:
            return Image(value[0],value[1])
    elif key == 'Header':
        return header_filter(value,format,meta,pandoc_filter.current_file)
    elif key == 'RawInline' and value[0] == 'html':
        html_filter_result = html_inline_filter(value, pandoc_filter.current_file,True)
        if html_filter_result is not None:
            return html_filter_result
        else:
            file_marker = extract_file_marker(key,value)
            if file_marker is not None:
                pandoc_filter.current_file = file_marker
            return None

pandoc_filter.current_file = ''

def main():
    toJSONFilter(pandoc_filter)

if __name__ == "__main__":
    main()


text:
package java.awt.geom;

import java.io.Serial;

/**
 * The {@code IllegalPathStateException} represents an
 * exception that is thrown if an operation is performed on a path
 * that is in an illegal state with respect to the particular
 * operation being performed, such as appending a path segment
 * to a {@link GeneralPath} without an initial moveto.
 *
 */

public class IllegalPathStateException extends RuntimeException {

    /**
     * Use serialVersionUID from JDK 9 for interoperability.
     */
    @Serial
    private static final long serialVersionUID = -5158084205220481094L;

    /**
     * Constructs an {@code IllegalPathStateException} with no
     * detail message.
     *
     * @since   1.2
     */
    public IllegalPathStateException() {
    }

    /**
     * Constructs an {@code IllegalPathStateException} with the
     * specified detail message.
     * @param   s   the detail message
     * @since   1.2
     */
    public IllegalPathStateException(String s) {
        super (s);
    }
}


text:
package ru.job4j.pattern.strategy;

/**
 * Shape interface.
 */
public interface Shape {
	/**
	 * Method for returning the shape.
	 *
	 * @return String Any shape.
	 */
	String picture();
}