You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by "Hasan (JIRA)" <ji...@apache.org> on 2011/01/25 16:56:47 UTC

[jira] Created: (CLEREZZA-409) Various methods in SecuredTripleCollection use iterator() of the wrapped TripleCollection instead of delegating to the corresponding method in the wrapped TripleCollection

Various methods in SecuredTripleCollection use iterator() of the wrapped TripleCollection instead of delegating to the corresponding method in the wrapped TripleCollection
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: CLEREZZA-409
                 URL: https://issues.apache.org/jira/browse/CLEREZZA-409
             Project: Clerezza
          Issue Type: Improvement
            Reporter: Hasan
            Assignee: Hasan


The contains method of SecuredTripleCollection looks as follows:
	@Override
	public boolean contains(Object o) {
		checkRead();
		Iterator<Triple> e = wrapped.iterator();
		if (o==null) {
			while (e.hasNext())
			if (e.next()==null)
				return true;
		} else {
			while (e.hasNext())
			if (o.equals(e.next()))
				return true;
		}
		return false;
	}

Calling wrapped.iterator() (which will lead to graph filtering by no specification of subject, predicate, and object ) and then iterating through the result set is expensive.

Instead, the contains method could be implemented as follows:
	@Override
	public boolean contains(Object o) {
		checkRead();
		return wrapped.contains((Triple) o);
	}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (CLEREZZA-409) Various methods in SecuredTripleCollection use iterator() of the wrapped TripleCollection instead of delegating to the corresponding method in the wrapped TripleCollection

Posted by "Hasan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLEREZZA-409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hasan closed CLEREZZA-409.
--------------------------

    Resolution: Fixed

> Various methods in SecuredTripleCollection use iterator() of the wrapped TripleCollection instead of delegating to the corresponding method in the wrapped TripleCollection
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-409
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-409
>             Project: Clerezza
>          Issue Type: Improvement
>            Reporter: Hasan
>            Assignee: Hasan
>
> The contains method of SecuredTripleCollection looks as follows:
> 	@Override
> 	public boolean contains(Object o) {
> 		checkRead();
> 		Iterator<Triple> e = wrapped.iterator();
> 		if (o==null) {
> 			while (e.hasNext())
> 			if (e.next()==null)
> 				return true;
> 		} else {
> 			while (e.hasNext())
> 			if (o.equals(e.next()))
> 				return true;
> 		}
> 		return false;
> 	}
> Calling wrapped.iterator() (which will lead to graph filtering by no specification of subject, predicate, and object ) and then iterating through the result set is expensive.
> Instead, the contains method could be implemented as follows:
> 	@Override
> 	public boolean contains(Object o) {
> 		checkRead();
> 		return wrapped.contains((Triple) o);
> 	}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.