text:
namespace {

gfx::ImageSkia CreateTestImage(int width, int height) {
  SkBitmap bitmap;
  bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
  bitmap.allocPixels();
  return gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
}

}  // namespace

namespace views {

typedef ViewsTestBase LabelButtonTest;

TEST_F(LabelButtonTest, Init) {
  const string16 text(ASCIIToUTF16("abc"));
  LabelButton button(NULL, text);

  EXPECT_TRUE(button.GetImage(Button::STATE_NORMAL).isNull());
  EXPECT_TRUE(button.GetImage(Button::STATE_HOVERED).isNull());
  EXPECT_TRUE(button.GetImage(Button::STATE_PRESSED).isNull());
  EXPECT_TRUE(button.GetImage(Button::STATE_DISABLED).isNull());

  EXPECT_EQ(text, button.GetText());
  EXPECT_EQ(gfx::ALIGN_LEFT, button.GetHorizontalAlignment());
  EXPECT_FALSE(button.is_default());
  EXPECT_EQ(button.style(), Button::STYLE_TEXTBUTTON);
  EXPECT_EQ(Button::STATE_NORMAL, button.state());

  EXPECT_EQ(button.image_->parent(), &button);
  EXPECT_EQ(button.label_->parent(), &button);
}

TEST_F(LabelButtonTest, Label) {
  LabelButton button(NULL, string16());
  EXPECT_TRUE(button.GetText().empty());

  const gfx::Font font;
  const string16 short_text(ASCIIToUTF16("abcdefghijklm"));
  const string16 long_text(ASCIIToUTF16("abcdefghijklmnopqrstuvwxyz"));
  const int short_text_width = gfx::Canvas::GetStringWidth(short_text, font);
  const int long_text_width = gfx::Canvas::GetStringWidth(long_text, font);

  // The width increases monotonically with string size (it does not shrink).
  EXPECT_LT(button.GetPreferredSize().width(), short_text_width);
  button.SetText(short_text);
  EXPECT_GT(button.GetPreferredSize().height(), font.GetHeight());
  EXPECT_GT(button.GetPreferredSize().width(), short_text_width);
  EXPECT_LT(button.GetPreferredSize().width(), long_text_width);
  button.SetText(long_text);
  EXPECT_GT(button.GetPreferredSize().width(), long_text_width);
  button.SetText(short_text);
  EXPECT_GT(button.GetPreferredSize().width(), long_text_width);

  // Clamp the size to a maximum value.
  button.set_max_size(gfx::Size(long_text_width, 1));
  EXPECT_EQ(button.GetPreferredSize(), gfx::Size(long_text_width, 1));

  // Clear the monotonically increasing minimum size.
  button.set_min_size(gfx::Size());
  EXPECT_GT(button.GetPreferredSize().width(), short_text_width);
  EXPECT_LT(button.GetPreferredSize().width(), long_text_width);
}

TEST_F(LabelButtonTest, Image) {
  LabelButton button(NULL, string16());

  const int small_size = 50, large_size = 100;
  const gfx::ImageSkia small_image = CreateTestImage(small_size, small_size);
  const gfx::ImageSkia large_image = CreateTestImage(large_size, large_size);

  // The width increases monotonically with image size (it does not shrink).
  EXPECT_LT(button.GetPreferredSize().width(), small_size);
  EXPECT_LT(button.GetPreferredSize().height(), small_size);
  button.SetImage(Button::STATE_NORMAL, small_image);
  EXPECT_GT(button.GetPreferredSize().width(), small_size);
  EXPECT_GT(button.GetPreferredSize().height(), small_size);
  EXPECT_LT(button.GetPreferredSize().width(), large_size);
  EXPECT_LT(button.GetPreferredSize().height(), large_size);
  button.SetImage(Button::STATE_NORMAL, large_image);
  EXPECT_GT(button.GetPreferredSize().width(), large_size);
  EXPECT_GT(button.GetPreferredSize().height(), large_size);
  button.SetImage(Button::STATE_NORMAL, small_image);
  EXPECT_GT(button.GetPreferredSize().width(), large_size);
  EXPECT_GT(button.GetPreferredSize().height(), large_size);

  // Clamp the size to a maximum value.
  button.set_max_size(gfx::Size(large_size, 1));
  EXPECT_EQ(button.GetPreferredSize(), gfx::Size(large_size, 1));

  // Clear the monotonically increasing minimum size.
  button.set_min_size(gfx::Size());
  EXPECT_GT(button.GetPreferredSize().width(), small_size);
  EXPECT_LT(button.GetPreferredSize().width(), large_size);
}

TEST_F(LabelButtonTest, LabelAndImage) {
  LabelButton button(NULL, string16());

  const gfx::Font font;
  const string16 text(ASCIIToUTF16("abcdefghijklm"));
  const int text_width = gfx::Canvas::GetStringWidth(text, font);

  const int image_size = 50;
  const gfx::ImageSkia image = CreateTestImage(image_size, image_size);
  ASSERT_LT(font.GetHeight(), image_size);

  // The width increases monotonically with content size (it does not shrink).
  EXPECT_LT(button.GetPreferredSize().width(), text_width);
  EXPECT_LT(button.GetPreferredSize().width(), image_size);
  EXPECT_LT(button.GetPreferredSize().height(), image_size);
  button.SetText(text);
  EXPECT_GT(button.GetPreferredSize().width(), text_width);
  EXPECT_GT(button.GetPreferredSize().height(), font.GetHeight());
  EXPECT_LT(button.GetPreferredSize().width(), text_width + image_size);
  EXPECT_LT(button.GetPreferredSize().height(), image_size);
  button.SetImage(Button::STATE_NORMAL, image);
  EXPECT_GT(button.GetPreferredSize().width(), text_width + image_size);
  EXPECT_GT(button.GetPreferredSize().height(), image_size);

  // Layout and ensure the image is left of the label except for ALIGN_RIGHT.
  // (A proper parent view or layout manager would Layout on its invalidations).
  button.SetSize(button.GetPreferredSize());
  button.Layout();
  EXPECT_EQ(gfx::ALIGN_LEFT, button.GetHorizontalAlignment());
  EXPECT_LT(button.image_->bounds().right(), button.label_->bounds().x());
  button.SetHorizontalAlignment(gfx::ALIGN_CENTER);
  button.Layout();
  EXPECT_EQ(gfx::ALIGN_CENTER, button.GetHorizontalAlignment());
  EXPECT_LT(button.image_->bounds().right(), button.label_->bounds().x());
  button.SetHorizontalAlignment(gfx::ALIGN_RIGHT);
  button.Layout();
  EXPECT_EQ(gfx::ALIGN_RIGHT, button.GetHorizontalAlignment());
  EXPECT_LT(button.label_->bounds().right(), button.image_->bounds().x());

  button.SetText(string16());
  EXPECT_GT(button.GetPreferredSize().width(), text_width + image_size);
  EXPECT_GT(button.GetPreferredSize().height(), image_size);
  button.SetImage(Button::STATE_NORMAL, gfx::ImageSkia());
  EXPECT_GT(button.GetPreferredSize().width(), text_width + image_size);
  EXPECT_GT(button.GetPreferredSize().height(), image_size);

  // Clamp the size to a maximum value.
  button.set_max_size(gfx::Size(image_size, 1));
  EXPECT_EQ(button.GetPreferredSize(), gfx::Size(image_size, 1));

  // Clear the monotonically increasing minimum size.
  button.set_min_size(gfx::Size());
  EXPECT_LT(button.GetPreferredSize().width(), text_width);
  EXPECT_LT(button.GetPreferredSize().width(), image_size);
  EXPECT_LT(button.GetPreferredSize().height(), image_size);
}

TEST_F(LabelButtonTest, Font) {
  const string16 text(ASCIIToUTF16("abc"));
  LabelButton button(NULL, text);

  const gfx::Font original_font = button.GetFont();
  const gfx::Font large_font = original_font.DeriveFont(100);
  const int original_width = button.GetPreferredSize().width();
  const int original_height = button.GetPreferredSize().height();

  // The button size increases when the font size is increased.
  button.SetFont(large_font);
  EXPECT_GT(button.GetPreferredSize().width(), original_width);
  EXPECT_GT(button.GetPreferredSize().height(), original_height);

  // The button returns to its original size when the minimal size is cleared
  // and the original font size is restored.
  button.set_min_size(gfx::Size());
  button.SetFont(original_font);
  EXPECT_EQ(original_width, button.GetPreferredSize().width());
  EXPECT_EQ(original_height, button.GetPreferredSize().height());
}

}  // namespace views


text:
package co.adun.mvnejb3jpa.persistence.eao;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import co.adun.mvnejb3jpa.persistence.entity.LtAssociatedSubject;

@Transactional
@Component

public interface LtAssociatedSubjectEao extends BaseEao<LtAssociatedSubject>{

}

redpajama_set_name: RedPajamaGithub


text:
#pragma once

#include <string>

#include "mongo/logger/log_severity.h"

namespace mongo {
namespace logger {

    /**
     * Deprecated utility for associating a string and log level together.
     */
    class LabeledLevel {
    public:
        LabeledLevel( int level ) : _level( level ) {}
        LabeledLevel( const char* label, int level ) : _label( label ), _level( level ) {}
        LabeledLevel( const std::string& label, int level ) : _label( label ), _level( level ) {}

        LabeledLevel operator+( int i ) const {
            return LabeledLevel( _label, _level + i );
        }

        LabeledLevel operator-( int i ) const {
            return LabeledLevel( _label, _level - i );
        }

        const std::string& getLabel() const { return _label; }
        int getLevel() const { return _level; }

        operator LogSeverity () const { return logger::LogSeverity::cast(_level); }

    private:
        std::string _label;
        int _level;
    };

    inline bool operator<( const LabeledLevel& ll, const int i ) { return ll.getLevel() < i; }
    inline bool operator<( const int i, const LabeledLevel& ll ) { return i < ll.getLevel(); }
    inline bool operator>( const LabeledLevel& ll, const int i ) { return ll.getLevel() > i; }
    inline bool operator>( const int i, const LabeledLevel& ll ) { return i > ll.getLevel(); }
    inline bool operator<=( const LabeledLevel& ll, const int i ) { return ll.getLevel() <= i; }
    inline bool operator<=( const int i, const LabeledLevel& ll ) { return i <= ll.getLevel(); }
    inline bool operator>=( const LabeledLevel& ll, const int i ) { return ll.getLevel() >= i; }
    inline bool operator>=( const int i, const LabeledLevel& ll ) { return i >= ll.getLevel(); }
    inline bool operator==( const LabeledLevel& ll, const int i ) { return ll.getLevel() == i; }
    inline bool operator==( const int i, const LabeledLevel& ll ) { return i == ll.getLevel(); }

}  // namespace logger
}  // namespace mongo


text:
require 'whois/record/parser/base'
require 'whois/record/scanners/whois.fi.rb'

module Whois
  class Record
    class Parser

      # Parser for the whois.fi server.
      #
      # @see Whois::Record::Parser::Example
      #   The Example parser for the list of all available methods.
      #
      class WhoisFi < Base
        include Scanners::Scannable

        self.scanner = Scanners::WhoisFi

        property_supported :disclaimer do
          node("field:disclaimer")
        end

        property_supported :domain do
          node("domain")
        end

        property_not_supported :domain_id

        property_supported :status do
          if registered?
            case node("status", &:downcase)
            when "granted"
              :registered
            when "grace period"
              :registered
            else
              Whois.bug!(ParserError, "Unknown status `#{node("status")}'.")
            end
          else
            :available
          end
        end

        property_supported :available? do
          !!node("status:available")
        end

        property_supported :registered? do
          !available?
        end

        property_supported :created_on do
          node("created") { |value| Time.parse(value) }
        end

        property_supported :updated_on do
          node("modified") { |value| Time.parse(value) }
        end

        property_supported :expires_on do
          node("expires") { |value| Time.parse(value) }
        end

        property_not_supported :registrar

        property_supported :registrant_contacts do
          node("descr") do |array|
            address = node("address")

            Record::Contact.new(
              type:         Record::Contact::TYPE_REGISTRANT,
              id:           array[1],
              name:         address[0],
              organization: array[0],
              address:      address[1],
              zip:          address[2],
              city:         address[3],
              phone:        node("phone")
            )
          end
        end

        property_not_supported :admin_contacts

        property_not_supported :technical_contacts

        property_supported :nameservers do
          Array.wrap(node("nserver")).map do |line|
            Record::Nameserver.new(name: line.split(" ").first)
          end
        end

      end

    end
  end
end


text:
@class FullscreenToolbarController;

// This class provides a controller that manages the fullscreen toolbar's
// animation.
class FullscreenToolbarAnimationController : public gfx::AnimationDelegate {
 public:
  explicit FullscreenToolbarAnimationController(
      FullscreenToolbarController* owner);

  // Called by |owner_| when the fullscreen toolbar layout is updated.
  void ToolbarDidUpdate();

  // Stops the animation and cancels |hide_toolbar_timer_|.
  void StopAnimationAndTimer();

  // Animates the toolbar in and out to show changes with the tabstrip.
  void AnimateToolbarForTabstripChanges();

  // Animates the toolbar in if it's not fully shown.
  void AnimateToolbarIn();

  // Animates the toolbar out if it's not focused.
  void AnimateToolbarOutIfPossible();

  // Returns the fraction of the toolbar exposed at the top according to the
  // animation's progress.
  CGFloat GetToolbarFractionFromProgress() const;

  // Returns true if |animation_| is running.
  bool IsAnimationRunning() const;

  // gfx::AnimationDelegate:
  void AnimationProgressed(const gfx::Animation* animation) override;
  void AnimationEnded(const gfx::Animation* animation) override;

 private:
  // Our owner.
  FullscreenToolbarController* owner_;  // weak

  // The animation of the decoration.
  gfx::SlideAnimation animation_;

  // Timer that will start the scrollbar's hiding animation when it reaches 0.
  base::Timer hide_toolbar_timer_;

  // The value that the animation should start from.
  CGFloat animation_start_value_;

  // True when the toolbar is dropped to show tabstrip changes.
  BOOL should_hide_toolbar_after_delay_;
};

#endif  // CHROME_BROWSER_UI_COCOA_FULLSCREEN_FULLSCREEN_TOOLBAR_ANIMATION_CONTROLLER_H_


text:
package org.deri.iris.terms;

import org.deri.iris.api.terms.ITerm;
import org.deri.iris.api.terms.IVariable;

/**
 *

 * Simple implementation of the IVariable.
 *

 *

 * $Id$
 *

 * @author Richard Pöttler (richard dot poettler at deri dot at)
 * @version $Revision$
 */
public class Variable implements IVariable {

	private String name = "";

	Variable(final String name) {
		this.name = name;
	}

	@Override
	public boolean isGround() {
		return false;
	}

	@Override
	public int compareTo(final ITerm o) {
		if (o == null)
			return 1;

		if (!(o instanceof IVariable))
			return 1;

		final Variable v = (Variable) o;

		return name.compareTo(v.getValue());
	}

	@Override
	public int hashCode() {
		return name.hashCode();
	}

	@Override
	public boolean equals(final Object o) {
		if (!(o instanceof Variable))
			return false;
		final Variable v = (Variable) o;
		return name.equals(v.name);
	}

	/**
	 * Returns a String representation of this object. The subject of the string format is to change. An example return
	 * value might be "?date"
	 * @return the String representation
	 */
	@Override
	public String toString() {
		return "?" + name;
	}

	@Override
	public String getValue() {
		return name;
	}
}


text:
#include "CCPUMeshSurfaceEmitterTranslator.h"
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
#include "extensions/Particle3D/PU/CCPUDynamicAttribute.h"
#include "extensions/Particle3D/PU/CCPUDynamicAttributeTranslator.h"

NS_CC_BEGIN

PUMeshSurfaceEmitterTranslator::PUMeshSurfaceEmitterTranslator()
{
}
//-------------------------------------------------------------------------
bool PUMeshSurfaceEmitterTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node )
{
    PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node);
    PUEmitter* em = static_cast<PUEmitter*>(prop->parent->context);
    PUMeshSurfaceEmitter* emitter = static_cast<PUMeshSurfaceEmitter*>(em);

    if (prop->name == token[TOKEN_MESH_NAME])
    {
        // Property: mesh_name
        if (passValidateProperty(compiler, prop, token[TOKEN_MESH_NAME], VAL_STRING))
        {
            std::string val;
            if(getString(*prop->values.front(), &val))
            {
                emitter->setMeshName(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_MESH_SURFACE_NAME])
    {
        // Property: mesh_surface_mesh_name (deprecated and replaced by mesh_name)
        if (passValidateProperty(compiler, prop, token[TOKEN_MESH_SURFACE_NAME], VAL_STRING))
        {
            std::string val;
            if(getString(*prop->values.front(), &val))
            {
                emitter->setMeshName(val);
                return true;
            }
        }
    }
    else if (prop->name == token[TOKEN_MESH_SURFACE_DISTRIBUTION])
    {
        // Property: mesh_surface_distribution
        if (passValidateProperty(compiler, prop, token[TOKEN_MESH_SURFACE_DISTRIBUTION], VAL_STRING))
        {
            std::string val;
            if(getString(*prop->values.front(), &val))
            {
                if (val == token[TOKEN_MESH_SURFACE_EDGE])
                {
                    emitter->setDistribution(MeshInfo::MSD_EDGE);
                    return true;
                }
                else if (val == token[TOKEN_MESH_SURFACE_HETEROGENEOUS_1])
                {
                    emitter->setDistribution(MeshInfo::MSD_HETEROGENEOUS_1);
                    return true;
                }
                else if (val == token[TOKEN_MESH_SURFACE_HETEROGENEOUS_2])
                {
                    emitter->setDistribution(MeshInfo::MSD_HETEROGENEOUS_2);
                    return true;
                }
                else if (val == token[TOKEN_MESH_SURFACE_HOMOGENEOUS])
                {
                    emitter->setDistribution(MeshInfo::MSD_HOMOGENEOUS);
                    return true;
                }
            }
        }
    }
    else if (prop->name == token[TOKEN_MESH_SURFACE_MESH_SCALE])
    {
        // Property: mesh_surface_scale
        if (passValidateProperty(compiler, prop, token[TOKEN_MESH_SURFACE_MESH_SCALE], VAL_VECTOR3))
        {
            Vec3 val;
            if(getVector3(prop->values.begin(), prop->values.end(), &val))
            {
                emitter->setScale(val);
                return true;
            }
        }
    }

    return false;
}

bool PUMeshSurfaceEmitterTranslator::translateChildObject( PUScriptCompiler* /*compiler*/, PUAbstractNode* /*node*/ )
{
    // No objects
    return false;
}

NS_CC_END


text:
#include <clock.h>
#include <mips32s.h>
#include <trap.h>
#include <stdio.h>
#include <picirq.h>

#define TIMER_DELTA     0x100000

volatile size_t ticks;

long SYSTEM_READ_TIMER( void ){
    return ticks;
}

/* *
 * clock_init - initialize MIPS timer to interrupt,
 * and then enable IRQ_TIMER.
 * */
void
clock_init(void) {
    // set MIPS timer, function name is a little confusing
    // clock_intr();

    // initialize time counter 'ticks' to zero
    ticks = 0;

    cprintf("++ setup timer interrupts\n");
    pic_enable(IRQ_TIMER);
}

void
clock_intr(void) {
    mtc0(CP0_Compare, 0x00020000);
    // uint32_t count = mfc0(CP0_Count);
    // mtc0(CP0_Compare, count + TIMER_DELTA);
}


text:
<!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />

<META http-equiv="Content-Type" content="text/html; charset=utf-8">

<link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.10.custom.css" type="text/css" media="all" />

<LINK href="css/screen.css" rel="stylesheet" type="text/css" media="screen">
<LINK href="css/print.css" rel="stylesheet" type="text/css" media="print">

<title>Mets viewer</title>

Selaimesi ei tue canvas -elementtiä. Osa ominaisuuksista eivät ole käytössä. Paremmin tuettuja selaimia: IE9, Firefox, Chrome, Safari
X

		<canvas id="viewer" height="800" width="800">
Selaimesi ei tue canvas -elementtiä.
</canvas>

		Sisällysluettelo

Metadata


text:
//
//  QYProfileController.m
//  约吧
//
//  Created by 青云-wjl on 16/5/15.
//  Copyright © 2016年 云菲. All rights reserved.
//

#import "QYProfileController.h"
#import "QLProfileInfo.h"
#import "QYProfileSectionModel.h"
#import "QYAccountInfoEntranceCell.h"
#import "QYSingleSelectionCell.h"
#import "QYMultipleSelectionCell.h"
#import "QYScrollPhotoView.h"
@interface QYProfileController ()
{
    QLProfileInfo *_profileInfo;
    NSArray *_images;
    CGRect _bgViewFrame;
    UIImageView *_currentDisplayPhoto;
}
@end

@implementation QYProfileController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self loadDefaultSetting];
}

/** Load the default UI elements And prepare some datas needed. */
- (void)loadDefaultSetting {
    _profileInfo = [QLProfileInfo profileInfoExceptEmpty];

    self.tableView.estimatedRowHeight = 80;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return _profileInfo.arrProfileInfos.count + 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section == 0) {
        return 1;
    }
    QYProfileSectionModel *sectionModel = _profileInfo.arrProfileInfos[section - 1];
    return sectionModel.celldatas.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) { //个人信息修改入口
        QYAccountInfoEntranceCell *cell = [QYAccountInfoEntranceCell cellWithTableView:tableView];
        cell.accessoryType = UITableViewCellAccessoryNone;
        return cell;
    } else{
        QYProfileSectionModel *sectionModel = _profileInfo.arrProfileInfos[indexPath.section - 1];

        if([sectionModel.sectionheader isEqualToString:@"我的信息"] || [sectionModel.sectionheader isEqualToString:@"我的社交账号"]){
            QYSingleSelectionCell *cell = [QYSingleSelectionCell singleSelectionCellForTableView:tableView forIndexPath:indexPath];
            cell.accessoryType = UITableViewCellAccessoryNone;
            cell.cellModel = sectionModel.celldatas[indexPath.row];
            return cell;
        }else if ([sectionModel.sectionheader isEqualToString:@"我的标签"] || [sectionModel.sectionheader isEqualToString:@"我的兴趣"]) {
            QYMultipleSelectionCell *cell = [QYMultipleSelectionCell multipleSelectionCellForTableView:tableView forIndexPath:indexPath];
            cell.accessoryType = UITableViewCellAccessoryNone;
            cell.cellModel = sectionModel.celldatas[indexPath.row];
            return cell;
        }else {
            NSAssert(0 > 1, @"数据错误, 请检查");
            return nil;
        }
    }
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    if (section == 0) {
        return nil;
    }
    QYProfileSectionModel *sectionModel = _profileInfo.arrProfileInfos[section - 1];
    return sectionModel.sectionheader;
}

#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    UIViewController *destinationVC = segue.destinationViewController;
    __weak QYProfileController *weakProfileVC = self;
    void (^didBackFromEditProfile)(NSArray *photos) = ^(NSArray *photos){
        [weakProfileVC updateUI:photos];
    };
    [destinationVC setValue:didBackFromEditProfile forKey:@"didEditProfile"];
    [destinationVC setValue:_images forKey:@"wallPhotos"];
}

//从编辑个人信息界面返回后更新界面
-(void)updateUI:(NSArray *)images{
    _profileInfo = [QLProfileInfo profileInfoExceptEmpty];
    [self.tableView reloadData];

    _images = images;
    QYScrollPhotoView *scrollPhotoView = [QYScrollPhotoView scrollPhotoViewWithImages:images];
    self.tableView.tableHeaderView = scrollPhotoView;
    self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(kScreenW, 0, 0, 0);

}

@end


text:
package com.domhauton.membrane.network;

import com.domhauton.membrane.distributed.ContractManager;
import com.domhauton.membrane.network.auth.AuthException;
import com.domhauton.membrane.network.auth.AuthUtils;
import com.domhauton.membrane.network.auth.MembraneAuthInfo;
import com.domhauton.membrane.network.auth.PeerCertManager;
import com.domhauton.membrane.network.connection.ConnectionManager;
import com.domhauton.membrane.network.connection.peer.Peer;
import com.domhauton.membrane.network.connection.peer.PeerException;
import com.domhauton.membrane.network.messages.ContractUpdateMessage;
import com.domhauton.membrane.network.messages.PeerMessageConsumer;
import com.domhauton.membrane.network.messages.PeerStorageBlock;
import com.domhauton.membrane.network.pex.PexException;
import com.domhauton.membrane.network.pex.PexManager;
import com.domhauton.membrane.network.tracker.TrackerManager;
import com.domhauton.membrane.network.upnp.ExternalAddress;
import com.domhauton.membrane.network.upnp.PortForwardingService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.joda.time.DateTime;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 * Created by Dominic Hauton on 18/02/17.
 */
public class NetworkManagerImpl implements NetworkManager {
  private final Logger logger = LogManager.getLogger();

  private static final int MAX_LEDGER_SIZE = 500;

  private final PortForwardingService portForwardingService;
  private final PeerCertManager peerCertManager;
  private final ConnectionManager connectionManager;
  private final PexManager pexManager;
  private final Gatekeeper gatekeeper;
  private final PeerMessageConsumer peerMessageConsumer;

  // Stored for test reflection.
  private final MembraneAuthInfo membraneAuthInfo;
  private final TrackerManager trackerManager;

  public NetworkManagerImpl(Path baseNetworkPath, int transportPort, int maxConnections) throws NetworkException {
    this(baseNetworkPath, transportPort, maxConnections, -1);
  }

  public NetworkManagerImpl(Path baseNetworkPath, int transportPort, int maxConnections, int externalTransportPort) throws NetworkException {
    // Setup authentication information
    membraneAuthInfo = loadAuthInfo(baseNetworkPath); // Auto adds inner dir
    Path peerCertFolder = Paths.get(baseNetworkPath.toString() + File.separator + "peer");
    this.peerCertManager = new PeerCertManager(peerCertFolder);

    // Setup network connectivity
    this.connectionManager = new ConnectionManager(membraneAuthInfo, transportPort);
    this.portForwardingService = new PortForwardingService(transportPort);
    if (externalTransportPort > 0) {
      portForwardingService.addNewMapping(externalTransportPort);
    }

    // Setup peer info
    trackerManager = new TrackerManager();

    // Setup maintenance tasks
    this.pexManager = new PexManager(MAX_LEDGER_SIZE, baseNetworkPath);
    this.gatekeeper = new Gatekeeper(connectionManager, pexManager, portForwardingService,
        peerCertManager, trackerManager, maxConnections);

    // Configure message callback to all required network modules
    peerMessageConsumer = new PeerMessageConsumer(connectionManager, pexManager, gatekeeper, peerCertManager);
    connectionManager.registerMessageCallback(peerMessageConsumer);
    connectionManager.registerNewPeerCallback(gatekeeper::processNewPeerConnected);
  }

  /**
   * Create authentication info, from file or generate if unavailable
   *
   * @param authInfoPath Path auth info should be stored in
   * @return Generated auth info
   * @throws NetworkException Info could not be created
   */
  private MembraneAuthInfo loadAuthInfo(Path authInfoPath) throws NetworkException {
    try {
      logger.info("Loading auth info from [{}].", authInfoPath);
      return new MembraneAuthInfo(authInfoPath);
    } catch (AuthException e) {
      logger.warn("Could not load auth info from [{}]. Generating new auth info.", authInfoPath);
      try {
        AuthUtils.addProvider();
        MembraneAuthInfo tmpAuthInfo = AuthUtils.generateAuthenticationInfo();
        logger.info("Storing new auth info at [{}]", authInfoPath);
        tmpAuthInfo.write(authInfoPath);
        return tmpAuthInfo;
      } catch (AuthException e1) {
        logger.error("Could not generate new auth info. {}", e.getMessage());
        throw new NetworkException("Could not generate auth info. " + e.getMessage(), e1);
      } catch (IOException e1) {
        logger.error("Could not store new auth info. This is required for future login.");
        throw new NetworkException("Could not store new auth info. " + e.getMessage(), e1);
      }
    }
  }

  /**
   * Check if peer is connected
   *
   * @param peerId Id of the peer connected
   * @return true if peer is connected.
   */
  @Override
  public boolean peerConnected(String peerId) {
    return connectionManager.getAllConnectedPeers().stream()
        .anyMatch(x -> x.getUid().equals(peerId));
  }

  /**
   * Upload block to peer provided. Async with no confirmation of upload.
   *
   * @param peerId    Peer to upload to
   * @param blockData The bytes inside the block to upload
   * @throws NetworkException If there was an issue uploading. Peer not connected or buffer full.
   */
  @Override
  public void uploadBlockToPeer(String peerId, String blockId, byte[] blockData) throws NetworkException {
    try {
      Peer peerConnection = connectionManager.getPeerConnection(peerId, 2, TimeUnit.SECONDS);
      PeerStorageBlock peerStorageBlock = new PeerStorageBlock(blockId, blockData);
      peerConnection.sendPeerMessage(peerStorageBlock);
    } catch (TimeoutException e) {
      throw new NetworkException("Peer " + peerId + " unavailable.");
    } catch (PeerException e) {
      throw new NetworkException("Unable to send block to peer. [ " + peerId + " ]", e);
    }
  }

  @Override
  public void sendContractUpdateToPeer(String peerId, DateTime dateTime, int permittedBlockOffset, Set<String> storedBlockIds) throws NetworkException {
    try {
      logger.debug("Sending contract update to peer with {} permitted offset and {} stored blocks", permittedBlockOffset, storedBlockIds.size());
      Peer peerConnection = connectionManager.getPeerConnection(peerId, 2, TimeUnit.SECONDS);
      ContractUpdateMessage contractUpdateMessage = new ContractUpdateMessage(dateTime, permittedBlockOffset, storedBlockIds);
      peerConnection.sendPeerMessage(contractUpdateMessage);
    } catch (TimeoutException e) {
      throw new NetworkException("Peer " + peerId + " unavailable.");
    } catch (PeerException e) {
      throw new NetworkException("Unable to send contract update to peer. [ " + peerId + " ]", e);
    }
  }

  @Override
  public void setSearchForNewPublicPeers(boolean shouldSearch) {
    logger.info("Search for new public peers {}.", shouldSearch ? "enabled" : "disabled");
    gatekeeper.setSearchForNewPublicPeers(shouldSearch);
  }

  @Override
  public String getUID() {
    return membraneAuthInfo.getClientId();
  }

  @Override
  public String getPrivateEncryptionKey() {
    return membraneAuthInfo.getPrivateKey().getPrivateExponent().toString(Character.MAX_RADIX);
  }

  @Override
  public int getConnectedPeers() {
    return connectionManager.getAllConnectedPeers().size();
  }

  @Override
  public ExternalAddress upnpAddress() {
    return portForwardingService.getExternalAddress();
  }

  /**
   * Set the contract manager in all of the network subsystems
   *
   * @param contractManager ContractManager to set
   */
  @Override
  public void setContractManager(ContractManager contractManager) {
    peerMessageConsumer.setContractManager(contractManager);
    gatekeeper.setContractManager(contractManager);
    peerCertManager.setContractManager(contractManager);
  }

  @Override
  public void run() {
    // Run all services
    gatekeeper.run();
    portForwardingService.run();
  }

  @Override
  public void close() {
    try {
      pexManager.saveLedger();
    } catch (PexException e) {
      logger.error("Failed to save PEX info before shutdown");
    }
    gatekeeper.close();
    portForwardingService.close();
    connectionManager.close();
  }
}


text:
package com.cezarykluczynski.stapi.etl.template.spacecraft.processor;

import com.cezarykluczynski.stapi.etl.common.dto.EnrichablePair;
import com.cezarykluczynski.stapi.etl.common.processor.ItemWithTemplateEnrichingProcessor;
import com.cezarykluczynski.stapi.etl.template.common.processor.DateStatusProcessor;
import com.cezarykluczynski.stapi.etl.template.common.processor.StatusProcessor;
import com.cezarykluczynski.stapi.etl.template.starship.dto.StarshipTemplate;
import com.cezarykluczynski.stapi.etl.template.starship.dto.StarshipTemplateParameter;
import com.cezarykluczynski.stapi.sources.mediawiki.dto.Template;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class SpacecraftTemplateContentsEnrichingProcessor implements ItemWithTemplateEnrichingProcessor<StarshipTemplate> {

	private final SpacecraftRegistryProcessor spacecraftRegistryProcessor;

	private final StatusProcessor statusProcessor;

	private final DateStatusProcessor dateStatusProcessor;

	public SpacecraftTemplateContentsEnrichingProcessor(SpacecraftRegistryProcessor spacecraftRegistryProcessor,
			StatusProcessor statusProcessor, DateStatusProcessor dateStatusProcessor) {
		this.spacecraftRegistryProcessor = spacecraftRegistryProcessor;
		this.statusProcessor = statusProcessor;
		this.dateStatusProcessor = dateStatusProcessor;
	}

	@Override
	public void enrich(EnrichablePair<Template, StarshipTemplate> enrichablePair) throws Exception {
		Template template = enrichablePair.getInput();
		StarshipTemplate starshipTemplate = enrichablePair.getOutput();

		for (Template.Part part : template.getParts()) {
			String key = part.getKey();
			String value = part.getValue();

			switch (key) {
				case StarshipTemplateParameter.REGISTRY:
					starshipTemplate.setRegistry(spacecraftRegistryProcessor.process(value));
					break;
				case StarshipTemplateParameter.STATUS:
					starshipTemplate.setStatus(statusProcessor.process(value));
					break;
				case StarshipTemplateParameter.DATE_STATUS:
					starshipTemplate.setDateStatus(dateStatusProcessor.process(value));
					break;
				default:
					break;
			}
		}
	}

}


text:
package org.n52.youngs.test;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.n52.youngs.impl.SourceRecordHelper;
import com.google.common.io.Resources;
import java.io.IOException;
import java.util.Collection;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import org.junit.Assert;
import static org.junit.Assert.assertThat;
import org.junit.Before;
import org.junit.Test;
import org.n52.youngs.harvest.SourceRecord;
import org.n52.youngs.impl.XPathHelper;
import org.n52.youngs.load.impl.BuilderRecord;
import org.n52.youngs.transform.impl.CswToBuilderMapper;
import org.n52.youngs.transform.impl.YamlMappingConfiguration;
import static org.n52.youngs.util.JsonMatchers.hasJsonPath;

/**
 *
 * @author Daniel Nüst
 */
public class CswToBuilderMapperTest {

    private YamlMappingConfiguration cswConfiguration;

    private CswToBuilderMapper cswMapper;

    private final ObjectMapper mapper = new ObjectMapper();

    @Before
    public void load() throws IOException {
        cswConfiguration = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/csw-record.yml")).openStream(),
                new XPathHelper());
        cswMapper = new CswToBuilderMapper(cswConfiguration);
    }

    @Test
    public void singleElementsAreParsedWithoutSlashText() throws Exception {
        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_829babb0-b2f1-49e1-8cd5-7b489fe71a1e.xml");
        BuilderRecord mappedRecord = cswMapper.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        assertThat("Mapped record contains identifier", mappedRecordString,
                hasJsonPath("id", is("urn:uuid:829babb0-b2f1-49e1-8cd5-7b489fe71a1e")));
        assertThat("Mapped record contains type", mappedRecordString,
                hasJsonPath("type", is("http://purl.org/dc/dcmitype/Image")));
    }

    @Test
    public void singleElementsAreParsedWithSlashText() throws Exception {
        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_829babb0-b2f1-49e1-8cd5-7b489fe71a1e.xml");
        BuilderRecord mappedRecord = cswMapper.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        assertThat("Mapped record contains format", mappedRecordString,
                hasJsonPath("format", is("image/jp2")));
    }

    @Test
    public void multipleElementsAreParsed() throws Exception {
        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_ab42a8c4-95e8-4630-bf79-33e59241605a.xml");
        BuilderRecord mappedRecord = cswMapper.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        mapper.disable(SerializationFeature.INDENT_OUTPUT);
        mappedRecordString = mapper.readTree(mappedRecordString).toString();

        assertThat("Mapped record contains all subjects", mappedRecordString,
                containsString("[\"Otherography\",\"Physiography\",\"Morography\"]"));
    }

    @Test
    public void stringResultsAdded() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/testmapping-xpath-values.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_ab42a8c4-95e8-4630-bf79-33e59241605a.xml");
        BuilderRecord mappedRecord = m.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

//        assertThat("Mapped record contains all subjects", mappedRecordString,
//                equalToIgnoringWhiteSpace("[ \"Otherography\", \"Physiography\", \"Morography\" ]"));
        assertThat("Mapped record contains used_mapping field", mappedRecordString,
                containsString("used_mapping"));
        assertThat("Mapped record contains used_mapping field value", mappedRecordString,
                containsString("testmapping 1"));
    }

    @Test
    public void datetimeResultsAdded() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/testmapping-xpath-values.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_ab42a8c4-95e8-4630-bf79-33e59241605a.xml");
        BuilderRecord mappedRecord = m.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        assertThat("Mapped record contains created_on field", mappedRecordString,
                containsString("created_on"));
    }

    @Test
    public void fulltextResultsAdded() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/testmapping-xpath-values.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_ab42a8c4-95e8-4630-bf79-33e59241605a.xml");
        BuilderRecord mappedRecord = m.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        assertThat("Mapped record contains full_text field", mappedRecordString,
                containsString("full_text"));
        assertThat("Mapped record contains fields that are not covered by mapping", mappedRecordString,
                allOf(containsString("Physiography"), containsString("molestie lorem")));
    }

    @Test
    public void invalidDocumentNotMapped() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/eum-default.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/not-valid.xml");
        BuilderRecord mappedRecord = m.map(record);
        Assert.assertNull(mappedRecord);
    }

    @Test
    public void bbox() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/testmapping-gmd-bbox.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        Collection<SourceRecord> record = SourceRecordHelper.loadGetRecordsResponse(Resources.asByteSource(Resources.getResource("responses/dab-records-iso.xml")).openStream());
        BuilderRecord mappedRecord = m.map(record.iterator().next());
        String mappedRecordString = mappedRecord.getBuilder().string();

        mapper.disable(SerializationFeature.INDENT_OUTPUT);
        mappedRecordString = mapper.readTree(mappedRecordString).toString();

        assertThat("Mapped record contains envelope", mappedRecordString,
                allOf(containsString("location"), containsString("envelope"),
                        containsString("[[-11.1,14.0],[12.22,-13.0]]")));
    }

    @Test
    public void removeWhitespace() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/testmapping-raw-outputproperties.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_ab42a8c4-95e8-4630-bf79-33e59241605a.xml");
        BuilderRecord mappedRecord = m.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        assertThat("Mapped record contains identifier", mappedRecordString, hasJsonPath("id", is("testid")));
        assertThat("Mapped record contains field", mappedRecordString, containsString("raw_xml"));

        assertThat("XML field has no new lines between elements", mappedRecordString,
                hasJsonPath("raw_xml", not(containsString("\n"))));
    }

    @Test
    public void doIndentation() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/testmapping-xpath-values.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_ab42a8c4-95e8-4630-bf79-33e59241605a.xml");
        BuilderRecord mappedRecord = m.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        assertThat("Mapped record contains identifier", mappedRecordString, hasJsonPath("id", is("testid")));
        assertThat("Mapped record contains field", mappedRecordString, containsString("raw_xml"));

        assertThat("XML field has no new lines between elements", mappedRecordString,
                hasJsonPath("raw_xml", containsString("\n")));
        assertThat("XML has some whitespace before elements", mappedRecordString,
                hasJsonPath("raw_xml", containsString("    <dc:subject")));
    }

    @Test
    public void xmlDeclaration() throws Exception {
        YamlMappingConfiguration c = new YamlMappingConfiguration(
                Resources.asByteSource(Resources.getResource("mappings/testmapping-raw-outputproperties.yml")).openStream(),
                new XPathHelper());
        CswToBuilderMapper m = new CswToBuilderMapper(c);

        SourceRecord record = SourceRecordHelper.getSourceRecordFromFile("records/csw/Record_ab42a8c4-95e8-4630-bf79-33e59241605a.xml");
        BuilderRecord mappedRecord = m.map(record);
        String mappedRecordString = mappedRecord.getBuilder().string();

        assertThat("Mapped record contains identifier", mappedRecordString, hasJsonPath("id", is("testid")));
        assertThat("Mapped record contains field", mappedRecordString, containsString("raw_xml"));
        assertThat("XML declaration is not contained", mappedRecordString,
                not(containsString("<?xml")));
    }

}


text:
package com.google.cloud.tools.jib.blob;

import com.google.cloud.tools.jib.api.DescriptorDigest;
import com.google.cloud.tools.jib.hash.Digests;
import com.google.cloud.tools.jib.hash.WritableContents;
import com.google.common.io.Resources;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.Assert;
import org.junit.Test;

/** Tests for {@link Blob}. */
public class BlobTest {

  @Test
  public void testFromInputStream() throws IOException {
    String expected = "crepecake";
    InputStream inputStream = new ByteArrayInputStream(expected.getBytes(StandardCharsets.UTF_8));
    verifyBlobWriteTo(expected, Blobs.from(inputStream));
  }

  @Test
  public void testFromFile() throws IOException, URISyntaxException {
    Path fileA = Paths.get(Resources.getResource("core/fileA").toURI());
    String expected = new String(Files.readAllBytes(fileA), StandardCharsets.UTF_8);
    verifyBlobWriteTo(expected, Blobs.from(fileA));
  }

  @Test
  public void testFromString() throws IOException {
    String expected = "crepecake";
    verifyBlobWriteTo(expected, Blobs.from(expected));
  }

  @Test
  public void testFromWritableContents() throws IOException {
    String expected = "crepecake";

    WritableContents writableContents =
        outputStream -> outputStream.write(expected.getBytes(StandardCharsets.UTF_8));

    verifyBlobWriteTo(expected, Blobs.from(writableContents, false));
  }

  /** Checks that the {@link Blob} streams the expected string. */
  private void verifyBlobWriteTo(String expected, Blob blob) throws IOException {
    OutputStream outputStream = new ByteArrayOutputStream();
    BlobDescriptor blobDescriptor = blob.writeTo(outputStream);

    String output = outputStream.toString();
    Assert.assertEquals(expected, output);

    byte[] expectedBytes = expected.getBytes(StandardCharsets.UTF_8);
    Assert.assertEquals(expectedBytes.length, blobDescriptor.getSize());

    DescriptorDigest expectedDigest =
        Digests.computeDigest(new ByteArrayInputStream(expectedBytes)).getDigest();
    Assert.assertEquals(expectedDigest, blobDescriptor.getDigest());
  }
}


text:
import { ADD_TOAST, REMOVE_TOAST } from '../actions';

export default function messageToastsReducer(toasts = [], action) {
  switch (action.type) {
    case ADD_TOAST: {
      const { payload: toast } = action;
      return [toast, ...toasts];
    }

    case REMOVE_TOAST: {
      const {
        payload: { id },
      } = action;
      return [...toasts].filter(toast => toast.id !== id);
    }

    default:
      return toasts;
  }
}


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TrackerHitResult.cs" company="OxyPlot">
//   The MIT License (MIT)
//
//   Copyright (c) 2012 Oystein Bjorke
//
//   Permission is hereby granted, free of charge, to any person obtaining a
//   copy of this software and associated documentation files (the
//   "Software"), to deal in the Software without restriction, including
//   without limitation the rights to use, copy, modify, merge, publish,
//   distribute, sublicense, and/or sell copies of the Software, and to
//   permit persons to whom the Software is furnished to do so, subject to
//   the following conditions:
//
//   The above copyright notice and this permission notice shall be included
//   in all copies or substantial portions of the Software.
//
//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
//   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
//   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
//   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
//   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
//   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
//   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
// <summary>
//   Provides a data container for a tracker hit result.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot
{
    using OxyPlot.Series;

    /// <summary>
    /// Provides a data container for a tracker hit result.
    /// </summary>
    /// <remarks>
    /// This is used as DataContext for the TrackerControl.
    /// The TrackerControl is visible when the user use the left mouse button to "track" points on the series.
    /// </remarks>
    public class TrackerHitResult
    {
        /// <summary>
        /// The default format string.
        /// </summary>
        private const string DefaultFormatString = "{0}\n{1}: {2}\n{3}: {4}";

        /// <summary>
        /// Initializes a new instance of the <see cref="TrackerHitResult"/> class.
        /// </summary>
        /// <param name="series">The series.</param>
        /// <param name="dp">The data point.</param>
        /// <param name="sp">The screen point.</param>
        /// <param name="item">The item.</param>
        /// <param name="index">The index.</param>
        /// <param name="text">The text.</param>
        public TrackerHitResult(OxyPlot.Series.Series series, IDataPoint dp, ScreenPoint sp, object item = null, double index = -1, string text = null)
        {
            this.DataPoint = dp;
            this.Position = sp;
            this.Item = item;
            this.Index = index;
            this.Series = series;
            this.Text = text;
            var ds = series as DataPointSeries;
            if (ds != null)
            {
                this.XAxis = ds.XAxis;
                this.YAxis = ds.YAxis;
            }
        }

        /// <summary>
        /// Gets or sets the nearest or interpolated data point.
        /// </summary>
        public IDataPoint DataPoint { get; set; }

        /// <summary>
        /// Gets or sets the source item of the point.
        /// If the current point is from an ItemsSource and is not interpolated, this property will contain the item.
        /// </summary>
        public object Item { get; set; }

        /// <summary>
        /// Gets or sets the index for the Item.
        /// </summary>
        public double Index { get; set; }

        /// <summary>
        /// Gets or sets the horizontal/vertical line extents.
        /// </summary>
        public OxyRect LineExtents { get; set; }

        /// <summary>
        /// Gets or sets the plot model.
        /// </summary>
        public PlotModel PlotModel { get; set; }

        /// <summary>
        /// Gets or sets the position in screen coordinates.
        /// </summary>
        public ScreenPoint Position { get; set; }

        /// <summary>
        /// Gets or sets the series that is being tracked.
        /// </summary>
        public Series.Series Series { get; set; }

        /// <summary>
        /// Gets or sets the text shown in the tracker.
        /// </summary>
        public string Text { get; set; }

        /// <summary>
        /// Gets or sets the X axis.
        /// </summary>
        public Axes.Axis XAxis { get; set; }

        /// <summary>
        /// Gets or sets the Y axis.
        /// </summary>
        public Axes.Axis YAxis { get; set; }

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            if (this.Text != null)
            {
                return this.Text;
            }

            var ts = this.Series as ITrackableSeries;
            string formatString = DefaultFormatString;
            if (ts != null && !string.IsNullOrEmpty(ts.TrackerFormatString))
            {
                formatString = ts.TrackerFormatString;
            }

            string xaxisTitle = (this.XAxis != null ? this.XAxis.Title : null) ?? "X";
            string yaxisTitle = (this.YAxis != null ? this.YAxis.Title : null) ?? "Y";
            object xvalue = this.XAxis != null ? this.XAxis.GetValue(this.DataPoint.X) : this.DataPoint.X;
            object yvalue = this.YAxis != null ? this.YAxis.GetValue(this.DataPoint.Y) : this.DataPoint.Y;

            return StringHelper.Format(
                this.Series.ActualCulture,
                formatString,
                this.Item,
                this.Series.Title,
                xaxisTitle,
                xvalue,
                yaxisTitle,
                yvalue,
                this.Item).Trim();
        }

    }
}


text:
require "delegate"
require "validators/date_validator"
require "validators/safe_html_validator"

class UtaacDecisionValidator < SimpleDelegator
  include ActiveModel::Validations

  validates :title, presence: true
  validates :summary, presence: true
  validates :body, presence: true, safe_html: true

  validates :tribunal_decision_categories, presence: true
  validates :tribunal_decision_decision_date, presence: true, date: true
  validates :tribunal_decision_judges, presence: true

end


text:
package org.mousephenotype.dcc.qualitycontrol.webservice;

import java.util.ArrayList;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.mousephenotype.dcc.entities.overviews.ACentre;
import org.mousephenotype.dcc.qualitycontrol.webservice.pack.CentrePack;

/**
 *
 * @author Gagarine Yaikhom <g.yaikhom@har.mrc.ac.uk>
 */
@Stateless
@Path("centres")
public class CentreFacadeREST extends AbstractFacade<ACentre> {

    public CentreFacadeREST() {
        super(ACentre.class);
    }

    @GET
    @Path("extjs/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public CentrePack extjsFind(
            @PathParam("id") Short id,
            @QueryParam("s") String sessionId,
            @QueryParam("u") Integer userId) {
        CentrePack p = new CentrePack();
        if (isValidSession(sessionId, userId)) {
            ArrayList<ACentre> t = new ArrayList<ACentre>();
            t.add(super.find(id));
            p.setDataSet(t);
        } else {
            p.sessionHasExpired();
        }
        return p;
    }

    @GET
    @Path("extjs")
    @Produces(MediaType.APPLICATION_JSON)
    public CentrePack extjsFindAll(
            @QueryParam("s") String sessionId,
            @QueryParam("u") Integer userId) {
        CentrePack p = new CentrePack();
        if (isValidSession(sessionId, userId)) {
            p.setDataSet(super.findAll());
        } else {
            p.sessionHasExpired();
        }
        return p;
    }
}


text:
package net.lilifei.algorithm.clrs.v1.random;

import java.util.Arrays;

/**
 * Created by Lifei on 15/5/8.
 */
public class RandomAlgorithm {
    /**
     * Generate an different permutation from a given array
     *
     * @param A : the original array
     * @return : the new permutation
     */
    public static <T extends Object> T[] permuteWithoutIdentity(T[] A) {
        T[] ans = Arrays.copyOf(A, A.length);
        java.util.Random rd = new java.util.Random();
        int len = ans.length;
        for(int i = 0; i < len; i++) {
            int index = rd.nextInt(len - i) + i;
            T tmp = A[i];
            A[i] = A[index];
            A[index] = tmp;
        }
        return ans;
    }

    /**
     * Generate an different permutation from a given array
     *
     * @param A : the original array
     * @return : the new permutation
     */
    public static int[] permuteWithoutIdentity(int[] A) {
        int[] ans = Arrays.copyOf(A, A.length);
        java.util.Random rd = new java.util.Random();
        int len = ans.length;
        for(int i = 0; i < len; i++) {
            int index = rd.nextInt(len - i) + i;
            int tmp = A[i];
            A[i] = A[index];
            A[index] = tmp;
        }
        return ans;
    }
}


text:
docker-compose -f docker-compose-test.yml pull
docker-compose -f docker-compose-test.yml build
docker-compose -f docker-compose-test.yml run --rm -T tests
RC=$?
docker-compose -f docker-compose-test.yml stop
docker-compose -f docker-compose-test.yml rm -f
exit $RC


text:
var Emitter     = require('events').EventEmitter;
var async       = require('async');
var nopt        = require('nopt');
var rimraf      = require('rimraf');
var path        = require('path');
var glob        = require('glob');
var _           = require('lodash');

var help        = require('./help');
var config      = require('../core/config');
var template    = require('../util/template');
var fileExists  = require('../util/file-exists');

var optionTypes = { help: Boolean };
var shorthand   = { 'h': ['--help'] };

var removePkg = function (pkg, emitter, next) {
  var folder = path.join(config.cache, pkg);

  fileExists(folder, function (exists) {
    if (!exists) return emitter.emit('error', new Error('Package ' + pkg + ' is not installed'));

    rimraf(folder, function (err) {
      if (err) emitter.emit('error', err);
      else {
        emitter.emit('data', template('action', { name: 'cleared', shizzle: pkg }, true));
        next();
      }
    });
  });
};

var createFuncs = function (pkgs, emitter) {
  return pkgs.map(function (pkg) {
    pkg = pkg.replace(/^\.\//, '');
    return removePkg.bind(removePkg, pkg, emitter);
  });
};

module.exports = function (pkgs) {
  var emitter = new Emitter;

  // If no pkgs are passed we delete all
  // Otherwise we delete the passed ones
  if (!pkgs || !pkgs.length) {
    glob('./*', { cwd: config.cache }, function (err, dirs) {
      if (err) return emitter.emit('error', err);
      pkgs = dirs;
      async.parallel(createFuncs(pkgs, emitter), emitter.emit.bind(emitter, 'end'));
    });
  } else {
    async.parallel(createFuncs(_.uniq(pkgs), emitter), emitter.emit.bind(emitter, 'end'));
  }

  return emitter;
};

module.exports.line = function (argv) {
  var options  = nopt(optionTypes, shorthand, argv);
  var pkgs     = options.argv.remain.slice(1);

  if (options.help) return help('cache-clean');
  return module.exports(pkgs);
};


text:
#include "xenia/cpu/breakpoint.h"

#include "xenia/cpu/backend/backend.h"

namespace xe {
namespace cpu {

Breakpoint::Breakpoint(Processor* processor,
                       std::function<void(uint32_t, uint64_t)> hit_callback)
    : processor_(processor), hit_callback_(hit_callback) {}
Breakpoint::Breakpoint(Processor* processor, uint32_t address,
                       std::function<void(uint32_t, uint64_t)> hit_callback)
    : processor_(processor), address_(address), hit_callback_(hit_callback) {}
Breakpoint::~Breakpoint() { assert_false(installed_); }

bool Breakpoint::Install() {
  assert_false(installed_);

  installed_ = processor_->InstallBreakpoint(this);
  return installed_;
}

bool Breakpoint::Uninstall() {
  assert_true(installed_);

  installed_ = !processor_->UninstallBreakpoint(this);
  return !installed_;
}

}  // namespace cpu
}  // namespace xe


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

<TITLE>
Uses of Package org.apache.fop.render.bitmap (Apache FOP 1.1 API)
</TITLE>

<META NAME="date" CONTENT="2012-10-16">

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

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

fop 1.1

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Package
org.apache.fop.render.bitmap

Packages that use org.apache.fop.render.bitmap

org.apache.fop.render.bitmap
Bitmap Renderer which creates TIFF and PNG images from rendered pages.

Classes in org.apache.fop.render.bitmap used by org.apache.fop.render.bitmap

AbstractBitmapDocumentHandler

          Abstract IFDocumentHandler implementation
 for producing bitmap images.

BitmapRendererConfigurator

          Configurator for bitmap output.

BitmapRendererEventProducer

          Event producer interface for events generated by the bitmap renderers.

BitmapRenderingSettings

          This class holds settings used when rendering to bitmaps.

TIFFConstants

          Constants for TIFF output.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

fop 1.1

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.


text:
'''
DESCRIPTION:
Extracts compressed tar.gz, tar.bz2 or zip archives.

USAGE:
	python extract.py [options]

OPTIONS:
	-h | --help		prints this help message.

	-n archive | --name=archive
					specify the name of the archive to extact.

	-p location | --path=location
					specify the extraction location.

'''

import os
import sys
import getopt
import tarfile
import zipfile

def usage():
	print(__doc__)

def unzip(zip, path):
	z = zipfile.ZipFile(zip)
	for name in z.namelist():
		(dirname, filename) = os.path.split(name)
		if filename == '': # directory
			dir = os.path.join(path, dirname)
			if not os.path.exists(dir):
				os.mkdir(dir)
		else: # file
			fname = os.path.join(path, name)
			print(fname)
			fd = open(fname, 'wb')
			fd.write(z.read(name))
			fd.close()
	z.close()

def untar(tar, path):
	if name.endswith('.gz'):
		compression = 'gz'
	else:
		compression = 'bz2'

	t = tarfile.open(name, 'r:%s' % compression)
	for member in t.getmembers():
		print(member.name)
		t.extract(member, path=path)

if __name__ == "__main__":
	try:
		opts, args = getopt.getopt(sys.argv[1:], 'hn:p:', ['help', 'name=', 'path='])
	except getopt.GetoptError as err:
		print(str(err))
		usage()
		sys.exit(2)

	name = None
	path = '.'

	for o, a in opts:
		if o in ('-h', '--help'):
			usage()
			sys.exit()
		elif o in ('-n', '--name'):
			name = a
		elif o in ('-p', '--path'):
			path = a

	if not name:
		usage()
		sys.exit(2)

	if name.endswith('.zip'):
		unzip(name, path)
	else:
		untar(name, path)


text:
/*
FUNCTION
	<<wcslcpy>>---copy a wide-character string to specified length

ANSI_SYNOPSIS
	#include <wchar.h>
	size_t wcslcpy(wchar_t *<[dst]>, const wchar_t *<[src]>, size_t <[siz]>);

TRAD_SYNOPSIS
	#include <wchar.h>
	size_t wcslcpy(<[dst]>, <[src]>, <[siz]>)
	wchar_t *<[dst]>;
	const wchar_t *<[src]>;
	size_t <[siz]>;

DESCRIPTION
	<<wcslcpy>> copies wide characters from <[src]> to <[dst]>
	such that up to <[siz]> - 1 characters are copied.  A
	terminating null is appended to the result, unless <[siz]>
	is zero.

RETURNS
	<<wcslcpy>> returns the number of wide characters in <[src]>,
	not including the terminating null wide character.  If the
	return value is greater than or equal to <[siz]>, then
	not all wide characters were copied from <[src]> and truncation
	occurred.

PORTABILITY
No supporting OS subroutines are required.
*/

/*	$NetBSD: wcslcpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $	*/
/*	from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp 	*/

/*
 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <_ansi.h>
#include <wchar.h>

/*
 * Copy src to string dst of size siz.  At most siz-1 characters
 * will be copied.  Always NUL terminates (unless siz == 0).
 * Returns wcslen(src); if retval >= siz, truncation occurred.
 */
size_t
_DEFUN (wcslcpy, (dst, src, siz),
	wchar_t * dst _AND
	_CONST wchar_t * src _AND
	size_t siz)
{
  wchar_t *d = dst;
  _CONST wchar_t *s = src;
  size_t n = siz;

  /* Copy as many bytes as will fit */
  if (n != 0 && --n != 0)
    {
      do
	{
	  if ((*d++ = *s++) == 0)
	    break;
	}
      while (--n != 0);
    }

  /* Not enough room in dst, add NUL and traverse rest of src */
  if (n == 0)
    {
      if (siz != 0)
	*d = '\0';		/* NUL-terminate dst */
      while (*s++)
	;
    }

  return (s - src - 1);		/* count does not include NUL */
}


text:
permalink: /
title: "Welcome to Jing Luo's Zone"
excerpt: "About me"
author_profile: true
redirect_from:
  - /about/
  - /about.html
---

The main page, CV page and projects page are being built and feel free to check my [blogs](https://jing-luo.github.io/blogs/) and [contact page](https://jing-luo.github.io/contact/).

### Short Bio

I am a senior Computer Science student at the School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University. In my freshman year, I was admitted by Zhiyuan College as a member of Zhiyuan Honor Class.

Currently, I am working as a research intern in Visual Computing Group at Microsoft Research Asia (MSRA), advised by Jifeng Dai. Prior to that, I was also a LEaRN Scholar during my exchange in the Nanyang Technological University in 2016 and a research summer intern in Computational Health Informatics Lab of the University of Oxford advised by Prof. David Clifton.

I am adept at coding and keen on exploring the field of artificial intelligence. My current research focus is on deep learning for high-level computer vision, especially for object detection and semantic segmentation.


text:
package org.kie.processmigration.model.exceptions;

public class InvalidMigrationException extends Exception {

    private static final long serialVersionUID = 7144906219120602668L;

    public InvalidMigrationException(String reason) {
        super(reason);
    }

    @Override
    public String getMessage() {
        return String.format("Invalid migration: %s", super.getMessage());
    }
}


text:
#include "GlobalDef.h"
#include "iDatalink.h"
#include "Rs_Ignition.h"
#include "2CS.h"

#define REMOTES_MAX				4

#define REMOTE_MODE_NORMAL		NO
#define REMOTE_MODE_LEARN		YES

typedef  struct remote_id_s
{
	Uint8 current;						// 0,1,2,3 	: ID (remote ID)
	Uint8 type[REMOTES_MAX];			// 1,2		: 1Way, 2Way
	Uint8 bid_Support[REMOTES_MAX];		// 0,1		: Not supported, supported
//	Uint8 flex_Config[REMOTES_MAX];		// 0,1		: Non-Flex, Flex
	Uint8 pid[REMOTES_MAX][3];   		// XX XX XX : PID (Product id)
	Uint8 bid[3];						// XX XX XX : BID (Broadcast id)
	Uint8 mode;							// 0,1 		: REMOTE_MODE_NORMAL / REMOTE_MODE_LEARN
	Uint8 learned;						// 0,1 		: YES = new learned remote!
	Uint8 bid_Learned[REMOTES_MAX];		// 0,1		: YES = BID learned
	Uint8 lastIdSaved;					// 0,1,2,3 	: Last remote saved (remote ID)
	Uint8 totalSaved;					// 0-4 		: Total remote learned
	Uint8 eink[REMOTES_MAX];			// 0,1		: (NO)normal ,(YES) LCD/EINK	(check if it's an advanced remote with advanced data)
	Uint16 cmd_Delay[REMOTES_MAX];		// XX		: Counter value in ms for minimum delay between command frames
} remote_t;

extern volatile remote_t remote;

void Rf_Idatalink_SetLearnMode(Uint8 state);
void Rf_Idatalink_RecordRemote(void);

void Rf_Idatalink_SendRestTime(Uint8 uart);

// Init Remote and function pointer
void Rf_Idatalink_Init(void);

void Rf_Idatalink_RefreshVehicleStatus(void);

// Function used to manage iDataLink RF (called by idatalink.c)
Uint8 Rf_Idatalink_Refresh(Uint8 uart);

// This function send the remote starter alarm status to antenna/remotes
void Rf_Idatalink_SendAlarmStatus(Uint8 state);

// This function is used to encrypt or decrypt remote PID
void Rf_Idatalink_Crypto(remote_t* rem);

void Rf_Idatalink_RequestAntennaTemperature(Uint8 uart);

#if defined(INCLUDE_AUTO_LEARN)
void Rf_Idatalink_RequestRemoteAutoLearn(Uint8 uart);
void Rf_Idatalink_RemotesSave(void);
#endif
void Rf_Idatalink_SendLearningMode(Uint8 state);

// Function used to Send status to remote
// Before calling this function, TX buffer need to be ready to send
// 1- Set remote state (Set all icon, sound and additionnal data need to be send)
// 2- Call This function
//
// Ex.:
// Rf_Idatalink_RemoteState_Unlock();
// Rf_Idatalink_SendStatus();
//
void Rf_Idatalink_SendStatus(Uint8 uart);

///////////////////////////////////////////////////////////////////////////////
/// @brief Sends car statuses to all remotes at once.
///
/// @param uart			UART on which the learn BID frame is sent
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatalink_BID_SendStatus(Uint8 uart);

void Rf_Idatalink_NotifyRemotesFromOEM(Uint8 oemState);

///////////////////////////////////////////////////////////////////////////////
/// @brief Generates the BID based on the Module part number and the remotes
///	learned.
///
///	Format of the BID: XX-XX-X1
///					 ~(ED CB A)
///
///	Data taken in EEPROM
///			 	| Mem. Addr.	| Data
///	------------+---------------+-------------------------
///	Serial Num: | 0000			| __-EB-AX-XX-XX-XX-__-...
///	Remotes ID: | 1008			| XX-XX-CD-XX-XX-XX-...
///
/// @param None
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatalink_BID_GenerateBID(void);

///////////////////////////////////////////////////////////////////////////////
/// @brief Sends a new broadcast ID (BID) to a remote to be learnt.
///
///	NOTE: In order to make all remotes learn the BID, the following function
///	must be called after changing the value of remote.current variable.
///
/// @param uart 		UART on which the learn BID frame is sent
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatalink_BID_SendLearn(Uint8 uart);

///////////////////////////////////////////////////////////////////////////////
/// @brief Sends remote IDs to antenna for data filter after request all
///		   information.
///
/// @param uart			UART on which the frame is sent
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatalink_SendRemotesPID(Uint8 uart);

///////////////////////////////////////////////////////////////////////////////
/// @brief Sets delay in ms before sending status frame to BID.
///
/// @param delay		Delay in ms
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatastart_StatusToBID_SetDelay(Uint8 delay);

///////////////////////////////////////////////////////////////////////////////
/// @brief Get delay counter value
///
/// @param None
/// @return Current counter value
///////////////////////////////////////////////////////////////////////////////
Uint8 Rf_Idatastart_StatusToBID_GetDelay(void);

///////////////////////////////////////////////////////////////////////////////
/// @brief Start or stop delay
///
/// @param state	ON or OFF
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatastart_StatusToBID_SetState(Uint8 state);

///////////////////////////////////////////////////////////////////////////////
/// @brief Check if delay is enabled or not.
///
/// @param None
/// @return Status of the delay (enabled or not)
///////////////////////////////////////////////////////////////////////////////
Uint8 Rf_Idatastart_StatusToBID_GetState(void);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function to be called by scheduler
///
/// @param uart		UART on which request is sent.
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatastart_Update(Uint8 uart);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function send ignition state
///
/// @param uart		UART on which state is sent.
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatalink_SendIgnitionState(Uint8 uart);

///////////////////////////////////////////////////////////////////////////////
/// @brief Sends Car call to remotes.
///
///	Use thi function via RPS, for example.
///
/// @param uart		UART on which state is sent.
/// @return None
///////////////////////////////////////////////////////////////////////////////
void Rf_Idatalink_SendCarCall(Uint8 uart);

//void Rf_Idatalink_RequestRemoteAutoLearn(void);

//extern volatile Uint8 rf_Idatalink_RemoteLearning;
//extern volatile Uint8 rf_Idatalink_RemoteIDLearned;
//extern volatile Uint8 rf_Idatalink_CurrentRemoteID;
//extern volatile Uint8 rf_Idatalink_RemoteLastRecordedMemory;
//extern volatile Uint8 rf_Idatalink_Learn1w2wRemote;
extern volatile Uint8 rf_Idatalink_StatusData[3];
extern volatile Uint8 rf_Idatalink_AdditionnalData[2];
// used for Additionnal Data section
extern volatile Uint8 rf_Idatalink_Error;
extern volatile Uint8 rf_Idatalink_ErrorBuffer;
extern volatile Uint8 rf_Idatalink_AddFlag;
extern volatile Uint8 rf_Idatalink_QueryData;
extern volatile Uint16 rf_Idatalink_EngineRunTimeData;

extern volatile Uint8 rf_Idatalink_BattVoltage;
extern volatile Uint8 rf_Idatalink_Temp;
extern volatile Uint8 rf_Idatalink_Port;

#define Rf_Idatalink_Set_Error(err)		rf_Idatalink_Error=err
#define Rf_Idatalink_Get_Error()		rf_Idatalink_Error

#define rf_Idatalink_ShockState			(1<<4)

//#if defined(INCLUDE_RF_COMPU)

	#define Rf_Idatalink_RemoteState_GetPort()				rf_Idatalink_Port

	/////////////////////////////////////////////////////////////////
	// Additionnal Data Management
	/////////////////////////////////////////////////////////////////
	#define Rf_Idatalink_RemoteState_SetAlarmCode(code)		(code==0)?(code=0x7F):(code=code);\
															rf_Idatalink_AdditionnalData[0] = ((code>>4)|rf_Idatalink_AddFlag);\
															rf_Idatalink_AdditionnalData[1] = (code<<4)

															// If no error : replace with 0x7F = That will display "FAIL" instead of "ERROR 0"
	#define Rf_Idatalink_RemoteState_SetErrorCode()			(rf_Idatalink_Error==0)?(rf_Idatalink_ErrorBuffer=0x7F):(rf_Idatalink_ErrorBuffer=rf_Idatalink_Error);\
															rf_Idatalink_AdditionnalData[0] = ((rf_Idatalink_ErrorBuffer>>4)|rf_Idatalink_AddFlag);\
															rf_Idatalink_AdditionnalData[1] = (rf_Idatalink_ErrorBuffer<<4)
															//rf_Idatalink_AdditionnalData[0] |= 0x10// (1=Voltage 0=Temperature)

	#define Rf_Idatalink_RemoteState_SetQueryData()			rf_Idatalink_AdditionnalData[0] = ((rf_Idatalink_QueryData>>4)|rf_Idatalink_AddFlag);\
															rf_Idatalink_AdditionnalData[1] = (rf_Idatalink_QueryData<<4)

	#define Rf_Idatalink_RemoteState_SetEngineRunTimeData()	rf_Idatalink_AdditionnalData[0] = (rf_Idatalink_EngineRunTimeData>>4);\
															rf_Idatalink_AdditionnalData[1] = (rf_Idatalink_EngineRunTimeData<<4)

	#define Rf_Idatalink_RemoteState_SetAddFlag()			rf_Idatalink_AdditionnalData[0] = rf_Idatalink_AddFlag;\
															rf_Idatalink_AdditionnalData[1] = 0

	#define Rf_Idatalink_RemoteState_ResetAdditionnalData()	rf_Idatalink_AdditionnalData[0] = 0;\
															rf_Idatalink_AdditionnalData[1] = 0

	// Forces a "Not Available" status
	#define Rf_Idatalink_RemoteState_ShowNothing()			rf_Idatalink_AdditionnalData[0] = (0x07|rf_Idatalink_AddFlag);\
															rf_Idatalink_AdditionnalData[1] = 0xE0

	#define Rf_Idatalink_RemoteState_SetTemp()				rf_Idatalink_AdditionnalData[0] = ((rf_Idatalink_Temp>>4)|rf_Idatalink_AddFlag);\
															rf_Idatalink_AdditionnalData[1] = (rf_Idatalink_Temp<<4)
															//rf_Idatalink_AdditionnalData[0] |= 0x00// (1=Voltage 0=Temperature)

	#define Rf_Idatalink_RemoteState_SetVoltage()			rf_Idatalink_AdditionnalData[0] = (0x10|(rf_Idatalink_BattVoltage>>4)|rf_Idatalink_AddFlag);\
															rf_Idatalink_AdditionnalData[1] = (rf_Idatalink_BattVoltage<<4)
															//rf_Idatalink_AdditionnalData[0] |= 0x10// (1=Voltage 0=Temperature)

	#if defined(INCLUDE_DAS)
		#define Rf_Idatalink_RemoteState_SetShock()			rf_Idatalink_AdditionnalData[0] = rf_Idatalink_AddFlag|rf_Idatalink_ShockState|(Alarm_TiltOccured()<<3)|(Alarm_GetShockCounter()>>4);\
															rf_Idatalink_AdditionnalData[1] = (Alarm_GetShockCounter()<<4);\
															Alarm_ResetShockCounter()
	#endif

	/////////////////////////////////////////////////////////////////
	// Idatalink remote predifined state
	/////////////////////////////////////////////////////////////////
	#define Rf_Idatalink_RemoteState_Reset()				Compu_RF_Tx_SetIcon_Reset();\
															Compu_RF_Tx_SetIcon_ReservedOn()

	#define Rf_Idatalink_RemoteState_Unlock()				Compu_RF_Tx_SetState_2();\
															Compu_RF_Tx_SetIcon_Disarmed();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_Lock()					Compu_RF_Tx_SetState_1();\
															Compu_RF_Tx_SetIcon_Armed();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#if defined(RF_COMPU)
		#define Rf_Idatalink_RemoteState_LockCompu()		Compu_RF_Tx_SetState_10();\
															Compu_RF_Tx_SetIcon_Armed();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_ShowNothing()
	#endif

	#define Rf_Idatalink_RemoteState_Trunk()				Compu_RF_Tx_SetState_9();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_IdleMode()				Compu_RF_Tx_SetState_1();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_RemoteStart()			Compu_RF_Tx_SetState_1();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_EngineRunning()		Compu_RF_Tx_SetState_19();\
															Compu_RF_Tx_SetIcon_EngineOn();\
															Compu_RF_Tx_SetIcon_Tx_7Sec();\
															Compu_RF_Tx_SetIcon_SetTimer(Rs_Fsm_GetRunningTime());\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_RemoteStartRefused()	Compu_RF_Tx_SetState_3();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetErrorCode()

	#define Rf_Idatalink_RemoteState_RemoteStartFailed()	Compu_RF_Tx_SetState_29();\
															Compu_RF_Tx_SetIcon_Tx_7Sec();\
															Rf_Idatalink_RemoteState_SetErrorCode()

	#define Rf_Idatalink_RemoteState_Stop()					Compu_RF_Tx_SetState_2();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Compu_RF_Tx_SetIcon_SetTimer(0);\
															Compu_RF_Tx_SetIcon_StartOff();\
															Compu_RF_Tx_SetIcon_EngineOff();\
															Compu_RF_Tx_SetIcon_IG_Off();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_StopSuccess()			Compu_RF_Tx_SetState_23();\
															Compu_RF_Tx_SetIcon_EngineOff();\
															Compu_RF_Tx_SetIcon_Tx_7Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_StopSuccessWithoutRemoteWakeup()			Compu_RF_Tx_SetState_23();\
																				Compu_RF_Tx_SetIcon_EngineOff();\
																				Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_TakeOver()				Compu_RF_Tx_SetState_23();\
															Compu_RF_Tx_SetIcon_Tx_7Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_Aux()					Compu_RF_Tx_SetState_1();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_SetTimer(time)			Compu_RF_Tx_SetIcon_SetTimer(time);\
															Rf_Idatalink_RemoteState_SetEngineRunTimeData()

	#define Rf_Idatalink_RemoteState_ValetOn()				Compu_RF_Tx_SetState_7();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_ValetOff()				Compu_RF_Tx_SetState_8();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_LockValet()			Compu_RF_Tx_SetState_4();\
															Compu_RF_Tx_SetIcon_Armed();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_UnlockValet()			Compu_RF_Tx_SetState_5();\
															Compu_RF_Tx_SetIcon_Disarmed();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_PanicOn()				Compu_RF_Tx_SetState_11();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_PanicOff()				Rf_Idatalink_RemoteState_Unlock();\
															Rf_Idatalink_RemoteState_SetAddFlag()

	#define Rf_Idatalink_RemoteState_Query()				Compu_RF_Tx_SetState_10();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Rf_Idatalink_RemoteState_SetErrorCode();\
															(Rs_Ignition_GetVehicleState())?(Compu_RF_Tx_SetIcon_IG_On()):(Compu_RF_Tx_SetIcon_IG_Off())

	#define Rf_Idatalink_RemoteState_QueryRestTime()		Compu_RF_Tx_SetState_26();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Compu_RF_Tx_SetIcon_SetTimer(Rs_Fsm_GetRunningTime());\
															Rf_Idatalink_RemoteState_SetEngineRunTimeData()

	#define Rf_Idatalink_RemoteState_Turbo()				Compu_RF_Tx_SetState_25();\
															Compu_RF_Tx_SetIcon_Tx_7Sec();\
															Compu_RF_Tx_SetIcon_SetTimer(Rs_Fsm_GetRunningTime());\
															Rf_Idatalink_RemoteState_SetEngineRunTimeData()

	#define Rf_Idatalink_RemoteState_StartExtended()		Compu_RF_Tx_SetState_19();\
															Compu_RF_Tx_SetIcon_EngineOn();\
															Compu_RF_Tx_SetIcon_Tx_1Sec();\
															Compu_RF_Tx_SetIcon_SetTimer(Rs_Fsm_GetRunningTime());\
															Rf_Idatalink_RemoteState_SetEngineRunTimeData()

	/////////////////////////////////////////////////////////////////
	// Idatalink refresh internal status state
	/////////////////////////////////////////////////////////////////
	#define Rf_Idatalink_RefreshState_Lock(state)			(state)?(Compu_RF_Tx_SetIcon_Armed()):(Compu_RF_Tx_SetIcon_Disarmed())
	#define Rf_Idatalink_RefreshState_Trunk(state)			(state)?(Compu_RF_Tx_SetIcon_TrunkOpened()):(Compu_RF_Tx_SetIcon_TrunkClosed())
	#define Rf_Idatalink_RefreshState_Hood(state)			(state)?(Compu_RF_Tx_SetIcon_HoodOpened()):(Compu_RF_Tx_SetIcon_HoodClosed())
	#define Rf_Idatalink_RefreshState_Door(state)			(state)?(Compu_RF_Tx_SetIcon_DoorOpened()):(Compu_RF_Tx_SetIcon_DoorClosed())

//#endif

#endif // _Rf_Idatalink_H_