private static void assertAttributes(Object value, String... keys) { if (!(value instanceof RAbstractVector)) { Assert.assertEquals(0, keys.length); return; } RAbstractVector vector = (RAbstractVector) value; Set<String> expectedAttributes = new HashSet<>(Arrays.asList(keys)); DynamicObject attributes = vector.getAttributes(); if (attributes == null) { Assert.assertEquals(0, keys.length); return; } Set<Object> foundAttributes = new HashSet<>(); for (RAttributesLayout.RAttribute attribute : RAttributesLayout.asIterable(attributes)) { foundAttributes.add(attribute.getName()); foundAttributes.add(attribute.getValue()); } Assert.assertEquals(expectedAttributes, foundAttributes); }
protected boolean containsMetadata(RAbstractVector vector) { return vector instanceof RVector && hasDimNode.execute(vector) || (copyAllAttributes && vector.getAttributes() != null) || getNamesNode.getNames(vector) != null || getDimNamesNode.getDimNames(vector) != null; }
protected boolean containsMetadata(RAbstractVector vector, RAttributeProfiles attrProfiles) { return vector instanceof RVector && vector.hasDimensions() || (copyAllAttributes && vector.getAttributes() != null) || vector.getNames(attrProfiles) != null || vector.getDimNames(attrProfiles) != null; }