本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.Property.isPresent方法的典型用法代码示例。如果您正苦于以下问题:Java Property.isPresent方法的具体用法?Java Property.isPresent怎么用?Java Property.isPresent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.structure.Property
的用法示例。
在下文中一共展示了Property.isPresent方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: properties
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
@Override
// THERE ARE TWO MORE COPIES OF THIS CODE IN ELEMENT AND VERTEX
public <T> Iterator<Property<T>> properties(String... propertyKeys) {
ArrayList<Property<T>> ans = new ArrayList<Property<T>>();
if (propertyKeys.length == 0) {
if (this.properties == null) return Collections.emptyIterator();
propertyKeys = this.properties.getPropertyKeys();
}
for (String key : propertyKeys) {
Property<T> prop = property(key);
if (prop.isPresent()) ans.add(prop);
}
return ans.iterator();
}
示例2: areEqual
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
/**
* A standard method for determining if two {@link org.apache.tinkerpop.gremlin.structure.Property} objects are equal. This method should be used by any
* {@link Object#equals(Object)} implementation to ensure consistent behavior.
*
* @param a the first {@link org.apache.tinkerpop.gremlin.structure.Property}
* @param b the second {@link org.apache.tinkerpop.gremlin.structure.Property}
* @return true if equal and false otherwise
*/
public static boolean areEqual(final Property a, final Object b) {
if (null == a)
throw Graph.Exceptions.argumentCanNotBeNull("a");
if (null == b)
throw Graph.Exceptions.argumentCanNotBeNull("b");
if (a == b)
return true;
if (!(b instanceof Property))
return false;
if (!a.isPresent() && !((Property) b).isPresent())
return true;
if (!a.isPresent() && ((Property) b).isPresent() || a.isPresent() && !((Property) b).isPresent())
return false;
return a.key().equals(((Property) b).key()) && a.value().equals(((Property) b).value()) && areEqual(a.element(), ((Property) b).element());
}
示例3: map
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
@Override
public void map(final Vertex vertex, final MapEmitter<Serializable, Long> emitter) {
final Property<Serializable> cluster = vertex.property(PeerPressureVertexProgram.CLUSTER);
if (cluster.isPresent()) {
emitter.emit(cluster.value(), 1l);
}
}
示例4: validatePropertyEquality
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
public static void validatePropertyEquality(final Property originalProperty, final Property otherProperty) {
assertEquals(originalProperty, otherProperty);
assertEquals(otherProperty, originalProperty);
if (originalProperty.isPresent()) {
assertEquals(originalProperty.key(), otherProperty.key());
assertEquals(originalProperty.value(), otherProperty.value());
assertEquals(originalProperty.element(), otherProperty.element());
}
}
示例5: contextEquals
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
private boolean contextEquals(final String expected, final Edge edge) {
Property<String> actual = edge.property(Schema.EdgeProperties.CONTEXT);
if (actual.isPresent()) {
return null != expected && actual.value().equals(expected);
} else {
return null == expected;
}
}
示例6: properties
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
@Override
public <T> Iterator<? extends Property<T>> properties(String... propertyKeys) {
ArrayList<Property<T>> ans = new ArrayList<Property<T>>();
if (propertyKeys.length == 0) {
if (this.properties == null) return Collections.emptyIterator();
propertyKeys = this.properties.getPropertyKeys();
}
for (String key : propertyKeys) {
Property<T> prop = property(key);
if (prop.isPresent()) ans.add(prop);
}
return ans.iterator();
}
示例7: property
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
/**
*
* @param key The key of the property to mutate
* @param value The value to commit into the property
*/
public void property(P key, Object value){
if(value == null) {
element().property(key.name()).remove();
} else {
Property<Object> foundProperty = element().property(key.name());
if(!foundProperty.isPresent() || !foundProperty.value().equals(value)){
element().property(key.name(), value);
}
}
}
示例8: map
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
@Override
public void map(final Vertex vertex, final MapEmitter<Object, Double> emitter) {
final Property pageRank = vertex.property(PageRankVertexProgram.PAGE_RANK);
if (pageRank.isPresent()) {
emitter.emit(vertex.id(), (Double) pageRank.value());
}
}
示例9: map
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
@Override
public void map(final Vertex vertex, final MapEmitter<NullObject, Serializable> emitter) {
final Property<Serializable> cluster = vertex.property(PeerPressureVertexProgram.CLUSTER);
if (cluster.isPresent()) {
emitter.emit(NullObject.instance(), cluster.value());
}
}
示例10: getContext
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
private Resource getContext(final Edge edge) {
Property<String> prop = edge.property(Schema.EdgeProperties.CONTEXT);
return prop.isPresent() ? toResource(prop.value()) : null;
}
示例11: getLanguage
import org.apache.tinkerpop.gremlin.structure.Property; //导入方法依赖的package包/类
private String getLanguage(final Vertex vertex) {
Property<String> prop = vertex.property(Schema.VertexProperties.LANGUAGE);
return prop.isPresent() ? prop.value() : null;
}