@Override public int hashCode() { return new HashCodeBuilder().append(getType()).append(baseVertex).append(otherVertex).toHashCode(); }
/** * Constructs a {@link VertexCentricQuery} for this query builder. The query construction and optimization * logic is taken from {@link #constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)} * This method only adds the additional conditions that are based on the base vertex. * * @param vertex for which to construct this query * @param baseQuery as constructed by {@link #constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)} * @return */ protected VertexCentricQuery constructQuery(InternalVertex vertex, BaseVertexCentricQuery baseQuery) { Condition<TitanRelation> condition = baseQuery.getCondition(); if (!baseQuery.isEmpty()) { //Add adjacent-vertex and direction related conditions; copy conditions to so that baseQuery does not change And<TitanRelation> newcond = new And<TitanRelation>(); if (condition instanceof And) newcond.addAll((And) condition); else newcond.add(condition); newcond.add(new DirectionCondition<TitanRelation>(vertex,dir)); if (adjacentVertex != null) newcond.add(new IncidenceCondition<TitanRelation>(vertex,adjacentVertex)); condition = newcond; } VertexCentricQuery query = new VertexCentricQuery(vertex, condition, baseQuery.getDirection(), baseQuery.getQueries(),baseQuery.getOrders(), baseQuery.getLimit()); Preconditions.checkArgument(!queryOnlyLoaded || query.isSimple(),"Query-only-loaded only works on simple queries"); return query; }
/** * Constructs a {@link VertexCentricQuery} for this query builder. The query construction and optimization * logic is taken from {@link #constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)} * This method only adds the additional conditions that are based on the base vertex. * * @param vertex for which to construct this query * @param baseQuery as constructed by {@link #constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)} * @return */ protected VertexCentricQuery constructQuery(InternalVertex vertex, BaseVertexCentricQuery baseQuery) { Condition<TitanRelation> condition = baseQuery.getCondition(); if (!baseQuery.isEmpty()) { //Add adjacent-vertex and direction related conditions; copy conditions to so that baseQuery does not change And<TitanRelation> newcond = new And<TitanRelation>(); if (condition instanceof And) newcond.addAll((And) condition); else newcond.add(condition); newcond.add(new DirectionCondition<TitanRelation>(vertex,dir)); if (adjacentVertex != null) newcond.add(new IncidenceCondition<TitanRelation>(vertex,adjacentVertex)); condition = newcond; } VertexCentricQuery query = new VertexCentricQuery(vertex, condition, baseQuery.getDirection(), baseQuery.getQueries(),baseQuery.getOrders(), baseQuery.getLimit()); Preconditions.checkArgument(!queryOnlyLoaded || query.isSimple(),"Query-only-loaded only works on simple queries"); return query; }
@Override public int hashCode() { return new HashCodeBuilder().append(getType()).append(baseVertex).append(otherVertex).toHashCode(); }
/** * Constructs a {@link VertexCentricQuery} for this query builder. The query construction and optimization * logic is taken from {@link #constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)} * This method only adds the additional conditions that are based on the base vertex. * * @param vertex for which to construct this query * @param baseQuery as constructed by {@link #constructQuery(com.thinkaurelius.titan.graphdb.internal.RelationCategory)} * @return */ protected VertexCentricQuery constructQuery(InternalVertex vertex, BaseVertexCentricQuery baseQuery) { Condition<TitanRelation> condition = baseQuery.getCondition(); if (!baseQuery.isEmpty()) { //Add adjacent-vertex and direction related conditions; copy conditions to so that baseQuery does not change And<TitanRelation> newcond = new And<TitanRelation>(); if (condition instanceof And) newcond.addAll((And) condition); else newcond.add(condition); newcond.add(new DirectionCondition<TitanRelation>(vertex,dir)); if (adjacentVertex != null) newcond.add(new IncidenceCondition<TitanRelation>(vertex,adjacentVertex)); condition = newcond; } VertexCentricQuery query = new VertexCentricQuery(vertex, condition, baseQuery.getDirection(), baseQuery.getQueries(),baseQuery.getOrders(), baseQuery.getLimit()); Preconditions.checkArgument(!queryOnlyLoaded || query.isSimple(),"Query-only-loaded only works on simple queries"); return query; }
@Override public int hashCode() { return new HashCodeBuilder().append(getType()).append(baseVertex).append(otherVertex).toHashCode(); }