Examples of InConstraint


Examples of fr.soleil.lib.flyscan.model.constraints.InConstraint

        Constraint constraint = constraints.get(0);

        assertTrue(constraint instanceof InConstraint);

        InConstraint inConstraint = (InConstraint) constraint;

        assertEquals(3, inConstraint.getPossibleValues().size());

        assertEquals(-100.0, inConstraint.getPossibleValues().get(0));

        assertEquals(100.0, inConstraint.getPossibleValues().get(1));

        assertEquals(150.0, inConstraint.getPossibleValues().get(2));

        boolean isConstraintSatisfied = false;

        Double measurement = new Double(measurementsEntry.getValue());

        assertEquals(3.14116, measurement);

        for (Double d : inConstraint.getPossibleValues()) {
            if (d == measurement) {
                isConstraintSatisfied = true;
            }
        }
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.constraints.InConstraint

                                                        listStr.add(str);
                                                    }
                                                    constraint = new InConstraintStr(listStr);
                                                }
                                            }
                                            constraint = new InConstraint(listDouble);

                                        } else if (value.startsWith(ParsingUtil.IN_RANGE_KEYWORD)) {
                                            String[] lStr = value.replace(ParsingUtil.BRACKET_OPENNING, "")
                                                    .replace(ParsingUtil.BRACKET_CLOSING, "")
                                                    .replace(ParsingUtil.IN_RANGE_KEYWORD, "").split(ParsingUtil.COMMA);
View Full Code Here

Examples of fr.soleil.lib.flyscan.model.constraints.InConstraint

                                        } catch (NumberFormatException e) {
                                            throw new FSParsingException(e.getMessage(), e);
                                        }
                                    }
                                    constraint = new InConstraint(listDouble);

                                } else if (value.startsWith(ParsingUtil.IN_RANGE_KEYWORD)) {
                                    String[] lStr = value.replace(ParsingUtil.BRACKET_OPENNING, "")
                                            .replace(ParsingUtil.BRACKET_CLOSING, "").split(ParsingUtil.COMMA);
                                    if (lStr.length != 2) {
                                        throw new FSParsingException("Can not parse in range constraint value: "
                                                + value);
                                    }
                                    try {
                                        Double min = Double.parseDouble(lStr[0].trim());
                                        Double max = Double.parseDouble(lStr[1].trim());
                                        constraint = new MinMaxConstraint(min, max);
                                    } catch (NumberFormatException e) {
                                        throw new FSParsingException(e.getMessage(), e);
                                    }

                                } else if (ParsingUtil.CONSTANT_KEYWORD.equals(value)) {
                                    constraint = new ConstantConstraint();
                                }
                                if (constraint != null) {
                                    currentParameter.addConstraint(constraint);
                                }

                            }

                        } else if ((key != null) && (key.startsWith(ParsingUtil.IN_LIST_KEYWORD))) {
                            Constraint constraint = null;
                            String[] lStr = value.replace(ParsingUtil.BRACKET_OPENNING, "")
                                    .replace(ParsingUtil.BRACKET_CLOSING, "").split(ParsingUtil.COMMA);
                            List<Double> listDouble = new ArrayList<Double>();

                            try {
                                for (String s : lStr) {
                                    Double d = Double.parseDouble(s.trim());
                                    listDouble.add(d);
                                }
                                constraint = new InConstraint(listDouble);

                            } catch (NumberFormatException e) {
                                List<String> listStr = new ArrayList<String>();
                                for (String str : lStr) {
                                    listStr.add(str);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.