Examples of IntRange


Examples of groovy.lang.IntRange

                "123456",
                "Property [{0}] of class [{1}] with value [{2}] does not fall within the valid size range from [{3}] to [{4}]");
    }

    public void testCreation() {
        SizeConstraint constraint = (SizeConstraint) getConstraint("testInteger", new IntRange(1,5));
        assertEquals(ConstrainedProperty.SIZE_CONSTRAINT, constraint.getName());
        assertTrue(constraint.supports(List.class));
        assertTrue(constraint.supports(Collection.class));
        assertTrue(constraint.supports(Double[].class));
        assertFalse(constraint.supports(Object.class));
        assertFalse(constraint.supports(null));
        assertFalse(constraint.supports(Integer.class));
        assertFalse(constraint.supports(Number.class));
        assertEquals(new IntRange(1,5), constraint.getRange());

        try {
            getConstraint("testInteger", "wrong");
            fail("SizeConstraint must throw an exception for non-range parameters.");
        } catch(IllegalArgumentException iae) {
View Full Code Here

Examples of groovy.lang.IntRange

        List<String> lines = StringGroovyMethods.readLines(body);

        // split the form-data lines around the boundaries
        // remove a first surrounding empty lines and closing boundary
        // trim the last \n characters
        List<String> parts = DefaultGroovyMethods.getAt(body.split(lines.get(0).trim()), new IntRange(true, 1,-2));
        for (int i = 0; i < parts.size(); i++) {
            parts.set(i, parts.get(i).trim());
        }       

        // reads the part keys and values into a Map
View Full Code Here

Examples of groovy.lang.IntRange

        assertEquals("substring(1,3)", object.substring(1, 3), value);
    }

    public void testListGetWithRange() throws Throwable {
        List list = Arrays.asList(new Object[]{"a", "b", "c"});
        Object range = new IntRange(true, 0, 2);
        Object value = invoke(list, "getAt", range);
        assertTrue("Returned List: " + value, value instanceof List);
        List retList = (List) value;
        assertEquals("List size", 3, retList.size());
    }
View Full Code Here

Examples of groovy.lang.IntRange

        // case, we need to reverse them and make sure the range's 'reverse'
        // property is correct.
        // TODO We should probably use DefaultGroovyMethodsSupport.subListBorders(),
        // but that's protected and unavailable to us.
        if (from > to) {
            r = r.isReverse() ? new IntRange(to, from) : new IntRange(from, to);
            from = r.getFromInt();
            to = r.getToInt();
        }

        // Copy the required nodes into a new list.
View Full Code Here

Examples of org.apache.commons.lang.math.IntRange

     * {@inheritDoc}
     */
    @Override
    public boolean isValid(List<PollItem> pollItems, ConstraintValidatorContext context) {
        if (!CollectionUtils.isEmpty(pollItems)) {
            Range range = new IntRange(minSize, maxSize);
            return range.containsInteger(pollItems.size());
        }
        return true;
    }
View Full Code Here

Examples of org.apache.commons.lang.math.IntRange

     * @return {@code true} if poll item name has correct length,
     *         otherwise {@code false}
     */
    private boolean isPollItemValid(PollItem pollItem) {
        String pollItemName = pollItem.getName();
        Range range = new IntRange(minLength, maxLenght);
        int pollItemLength = pollItemName.length();
        return range.containsInteger(pollItemLength);
    }
View Full Code Here

Examples of org.carrot2.util.attribute.constraint.IntRange

            hasNegativeValues = (r == null || r.min() < 0);
            unbounded = (r == null || NumberUtils.isUnbounded(r));
        }
        else
        {
            final IntRange r = NumberUtils.getIntRange(descriptor);

            hasNegativeValues = (r == null || r.min() < 0);
            unbounded = (r == null || NumberUtils.isUnbounded(r));
        }

        final IAttributeEditor delegate;
        if (unbounded)
View Full Code Here

Examples of org.encog.engine.util.IntRange

        high = this.workloadSize - 1;
      } else {
        high = ((i + 1) * sizePerThread) - 1;
      }

      result.add(new IntRange(high, low));
    }

    return result;
  }
View Full Code Here

Examples of org.encog.mathutil.IntRange

        high = this.workloadSize - 1;
      } else {
        high = ((i + 1) * sizePerThread) - 1;
      }

      result.add(new IntRange(high, low));
    }

    return result;
  }
View Full Code Here

Examples of org.rlcommunity.rlglue.codec.taskspec.ranges.IntRange

        TaskSpecVRLGLUE3 theTaskSpecObject = new TaskSpecVRLGLUE3();
        theTaskSpecObject.setEpisodic();
        theTaskSpecObject.setDiscountFactor(1.0d);

        //Specify that there will be an integer observation [0,107] for the state
        theTaskSpecObject.addDiscreteObservation(new IntRange(0, theWorld.getNumStates() - 1));
        //Specify that there will be an integer action [0,3]
        theTaskSpecObject.addDiscreteAction(new IntRange(0, 3));
        //Specify the reward range [-100,10]
        theTaskSpecObject.setRewardRange(new DoubleRange(-100.0d, 10.0d));

        theTaskSpecObject.setExtra("SampleMinesEnvironment(Java) by Brian Tanner.");
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.