/** * Creates an item. The item is coupled to a particular Relation. If shared * contents is null a new sharedContents is created. * * @param relation the relation that owns this item * @param sharedContents the contents that is shared with others. If null, * a new sharedContents is created. */ public Item(Relation relation, ItemContents sharedContents) { ownerRelation = relation; if (sharedContents != null) { contents = sharedContents; } else { contents = new ItemContents(); } parent = null; daughter = null; next = null; prev = null; getSharedContents().addItemRelation(relation.getName(), this); }
/** * Returns the feature set of this item. * * @return the feature set of this item */ public FeatureSet getFeatures() { return getSharedContents().getFeatures(); }
/** * Finds the item in the given relation that has the same shared contents. * * @param relationName the relation of interest * * @return the item as found in the given relation or null if not found */ public Item getItemAs(String relationName) { return getSharedContents().getItemRelation(relationName); }
/** * Adds the given item as a daughter to this item. * * @param item for the new daughter * @return created item */ public Item addDaughter(Item item) { Item newItem; ItemContents contents; Item p = getLastDaughter(); if (p != null) { newItem = p.appendItem(item); } else { if (item == null) { contents = new ItemContents(); } else { contents = item.getSharedContents(); } newItem = new Item(getOwnerRelation(), contents); newItem.parent = this; daughter = newItem; } return newItem; }
/** * Adds the given item as a daughter to this item. * * @param item for the new daughter * @return created item */ public Item addDaughter(Item item) { Item newItem; ItemContents contents; Item p = getLastDaughter(); if (p != null) { newItem = p.appendItem(item); } else { if (item == null) { contents = new ItemContents(); } else { contents = item.getSharedContents(); } newItem = new Item(getOwnerRelation(), contents); newItem.parent = this; daughter = newItem; } return newItem; }
/** * Creates an item. The item is coupled to a particular Relation. If shared * contents is null a new sharedContents is created. * * @param relation the relation that owns this item * @param sharedContents the contents that is shared with others. If null, * a new sharedContents is created. */ public Item(Relation relation, ItemContents sharedContents) { ownerRelation = relation; if (sharedContents != null) { contents = sharedContents; } else { contents = new ItemContents(); } parent = null; daughter = null; next = null; prev = null; getSharedContents().addItemRelation(relation.getName(), this); }
pitem = pitem.getSharedContents() .getItemRelation(relationName); } else { System.out.println("findItem: bad feature " + token + " in "
/** * Returns the feature set of this item. * * @return the feature set of this item */ public FeatureSet getFeatures() { return getSharedContents().getFeatures(); }
pitem = pitem.getSharedContents() .getItemRelation(relationName); } else { System.out.println("findItem: bad feature " + op + " in "
/** * Finds the item in the given relation that has the same shared contents. * * @param relationName the relation of interest * * @return the item as found in the given relation or null if not found */ public Item getItemAs(String relationName) { return getSharedContents().getItemRelation(relationName); }
pitem = pitem.getSharedContents() .getItemRelation(relationName); } else { System.out.println("findItem: bad feature " + token + " in "
pitem = pitem.getSharedContents() .getItemRelation(relationName); } else { System.out.println("findItem: bad feature " + op + " in "