Package eu.planets_project.pp.plato.util

Examples of eu.planets_project.pp.plato.util.MeasurementInfoUri


   
    @OneToOne(cascade=CascadeType.ALL)
    private ChangeLog changeLog = new ChangeLog();
   
    public MeasurementInfoUri toMeasurementInfoUri(){
        MeasurementInfoUri uri = new MeasurementInfoUri(getUri());
        return uri;
    }
View Full Code Here


     *
     * @throws IllegalArgumentException  if uri is invalid, or does not correspond to a criterion category
     * @param uri
     */
    public void fromUri(String uri) throws IllegalArgumentException {
        MeasurementInfoUri info = new MeasurementInfoUri();

        // this may throw an IllegalArgumentException, we do not catch it, but pass it on directly
        info.setAsURI(uri);
        String scheme = info.getScheme();
        String path = info.getPath();
        String fragment = info.getFragment();
       
        // if the URI is empty, reset measurement info
        if ((scheme == null)||(path == null)) {
            property = null;
            metric = null;
View Full Code Here

     * This makes sure that the scales of all leaves match the scales implied by the measurement info uri
     * Can e.g. be used after freemind import, to complete the measurement info
     */
    public void adjustScalesToMeasurements(MeasurementsDescriptor descriptor) {
        for (Leaf l : getRoot().getAllLeaves()) {
            MeasurementInfoUri mInfo = l.getMeasurementInfo().toMeasurementInfoUri();
            if (mInfo.getAsURI() != null) {
                Scale s = descriptor.getMeasurementScale(mInfo);
                if (s != null) {
                    l.adjustScale(s);
                }
            }
View Full Code Here

   
   
   
    @Test
    public void testSetAsUri(){
        MeasurementInfoUri infoUri = new MeasurementInfoUri();
        Assert.assertNull(infoUri.getAsURI(), "not initialised");
        infoUri.setAsURI(null);
        Assert.assertNull(infoUri.getAsURI(), "should be clean");
        infoUri.setAsURI("");
        Assert.assertNull(infoUri.getAsURI(), "should be reset");
       
        infoUri.setAsURI("blabla://");
        Assert.assertEquals("blabla", infoUri.getScheme());
        Assert.assertEquals("blabla://", infoUri.getAsURI());
       
        infoUri.setAsURI("action://runtime");
        Assert.assertEquals("action", infoUri.getScheme());
        Assert.assertEquals("runtime", infoUri.getPath());
        Assert.assertEquals("action://runtime", infoUri.getAsURI());

        infoUri.setAsURI("outcome://object/image/dimension/width#equal");
        Assert.assertEquals("outcome", infoUri.getScheme());
        Assert.assertEquals("object/image/dimension/width", infoUri.getPath());
        Assert.assertEquals("equal", infoUri.getFragment());
        Assert.assertEquals("outcome://object/image/dimension/width#equal", infoUri.getAsURI());
       
        try {
            infoUri.setAsURI("action://runtime//performance");
            Assert.fail("invalid path - should throw exception");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            infoUri.setAsURI("action://runtime://performance");
            Assert.fail("invalid path - should throw exception");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            infoUri.setAsURI("outcome://object/image/dimension/width#equal#holla");
            Assert.fail("invalid fragment - should throw exception");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            infoUri.setAsURI("blabla#://");
            Assert.fail("invalid scheme - should throw exception");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            infoUri.setAsURI("blabla/hoho://");
            Assert.fail("invalid scheme - should throw exception");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            infoUri.setAsURI("blabla");
            Assert.fail("invalid scheme - should throw exception");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }
View Full Code Here

        // before persisting: adjust all scales of leaves
        List<Leaf> leaves = reqexpTree.getRoot().getAllLeaves();
        MeasurementsDescriptor  descriptor = MiniRED.getInstance().getMeasurementsDescriptor();
        for (Leaf l : leaves) {
            MeasurementInfoUri mInfo = l.getMeasurementInfo().toMeasurementInfoUri();
            if (mInfo.getAsURI() != null) {
                Scale s = descriptor.getMeasurementScale(mInfo);
                if (s != null) {
                    l.adjustScale(s);
                }
            }
View Full Code Here

        // list of measurements which shall be evaluated
        List<MeasurementInfoUri> allMeasurementsToEval = new LinkedList<MeasurementInfoUri>();

        for(Leaf l : leaves) {
            // measure this criterion automatically
            MeasurementInfoUri m = l.getMeasurementInfo().toMeasurementInfoUri();
            if ((m != null) && (m.getAsURI() != null)) {
                measurementOfLeaf.put(m , l);
               allMeasurementsToEval.add(m);
            }
        }           
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.util.MeasurementInfoUri

Copyright © 2018 www.massapicom. 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.