// Path: Java/Blink/library/src/net/qiujuer/blink/core/listener/ConnectListener.java
// public interface ConnectListener {
// 
//     /**
//      * On Receive or Sender socket error call this
//      *
//      * @param connector Connector
//      */
//     void onConnectClosed(Connector connector);
// }
// 
// Path: Java/Blink/library/src/net/qiujuer/blink/core/listener/ReceiveListener.java
// public interface ReceiveListener {
//     /**
//      * On Receiver receive new packet call this
//      *
//      * @param connector Connector
//      * @param packet    ReceivePacket
//      */
//     void onReceiveStart(Connector connector, ReceivePacket packet);
// 
//     /**
//      * Receiver receive packet progress
//      *
//      * @param connector Connector
//      * @param packet    ReceivePacket
//      * @param progress  Receive Progress
//      */
//     void onReceiveProgress(Connector connector, ReceivePacket packet, float progress);
// 
//     /**
//      * On Receiver end receive packet call this
//      *
//      * @param connector Connector
//      * @param packet    ReceivePacket
//      */
//     void onReceiveCompleted(Connector connector, ReceivePacket packet);
// }
// 
// Path: Java/Blink/library/src/net/qiujuer/blink/kit/Disposable.java
// public interface Disposable {
//     /**
//      * Perform related to release or reset unmanaged resources application defined tasks.
//      */
//     void dispose();
// }


import net.qiujuer.blink.async.SelectorFactory;
import net.qiujuer.blink.core.delivery.ConnectDelivery;
import net.qiujuer.blink.core.delivery.ReceiveDelivery;
import net.qiujuer.blink.core.delivery.SendDelivery;
import net.qiujuer.blink.core.listener.ConnectListener;
import net.qiujuer.blink.core.listener.ReceiveListener;
import net.qiujuer.blink.kit.Disposable;
import java.util.UUID;
/*
 * Copyright (C) 2014 Qiujuer <qiujuer@live.cn>
 * WebSite http://www.qiujuer.net
 * Created 04/25/2015
 * Changed 04/25/2015
 * Version 1.0.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.qiujuer.blink.core;



/**
 * Connector
 */
public abstract class Connector implements Disposable {
    // Default buffer size
    public static final int DEFAULT_BUFFER_SIZE = 4096;
    // Default progress precision
    public static final float DEFAULT_PROGRESS_PRECISION = 0.001F;

    private String mId = UUID.randomUUID().toString();

    private int mBufferSize = DEFAULT_BUFFER_SIZE;
    private float mProgressPrecision = DEFAULT_PROGRESS_PRECISION;

    protected boolean isClosed = true;

    protected Sender mSender;
    protected Receiver mReceiver;

// Path: Java/Blink/library/src/net/qiujuer/blink/core/listener/ConnectListener.java
// public interface ConnectListener {
// 
//     /**
//      * On Receive or Sender socket error call this
//      *
//      * @param connector Connector
//      */
//     void onConnectClosed(Connector connector);
// }
// 
// Path: Java/Blink/library/src/net/qiujuer/blink/core/listener/ReceiveListener.java
// public interface ReceiveListener {
//     /**
//      * On Receiver receive new packet call this
//      *
//      * @param connector Connector
//      * @param packet    ReceivePacket
//      */
//     void onReceiveStart(Connector connector, ReceivePacket packet);
// 
//     /**
//      * Receiver receive packet progress
//      *
//      * @param connector Connector
//      * @param packet    ReceivePacket
//      * @param progress  Receive Progress
//      */
//     void onReceiveProgress(Connector connector, ReceivePacket packet, float progress);
// 
//     /**
//      * On Receiver end receive packet call this
//      *
//      * @param connector Connector
//      * @param packet    ReceivePacket
//      */
//     void onReceiveCompleted(Connector connector, ReceivePacket packet);
// }
// 
// Path: Java/Blink/library/src/net/qiujuer/blink/kit/Disposable.java
// public interface Disposable {
//     /**
//      * Perform related to release or reset unmanaged resources application defined tasks.
//      */
//     void dispose();
// }


// Path: Java/Blink/library/src/net/qiujuer/blink/core/Connector.java
import net.qiujuer.blink.async.SelectorFactory;
import net.qiujuer.blink.core.delivery.ConnectDelivery;
import net.qiujuer.blink.core.delivery.ReceiveDelivery;
import net.qiujuer.blink.core.delivery.SendDelivery;
import net.qiujuer.blink.core.listener.ConnectListener;
import net.qiujuer.blink.core.listener.ReceiveListener;
import net.qiujuer.blink.kit.Disposable;
import java.util.UUID;

/*
 * Copyright (C) 2014 Qiujuer <qiujuer@live.cn>
 * WebSite http://www.qiujuer.net
 * Created 04/25/2015
 * Changed 04/25/2015
 * Version 1.0.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.qiujuer.blink.core;



/**
 * Connector
 */
public abstract class Connector implements Disposable {
    // Default buffer size
    public static final int DEFAULT_BUFFER_SIZE = 4096;
    // Default progress precision
    public static final float DEFAULT_PROGRESS_PRECISION = 0.001F;

    private String mId = UUID.randomUUID().toString();

    private int mBufferSize = DEFAULT_BUFFER_SIZE;
    private float mProgressPrecision = DEFAULT_PROGRESS_PRECISION;

    protected boolean isClosed = true;

    protected Sender mSender;
    protected Receiver mReceiver;

    protected ConnectListener mConnectListener;