text:
package org.javaosc.galaxy.jdbc.core;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;

public abstract class ResultTypeHandler<T> implements ResultType<T> {

    private ResultSet rs;

    @Override
    public final T handle(ResultSet rs) throws SQLException {
        if (this.rs != null) {
            throw new IllegalStateException("Re-entry not allowed!");
        }

        this.rs = rs;

        try {
            return handle();
        } finally {
            this.rs = null;
        }
    }

    protected abstract T handle() throws SQLException;

    protected final boolean absolute(int row) throws SQLException {
        return rs.absolute(row);
    }

    protected final void afterLast() throws SQLException {
        rs.afterLast();
    }

    protected final void beforeFirst() throws SQLException {
        rs.beforeFirst();
    }

    protected final void cancelRowUpdates() throws SQLException {
        rs.cancelRowUpdates();
    }

    protected final void clearWarnings() throws SQLException {
        rs.clearWarnings();
    }

    protected final void close() throws SQLException {
        rs.close();
    }

    protected final void deleteRow() throws SQLException {
        rs.deleteRow();
    }

    protected final int findColumn(String columnLabel) throws SQLException {
        return rs.findColumn(columnLabel);
    }

    protected final boolean first() throws SQLException {
        return rs.first();
    }

    protected final Array getArray(int columnIndex) throws SQLException {
        return rs.getArray(columnIndex);
    }

    protected final Array getArray(String columnLabel) throws SQLException {
        return rs.getArray(columnLabel);
    }

    protected final InputStream getAsciiStream(int columnIndex) throws SQLException {
        return rs.getAsciiStream(columnIndex);
    }

    protected final InputStream getAsciiStream(String columnLabel) throws SQLException {
        return rs.getAsciiStream(columnLabel);
    }

    protected final BigDecimal getBigDecimal(int columnIndex) throws SQLException {
        return rs.getBigDecimal(columnIndex);
    }

    protected final BigDecimal getBigDecimal(String columnLabel) throws SQLException {
        return rs.getBigDecimal(columnLabel);
    }

    protected final InputStream getBinaryStream(int columnIndex) throws SQLException {
        return rs.getBinaryStream(columnIndex);
    }

    protected final InputStream getBinaryStream(String columnLabel) throws SQLException {
        return rs.getBinaryStream(columnLabel);
    }

    protected final Blob getBlob(int columnIndex) throws SQLException {
        return rs.getBlob(columnIndex);
    }

    protected final Blob getBlob(String columnLabel) throws SQLException {
        return rs.getBlob(columnLabel);
    }

    protected final boolean getBoolean(int columnIndex) throws SQLException {
        return rs.getBoolean(columnIndex);
    }

    protected final boolean getBoolean(String columnLabel) throws SQLException {
        return rs.getBoolean(columnLabel);
    }

    protected final byte getByte(int columnIndex) throws SQLException {
        return rs.getByte(columnIndex);
    }

    protected final byte getByte(String columnLabel) throws SQLException {
        return rs.getByte(columnLabel);
    }

    protected final byte[] getBytes(int columnIndex) throws SQLException {
        return rs.getBytes(columnIndex);
    }

    protected final byte[] getBytes(String columnLabel) throws SQLException {
        return rs.getBytes(columnLabel);
    }

    protected final Reader getCharacterStream(int columnIndex) throws SQLException {
        return rs.getCharacterStream(columnIndex);
    }

    protected final Reader getCharacterStream(String columnLabel) throws SQLException {
        return rs.getCharacterStream(columnLabel);
    }

    protected final Clob getClob(int columnIndex) throws SQLException {
        return rs.getClob(columnIndex);
    }

    protected final Clob getClob(String columnLabel) throws SQLException {
        return rs.getClob(columnLabel);
    }

    protected final int getConcurrency() throws SQLException {
        return rs.getConcurrency();
    }

    protected final String getCursorName() throws SQLException {
        return rs.getCursorName();
    }

    protected final Date getDate(int columnIndex, Calendar cal) throws SQLException {
        return rs.getDate(columnIndex, cal);
    }

    protected final Date getDate(int columnIndex) throws SQLException {
        return rs.getDate(columnIndex);
    }

    protected final Date getDate(String columnLabel, Calendar cal) throws SQLException {
        return rs.getDate(columnLabel, cal);
    }

    protected final Date getDate(String columnLabel) throws SQLException {
        return rs.getDate(columnLabel);
    }

    protected final double getDouble(int columnIndex) throws SQLException {
        return rs.getDouble(columnIndex);
    }

    protected final double getDouble(String columnLabel) throws SQLException {
        return rs.getDouble(columnLabel);
    }

    protected final int getFetchDirection() throws SQLException {
        return rs.getFetchDirection();
    }

    protected final int getFetchSize() throws SQLException {
        return rs.getFetchSize();
    }

    protected final float getFloat(int columnIndex) throws SQLException {
        return rs.getFloat(columnIndex);
    }

    protected final float getFloat(String columnLabel) throws SQLException {
        return rs.getFloat(columnLabel);
    }

    protected final int getHoldability() throws SQLException {
        return rs.getHoldability();
    }

    protected final int getInt(int columnIndex) throws SQLException {
        return rs.getInt(columnIndex);
    }

    protected final int getInt(String columnLabel) throws SQLException {
        return rs.getInt(columnLabel);
    }

    protected final long getLong(int columnIndex) throws SQLException {
        return rs.getLong(columnIndex);
    }

    protected final long getLong(String columnLabel) throws SQLException {
        return rs.getLong(columnLabel);
    }

    protected final ResultSetMetaData getMetaData() throws SQLException {
        return rs.getMetaData();
    }

    protected final Reader getNCharacterStream(int columnIndex) throws SQLException {
        return rs.getNCharacterStream(columnIndex);
    }

    protected final Reader getNCharacterStream(String columnLabel) throws SQLException {
        return rs.getNCharacterStream(columnLabel);
    }

    protected final NClob getNClob(int columnIndex) throws SQLException {
        return rs.getNClob(columnIndex);
    }

    protected final NClob getNClob(String columnLabel) throws SQLException {
        return rs.getNClob(columnLabel);
    }

    protected final String getNString(int columnIndex) throws SQLException {
        return rs.getNString(columnIndex);
    }

    protected final String getNString(String columnLabel) throws SQLException {
        return rs.getNString(columnLabel);
    }

    protected final Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
        return rs.getObject(columnIndex, map);
    }

    protected final Object getObject(int columnIndex) throws SQLException {
        return rs.getObject(columnIndex);
    }

    protected final Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
        return rs.getObject(columnLabel, map);
    }

    protected final Object getObject(String columnLabel) throws SQLException {
        return rs.getObject(columnLabel);
    }

    protected final Ref getRef(int columnIndex) throws SQLException {
        return rs.getRef(columnIndex);
    }

    protected final Ref getRef(String columnLabel) throws SQLException {
        return rs.getRef(columnLabel);
    }

    protected final int getRow() throws SQLException {
        return rs.getRow();
    }

    protected final RowId getRowId(int columnIndex) throws SQLException {
        return rs.getRowId(columnIndex);
    }

    protected final RowId getRowId(String columnLabel) throws SQLException {
        return rs.getRowId(columnLabel);
    }

    protected final SQLXML getSQLXML(int columnIndex) throws SQLException {
        return rs.getSQLXML(columnIndex);
    }

    protected final SQLXML getSQLXML(String columnLabel) throws SQLException {
        return rs.getSQLXML(columnLabel);
    }

    protected final short getShort(int columnIndex) throws SQLException {
        return rs.getShort(columnIndex);
    }

    protected final short getShort(String columnLabel) throws SQLException {
        return rs.getShort(columnLabel);
    }

    protected final Statement getStatement() throws SQLException {
        return rs.getStatement();
    }

    protected final String getString(int columnIndex) throws SQLException {
        return rs.getString(columnIndex);
    }

    protected final String getString(String columnLabel) throws SQLException {
        return rs.getString(columnLabel);
    }

    protected final Time getTime(int columnIndex, Calendar cal) throws SQLException {
        return rs.getTime(columnIndex, cal);
    }

    protected final Time getTime(int columnIndex) throws SQLException {
        return rs.getTime(columnIndex);
    }

    protected final Time getTime(String columnLabel, Calendar cal) throws SQLException {
        return rs.getTime(columnLabel, cal);
    }

    protected final Time getTime(String columnLabel) throws SQLException {
        return rs.getTime(columnLabel);
    }

    protected final Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
        return rs.getTimestamp(columnIndex, cal);
    }

    protected final Timestamp getTimestamp(int columnIndex) throws SQLException {
        return rs.getTimestamp(columnIndex);
    }

    protected final Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
        return rs.getTimestamp(columnLabel, cal);
    }

    protected final Timestamp getTimestamp(String columnLabel) throws SQLException {
        return rs.getTimestamp(columnLabel);
    }

    protected final int getType() throws SQLException {
        return rs.getType();
    }

    protected final URL getURL(int columnIndex) throws SQLException {
        return rs.getURL(columnIndex);
    }

    protected final URL getURL(String columnLabel) throws SQLException {
        return rs.getURL(columnLabel);
    }

    protected final SQLWarning getWarnings() throws SQLException {
        return rs.getWarnings();
    }

    protected final void insertRow() throws SQLException {
        rs.insertRow();
    }

    protected final boolean isAfterLast() throws SQLException {
        return rs.isAfterLast();
    }

    protected final boolean isBeforeFirst() throws SQLException {
        return rs.isBeforeFirst();
    }

    protected final boolean isClosed() throws SQLException {
        return rs.isClosed();
    }

    protected final boolean isFirst() throws SQLException {
        return rs.isFirst();
    }

    protected final boolean isLast() throws SQLException {
        return rs.isLast();
    }

    protected final boolean isWrapperFor(Class<?> iface) throws SQLException {
        return rs.isWrapperFor(iface);
    }

    protected final boolean last() throws SQLException {
        return rs.last();
    }

    protected final void moveToCurrentRow() throws SQLException {
        rs.moveToCurrentRow();
    }

    protected final void moveToInsertRow() throws SQLException {
        rs.moveToInsertRow();
    }

    protected final boolean next() throws SQLException {
        return rs.next();
    }

    protected final boolean previous() throws SQLException {
        return rs.previous();
    }

    protected final void refreshRow() throws SQLException {
        rs.refreshRow();
    }

    protected final boolean relative(int rows) throws SQLException {
        return rs.relative(rows);
    }

    protected final boolean rowDeleted() throws SQLException {
        return rs.rowDeleted();
    }

    protected final boolean rowInserted() throws SQLException {
        return rs.rowInserted();
    }

    protected final boolean rowUpdated() throws SQLException {
        return rs.rowUpdated();
    }

    protected final void setFetchDirection(int direction) throws SQLException {
        rs.setFetchDirection(direction);
    }

    protected final void setFetchSize(int rows) throws SQLException {
        rs.setFetchSize(rows);
    }

    protected final <E> E unwrap(Class<E> iface) throws SQLException {
        return rs.unwrap(iface);
    }

    protected final void updateArray(int columnIndex, Array x) throws SQLException {
        rs.updateArray(columnIndex, x);
    }

    protected final void updateArray(String columnLabel, Array x) throws SQLException {
        rs.updateArray(columnLabel, x);
    }

    protected final void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
        rs.updateAsciiStream(columnIndex, x, length);
    }

    protected final void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
        rs.updateAsciiStream(columnIndex, x, length);
    }

    protected final void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
        rs.updateAsciiStream(columnIndex, x);
    }

    protected final void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
        rs.updateAsciiStream(columnLabel, x, length);
    }

    protected final void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
        rs.updateAsciiStream(columnLabel, x, length);
    }

    protected final void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
        rs.updateAsciiStream(columnLabel, x);
    }

    protected final void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
        rs.updateBigDecimal(columnIndex, x);
    }

    protected final void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
        rs.updateBigDecimal(columnLabel, x);
    }

    protected final void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
        rs.updateBinaryStream(columnIndex, x, length);
    }

    protected final void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
        rs.updateBinaryStream(columnIndex, x, length);
    }

    protected final void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
        rs.updateBinaryStream(columnIndex, x);
    }

    protected final void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
        rs.updateBinaryStream(columnLabel, x, length);
    }

    protected final void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
        rs.updateBinaryStream(columnLabel, x, length);
    }

    protected final void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
        rs.updateBinaryStream(columnLabel, x);
    }

    protected final void updateBlob(int columnIndex, Blob x) throws SQLException {
        rs.updateBlob(columnIndex, x);
    }

    protected final void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
        rs.updateBlob(columnIndex, inputStream, length);
    }

    protected final void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
        rs.updateBlob(columnIndex, inputStream);
    }

    protected final void updateBlob(String columnLabel, Blob x) throws SQLException {
        rs.updateBlob(columnLabel, x);
    }

    protected final void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
        rs.updateBlob(columnLabel, inputStream, length);
    }

    protected final void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
        rs.updateBlob(columnLabel, inputStream);
    }

    protected final void updateBoolean(int columnIndex, boolean x) throws SQLException {
        rs.updateBoolean(columnIndex, x);
    }

    protected final void updateBoolean(String columnLabel, boolean x) throws SQLException {
        rs.updateBoolean(columnLabel, x);
    }

    protected final void updateByte(int columnIndex, byte x) throws SQLException {
        rs.updateByte(columnIndex, x);
    }

    protected final void updateByte(String columnLabel, byte x) throws SQLException {
        rs.updateByte(columnLabel, x);
    }

    protected final void updateBytes(int columnIndex, byte[] x) throws SQLException {
        rs.updateBytes(columnIndex, x);
    }

    protected final void updateBytes(String columnLabel, byte[] x) throws SQLException {
        rs.updateBytes(columnLabel, x);
    }

    protected final void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
        rs.updateCharacterStream(columnIndex, x, length);
    }

    protected final void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
        rs.updateCharacterStream(columnIndex, x, length);
    }

    protected final void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
        rs.updateCharacterStream(columnIndex, x);
    }

    protected final void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
        rs.updateCharacterStream(columnLabel, reader, length);
    }

    protected final void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
        rs.updateCharacterStream(columnLabel, reader, length);
    }

    protected final void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
        rs.updateCharacterStream(columnLabel, reader);
    }

    protected final void updateClob(int columnIndex, Clob x) throws SQLException {
        rs.updateClob(columnIndex, x);
    }

    protected final void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
        rs.updateClob(columnIndex, reader, length);
    }

    protected final void updateClob(int columnIndex, Reader reader) throws SQLException {
        rs.updateClob(columnIndex, reader);
    }

    protected final void updateClob(String columnLabel, Clob x) throws SQLException {
        rs.updateClob(columnLabel, x);
    }

    protected final void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
        rs.updateClob(columnLabel, reader, length);
    }

    protected final void updateClob(String columnLabel, Reader reader) throws SQLException {
        rs.updateClob(columnLabel, reader);
    }

    protected final void updateDate(int columnIndex, Date x) throws SQLException {
        rs.updateDate(columnIndex, x);
    }

    protected final void updateDate(String columnLabel, Date x) throws SQLException {
        rs.updateDate(columnLabel, x);
    }

    protected final void updateDouble(int columnIndex, double x) throws SQLException {
        rs.updateDouble(columnIndex, x);
    }

    protected final void updateDouble(String columnLabel, double x) throws SQLException {
        rs.updateDouble(columnLabel, x);
    }

    protected final void updateFloat(int columnIndex, float x) throws SQLException {
        rs.updateFloat(columnIndex, x);
    }

    protected final void updateFloat(String columnLabel, float x) throws SQLException {
        rs.updateFloat(columnLabel, x);
    }

    protected final void updateInt(int columnIndex, int x) throws SQLException {
        rs.updateInt(columnIndex, x);
    }

    protected final void updateInt(String columnLabel, int x) throws SQLException {
        rs.updateInt(columnLabel, x);
    }

    protected final void updateLong(int columnIndex, long x) throws SQLException {
        rs.updateLong(columnIndex, x);
    }

    protected final void updateLong(String columnLabel, long x) throws SQLException {
        rs.updateLong(columnLabel, x);
    }

    protected final void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
        rs.updateNCharacterStream(columnIndex, x, length);
    }

    protected final void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
        rs.updateNCharacterStream(columnIndex, x);
    }

    protected final void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
        rs.updateNCharacterStream(columnLabel, reader, length);
    }

    protected final void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
        rs.updateNCharacterStream(columnLabel, reader);
    }

    protected final void updateNClob(int columnIndex, NClob nClob) throws SQLException {
        rs.updateNClob(columnIndex, nClob);
    }

    protected final void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
        rs.updateNClob(columnIndex, reader, length);
    }

    protected final void updateNClob(int columnIndex, Reader reader) throws SQLException {
        rs.updateNClob(columnIndex, reader);
    }

    protected final void updateNClob(String columnLabel, NClob nClob) throws SQLException {
        rs.updateNClob(columnLabel, nClob);
    }

    protected final void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
        rs.updateNClob(columnLabel, reader, length);
    }

    protected final void updateNClob(String columnLabel, Reader reader) throws SQLException {
        rs.updateNClob(columnLabel, reader);
    }

    protected final void updateNString(int columnIndex, String nString) throws SQLException {
        rs.updateNString(columnIndex, nString);
    }

    protected final void updateNString(String columnLabel, String nString) throws SQLException {
        rs.updateNString(columnLabel, nString);
    }

    protected final void updateNull(int columnIndex) throws SQLException {
        rs.updateNull(columnIndex);
    }

    protected final void updateNull(String columnLabel) throws SQLException {
        rs.updateNull(columnLabel);
    }

    protected final void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException {
        rs.updateObject(columnIndex, x, scaleOrLength);
    }

    protected final void updateObject(int columnIndex, Object x) throws SQLException {
        rs.updateObject(columnIndex, x);
    }

    protected final void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException {
        rs.updateObject(columnLabel, x, scaleOrLength);
    }

    protected final void updateObject(String columnLabel, Object x) throws SQLException {
        rs.updateObject(columnLabel, x);
    }

    protected final void updateRef(int columnIndex, Ref x) throws SQLException {
        rs.updateRef(columnIndex, x);
    }

    protected final void updateRef(String columnLabel, Ref x) throws SQLException {
        rs.updateRef(columnLabel, x);
    }

    protected final void updateRow() throws SQLException {
        rs.updateRow();
    }

    protected final void updateRowId(int columnIndex, RowId x) throws SQLException {
        rs.updateRowId(columnIndex, x);
    }

    protected final void updateRowId(String columnLabel, RowId x) throws SQLException {
        rs.updateRowId(columnLabel, x);
    }

    protected final void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
        rs.updateSQLXML(columnIndex, xmlObject);
    }

    protected final void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
        rs.updateSQLXML(columnLabel, xmlObject);
    }

    protected final void updateShort(int columnIndex, short x) throws SQLException {
        rs.updateShort(columnIndex, x);
    }

    protected final void updateShort(String columnLabel, short x) throws SQLException {
        rs.updateShort(columnLabel, x);
    }

    protected final void updateString(int columnIndex, String x) throws SQLException {
        rs.updateString(columnIndex, x);
    }

    protected final void updateString(String columnLabel, String x) throws SQLException {
        rs.updateString(columnLabel, x);
    }

    protected final void updateTime(int columnIndex, Time x) throws SQLException {
        rs.updateTime(columnIndex, x);
    }

    protected final void updateTime(String columnLabel, Time x) throws SQLException {
        rs.updateTime(columnLabel, x);
    }

    protected final void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
        rs.updateTimestamp(columnIndex, x);
    }

    protected final void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
        rs.updateTimestamp(columnLabel, x);
    }

    protected final boolean wasNull() throws SQLException {
        return rs.wasNull();
    }

    protected final ResultSet getAdaptedResultSet() {
        return rs;
    }

}


text:
@implementation FindingDataManager

static FindingDataManager *manager = nil;

+(instancetype)sharedManager{
    if (manager == nil) {
        manager = [FindingDataManager new];

    }
    return manager;
}

//初始化 只走一次的初始化    如果有懒加载 可以不需要写以下的初始化  初始化不能写到解析中,因为每走一次新开辟一次空间  自动移除以前的缓存  我们展示需要保留以前的东西  所以开辟空间只走一次
//- (instancetype)init{
//
//    if ([super init]) {
//        _dataArray = [NSMutableArray arrayWithCapacity:10];
//        _detailArray = [NSMutableArray arrayWithCapacity:10];
//        _infoArray = [NSMutableArray arrayWithCapacity:10];
//
//    }
//
//    return self;
//
//}

-(void)requestDataWithPage:(int)page isReload:(BOOL)reload {

//    if (page == 0) {
//        if (self.dataArray.count) {
//            [self.dataArray removeAllObjects];
//        }
//
//        if (self.detailArray.count) {
//            [self.detailArray removeAllObjects];
//        }
//    }
    if (reload) {
        [self.dataArray removeAllObjects];
//        [self.detailArray removeAllObjects];
    }

    NSString *string = [ NSString stringWithFormat:kFind,page];

    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    [manager GET:string parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        NSDictionary *dictionary = responseObject;
        NSArray *array = dictionary[@"data"];
        for (NSDictionary *dic in array) {
            FindingModel *new = [FindingModel new];
            [new setValuesForKeysWithDictionary:dic];

//            NSArray *arrayProducts = dic[@"products"];

            NSString *picUrl = dic[@"info"][@"picUrl"];
            new.picUrl = picUrl;
            [self.dataArray addObject:new];
            //NSLog(@"☀%@",arrayProducts);//此数组盛放products后面对应的由3各字典组成的数组/10组
            //NSLog(@"啊啊☀%@",arrayProducts[0]);//取出每组中三个字典的第一个字典

            //将所有produces 后面的数组(数组含有三个,每一个是由4个字典组成)
//            [self.productsArray addObject:arrayProducts];
            //NSLog(@"self.productsArray=%@",self.productsArray);

//
//            for (NSDictionary *dic in arrayProducts) {
//
//                FindingDetailModel *model = [FindingDetailModel new];
//                [model setValuesForKeysWithDictionary:dic];
//                [self.detailArray addObject:model];
//
//            }
        }
        if (_myUpdataUI) {
            self.myUpdataUI();

        }else{
            NSLog(@"block里面没有东西");
        }

    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"解析失败");
    }];

//    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:kFind,page]]];
//    NSURLSession *session = [NSURLSession sharedSession];
//    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
//        NSMutableDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
//        NSArray *array = dictionary[@"data"];
//
//
//        for (NSDictionary *dic in array) {
//            FindingModel *new = [FindingModel new];
//            [new setValuesForKeysWithDictionary:dic];
//            [self.dataArray addObject:new];
//
//            NSArray *arrayProducts = dic[@"products"];
//
//            NSDictionary *infoDictionary = dic[@"info"];
//            [self.infoArray addObject:infoDictionary];\
//
//            //NSLog(@"☀%@",arrayProducts);//此数组盛放products后面对应的由3各字典组成的数组/10组
//            //NSLog(@"啊啊☀%@",arrayProducts[0]);//取出每组中三个字典的第一个字典
//
//            //将所有produces 后面的数组(数组含有三个,每一个是由4个字典组成)
//            [self.productsArray addObject:arrayProducts];
//            //NSLog(@"self.productsArray=%@",self.productsArray);
//
//
//            for (NSDictionary *dic in arrayProducts) {
//
//                FindingDetailModel *model = [FindingDetailModel new];
//                [model setValuesForKeysWithDictionary:dic];
//                [self.detailArray addObject:model];
//
//            }
//
//        }
//        // 返回主线程更新UI
//        dispatch_async(dispatch_get_main_queue(), ^{
//            if (!self.myUpdataUI) {
//                NSLog(@"black 没有代码");
//            }else{
//                self.myUpdataUI();
//            }
//        });
//    }];
//    //使用resume方法启动任务
//    [task resume];
//
}
//
// lazy lodad懒加载 使用懒加载上面解析的数组都要用self.dataArray  不能用下划线
-(NSMutableArray *)dataArray{
    if (!_dataArray) {
        _dataArray=[NSMutableArray new];
    }
    return _dataArray;
}

-(NSMutableArray *)productsArray{
    if (!_productsArray) {
        _productsArray=[NSMutableArray new];
    }
    return _productsArray;
}

-(NSMutableArray *)detailArray{
    if (!_detailArray) {
        _detailArray = [NSMutableArray new];

    }
    return _detailArray;
}
-(NSMutableArray *)infoArray{
    if (!_infoArray) {
        _infoArray = [NSMutableArray new];

    }
    return _infoArray;
}

@end

redpajama_set_name: RedPajamaGithub


text:
import * as IGame from '@IGame';
export default class Timer implements IGame.ITimer {
    private _nextFireTime: number;
    private delay: number;
    private action: () => void;
    /**
     *
     */
    constructor() {
        this._nextFireTime = 0;
        this.delay = 0;
        this.action = () => { };
    }
    get nextFireTime() {
        return this._nextFireTime;
    }

    public triggerAction(currentTime: number): void {
        this._nextFireTime = currentTime + this.delay;
        this.action();
    }

    public static create(tick: number, action: () => void): Timer {
        const timer = new Timer();
        timer.delay = tick;
        timer._nextFireTime = timer.delay;
        timer.action = action;
        return timer;
    }
}


text:
<?php

namespace spec\Authoritarian\Flow;

use PhpSpec\ObjectBehavior;
use Authoritarian\Flow\ResourceOwnerPasswordFlow;

class ResourceOwnerPasswordFlowSpec extends ObjectBehavior
{
    private $tokenUrl;
    private $username;
    private $password;
    private $clientId;
    private $clientSecret;

    public function let()
    {
        $this->tokenUrl = 'http://api.example.com/oauth/token';
        $this->username = 'username';
        $this->password = 'password';
        $this->clientId = 'client id';
        $this->clientSecret = 'client secret';
        $client = new \Guzzle\Http\Client();

        $this->beConstructedWith(
            $this->username,
            $this->password
        );

        $this->setTokenUrl($this->tokenUrl);
        $this->setHttpClient($client);
        $this->setClientCredential($this->clientId, $this->clientSecret);
    }

    public function it_should_be_initializable()
    {
        $this->shouldHaveType('Authoritarian\Flow\ResourceOwnerPasswordFlow');
    }

    public function it_should_throw_an_exception_to_get_a_request_without_token_url()
    {
        $this->setTokenUrl(null);
        $this->shouldThrow(
            '\Authoritarian\Exception\FlowException'
        )->duringGetRequest();
    }

    public function it_should_throw_an_exception_to_get_a_request_without_client_credential()
    {
        $this->setClientCredential(null, null);
        $this->shouldThrow(
            '\Authoritarian\Exception\FlowException'
        )->duringGetRequest();
    }

    public function it_should_create_a_request_to_the_token_url()
    {
        $this->getRequest()->getUrl()->shouldBeEqualTo($this->tokenUrl);
    }

    public function it_should_create_a_request_with_method_post()
    {
        $this->getRequest()
            ->getMethod()
            ->shouldBe('POST');
    }

    public function it_should_create_a_request_with_form_url_encode_header()
    {
        $this->getRequest()
            ->getHeader('Content-Type')
            ->hasValue('application/x-www-form-urlencoded; charset=utf-8')
            ->shouldBe(true);
    }

    public function it_should_create_a_request_with_client_id_in_the_body()
    {
        $this->getRequest()
            ->shouldHavePostParameter('client_id', $this->clientId);
    }

    public function it_should_create_a_request_with_client_secret_in_the_body()
    {
        $this->getRequest()
            ->shouldHavePostParameter('client_secret', $this->clientSecret);
    }

    public function it_should_create_a_request_with_grant_type_password_in_the_body()
    {
        $this->getRequest()
            ->shouldHavePostParameter(
                'grant_type',
                ResourceOwnerPasswordFlow::GRANT_TYPE
            );
    }

    public function it_should_create_a_request_with_the_given_scope_in_the_body()
    {
        $scope = 'scope';
        $this->setScope($scope);
        $this->getRequest()
            ->shouldHavePostParameter('scope', $scope);
    }

    public function it_should_create_a_request_with_username_in_the_body()
    {
        $this->getRequest()
            ->shouldHavePostParameter('username', $this->username);
    }

    public function it_should_create_a_request_with_password_in_the_body()
    {
        $this->getRequest()
            ->shouldHavePostParameter('password', $this->password);
    }

    public function getMatchers()
    {
        return array(
            'havePostParameter' => function ($subject, $key, $value) {
                $body = preg_split('/\n\s*\n/', $subject)[1];
                $parameters = array();
                parse_str($body, $parameters);

                return array_key_exists($key, $parameters) &&
                    $parameters[$key] == $value;
            },
        );
    }
}


text:
/*--------------------------- Package Declaration ----------------------------*/

package com.github.jessemull.microflex.integerflex.io;

import com.github.jessemull.microflex.integerflex.plate.WellInteger;

/**
 * This is a wrapper class for importing or exporting a JSON encoded well object.
 *
 * @author Jesse L. Mull
 * @update Updated Oct 18, 2016
 * @address http://www.jessemull.com
 * @email hello@jessemull.com
 */
public class WellPOJOInteger {

	/*---------------------------- Private fields ----------------------------*/

    private String type;         // Data set numerical type
    private String index;        // The well index
    private int size;            // Size of the data set
    private Integer[] values;    // Array holding the well values

    /*------------------------------ Constructors ----------------------------*/

    public WellPOJOInteger(){}

    /**
     * Creates a well POJO from the well object.
     * @param    WellInteger    the well object
     */
    public WellPOJOInteger(WellInteger well) {
        this.index = well.index();
        this.size = well.size();
        this.values = well.data().toArray(new Integer[well.size()]);
        this.type = well.typeString();
    }

    /**
     * Creates a well POJO from the well object.
     * @param    WellInteger    the well object
     */
    public WellPOJOInteger(String index, int size, Integer[] values, String type) {
        this.index = index;
        this.size = size;
        this.values = values;
        this.type = type;;
    }

    /*------------------------- Getters and setters --------------------------*/

    /**
     * Sets the index.
     * @param    String    the new index
     */
    public void setIndex(String newIndex) {
        this.index = newIndex;
    }

    /**
     * Sets the values array.
     * @param    int[]    the values array
     */
    public void setValues(Integer[] newValues) {
        this.values = newValues;
    }

    /**
     * Sets the type.
     * @param   String    the numerical type
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * Sets the size.
     * @param   String    the numerical type
     */
    public void setSize(int size) {
        this.size = size;
    }

    /**
     * Returns the index.
     * @return    the index
     */
    public String getIndex() {
        return this.index;
    }

    /**
     * Returns the values array.
     * @return    the array of values
     */
    public Integer[] getValues() {
        return this.values;
    }

    /**
     * Returns the numerical type as a string.
     * @return    the numerical type
     */
    public String getType() {
        return this.type;
    }

    /**
     * Returns the size of the values array.
     * @return    the size of the values array
     */
    public int getSize() {
        return this.size;
    }

    /**
     * Returns a WellInteger object.
     * @return    the well
     */
    public WellInteger toWellObject() {
        return new WellInteger(index, values);
    }
}


text:
from pyflk import simple_template
from pyflk.session import session

from core.base_view import SessionView

class Index(SessionView):
    def get(self):
        user = session.get(self.request, 'user')
        return simple_template('index.html', message='current user', user=user)


text:
package org.apache.jmeter.protocol.http.sampler;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.util.concurrent.TimeUnit;

import javax.net.ssl.SSLSession;

import org.apache.http.HttpConnectionMetrics;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.ClientConnectionRequest;
import org.apache.http.conn.ConnectionPoolTimeoutException;
import org.apache.http.conn.DnsResolver;
import org.apache.http.conn.ManagedClientConnection;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.conn.JMeterPoolingClientConnectionManager;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
import org.apache.jmeter.samplers.SampleResult;

/**
 * Adapter for {@link PoolingClientConnectionManager}
 * that wraps all connection requests into time-measured implementation a private
 * MeasuringConnectionRequest
 */
public class MeasuringConnectionManager extends JMeterPoolingClientConnectionManager {

    public MeasuringConnectionManager(SchemeRegistry schemeRegistry,
            DnsResolver resolver,
            int timeToLiveMs,
            int validateAfterInactivityMs) {
        super(schemeRegistry, timeToLiveMs, TimeUnit.MILLISECONDS, resolver, validateAfterInactivityMs);
    }

    @Override
    public ClientConnectionRequest requestConnection(final HttpRoute route, final Object state) {
        ClientConnectionRequest res = super.requestConnection(route, state);
        return new MeasuringConnectionRequest(res);
    }

    /**
     * Overriden to use {@link JMeterClientConnectionOperator} and fix SNI issue
     * @see "https://bz.apache.org/bugzilla/show_bug.cgi?id=57935"
     * @see org.apache.http.impl.conn.PoolingClientConnectionManager#createConnectionOperator(org.apache.http.conn.scheme.SchemeRegistry)
     */
    @Override
    protected ClientConnectionOperator createConnectionOperator(
            SchemeRegistry schreg) {
        return new JMeterClientConnectionOperator(schreg);
    }

    /**
     * An adapter class to pass {@link SampleResult} into {@link MeasuredConnection}
     */
    private static class MeasuringConnectionRequest implements ClientConnectionRequest {
        private final ClientConnectionRequest handler;
        public MeasuringConnectionRequest(ClientConnectionRequest res) {
            handler = res;
        }

        @Override
        public ManagedClientConnection getConnection(long timeout, TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException {
            ManagedClientConnection res = handler.getConnection(timeout, tunit);
            return new MeasuredConnection(res);
        }

        @Override
        public void abortRequest() {
            handler.abortRequest();
        }
    }

    /**
     * An adapter for {@link ManagedClientConnection}
     * that calls SampleResult.connectEnd after calling ManagedClientConnection.open
     */
    private static class MeasuredConnection implements ManagedClientConnection {
        private final ManagedClientConnection handler;

        public MeasuredConnection(ManagedClientConnection res) {
            handler = res;
        }

        @Override
        public void open(HttpRoute route, HttpContext context, HttpParams params) throws IOException {
            try {
                handler.open(route, context, params);
            } finally {
                SampleResult sample =
                        (SampleResult)context.getAttribute(HTTPHC4Impl.SAMPLER_RESULT_TOKEN);
                if (sample != null) {
                    sample.connectEnd();
                }
            }
        }

        // ================= all following methods just wraps handler's =================
        @Override
        public boolean isSecure() {
            return handler.isSecure();
        }

        @Override
        public HttpRoute getRoute() {
            return handler.getRoute();
        }

        @Override
        public SSLSession getSSLSession() {
            return handler.getSSLSession();
        }

        @Override
        public void tunnelTarget(boolean secure, HttpParams params) throws IOException {
            handler.tunnelTarget(secure, params);
        }

        @Override
        public void tunnelProxy(HttpHost next, boolean secure, HttpParams params) throws IOException {
            handler.tunnelProxy(next, secure, params);
        }

        @Override
        public void layerProtocol(HttpContext context, HttpParams params) throws IOException {
            handler.layerProtocol(context, params);
        }

        @Override
        public void markReusable() {
            handler.markReusable();
        }

        @Override
        public void unmarkReusable() {
            handler.unmarkReusable();
        }

        @Override
        public boolean isMarkedReusable() {
            return handler.isMarkedReusable();
        }

        @Override
        public void setState(Object state) {
            handler.setState(state);
        }

        @Override
        public Object getState() {
            return handler.getState();
        }

        @Override
        public void setIdleDuration(long duration, TimeUnit unit) {
            handler.setIdleDuration(duration, unit);
        }

        @Override
        public void releaseConnection() throws IOException {
            handler.releaseConnection();
        }

        @Override
        public void abortConnection() throws IOException {
            handler.abortConnection();
        }

        @Override
        public boolean isResponseAvailable(int timeout) throws IOException {
            return handler.isResponseAvailable(timeout);
        }

        @Override
        public void sendRequestHeader(HttpRequest request) throws HttpException, IOException {
            handler.sendRequestHeader(request);
        }

        @Override
        public void sendRequestEntity(HttpEntityEnclosingRequest request) throws HttpException, IOException {
            handler.sendRequestEntity(request);
        }

        @Override
        public HttpResponse receiveResponseHeader() throws HttpException, IOException {
            return handler.receiveResponseHeader();
        }

        @Override
        public void receiveResponseEntity(HttpResponse response) throws HttpException, IOException {
            handler.receiveResponseEntity(response);
        }

        @Override
        public void flush() throws IOException {
            handler.flush();
        }

        @Override
        public InetAddress getLocalAddress() {
            return handler.getLocalAddress();
        }

        @Override
        public int getLocalPort() {
            return handler.getLocalPort();
        }

        @Override
        public InetAddress getRemoteAddress() {
            return handler.getRemoteAddress();
        }

        @Override
        public int getRemotePort() {
            return handler.getRemotePort();
        }

        @Override
        public void close() throws IOException {
            handler.close();
        }

        @Override
        public boolean isOpen() {
            return handler.isOpen();
        }

        @Override
        public boolean isStale() {
            return handler.isStale();
        }

        @Override
        public void setSocketTimeout(int timeout) {
            handler.setSocketTimeout(timeout);
        }

        @Override
        public int getSocketTimeout() {
            return handler.getSocketTimeout();
        }

        @Override
        public void shutdown() throws IOException {
            handler.shutdown();
        }

        @Override
        public HttpConnectionMetrics getMetrics() {
            return handler.getMetrics();
        }

        @Override
        public void bind(Socket arg0) throws IOException {
            handler.bind(arg0);
        }

        @Override
        public String getId() {
            return handler.getId();
        }

        @Override
        public Socket getSocket() {
            return handler.getSocket();
        }
    }
}


text:
<?php

namespace tests\associations;

use CaboLabs\PhTest\PhTestCase;

/**
 * The goal of these tests is to verify the functionality of creating and saving
 * two objects associated with a hasone, and check the attribute values after a
 * get is executed.
 */
class TestHasOneGet extends PhTestCase {

  public function test_1()
  {
    global $Employer;

    $out = SetupTestData::hasone_save_cascade_1();
    $e = $Employer->get($out['e']->id);

    // tests
    $this->assert($e->id === $out['e']->id, 'Consistent id in get');

    $this->assert($e->payor_id === $out['e']->payor->id, 'Consistent FK id in get');

    $this->assert($e->payor === $Employer::NOT_LOADED_ASSOC, 'Has one object is not loaded');
  }

  public function test_2()
  {
    global $Employer;

    // setup
    $out = SetupTestData::hasone_save_cascade_2();
    $e = $Employer->get($out['e']->id);

    // tests
    $this->assert($e->id === $out['e']->id, 'Consistent id in get');

    $this->assert($e->payor_id === $out['e']->payor->id, 'Consistent FK id in get');

    $this->assert($e->payor === $Employer::NOT_LOADED_ASSOC, 'Has one object is not loaded');
  }

  public function test_3()
  {
    global $Employer;

    // setup
    $out = SetupTestData::hasone_save_cascade_3();
    $e = $Employer->get($out['e']->id);

    // tests
    $this->assert($e->id === $out['e']->id, 'Consistent id in get');

    $this->assert($e->payor_id === $out['e']->payor->id, 'Consistent FK id in get');

    $this->assert($e->payor === $Employer::NOT_LOADED_ASSOC, 'Has one object is not loaded');
  }

  public function test_4()
  {
    global $Employer;

    // setup
    $out = SetupTestData::hasone_save_cascade_4();
    $e = $Employer->get($out['e']->id);

    // tests
    $this->assert($e->id === $out['e']->id, 'Consistent id in get');

    $this->assert($e->payor_id === $out['e']->payor->id, 'Consistent FK id in get');

    $this->assert($e->payor === $Employer::NOT_LOADED_ASSOC, 'Has one object is not loaded');
  }

  public function test_5()
  {
    global $Employer;

    // setup
    $out = SetupTestData::hasone_save_cascade_5();
    $e = $Employer->get($out['e']->id);

    // tests
    $this->assert($e->id === $out['e']->id, 'Consistent id in get');

    $this->assert($e->payor_id === NULL, 'Has one FK id in get is NULL');

    $this->assert($e->payor === NULL, 'Has one object is NULL');
  }
}

?>


text:
var module = require('module')
var strictMode = require('strict-mode')
var test = require('tape')

var origWrapper = '(function (exports, require, module, __filename, __dirname) { '

test('strict-mode', function (t) {
  t.plan(2)

  t.equal(module.wrapper[0], origWrapper, 'origWrapper is unchanged')

  strictMode(function () {
    t.throws(require('./noStrictCode'))
  })
})


text:
package userInterface;

import java.util.ArrayList;
import java.util.Collections;
import uiManager.UIManager;
import userInterface.UserInterface;
import userInterface.uiobject.IterationCountDisplay;
import javafx.scene.Node;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;

public class PredPreyUserInterface extends UserInterface {

    public PredPreyUserInterface (BorderPane root, UIManager uim) {
        super(root, uim);
    }

    @Override
    protected ArrayList<HBox> paramsPanelHelper (ArrayList <HBox> paramLabels) {
        HBox fishBreed = myUIFactory.createTextField("FishBreed");
        HBox sharkBreed = myUIFactory.createTextField("SharkBreed");
        HBox sharkStarve = myUIFactory.createTextField("SharkStarve");
        Collections.addAll(paramLabels, fishBreed, sharkBreed, sharkStarve);
        return paramLabels;
    }

    @Override
    protected Node simInfoPanelHelper (ArrayList<Object> updates) {
        IterationCountDisplay icd = (IterationCountDisplay) updates.get(0);
        return icd.getNode();
    }

    @Override
    protected ArrayList<Object> updateSimInfoParams (boolean isReset) {
        return new ArrayList<Object>();
    }

}


text:
<?php

namespace Drupal\Tests\Core\EventSubscriber;

use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber;
use Drupal\Core\Render\HtmlResponse;
use Drupal\Core\Routing\AccessAwareRouterInterface;
use Drupal\Core\Url;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\RequestContext;

/**
 * @coversDefaultClass \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber
 * @group EventSubscriber
 */
class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase {

  /**
   * The mocked HTTP kernel.
   *
   * @var \Symfony\Component\HttpKernel\HttpKernelInterface|\PHPUnit_Framework_MockObject_MockObject
   */
  protected $kernel;

  /**
   * The mocked config factory
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
   */
  protected $configFactory;

  /**
   * The mocked logger.
   *
   * @var \Psr\Log\LoggerInterface
   */
  protected $logger;

  /**
   * The PHP error log settings before the test.
   *
   * @var string
   */
  protected $errorLog;

  /**
   * The tested custom page exception subscriber.
   *
   * @var \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber|\Drupal\Tests\Core\EventSubscriber\TestCustomPageExceptionHtmlSubscriber
   */
  protected $customPageSubscriber;

  /**
   * The mocked redirect.destination service.
   *
   * @var \Drupal\Core\Routing\RedirectDestinationInterface|\PHPUnit_Framework_MockObject_MockObject
   */
  protected $redirectDestination;

  /**
   * The mocked access unaware router.
   * @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface|\PHPUnit_Framework_MockObject_MockObject
   */
  protected $accessUnawareRouter;

  /**
   * The access manager.
   *
   * @var \Drupal\Core\Access\AccessManagerInterface
   */
  protected $accessManager;

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    $this->configFactory = $this->getConfigFactoryStub(['system.site' => ['page.403' => '/access-denied-page', 'page.404' => '/not-found-page']]);

    $this->kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
    $this->logger = $this->getMock('Psr\Log\LoggerInterface');
    $this->redirectDestination = $this->getMock('\Drupal\Core\Routing\RedirectDestinationInterface');
    $this->redirectDestination->expects($this->any())
      ->method('getAsArray')
      ->willReturn(['destination' => 'test']);
    $this->accessUnawareRouter = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
    $this->accessUnawareRouter->expects($this->any())
      ->method('match')
      ->willReturn([
        '_controller' => 'mocked',
      ]);
    $this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');
    $this->accessManager->expects($this->any())
      ->method('checkNamedRoute')
      ->willReturn(AccessResult::allowed()->addCacheTags(['foo', 'bar']));

    $this->customPageSubscriber = new CustomPageExceptionHtmlSubscriber($this->configFactory, $this->kernel, $this->logger, $this->redirectDestination, $this->accessUnawareRouter, $this->accessManager);

    $path_validator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');
    $path_validator->expects($this->any())
      ->method('getUrlIfValidWithoutAccessCheck')
      ->willReturn(Url::fromRoute('foo', ['foo' => 'bar']));
    $container = new ContainerBuilder();
    $container->set('path.validator', $path_validator);
    \Drupal::setContainer($container);

    // You can't create an exception in PHP without throwing it. Store the
    // current error_log, and disable it temporarily.
    $this->errorLog = ini_set('error_log', file_exists('/dev/null') ? '/dev/null' : 'nul');
  }

  /**
   * {@inheritdoc}
   */
  protected function tearDown() {
    ini_set('error_log', $this->errorLog);
  }

  /**
   * Tests onHandleException with a POST request.
   */
  public function testHandleWithPostRequest() {
    $request = Request::create('/test', 'POST', ['name' => 'druplicon', 'pass' => '12345']);

    $request_context = new RequestContext();
    $request_context->fromRequest($request);
    $this->accessUnawareRouter->expects($this->any())
      ->method('getContext')
      ->willReturn($request_context);

    $this->kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
      return new HtmlResponse($request->getMethod());
    }));

    $event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', new NotFoundHttpException('foo'));

    $this->customPageSubscriber->onException($event);

    $response = $event->getResponse();
    $result = $response->getContent() . " " . UrlHelper::buildQuery($request->request->all());
    $this->assertEquals('POST name=druplicon&pass=12345', $result);
    $this->assertEquals(AccessResult::allowed()->addCacheTags(['foo', 'bar']), $request->attributes->get(AccessAwareRouterInterface::ACCESS_RESULT));
  }

  /**
   * Tests onHandleException with a GET request.
   */
  public function testHandleWithGetRequest() {
    $request = Request::create('/test', 'GET', ['name' => 'druplicon', 'pass' => '12345']);
    $request->attributes->set(AccessAwareRouterInterface::ACCESS_RESULT, AccessResult::forbidden()->addCacheTags(['druplicon']));

    $request_context = new RequestContext();
    $request_context->fromRequest($request);
    $this->accessUnawareRouter->expects($this->any())
      ->method('getContext')
      ->willReturn($request_context);

    $this->kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
      return new Response($request->getMethod() . ' ' . UrlHelper::buildQuery($request->query->all()));
    }));

    $event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', new NotFoundHttpException('foo'));
    $this->customPageSubscriber->onException($event);

    $response = $event->getResponse();
    $result = $response->getContent() . " " . UrlHelper::buildQuery($request->request->all());
    $this->assertEquals('GET name=druplicon&pass=12345&destination=test&_exception_statuscode=404 ', $result);
    $this->assertEquals(AccessResult::forbidden()->addCacheTags(['druplicon', 'foo', 'bar']), $request->attributes->get(AccessAwareRouterInterface::ACCESS_RESULT));
  }

}


text:
INCLUDE(FindPkgConfig)

IF(Cairo_FIND_REQUIRED)
	SET(_pkgconfig_REQUIRED "REQUIRED")
ELSE(Cairo_FIND_REQUIRED)
	SET(_pkgconfig_REQUIRED "")
ENDIF(Cairo_FIND_REQUIRED)

IF(CAIRO_MIN_VERSION)
	PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo>=${CAIRO_MIN_VERSION})
ELSE(CAIRO_MIN_VERSION)
	PKG_SEARCH_MODULE(CAIRO ${_pkgconfig_REQUIRED} cairo)
ENDIF(CAIRO_MIN_VERSION)

IF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND)
	FIND_PATH(CAIRO_INCLUDE_DIRS cairo.h)
	FIND_LIBRARY(CAIRO_LIBRARIES cairo)

	# Report results
	IF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
		SET(CAIRO_FOUND 1)
		IF(NOT Cairo_FIND_QUIETLY)
			MESSAGE(STATUS "Found Cairo: ${CAIRO_LIBRARIES}")
		ENDIF(NOT Cairo_FIND_QUIETLY)
	ELSE(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
		IF(Cairo_FIND_REQUIRED)
			MESSAGE(SEND_ERROR "Could not find Cairo")
		ELSE(Cairo_FIND_REQUIRED)
			IF(NOT Cairo_FIND_QUIETLY)
				MESSAGE(STATUS "Could not find Cairo")
			ENDIF(NOT Cairo_FIND_QUIETLY)
		ENDIF(Cairo_FIND_REQUIRED)
	ENDIF(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS)
ENDIF(NOT CAIRO_FOUND AND NOT PKG_CONFIG_FOUND)

# Hide advanced variables from CMake GUIs
MARK_AS_ADVANCED(CAIRO_LIBRARIES CAIRO_INCLUDE_DIRS)


text:
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/console-test.js"></script>
<script>

function onload()
{
    var obj = new Object();
    obj["a"] = 1;
    obj[Symbol()] = 2;
    obj[Symbol("a")] = 3;
    obj[Symbol("a")] = Symbol.iterator;
    obj[Symbol.iterator] = Symbol("foo");
    console.dir(obj);

    // This used to crash in debug build.
    console.dir(Symbol());

    [new Map(), new WeakMap()].forEach(function(m) {
        m.set(obj, {foo: 1});
        console.dir(m);
    });
    [new Set(), new WeakSet()].forEach(function(s) {
        s.add(obj);
        console.dir(s);
    });

    // Test circular dependency by entries.
    var s1 = new Set();
    var s2 = new Set();
    s1.add(s2);
    s2.add(s1);
    console.dir(s1);

    // Test "No Entries" placeholder.
    console.dir(new WeakMap());

    // Test Map/Set iterators.
    var m = new Map();
    m.set(obj, {foo: 1});
    var s = new Set();
    s.add(obj);
    [m, s].forEach(function(c) {
        console.dir(c.keys());
        console.dir(c.values());
        console.dir(c.entries());
    });

    class FooClass {
        jump(x) { return 1 }
        badArrow(x = a => 2) { return "looooooooooooooooooooooooooooooooooooooooooooooooooooong" }
    }
    var fooInstance = new FooClass();

    var fns = [
        class{method(){ return 1 }},
        class        classWithWhitespace     {       method(){ return 1 }     },
        FooClass,
        fooInstance.jump,
        class BarClass extends FooClass{},
        class BarClass2 extends class base{} {},
        class BarClass3 extends function base2(a, b) {} {},
        _ => { return 1 },
        (x) => { return 1 },
        (x, y, z) => { return 1 },
        ({}) => { return 1 },
        ([]) => { return 1 },
        () => { return "short" },
        () => { return "looooooooooooooooooooooooooooooooooooooooooooooooooooong" },
        (...x) => { return 1 },
        (x, y, ...z) => { return 1 },
        function (...x) { return 1 },
        function (x, y, ...z) { return 1 },
        function({a}){ return 1 },
        function([a]){ return 1 },
        function({a, b}){ return 1 },
        function(...{a}){ return 1 },
        function(a = (1), b){ return 1 },
        function(a = {x: (1)}, b){ return 1 },
        function(a = (x) => { return 1 }, b){ return 2 },
        function({a: b}){ return 1 },
        function(c = ")", {a: b}){ return 1 }
    ];
    console.dir(fns);

    var badFns = [
        fooInstance.badArrow,
        function(a = ") {", b){ return 1 },
        function(a = function(){ return 1 }, b){ return 2 },
        function(a = class{ constructor(){} }){ return 2 }
    ];
    console.dir(badFns);

    runTest();
}

function test()
{
    InspectorTest.expandConsoleMessages(dumpConsoleMessages);

    function dumpConsoleMessages()
    {
        InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textContentWithLineBreaks);
        InspectorTest.completeTest();
    }
}

</script>
</head>

<body onload="onload()">
<p>
Tests that console logging dumps proper messages.
</p>

</body>
</html>


text:
#import <Foundation/Foundation.h>
#import "XMLDigesterRule.h"

@interface XMLDigesterCallMethodWithAttributeRule : XMLDigesterRule {
   @private
      SEL selector_;
	  NSString* attribute_;
}

- (id) initWithDigester: (XMLDigester*) digester selector: (SEL) selector attribute: (NSString*) attribute;
+ (id) callMethodWithAttributeRuleWithDigester: (XMLDigester*) digester selector: (SEL) selector attribute: (NSString*) attribute;

@end


text:
using System;
using System.Collections.Generic;
using Sharpility.Util;

namespace Sharpility.Collections
{
    /// <summary>
    /// Sorted mapped array list mapped queue.
    /// </summary>
    /// <typeparam name="TKey">Type of key</typeparam>
    /// <typeparam name="TValue">Type of value</typeparam>
    public sealed class ArrayListSortedMappedQueue<TKey, TValue> : AbstractSortedMappedQueue<TKey, TValue, List<TValue>>
        where TValue : class
    {
        private ArrayListSortedMappedQueue(Converter<TValue, TKey> keyExtractor, IComparer<TValue> comparer) :
            base(keyExtractor, comparer, new List<TValue>())
        {
        }

        /// <summary>
        /// Created ArrayListSortedMappedQueue.
        /// </summary>
        /// <param name="keyExtractor">Extracts key from value</param>
        /// <param name="comparer">Queue item comparer</param>
        /// <returns>ArrayListSortedMappedQueue</returns>
        public static SortedMappedQueue<TValue> Create(Converter<TValue, TKey> keyExtractor, IComparer<TValue> comparer)
        {
            return new ArrayListSortedMappedQueue<TKey, TValue>(keyExtractor, comparer);
        }

        /// <summary>
        /// Created ArrayListSortedMappedQueue.
        /// </summary>
        /// <param name="comparer">Queue item comparer</param>
        /// <returns>ArrayListSortedMappedQueue</returns>
        public static SortedMappedQueue<T> Create<T>(IComparer<T> comparer)
            where T : class
        {
            Converter<T, T> keyExtractor = element => element;
            return new ArrayListSortedMappedQueue<T, T>(keyExtractor, comparer);
        }

        /// <summary>
        /// Created ArrayListSortedMappedQueue with comparable items.
        /// </summary>
        /// <returns>ArrayListSortedMappedQueue</returns>
        public static SortedMappedQueue<T> Create<T>()
            where T : class, IComparable<T>
        {
            var comparer = Comparers.OfComparables<T>();
            return Create(comparer);
        }

        /// <summary>
        /// Created ArrayListSortedMappedQueue with comparable items
        /// </summary>
        /// <param name="keyExtractor">Extracts key from value</param>
        /// <returns>ArrayListSortedMappedQueue</returns>
        public static SortedMappedQueue<TV> Create<T, TV>(Converter<TV, T> keyExtractor)
            where TV : class, IComparable<TV>
        {
            var comparer = Comparers.OfComparables<TV>();
            return new ArrayListSortedMappedQueue<T, TV>(keyExtractor, comparer);
        }

        protected override void SortQueue(List<TValue> queue, IComparer<TValue> comparer)
        {
            queue.Sort(comparer);
        }
    }
}


text:
<?php

namespace Minime\Annotations\Cache;

use Minime\Annotations\Interfaces\CacheInterface;

/**
 * A file storage cache implementation
 *
 * @package Minime\Annotations
 */
class FileCache implements CacheInterface
{
    /**
     * Cache storage path
     *
     * @var string
     */
    protected $path;

    /**
     * Cache entry file extension
     *
     * @var string
     */
    protected $extension = 'annotations';

    /**
     *
     * @param string $path custom sorage path
     */
    public function __construct($path = null)
    {
        $this->path = $path;

        if (! $this->path) {
            $this->path = sys_get_temp_dir() . '/minime-annotations/';
            if (! is_dir($this->path) ) {
                mkdir($this->path);
            }
        }

        if (! is_dir($this->path) || ! is_writable($this->path) || ! is_readable($this->path)) {
            throw new \InvalidArgumentException("Cache path is not a writable/readable directory: {$this->path}.");
        }
    }

    public function getKey($docblock)
    {
        return md5($docblock);
    }

    public function set($key, array $annotations)
    {
        $file = $this->getFileName($key);
        if (! file_exists($file)) {
            file_put_contents($file, serialize($annotations));
        }
    }

    public function get($key)
    {
        $file = $this->getFileName($key);
        if (file_exists($file)) {
            return unserialize(file_get_contents($file));
        }

        return [];
    }

    public function clear()
    {
        foreach (glob($this->path . "*{.{$this->extension}}", GLOB_BRACE | GLOB_NOSORT) as $file) {
            unlink($file);
        }
    }

    protected function getFileName($key)
    {
        return $this->path . $key . '.' . $this->extension;
    }

}


text:
var process = require('process');
var _ = require('lodash');
var glob = require('glob');
var path = require('path');
var packageFile = require('./package-file');
var options = require('./options');

module.exports = {
    options: setupOptions
};

function setupOptions(opts) {
    console.info('Reading options');

    applyOptions(getOptionsFromFileSync());
    applyOptions(getOptionsFromPackageFileSync());
    applyOptions(getOptionsFromCli());
    applyOptions(opts);

    if (!_.isArray(options.ignore)) {
        options.ignore = [];
    }

    options.ignore.push('**/node_modules/**');
}

function applyOptions(opts) {
    if (typeof opts === 'undefined' || opts === null) {
        return;
    }
    var keys = _.keys(opts);
    _.forEach(keys, function(key) {
        options[key] = opts[key];
    });
}

function getOptionsFromCli() {
    if (process.argv.length > 2) {
        var params = _.slice(process.argv, 2);
        var opts = {};
        _.each(params, function(param, n) {
            if (_.startsWith(param, '-')) {

                var value = params[n + 1];

                if (typeof value === 'undefined' || _.startsWith(value, '-')) {
                    value = null;
                }

                if (value !== null && param === '-ignore') {
                    value = value.split(',');
                }

                opts[param.substr(1)] = value;
            }
        });
        return opts;
    }
    return null;
}

function getOptionsFromFileSync() {
    var files = glob.sync('**/modsyncr.rc', {ignore: ['**/node_modules/**'], cwd: path.join(__dirname, '../')});

    if (files.length > 0) {
        var rcFile = files[files.length - 1];

        var data = fs.readFileSync(rcFile, 'utf8');

        try {
            return JSON.parse(data);

        }
        catch (err) {
            console.error(err);

        }
    }
    return null;
}

function getOptionsFromPackageFileSync() {
    var packageFilename = path.join(__dirname, '../package.json');
    var data = packageFile.loadPackageFileSync(packageFilename);
    if (data && data.modsyncr && data.modsyncr.options) {
        return data.modsyncr.options;
    }
    return null;
}


text:
package com.wuxian99.finance.common;

import java.util.List;

/**
 * Created by sxjiang on 2017/3/3.
 */
public class QueryCommand implements Command {
	private String module;
    private Integer start;
    private Integer length;
    private Integer draw;
    private List<SubQueryCommand> columns;
    private List<OrderCommand> order;
    private SearchCommand search;

    public Integer getStart() {
        return start;
    }

    public void setStart(Integer start) {
        this.start = start;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public Integer getDraw() {
        return draw;
    }

    public void setDraw(Integer draw) {
        this.draw = draw;
    }

    public List<SubQueryCommand> getColumns() {
        return columns;
    }

    public void setColumns(List<SubQueryCommand> columns) {
        this.columns = columns;
    }

    public List<OrderCommand> getOrder() {
        return order;
    }

    public void setOrder(List<OrderCommand> order) {
        this.order = order;
    }

    public SearchCommand getSearch() {
        return search;
    }

    public void setSearch(SearchCommand search) {
        this.search = search;
    }

	public String getModule() {
		return module;
	}

	public void setModule(String module) {
		this.module = module;
	}

	public String getAction() {
		return Constants.FIND;
	}

	@Override
	public boolean isQuery() {
		return true;
	}
}


text:
<?php
namespace Braintree;

/**
 * Braintree Transaction processor
 * Creates and manages transactions
 *
 * At minimum, an amount, credit card number, and
 * credit card expiration date are required.
 *
 * Minimalistic example:
 *
 * Transaction::saleNoValidate(array(
 *   'amount' => '100.00',
 *   'creditCard' => array(
 *       'number' => '5105105105105100',
 *       'expirationDate' => '05/12',
 *       ),
 *   ));
 *
 *
 * Full example:
 *
 * Transaction::saleNoValidate(array(
 *    'amount'      => '100.00',
 *    'orderId'    => '123',
 *    'channel'    => 'MyShoppingCardProvider',
 *    'creditCard' => array(
 *         // if token is omitted, the gateway will generate a token
 *         'token' => 'credit_card_123',
 *         'number' => '5105105105105100',
 *         'expirationDate' => '05/2011',
 *         'cvv' => '123',
 *    ),
 *    'customer' => array(
 *     // if id is omitted, the gateway will generate an id
 *     'id'    => 'customer_123',
 *     'firstName' => 'Dan',
 *     'lastName' => 'Smith',
 *     'company' => 'Braintree',
 *     'email' => 'dan@example.com',
 *     'phone' => '419-555-1234',
 *     'fax' => '419-555-1235',
 *     'website' => 'http://braintreepayments.com'
 *    ),
 *    'billing'    => array(
 *      'firstName' => 'Carl',
 *      'lastName'  => 'Jones',
 *      'company'    => 'Braintree',
 *      'streetAddress' => '123 E Main St',
 *      'extendedAddress' => 'Suite 403',
 *      'locality' => 'Chicago',
 *      'region' => 'IL',
 *      'postalCode' => '60622',
 *      'countryName' => 'United States of America'
 *    ),
 *    'shipping' => array(
 *      'firstName'    => 'Andrew',
 *      'lastName'    => 'Mason',
 *      'company'    => 'Braintree',
 *      'streetAddress'    => '456 W Main St',
 *      'extendedAddress'    => 'Apt 2F',
 *      'locality'    => 'Bartlett',
 *      'region'    => 'IL',
 *      'postalCode'    => '60103',
 *      'countryName'    => 'United States of America'
 *    ),
 *    'customFields'    => array(
 *      'birthdate'    => '11/13/1954'
 *    )
 *  )
 *
 *
 * == Storing in the Vault ==
 *
 * The customer and credit card information used for
 * a transaction can be stored in the vault by setting
 * transaction[options][storeInVault] to true.
 *
 *   $transaction = Transaction::saleNoValidate(array(
 *     'customer' => array(
 *       'firstName'    => 'Adam',
 *       'lastName'    => 'Williams'
 *     ),
 *     'creditCard'    => array(
 *       'number'    => '5105105105105100',
 *       'expirationDate'    => '05/2012'
 *     ),
 *     'options'    => array(
 *       'storeInVault'    => true
 *     )
 *   ));
 *
 *  echo $transaction->customerDetails->id
 *  // '865534'
 *  echo $transaction->creditCardDetails->token
 *  // '6b6m'
 *
 *
 * To also store the billing address in the vault, pass the
 * addBillingAddressToPaymentMethod option.
 *
 *   Transaction.saleNoValidate(array(
 *    ...
 *     'options' => array(
 *       'storeInVault' => true
 *       'addBillingAddressToPaymentMethod' => true
 *     )
 *   ));
 *
 *
 * == Submitting for Settlement==
 *
 * This can only be done when the transction's
 * status is authorized. If amount is not specified,
 * the full authorized amount will be settled. If you would like to settle
 * less than the full authorized amount, pass the desired amount.
 * You cannot settle more than the authorized amount.
 *
 * A transaction can be submitted for settlement when created by setting
 * $transaction[options][submitForSettlement] to true.
 *
 *
 *   $transaction = Transaction::saleNoValidate(array(
 *     'amount'    => '100.00',
 *     'creditCard'    => array(
 *       'number'    => '5105105105105100',
 *       'expirationDate'    => '05/2012'
 *     ),
 *     'options'    => array(
 *       'submitForSettlement'    => true
 *     )
 *   ));
 *
 *
 * == More information ==
 *
 * For more detailed information on Transactions, see {@link https://developers.braintreepayments.com/reference/response/transaction/php https://developers.braintreepayments.com/reference/response/transaction/php}
 *
 * @package    Braintree
 * @category   Resources
 *
 *
 * @property-read string $avsErrorResponseCode
 * @property-read string $avsPostalCodeResponseCode
 * @property-read string $avsStreetAddressResponseCode
 * @property-read string $cvvResponseCode
 * @property-read string $id transaction id
 * @property-read string $amount transaction amount
 * @property-read Braintree\Transaction\AddressDetails $billingDetails transaction billing address
 * @property-read \DateTime $createdAt transaction created DateTime
 * @property-read Braintree\ApplePayCardDetails $applePayCardDetails transaction Apple Pay card info
 * @property-read Braintree\AndroidPayCardDetails $androidPayCardDetails transaction Android Pay card info
 * @property-read Braintree\AmexExpressCheckoutCardDetails $amexExpressCheckoutCardDetails transaction Amex Express Checkout card info
 * @property-read Braintree\CreditCardDetails $creditCardDetails transaction credit card info
 * @property-read Braintree\CoinbaseDetails $coinbaseDetails transaction Coinbase account info
 * @property-read Braintree\MasterpassCardDetails $masterpassCardDetails transaction Masterpass card info
 * @property-read Braintree\PayPalDetails $paypalDetails transaction paypal account info
 * @property-read Braintree\Transaction\CustomerDetails $customerDetails transaction customer info
 * @property-read Braintree\VenmoAccount $venmoAccountDetails transaction Venmo Account info
 * @property-read Braintree\IdealPayment $idealPaymentDetails transaction Ideal Payment info
 * @property-read Braintree\VisaCheckoutCardDetails $visaCheckoutCardDetails transaction Visa Checkout card info
 * @property-read array  $customFields custom fields passed with the request
 * @property-read string $processorResponseCode gateway response code
 * @property-read string $additionalProcessorResponse raw response from processor
 * @property-read Braintree\Transaction\AddressDetails $shippingDetails transaction shipping address
 * @property-read string $status transaction status
 * @property-read array  $statusHistory array of StatusDetails objects
 * @property-read string $type transaction type
 * @property-read \DateTime $updatedAt transaction updated DateTime
 * @property-read Braintree\Disbursement $disbursementDetails populated when transaction is disbursed
 * @property-read Braintree\Dispute $disputes populated when transaction is disputed
 * @property-read Braintree\AuthorizationAdjustment $authorizationAdjustments populated when a transaction has authorization adjustments created when submitted for settlement
 *
 */

class Transaction extends Base
{
    // Transaction Status
    const AUTHORIZATION_EXPIRED    = 'authorization_expired';
    const AUTHORIZING              = 'authorizing';
    const AUTHORIZED               = 'authorized';
    const GATEWAY_REJECTED         = 'gateway_rejected';
    const FAILED                   = 'failed';
    const PROCESSOR_DECLINED       = 'processor_declined';
    const SETTLED                  = 'settled';
    const SETTLING                 = 'settling';
    const SUBMITTED_FOR_SETTLEMENT = 'submitted_for_settlement';
    const VOIDED                   = 'voided';
    const UNRECOGNIZED             = 'unrecognized';
    const SETTLEMENT_DECLINED      = 'settlement_declined';
    const SETTLEMENT_PENDING       = 'settlement_pending';
    const SETTLEMENT_CONFIRMED     = 'settlement_confirmed';

    // Transaction Escrow Status
    const ESCROW_HOLD_PENDING    = 'hold_pending';
    const ESCROW_HELD            = 'held';
    const ESCROW_RELEASE_PENDING = 'release_pending';
    const ESCROW_RELEASED        = 'released';
    const ESCROW_REFUNDED        = 'refunded';

    // Transaction Types
    const SALE   = 'sale';
    const CREDIT = 'credit';

    // Transaction Created Using
    const FULL_INFORMATION = 'full_information';
    const TOKEN            = 'token';

    // Transaction Sources
    const API           = 'api';
    const CONTROL_PANEL = 'control_panel';
    const RECURRING     = 'recurring';

    // Gateway Rejection Reason
    const AVS            = 'avs';
    const AVS_AND_CVV    = 'avs_and_cvv';
    const CVV            = 'cvv';
    const DUPLICATE      = 'duplicate';
    const FRAUD          = 'fraud';
    const THREE_D_SECURE = 'three_d_secure';
    const APPLICATION_INCOMPLETE = 'application_incomplete';

    // Industry Types
    const LODGING_INDUSTRY           = 'lodging';
    const TRAVEL_AND_CRUISE_INDUSTRY = 'travel_cruise';

    /**
     * sets instance properties from an array of values
     *
     * @ignore
     * @access protected
     * @param array $transactionAttribs array of transaction data
     * @return void
     */
    protected function _initialize($transactionAttribs)
    {
        $this->_attributes = $transactionAttribs;

        if (isset($transactionAttribs['applePay'])) {
            $this->_set('applePayCardDetails',
                new Transaction\ApplePayCardDetails(
                    $transactionAttribs['applePay']
                )
            );
        }

        if (isset($transactionAttribs['androidPayCard'])) {
            $this->_set('androidPayCardDetails',
                new Transaction\AndroidPayCardDetails(
                    $transactionAttribs['androidPayCard']
                )
            );
        }

        if (isset($transactionAttribs['masterpassCard'])) {
            $this->_set('masterpassCardDetails',
                new Transaction\MasterpassCardDetails(
                    $transactionAttribs['masterpassCard']
                )
            );
        }

        if (isset($transactionAttribs['visaCheckoutCard'])) {
            $this->_set('visaCheckoutCardDetails',
                new Transaction\VisaCheckoutCardDetails(
                    $transactionAttribs['visaCheckoutCard']
                )
            );
        }

        if (isset($transactionAttribs['amexExpressCheckoutCard'])) {
            $this->_set('amexExpressCheckoutCardDetails',
                new Transaction\AmexExpressCheckoutCardDetails(
                    $transactionAttribs['amexExpressCheckoutCard']
                )
            );
        }

        if (isset($transactionAttribs['venmoAccount'])) {
            $this->_set('venmoAccountDetails',
                new Transaction\VenmoAccountDetails(
                    $transactionAttribs['venmoAccount']
                )
            );
        }

        if (isset($transactionAttribs['creditCard'])) {
            $this->_set('creditCardDetails',
                new Transaction\CreditCardDetails(
                    $transactionAttribs['creditCard']
                )
            );
        }

        if (isset($transactionAttribs['coinbaseAccount'])) {
            $this->_set('coinbaseDetails',
                new Transaction\CoinbaseDetails(
                    $transactionAttribs['coinbaseAccount']
                )
            );
        }

        if (isset($transactionAttribs['europeBankAccount'])) {
            $this->_set('europeBankAccount',
                new Transaction\EuropeBankAccountDetails(
                    $transactionAttribs['europeBankAccount']
                )
            );
        }

        if (isset($transactionAttribs['usBankAccount'])) {
            $this->_set('usBankAccount',
                new Transaction\UsBankAccountDetails(
                    $transactionAttribs['usBankAccount']
                )
            );
        }

        if (isset($transactionAttribs['idealPayment'])) {
            $this->_set('idealPayment',
                new Transaction\IdealPaymentDetails(
                    $transactionAttribs['idealPayment']
                )
            );
        }

        if (isset($transactionAttribs['paypal'])) {
            $this->_set('paypalDetails',
                new Transaction\PayPalDetails(
                    $transactionAttribs['paypal']
                )
            );
        }

        if (isset($transactionAttribs['customer'])) {
            $this->_set('customerDetails',
                new Transaction\CustomerDetails(
                    $transactionAttribs['customer']
                )
            );
        }

        if (isset($transactionAttribs['billing'])) {
            $this->_set('billingDetails',
                new Transaction\AddressDetails(
                    $transactionAttribs['billing']
                )
            );
        }

        if (isset($transactionAttribs['shipping'])) {
            $this->_set('shippingDetails',
                new Transaction\AddressDetails(
                    $transactionAttribs['shipping']
                )
            );
        }

        if (isset($transactionAttribs['subscription'])) {
            $this->_set('subscriptionDetails',
                new Transaction\SubscriptionDetails(
                    $transactionAttribs['subscription']
                )
            );
        }

        if (isset($transactionAttribs['descriptor'])) {
            $this->_set('descriptor',
                new Descriptor(
                    $transactionAttribs['descriptor']
                )
            );
        }

        if (isset($transactionAttribs['disbursementDetails'])) {
            $this->_set('disbursementDetails',
                new DisbursementDetails($transactionAttribs['disbursementDetails'])
            );
        }

        $disputes = [];
        if (isset($transactionAttribs['disputes'])) {
            foreach ($transactionAttribs['disputes'] AS $dispute) {
                $disputes[] = Dispute::factory($dispute);
            }
        }

        $this->_set('disputes', $disputes);

        $statusHistory = [];
        if (isset($transactionAttribs['statusHistory'])) {
            foreach ($transactionAttribs['statusHistory'] AS $history) {
                $statusHistory[] = new Transaction\StatusDetails($history);
            }
        }

        $this->_set('statusHistory', $statusHistory);

        $addOnArray = [];
        if (isset($transactionAttribs['addOns'])) {
            foreach ($transactionAttribs['addOns'] AS $addOn) {
                $addOnArray[] = AddOn::factory($addOn);
            }
        }
        $this->_set('addOns', $addOnArray);

        $discountArray = [];
        if (isset($transactionAttribs['discounts'])) {
            foreach ($transactionAttribs['discounts'] AS $discount) {
                $discountArray[] = Discount::factory($discount);
            }
        }
        $this->_set('discounts', $discountArray);

        $authorizationAdjustments = [];
        if (isset($transactionAttribs['authorizationAdjustments'])) {
            foreach ($transactionAttribs['authorizationAdjustments'] AS $authorizationAdjustment) {
                $authorizationAdjustments[] = AuthorizationAdjustment::factory($authorizationAdjustment);
            }
        }

        $this->_set('authorizationAdjustments', $authorizationAdjustments);

        if(isset($transactionAttribs['riskData'])) {
            $this->_set('riskData', RiskData::factory($transactionAttribs['riskData']));
        }
        if(isset($transactionAttribs['threeDSecureInfo'])) {
            $this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($transactionAttribs['threeDSecureInfo']));
        }
        if(isset($transactionAttribs['facilitatedDetails'])) {
            $this->_set('facilitatedDetails', FacilitatedDetails::factory($transactionAttribs['facilitatedDetails']));
        }
        if(isset($transactionAttribs['facilitatorDetails'])) {
            $this->_set('facilitatorDetails', FacilitatorDetails::factory($transactionAttribs['facilitatorDetails']));
        }
    }

    /**
     * returns a string representation of the transaction
     * @return string
     */
    public function  __toString()
    {
        // array of attributes to print
        $display = [
            'id', 'type', 'amount', 'status',
            'createdAt', 'creditCardDetails', 'customerDetails'
            ];

        $displayAttributes = [];
        foreach ($display AS $attrib) {
            $displayAttributes[$attrib] = $this->$attrib;
        }
        return __CLASS__ . '[' .
                Util::attributesToString($displayAttributes) .']';
    }

    public function isEqual($otherTx)
    {
        return $this->id === $otherTx->id;
    }

    public function vaultCreditCard()
    {
        $token = $this->creditCardDetails->token;
        if (empty($token)) {
            return null;
        }
        else {
            return CreditCard::find($token);
        }
    }

    /** @return void|Braintree\Customer */
    public function vaultCustomer()
    {
        $customerId = $this->customerDetails->id;
        if (empty($customerId)) {
            return null;
        }
        else {
            return Customer::find($customerId);
        }
    }

    /** @return bool */
    public function isDisbursed() {
        return $this->disbursementDetails->isValid();
    }

    /** @return line items */
    public function lineItems() {
        return Configuration::gateway()->transactionLineItem()->findAll($this->id);
    }

    /**
     *  factory method: returns an instance of Transaction
     *  to the requesting method, with populated properties
     *
     * @ignore
     * @return Transaction
     */
    public static function factory($attributes)
    {
        $instance = new self();
        $instance->_initialize($attributes);
        return $instance;
    }

    // static methods redirecting to gateway

    public static function cloneTransaction($transactionId, $attribs)
    {
        return Configuration::gateway()->transaction()->cloneTransaction($transactionId, $attribs);
    }

    public static function createFromTransparentRedirect($queryString)
    {
        return Configuration::gateway()->transaction()->createFromTransparentRedirect($queryString);
    }

    public static function createTransactionUrl()
    {
        return Configuration::gateway()->transaction()->createTransactionUrl();
    }

    public static function credit($attribs)
    {
        return Configuration::gateway()->transaction()->credit($attribs);
    }

    public static function creditNoValidate($attribs)
    {
        return Configuration::gateway()->transaction()->creditNoValidate($attribs);
    }

    public static function find($id)
    {
        return Configuration::gateway()->transaction()->find($id);
    }

    public static function sale($attribs)
    {
        return Configuration::gateway()->transaction()->sale($attribs);
    }

    public static function saleNoValidate($attribs)
    {
        return Configuration::gateway()->transaction()->saleNoValidate($attribs);
    }

    public static function search($query)
    {
        return Configuration::gateway()->transaction()->search($query);
    }

    public static function fetch($query, $ids)
    {
        return Configuration::gateway()->transaction()->fetch($query, $ids);
    }

    public static function void($transactionId)
    {
        return Configuration::gateway()->transaction()->void($transactionId);
    }

    public static function voidNoValidate($transactionId)
    {
        return Configuration::gateway()->transaction()->voidNoValidate($transactionId);
    }

    public static function submitForSettlement($transactionId, $amount = null, $attribs = [])
    {
        return Configuration::gateway()->transaction()->submitForSettlement($transactionId, $amount, $attribs);
    }

    public static function submitForSettlementNoValidate($transactionId, $amount = null, $attribs = [])
    {
        return Configuration::gateway()->transaction()->submitForSettlementNoValidate($transactionId, $amount, $attribs);
    }

    public static function updateDetails($transactionId, $attribs = [])
    {
        return Configuration::gateway()->transaction()->updateDetails($transactionId, $attribs);
    }

    public static function submitForPartialSettlement($transactionId, $amount, $attribs = [])
    {
        return Configuration::gateway()->transaction()->submitForPartialSettlement($transactionId, $amount, $attribs);
    }

    public static function holdInEscrow($transactionId)
    {
        return Configuration::gateway()->transaction()->holdInEscrow($transactionId);
    }

    public static function releaseFromEscrow($transactionId)
    {
        return Configuration::gateway()->transaction()->releaseFromEscrow($transactionId);
    }

    public static function cancelRelease($transactionId)
    {
        return Configuration::gateway()->transaction()->cancelRelease($transactionId);
    }

    public static function refund($transactionId, $amount = null)
    {
        return Configuration::gateway()->transaction()->refund($transactionId, $amount);
    }
}
class_alias('Braintree\Transaction', 'Braintree_Transaction');


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>XLabs: XLabs.Forms.Behaviors.RelayGestureAsync< T > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

XLabs

Cross-platform reusable C# libraries

Main Page

Packages

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

Public Member Functions |
Protected Member Functions |
List of all members

XLabs.Forms.Behaviors.RelayGestureAsync< T > Class Template Reference

ASyncronous Implmenta tion of the IGesture The execute is asyncronous while the canexecute is syncronous Paramater is an T type
 More...

Inheritance diagram for XLabs.Forms.Behaviors.RelayGestureAsync< T >:

  <map id="XLabs.Forms.Behaviors.RelayGestureAsync< T >_map" name="XLabs.Forms.Behaviors.RelayGestureAsync< T >_map">
<area href="interface_x_labs_1_1_forms_1_1_behaviors_1_1_i_gesture.html" title="Interface implmenented to consume gestures analagous to ICommand " alt="XLabs.Forms.Behaviors.IGesture" shape="rect" coords="0,0,295,24"/>
<area href="interface_x_labs_1_1_forms_1_1_behaviors_1_1_i_gesture.html" title="Interface implmenented to consume gestures analagous to ICommand " alt="XLabs.Forms.Behaviors.IGesture" shape="rect" coords="305,0,600,24"/>
</map>

Public Member Functions

 	RelayGestureAsync (Func< GestureResult, T, Task > execute, Func< GestureResult, T, bool > predicate)

 	Builds the Rely Gesture  More...

async void 	ExecuteGesture (GestureResult result, object param)

 	Excutes the asyncronous action assoicated with the gesture  More...

bool 	CanExecuteGesture (GestureResult result, object annoyingbaseobjectthing)

 	Tests to see if a gesture's action can execute  More...

 	RelayGestureAsync (Func< GestureResult, object, Task > execute, Func< GestureResult, object, bool > predicate)

 	Builds the Rely Gesture  More...

async void 	ExecuteGesture (GestureResult result, object param)

 	Excutes the asyncronous action assoicated with the gesture  More...

bool 	CanExecuteGesture (GestureResult result, object annoyingbaseobjectthing)

 	Tests to see if a gesture's action can execute  More...

Protected Member Functions

virtual async Task 	Execute (GestureResult gesture, object annoyingbaseobjectthing)

 	Virtual aync funciton that the user can override to provide any custom functionality required.  More...

virtual async Task 	Execute (GestureResult gesture, object annoyingbaseobjectthing)

 	Virtual aync funciton that the user can override to provide any custom functionality required.  More...

Detailed Description

ASyncronous Implmenta tion of the IGesture The execute is asyncronous while the canexecute is syncronous Paramater is an T type

ASyncronous Implmenta tion of the IGesture The execute is asyncronous while the canexecute is syncronous Paramater is an object type

Type Constraints

T	 :	class

Constructor & Destructor Documentation

          XLabs.Forms.Behaviors.RelayGestureAsync< T >.RelayGestureAsync
          (
          Func< GestureResult, T, Task >
          execute,

          Func< GestureResult, T, bool >
          predicate

          )

Builds the Rely Gesture

Parameters

execute	The asyncronous action to execute when the gesture occures

predicate	A function to determine if the action should fire. If ommited the action is always available.

          XLabs.Forms.Behaviors.RelayGestureAsync< T >.RelayGestureAsync
          (
          Func< GestureResult, object, Task >
          execute,

          Func< GestureResult, object, bool >
          predicate

          )

Builds the Rely Gesture

Parameters

execute	The asyncronous action to execute when the gesture occures

predicate	A function to determine if the action should fire. If ommited the action is always available.

Member Function Documentation

          bool XLabs.Forms.Behaviors.RelayGestureAsync< T >.CanExecuteGesture
          (
          GestureResult
          result,

          object
          annoyingbaseobjectthing

          )

Tests to see if a gesture's action can execute

Parameters

result	The final GestureResult

annoyingbaseobjectthing	The Gesture Paramater

Returns

true if the action can execute,false othewise

Implements XLabs.Forms.Behaviors.IGesture.

          bool XLabs.Forms.Behaviors.RelayGestureAsync< T >.CanExecuteGesture
          (
          GestureResult
          result,

          object
          annoyingbaseobjectthing

          )

Tests to see if a gesture's action can execute

Parameters

result	The final GestureResult

annoyingbaseobjectthing	The Gesture Paramater

Returns

true if the action can execute,false othewise

Implements XLabs.Forms.Behaviors.IGesture.

          virtual async Task XLabs.Forms.Behaviors.RelayGestureAsync< T >.Execute
          (
          GestureResult
          gesture,

          object
          annoyingbaseobjectthing

          )

protectedvirtual

Virtual aync funciton that the user can override to provide any custom functionality required.

Parameters

gesture	GestureResult

annoyingbaseobjectthing

Returns

          virtual async Task XLabs.Forms.Behaviors.RelayGestureAsync< T >.Execute
          (
          GestureResult
          gesture,

          object
          annoyingbaseobjectthing

          )

protectedvirtual

Virtual aync funciton that the user can override to provide any custom functionality required.

Parameters

gesture	GestureResult

annoyingbaseobjectthing

Returns

          async void XLabs.Forms.Behaviors.RelayGestureAsync< T >.ExecuteGesture
          (
          GestureResult
          result,

          object
          param

          )

Excutes the asyncronous action assoicated with the gesture

Parameters

result	The final GestureResult

param	The Gesture Paramater

Implements XLabs.Forms.Behaviors.IGesture.

          async void XLabs.Forms.Behaviors.RelayGestureAsync< T >.ExecuteGesture
          (
          GestureResult
          result,

          object
          param

          )

Excutes the asyncronous action assoicated with the gesture

Parameters

result	The final GestureResult

param	The Gesture Paramater

Implements XLabs.Forms.Behaviors.IGesture.

The documentation for this class was generated from the following file:

F:/Projects/Xamarin-Forms-Labs/src/Forms/XLabs.Forms/Behaviors/RelayGestureAsync.cs

XLabs

Forms

Behaviors

RelayGestureAsync

Generated by

     1.8.10