// Path: client/src/main/java/com/github/e13mort/stf/console/AdbRunner.java
// public class AdbRunner {
//     private static final String ADB_DIRECTORY = "platform-tools";
//     private final String androidSdkPath;
//     private static final String TAG_ADB = "ADB";
//     private final Logger logger;
// 
//     AdbRunner(String androidSdkPath, Logger logger) {
//         if (androidSdkPath == null) {
//             androidSdkPath = "";
//         }
//         this.androidSdkPath = androidSdkPath;
//         this.logger = logger;
//     }
// 
//     public void connectToDevice(String connectionUrl) throws IOException {
//         runComplexCommand("adb", "connect", connectionUrl);
//         runComplexCommand("adb", "wait-for-device");
//     }
// 
//     private void runComplexCommand(String... params) throws IOException {
//         File adb = new File(androidSdkPath + File.separator + ADB_DIRECTORY);
//         Process exec = new ProcessBuilder(params)
//                 .directory(adb)
//                 .start();
//         runProcess(exec);
//     }
// 
//     private void runProcess(Process process) throws IOException {
//         final InputStream stream = process.getInputStream();
//         final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
//         try {
//             String line;
//             while ((line = reader.readLine()) != null) {
//                 log(TAG_ADB, line);
//             }
//         } catch (IOException e) {
//             log(e);
//         } finally {
//             reader.close();
//             stream.close();
//         }
//     }
// 
//     private void log(Exception e) {
//         logger.log(Level.INFO, "message {0}", e.getMessage());
//     }
// 
//     private void log(String tag, String message) {
//         logger.info(tag + ": " + message);
//     }
// }
// 
// Path: client/src/main/java/com/github/e13mort/stf/console/commands/cache/DeviceListCache.java
// public interface DeviceListCache {
//     static DeviceListCache getCache() {
//         return new DeviceListCacheImpl();
//     }
// 
//     DeviceListCache EMPTY = new DeviceListCache() {
//         @Override
//         public CacheTransaction beginTransaction() {
//             return CacheTransaction.EMPTY;
//         }
// 
//         @Override
//         public List<Device> getCachedFiles() {
//             return Collections.emptyList();
//         }
//     };
// 
//     CacheTransaction beginTransaction();
// 
//     List<Device> getCachedFiles();
// 
//     interface CacheTransaction {
//         CacheTransaction EMPTY = new CacheTransaction() {
//             @Override
//             public void addDevice(Device device) {
// 
//             }
// 
//             @Override
//             public void save() {
// 
//             }
//         };
// 
//         void addDevice(Device device);
// 
//         void save();
//     }
// }


import com.github.e13mort.stf.adapter.filters.InclusionType;
import com.github.e13mort.stf.adapter.filters.StringsFilterDescription;
import com.github.e13mort.stf.client.FarmClient;
import com.github.e13mort.stf.client.parameters.DevicesParams;
import com.github.e13mort.stf.client.parameters.DevicesParamsImpl;
import com.github.e13mort.stf.console.AdbRunner;
import com.github.e13mort.stf.console.commands.cache.DeviceListCache;
import com.github.e13mort.stf.model.device.Device;
import io.reactivex.Flowable;
import io.reactivex.Notification;
import org.reactivestreams.Publisher;
import java.util.List;
import java.util.logging.Logger;
package com.github.e13mort.stf.console.commands.connect;



class CacheDevicesConnector extends DeviceConnector {

    private final List<Integer> devicesIndexesFromCache;
// Path: client/src/main/java/com/github/e13mort/stf/console/AdbRunner.java
// public class AdbRunner {
//     private static final String ADB_DIRECTORY = "platform-tools";
//     private final String androidSdkPath;
//     private static final String TAG_ADB = "ADB";
//     private final Logger logger;
// 
//     AdbRunner(String androidSdkPath, Logger logger) {
//         if (androidSdkPath == null) {
//             androidSdkPath = "";
//         }
//         this.androidSdkPath = androidSdkPath;
//         this.logger = logger;
//     }
// 
//     public void connectToDevice(String connectionUrl) throws IOException {
//         runComplexCommand("adb", "connect", connectionUrl);
//         runComplexCommand("adb", "wait-for-device");
//     }
// 
//     private void runComplexCommand(String... params) throws IOException {
//         File adb = new File(androidSdkPath + File.separator + ADB_DIRECTORY);
//         Process exec = new ProcessBuilder(params)
//                 .directory(adb)
//                 .start();
//         runProcess(exec);
//     }
// 
//     private void runProcess(Process process) throws IOException {
//         final InputStream stream = process.getInputStream();
//         final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
//         try {
//             String line;
//             while ((line = reader.readLine()) != null) {
//                 log(TAG_ADB, line);
//             }
//         } catch (IOException e) {
//             log(e);
//         } finally {
//             reader.close();
//             stream.close();
//         }
//     }
// 
//     private void log(Exception e) {
//         logger.log(Level.INFO, "message {0}", e.getMessage());
//     }
// 
//     private void log(String tag, String message) {
//         logger.info(tag + ": " + message);
//     }
// }
// 
// Path: client/src/main/java/com/github/e13mort/stf/console/commands/cache/DeviceListCache.java
// public interface DeviceListCache {
//     static DeviceListCache getCache() {
//         return new DeviceListCacheImpl();
//     }
// 
//     DeviceListCache EMPTY = new DeviceListCache() {
//         @Override
//         public CacheTransaction beginTransaction() {
//             return CacheTransaction.EMPTY;
//         }
// 
//         @Override
//         public List<Device> getCachedFiles() {
//             return Collections.emptyList();
//         }
//     };
// 
//     CacheTransaction beginTransaction();
// 
//     List<Device> getCachedFiles();
// 
//     interface CacheTransaction {
//         CacheTransaction EMPTY = new CacheTransaction() {
//             @Override
//             public void addDevice(Device device) {
// 
//             }
// 
//             @Override
//             public void save() {
// 
//             }
//         };
// 
//         void addDevice(Device device);
// 
//         void save();
//     }
// }


// Path: client/src/main/java/com/github/e13mort/stf/console/commands/connect/CacheDevicesConnector.java
import com.github.e13mort.stf.adapter.filters.InclusionType;
import com.github.e13mort.stf.adapter.filters.StringsFilterDescription;
import com.github.e13mort.stf.client.FarmClient;
import com.github.e13mort.stf.client.parameters.DevicesParams;
import com.github.e13mort.stf.client.parameters.DevicesParamsImpl;
import com.github.e13mort.stf.console.AdbRunner;
import com.github.e13mort.stf.console.commands.cache.DeviceListCache;
import com.github.e13mort.stf.model.device.Device;
import io.reactivex.Flowable;
import io.reactivex.Notification;
import org.reactivestreams.Publisher;
import java.util.List;
import java.util.logging.Logger;

package com.github.e13mort.stf.console.commands.connect;



class CacheDevicesConnector extends DeviceConnector {

    private final List<Integer> devicesIndexesFromCache;
    private final DeviceListCache cache;