当前位置: 首页>>代码示例>>Java>>正文


Java Pair.getValue方法代码示例

本文整理汇总了Java中com.musala.atmosphere.commons.util.Pair.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getValue方法的具体用法?Java Pair.getValue怎么用?Java Pair.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.musala.atmosphere.commons.util.Pair的用法示例。


在下文中一共展示了Pair.getValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUiSelectorPackageWithSelectionOption

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
private static UiSelector setUiSelectorPackageWithSelectionOption(UiSelector uiSelector, Pair<String, UiElementSelectionOption> propertyPair) {
    switch (propertyPair.getValue()) {
        case CONTAINS:
            String pattern = "^.*%s.*$";
            uiSelector = uiSelector.packageNameMatches(String.format(pattern, propertyPair.getKey()));
            break;
        case EQUALS:
            uiSelector = uiSelector.packageName(propertyPair.getKey());
            break;
        case WORD_MATCH:
            uiSelector = uiSelector.packageNameMatches(propertyPair.getKey());
            break;
        default:
            uiSelector = uiSelector.packageName(propertyPair.getKey());
            break;
    }

    return uiSelector;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:20,代码来源:UiSelectorParser.java

示例2: parseAndExecuteShellCommand

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
/**
 * Executes a passed shell command from the console.
 *
 * @param passedShellCommand
 *        - the passed shell command.
 * @throws IllegalArgumentException
 *         - if the passed argument is <b>null</b>
 */
public void parseAndExecuteShellCommand(String passedShellCommand) {
    if (passedShellCommand != null) {
        Pair<String, List<String>> parsedCommand = ConsoleControl.parseShellCommand(passedShellCommand);
        String command = parsedCommand.getKey();
        List<String> params = parsedCommand.getValue();

        AgentCommand commandForExecution = AgentCommandFactory.getCommandInstance(command, params);
        if (commandForExecution != null) {
            currentAgentState.executeCommand(commandForExecution);
        } else {
            String helpCommand = AgentConsoleCommands.AGENT_HELP.getCommand();
            String errorMessage = String.format("Unknown command \"%s\". Type '%s' for all available commands.",
                                                command,
                                                helpCommand);
            agentConsole.writeLine(errorMessage);
        }
    } else {
        LOGGER.error("Error in console: trying to execute 'null' as a command.");
        throw new IllegalArgumentException("Command passed for execution to agent is 'null'");
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:30,代码来源:Agent.java

示例3: validatePointOnScreen

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
/**
 * Checks whether the given point is inside the bounds of the screen, and throws an {@link IllegalArgumentException}
 * otherwise.
 *
 * @param point
 *        - the point to be checked
 */
private void validatePointOnScreen(Point point) {
    Pair<Integer, Integer> resolution = deviceInformation.getResolution();

    boolean hasPositiveCoordinates = point.getX() >= 0 && point.getY() >= 0;
    boolean isOnScreen = point.getX() <= resolution.getKey() && point.getY() <= resolution.getValue();

    if (!hasPositiveCoordinates || !isOnScreen) {
        String exeptionMessageFormat = "The passed point with coordinates (%d, %d) is outside the bounds of the screen. Screen dimentions (%d, %d)";
        String message = String.format(exeptionMessageFormat,
                                       point.getX(),
                                       point.getY(),
                                       resolution.getKey(),
                                       resolution.getValue());
        LOGGER.error(message);
        throw new IllegalArgumentException(message);
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:25,代码来源:GestureEntity.java

示例4: Device

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
/**
 * Creates new device with the given serial number, device identifier and passkey.
 *
 * @param deviceInformation
 *        - the {@link DeviceInformation information} of this device
 * @param deviceId
 *        - the identifier of this device
 * @param passkeyAuthority
 *        - a passkey for validating authority
 */
public Device(DeviceInformation deviceInformation, String deviceId, long passkeyAuthority) {
    apiLevel = deviceInformation.getApiLevel();
    cpu = deviceInformation.getCpu();
    dpi = deviceInformation.getDpi();
    manufacturer = deviceInformation.getManufacturer();
    model = deviceInformation.getModel();
    os = deviceInformation.getOS();
    ram = deviceInformation.getRam();
    Pair<Integer, Integer> resolution = deviceInformation.getResolution();
    resolutionWidth = resolution.getValue();
    resolutionHeight = resolution.getKey();
    serialNumber = deviceInformation.getSerialNumber();
    isEmulator = deviceInformation.isEmulator();
    isTablet = deviceInformation.isTablet();
    hasCamera = deviceInformation.hasCamera();
    this.deviceId = deviceId;
    passkey = passkeyAuthority;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-server,代码行数:29,代码来源:Device.java

示例5: setDeviceInformation

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
@Override
public void setDeviceInformation(DeviceInformation information) {
    apiLevel = information.getApiLevel();
    cpu = information.getCpu();
    dpi = information.getDpi();
    manufacturer = information.getManufacturer();
    model = information.getModel();
    os = information.getOS();
    ram = information.getRam();
    Pair<Integer, Integer> resolution = information.getResolution();
    resolutionWidth = resolution.getValue();
    resolutionHeight = resolution.getKey();
    serialNumber = information.getSerialNumber();
    isEmulator = information.isEmulator();
    isTablet = information.isTablet();
    hasCamera = information.hasCamera();
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-server,代码行数:18,代码来源:Device.java

示例6: parseAndExecuteShellCommand

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
/**
 * Executes a passed command from the console.
 *
 * @param passedShellCommand
 *        - the passed shell command.
 * @throws IOException
 */
private void parseAndExecuteShellCommand(String passedShellCommand) throws IOException {
    if (passedShellCommand != null) {
        Pair<String, List<String>> parsedCommand = ConsoleControl.parseShellCommand(passedShellCommand);
        String command = parsedCommand.getKey();
        List<String> paramsAsList = parsedCommand.getValue();

        if (!command.isEmpty()) {
            String[] params = new String[paramsAsList.size()];
            paramsAsList.toArray(params);
            executeShellCommand(command, params);
        }
    } else {
        LOGGER.error("Error in console: trying to execute 'null' as a command.");
        throw new IllegalArgumentException("Command passed to server is 'null'");
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-server,代码行数:24,代码来源:Server.java

示例7: setUiSelectorClassNameWithSelectionOption

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
private static UiSelector setUiSelectorClassNameWithSelectionOption(UiSelector uiSelector, Pair<String, UiElementSelectionOption> propertyPair) {
    switch (propertyPair.getValue()) {
        case CONTAINS:
            String pattern = "^.*%s.*$";
            uiSelector = uiSelector.classNameMatches(String.format(pattern, propertyPair.getKey()));
            break;
        case EQUALS:
            uiSelector = uiSelector.className(propertyPair.getKey());
            break;
        case WORD_MATCH:
            uiSelector = uiSelector.classNameMatches(propertyPair.getKey());
            break;
        default:
            uiSelector = uiSelector.className(propertyPair.getKey());
            break;
    }

    return uiSelector;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:20,代码来源:UiSelectorParser.java

示例8: setUiSelectorTextWithSelectionOption

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
private static UiSelector setUiSelectorTextWithSelectionOption(UiSelector uiSelector, Pair<String, UiElementSelectionOption> propertyPair) {
    switch (propertyPair.getValue()) {
        case CONTAINS:
            uiSelector = uiSelector.textContains(propertyPair.getKey());
            break;
        case EQUALS:
            uiSelector = uiSelector.text(propertyPair.getKey());
            break;
        case WORD_MATCH:
            uiSelector = uiSelector.textMatches(propertyPair.getKey());
            break;
        default:
            uiSelector = uiSelector.text(propertyPair.getKey());
            break;

    }

    return uiSelector;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:20,代码来源:UiSelectorParser.java

示例9: setUiSelectorDescriptionWithSelectionOption

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
private static UiSelector setUiSelectorDescriptionWithSelectionOption(UiSelector uiSelector, Pair<String, UiElementSelectionOption> propertyPair) {
    switch (propertyPair.getValue()) {
        case CONTAINS:
            uiSelector = uiSelector.descriptionContains(propertyPair.getKey());
            break;
        case EQUALS:
            uiSelector = uiSelector.description(propertyPair.getKey());
            break;
        case WORD_MATCH:
            uiSelector = uiSelector.descriptionMatches(propertyPair.getKey());
            break;
        default:
            uiSelector = uiSelector.description(propertyPair.getKey());
            break;
    }

    return uiSelector;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-uiautomator-bridge,代码行数:19,代码来源:UiSelectorParser.java

示例10: isMatch

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
private boolean isMatch(Pair<String, UiElementSelectionOption> selectorPair, String nodeValue) {
    if (nodeValue == null) {
        return false;
    }
    switch (selectorPair.getValue()) {
        case CONTAINS:
            return nodeValue.contains(selectorPair.getKey());
        case EQUALS:
            return nodeValue.equals(selectorPair.getKey());
        case WORD_MATCH:
            return nodeValue.matches(selectorPair.getKey());
        default:
            return nodeValue.equals(selectorPair.getKey());
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-commons,代码行数:16,代码来源:UiElementSelectorMatcherCompat.java

示例11: testDevicePinchInInvalidPoint

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testDevicePinchInInvalidPoint() {
    DeviceInformation deviceInfo = testDevice.getInformation();
    Pair<Integer, Integer> resolution = deviceInfo.getResolution();
    Point testPoint = new Point(resolution.getKey() + 1, resolution.getValue() + 1);

    testDevice.pinchIn(testPoint, testPoint);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:9,代码来源:PinchTest.java

示例12: testDevicePinchOutInvalidPoint

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testDevicePinchOutInvalidPoint() {
    DeviceInformation deviceInfo = testDevice.getInformation();
    Pair<Integer, Integer> resolution = deviceInfo.getResolution();
    Point testPoint = new Point(resolution.getKey() + 1, resolution.getValue() + 1);

    testDevice.pinchOut(testPoint, testPoint);
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:9,代码来源:PinchTest.java

示例13: checkClients

import com.musala.atmosphere.commons.util.Pair; //导入方法依赖的package包/类
/**
 * Checks whether a client {@link DeviceSelector selector} is applicable to the newly available device(published or
 * released).
 *
 * @param deviceInformation
 *        - information about the {@link IDevice device}
 */
private void checkClients(DeviceInformation deviceInformation) {
    synchronized (waitingClients) {
        availableDeviceLatch = new CountDownLatch(COUNTDOWN_NUMBER);

        ListIterator<Pair<DeviceSelector, String>> li = waitingClients.listIterator(waitingClients.size());
        while (li.hasPrevious()) {
            Pair<DeviceSelector, String> clientInfo = li.previous();
            DeviceSelector deviceSelector = clientInfo.getKey();
            String clientId = clientInfo.getValue();

            boolean isApplicable = slectorResolver.isApplicable(deviceSelector, deviceInformation);

            if (isApplicable) {
                DeviceAllocationInformation dAlloc = allocate(deviceSelector);

                if (dAlloc != null) {
                    li.remove();
                    clientIdForDeviceAllocationInformation.put(clientId, dAlloc);
                    clientIdForLatch.get(clientId).countDown();
                    break;
                }
            }
        }

        availableDeviceLatch.countDown();
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-server,代码行数:35,代码来源:DeviceAllocationManager.java


注:本文中的com.musala.atmosphere.commons.util.Pair.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。