text:
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Siswa extends CI_Controller
{

    function __construct()
    {
        parent::__construct();
        $this->load->model('Siswa_model');
        $this->load->library('form_validation');
    }

    public function index()
    {
        $siswa = $this->Siswa_model->get_all_query();

        $data = array(
            'siswa_data' => $siswa
        );

        $this->template->load('template','siswa_list', $data);
    }

    public function read($id)
    {
        $row = $this->Siswa_model->get_by_id($id);
        if ($row) {
            $data = array(
		'id' => $row->id,
		'nama' => $row->nama,
		'id_jurusan' => $row->id_jurusan,
	    );
            $this->template->load('template','siswa_read', $data);
        } else {
            $this->session->set_flashdata('message', 'Record Not Found');
            redirect(site_url('siswa'));
        }
    }

    public function create()
    {
        $data = array(
            'button' => 'Create',
            'action' => site_url('siswa/create_action'),
	    'id' => set_value('id'),
	    'nama' => set_value('nama'),
	    'id_jurusan' => set_value('id_jurusan'),
	);
        $this->template->load('template','siswa_form', $data);
    }

    public function create_action()
    {
        $this->_rules();

        if ($this->form_validation->run() == FALSE) {
            $this->create();
        } else {
            $data = array(
		'nama' => $this->input->post('nama',TRUE),
		'id_jurusan' => $this->input->post('id_jurusan',TRUE),
	    );

            $this->Siswa_model->insert($data);
            $this->session->set_flashdata('message', 'Create Record Success');
            redirect(site_url('siswa'));
        }
    }

    public function update($id)
    {
        $row = $this->Siswa_model->get_by_id($id);

        if ($row) {
            $data = array(
                'button' => 'Update',
                'action' => site_url('siswa/update_action'),
		'id' => set_value('id', $row->id),
		'nama' => set_value('nama', $row->nama),
		'id_jurusan' => set_value('id_jurusan', $row->id_jurusan),
	    );
            $this->template->load('template','siswa_form', $data);
        } else {
            $this->session->set_flashdata('message', 'Record Not Found');
            redirect(site_url('siswa'));
        }
    }

    public function update_action()
    {
        $this->_rules();

        if ($this->form_validation->run() == FALSE) {
            $this->update($this->input->post('id', TRUE));
        } else {
            $data = array(
		'nama' => $this->input->post('nama',TRUE),
		'id_jurusan' => $this->input->post('id_jurusan',TRUE),
	    );

            $this->Siswa_model->update($this->input->post('id', TRUE), $data);
            $this->session->set_flashdata('message', 'Update Record Success');
            redirect(site_url('siswa'));
        }
    }

    public function delete($id)
    {
        $row = $this->Siswa_model->get_by_id($id);

        if ($row) {
            $this->Siswa_model->delete($id);
            $this->session->set_flashdata('message', 'Delete Record Success');
            redirect(site_url('siswa'));
        } else {
            $this->session->set_flashdata('message', 'Record Not Found');
            redirect(site_url('siswa'));
        }
    }

    public function _rules()
    {
	$this->form_validation->set_rules('nama', 'nama', 'trim|required');
	$this->form_validation->set_rules('id_jurusan', 'id jurusan', 'trim|required');

	$this->form_validation->set_rules('id', 'id', 'trim');
	$this->form_validation->set_error_delimiters('', '');
    }

    public function excel()
    {
        $this->load->helper('exportexcel');
        $namaFile = "siswa.xls";
        $judul = "siswa";
        $tablehead = 0;
        $tablebody = 1;
        $nourut = 1;
        //penulisan header
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header("Content-Disposition: attachment;filename=" . $namaFile . "");
        header("Content-Transfer-Encoding: binary ");

        xlsBOF();

        $kolomhead = 0;
        xlsWriteLabel($tablehead, $kolomhead++, "No");
	xlsWriteLabel($tablehead, $kolomhead++, "Nama");
	xlsWriteLabel($tablehead, $kolomhead++, "Id Jurusan");

	foreach ($this->Siswa_model->get_all() as $data) {
            $kolombody = 0;

            //ubah xlsWriteLabel menjadi xlsWriteNumber untuk kolom numeric
            xlsWriteNumber($tablebody, $kolombody++, $nourut);
	    xlsWriteLabel($tablebody, $kolombody++, $data->nama);
	    xlsWriteNumber($tablebody, $kolombody++, $data->id_jurusan);

	    $tablebody++;
            $nourut++;
        }

        xlsEOF();
        exit();
    }

    public function word()
    {
        header("Content-type: application/vnd.ms-word");
        header("Content-Disposition: attachment;Filename=siswa.doc");

        $data = array(
            'siswa_data' => $this->Siswa_model->get_all(),
            'start' => 0
        );

        $this->load->view('siswa_doc',$data);
    }

}

/* End of file Siswa.php */
/* Location: ./application/controllers/Siswa.php */
/* Please DO NOT modify this information : */
/* Generated by Harviacode Codeigniter CRUD Generator 2015-12-31 12:04:46 */
/* http://harviacode.com */


text:
// Kernel name: SetupForHWMC.asm
//
// Initial setup for running HWMC kernels in HWMC-Only decoding mode
//
#include "header.inc"
#include "intra_Header.inc"

#if !defined(__SETUPFORHWMC__)	// Make sure the following are only included once
#define __SETUPFORHWMC__

.reg_count_total    64
.reg_count_payload  2

//
//  Now, begin source code....
//

.code
#endif	// !defined(__SETUPFORHWMC__)

    mov (8)	MSGSRC<1>:ud	r0.0<8;8,1>:ud			// Initialize message header payload with R0
	shl (2) I_ORIX<1>:uw	ORIX<2;2,1>:ub	4:w		// Convert MB origin to pixel unit

// End of SetupForHWMC

redpajama_set_name: RedPajamaGithub


text:
#
# Author:: John Keiser (<jkeiser@chef.io>)
# Copyright:: Copyright 2012-2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# 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.
#

require "spec_helper"
require "chef/chef_fs/file_pattern"

describe Chef::ChefFS::FilePattern do
  def p(str)
    Chef::ChefFS::FilePattern.new(str)
  end

  # Different kinds of patterns
  context 'with empty pattern ""' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("") }
    it "match?" do
      expect(pattern.match?("")).to be_truthy
      expect(pattern.match?("/")).to be_falsey
      expect(pattern.match?("a")).to be_falsey
      expect(pattern.match?("a/b")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to eq("")
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("")).to be_falsey
      expect(pattern.could_match_children?("a/b")).to be_falsey
    end
  end

  context 'with root pattern "/"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/") }
    it "match?" do
      expect(pattern.match?("/")).to be_truthy
      expect(pattern.match?("")).to be_falsey
      expect(pattern.match?("a")).to be_falsey
      expect(pattern.match?("/a")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to eq("/")
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("")).to be_falsey
      expect(pattern.could_match_children?("/")).to be_falsey
      expect(pattern.could_match_children?("a")).to be_falsey
      expect(pattern.could_match_children?("a/b")).to be_falsey
      expect(pattern.could_match_children?("/a")).to be_falsey
    end
  end

  context 'with simple pattern "abc"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("abc") }
    it "match?" do
      expect(pattern.match?("abc")).to be_truthy
      expect(pattern.match?("a")).to be_falsey
      expect(pattern.match?("abcd")).to be_falsey
      expect(pattern.match?("/abc")).to be_falsey
      expect(pattern.match?("")).to be_falsey
      expect(pattern.match?("/")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to eq("abc")
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("")).to be_falsey
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/abc")).to be_falsey
    end
  end

  context 'with simple pattern "/abc"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc") }
    it "match?" do
      expect(pattern.match?("/abc")).to be_truthy
      expect(pattern.match?("abc")).to be_falsey
      expect(pattern.match?("a")).to be_falsey
      expect(pattern.match?("abcd")).to be_falsey
      expect(pattern.match?("")).to be_falsey
      expect(pattern.match?("/")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to eq("/abc")
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/abc")).to be_falsey
      expect(pattern.could_match_children?("/")).to be_truthy
      expect(pattern.could_match_children?("")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
    end
  end

  context 'with simple pattern "abc/def/ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("abc/def/ghi") }
    it "match?" do
      expect(pattern.match?("abc/def/ghi")).to be_truthy
      expect(pattern.match?("/abc/def/ghi")).to be_falsey
      expect(pattern.match?("abc")).to be_falsey
      expect(pattern.match?("abc/def")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to eq("abc/def/ghi")
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("abc")).to be_truthy
      expect(pattern.could_match_children?("xyz")).to be_falsey
      expect(pattern.could_match_children?("/abc")).to be_falsey
      expect(pattern.could_match_children?("abc/def")).to be_truthy
      expect(pattern.could_match_children?("abc/xyz")).to be_falsey
      expect(pattern.could_match_children?("abc/def/ghi")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("abc")).to eq("def")
      expect(pattern.exact_child_name_under("abc/def")).to eq("ghi")
    end
  end

  context 'with simple pattern "/abc/def/ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/def/ghi") }
    it "match?" do
      expect(pattern.match?("/abc/def/ghi")).to be_truthy
      expect(pattern.match?("abc/def/ghi")).to be_falsey
      expect(pattern.match?("/abc")).to be_falsey
      expect(pattern.match?("/abc/def")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to eq("/abc/def/ghi")
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/xyz")).to be_falsey
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/abc/def")).to be_truthy
      expect(pattern.could_match_children?("/abc/xyz")).to be_falsey
      expect(pattern.could_match_children?("/abc/def/ghi")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
      expect(pattern.exact_child_name_under("/abc")).to eq("def")
      expect(pattern.exact_child_name_under("/abc/def")).to eq("ghi")
    end
  end

  context 'with simple pattern "a\*\b"', skip: (Chef::Platform.windows?) do
    let(:pattern) { Chef::ChefFS::FilePattern.new('a\*\b') }
    it "match?" do
      expect(pattern.match?("a*b")).to be_truthy
      expect(pattern.match?("ab")).to be_falsey
      expect(pattern.match?("acb")).to be_falsey
      expect(pattern.match?("ab")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to eq("a*b")
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("a/*b")).to be_falsey
    end
  end

  context 'with star pattern "/abc/*/ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/*/ghi") }
    it "match?" do
      expect(pattern.match?("/abc/def/ghi")).to be_truthy
      expect(pattern.match?("/abc/ghi")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/xyz")).to be_falsey
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/abc/def")).to be_truthy
      expect(pattern.could_match_children?("/abc/xyz")).to be_truthy
      expect(pattern.could_match_children?("/abc/def/ghi")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
      expect(pattern.exact_child_name_under("/abc")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc/def")).to eq("ghi")
    end
  end

  context 'with star pattern "/abc/d*f/ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/d*f/ghi") }
    it "match?" do
      expect(pattern.match?("/abc/def/ghi")).to be_truthy
      expect(pattern.match?("/abc/dxf/ghi")).to be_truthy
      expect(pattern.match?("/abc/df/ghi")).to be_truthy
      expect(pattern.match?("/abc/dxyzf/ghi")).to be_truthy
      expect(pattern.match?("/abc/d/ghi")).to be_falsey
      expect(pattern.match?("/abc/f/ghi")).to be_falsey
      expect(pattern.match?("/abc/ghi")).to be_falsey
      expect(pattern.match?("/abc/xyz/ghi")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/xyz")).to be_falsey
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/abc/def")).to be_truthy
      expect(pattern.could_match_children?("/abc/xyz")).to be_falsey
      expect(pattern.could_match_children?("/abc/dxyzf")).to be_truthy
      expect(pattern.could_match_children?("/abc/df")).to be_truthy
      expect(pattern.could_match_children?("/abc/d")).to be_falsey
      expect(pattern.could_match_children?("/abc/f")).to be_falsey
      expect(pattern.could_match_children?("/abc/def/ghi")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
      expect(pattern.exact_child_name_under("/abc")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc/def")).to eq("ghi")
    end
  end

  context 'with star pattern "/abc/d??f/ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/d??f/ghi") }
    it "match?" do
      expect(pattern.match?("/abc/deef/ghi")).to be_truthy
      expect(pattern.match?("/abc/deeef/ghi")).to be_falsey
      expect(pattern.match?("/abc/def/ghi")).to be_falsey
      expect(pattern.match?("/abc/df/ghi")).to be_falsey
      expect(pattern.match?("/abc/d/ghi")).to be_falsey
      expect(pattern.match?("/abc/f/ghi")).to be_falsey
      expect(pattern.match?("/abc/ghi")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/xyz")).to be_falsey
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/abc/deef")).to be_truthy
      expect(pattern.could_match_children?("/abc/deeef")).to be_falsey
      expect(pattern.could_match_children?("/abc/def")).to be_falsey
      expect(pattern.could_match_children?("/abc/df")).to be_falsey
      expect(pattern.could_match_children?("/abc/d")).to be_falsey
      expect(pattern.could_match_children?("/abc/f")).to be_falsey
      expect(pattern.could_match_children?("/abc/deef/ghi")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
      expect(pattern.exact_child_name_under("/abc")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc/deef")).to eq("ghi")
    end
  end

  context 'with star pattern "/abc/d[a-z][0-9]f/ghi"', skip: (Chef::Platform.windows?) do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/d[a-z][0-9]f/ghi") }
    it "match?" do
      expect(pattern.match?("/abc/de1f/ghi")).to be_truthy
      expect(pattern.match?("/abc/deef/ghi")).to be_falsey
      expect(pattern.match?("/abc/d11f/ghi")).to be_falsey
      expect(pattern.match?("/abc/de11f/ghi")).to be_falsey
      expect(pattern.match?("/abc/dee1f/ghi")).to be_falsey
      expect(pattern.match?("/abc/df/ghi")).to be_falsey
      expect(pattern.match?("/abc/d/ghi")).to be_falsey
      expect(pattern.match?("/abc/f/ghi")).to be_falsey
      expect(pattern.match?("/abc/ghi")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/xyz")).to be_falsey
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/abc/de1f")).to be_truthy
      expect(pattern.could_match_children?("/abc/deef")).to be_falsey
      expect(pattern.could_match_children?("/abc/d11f")).to be_falsey
      expect(pattern.could_match_children?("/abc/de11f")).to be_falsey
      expect(pattern.could_match_children?("/abc/dee1f")).to be_falsey
      expect(pattern.could_match_children?("/abc/def")).to be_falsey
      expect(pattern.could_match_children?("/abc/df")).to be_falsey
      expect(pattern.could_match_children?("/abc/d")).to be_falsey
      expect(pattern.could_match_children?("/abc/f")).to be_falsey
      expect(pattern.could_match_children?("/abc/de1f/ghi")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
      expect(pattern.exact_child_name_under("/abc")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc/de1f")).to eq("ghi")
    end
  end

  context 'with star pattern "/abc/**/ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/**/ghi") }
    it "match?" do
      expect(pattern.match?("/abc/def/ghi")).to be_truthy
      expect(pattern.match?("/abc/d/e/f/ghi")).to be_truthy
      expect(pattern.match?("/abc/ghi")).to be_falsey
      expect(pattern.match?("/abcdef/d/ghi")).to be_falsey
      expect(pattern.match?("/abc/d/defghi")).to be_falsey
      expect(pattern.match?("/xyz")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/abc/d")).to be_truthy
      expect(pattern.could_match_children?("/abc/d/e")).to be_truthy
      expect(pattern.could_match_children?("/abc/d/e/f")).to be_truthy
      expect(pattern.could_match_children?("/abc/def/ghi")).to be_truthy
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/xyz")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
      expect(pattern.exact_child_name_under("/abc")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc/def")).to eq(nil)
    end
  end

  context 'with star pattern "/abc**/ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc**/ghi") }
    it "match?" do
      expect(pattern.match?("/abc/def/ghi")).to be_truthy
      expect(pattern.match?("/abc/d/e/f/ghi")).to be_truthy
      expect(pattern.match?("/abc/ghi")).to be_truthy
      expect(pattern.match?("/abcdef/ghi")).to be_truthy
      expect(pattern.match?("/abc/defghi")).to be_falsey
      expect(pattern.match?("/xyz")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/abcdef")).to be_truthy
      expect(pattern.could_match_children?("/abc/d/e")).to be_truthy
      expect(pattern.could_match_children?("/abc/d/e/f")).to be_truthy
      expect(pattern.could_match_children?("/abc/def/ghi")).to be_truthy
      expect(pattern.could_match_children?("abc")).to be_falsey
    end

    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc/def")).to eq(nil)
    end
  end

  context 'with star pattern "/abc/**ghi"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/**ghi") }
    it "match?" do
      expect(pattern.match?("/abc/def/ghi")).to be_truthy
      expect(pattern.match?("/abc/def/ghi/ghi")).to be_truthy
      expect(pattern.match?("/abc/def/ghi/jkl")).to be_falsey
      expect(pattern.match?("/abc/d/e/f/ghi")).to be_truthy
      expect(pattern.match?("/abc/ghi")).to be_truthy
      expect(pattern.match?("/abcdef/ghi")).to be_falsey
      expect(pattern.match?("/abc/defghi")).to be_truthy
      expect(pattern.match?("/xyz")).to be_falsey
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
    it "could_match_children?" do
      expect(pattern.could_match_children?("/abc")).to be_truthy
      expect(pattern.could_match_children?("/abcdef")).to be_falsey
      expect(pattern.could_match_children?("/abc/d/e")).to be_truthy
      expect(pattern.could_match_children?("/abc/d/e/f")).to be_truthy
      expect(pattern.could_match_children?("/abc/def/ghi")).to be_truthy
      expect(pattern.could_match_children?("abc")).to be_falsey
      expect(pattern.could_match_children?("/xyz")).to be_falsey
    end
    it "exact_child_name_under" do
      expect(pattern.exact_child_name_under("/")).to eq("abc")
      expect(pattern.exact_child_name_under("/abc")).to eq(nil)
      expect(pattern.exact_child_name_under("/abc/def")).to eq(nil)
    end
  end

  context 'with star pattern "a**b**c"' do
    let(:pattern) { Chef::ChefFS::FilePattern.new("a**b**c") }
    it "match?" do
      expect(pattern.match?("axybzwc")).to be_truthy
      expect(pattern.match?("abc")).to be_truthy
      expect(pattern.match?("axyzwc")).to be_falsey
      expect(pattern.match?("ac")).to be_falsey
      expect(pattern.match?("a/x/y/b/z/w/c")).to be_truthy
    end
    it "exact_path" do
      expect(pattern.exact_path).to be_nil
    end
  end

  context "normalization tests" do
    it "handles trailing slashes" do
      expect(p("abc/").normalized_pattern).to eq("abc")
      expect(p("abc/").exact_path).to eq("abc")
      expect(p("abc/").match?("abc")).to be_truthy
      expect(p("//").normalized_pattern).to eq("/")
      expect(p("//").exact_path).to eq("/")
      expect(p("//").match?("/")).to be_truthy
      expect(p("/./").normalized_pattern).to eq("/")
      expect(p("/./").exact_path).to eq("/")
      expect(p("/./").match?("/")).to be_truthy
    end
    it "handles multiple slashes" do
      expect(p("abc//def").normalized_pattern).to eq("abc/def")
      expect(p("abc//def").exact_path).to eq("abc/def")
      expect(p("abc//def").match?("abc/def")).to be_truthy
      expect(p("abc//").normalized_pattern).to eq("abc")
      expect(p("abc//").exact_path).to eq("abc")
      expect(p("abc//").match?("abc")).to be_truthy
    end
    it "handles dot" do
      expect(p("abc/./def").normalized_pattern).to eq("abc/def")
      expect(p("abc/./def").exact_path).to eq("abc/def")
      expect(p("abc/./def").match?("abc/def")).to be_truthy
      expect(p("./abc/def").normalized_pattern).to eq("abc/def")
      expect(p("./abc/def").exact_path).to eq("abc/def")
      expect(p("./abc/def").match?("abc/def")).to be_truthy
      expect(p("/.").normalized_pattern).to eq("/")
      expect(p("/.").exact_path).to eq("/")
      expect(p("/.").match?("/")).to be_truthy
    end
    it "handles dotdot" do
      expect(p("abc/../def").normalized_pattern).to eq("def")
      expect(p("abc/../def").exact_path).to eq("def")
      expect(p("abc/../def").match?("def")).to be_truthy
      expect(p("abc/def/../..").normalized_pattern).to eq("")
      expect(p("abc/def/../..").exact_path).to eq("")
      expect(p("abc/def/../..").match?("")).to be_truthy
      expect(p("/*/../def").normalized_pattern).to eq("/def")
      expect(p("/*/../def").exact_path).to eq("/def")
      expect(p("/*/../def").match?("/def")).to be_truthy
      expect(p("/*/*/../def").normalized_pattern).to eq("/*/def")
      expect(p("/*/*/../def").exact_path).to be_nil
      expect(p("/*/*/../def").match?("/abc/def")).to be_truthy
      expect(p("/abc/def/../..").normalized_pattern).to eq("/")
      expect(p("/abc/def/../..").exact_path).to eq("/")
      expect(p("/abc/def/../..").match?("/")).to be_truthy
      expect(p("abc/../../def").normalized_pattern).to eq("../def")
      expect(p("abc/../../def").exact_path).to eq("../def")
      expect(p("abc/../../def").match?("../def")).to be_truthy
    end
    it "handles dotdot with double star" do
      expect(p("abc**/def/../ghi").exact_path).to be_nil
      expect(p("abc**/def/../ghi").match?("abc/ghi")).to be_truthy
      expect(p("abc**/def/../ghi").match?("abc/x/y/z/ghi")).to be_truthy
      expect(p("abc**/def/../ghi").match?("ghi")).to be_falsey
    end
    it "raises error on dotdot with overlapping double star" do
      expect { Chef::ChefFS::FilePattern.new("abc/**/../def").exact_path }.to raise_error(ArgumentError)
      expect { Chef::ChefFS::FilePattern.new("abc/**/abc/../../def").exact_path }.to raise_error(ArgumentError)
    end
    it "handles leading dotdot" do
      expect(p("../abc/def").exact_path).to eq("../abc/def")
      expect(p("../abc/def").match?("../abc/def")).to be_truthy
      expect(p("/../abc/def").exact_path).to eq("/abc/def")
      expect(p("/../abc/def").match?("/abc/def")).to be_truthy
      expect(p("..").exact_path).to eq("..")
      expect(p("..").match?("..")).to be_truthy
      expect(p("/..").exact_path).to eq("/")
      expect(p("/..").match?("/")).to be_truthy
    end
  end

  # match?
  #  - single element matches (empty, fixed, ?, *, characters, escapes)
  #  - nested matches
  #  - absolute matches
  #  - trailing slashes
  #  - **

  # exact_path
  #  - empty
  #  - single element and nested matches, with escapes
  #  - absolute and relative
  #  - ?, *, characters, **

  # could_match_children?
  #
  #
  #
  #
  context 'with pattern "abc"' do
  end

  context 'with pattern "/abc"' do
  end

  context 'with pattern "abc/def/ghi"' do
  end

  context 'with pattern "/abc/def/ghi"' do
  end

  # Exercise the different methods to their maximum
end


text:
title: Inside a Computer
layout: post
author: michael.fahey
permalink: /inside-a-computer/
source-id: 17Kg47MYT7ENhwuuWky4ZEtvWkvAwtsugpXxbLjOIh9c
published: true
---
![image alt text]({{ site.url }}/public/3Hf76Cu5rTeQUrHuZTV7Qw_img_0.png)


text:
<?php

namespace Drupal\Tests;

use Behat\Mink\Exception\ExpectationException;
use Behat\Mink\WebAssert as MinkWebAssert;
use Behat\Mink\Element\TraversableElement;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Session;
use Drupal\Component\Utility\Html;
use Drupal\Core\Url;

/**
 * Defines a class with methods for asserting presence of elements during tests.
 */
class WebAssert extends MinkWebAssert {

  /**
   * The absolute URL of the site under test.
   *
   * @var string
   */
  protected $baseUrl = '';

  /**
   * Constructor.
   *
   * @param \Behat\Mink\Session $session
   *   The Behat session object;
   * @param string $base_url
   *   The base URL of the site under test.
   */
  public function __construct(Session $session, $base_url = '') {
    parent::__construct($session);
    $this->baseUrl = $base_url;
  }

  /**
   * {@inheritdoc}
   */
  protected function cleanUrl($url) {
    if ($url instanceof Url) {
      $url = $url->setAbsolute()->toString();
    }
    // Strip the base URL from the beginning for absolute URLs.
    if ($this->baseUrl !== '' && strpos($url, $this->baseUrl) === 0) {
      $url = substr($url, strlen($this->baseUrl));
    }
    // Make sure there is a forward slash at the beginning of relative URLs for
    // consistency.
    if (parse_url($url, PHP_URL_HOST) === NULL && strpos($url, '/') !== 0) {
      $url = "/$url";
    }
    return parent::cleanUrl($url);
  }

  /**
   * Checks that specific button exists on the current page.
   *
   * @param string $button
   *   One of id|name|label|value for the button.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @return \Behat\Mink\Element\NodeElement
   *   The matching element.
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   *   When the element doesn't exist.
   */
  public function buttonExists($button, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    $node = $container->findButton($button);

    if ($node === NULL) {
      throw new ElementNotFoundException($this->session, 'button', 'id|name|label|value', $button);
    }

    return $node;
  }

  /**
   * Checks that the specific button does NOT exist on the current page.
   *
   * @param string $button
   *   One of id|name|label|value for the button.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   When the button exists.
   */
  public function buttonNotExists($button, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    $node = $container->findButton($button);

    $this->assert(NULL === $node, sprintf('A button "%s" appears on this page, but it should not.', $button));
  }

  /**
   * Checks that specific select field exists on the current page.
   *
   * @param string $select
   *   One of id|name|label|value for the select field.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @return \Behat\Mink\Element\NodeElement
   *   The matching element
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   *   When the element doesn't exist.
   */
  public function selectExists($select, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    $node = $container->find('named', [
      'select',
      $this->session->getSelectorsHandler()->xpathLiteral($select),
    ]);

    if ($node === NULL) {
      throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $select);
    }

    return $node;
  }

  /**
   * Checks that specific option in a select field exists on the current page.
   *
   * @param string $select
   *   One of id|name|label|value for the select field.
   * @param string $option
   *   The option value.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @return \Behat\Mink\Element\NodeElement
   *   The matching option element
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   *   When the element doesn't exist.
   */
  public function optionExists($select, $option, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    $select_field = $container->find('named', [
      'select',
      $this->session->getSelectorsHandler()->xpathLiteral($select),
    ]);

    if ($select_field === NULL) {
      throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $select);
    }

    $option_field = $select_field->find('named', ['option', $option]);

    if ($option_field === NULL) {
      throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $option);
    }

    return $option_field;
  }

  /**
   * Checks that an option in a select field does NOT exist on the current page.
   *
   * @param string $select
   *   One of id|name|label|value for the select field.
   * @param string $option
   *   The option value that shoulkd not exist.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   *   When the select element doesn't exist.
   */
  public function optionNotExists($select, $option, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    $select_field = $container->find('named', [
      'select',
      $this->session->getSelectorsHandler()->xpathLiteral($select),
    ]);

    if ($select_field === NULL) {
      throw new ElementNotFoundException($this->session, 'select', 'id|name|label|value', $select);
    }

    $option_field = $select_field->find('named', ['option', $option]);

    $this->assert($option_field === NULL, sprintf('An option "%s" exists in select "%s", but it should not.', $option, $select));
  }

  /**
   * Pass if the page title is the given string.
   *
   * @param string $expected_title
   *   The string the page title should be.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   Thrown when element doesn't exist, or the title is a different one.
   */
  public function titleEquals($expected_title) {
    $title_element = $this->session->getPage()->find('css', 'title');
    if (!$title_element) {
      throw new ExpectationException('No title element found on the page', $this->session->getDriver());
    }
    $actual_title = $title_element->getText();
    $this->assert($expected_title === $actual_title, 'Title found');
  }

  /**
   * Passes if a link with the specified label is found.
   *
   * An optional link index may be passed.
   *
   * @param string $label
   *   Text between the anchor tags.
   * @param int $index
   *   Link position counting from zero.
   * @param string $message
   *   (optional) A message to display with the assertion. Do not translate
   *   messages: use strtr() to embed variables in the message text, not
   *   t(). If left blank, a default message will be displayed.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   Thrown when element doesn't exist, or the link label is a different one.
   */
  public function linkExists($label, $index = 0, $message = '') {
    $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label]));
    $links = $this->session->getPage()->findAll('named', ['link', $label]);
    $this->assert(!empty($links[$index]), $message);
  }

  /**
   * Passes if a link with the exactly specified label is found.
   *
   * An optional link index may be passed.
   *
   * @param string $label
   *   Text between the anchor tags.
   * @param int $index
   *   Link position counting from zero.
   * @param string $message
   *   (optional) A message to display with the assertion. Do not translate
   *   messages: use strtr() to embed variables in the message text, not
   *   t(). If left blank, a default message will be displayed.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   Thrown when element doesn't exist, or the link label is a different one.
   */
  public function linkExistsExact($label, $index = 0, $message = '') {
    $message = ($message ? $message : strtr('Link with label %label found.', ['%label' => $label]));
    $links = $this->session->getPage()->findAll('named_exact', ['link', $label]);
    $this->assert(!empty($links[$index]), $message);
  }

  /**
   * Passes if a link with the specified label is not found.
   *
   * An optional link index may be passed.
   *
   * @param string $label
   *   Text between the anchor tags.
   * @param string $message
   *   (optional) A message to display with the assertion. Do not translate
   *   messages: use strtr() to embed variables in the message text, not
   *   t(). If left blank, a default message will be displayed.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   Thrown when element doesn't exist, or the link label is a different one.
   */
  public function linkNotExists($label, $message = '') {
    $message = ($message ? $message : strtr('Link with label %label not found.', ['%label' => $label]));
    $links = $this->session->getPage()->findAll('named', ['link', $label]);
    $this->assert(empty($links), $message);
  }

  /**
   * Passes if a link with the exactly specified label is not found.
   *
   * An optional link index may be passed.
   *
   * @param string $label
   *   Text between the anchor tags.
   * @param string $message
   *   (optional) A message to display with the assertion. Do not translate
   *   messages: use strtr() to embed variables in the message text, not
   *   t(). If left blank, a default message will be displayed.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   Thrown when element doesn't exist, or the link label is a different one.
   */
  public function linkNotExistsExact($label, $message = '') {
    $message = ($message ? $message : strtr('Link with label %label not found.', ['%label' => $label]));
    $links = $this->session->getPage()->findAll('named_exact', ['link', $label]);
    $this->assert(empty($links), $message);
  }

  /**
   * Passes if a link containing a given href (part) is found.
   *
   * @param string $href
   *   The full or partial value of the 'href' attribute of the anchor tag.
   * @param int $index
   *   Link position counting from zero.
   * @param string $message
   *   (optional) A message to display with the assertion. Do not translate
   *   messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
   *   variables in the message text, not t(). If left blank, a default message
   *   will be displayed.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   Thrown when element doesn't exist, or the link label is a different one.
   */
  public function linkByHrefExists($href, $index = 0, $message = '') {
    $xpath = $this->buildXPathQuery('//a[contains(@href, :href)]', [':href' => $href]);
    $message = ($message ? $message : strtr('Link containing href %href found.', ['%href' => $href]));
    $links = $this->session->getPage()->findAll('xpath', $xpath);
    $this->assert(!empty($links[$index]), $message);
  }

  /**
   * Passes if a link containing a given href (part) is not found.
   *
   * @param string $href
   *   The full or partial value of the 'href' attribute of the anchor tag.
   * @param string $message
   *   (optional) A message to display with the assertion. Do not translate
   *   messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
   *   variables in the message text, not t(). If left blank, a default message
   *   will be displayed.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   Thrown when element doesn't exist, or the link label is a different one.
   */
  public function linkByHrefNotExists($href, $message = '') {
    $xpath = $this->buildXPathQuery('//a[contains(@href, :href)]', [':href' => $href]);
    $message = ($message ? $message : strtr('No link containing href %href found.', ['%href' => $href]));
    $links = $this->session->getPage()->findAll('xpath', $xpath);
    $this->assert(empty($links), $message);
  }

  /**
   * Builds an XPath query.
   *
   * Builds an XPath query by replacing placeholders in the query by the value
   * of the arguments.
   *
   * XPath 1.0 (the version supported by libxml2, the underlying XML library
   * used by PHP) doesn't support any form of quotation. This function
   * simplifies the building of XPath expression.
   *
   * @param string $xpath
   *   An XPath query, possibly with placeholders in the form ':name'.
   * @param array $args
   *   An array of arguments with keys in the form ':name' matching the
   *   placeholders in the query. The values may be either strings or numeric
   *   values.
   *
   * @return string
   *   An XPath query with arguments replaced.
   */
  public function buildXPathQuery($xpath, array $args = []) {
    // Replace placeholders.
    foreach ($args as $placeholder => $value) {
      if (is_object($value)) {
        throw new \InvalidArgumentException('Just pass in scalar values for $args and remove all t() calls from your test.');
      }
      // XPath 1.0 doesn't support a way to escape single or double quotes in a
      // string literal. We split double quotes out of the string, and encode
      // them separately.
      if (is_string($value)) {
        // Explode the text at the quote characters.
        $parts = explode('"', $value);

        // Quote the parts.
        foreach ($parts as &$part) {
          $part = '"' . $part . '"';
        }

        // Return the string.
        $value = count($parts) > 1 ? 'concat(' . implode(', \'"\', ', $parts) . ')' : $parts[0];
      }

      // Use preg_replace_callback() instead of preg_replace() to prevent the
      // regular expression engine from trying to substitute backreferences.
      $replacement = function ($matches) use ($value) {
        return $value;
      };
      $xpath = preg_replace_callback('/' . preg_quote($placeholder) . '\b/', $replacement, $xpath);
    }
    return $xpath;
  }

  /**
   * Passes if the raw text IS NOT found escaped on the loaded page.
   *
   * Raw text refers to the raw HTML that the page generated.
   *
   * @param string $raw
   *   Raw (HTML) string to look for.
   */
  public function assertNoEscaped($raw) {
    $this->responseNotContains(Html::escape($raw));
  }

  /**
   * Passes if the raw text IS found escaped on the loaded page.
   *
   * Raw text refers to the raw HTML that the page generated.
   *
   * @param string $raw
   *   Raw (HTML) string to look for.
   */
  public function assertEscaped($raw) {
    $this->responseContains(Html::escape($raw));
  }

  /**
   * Asserts a condition.
   *
   * The parent method is overridden because it is a private method.
   *
   * @param bool $condition
   *   The condition.
   * @param string $message
   *   The success message.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *   When the condition is not fulfilled.
   */
  public function assert($condition, $message) {
    if ($condition) {
      return;
    }

    throw new ExpectationException($message, $this->session->getDriver());
  }

  /**
   * Checks that a given form field element is disabled.
   *
   * @param string $field
   *   One of id|name|label|value for the field.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @return \Behat\Mink\Element\NodeElement
   *   The matching element.
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   * @throws \Behat\Mink\Exception\ExpectationException
   */
  public function fieldDisabled($field, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    $node = $container->findField($field);

    if ($node === NULL) {
      throw new ElementNotFoundException($this->session->getDriver(), 'field', 'id|name|label|value', $field);
    }

    if (!$node->hasAttribute('disabled')) {
      throw new ExpectationException("Field $field is disabled", $this->session->getDriver());
    }

    return $node;
  }

  /**
   * Checks that specific hidden field exists.
   *
   * @param string $field
   *   One of id|name|value for the hidden field.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @return \Behat\Mink\Element\NodeElement
   *   The matching element.
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   */
  public function hiddenFieldExists($field, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    if ($node = $container->find('hidden_field_selector', ['hidden_field', $field])) {
      return $node;
    }
    throw new ElementNotFoundException($this->session->getDriver(), 'form hidden field', 'id|name|value', $field);
  }

  /**
   * Checks that specific hidden field does not exists.
   *
   * @param string $field
   *   One of id|name|value for the hidden field.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   */
  public function hiddenFieldNotExists($field, TraversableElement $container = NULL) {
    $container = $container ?: $this->session->getPage();
    $node = $container->find('hidden_field_selector', ['hidden_field', $field]);
    $this->assert($node === NULL, "A hidden field '$field' exists on this page, but it should not.");
  }

  /**
   * Checks that specific hidden field have provided value.
   *
   * @param string $field
   *   One of id|name|value for the hidden field.
   * @param string $value
   *   The hidden field value that needs to be checked.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   * @throws \Behat\Mink\Exception\ExpectationException
   */
  public function hiddenFieldValueEquals($field, $value, TraversableElement $container = NULL) {
    $node = $this->hiddenFieldExists($field, $container);
    $actual = $node->getValue();
    $regex = '/^' . preg_quote($value, '/') . '$/ui';
    $message = "The hidden field '$field' value is '$actual', but '$value' expected.";
    $this->assert((bool) preg_match($regex, $actual), $message);
  }

  /**
   * Checks that specific hidden field doesn't have the provided value.
   *
   * @param string $field
   *   One of id|name|value for the hidden field.
   * @param string $value
   *   The hidden field value that needs to be checked.
   * @param \Behat\Mink\Element\TraversableElement $container
   *   (optional) The document to check against. Defaults to the current page.
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   * @throws \Behat\Mink\Exception\ExpectationException
   */
  public function hiddenFieldValueNotEquals($field, $value, TraversableElement $container = NULL) {
    $node = $this->hiddenFieldExists($field, $container);
    $actual = $node->getValue();
    $regex = '/^' . preg_quote($value, '/') . '$/ui';
    $message = "The hidden field '$field' value is '$actual', but it should not be.";
    $this->assert(!preg_match($regex, $actual), $message);
  }

}


text:
package de.jcup.egradle.eclipse.ide.ui;

import static de.jcup.egradle.eclipse.ide.preferences.EGradleIdePreferenceConstants.*;

import java.lang.reflect.InvocationTargetException;

import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;

import de.jcup.egradle.core.config.MutableGradleConfiguration;
import de.jcup.egradle.core.domain.CancelStateProvider;
import de.jcup.egradle.core.process.EGradleShellType;
import de.jcup.egradle.core.process.OutputHandler;
import de.jcup.egradle.eclipse.ide.IDEActivator;
import de.jcup.egradle.eclipse.ide.IDEUtil;
import de.jcup.egradle.eclipse.ide.execution.validation.RootProjectValidationHandler;
import de.jcup.egradle.eclipse.ide.execution.validation.RootProjectValidationObserver;
import de.jcup.egradle.eclipse.ide.execution.validation.RootProjectValidationProgressRunnable;
import de.jcup.egradle.eclipse.preferences.ChangeableComboFieldEditor;
import de.jcup.egradle.eclipse.preferences.EGradleCallType;
import de.jcup.egradle.eclipse.ui.SWTFactory;
import de.jcup.egradle.eclipse.util.ColorManager;
import de.jcup.egradle.eclipse.util.EclipseUtil;

public class RootProjectConfigUIDelegate implements RootProjectValidationObserver, IPropertyChangeListener {

    private ChangeableComboFieldEditor gradleCallTypeRadioButton;
    private ChangeableComboFieldEditor shellFieldEditor;
    private StringFieldEditor gradleCommandFieldEditor;
    private DirectoryFieldEditor gradleInstallBinDirectoryFieldEditor;
    private Group gradleCallGroup;
    private Text validationOutputField;
    private DirectoryFieldEditor rootPathDirectoryEditor;
    private DirectoryFieldEditor defaultJavaHomeDirectoryEditor;
    private DirectoryFieldEditor gradleUserHOmeDirectoryEditor;
    private Button validationButton;

    private RootProjectValidationHandler validation;
    private RootProjectConfigMode mode;
    private Button restoreMetaDataCheckbox;
    private boolean rootPathMayBeEmpty;

    public RootProjectConfigUIDelegate(RootProjectValidationHandler validation) {
        this(validation, null);
    }

    public RootProjectConfigUIDelegate(RootProjectValidationHandler validation, RootProjectConfigMode rootProjectConfigMode) {
        this.validation = validation;
        if (rootProjectConfigMode == null) {
            this.mode = RootProjectConfigMode.IMPORT_PROJECTS;
        } else {
            this.mode = rootProjectConfigMode;
        }
    }

    /**
     * Creates the configuration UI containing field editors. Field editors are
     * abstractions of the common GUI blocks needed to manipulate various types of
     * preferences. Each field editor knows how to save and restore itself.
     *
     * @param parent parent composite to add to
     */
    public void createConfigUI(Composite parent) {
        createDefaults(parent);
        createGradleCallTypeGroup(parent);
        createValidationGroup(parent);
    }

    private void createValidationGroup(Composite parent) {
        if (!mode.isValidationGroupNeeded()) {
            return;
        }
        /* ------------------------------------ */
        /* - Check output - */
        /* ------------------------------------ */
        GridData groupLayoutData = new GridData();
        groupLayoutData.horizontalAlignment = GridData.FILL;
        groupLayoutData.verticalAlignment = GridData.FILL;
        groupLayoutData.grabExcessHorizontalSpace = true;
        groupLayoutData.grabExcessVerticalSpace = true;
        groupLayoutData.verticalSpan = 2;
        groupLayoutData.horizontalSpan = 3;

        Group validationGroup = SWTFactory.createGroup(parent, "Validate preferences correct", 1, 10, SWT.FILL);
        validationGroup.setLayoutData(groupLayoutData);

        GridData labelGridData = new GridData();
        labelGridData.horizontalAlignment = GridData.FILL;
        labelGridData.verticalAlignment = GridData.BEGINNING;
        labelGridData.grabExcessHorizontalSpace = false;
        labelGridData.grabExcessVerticalSpace = false;

        GridData gridDataLastColumn = new GridData();
        gridDataLastColumn.horizontalAlignment = GridData.FILL;
        gridDataLastColumn.verticalAlignment = GridData.FILL;
        gridDataLastColumn.grabExcessHorizontalSpace = true;
        gridDataLastColumn.grabExcessVerticalSpace = true;
        gridDataLastColumn.verticalSpan = 2;
        gridDataLastColumn.horizontalSpan = 2;
        gridDataLastColumn.minimumHeight = 50;
        gridDataLastColumn.heightHint = 100;

        validationOutputField = new Text(validationGroup, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
        validationOutputField.setLayoutData(gridDataLastColumn);

        validationButton = new Button(validationGroup, SWT.NONE);
        validationButton.setText("Start validation");
        validationButton.setImage(getValidationButtonImage());

        validationButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                if (validationRunning == true) {
                    return;
                }
                setValid(false);
                handleValidationRunning(true);
                validationOutputField.setText("Start validation...\n");

                OutputHandler validationOutputHandler = new OutputHandler() {

                    @Override
                    public void output(String line) {
                        EclipseUtil.safeAsyncExec(new Runnable() {

                            @Override
                            public void run() {
                                validationOutputField.append(line + "\n");
                            }
                        });
                    }

                };

                MutableGradleConfiguration configuration = new MutableGradleConfiguration();
                configuration.setGradleCommand(getGradleCommand());
                configuration.setGradleBinDirectory(getGradleBinDirectory());
                configuration.setShellCommand(getShellCommand());
                configuration.setWorkingDirectory(getWorkingDirectory());
                configuration.setJavaHome(getGlobalJavaHomePath());
                configuration.setGradleUserHome(getGradleUserHome());

                startValidation(validationOutputHandler, configuration);
            }

            private void startValidation(OutputHandler validationOutputHandler, MutableGradleConfiguration configuration) {
                try {
                    RootProjectConfigUIDelegate observer = RootProjectConfigUIDelegate.this;
                    ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(EclipseUtil.getActiveWorkbenchShell());

                    RootProjectValidationProgressRunnable runnable = new RootProjectValidationProgressRunnable(new CancelStateProvider() {

                        @Override
                        public boolean isCanceled() {
                            return progressMonitorDialog.getProgressMonitor().isCanceled();
                        }

                    }, configuration, observer, validationOutputHandler);
                    /*
                     * use own progress monitor dialog here - progress service did not work well
                     * because this is in model state
                     */
                    progressMonitorDialog.run(true, true, runnable);
                } catch (InvocationTargetException | InterruptedException e1) {
                    IDEUtil.logError("Was not able to execute validation", e1);
                }
            }
        });
    }

    private void createGradleCallTypeGroup(Composite parent) {
        GridData groupLayoutData = new GridData();
        groupLayoutData.horizontalAlignment = GridData.FILL;
        groupLayoutData.verticalAlignment = GridData.BEGINNING;
        groupLayoutData.grabExcessHorizontalSpace = true;
        groupLayoutData.grabExcessVerticalSpace = false;
        groupLayoutData.verticalSpan = 3;
        groupLayoutData.horizontalSpan = 3;

        GridData labelGridData = new GridData();
        labelGridData.horizontalAlignment = GridData.FILL;
        labelGridData.verticalAlignment = GridData.BEGINNING;
        labelGridData.grabExcessHorizontalSpace = false;
        labelGridData.grabExcessVerticalSpace = false;

        GridData gridDataLastColumn = new GridData();
        gridDataLastColumn.horizontalAlignment = GridData.FILL;
        gridDataLastColumn.verticalAlignment = GridData.FILL;
        gridDataLastColumn.grabExcessHorizontalSpace = true;
        gridDataLastColumn.grabExcessVerticalSpace = false;
        gridDataLastColumn.horizontalSpan = 2;

        GridData labelGridData2 = new GridData();
        labelGridData2.horizontalAlignment = GridData.FILL;
        labelGridData2.verticalAlignment = GridData.BEGINNING;
        labelGridData2.grabExcessHorizontalSpace = false;
        labelGridData2.grabExcessVerticalSpace = false;
        labelGridData2.grabExcessHorizontalSpace = true;

        gradleCallGroup = SWTFactory.createGroup(parent, "Gradle call", 1, 10, SWT.FILL);
        if (debug) {
            gradleCallGroup.setBackground(getColorManager().getColor(new RGB(0, 255, 0)));
        }
        gradleCallGroup.setLayoutData(groupLayoutData);
        /* @formatter:off */
		String[][] entryNamesAndValues = new String[][] {
				new String[] { "Windows - Gradle wrapper in root project",EGradleCallType.WINDOWS_GRADLE_WRAPPER.getId() },
				new String[] { "Windows - Use gradle installation", EGradleCallType.WINDOWS_GRADLE_INSTALLED.getId() },
				new String[] { "Linux/Mac - Gradle wrapper in root project", EGradleCallType.LINUX_GRADLE_WRAPPER.getId() },
				new String[] { "Linux/Mac - Use gradle installation", EGradleCallType.LINUX_GRADLE_INSTALLED.getId() },
				new String[] { "Custom", EGradleCallType.CUSTOM.getId() } };
		/* @formatter:on */
        gradleCallTypeRadioButton = new ChangeableComboFieldEditor(P_GRADLE_CALL_TYPE.getId(), "Call type", entryNamesAndValues, gradleCallGroup);
        gradleCallTypeRadioButton.getLabelControl(gradleCallGroup).setLayoutData(labelGridData);
        gradleCallTypeRadioButton.getComboBoxControl(gradleCallGroup).setLayoutData(gridDataLastColumn);
        addField(gradleCallTypeRadioButton);

        if (debug) {
            gradleCallTypeRadioButton.getComboBoxControl(gradleCallGroup).setBackground(getColorManager().getColor(new RGB(0, 0, 255)));
        }
        gradleCallTypeRadioButton.setPropertyChangeListener(this);

        /* @formatter:off */
		String[][] shellTypeComboValues =
				new String[][] {
					new String[] { "(no shell used)", EGradleShellType.NONE.getId() },
					new String[] { "bash", EGradleShellType.BASH.getId() },
					new String[] { "sh", EGradleShellType.SH.getId() },
					new String[] { "cmd", EGradleShellType.CMD.getId() } };
		/* @formatter:on */
        shellFieldEditor = new ChangeableComboFieldEditor(P_GRADLE_SHELL.getId(), "Shell", shellTypeComboValues, gradleCallGroup);
        shellFieldEditor.getLabelControl(gradleCallGroup).setLayoutData(labelGridData);
        shellFieldEditor.getComboBoxControl(gradleCallGroup).setLayoutData(gridDataLastColumn);
        addField(shellFieldEditor);

        gradleCommandFieldEditor = new StringFieldEditor(P_GRADLE_CALL_COMMAND.getId(), "Gradle call", gradleCallGroup);
        gradleCommandFieldEditor.getLabelControl(gradleCallGroup).setLayoutData(labelGridData);
        gradleCommandFieldEditor.getTextControl(gradleCallGroup).setLayoutData(gridDataLastColumn);
        addField(gradleCommandFieldEditor);

        gradleInstallBinDirectoryFieldEditor = new DirectoryFieldEditor(P_GRADLE_INSTALL_BIN_FOLDER.getId(), "Gradle bin folder:", gradleCallGroup);
        gradleInstallBinDirectoryFieldEditor.getLabelControl(gradleCallGroup).setLayoutData(labelGridData);
        gradleInstallBinDirectoryFieldEditor.getTextControl(gradleCallGroup).setLayoutData(labelGridData2);

        addField(gradleInstallBinDirectoryFieldEditor);
    }

    private ColorManager getColorManager() {
        IDEActivator iDEActivator = IDEActivator.getDefault();
        if (iDEActivator == null) {
            return ColorManager.getStandalone();
        }
        return iDEActivator.getColorManager();
    }

    private void createDefaults(Composite parent) {
        GridData groupLayoutData = new GridData();
        groupLayoutData.horizontalAlignment = GridData.FILL;
        groupLayoutData.verticalAlignment = GridData.BEGINNING;
        groupLayoutData.grabExcessHorizontalSpace = true;
        groupLayoutData.grabExcessVerticalSpace = false;
        groupLayoutData.verticalSpan = 2;
        groupLayoutData.horizontalSpan = 3;

        Group defaultGroup = SWTFactory.createGroup(parent, "", 1, 10, SWT.FILL);
        defaultGroup.setLayoutData(groupLayoutData);

        rootPathDirectoryEditor = new DirectoryFieldEditor(P_ROOTPROJECT_PATH.getId(), "&Gradle root project path", defaultGroup);
        addField(rootPathDirectoryEditor);
        GridData directoryTextLayout = new GridData(SWT.FILL, SWT.TOP, true, false);

        String rootPathTooltipText = "Default root path. Can be overriden in launch configurations";
        rootPathDirectoryEditor.getLabelControl(defaultGroup).setToolTipText(rootPathTooltipText);

        Text rootPathTextControl = rootPathDirectoryEditor.getTextControl(defaultGroup);
        rootPathTextControl.setToolTipText(rootPathTooltipText);
        rootPathTextControl.setLayoutData(directoryTextLayout);

        rootPathDirectoryEditor.setEmptyStringAllowed(rootPathMayBeEmpty);

        if (!mode.isRootPathDirectoryEditable()) {
            rootPathDirectoryEditor.setEnabled(false, defaultGroup);
        }

        /* gradle user home directory */
        gradleUserHOmeDirectoryEditor = new DirectoryFieldEditor(P_GRADLE_USER_HOME.getId(), "GRADLE_USER_HOME (optional)", defaultGroup);
        gradleUserHOmeDirectoryEditor.setEmptyStringAllowed(true);
        gradleUserHOmeDirectoryEditor.getTextControl(defaultGroup).setMessage("per default: '{user.home}/.gradle'");
        addField(gradleUserHOmeDirectoryEditor);

        /* java home default */
        defaultJavaHomeDirectoryEditor = new DirectoryFieldEditor(P_JAVA_HOME_PATH.getId(), "&JAVA HOME (optional)", defaultGroup);
        defaultJavaHomeDirectoryEditor.setEmptyStringAllowed(true);
        String defaultJavaHomeDirectoryTooltipText = "A default global JAVA_HOME path. Can be overriden in launch configurations";
        defaultJavaHomeDirectoryEditor.getLabelControl(defaultGroup).setToolTipText(defaultJavaHomeDirectoryTooltipText);

        Text javaHomeTextControl = defaultJavaHomeDirectoryEditor.getTextControl(defaultGroup);
        javaHomeTextControl.setToolTipText(defaultJavaHomeDirectoryTooltipText);
        javaHomeTextControl.setLayoutData(directoryTextLayout);

        addField(defaultJavaHomeDirectoryEditor);

        /* restore meta data */
        if (mode.isRestoreMetaDataCheckBoxNeeded()) {
            restoreMetaDataCheckbox = SWTFactory.createCheckButton(defaultGroup, "Restore former meta data (e.g. Team provider data)", null, true, SWT.LEFT);
        }
    }

    Image getValidationButtonImage() {
        return IDEUtil.getImage("icons/gradle-og.png");
    }

    private void setValid(boolean valid) {
        validation.onValidationStateChanged(valid);

    }

    private void addField(FieldEditor field) {
        validation.addFieldEditor(field);
    }

    private boolean validationRunning = false;
    boolean debug;

    @Override
    public void handleValidationResult(boolean valid) {
        validation.handleValidationResult(valid);
    }

    public void propertyChange(PropertyChangeEvent event) {
        if (validation.isHandlingPropertyChanges()) {
            return;
        }
        if (isGradleCallTypeButton(event)) {
            updateCallTypeFields(event.getNewValue());
        }
    }

    public boolean isGradleCallTypeButton(PropertyChangeEvent event) {
        return gradleCallTypeRadioButton == event.getSource();
    }

    /**
     * Update call type has changed before - this method updates only dependent
     * parts!
     *
     * @param value
     */
    public void updateCallTypeFields(Object value) {
        if (!(value instanceof String)) {
            return;
        }
        String callTypeId = (String) value;
        updateCallTypeGroupEnabledState(callTypeId);

        EGradleCallType callType = EGradleCallType.findById(callTypeId);
        if (callType == null) {
            throw new IllegalStateException("Wrong implemented - not a call type ID:" + callTypeId);
        }
        if (EGradleCallType.CUSTOM.equals(callType)) {
            /*
             * do nothing, just keep the editor fields from former default settings - user
             * can change...
             */
        } else {
            setCallGroupPartsEnabled(false);
            /* set defaults */
            shellFieldEditor.setStringValue(callType.getDefaultShell().getId());
            gradleInstallBinDirectoryFieldEditor.setStringValue(callType.getDefaultGradleBinFolder());
            gradleCommandFieldEditor.setStringValue(callType.getDefaultGradleCommand());
        }

    }

    /**
     * Set call type by given id
     *
     * @param callTypeId
     */
    public void updateCallTypeGroupEnabledState(String callTypeId) {
        if (EGradleCallType.CUSTOM.getId().equals(callTypeId)) {
            /* set all editable */
            setCallGroupPartsEnabled(true);
        } else {
            setCallGroupPartsEnabled(false);
            /* set defaults */
        }
    }

    private void setCallGroupPartsEnabled(boolean enabled) {
        shellFieldEditor.setEnabled(enabled, gradleCallGroup);
        gradleCommandFieldEditor.setEnabled(enabled, gradleCallGroup);
        gradleInstallBinDirectoryFieldEditor.setEnabled(enabled, gradleCallGroup);
    }

    public void init(IWorkbench workbench) {

    }

    @Override
    public void handleValidationRunning(boolean running) {
        validationRunning = running;
        validation.handleValidationRunning(running);
    }

    public String getRootPathDirectory() {
        return rootPathDirectoryEditor.getStringValue();
    }

    public void setGradleCallTypeId(String gradleCallTypeID) {
        gradleCallTypeRadioButton.setStringValue(gradleCallTypeID);
        updateCallTypeFields(gradleCallTypeID);
    }

    public void setRootPathMayBeEmpty(boolean rootPathMayBeEmpty) {
        this.rootPathMayBeEmpty = rootPathMayBeEmpty;
    }

    public String getGradleRootPathText() {
        return this.rootPathDirectoryEditor.getStringValue();
    }

    public void setGlobalJavaHomePath(String globalJavaHomePath) {
        this.defaultJavaHomeDirectoryEditor.setStringValue(globalJavaHomePath);
    }

    public void setRootProjectPath(String rootPath) {
        this.rootPathDirectoryEditor.setStringValue(rootPath);
    }

    public String getGlobalJavaHomePath() {
        return defaultJavaHomeDirectoryEditor.getStringValue();
    }

    public boolean isRestoringMetaData() {
        if (restoreMetaDataCheckbox == null) {
            return false;
        }
        return restoreMetaDataCheckbox.getSelection();
    }

    private String getShellId() {
        return shellFieldEditor.getStringValue();
    }

    public EGradleShellType getShellCommand() {
        String shellTypeAsString = getShellId();
        EGradleShellType type = EGradleShellType.findById(shellTypeAsString);
        return type;
    }

    public String getWorkingDirectory() {
        return rootPathDirectoryEditor.getStringValue();
    }

    public String getGradleUserHome() {
        return gradleUserHOmeDirectoryEditor.getStringValue();
    }

    public String getGradleBinDirectory() {
        return gradleInstallBinDirectoryFieldEditor.getStringValue();
    }

    public String getGradleCommand() {
        return gradleCommandFieldEditor.getStringValue();
    }

    public String getCallTypeId() {
        return gradleCallTypeRadioButton.getStringValue();
    }

    public void setGradleBinInstallFolder(String gradleBinInstallFolder) {
        gradleInstallBinDirectoryFieldEditor.setStringValue(gradleBinInstallFolder);
    }

    public void setGradleCallCommand(String gradleCallCommand) {
        this.gradleCommandFieldEditor.setStringValue(gradleCallCommand);
    }

    public void setShellId(String shellId) {
        this.shellFieldEditor.setStringValue(shellId);
    }

}


text:
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.Audio;
using osu.Framework.IO.Stores;
using osu.Game.Beatmaps;

namespace osu.Game.Skinning
{
    public class LegacyBeatmapSkin : LegacySkin
    {
        public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, AudioManager audioManager)
            : base(createSkinInfo(beatmap), new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), audioManager, beatmap.Path)
        {
        }

        private static SkinInfo createSkinInfo(BeatmapInfo beatmap) =>
            new SkinInfo { Name = beatmap.ToString(), Creator = beatmap.Metadata.Author.ToString() };
    }
}


text:
package thirdparty.ods;

import algorithms.util.ObjectSpaceEstimator;

/**
 */
public class XFastTrieNode<T> extends BinaryTrieNode<T> {

    int prefix;

    @SuppressWarnings({"unchecked"})
    @Override
    public boolean equals(Object u) {

        if (!(u instanceof XFastTrieNode<?>)) {
            return false;
        }

        XFastTrieNode<T> uu = (XFastTrieNode<T>)u;

        if (this.prefix == uu.prefix) {
            return true;
        }

        return false;
    }

    @Override
    public int hashCode() {
        return prefix;
    }

}


text:
'''
  :copyright (c) 2014 Quantopian, Inc.
  :license: Apache 2.0, see LICENSE for more details.
'''

class Position(object):

    def __init__(self, sid):
        self.sid = sid
        self.amount = 0
        self.cost_basis = 0.0  # per share
        self.last_sale_price = 0.0

    def __getitem__(self, key):
        return self.__dict__[key]

    def __repr__(self):
        return "Position({0})".format(self.__dict__)

class Positions(dict):

    def __missing__(self, key):
        pos = Position(key)
        self[key] = pos
        return pos

class FactoryPortfolio(object):

    def __init__(self):
        self.capital_used = 0.0
        self.starting_cash = 0.0
        self.portfolio_value = 0.0
        self.pnl = 0.0
        self.returns = 0.0
        self.cash = 0.0
        self.positions = Positions()
        self.start_date = None
        self.positions_value = 0.0

    def __getitem__(self, key):
        return self.__dict__[key]

    def __repr__(self):
        return "Portfolio({0})".format(self.__dict__)


text:
package com.omega_r.libs.omegarecyclerview.item_decoration;

import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;

import com.omega_r.libs.omegarecyclerview.OmegaRecyclerView;
import com.omega_r.libs.omegarecyclerview.item_decoration.decoration_helpers.DividerDecorationHelper;

public class DividerItemDecoration extends BaseItemDecoration {

    private final Rect mViewRect = new Rect();
    private final Rect mItemRect = new Rect();
    private final int mOriginalDividerSize;
    private final int mOffset;
    private float mDividerAlpha;
    private Drawable mDivider;
    private int mDividerSize;
    private int mPaddingStart;
    private int mPaddingEnd;

    public DividerItemDecoration(Drawable divider, int dividerSize, int showDivider, int offset, float dividerAlpha) {
        super(showDivider);
        mOriginalDividerSize = dividerSize;
        mDivider = divider;
        mDividerSize = dividerSize;
        mOffset = offset;
        mDividerAlpha = dividerAlpha;
        updateSize();
    }

    @Override
    void onOrientationUpdated(int orientation) {
        updateSize();
    }

    public void setPadding(int padding) {
        mPaddingStart = padding;
        mPaddingEnd = padding;
    }

    public void setPaddingStart(int padding) {
        mPaddingStart = padding;
    }

    public void setPaddingEnd(int padding) {
        mPaddingEnd = padding;
    }

    public void setDividerAlpha(float dividerAlpha) {
        this.mDividerAlpha = dividerAlpha;
    }

    public void setDividerDrawable(@NonNull Drawable dividerDrawable) {
        mDivider = dividerDrawable;
        if (mOriginalDividerSize < 0) {
            mDividerSize = mOriginalDividerSize;
            updateSize();
        }
    }

    private void updateSize() {
        if (mDividerSize < 0) {
            switch (getOrientation()) {
                case Orientation.HORIZONTAL:
                    mDividerSize = mDivider.getIntrinsicWidth();
                    break;
                case Orientation.VERTICAL:
                    mDividerSize = mDivider.getIntrinsicHeight();
                    break;
            }
        }
    }

    @Override
    public void getItemOffset(@NonNull Rect outRect, @NonNull RecyclerView parent, @NonNull DividerDecorationHelper helper, int position, int itemCount) {
        if (position == 0 && isShowBeginDivider()) {
            helper.setStart(outRect, mDividerSize);
        }
        if (position != 0 && isShowMiddleDivider()) {
            helper.setStart(outRect, mDividerSize);
        }
        if (position == itemCount - 1 && isShowEndDivider()) {
            helper.setEnd(outRect, mDividerSize);
        }
    }

    @Override
    public void onDrawOver(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        if (mDivider == null || !(parent.getLayoutManager() instanceof LinearLayoutManager)) {
            super.onDrawOver(c, parent, state);
            return;
        }

        final int childCount = parent.getChildCount();

        if (childCount > 0) {
            c.save();
            DividerDecorationHelper helper = DividerDecorationHelper.getHelper(getOrientation(), parent);

            if (parent.getClipToPadding()) {
                mViewRect.set(parent.getPaddingLeft(),
                        parent.getPaddingTop(),
                        parent.getWidth() - parent.getPaddingRight(),
                        parent.getHeight() - parent.getPaddingBottom());

                c.clipRect(mViewRect);

                mItemRect.set(parent.getPaddingLeft() + mPaddingStart,
                        parent.getPaddingTop() + mPaddingStart,
                        parent.getWidth() - parent.getPaddingRight() - mPaddingEnd,
                        parent.getHeight() - parent.getPaddingBottom() - mPaddingEnd);

                helper.setStart(mItemRect, helper.getStart(mItemRect) - mPaddingStart);
                helper.setEnd(mItemRect, helper.getEnd(mItemRect) + mPaddingEnd);
            } else {
                mItemRect.set(mPaddingStart, mPaddingStart,
                        parent.getWidth() - mPaddingEnd, parent.getHeight() - mPaddingEnd);
            }
            View child;

            int offsetIndex = 0;

            // show beginning divider
            if (isShowBeginDivider()) {
                child = getFirstChild(parent);
                int adapterPosition = getAdapterPosition(parent, child);
                if (adapterPosition == 0 && isShowDividerAbove(parent, 0)) {
                    offsetIndex = 1;
                    updateViewRect(parent, child);
                    helper.setStart(mItemRect, helper.getStart(mViewRect) - helper.getOffset(mOffset));
                    helper.setEnd(mItemRect, helper.getStart(mItemRect) - helper.getOffset(mDividerSize));
                    drawDivider(c, child, mItemRect);
                }
            }

            // show middle dividers
            if (isShowMiddleDivider()) {
                for (int i = offsetIndex; i < childCount; i++) {
                    child = parent.getChildAt(i);
                    int adapterPosition = getAdapterPosition(parent, child);
                    if (adapterPosition > 0 && isShowDividerAbove(parent, adapterPosition)) {
                        updateViewRect(parent, child);
                        helper.setStart(mItemRect, helper.getStart(mViewRect) - helper.getOffset(mOffset));
                        helper.setEnd(mItemRect, helper.getStart(mItemRect) - helper.getOffset(mDividerSize));
                        drawDivider(c, child, mItemRect);
                    }
                }
            }

            // show end divider
            if (isShowEndDivider()) {
                child = parent.getChildAt(childCount - 1);
                int adapterPosition = getAdapterPosition(parent, child);
                int adapterCount = parent.getAdapter().getItemCount();
                if (adapterPosition == adapterCount - 1 && isShowDividerBelow(parent, adapterPosition, adapterCount)) {
                    updateViewRect(parent, child);
                    helper.setStart(mItemRect, helper.getEnd(mViewRect) + helper.getOffset(mOffset));
                    helper.setEnd(mItemRect, helper.getStart(mItemRect) + helper.getOffset(mDividerSize));
                    drawDivider(c, child, mItemRect);
                }
            }

            c.restore();
        }
    }

    // Bug with Expandable adapter and hide animation.
    // RecyclerView getChild - returns wrong child (ChildClippingFrameLayout).
    private View getFirstChild(RecyclerView parent) {
        int count = parent.getChildCount();
        View topView = null;
        for (int i = 0; i < count; i++) {
            View view = parent.getChildAt(i);
            if (topView == null) {
                topView = view;
            } else if (topView.getY() > view.getY()) {
                topView = view;
            }
        }
        return topView;
    }

    private void updateViewRect(RecyclerView parent, View view) {
        view.getHitRect(mViewRect);
        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams();
        mViewRect.left -= params.leftMargin;
        mViewRect.top -= params.topMargin;
        mViewRect.right += params.rightMargin;
        mViewRect.bottom += params.bottomMargin;
    }

    private void drawDivider(Canvas canvas, View view, Rect rect) {
        Drawable divider = this.mDivider;
        divider.setAlpha((int) (view.getAlpha() * 255f * mDividerAlpha));
        rect.sort();
        divider.setBounds(rect);
        divider.draw(canvas);
    }

    private boolean isShowDividerBelow(RecyclerView parent, int adapterPosition, int count) {
        RecyclerView.Adapter adapter = parent.getAdapter();
        if (adapter instanceof OmegaRecyclerView.Adapter) {
            boolean allowedBelow = ((OmegaRecyclerView.Adapter) adapter).isDividerAllowedBelow(adapterPosition);
            if (allowedBelow) {
                return (adapterPosition + 1 == count)
                        || ((OmegaRecyclerView.Adapter) adapter).isDividerAllowedAbove(adapterPosition + 1);

            } else {
                return false;
            }
        }
        return true;
    }

    private boolean isShowDividerAbove(RecyclerView parent, int adapterPosition) {
        RecyclerView.Adapter adapter = parent.getAdapter();
        if (adapter instanceof OmegaRecyclerView.Adapter) {
            OmegaRecyclerView.Adapter omegaAdapter = (OmegaRecyclerView.Adapter) adapter;
            boolean allowedBelow = adapterPosition == 0 || omegaAdapter.isDividerAllowedBelow(adapterPosition - 1);
            if (allowedBelow) {
                return omegaAdapter.isDividerAllowedAbove(adapterPosition);
            } else {
                return false;
            }
        }
        return true;
    }

}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Revis. gen. pl. (Leipzig) 3: 461 (1898)

#### Original name
Nectria pandani Tul. & C. Tul., 1865

### Remarks
null


text:
A haskell EDSL for generating [terraform][] infrastructure specifications.

The terraform system has some nice properties (an excellent workflow, support for many resource types over multiple cloud providers),
but as a programming language it has very limited data structures and abstraction cababilities. With this library
one can leverage haskell abstractions to specifying infrastructure, whilst relying on terraforms excellent features.

The terraform "API" is very broad, supporting hundreds of resource types accross multiple cloud providers. By its nature
a haskell wrapping of this is involves significant boilerplate. This [boilerplate][] is [generated][] from an API specification.

Currently only a small subset of the AWS API is implemented, though
the addition of other resources and providers should be
straightforward.

The [examples][] directory illustrates API usage.

[terraform]:https://www.terraform.io/
[boilerplate]:https://github.com/timbod7/terraform-hs/blob/master/src/Language/Terraform/Aws.hs
[generated]:https://github.com/timbod7/terraform-hs/blob/master/scripts/generate.hs
[examples]:https://github.com/timbod7/terraform-hs/blob/master/examples


text:
package com.graphicalinfo.fim.ui.activities;

import android.graphics.drawable.AnimationDrawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.TextView;

import com.graphicalinfo.fim.R;
import com.graphicalinfo.fim.ui.BaseActivity;
import com.graphicalinfo.fim.ui.fragments.CommitteeFragment;
import com.graphicalinfo.fim.ui.fragments.EventFragment;
import com.graphicalinfo.fim.ui.fragments.OverviewFragment;
import com.graphicalinfo.fim.ui.fragments.SettingFragment;
import com.graphicalinfo.fim.ui.presenter.MainPresenter;
import com.graphicalinfo.fim.ui.views.MainContract;

public class MainActivity extends BaseActivity
        implements NavigationView.OnNavigationItemSelectedListener, MainContract.View {
    AnimationDrawable anim;
    private MainContract.Presenter presenter;
    TextView logo;
    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        presenter = new MainPresenter();
        presenter.attachView(this);
        presenter.presenterMethod();
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

        logo = (TextView) findViewById(R.id.logo);
        logo.setTextColor(getResources().getColor(R.color.amber_700));
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);

    }

    @Override
    protected void onStop() {
        super.onStop();
        if (anim != null && !anim.isRunning())
            anim.stop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.onDestroy();
        if (anim != null && !anim.isRunning())
        anim.stop();
    }

    @Override
    public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }

    @SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        Fragment fragment = null;
        SettingFragment setting = null;
        int id = item.getItemId();

        if (id == R.id.nav_home) {
            fragment = new OverviewFragment();
        } else if (id == R.id.nav_events) {
            fragment = new EventFragment();

        } else if (id == R.id.nav_lectural) {
            fragment = new CommitteeFragment();
        }  else if (id == R.id.nav_manage) {
            getFragmentManager().beginTransaction().
                    replace(R.id.container,
                           new  SettingFragment()).commit();

        }
        if (fragment != null){

            FragmentTransaction manager = getSupportFragmentManager().beginTransaction();
            manager.replace(R.id.container, fragment)
                    .commit();
        }
        String TITLE = (String) item.getTitle();

        logo.setText(TITLE);
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }

    @Override
    public void viewMethod() {

    }
}


text:
namespace System.Reflection
{

#if CONFIG_REFLECTION

using System;
using System.Globalization;
using System.Runtime.InteropServices;

#if CONFIG_COM_INTEROP
[ClassInterface(ClassInterfaceType.AutoDual)]
#endif
public abstract class Binder
{

	// Constructor.
	protected Binder() {}

	// Bind a value to a field.
	public abstract FieldInfo BindToField(BindingFlags bindingAttr,
										  FieldInfo[] match,
										  Object value,
										  CultureInfo culture);

	// Bind a set of arguments to a method.
	public abstract MethodBase BindToMethod(BindingFlags bindingAttr,
											MethodBase[] match,
											ref Object[] args,
											ParameterModifier[] modifiers,
											CultureInfo culture,
											String[] names,
											ref Object state);

	// Convert an object from one type into another.
	public abstract Object ChangeType(Object value, Type type,
									  CultureInfo culture);

	// Re-order the argument array for a method call.
	public abstract void ReorderArgumentArray(ref Object[] args,
											  Object state);

	// Select a method based on argument types.
	public abstract MethodBase SelectMethod(BindingFlags bindingAttr,
											MethodBase[] match,
											Type[] types,
											ParameterModifier[] modifiers);

	// Select a property based on specified type criteria.
	public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr,
												PropertyInfo[] match,
												Type returnType,
												Type[] indexes,
												ParameterModifier[] modifiers);

}; // class Binder

#endif // CONFIG_REFLECTION

}; // namespace System.Reflection


text:
package wa.xare.core.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface NodeType {

  /**
   * <p>
   * Defines the type of the node. If not set the name of the class is used
   * instead, removing the suffix {@code Node} if it existed.
   * </p>
   *
   */
  String value() default "";

}


text:
<resources>
    <string name="app_name">EasyPay</string>

    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>

    <string name="action_settings">Settings</string>

    <string name="create_payment">Create Payment</string>
    <string name="list_payments">List Payments</string>
    <string name="amount_label">Amount:</string>
    <string name="description_label">Payment description:</string>

    <string name="payment_error">There was an error generating payment.</string>
    <string name="payment_dialog_title">Your payment details</string>
    <string name="share">Share</string>
    <string name="payment_url">Payment URL</string>
    <string name="title_activity_template">List of Templates</string>

    <string name="payment_notification_header">Cobro realizado correctamente</string>
    <string name="payment_notification_content">Su cobro se ha realizado correctamente</string>
</resources>


text:
<?PHP

require_once("./init.php");
if (!defined('is_florensia')) die('Hacking attempt');
if (!$flouser->get_permission("watch_log")) { $florensia->output_page($flouser->noaccess()); }

$florensia->sitetitle("AdminCP");
$florensia->sitetitle("Log");

if (!isset($_GET['timestamp']) && !isset($_GET['section']) && !isset($_GET['currentuser']) && !isset($_GET['currentip']) && !isset($_GET['logvalue']) && !isset($_GET['flagged'])) $_GET['timestamp'] = 7;

$timespanpreselected[$_GET['timestamp']] = " selected='selected'";
$timespan = "<option value='0'>-</option>";
for ($i=1; $i<=30; $i++) {
	$timespan .= "<option value='$i'{$timespanpreselected[$i]}>".$flolang->sprintf($flolang->market_quickform_timespan, $i)."</option>";
	if ($i>=7) $i=$i+6;
}
if ($_GET['flagged']) $checkedflagged = "checked='checked'";
else unset($checkedflagged);

$options = "

	<form action='".$florensia->root."/getposted.php' method='POST'>

Timeline:	<select name='timestamp'>$timespan</select>

Section:	<input type='text' name='section' value='".$florensia->escape($_GET['section'])."' style='width:300px;'>

Userid:	<input type='text' name='currentuser' value='".$florensia->escape($_GET['currentuser'])."' style='width:300px;'>

IP-Adress:	<input type='text' name='currentip' value='".$florensia->escape($_GET['currentip'])."' style='width:300px;'>

Message:	<input type='text' name='logvalue' value='".$florensia->escape($_GET['logvalue'])."' style='width:300px;'>

Only flagged entries:	<input type='checkbox' name='flagged' value='1' style='margin:1px;' $checkedflagged>

	<input type='submit' name='logsearch' value='Search'><input type='hidden' name='getposted' value='adminlog'>

	</form>

";

$linkoption = array();
$timestamp = intval($_GET['timestamp']);
if ($timestamp) {
	$dbwhere[] = "timestamp>='".bcsub(date("U"),$timestamp*24*60*60)."'";
	$linkoption['timestamp'] = $timestamp;
}
if (strlen($_GET['section'])) {
	$dbwhere[] = "section LIKE '%".mysql_real_escape_string($_GET['section'])."%'";
	$linkoption['section'] = $_GET['section'];
}
if (strlen($_GET['currentuser'])) {
	$dbwhere[] = "currentuser='".intval($_GET['currentuser'])."'";
	$linkoption['currentuser'] = $_GET['currentuser'];
}
if (strlen($_GET['currentip'])) {
	$dbwhere[] = "currentip LIKE '%".mysql_real_escape_string($_GET['currentip'])."%'";
	$linkoption['currentip'] = $_GET['currentip'];
}
if (strlen($_GET['logvalue'])) {
	$dbwhere[] = "logvalue LIKE '%".mysql_real_escape_string($_GET['logvalue'])."%'";
	$linkoption['logvalue'] = $_GET['logvalue'];
}
if (intval($_GET['flagged'])) {
	$dbwhere[] = "flagged='1'";
	$linkoption['flagged'] = 1;
}
if ($dbwhere) $dbwhere = "WHERE ".join(" AND ", $dbwhere);

if (intval($_GET['page'])) $startpage = $_GET['page']*50-50;
else $startpage = 0;

$querylog = MYSQL_QUERY("SELECT SQL_CALC_FOUND_ROWS id, section, timestamp, currentuser, currentip, logvalue, flagged FROM flobase_log {$dbwhere} ORDER BY timestamp DESC LIMIT {$startpage},50");
list($entries) = MYSQL_FETCH_ARRAY(MYSQL_QUERY("SELECT FOUND_ROWS()"));
$pageselect = $florensia->pageselect($entries, array("adminlog"), $linkoption, 50);
while ($log = MYSQL_FETCH_ARRAY($querylog)) {
	//change flags?
	if ($_POST['do_adminlog_flag'] && $_POST['adminlog_flagged_'.$log['id']] && !$log['flagged']) {
		$dbaddflag[] = "id='{$log['id']}'";
		$dbaddflagids[] = "{log:{$log['id']}}";
		$log['flagged'] = 1;
	}
	elseif ($_POST['do_adminlog_flag'] && !$_POST['adminlog_flagged_'.$log['id']] && $log['flagged']) {
		$dbremoveflag[] = "id='{$log['id']}'";
		$dbremoveflagids[] = "{log:{$log['id']}}";
		$log['flagged'] = 0;
	}

	if ($log['flagged']) { $checkedflagged = "checked='checked'"; $flaggedclass="warning"; }
	else { $flaggedclass="shortinfo_".$florensia->change(); unset($checkedflagged); }

	$loglist .= "

<input type='checkbox' name='adminlog_flagged_{$log['id']}' value='1' $checkedflagged>

			".date("m.d.y H:i", $log['timestamp'])."
".$flouserdata->get_username($log['currentuser'])."
			{$log['section']}
			{$log['currentip']}

".$flolog->parse($log['logvalue'])."

	";
}
if ($loglist) {
	$loglist = "
		<form action='".$florensia->escape($florensia->request_uri())."' method='post'>

<input type='submit' name='do_adminlog_flag' value='Update flags'>

		{$loglist}

<input type='submit' name='do_adminlog_flag' value='Update flags'>

		</form>
	";
}

if (count($dbaddflag)) {
	if (!MYSQL_QUERY("UPDATE flobase_log SET flagged=1 WHERE ".join(" OR ", $dbaddflag))) {
		$flolog->add("error:log", "MySQL-Update-Error while add flagged status on ".join(", ", $dbaddflagids));
	} else {
		$flolog->add("log:flag", "{user:{$flouser->userid}} set flagged status on ".join(", ", $dbaddflagids));
	}
}
if (count($dbremoveflag)) {
	if (!MYSQL_QUERY("UPDATE flobase_log SET flagged=0 WHERE ".join(" OR ", $dbremoveflag))) {
		$flolog->add("error:log", "MySQL-Update-Error while remove flagged status on ".join(", ", $dbremoveflagids));
	} else {
		$flolog->add("log:flag", "{user:{$flouser->userid}} removed flagged status on ".join(", ", $dbremoveflagids));
	}
}

$content = "

root}/admincp.php'>AdminCP > Log

		Searching:

		For searching use the expressions displayed below on the right side and the IDs/numbers in brackets of each entry.

		Because in this way it is much easier to keep all names and links synched with the database by parsing them afterwards.

		You don't need to search always for the full expression, e.g. "{npc:mtmaidne1}". Mostly you will be fine with "mtmaidne1" or ":mtmaidne1"

		However sometimes it can be useful...

		Flags:

		Entries which shows something negative should be flagged, e.g. an user deliberately added wrong coordinates to the database.

		This might be useful to find users which abuse the database.

		Used expressions

		{user:userid}

		{npc:npcid}

		{item:itemid}

		{quest:questid}

		{map:mapid}

		{usernote:noteid}

		{guide:guideid}

		{gallery:galleryid}

		{character:charactername}

		{characterid:characterid}

		{characterverification:requestid}

		{log:logid}

		{timestamp:unixtime}

	{$options}

".$pageselect['selectbar']."

	{$loglist}

".$pageselect['selectbar']."

";
$florensia->output_page($content);
?>


text:
#import "NSView.h"

@class NSColor, NSDateFormatter, NSIndexSet, NSPopover;

@interface IntegrationHistoryView : NSView
{
    id <IntegrationHistoryViewDataSource> _dataSource;
    unsigned long long _loupeSize;
    double _currentBarWidth;
    double _currentColumnWidth;
    struct CGRect _newFrameSize;
    BOOL _mouseIsDown;
    BOOL _isPinnedToLastIntegration;
    NSPopover *_popover;
    id <IntegrationHistoryViewDelegate> _delegate;
    NSDateFormatter *_dateFormatter;
    NSColor *_backgroundColor;
    unsigned long long _integrationCount;
    unsigned long long _maxTestCount;
    double _loupeLocation;
}

+ (id)keyPathsForValuesAffectingLoupeWidth;
@property BOOL isPinnedToLastIntegration; // @synthesize isPinnedToLastIntegration=_isPinnedToLastIntegration;
@property BOOL mouseIsDown; // @synthesize mouseIsDown=_mouseIsDown;
@property double loupeLocation; // @synthesize loupeLocation=_loupeLocation;
@property unsigned long long maxTestCount; // @synthesize maxTestCount=_maxTestCount;
@property unsigned long long integrationCount; // @synthesize integrationCount=_integrationCount;
@property(retain, nonatomic) NSColor *backgroundColor; // @synthesize backgroundColor=_backgroundColor;
@property(retain, nonatomic) NSDateFormatter *dateFormatter; // @synthesize dateFormatter=_dateFormatter;
@property(nonatomic) __weak id <IntegrationHistoryViewDelegate> delegate; // @synthesize delegate=_delegate;
@property(nonatomic) __weak NSPopover *popover; // @synthesize popover=_popover;
- (void).cxx_destruct;
- (id)indexSetBasedOnRightSizeIsLastIntegration:(id)arg1;
- (id)titleFromIntegrationNumber:(unsigned long long)arg1;
- (id)titleFromDate:(id)arg1;
- (struct CGRect)rightJogRect;
- (struct CGPoint)maxPoint;
- (double)loupeWidth;
- (struct CGRect)loupeRect;
- (struct CGRect)leftJogRect;
- (BOOL)lastIntegrationIsVisible;
- (BOOL)isClipped;
- (id)indexesForRect:(struct CGRect)arg1;
- (void)contentViewBoundsDidChange:(id)arg1;
- (void)contentViewFrameDidChange:(id)arg1;
- (void)_frameOrBoundsDidChange;
- (double)constrainLoupeLocation:(double)arg1;
- (void)drawTopGutter;
- (void)drawTitles;
- (void)drawRightContentIndicator;
- (id)dateRangeStringWithSelectedIntegrationIndexes:(id)arg1;
- (id)stringWithSelectedIntegrationIndexes:(id)arg1;
- (void)drawLoupe;
- (void)drawLeftContentIndicator;
- (void)drawColumns;
- (void)drawBottomGutter;
- (void)hostWindowDidExitFullScreen:(id)arg1;
- (void)hostWindowDidEnterFullScreen:(id)arg1;
- (void)windowFinishedResizing:(id)arg1;
- (void)viewWillMoveToWindow:(id)arg1;
- (void)viewDidMoveToWindow;
- (void)drawRect:(struct CGRect)arg1;
- (void)mouseUp:(id)arg1;
- (void)mouseDown:(id)arg1;
- (void)layoutData;
- (void)resizeSubviewsWithOldSize:(struct CGSize)arg1;
- (void)reloadData;
- (void)noteNumberOfIntegrationsChanged;
@property(readonly, nonatomic) NSIndexSet *selectedIntegrationIndexes;
- (void)setFrame:(struct CGRect)arg1;
@property(nonatomic) unsigned long long loupeSize;
@property(nonatomic) __weak id <IntegrationHistoryViewDataSource> dataSource;
- (void)observeValueForKeyPath:(id)arg1 ofObject:(id)arg2 change:(id)arg3 context:(void *)arg4;
- (void)dealloc;
- (void)commonInit;
- (id)initWithCoder:(id)arg1;
- (id)initWithFrame:(struct CGRect)arg1;

@end


text:
package rise.http;

import rise.Account;
import rise.RiseException;
import org.json.simple.JSONObject;
import org.json.simple.JSONStreamAware;

import javax.servlet.http.HttpServletRequest;

public final class GetAccountAssetCount extends APIServlet.APIRequestHandler {

    static final GetAccountAssetCount instance = new GetAccountAssetCount();

    private GetAccountAssetCount() {
        super(new APITag[] {APITag.ACCOUNTS, APITag.AE}, "account", "height");
    }

    @Override
    JSONStreamAware processRequest(HttpServletRequest req) throws RiseException {

        Account account = ParameterParser.getAccount(req);
        int height = ParameterParser.getHeight(req);

        JSONObject response = new JSONObject();
        response.put("numberOfAssets", Account.getAccountAssetCount(account.getId(), height));
        return response;
    }

}