public Property[] getPropertiesArray() { final Property[] a = new Property[ getProperties().size() ]; int i = 0; for( final String ref : getProperties().keySet() ) { a[ i++ ] = getProperties().get( ref ); } return a; }
/** * Returns all property refs of this PhylogenyNode as String array. */ public String[] getPropertyRefs() { if ( getProperties() == null ) { return new String[ 0 ]; } final Property[] properties = getPropertiesArray(); final String[] refs = new String[ properties.length ]; for( int i = 0; i < properties.length; ++i ) { refs[ i ] = properties[ i ].getRef(); } return refs; }
return false; if ( pm.getProperties().size() != 3 ) { return false; return false; if ( pm.getProperties().size() != 3 ) { return false; if ( pm.getProperties().size() != 2 ) { return false;
public boolean refExists( final String ref ) { if ( getProperties() != null ) { for( final String r : getProperties().keySet() ) { if ( r.equalsIgnoreCase( ref ) ) { return true; } } } return false; }
public Property getProperty( final String ref ) throws IllegalArgumentException { if ( getProperties().containsKey( ref ) ) { return getProperties().get( ref ); } else { throw new IllegalArgumentException( "reference [" + ref + "] is not present" ); } }
@Override public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException { if ( getProperties() != null ) { for( final String ref : getProperties().keySet() ) { getProperties().get( ref ).toPhyloXML( writer, level, indentation ); } } }
public Property removeProperty( final String ref ) throws IllegalArgumentException { if ( getProperties().containsKey( ref ) ) { return getProperties().remove( ref ); } else { throw new IllegalArgumentException( "reference [" + ref + "] is not present" ); } }
@Override public PhylogenyData copy() { final PropertiesMap new_one = new PropertiesMap(); for( final String r : getProperties().keySet() ) { new_one.addProperty( getProperties().get( r ) ); } return new_one; }
public List<String> removePropertiesWithGivenReferencePrefix( final String ref_prefix ) throws IllegalArgumentException { if ( ForesterUtil.isEmpty( ref_prefix ) ) { throw new IllegalArgumentException( "reference prefix is null or empty" ); } final String my_ref_prefix = new String( ref_prefix.trim() ); final List<String> to_remove = new ArrayList<String>(); for( final String ref : getProperties().keySet() ) { if ( ref.startsWith( my_ref_prefix ) ) { to_remove.add( ref ); } } for( final String ref : to_remove ) { getProperties().remove( ref ); } return to_remove; }
public void addProperty( final Property property ) throws IllegalArgumentException { if ( getProperties().containsKey( property.getRef() ) ) { throw new IllegalArgumentException( "ref [" + property.getRef() + "] is already present" ); } getProperties().put( property.getRef(), property ); }
public List<Property> getPropertiesWithGivenReferencePrefix( final String ref_prefix ) throws IllegalArgumentException { if ( ForesterUtil.isEmpty( ref_prefix ) ) { throw new IllegalArgumentException( "reference prefix is null or empty" ); } final String my_ref_prefix = new String( ref_prefix.trim() ); final List<Property> props = new ArrayList<Property>(); for( final String ref : getProperties().keySet() ) { if ( ref.startsWith( my_ref_prefix ) ) { props.add( getProperty( ref ) ); } } return props; }
private static void addProperties( final DefaultMutableTreeNode top, final PropertiesMap properties, final String string ) { final SortedMap<String, Property> properties_map = properties.getProperties(); final DefaultMutableTreeNode category = new DefaultMutableTreeNode( "Properties " ); top.add( category ); for( final String key : properties_map.keySet() ) { final Property prop = properties_map.get( key ); category.add( new DefaultMutableTreeNode( prop.getRef() + "=" + prop.getValue() + " " + prop.getUnit() + " [" + prop.getAppliesTo().toString() + "]" ) ); } }
if ( node.getNodeData().getProperties() != null ) { final PropertiesMap pm = node.getNodeData().getProperties(); final double[] vector = new double[ pm.getProperties().size() ]; int counter = 0; for( final String ref : pm.getProperties().keySet() ) { if ( ref.startsWith( PhyloXmlUtil.VECTOR_PROPERTY_REF ) ) { final Property p = pm.getProperty( ref );