@Override public IDataItem getDataItem(String shortName) { if (shortName != null) { for (IDataItem item : itemList) { if (shortName.equals(item.getName())) { return item; } } } return null; }
@Override public void setShortName(final String name) { try { this.shortName = name; this.name = getParentGroup().getName() + HdfPath.PATH_SEPARATOR + name; for (IDataItem item : itemMap.values()) { item.setParent(this); } } catch (Exception e) { Factory.getLogger().severe(e.getMessage()); } }
@Override public IDataItem getDataItemWithAttribute(String name, String value) { if (name != null) { for (IDataItem item : itemList) { IAttribute attribute = item.getAttribute(name); if (attribute != null) { if (StringUtils.isSameString(value, attribute.getStringValue())) { return item; } } } } return null; }
@Override public IGroup getRootGroup() { IGroup result = null; IDataItem dataItem = dataItems[0]; if (dataItem != null) { IContainer parent = dataItem.getParentGroup(); if (parent != null) { result = (IGroup) parent.getRootGroup(); } else { result = (IGroup) parent; } } return result; }
@Override public IDataItem getDataItemWithAttribute(final String name, final String value) { IDataItem resItem = null; List<IDataItem> groups = getDataItemList(); for (Iterator<?> iter = groups.iterator(); iter.hasNext(); ) { resItem = (IDataItem) iter.next(); if (resItem.hasAttribute(name, value)) { groups.clear(); return resItem; } } return null; }
@Override public void addDataItem(IDataItem v) { if ((v instanceof EdfDataItem) && (!itemList.contains(v))) { itemList.add((EdfDataItem) v); objectList.add((EdfDataItem) v); v.setParent(this); } }
@Override public void setDimensions(String dimString) { IGroup parent = getParentGroup(); List<String> dimNames = java.util.Arrays.asList(dimString.split(" ")); List<IDataItem> items = parent.getDataItemList(); for (IDataItem item : items) { IAttribute attr = item.getAttribute("axis"); if (attr != null) { try { IDimension dim = new BasicDimension(item.getName(), item.getData(), false, item.isUnlimited(), false); if ("*".equals(dimString)) { setDimension(dim, attr.getNumericValue().intValue()); } else if (dimNames.contains(attr.getName())) { setDimension(dim, attr.getNumericValue().intValue()); } } catch (IOException e) { e.printStackTrace(); } } } }
@Override public boolean removeDataItem(final IDataItem item) { return removeDataItem(item.getShortName()); }
@Override public void addDataItem(final IDataItem item) { item.setParent(this); itemMap.put(item.getName(), item); }