Ejemplo n.º 1
0
 @Override
 public Property getProperty(String name) {
   if (ID_PROPERTY_NAME.equals(name)) {
     return getIdProperty();
   } else if (Edge.LABEL_PROPERTY_NAME.equals(name) && this instanceof Edge) {
     return getEdgeLabelProperty();
   }
   Iterator<Property> propertiesWithName = getProperties(name).iterator();
   if (propertiesWithName.hasNext()) {
     return propertiesWithName.next();
   }
   return null;
 }
Ejemplo n.º 2
0
 @Override
 public Object getPropertyValue(String key, String name, int index) {
   if (ID_PROPERTY_NAME.equals(name)) {
     return getIdProperty();
   } else if (Edge.LABEL_PROPERTY_NAME.equals(name) && this instanceof Edge) {
     return getEdgeLabelProperty();
   }
   Iterator<Object> values = getPropertyValues(key, name).iterator();
   while (values.hasNext() && index >= 0) {
     Object v = values.next();
     if (index == 0) {
       return v;
     }
     index--;
   }
   return null;
 }
Ejemplo n.º 3
0
 @Override
 public Iterable<Property> getProperties(final String name) {
   if (ID_PROPERTY_NAME.equals(name)) {
     ArrayList<Property> result = new ArrayList<>();
     result.add(getIdProperty());
     return result;
   } else if (Edge.LABEL_PROPERTY_NAME.equals(name) && this instanceof Edge) {
     ArrayList<Property> result = new ArrayList<>();
     result.add(getEdgeLabelProperty());
     return result;
   }
   return new FilterIterable<Property>(getProperties()) {
     @Override
     protected boolean isIncluded(Property property) {
       return property.getName().equals(name);
     }
   };
 }
Ejemplo n.º 4
0
 @Override
 public Property getProperty(String key, String name, Visibility visibility) {
   if (ID_PROPERTY_NAME.equals(name)) {
     return getIdProperty();
   } else if (Edge.LABEL_PROPERTY_NAME.equals(name) && this instanceof Edge) {
     return getEdgeLabelProperty();
   }
   for (Property p : getProperties()) {
     if (!p.getKey().equals(key)) {
       continue;
     }
     if (!p.getName().equals(name)) {
       continue;
     }
     if (visibility == null) {
       return p;
     }
     if (!visibility.equals(p.getVisibility())) {
       continue;
     }
     return p;
   }
   return null;
 }