Esempio n. 1
0
        public override LabelSet Labels()
        {
            if (HasChanges())
            {
                TransactionState txState = _read.txState();
                if (txState.NodeIsAddedInThisTx(_storeCursor.entityReference()))
                {
                    //Node just added, no reason to go down to store and check
                    return(Labels.From(txState.NodeStateLabelDiffSets(_storeCursor.entityReference()).Added));
                }
                else
                {
                    //Get labels from store and put in intSet, unfortunately we get longs back
                    long[] longs = _storeCursor.labels();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableLongSet labels = new org.eclipse.collections.impl.set.mutable.primitive.LongHashSet();
                    MutableLongSet labels = new LongHashSet();
                    foreach (long labelToken in longs)
                    {
                        labels.add(labelToken);
                    }

                    //Augment what was found in store with what we have in tx state
                    return(Labels.From(txState.AugmentLabels(labels, txState.GetNodeState(_storeCursor.entityReference()))));
                }
            }
            else
            {
                //Nothing in tx state, just read the data.
                return(Labels.From(_storeCursor.labels()));
            }
        }
Esempio n. 2
0
        public override bool HasLabel(int label)
        {
            if (HasChanges())
            {
                TransactionState txState  = _read.txState();
                LongDiffSets     diffSets = txState.NodeStateLabelDiffSets(_storeCursor.entityReference());
                if (diffSets.Added.contains(label))
                {
                    return(true);
                }
                if (diffSets.Removed.contains(label))
                {
                    return(false);
                }
            }

            //Get labels from store and put in intSet, unfortunately we get longs back
            return(_storeCursor.hasLabel(label));
        }