text:
using views::ColumnSet;
using views::GridLayout;

namespace {

// Minimum width of the the bubble.
const int kMinBubbleWidth = 300;
// Minimum width of the the textfield.
const int kMinTextfieldWidth = 200;
// Size of the icon.
const int kIconSize = extension_misc::EXTENSION_ICON_MEDIUM;

ExtensionService* GetExtensionService(Profile* profile) {
  return extensions::ExtensionSystem::Get(profile)->extension_service();
}

}  // namespace

BookmarkAppBubbleView* BookmarkAppBubbleView::bookmark_app_bubble_ = NULL;

BookmarkAppBubbleView::~BookmarkAppBubbleView() {
}

// static
void BookmarkAppBubbleView::ShowBubble(views::View* anchor_view,
                                       Profile* profile,
                                       const WebApplicationInfo& web_app_info,
                                       const std::string& extension_id) {
  if (bookmark_app_bubble_ != NULL)
    return;

  bookmark_app_bubble_ = new BookmarkAppBubbleView(
      anchor_view, profile, web_app_info, extension_id);
  views::BubbleDelegateView::CreateBubble(bookmark_app_bubble_)->Show();
  // Select the entire title textfield contents when the bubble is first shown.
  bookmark_app_bubble_->title_tf_->SelectAll(true);
  bookmark_app_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
}

BookmarkAppBubbleView::BookmarkAppBubbleView(
    views::View* anchor_view,
    Profile* profile,
    const WebApplicationInfo& web_app_info,
    const std::string& extension_id)
    : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
      profile_(profile),
      web_app_info_(web_app_info),
      extension_id_(extension_id),
      add_button_(NULL),
      cancel_button_(NULL),
      open_as_tab_checkbox_(NULL),
      title_tf_(NULL),
      remove_app_(true),
      app_icon_loader_(new extensions::AppIconLoaderImpl(profile,
                                                         kIconSize,
                                                         this)) {
  const SkColor background_color = GetNativeTheme()->GetSystemColor(
      ui::NativeTheme::kColorId_DialogBackground);
  set_arrow(views::BubbleBorder::TOP_CENTER);
  set_color(background_color);
  set_background(views::Background::CreateSolidBackground(background_color));
  set_margins(gfx::Insets(views::kPanelVertMargin, 0, 0, 0));
}

void BookmarkAppBubbleView::Init() {
  views::Label* title_label = new views::Label(
      l10n_util::GetStringUTF16(IDS_BOOKMARK_APP_BUBBLE_TITLE));
  ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
  title_label->SetFontList(rb->GetFontList(ui::ResourceBundle::MediumFont));
  title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);

  add_button_ =
      new views::LabelButton(this, l10n_util::GetStringUTF16(IDS_ADD));
  add_button_->SetStyle(views::Button::STYLE_BUTTON);
  add_button_->SetIsDefault(true);

  cancel_button_ =
      new views::LabelButton(this, l10n_util::GetStringUTF16(IDS_CANCEL));
  cancel_button_->SetStyle(views::Button::STYLE_BUTTON);

  GridLayout* layout = new GridLayout(this);
  SetLayoutManager(layout);

  // Column sets used in the layout of the bubble.
  enum ColumnSetID {
    TITLE_COLUMN_SET_ID,
    TITLE_TEXT_COLUMN_SET_ID,
    CONTENT_COLUMN_SET_ID
  };

  // The column layout used for the title and checkbox.
  ColumnSet* cs = layout->AddColumnSet(TITLE_COLUMN_SET_ID);
  cs->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
  cs->AddColumn(
      GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);

  // The column layout used for the icon and text box.
  cs = layout->AddColumnSet(TITLE_TEXT_COLUMN_SET_ID);
  cs->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
  cs->AddColumn(GridLayout::LEADING,
                GridLayout::CENTER,
                0,
                GridLayout::USE_PREF,
                0,
                0);
  cs->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
  cs->AddColumn(GridLayout::FILL,
                GridLayout::CENTER,
                1,
                GridLayout::USE_PREF,
                0,
                kMinTextfieldWidth);
  cs->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);

  // The column layout used for the row with buttons.
  cs = layout->AddColumnSet(CONTENT_COLUMN_SET_ID);
  cs->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
  cs->AddColumn(
      GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing);
  cs->AddColumn(
      GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
  cs->AddColumn(
      GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0);
  cs->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);

  layout->StartRow(0, TITLE_COLUMN_SET_ID);
  layout->AddView(title_label);
  layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);

  const extensions::Extension* extension =
      extensions::ExtensionRegistry::Get(profile_)->GetExtensionById(
          extension_id_, extensions::ExtensionRegistry::EVERYTHING);

  layout->StartRow(0, TITLE_TEXT_COLUMN_SET_ID);
  icon_image_view_ = new views::ImageView();
  icon_image_view_->SetImageSize(gfx::Size(kIconSize, kIconSize));
  layout->AddView(icon_image_view_);
  app_icon_loader_->FetchImage(extension_id_);

  title_tf_ = new views::Textfield();
  title_tf_->SetText(extension ? base::UTF8ToUTF16(extension->name())
                               : web_app_info_.title);
  layout->AddView(title_tf_);
  layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);

  layout->StartRow(0, CONTENT_COLUMN_SET_ID);
  open_as_tab_checkbox_ = new views::Checkbox(
      l10n_util::GetStringUTF16(IDS_BOOKMARK_APP_BUBBLE_OPEN_AS_TAB));
  open_as_tab_checkbox_->SetChecked(
      profile_->GetPrefs()->GetInteger(
          extensions::pref_names::kBookmarkAppCreationLaunchType) ==
              extensions::LAUNCH_TYPE_REGULAR);
  layout->AddView(open_as_tab_checkbox_);
  layout->AddView(add_button_);
  layout->AddView(cancel_button_);
  layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);

  AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
}

views::View* BookmarkAppBubbleView::GetInitiallyFocusedView() {
  return title_tf_;
}

void BookmarkAppBubbleView::WindowClosing() {
  // We have to reset |bookmark_app_bubble_| here, not in our destructor,
  // because we'll be destroyed asynchronously and the shown state will be
  // checked before then.
  DCHECK_EQ(bookmark_app_bubble_, this);
  bookmark_app_bubble_ = NULL;

  if (remove_app_) {
    GetExtensionService(profile_)->UninstallExtension(
        extension_id_,
        ExtensionService::UNINSTALL_REASON_INSTALL_CANCELED,
        NULL);
  } else {
    ApplyEdits();
  }
}

bool BookmarkAppBubbleView::AcceleratorPressed(
    const ui::Accelerator& accelerator) {
  if (accelerator.key_code() == ui::VKEY_RETURN) {
    HandleButtonPressed(add_button_);
  }

  return BubbleDelegateView::AcceleratorPressed(accelerator);
}

gfx::Size BookmarkAppBubbleView::GetMinimumSize() const {
  gfx::Size size(views::BubbleDelegateView::GetPreferredSize());
  size.SetToMax(gfx::Size(kMinBubbleWidth, 0));
  return size;
}

void BookmarkAppBubbleView::ButtonPressed(views::Button* sender,
                                          const ui::Event& event) {
  HandleButtonPressed(sender);
}

void BookmarkAppBubbleView::SetAppImage(const std::string& id,
                                        const gfx::ImageSkia& image) {
  DCHECK_EQ(extension_id_, id);
  icon_image_view_->SetImage(image);
}

void BookmarkAppBubbleView::HandleButtonPressed(views::Button* sender) {
  // Unset |remove_app_| so we don't delete the bookmark after the window
  // closes.
  if (sender == add_button_)
    remove_app_ = false;

  GetWidget()->Close();
}

void BookmarkAppBubbleView::ApplyEdits() {
  // Set the launch type based on the checkbox.
  extensions::LaunchType launch_type = open_as_tab_checkbox_->checked()
      ? extensions::LAUNCH_TYPE_REGULAR
      : extensions::LAUNCH_TYPE_WINDOW;
  profile_->GetPrefs()->SetInteger(
          extensions::pref_names::kBookmarkAppCreationLaunchType, launch_type);
  extensions::SetLaunchType(GetExtensionService(profile_),
                            extension_id_,
                            launch_type);

  const extensions::Extension* extension =
      extensions::ExtensionRegistry::Get(profile_)->GetExtensionById(
          extension_id_, extensions::ExtensionRegistry::EVERYTHING);
  if (extension && base::UTF8ToUTF16(extension->name()) == title_tf_->text())
    return;

  // Reinstall the app with an updated name.
  WebApplicationInfo install_info(web_app_info_);
  install_info.title = title_tf_->text();

  extensions::CreateOrUpdateBookmarkApp(GetExtensionService(profile_),
                                        install_info);
}


text:
package nl.soccar.gameserver.util;

import nl.soccar.gameserver.model.session.RoomWrapper;

import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Utilities for the Room.
 *
 * @author PTS34A
 */
public final class RoomUtilities {

    private static final Random RANDOM = new Random();

    private RoomUtilities() {
    }

    /**
     * Gets the next player id.
     *
     * @param room The given Room, not null.
     * @return int The next player Id.
     */
    public static final int getNextPlayerId(RoomWrapper room) {
        final AtomicInteger id = new AtomicInteger(RANDOM.nextInt(Byte.MAX_VALUE));
        while (room.getPlayers().stream().anyMatch(p -> p.getPlayerId() == id.get())) {
            id.set(RANDOM.nextInt(Byte.MAX_VALUE));
        }

        return id.get();
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?php

// Numa\DOAAdminBundle\Events/AddFeedSourceSubscriber.php

namespace Numa\DOADMSBundle\Events;

use Numa\DOAAdminBundle\Entity\Item;
use Numa\DOAAdminBundle\Entity\Catalogrecords;
use Numa\DOADMSBundle\Entity\DealerGroup;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Numa\Form\AutocompleteType;

class CustomerSubscriber implements EventSubscriberInterface
{

    protected $container;

    public function __construct($container)
    {
        $this->container = $container;
    }

    public static function getSubscribedEvents()
    {
        // Tells the dispatcher that you want to listen on the form.pre_set_data
        // event and that the preSetData method should be called.
        return array(FormEvents::PRE_SET_DATA => 'preSetData');
    }

    /**
     * @param FormEvent $event
     * Based by the type of the each field in the form (item)
     * Fills the select  or other fields
     */
    public function preSetData(FormEvent $event)
    {
        if ($this->container->get('security.authorization_checker')->isGranted('ROLE_DEALER_PRINCIPAL')) {

            $form = $event->getForm();
            $em = $this->container->get("doctrine.orm.entity_manager");
            $dealerPrincipal = $this->container->get("numa.dms.user")->getSignedDealerPrincipal();

            if ($dealerPrincipal instanceof DealerGroup) {
                $form->add('Catalogrecords', 'entity', array(
                    'choices' => $em->getRepository('NumaDOAAdminBundle:Catalogrecords')->getDealersByDealerGroup($dealerPrincipal->getId()),
                    'class' => "Numa\DOAAdminBundle\Entity\Catalogrecords"
                ));
            }

            //if dealer have dealer group
            //add select field with all the dealers from the group
        }

    }

}


text:
package com.lujiahao.portal.controller;

import com.lujiahao.common.domain.ServerResponse;
import com.lujiahao.portal.pojo.CartItem;
import com.lujiahao.portal.service.CartService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 购物车的Controller
 * Created by lujiahao on 2016/11/1.
 */
@Controller
@RequestMapping(value = "/cart")
public class CartController {
    @Autowired
    private CartService cartService;

    /**
     * 展示购物车界面
     * @param itemId
     * @param num
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/add/{itemId}")
    public String addCartItem(@PathVariable Long itemId, @RequestParam(defaultValue = "1") Integer num,
                              HttpServletRequest request, HttpServletResponse response) {
        ServerResponse serverResponse = cartService.addCartItem(request, response, itemId, num);
        //return "cartSuccess";  // 不这样直接写的原因是因为如果刷新的话会造成多次添加购物车,造成数量不正确
        return "redirect:/cart/success.html";
    }

    /**
     * 显示添加购物车成功界面
     */
    @RequestMapping(value = "/success")
    public String addCartItem() {
        return "cartSuccess";
    }

    /**
     * 展示购物车列表
     * @param request
     * @param response
     * @param model
     * @return
     */
    @RequestMapping(value = "/cart")
    public String showCart(HttpServletRequest request, HttpServletResponse response, Model model){
        List<CartItem> list = cartService.getCartItemList(request, response);
        model.addAttribute("cartList",list);
        return "cart";
    }

    @RequestMapping(value = "/delete/{itemId}")
    public String deleteCartItem(@PathVariable Long itemId, HttpServletRequest request, HttpServletResponse response){
        ServerResponse serverResponse = cartService.deleteCartItem(request, response, itemId);
        return "redirect:/cart/cart.html";
    }
}


text:
package com.designpattern.mains;

import com.designpattern.abstractfactory.*;
import com.designpattern.abstractfactory.FactoryProducer;
import com.designpattern.factory.interfaces.Color;
import com.designpattern.factory.interfaces.Shape;

public class AbstractFactoryPatternDemo {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		// Instantiate Shape Factory
		AbstractFactory shapeFactory = FactoryProducer.getFactory("SHAPE");

		// Create a circle object
		Shape circle = shapeFactory.getShape("circle");
		circle.draw();

		// Create a rectangle object
		Shape rectangle = shapeFactory.getShape("rectangle");
		rectangle.draw();

		// Instantiate Color Factory
		AbstractFactory colorFactory = FactoryProducer.getFactory("COLOR");

		// Create a red object
		Color red = colorFactory.getColor("RED");
		red.fill();

		// Create a green object
		Color green = colorFactory.getColor("Green");
		green.fill();

		// Create a blue object
		Color blue = colorFactory.getColor("Blue");
		blue.fill();

	}

}


text:
namespace iControl {
	using System.Xml.Serialization;
	using System.Web.Services;
	using System.ComponentModel;
	using System.Web.Services.Protocols;
	using System;
	using System.Diagnostics;

	/// <remarks/>
	[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
	[System.Diagnostics.DebuggerStepThroughAttribute()]
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	[System.Web.Services.WebServiceBindingAttribute(Name="Security.ProfileIPIntelligenceBinding", Namespace="urn:iControl")]
	[System.Xml.Serialization.SoapIncludeAttribute(typeof(SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics))]
	[System.Xml.Serialization.SoapIncludeAttribute(typeof(SecurityProfileIPIntelligenceProfileAction))]
	[System.Xml.Serialization.SoapIncludeAttribute(typeof(CommonProfileStatisticsByVirtual))]
	public partial class SecurityProfileIPIntelligence : iControlInterface {
		public SecurityProfileIPIntelligence() {
			this.Url = "https://url_to_service";
		}

	//=======================================================================
	// Operations
	//=======================================================================
	//-----------------------------------------------------------------------
	// create
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void create(
		string [] profile_names
	) {
		this.Invoke("create", new object [] {
				profile_names});

	}
	public System.IAsyncResult Begincreate(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("create", new object[] {
			profile_names}, callback, asyncState);
	}
	public void Endcreate(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// delete_all_profiles
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void delete_all_profiles(

	) {
		this.Invoke("delete_all_profiles", new object [0]);

	}
	public System.IAsyncResult Begindelete_all_profiles(System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("delete_all_profiles", new object[0], callback, asyncState);
	}
	public void Enddelete_all_profiles(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// delete_profile
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void delete_profile(
		string [] profile_names
	) {
		this.Invoke("delete_profile", new object [] {
				profile_names});

	}
	public System.IAsyncResult Begindelete_profile(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("delete_profile", new object[] {
			profile_names}, callback, asyncState);
	}
	public void Enddelete_profile(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// get_all_statistics
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics get_all_statistics(

	) {
		object [] results = this.Invoke("get_all_statistics", new object [0]);
		return ((SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics)(results[0]));
	}
	public System.IAsyncResult Beginget_all_statistics(System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_all_statistics", new object[0], callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics Endget_all_statistics(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics)(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_botnets_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_botnets_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_botnets_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_botnets_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_botnets_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_botnets_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_default_profile
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public string [] get_default_profile(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_default_profile", new object [] {
				profile_names});
		return ((string [])(results[0]));
	}
	public System.IAsyncResult Beginget_default_profile(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_default_profile", new object[] {
			profile_names}, callback, asyncState);
	}
	public string [] Endget_default_profile(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((string [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_denial_of_service_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_denial_of_service_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_denial_of_service_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_denial_of_service_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_denial_of_service_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_denial_of_service_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_description
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public string [] get_description(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_description", new object [] {
				profile_names});
		return ((string [])(results[0]));
	}
	public System.IAsyncResult Beginget_description(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_description", new object[] {
			profile_names}, callback, asyncState);
	}
	public string [] Endget_description(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((string [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_infected_sources_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_infected_sources_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_infected_sources_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_infected_sources_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_infected_sources_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_infected_sources_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_list
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public string [] get_list(

	) {
		object [] results = this.Invoke("get_list", new object [0]);
		return ((string [])(results[0]));
	}
	public System.IAsyncResult Beginget_list(System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_list", new object[0], callback, asyncState);
	}
	public string [] Endget_list(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((string [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_phishing_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_phishing_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_phishing_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_phishing_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_phishing_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_phishing_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_proxy_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_proxy_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_proxy_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_proxy_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_proxy_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_proxy_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_scanners_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_scanners_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_scanners_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_scanners_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_scanners_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_scanners_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_spam_sources_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_spam_sources_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_spam_sources_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_spam_sources_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_spam_sources_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_spam_sources_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_statistics
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics get_statistics(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_statistics", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics)(results[0]));
	}
	public System.IAsyncResult Beginget_statistics(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_statistics", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics Endget_statistics(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics)(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_statistics_by_virtual
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public CommonProfileStatisticsByVirtual get_statistics_by_virtual(
		string [] profile_names,
		string [] [] virtual_names
	) {
		object [] results = this.Invoke("get_statistics_by_virtual", new object [] {
				profile_names,
				virtual_names});
		return ((CommonProfileStatisticsByVirtual)(results[0]));
	}
	public System.IAsyncResult Beginget_statistics_by_virtual(string [] profile_names,string [] [] virtual_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_statistics_by_virtual", new object[] {
			profile_names,
			virtual_names}, callback, asyncState);
	}
	public CommonProfileStatisticsByVirtual Endget_statistics_by_virtual(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((CommonProfileStatisticsByVirtual)(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_version
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public string get_version(

	) {
		object [] results = this.Invoke("get_version", new object [] {
});
		return ((string)(results[0]));
	}
	public System.IAsyncResult Beginget_version(System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_version", new object[] {
}, callback, asyncState);
	}
	public string Endget_version(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((string)(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_web_attacks_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_web_attacks_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_web_attacks_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_web_attacks_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_web_attacks_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_web_attacks_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// get_windows_exploits_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public SecurityProfileIPIntelligenceProfileAction [] get_windows_exploits_action(
		string [] profile_names
	) {
		object [] results = this.Invoke("get_windows_exploits_action", new object [] {
				profile_names});
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}
	public System.IAsyncResult Beginget_windows_exploits_action(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("get_windows_exploits_action", new object[] {
			profile_names}, callback, asyncState);
	}
	public SecurityProfileIPIntelligenceProfileAction [] Endget_windows_exploits_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((SecurityProfileIPIntelligenceProfileAction [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// is_base_profile
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public bool [] is_base_profile(
		string [] profile_names
	) {
		object [] results = this.Invoke("is_base_profile", new object [] {
				profile_names});
		return ((bool [])(results[0]));
	}
	public System.IAsyncResult Beginis_base_profile(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("is_base_profile", new object[] {
			profile_names}, callback, asyncState);
	}
	public bool [] Endis_base_profile(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((bool [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// is_system_profile
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	[return: System.Xml.Serialization.SoapElementAttribute("return")]
	public bool [] is_system_profile(
		string [] profile_names
	) {
		object [] results = this.Invoke("is_system_profile", new object [] {
				profile_names});
		return ((bool [])(results[0]));
	}
	public System.IAsyncResult Beginis_system_profile(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("is_system_profile", new object[] {
			profile_names}, callback, asyncState);
	}
	public bool [] Endis_system_profile(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
		return ((bool [])(results[0]));
	}

	//-----------------------------------------------------------------------
	// reset_statistics
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void reset_statistics(
		string [] profile_names
	) {
		this.Invoke("reset_statistics", new object [] {
				profile_names});

	}
	public System.IAsyncResult Beginreset_statistics(string [] profile_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("reset_statistics", new object[] {
			profile_names}, callback, asyncState);
	}
	public void Endreset_statistics(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// reset_statistics_by_virtual
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void reset_statistics_by_virtual(
		string [] profile_names,
		string [] [] virtual_names
	) {
		this.Invoke("reset_statistics_by_virtual", new object [] {
				profile_names,
				virtual_names});

	}
	public System.IAsyncResult Beginreset_statistics_by_virtual(string [] profile_names,string [] [] virtual_names, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("reset_statistics_by_virtual", new object[] {
			profile_names,
			virtual_names}, callback, asyncState);
	}
	public void Endreset_statistics_by_virtual(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_botnets_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_botnets_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_botnets_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_botnets_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_botnets_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_botnets_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_default_profile
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_default_profile(
		string [] profile_names,
		string [] defaults
	) {
		this.Invoke("set_default_profile", new object [] {
				profile_names,
				defaults});

	}
	public System.IAsyncResult Beginset_default_profile(string [] profile_names,string [] defaults, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_default_profile", new object[] {
			profile_names,
			defaults}, callback, asyncState);
	}
	public void Endset_default_profile(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_denial_of_service_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_denial_of_service_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_denial_of_service_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_denial_of_service_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_denial_of_service_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_denial_of_service_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_description
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_description(
		string [] profile_names,
		string [] descriptions
	) {
		this.Invoke("set_description", new object [] {
				profile_names,
				descriptions});

	}
	public System.IAsyncResult Beginset_description(string [] profile_names,string [] descriptions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_description", new object[] {
			profile_names,
			descriptions}, callback, asyncState);
	}
	public void Endset_description(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_infected_sources_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_infected_sources_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_infected_sources_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_infected_sources_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_infected_sources_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_infected_sources_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_phishing_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_phishing_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_phishing_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_phishing_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_phishing_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_phishing_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_proxy_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_proxy_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_proxy_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_proxy_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_proxy_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_proxy_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_scanners_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_scanners_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_scanners_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_scanners_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_scanners_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_scanners_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_spam_sources_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_spam_sources_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_spam_sources_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_spam_sources_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_spam_sources_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_spam_sources_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_web_attacks_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_web_attacks_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_web_attacks_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_web_attacks_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_web_attacks_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_web_attacks_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	//-----------------------------------------------------------------------
	// set_windows_exploits_action
	//-----------------------------------------------------------------------
	[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:iControl:Security/ProfileIPIntelligence",
		RequestNamespace="urn:iControl:Security/ProfileIPIntelligence", ResponseNamespace="urn:iControl:Security/ProfileIPIntelligence")]
	public void set_windows_exploits_action(
		string [] profile_names,
		SecurityProfileIPIntelligenceProfileAction [] actions
	) {
		this.Invoke("set_windows_exploits_action", new object [] {
				profile_names,
				actions});

	}
	public System.IAsyncResult Beginset_windows_exploits_action(string [] profile_names,SecurityProfileIPIntelligenceProfileAction [] actions, System.AsyncCallback callback, object asyncState) {
		return this.BeginInvoke("set_windows_exploits_action", new object[] {
			profile_names,
			actions}, callback, asyncState);
	}
	public void Endset_windows_exploits_action(System.IAsyncResult asyncResult) {
		object [] results = this.EndInvoke(asyncResult);
	}

	}
	//=======================================================================
	// Enums
	//=======================================================================

	/// <remarks/>
	[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
	[System.SerializableAttribute()]
	[System.Xml.Serialization.SoapTypeAttribute(TypeName = "Security.ProfileIPIntelligence.Action", Namespace = "urn:iControl")]
	public enum SecurityProfileIPIntelligenceAction
	{
		IP_INTELLIGENCE_ACTION_UNKNOWN,
		IP_INTELLIGENCE_ACTION_ACCEPT,
		IP_INTELLIGENCE_ACTION_WARN,
		IP_INTELLIGENCE_ACTION_REJECT,
	}

	//=======================================================================
	// Structs
	//=======================================================================

	/// <remarks/>
	[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
	[System.SerializableAttribute()]
	[System.Diagnostics.DebuggerStepThroughAttribute()]
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	[System.Xml.Serialization.SoapTypeAttribute(TypeName = "Security.ProfileIPIntelligence.ProfileAction", Namespace = "urn:iControl")]
	public partial class SecurityProfileIPIntelligenceProfileAction
	{
		private SecurityProfileIPIntelligenceAction valueField;
		public SecurityProfileIPIntelligenceAction value
		{
			get { return this.valueField; }
			set { this.valueField = value; }
		}
		private bool default_flagField;
		public bool default_flag
		{
			get { return this.default_flagField; }
			set { this.default_flagField = value; }
		}
	};

	/// <remarks/>
	[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
	[System.SerializableAttribute()]
	[System.Diagnostics.DebuggerStepThroughAttribute()]
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	[System.Xml.Serialization.SoapTypeAttribute(TypeName = "Security.ProfileIPIntelligence.ProfileIPIntelligenceStatisticEntry", Namespace = "urn:iControl")]
	public partial class SecurityProfileIPIntelligenceProfileIPIntelligenceStatisticEntry
	{
		private string profile_nameField;
		public string profile_name
		{
			get { return this.profile_nameField; }
			set { this.profile_nameField = value; }
		}
		private CommonStatistic [] statisticsField;
		public CommonStatistic [] statistics
		{
			get { return this.statisticsField; }
			set { this.statisticsField = value; }
		}
	};

	/// <remarks/>
	[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
	[System.SerializableAttribute()]
	[System.Diagnostics.DebuggerStepThroughAttribute()]
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	[System.Xml.Serialization.SoapTypeAttribute(TypeName = "Security.ProfileIPIntelligence.ProfileIPIntelligenceStatistics", Namespace = "urn:iControl")]
	public partial class SecurityProfileIPIntelligenceProfileIPIntelligenceStatistics
	{
		private SecurityProfileIPIntelligenceProfileIPIntelligenceStatisticEntry [] statisticsField;
		public SecurityProfileIPIntelligenceProfileIPIntelligenceStatisticEntry [] statistics
		{
			get { return this.statisticsField; }
			set { this.statisticsField = value; }
		}
		private CommonTimeStamp time_stampField;
		public CommonTimeStamp time_stamp
		{
			get { return this.time_stampField; }
			set { this.time_stampField = value; }
		}
	};

}


text:
package hr.fer.zemris.util.scheduling.algorithms.filip_boltuzic;

import hr.fer.zemris.util.scheduling.algorithms.MainScheduler;
import hr.fer.zemris.util.scheduling.support.ISchedulingResult;
import hr.fer.zemris.util.scheduling.support.ReservationManager2;
import hr.fer.zemris.util.scheduling.support.RoomData;
import hr.fer.zemris.util.scheduling.support.SchedulingResult;
import hr.fer.zemris.util.scheduling.support.algorithmview.IEvent;
import hr.fer.zemris.util.scheduling.support.algorithmview.ILocationParameter;
import hr.fer.zemris.util.scheduling.support.algorithmview.IPlan;
import hr.fer.zemris.util.scheduling.support.algorithmview.IPrecondition;
import hr.fer.zemris.util.scheduling.support.algorithmview.ITerm;
import hr.fer.zemris.util.scheduling.support.algorithmview.ITimeParameter;
import hr.fer.zemris.util.time.DateStamp;
import hr.fer.zemris.util.time.TimeSpan;
import hr.fer.zemris.util.time.TimeStamp;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class PopulationMemberBCO implements Comparable<PopulationMemberBCO> {

	private int level;
	private int profitability;
	private String planName;
	private List<IEvent> events;
	private Map<String, List<TermBCO>> terms;
	private Map<String, List<Student>> students;

	private static final int numberOfHardConstraints = 4;
	private static final int penaltyStep = 10;
	private int[] fitnessVector = new int[6];

	public boolean studentiNaRaziniTermina = false;
	private Random randomGenerator = new Random();

	public PopulationMemberBCO() {
		events = new ArrayList<IEvent>();
		terms = new HashMap<String, List<TermBCO>>();
		students = new HashMap<String, List<Student>>();

	}

	public PopulationMemberBCO(ReservationManager2 fixedReservationManager) {
		events = new ArrayList<IEvent>();
		terms = new HashMap<String, List<TermBCO>>();
		students = new HashMap<String, List<Student>>();
	}

	public PopulationMemberBCO(int id) {
		this.level = id;
		events = new ArrayList<IEvent>();
		terms = new HashMap<String, List<TermBCO>>();
		students = new HashMap<String, List<Student>>();
	}

	public PopulationMemberBCO(int id,
			ReservationManager2 fixedReservationManager) {
		this.level = id;
		events = new ArrayList<IEvent>();
		terms = new HashMap<String, List<TermBCO>>();
		students = new HashMap<String, List<Student>>();
	}

	public PopulationMemberBCO(List<IEvent> events, Map<String, List<TermBCO>> terms,
			Map<String, List<Student>> students
			) {
		this.events = events;
		this.terms = terms;
		this.students = students;
		completeData();
	}
	public void completeData(){
		List<IEvent> events = this.events;
		Map<String, List<TermBCO>> terms = this.terms;
		Map<String, List<Student>> students = this.students;
		setEvents(events);
		setTerms(terms);
		setStudents(students);
	}

	public void rebuildManager(ReservationManager2 manager) {
		for (IEvent e : events) {
			for (TermBCO t : terms.get(e.getId())) {
				manager.reserveRoom(t.getRoom().getId(), t.getDate(), t
						.getTimeSpan());
				for (Student s : students.get(t.getId())) {
					manager.reserveStudent(s.jmbag, t.getDate(), t
							.getTimeSpan());
				}
			}
		}
	}

	private void setEvents(List<IEvent> events) {
		this.events = new ArrayList<IEvent>();
		for (IEvent e : events) {
			this.events.add(e);
		}
	}

	private void setTerms(Map<String, List<TermBCO>> terms) {
		this.terms = new HashMap<String, List<TermBCO>>();
		for (String s : terms.keySet()) {
			this.terms.put(s, new ArrayList<TermBCO>());
			for (TermBCO t : terms.get(s)) {
				this.terms.get(s).add((TermBCO) t.clone());
			}
		}
	}

	private void setStudents(Map<String, List<Student>> students) {
		this.students = new HashMap<String, List<Student>>();
		for (String s : students.keySet()) {
			this.students.put(s, new ArrayList<Student>());
			for (Student s1 : students.get(s)) {
				this.students.get(s).add(new Student(s1.jmbag));
			}
		}
	}

	public Map<String, List<TermBCO>> getTerms() {
		return this.terms;
	}

	public Map<String, List<Student>> getStudents() {
		return this.students;
	}

	public void setLevel(int id) {
		this.level = id;
	}

	public int getLevel() {
		return this.level;
	}

	protected Object clone() {
		PopulationMemberBCO ret = new PopulationMemberBCO(-1);
		ret.setPlan(planName);
		ret.setEvents(events);
		ret.setTerms(terms);
		ret.setStudents(students);
		ret.setFitnessVector(fitnessVector);
		return ret;
	}

	private void setFitnessVector(int[] fitnessVector) {
		this.fitnessVector = Arrays.copyOf(fitnessVector, fitnessVector.length);
	}

	public void setPlan(String planName) {
		this.planName = planName;
	}

	public ISchedulingResult toResult() {
		SchedulingResult result = new SchedulingResult();
		result.addPlan(MainScheduler.plan.getName());
		for(IEvent e:MainScheduler.plan.getPlanEvents()) {
			result.addEvent(e.getName(),e.getId());
			for(TermBCO t:terms.get(e.getId())) {
				result.addTerm(e.getName(), t.getName(), t.getRoom().getId(), t.getRoom().getCapacity(), t.getDate().getStamp(), t.getTimeSpan().getStart().getAbsoluteTime(), t.getTimeSpan().getEnd().getAbsoluteTime());
				for(Student s:students.get(t.getId())) {
					result.addStudentToTerm(e.getName(), t.getName(), s.jmbag);
				}
			}
		}
		return result;
	}

	public void addEvent(IEvent event) {
		events.add(event);
	}

	public List<IEvent> getEvents() {
		return events;
	}

	public void addTermToEvent(String eventId, TermBCO term) {
		if (this.terms.get(eventId) == null)
			this.terms.put(eventId, new ArrayList<TermBCO>());
		this.terms.get(eventId).add(term);
	}

	public void addStudentToTerm(TermBCO term, String JMBAG) {
		if (this.students.get(term.getId()) == null)
			this.students.put(term.getId(), new ArrayList<Student>());
		this.students.get(term.getId()).add(new Student(JMBAG));
	}

	@Override
	public String toString() {
		String out = "";
		for (IEvent e : events) {
			out += e.getId() + "\n\n";
			for (TermBCO t : terms.get(e.getId())) {
				out += t.getName() + "/" + t.getRoom().getName() + "("
						+ t.getRoom().getCapacity() + ")/"
						+ t.getDate().getStamp() + "/"
						+ t.getTimeSpan().toString() + "\n";
				for (Student s : students.get(t.getId())) {
					out += s.jmbag + "\n";
				}
				out += students.get(t.getId()).size() + "\n\n";
			}
			out += "-----------------------------------------";
			out += "\n\n";
		}
		return out;
	}

	public void evaluate(ReservationManager2 manager) {
		Arrays.fill(fitnessVector, 0);
		for (IEvent e : events) {
			fitnessVector[0] += countWrongPreconditionsForEvent(e);
		}
		fitnessVector[1] = manager.countConflictsForRooms();
		fitnessVector[2] = manager.countConflictsForStudents();
		countOvercrowdedRooms();
	}

	private void countOvercrowdedRooms() {
		for (String eventId : terms.keySet()) {
			for (TermBCO t : terms.get(eventId)) {
				fitnessVector[4]++;
				if (t.getRoom().getCapacity() < students.get(t.getId()).size())
					fitnessVector[3]++;
				else
					fitnessVector[5] += t.getRoom().getCapacity()
							- students.get(t.getId()).size();
			}
		}
	}

	private int countWrongPreconditionsForEvent(IEvent event) {
		int count = 0;
		for (IPrecondition p : event.getPreconditionEvents()) {
			for (TermBCO t1 : terms.get(event.getId())) {
				for (TermBCO t2 : terms.get(p.getEvent().getId())) {
					if (DateStamp.dateDiff(t1.getDate(), t2.getDate()) < p
							.getTimeDistanceValue())
						count++;
				}
			}
		}
		return count;
	}

	public int[] getFitnessVector() {
		return fitnessVector;
	}

	public void mutate(
			Map<String, Map<RoomData, Map<DateStamp, List<TimeSpan>>>> availableResourcesForEvent) {
		IEvent event = events.get(randomGenerator.nextInt(events.size()));
		List<TermBCO> termini = terms.get(event.getId());
		TermBCO term = termini.get(randomGenerator.nextInt(termini.size()));
		if (!studentiNaRaziniTermina) {
			TermBCO term2 = termini
					.get(randomGenerator.nextInt(termini.size()));
			List<Student> s1 = students.get(term.getId());
			List<Student> s2 = students.get(term2.getId());
			int num1 = randomGenerator.nextInt(s1.size());
			int num2 = randomGenerator.nextInt(s2.size());
			Collections.shuffle(s1, randomGenerator);
			Collections.shuffle(s2, randomGenerator);
			for (int i = 0; i < num1; i++)
				s2.add(s1.remove(0));
			for (int i = 0; i < num2; i++)
				s1.add(s2.remove(0));
		}
		// if(fitnessVector[0]!=0 || fitnessVector[1]!=0)
		changeTerm(event, term, availableResourcesForEvent);
	}

	public void swapStudents(TermBCO term1, TermBCO term2) {
		List<Student> students1 = students.get(term1.getId());
		List<Student> students2 = students.get(term2.getId());
		int size = Math.min(students1.size(), students2.size());
		int idx1 = randomGenerator.nextInt(size);
		int idx2 = randomGenerator.nextInt(size);
		Student s1 = students1.get(idx1);
		Student s2 = students2.get(idx2);
		students1.set(idx1, s2);
		students2.set(idx2, s1);
	}

	public void changeTerm(
			IEvent event,
			TermBCO term,
			Map<String, Map<RoomData, Map<DateStamp, List<TimeSpan>>>> availableResourcesForEvent) {
		Map<RoomData, Map<DateStamp, List<TimeSpan>>> termData = availableResourcesForEvent
				.get(term.getId());
		if (termData == null)
			termData = availableResourcesForEvent.get(event.getId());
		List<RoomData> availableRooms = new ArrayList<RoomData>(termData
				.keySet());
		RoomData selectedRoom = availableRooms.get(randomGenerator
				.nextInt(availableRooms.size()));
		List<DateStamp> availableDates = new ArrayList<DateStamp>(termData.get(
				selectedRoom).keySet());
		DateStamp selectedDate = availableDates.get(randomGenerator
				.nextInt(availableDates.size()));
		List<TimeSpan> availableTimeSpans = new ArrayList<TimeSpan>(termData
				.get(selectedRoom).get(selectedDate));
		if (availableTimeSpans == null)
			return;
		TimeSpan selectedTimeSpan = availableTimeSpans.get(randomGenerator
				.nextInt(availableTimeSpans.size()));
		int startTime = selectedTimeSpan.getStart().getAbsoluteTime() / 15;
		if (selectedTimeSpan.getEnd().getAbsoluteTime()
				- selectedTimeSpan.getStart().getAbsoluteTime() > term
				.getDuration()) {
			startTime += randomGenerator.nextInt((selectedTimeSpan.getEnd()
					.getAbsoluteTime()
					- selectedTimeSpan.getStart().getAbsoluteTime() - term
					.getDuration()) / 15);
		}
		int endTime = startTime + term.getDuration() / 15;
		TimeSpan ts = new TimeSpan(new TimeStamp(startTime * 15),
				new TimeStamp(endTime * 15));
		term.setDateStamp(selectedDate);
		term.setRoom(selectedRoom);
		term.setTimeSpan(ts);
	}

	@Override
	public int compareTo(PopulationMemberBCO o) {
		int[] fitnessVector1 = this.getFitnessVector();
		int[] fitnessVector2 = o.getFitnessVector();
		for (int i = 0; i < numberOfHardConstraints; i++) {
			if (fitnessVector1[i] < fitnessVector2[i])
				return -1;
			if (fitnessVector1[i] > fitnessVector2[i])
				return 1;
		}
		int penaltySum1 = 0;
		int penaltySum2 = 0;
		for (int i = numberOfHardConstraints; i < fitnessVector1.length; i++) {
			penaltySum1 += fitnessVector1[i]
					* Math.pow(penaltyStep, fitnessVector1.length - i);
			penaltySum2 += fitnessVector2[i]
					* Math.pow(penaltyStep, fitnessVector1.length - i);
		}
		if (penaltySum1 < penaltySum2)
			return -1;
		if (penaltySum1 > penaltySum2)
			return 1;
		return 0;
	}

	public int getNumberOfHardConstraints() {
		return numberOfHardConstraints;
	}

	public boolean isAcceptable() {
		for (int i = 0; i < numberOfHardConstraints; i++)
			if (fitnessVector[i] > 0)
				return false;
		return true;
	}
	public int calculateProfitability() {
		int field[] = getFitnessVector();
		int base = 37;
		int ret = 0;
		for (int i = 0; i < numberOfHardConstraints; i++) {
			ret += field[i] * Math.pow(base, numberOfHardConstraints - i);
		}
		for (int i = numberOfHardConstraints; i < field.length; i++) {
			ret += field[i] * base * (i - numberOfHardConstraints);
		}
		this.profitability = ret;
		return ret;
	}
	public int getProfitability (){
		return this.profitability;
	}

	public static PopulationMemberBCO convertFromResult(ISchedulingResult result) {
		PopulationMemberBCO ret = new PopulationMemberBCO();
		List <PopulationMemberBCO> list = new ArrayList <PopulationMemberBCO> ();
		BCOScheduler.stageMap.put(ret, list);
		IPlan p = result.getPlan();
		ret.setPlan(p.getName());
		for(IEvent e:p.getPlanEvents()) {
			for(ITerm t:e.getTerms()) {
				TermBCO t1=new TermBCO(t.getId(),t.getName());
				ITimeParameter time = t.getDefinition().getTimeParameters().get(0);
				t1.setDateStamp(time.getFromDate());
				t1.setTimeSpan(new TimeSpan(time.getFromTime(), time.getToTime()));
				t1.setDuration(e.getTermDuration());
				ILocationParameter location = t.getDefinition().getLocationParameters().get(0);
				t1.setRoom(new RoomData(location.getId(), location.getName(), location.getActualCapacity()));
				ret.addTermToEvent(e.getId(), t1);
				for(String s:t.getDefinition().getIndividuals()){
					ret.addStudentToTerm(t1, s);
					PopulationMemberBCO mem = new PopulationMemberBCO();
					mem = (PopulationMemberBCO)ret.clone();
					list.add(mem);
				}
			}
		}
		return ret;
	}

}


text:
package converters;

import android.os.Parcel;
import android.os.Parcelable;

public class ValueField
implements Parcelable
{
	public static String FT_int = "Integer";
	public static String FT_string = "String";
	public static String FT_Object = "Object";
	public static String FT_unknown = "Unknown";

	//Add more field types later
	public String name;
	public String type;

	public ValueField(String inName, String inFieldType)
	{
		name = inName;
		type = inFieldType;
	}
    public static final Parcelable.Creator<ValueField> CREATOR
	    = new Parcelable.Creator<ValueField>() {
			public ValueField createFromParcel(Parcel in) {
			    return new ValueField(in);
			}

			public ValueField[] newArray(int size) {
			    return new ValueField[size];
			}
    }; //end of creator

	//
	@Override
	public int describeContents() {
		return 0;
	}

	public ValueField(Parcel in)
	{
		name = in.readString();
		type = in.readString();
	}
	@Override
	public void writeToParcel(Parcel dest, int flags)
	{
		dest.writeString(name);
		dest.writeString(type);
	}
	public String toString()
	{
		return name + "/" + type;
	}

	public static ValueField getStringField(String fieldName)
	{
		return new ValueField(fieldName, ValueField.FT_string);
	}
}//eof-class


text:
package br.uff.ic.dyevc.tools.vcs.git;

//~--- non-JDK imports --------------------------------------------------------

import br.uff.ic.dyevc.exception.VCSException;

import org.eclipse.jgit.lib.BranchConfig;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.filter.RevFilter;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.revwalk.RevWalkUtils;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;

import org.gitective.core.CommitFinder;
import org.gitective.core.CommitUtils;
import org.gitective.core.filter.commit.CommitListFilter;

//~--- JDK imports ------------------------------------------------------------

import java.io.IOException;

import java.net.URISyntaxException;

import java.util.ArrayList;
import java.util.List;

/**
 * Status between two remote branches in a temp repository
 */
public class WorkingRepositoryBranchStatus {
    /**
     * Compute the tracking status for the
     * branchName in
     * repository, regarding to its remote. Both refs for the tracked branch and for the remote are remote
     * refs, because this class works on working repositories that were cloned from a real repository.
     *
     * @param connector the git connector to repository's status that will be computed (this is the working repository)
     * @param branchName the branch to compute status. This is a local branch in the real repository, but in the working
     * repository it is also a remote branch.
     * @throws IOException
     */
    public static WorkingRepositoryBranchStatus of(GitConnector connector, String branchName)
            throws IOException, VCSException, URISyntaxException {

        String remoteName = connector.getRemoteForBranch(branchName);
        if (remoteName == null) {
            return null;
        }

        BranchConfig branchConfig            = new BranchConfig(connector.getRepository().getConfig(), branchName);

        String       trackingBranchRefString = branchConfig.getTrackingBranch();
        if (trackingBranchRefString == null) {
            return null;
        }

        Ref tracking = connector.getRepository().getRef(trackingBranchRefString);
        if (tracking == null) {
            return null;
        }

        String trackingBranchName   = trackingBranchRefString.substring(trackingBranchRefString.lastIndexOf("/") + 1);

        String localBranchRefString = trackingBranchRefString.replace(trackingBranchName, branchName);
        localBranchRefString = localBranchRefString.replace(GitConnector.REFS_REMOTES + remoteName,
                GitConnector.REFS_REMOTES + connector.getId());

        Ref local = connector.getRepository().getRef(localBranchRefString);
        if (local == null) {
            return null;
        }

        RevWalk   walk           = new RevWalk(connector.getRepository());

        RevCommit localCommit    = walk.parseCommit(local.getObjectId());
        RevCommit trackingCommit = walk.parseCommit(tracking.getObjectId());

        walk.setRevFilter(RevFilter.MERGE_BASE);
        walk.markStart(localCommit);
        walk.markStart(trackingCommit);
        RevCommit mergeBase = walk.next();

        walk.reset();
        walk.setRevFilter(RevFilter.ALL);
        final int aheadCount  = RevWalkUtils.count(walk, localCommit, mergeBase);
        final int behindCount = RevWalkUtils.count(walk, trackingCommit, mergeBase);

        /* Finding list of commits ahead */
        CommitFinder     finder  = new CommitFinder(connector.getRepository());
        CommitListFilter commits = new CommitListFilter();
        finder.setFilter(RevFilter.ALL);
        finder.setFilter(commits).findBetween(localCommit.getId(), mergeBase.getId());
        List<String> listAheadCommitIds = new ArrayList<String>();
        for (RevCommit commit : commits.getCommits()) {
            listAheadCommitIds.add(commit.getName());
        }

        /* Finding list of commits behind */
        commits.reset();
        finder.setFilter(commits).findBetween(trackingCommit.getId(), mergeBase.getId());
        List<String> listBehindCommitIds = new ArrayList<String>();
        for (RevCommit commit : commits.getCommits()) {
            listBehindCommitIds.add(commit.getName());
        }

        RemoteConfig cfg      = new RemoteConfig(connector.getRepository().getConfig(), remoteName);

        List<URIish> pushURIs = cfg.getPushURIs();
        List<URIish> pullURIs = cfg.getURIs();

        return new WorkingRepositoryBranchStatus(trackingBranchRefString, aheadCount, behindCount, listAheadCommitIds,
                listBehindCommitIds, pushURIs, pullURIs);
    }

    private final String       trackingBranch;
    private final int          aheadCount;
    private final int          behindCount;
    private final List<String> listAheadCommitIds;
    private final List<String> listBehindCommitIds;
    private final List<URIish> pushURIs;
    private final List<URIish> pullURIs;

    /**
     * Constructs a new WorkingRepositoryBranchStatus object
     *
     * @param trackingBranch
     * @param aheadCount
     * @param behindCount
     */
    private WorkingRepositoryBranchStatus(String trackingBranch, int aheadCount, int behindCount,
            List<String> aheadCommits, List<String> behindCommits, List<URIish> pushURIs, List<URIish> pullURIs) {
        this.trackingBranch      = trackingBranch;
        this.aheadCount          = aheadCount;
        this.behindCount         = behindCount;
        this.listAheadCommitIds  = aheadCommits;
        this.listBehindCommitIds = behindCommits;
        this.pushURIs            = pushURIs;
        this.pullURIs            = pullURIs;
    }

    /**
     * @return full tracking branch name
     */
    public String getTrackingBranch() {
        return trackingBranch;
    }

    /**
     * @return number of commits that the local branch is ahead of the tracking branch
     */
    public int getAheadCount() {
        return aheadCount;
    }

    /**
     * @return number of commits that the local branch is behind of the tracking branch
     */
    public int getBehindCount() {
        return behindCount;
    }

    /**
     * @return the list of commits that the local branch is ahead of the tracking branch
     */
    public List<String> getListAheadCommitIds() {
        return listAheadCommitIds;
    }

    /**
     * @return the list of commits that the local branch is behind of the tracking branch
     */
    public List<String> getListBehindCommitIds() {
        return listBehindCommitIds;
    }

    public List<URIish> getPushURIs() {
        return pushURIs;
    }

    public List<URIish> getPullURIs() {
        return pullURIs;
    }
}


text:
namespace ofxCv {

	struct CompareContourArea
	{
		CompareContourArea(const std::vector<double>& areaVec)
		: mAreaVec(areaVec) {}

		// Sort contour indices into decreasing order, based on a vector of
		// contour areas.  Later, we will use these indices to order the
		// contours (which are stored in a separate vector).
		bool operator()(size_t a, size_t b) const
		{
			return mAreaVec[a] > mAreaVec[b];
		}

		const std::vector<double>& mAreaVec;
	};

	using namespace cv;

	ContourFinder::ContourFinder()
	:autoThreshold(true)
	,invert(false)
	,simplify(true)
	,thresholdValue(128.)
	,useTargetColor(false)
	,contourFindingMode(CV_RETR_EXTERNAL)
	,sortBySize(false) {
		resetMinArea();
		resetMaxArea();
	}

	void ContourFinder::findContours(Mat img) {
		// threshold the image using a tracked color or just binary grayscale
		if(useTargetColor) {
			Scalar offset(thresholdValue, thresholdValue, thresholdValue);
			Scalar base = toCv(targetColor);
			if(trackingColorMode == TRACK_COLOR_RGB) {
				inRange(img, base - offset, base + offset, thresh);
			} else {
                // all the HSV modes are broken incorrect,
                // because opencv uses hue 0-180 not 0-255
                // which means that the math doesn't wrap.
				if(trackingColorMode == TRACK_COLOR_H) {
					offset[1] = 255;
					offset[2] = 255;
				}
				if(trackingColorMode == TRACK_COLOR_HS) {
					offset[2] = 255;
				}
				cvtColor(img, hsvBuffer, CV_RGB2HSV);
				base = toCv(convertColor(targetColor, CV_RGB2HSV));
				Scalar lowerb = base - offset;
				Scalar upperb = base + offset;
				inRange(hsvBuffer, lowerb, upperb, thresh);
			}
		} else {
            copyGray(img, thresh);
		}
		if(autoThreshold) {
			threshold(thresh, thresholdValue, invert);
		}

		// run the contour finder
		vector<vector<cv::Point> > allContours;
		int simplifyMode = simplify ? CV_CHAIN_APPROX_SIMPLE : CV_CHAIN_APPROX_NONE;
		cv::findContours(thresh, allContours, contourFindingMode, simplifyMode);

		// filter the contours
		bool needMinFilter = (minArea > 0);
		bool needMaxFilter = maxAreaNorm ? (maxArea < 1) : (maxArea < numeric_limits<float>::infinity());
		vector<size_t> allIndices;
		vector<double> allAreas;
        vector<bool> allHoles;
		if(needMinFilter || needMaxFilter) {
			double imgArea = img.rows * img.cols;
			double imgMinArea = minAreaNorm ? (minArea * imgArea) : minArea;
			double imgMaxArea = maxAreaNorm ? (maxArea * imgArea) : maxArea;
			for(size_t i = 0; i < allContours.size(); i++) {
				double curArea = contourArea(Mat(allContours[i]), true);
                bool hole = true;
                if(curArea < 0) {
                    curArea = -curArea;
                    hole = false;
                }

				if((!needMinFilter || curArea >= imgMinArea) &&
					 (!needMaxFilter || curArea <= imgMaxArea)) {
					allIndices.push_back(i);
                    allHoles.push_back(hole);
                    allAreas.push_back(curArea);
				}
			}
		} else {
			for(size_t i = 0; i < allContours.size(); i++) {
                double curArea = contourArea(Mat(allContours[i]), true);
                allAreas.push_back(abs(curArea));
                allHoles.push_back(curArea > 0);
				allIndices.push_back(i);
			}
		}

		if (allIndices.size() > 1 && sortBySize) {
			// Sort contour indices, based on a separate vector of areas.
			std::sort(allIndices.begin(), allIndices.end(), CompareContourArea(allAreas));
		}

		// generate polylines and bounding boxes from the contours
		contours.clear();
		polylines.clear();
        boundingRects.clear();
        holes.clear();
		for(size_t i = 0; i < allIndices.size(); i++) {
			contours.push_back(allContours[allIndices[i]]);
			polylines.push_back(toOf(contours[i]));
			boundingRects.push_back(boundingRect(contours[i]));
            holes.push_back(allHoles[allIndices[i]]);
		}

		// track bounding boxes
		tracker.track(boundingRects);
	}

	void ContourFinder::setFindHoles(bool findHoles){
		if(findHoles){
			contourFindingMode = CV_RETR_LIST;
		}else{
			contourFindingMode = CV_RETR_EXTERNAL;
		}
	}

	void ContourFinder::setSortBySize(bool sizeSort) {
		sortBySize = sizeSort;
	}

	const vector<vector<cv::Point> >& ContourFinder::getContours() const {
		return contours;
	}

	const vector<ofPolyline>& ContourFinder::getPolylines() const {
		return polylines;
	}

	const vector<cv::Rect>& ContourFinder::getBoundingRects() const {
		return boundingRects;
	}

	unsigned int ContourFinder::size() const {
		return contours.size();
	}

	vector<cv::Point>& ContourFinder::getContour(unsigned int i) {
		return contours[i];
	}

	ofPolyline& ContourFinder::getPolyline(unsigned int i) {
		return polylines[i];
	}

	cv::Rect ContourFinder::getBoundingRect(unsigned int i) const {
		return boundingRects[i];
	}

	cv::Point2f ContourFinder::getCenter(unsigned int i) const {
		cv::Rect box = getBoundingRect(i);
		return cv::Point2f(box.x + box.width / 2, box.y + box.height / 2);
	}

	cv::Point2f ContourFinder::getCentroid(unsigned int i) const {
		Moments m = moments(contours[i]);
		if(m.m00!=0){
			return cv::Point2f(m.m10 / m.m00, m.m01 / m.m00);
		}else{
			return cv::Point2f(0, 0);
		}
	}

	cv::Point2f ContourFinder::getAverage(unsigned int i) const {
		Scalar average = mean(contours[i]);
		return cv::Point2f(average[0], average[1]);
	}

	cv::Vec2f ContourFinder::getBalance(unsigned int i) const {
		return cv::Vec2f(getCentroid(i) - getCenter(i));
	}

	double ContourFinder::getContourArea(unsigned int i) const {
		return contourArea(contours[i]);
	}

	double ContourFinder::getArcLength(unsigned int i) const {
		return arcLength(contours[i], true);
	}

	vector<cv::Point> ContourFinder::getConvexHull(unsigned int i) const {
		vector<cv::Point> hull;
		convexHull(contours[i], hull);
		return hull;
	}

	vector<cv::Vec4i> ContourFinder::getConvexityDefects(unsigned int i) const {
		return convexityDefects(contours[i]);
	}

	cv::RotatedRect ContourFinder::getMinAreaRect(unsigned int i) const {
		return minAreaRect(contours[i]);
	}

	cv::Point2f ContourFinder::getMinEnclosingCircle(unsigned int i, float& radius) const {
		cv::Point2f center;
		minEnclosingCircle(contours[i], center, radius);
		return center;
	}

	cv::RotatedRect ContourFinder::getFitEllipse(unsigned int i) const {
		if(contours[i].size() < 5) {
			return getMinAreaRect(i);
		}
		return fitEllipse(contours[i]);
	}

	vector<cv::Point> ContourFinder::getFitQuad(unsigned int i) const {
		vector<cv::Point> convexHull = getConvexHull(i);
		vector<cv::Point> quad = convexHull;

		static const unsigned int targetPoints = 4;
		static const unsigned int maxIterations = 16;
		static const double infinity = numeric_limits<double>::infinity();
		double minEpsilon = 0;
		double maxEpsilon = infinity;
		double curEpsilon = 16; // good initial guess

		// unbounded binary search to simplify the convex hull until it's 4 points
		if(quad.size() > 4) {
			for(int i = 0; i <(int) maxIterations; i++) {
				approxPolyDP(Mat(convexHull), quad, curEpsilon, true);
				if(quad.size() == targetPoints) {
					break;
				}
				if(quad.size() > targetPoints) {
					minEpsilon = curEpsilon;
					if(maxEpsilon == infinity) {
						curEpsilon = curEpsilon *  2;
					} else {
						curEpsilon = (maxEpsilon + minEpsilon) / 2;
					}
				}
				if(quad.size() < targetPoints) {
					maxEpsilon = curEpsilon;
					curEpsilon = (maxEpsilon + minEpsilon) / 2;
				}
			}
		}

		return quad;
    }

    bool ContourFinder::getHole(unsigned int i) const {
        return holes[i];
    }

	cv::Vec2f ContourFinder::getVelocity(unsigned int i) const {
		return tracker.getVelocity(i);
	}

	unsigned int ContourFinder::getLabel(unsigned int i) const {
		return tracker.getCurrentLabels()[i];
	}

	RectTracker& ContourFinder::getTracker() {
		return tracker;
	}

	void ContourFinder::setAutoThreshold(bool autoThreshold) {
		this->autoThreshold = autoThreshold;
	}

	void ContourFinder::setThreshold(float thresholdValue) {
		this->thresholdValue = thresholdValue;
	}

	void ContourFinder::setInvert(bool invert) {
		this->invert = invert;
	}

    void ContourFinder::setUseTargetColor(bool useTargetColor) {
        this->useTargetColor = useTargetColor;
    }

	void ContourFinder::setTargetColor(ofColor targetColor, TrackingColorMode trackingColorMode) {
		useTargetColor = true;
		this->targetColor = targetColor;
		this->trackingColorMode = trackingColorMode;
	}

	void ContourFinder::setSimplify(bool simplify) {
		this->simplify = simplify;
	}

	void ContourFinder::draw() const {
		ofPushStyle();
		ofNoFill();
        for(std::size_t i = 0; i < polylines.size(); i++) {
			polylines[i].draw();
			ofDrawRectangle(toOf(getBoundingRect(i)));
		}
		ofPopStyle();
	}

	void ContourFinder::resetMinArea() {
		setMinArea(0);
	}

	void ContourFinder::resetMaxArea() {
		setMaxArea(numeric_limits<float>::infinity());
	}

	void ContourFinder::setMinArea(float minArea) {
		this->minArea = minArea;
		minAreaNorm = false;
	}

	void ContourFinder::setMaxArea(float maxArea) {
		this->maxArea = maxArea;
		maxAreaNorm = false;
	}

	void ContourFinder::setMinAreaRadius(float minAreaRadius) {
		minArea = PI * minAreaRadius * minAreaRadius;
		minAreaNorm = false;
	}

	void ContourFinder::setMaxAreaRadius(float maxAreaRadius) {
		maxArea = PI * maxAreaRadius * maxAreaRadius;
		maxAreaNorm = false;
	}

	void ContourFinder::setMinAreaNorm(float minAreaNorm) {
		minArea = minAreaNorm;
		this->minAreaNorm = true;
	}

	void ContourFinder::setMaxAreaNorm(float maxAreaNorm) {
		maxArea = maxAreaNorm;
		this->maxAreaNorm = true;
	}

}