org.apache.tinkerpop.gremlin.structure.T.equals()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.apache.tinkerpop.gremlin.structure.T.equals()方法的一些代码示例,展示了T.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。T.equals()方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.structure.T
类名称:T
方法名:equals

T.equals介绍

暂无

代码示例

代码示例来源:origin: apache/tinkerpop

private static char isLocalStarGraph(final Traversal.Admin<?, ?> traversal, char state) {
  if (state == 'u' &&
      (traversal instanceof ElementValueTraversal ||
          (traversal instanceof TokenTraversal && !((TokenTraversal) traversal).getToken().equals(T.id))))
    return 'x';
  for (final Step step : traversal.getSteps()) {

代码示例来源:origin: apache/tinkerpop

public default ElementRequirement getMaxRequirement() {
  ElementRequirement max = ElementRequirement.ID;
  if (this instanceof TraversalParent) {
    for (final Traversal.Admin<Object, Object> traversal : ((TraversalParent) this).getLocalChildren()) {
      if (traversal instanceof IdentityTraversal) {
        if (max.compareTo(ElementRequirement.ID) < 0)
          max = ElementRequirement.ID;
      } else if (traversal instanceof TokenTraversal && ((TokenTraversal) traversal).getToken().equals(T.id)) {
        if (max.compareTo(ElementRequirement.ID) < 0)
          max = ElementRequirement.ID;
      } else if (traversal instanceof TokenTraversal && ((TokenTraversal) traversal).getToken().equals(T.label)) {
        if (max.compareTo(ElementRequirement.LABEL) < 0)
          max = ElementRequirement.LABEL;
      } else if (traversal instanceof ElementValueTraversal) {
        if (max.compareTo(ElementRequirement.PROPERTIES) < 0)
          max = ElementRequirement.PROPERTIES;
      } else {
        max = ElementRequirement.EDGES;
      }
    }
  }
  return max;
}

代码示例来源:origin: stackoverflow.com

public boolean remove(T item) {
  Iterator<T> iter = bag.iterator();
  while (iter.hasNext()) {
    T i = iter.next();
      if (i.equals(item)) {
        iter.remove();
        return true;
      }
  }
  return false;
}

代码示例来源:origin: stackoverflow.com

for (Iterator<T> iterator = list.iterator(); iterator.hasNext(); ) {
  T element = iterator.next();
  if (element.equals(elementToRemove)) {
    iterator.remove();
  }
}

代码示例来源:origin: stackoverflow.com

ArrayList<T> matches = new ArrayList<T>;   // T is your object type, e.g. String
for (T item : myObjects) {
  if (item.equals(thingToMatch))
   matches.add(item);
}

代码示例来源:origin: stackoverflow.com

Collection<T> ts;
f(ts, new Predicate<T> () { 
      public boolean test(T element) { 
           return element.equals("foo"); 
      }
 });

Collection<P> ps;
f(ps, new Predicate<P> () { 
      public boolean test(P element) { 
           return element.getT().equals("foo"); 
      }
});

代码示例来源:origin: stackoverflow.com

public T remove(T elt) {
 for (int i=0; i<data.length; ++i) {
   if (elt.equals(data[i]) ) {
     data[i] = null;
     for (++i; i < data.length; ++i) {
       data[i-1] = data[i];
     }
     break;
   }
 }

代码示例来源:origin: stackoverflow.com

public boolean contain(T o) {
  if (o == null) { // assuming that your list accept to add null object
    for (Node<T> x = first; x != null; x = x.next) {
      if (x.data == null)
        return true;
    }
  } else {
    for (Node<T> x = first; x != null; x = x.next) {
      if (o.equals(x.data))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: stackoverflow.com

public int getPosition(T anObject)  {
  int position = 0;
  Node currentNode = firstNode;

  while(currentNode != null) {
    if(anObject.equals(currentNode.data)) {
      break; // we found our node so we can stop searching
    }
    position++;
    currentNode = currentNode.next;
  }

  // we iterated through the whole list and didn't find the node
  if(currentNode == null) {
    return -1; // or some other error value
  }

  return position;
}

代码示例来源:origin: stackoverflow.com

public LinkedList<T> toSet()
{
  LinkedList<T> retList; 
  retList = lista;
  Iterator<T> iter1 = retList.iterator();
  int index1 = 0;
  while (iter1.hasNext()) {
    T elem1 = iter1.next();
    Iterator<T> iter2 = retList.iterator();
    int index2 = 0;
    while (iter2.hasNext())
    {
      T elem2 = iter2.next();
      if(index1 != index2 && elem1.equals(elem2)) 
        iter2.remove();
      index2++;
    }
    index1++;
  }

  return retList;
}

代码示例来源:origin: stackoverflow.com

public iterator search(T data)
{
  no<T> temp = first;
  while (!data.equals(temp.data)) {
    temp = temp.next;
  }
  return (new iterator(temp));
}

代码示例来源:origin: stackoverflow.com

public BagInterface<T>  union(T[] item) {
   List<T> unionList = Arrays.asList(this.bag);
   for(T elem: item){
     boolean present = false;
     for(T elem1: this.bag){
      if(elem1.equals(elem)){
        present = true;
      }
     }
     if(!present){
       unionList.add(elem);
     }
   }
   this.bag = unionList.toArray(new Bag[unionList.size()]);
   return this;
  }

代码示例来源:origin: stackoverflow.com

public BinarySearchTreeNode<T> getParent(BinarySearchTreeNode<T> e) {
  if (e == null) {
    return null;
  }
  BinarySearchTreeNode<T> current = this.root;
  T eValue = e.getValue();
  while (current != null) {
    if (howManyChildren(current) == 0) {
      return null;
    } else if ((current.getLeft()!=null && eValue.equals(current.getLeft().getValue()))
        || (current.getRight()!=null) && eValue.equals(current.getRight().getValue())) {
      return current;
    } else if (eValue.compareTo(current.getValue()) < 0) {
      current = current.getLeft();
    } else {
      current = current.getRight();
    }
  }
  return null;

}

代码示例来源:origin: stackoverflow.com

public void compareLists(final List<T> allProcesses, final List<T> runningProcesses) {
  // Assume lists are sorted, if not call Collection.sort() on each list (making this O(nlogn))
  final Iterator<T> allIter = allProcesses.iterator();
  final Iterator<T> runningIter = runningProcesses.iterator();
  T allEntry;
  T runningEntry;
  while (allIter.hasNext() && runningIter.hasNext()) {
    allEntry = allIter.next();
    runningEntry = runningIter.next();
    while (!allEntry.equals(runningEntry) && allIter.hasNext()) {
      System.out.println(allEntry);
      allEntry = allIter.next();
    }
    // Now we know allEntry == runningEntry, so we can go through to the next iteration
  }
  // No more running processes, so just print the remaining entries in the all processes list
  while (allIter.hasNext()) {
    System.out.println(allIter.next());
  }
}

代码示例来源:origin: stackoverflow.com

Map<T, Integer> rankMap = new HashMap<>(coll.size());
int rank = 0;
for (T t : coll)
  rankMap.put(t, t.equals(first) ? -1 : rank++);
Comparator<T> cmp = Comparator.comparing(rankMap::get);

代码示例来源:origin: opencypher/cypher-for-gremlin

private boolean isProperty(Entry<?, ?> e, boolean gremlinTokensCanBeMapKeys) {
    if (gremlinTokensCanBeMapKeys) {
      return !T.id.equals(e.getKey()) &&
        !T.label.equals(e.getKey());
    } else {
      return !("label".equals(e.getKey()) && !isVertexValueList(e.getValue())) &&
        !("id".equals(e.getKey()) && !isVertexValueList(e.getValue()));
    }
  }
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {

  foo Foo = new foo();
  System.out.println(Foo.compare(100L, 100));
  System.out.println(Foo.compare(100L, 100L));
  System.out.println(Foo.compare(127L, 127L));
  System.out.println(Foo.compare(128L, 128L));

  System.out.println();
  System.out.println(System.getProperty("java.vendor"));
  System.out.println(System.getProperty("java.version"));

}

public boolean compare( T val1, T val2) {
  return ( val1.equals(val2) ) ? true : false; // use equal instead
}

代码示例来源:origin: stackoverflow.com

@Override
public void commitEdit(T item) {

  // This block is necessary to support commit on losing focus, because the baked-in mechanism
  // sets our editing state to false before we can intercept the loss of focus.
  // The default commitEdit(...) method simply bails if we are not editing...
  if (! isEditing() && ! item.equals(getItem())) {
    TableView<S> table = getTableView();
    if (table != null) {
      TableColumn<S, T> column = getTableColumn();
      CellEditEvent<S, T> event = new CellEditEvent<>(table, 
          new TablePosition<S,T>(table, getIndex(), column), 
          TableColumn.editCommitEvent(), item);
      Event.fireEvent(column, event);
    }
  }

  super.commitEdit(item);
}

代码示例来源:origin: stackoverflow.com

private int binarySearchRecursive(int first, int last, T desiredItem) 
{
  int position = 0;
  int mid = (first + last) / 2;
  if (first > last)
    position =  -(last + 1);
  else if (desiredItem.equals(list[mid]))
    position = mid;
  else if (desiredItem.compareTo(list[mid]) < 0)
    position = binarySearchRecursive(first, mid -1, desiredItem);
  else 
    position = binarySearchRecursive(mid + 1, last, desiredItem);
  return position;
}

代码示例来源:origin: com.orientechnologies/orientdb-gremlin

@Override
public <U> Property<U> property(String key, U value) {
 if (T.id.equals(key))
  throw VertexProperty.Exceptions.userSuppliedIdsNotSupported();
 ODocument metadata = getMetadataDocument();
 metadata.field(key, value);
 return new OrientVertexPropertyProperty<>(key, value, this);
}

相关文章