tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "pieter martin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TINKERPOP3-766) Make B_O_P_S_SE_SL_Traverser.path mutable
Date Sat, 01 Aug 2015 20:54:04 GMT

    [ https://issues.apache.org/jira/browse/TINKERPOP3-766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14650528#comment-14650528
] 

pieter martin commented on TINKERPOP3-766:
------------------------------------------

This is not needed anymore for my usecase. As I am creating a custom traverser anyway for
optimizing the GraphStep I have added setPath() on the custom traverser.

> Make B_O_P_S_SE_SL_Traverser.path mutable
> -----------------------------------------
>
>                 Key: TINKERPOP3-766
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-766
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.0-incubating
>            Reporter: pieter martin
>            Assignee: Marko A. Rodriguez
>
> B_O_P_S_SE_SL_Traverser.path variable is currently immutable.
> Following on a discussion earlier on the mailing list it needs to be mutable to ensure
that the path reflects the correct state when labeled steps have been collapsed into one optimized
step.
> An indication of how I am using this at the moment in an optimized 'compiled' step is
as follows,
> {code}
>     @Override
>     protected Traverser<E> processNextStart() {
>         while (true) {
>             if (this.iterator.hasNext()) {
>                 Pair<E, Map<String, Object>> next = this.iterator.next();
>                 E e = next.getLeft();
>                 Map<String, Object> labeledObjects = next.getRight();
>                 //split before setting the path.
>                 //This is because the labels must be set on a unique path for every iteration.
>                 Traverser.Admin<E> split = this.head.split(e, this);
>                 for (String label : labeledObjects.keySet()) {
>                     //If there are labels then it must be a B_O_P_S_SE_SL_Traverser
>                     B_O_P_S_SE_SL_Traverser b_o_p_s_se_sl_traverser = (B_O_P_S_SE_SL_Traverser)split;
>                     b_o_p_s_se_sl_traverser.setPath(split.path().extend(labeledObjects.get(label),
new HashSet<>(Collections.singletonList(label))));
>                 }
>                 return split;
>             } else {
>                 this.head = this.starts.next();
>                 this.iterator = this.flatMapCustom(this.head);
>             }
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message