incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hasan (JIRA)" <j...@apache.org>
Subject [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
Date Tue, 25 Jan 2011 15:56:47 GMT
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.


Mime
View raw message