annotate java/src/uk/ac/qmul/eecs/ccmi/diagrammodel/NodeProperties.java @ 1:e3935c01cde2 tip

moved license of PdPersistenceManager to the beginning of the file
author Fiore Martin <f.martin@qmul.ac.uk>
date Tue, 08 Jul 2014 19:52:03 +0100
parents 78b7fc5391a2
children
rev   line source
f@0 1 /*
f@0 2 CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
f@0 3
f@0 4 Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
f@0 5
f@0 6 This program is free software: you can redistribute it and/or modify
f@0 7 it under the terms of the GNU General Public License as published by
f@0 8 the Free Software Foundation, either version 3 of the License, or
f@0 9 (at your option) any later version.
f@0 10
f@0 11 This program is distributed in the hope that it will be useful,
f@0 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
f@0 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f@0 14 GNU General Public License for more details.
f@0 15
f@0 16 You should have received a copy of the GNU General Public License
f@0 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
f@0 18 */
f@0 19 package uk.ac.qmul.eecs.ccmi.diagrammodel;
f@0 20
f@0 21 import java.util.ArrayList;
f@0 22 import java.util.Collections;
f@0 23 import java.util.LinkedHashMap;
f@0 24 import java.util.LinkedHashSet;
f@0 25 import java.util.List;
f@0 26 import java.util.Map;
f@0 27 import java.util.Set;
f@0 28
f@0 29 /**
f@0 30 * This class represents the internal properties of a node. Internal properties can be seen as
f@0 31 * attributes that each single nodes owns and that, in a visual diagram, would normally be displayed inside
f@0 32 * or in the neighbourhood of the node itself. This is a very high abstraction of the concept of properties
f@0 33 * of a node as the user can define their own type of properties through the property type definition object
f@0 34 * passed as argument in the constructor.
f@0 35 * An example of properties is <i>attributes</i> and <i>methods</i> of a class diagram in the UML language or just the
f@0 36 * <i>attributes</i> of entities in an ER diagram.
f@0 37 *
f@0 38 */
f@0 39 public final class NodeProperties implements Cloneable {
f@0 40
f@0 41 /**
f@0 42 * Creates a diagram element property data structure out of a property type specification. In a UML
f@0 43 * diagram the NodeProperties for a class node would be constructed passing as arguments a linked hash
f@0 44 * map containing the strings "attributes" and "properties" and the strings "public", "protected", "private",
f@0 45 * "static" as value for both the keys. "attributes" and "methods" would be the types of the NodeProperties,
f@0 46 * that is, all the values inserted in the object such as values would fall under either type. For example
f@0 47 * if a UML diagram class has the methods getX() and getY(), these would be inserted in the NodeProperties
f@0 48 * object with a type "methods".
f@0 49 *
f@0 50 * @param typeDefinition a linked Hash Map holding the properties types as keys
f@0 51 * and the modifiers type definition of each property as values
f@0 52 */
f@0 53
f@0 54 public NodeProperties(LinkedHashMap<String,Set<String>> typeDefinition){
f@0 55 if(typeDefinition == null)
f@0 56 this.typeDefinition = EMPTY_PROPERTY_TYPE_DEFINITION;
f@0 57 else
f@0 58 this.typeDefinition = typeDefinition;
f@0 59 /* create the type collection out of the typeDefinition keyset */
f@0 60 types = Collections.unmodifiableList(new ArrayList<String>(this.typeDefinition.keySet()));
f@0 61 properties = new LinkedHashMap<String,Entry>();
f@0 62 for(String s : types){
f@0 63 Entry q = new Entry();
f@0 64 q.values = new ArrayList<String>(); // property values to be filled by user + modifiers
f@0 65 q.indexes = new ArrayList<Set<Integer>>();
f@0 66 q.view = null;
f@0 67 Set<String> modifierTypeDefinition = this.typeDefinition.get(s);
f@0 68 if(modifierTypeDefinition == null)
f@0 69 /* null modifiers for this property */
f@0 70 q.modifiers = new Modifiers(EMPTY_MODIFIER_TYPE_DEFINITION,q.indexes);
f@0 71 else if(modifierTypeDefinition.size() == 0)
f@0 72 /* null modifiers for this property */
f@0 73 q.modifiers = new Modifiers(EMPTY_MODIFIER_TYPE_DEFINITION,q.indexes);
f@0 74 else
f@0 75 q.modifiers = new Modifiers(modifierTypeDefinition, q.indexes);
f@0 76 properties.put(s, q);
f@0 77 }
f@0 78 }
f@0 79
f@0 80 /**
f@0 81 * Returns the type definition argument of the constructor this object has been created through.
f@0 82 *
f@0 83 * @return the type definition
f@0 84 */
f@0 85 public Map<String,Set<String>> getTypeDefinition(){
f@0 86 return typeDefinition;
f@0 87 }
f@0 88
f@0 89 /**
f@0 90 * Returns the types of properties.
f@0 91 *
f@0 92 * @return a list of strings holding types of properties
f@0 93 */
f@0 94 public List<String> getTypes(){
f@0 95 return types;
f@0 96 }
f@0 97
f@0 98 /**
f@0 99 * @param propertyType the property type we want to get the values of.
f@0 100 * @return an array of string with the different properties set by the user or
f@0 101 * {@code null} if the specified type does not exist.
f@0 102 */
f@0 103 public List<String> getValues(String propertyType){
f@0 104 Entry e = properties.get(propertyType);
f@0 105 if(e == null)
f@0 106 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 107 return new ArrayList<String>(e.values);
f@0 108 }
f@0 109
f@0 110 /**
f@0 111 * Returns the view object associated with a property type in this NodeProperties instance. A view object is
f@0 112 * defined by the client of this class and it holds the information needed for a visual representation
f@0 113 * of the property.
f@0 114 *
f@0 115 * @param type the property type the returned view is associated with
f@0 116 * @return the View object or null if non has been set previously
f@0 117 */
f@0 118 public Object getView(String type){
f@0 119 Entry e = properties.get(type);
f@0 120 if(e == null)
f@0 121 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+type);
f@0 122 return e.view;
f@0 123 }
f@0 124
f@0 125 /**
f@0 126 * Sets the View object for the a type of properties. The NodeProperties only works
f@0 127 * as a holder as for the view objects. The client code of this class has to define
f@0 128 * its own view.
f@0 129 *
f@0 130 * @param type the type of property the view is associated with.
f@0 131 * @param o an object defined by user
f@0 132 * @see #getView(String)
f@0 133 */
f@0 134 public void setView(String type, Object o){
f@0 135 Entry e = properties.get(type);
f@0 136 if(e == null)
f@0 137 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+type);
f@0 138 e.view = o;
f@0 139 }
f@0 140
f@0 141 /**
f@0 142 * Returns a reference to the modifier object associated with a property type. Changes to the returned
f@0 143 * reference will affect the internal state of the NodeProperty object.
f@0 144 *
f@0 145 * @param propertyType a property type
f@0 146 * @return the modifiers of the specified property type or null if either
f@0 147 * the property type is null or it was not listed in the property type definition
f@0 148 * passed to the constructor
f@0 149 */
f@0 150 public Modifiers getModifiers(String propertyType){
f@0 151 Entry e = properties.get(propertyType);
f@0 152 if(e == null)
f@0 153 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 154 return e.modifiers;
f@0 155 }
f@0 156
f@0 157 /**
f@0 158 * Adds a value of the type passed as argument.
f@0 159 *
f@0 160 * @param propertyType a property type defined in the property type definition passed as argument to the constructor
f@0 161 * @param propertyValue the value to add to the property type
f@0 162 */
f@0 163 public void addValue(String propertyType, String propertyValue){
f@0 164 Entry e = properties.get(propertyType);
f@0 165 /* no such property type exists */
f@0 166 if(e == null)
f@0 167 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 168 e.values.add(propertyValue);
f@0 169 e.indexes.add(new LinkedHashSet<Integer>());
f@0 170 }
f@0 171
f@0 172 /**
f@0 173 * Adds a value of the type passed as argument and sets the modifier indexes for it as for
f@0 174 * {@link Modifiers#setIndexes(int, Set)}.
f@0 175 *
f@0 176 * @param propertyType a property type
f@0 177 * @param propertyValue a property value
f@0 178 * @param modifierIndexes the modifier set of indexes
f@0 179 *
f@0 180 * @throws IllegalArgumentException if propertyType
f@0 181 * is not among the ones in the type definition passed as argument to the constructor
f@0 182 */
f@0 183 public void addValue(String propertyType, String propertyValue, Set<Integer> modifierIndexes){
f@0 184 for(Integer i : modifierIndexes)
f@0 185 if((i < 0)||(i >= getModifiers(propertyType).getTypes().size()))
f@0 186 throw new ArrayIndexOutOfBoundsException("Index "+ i +
f@0 187 " corresponds to no Modifier type (modifierType size = "+
f@0 188 getModifiers(propertyType).getTypes().size()+")" );
f@0 189
f@0 190 Entry e = properties.get(propertyType);
f@0 191 if(e == null)
f@0 192 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 193 e.values.add(propertyValue);
f@0 194 e.indexes.add(modifierIndexes);
f@0 195 }
f@0 196
f@0 197 /**
f@0 198 * Removes the value at the specified index for the specified property type.
f@0 199 *
f@0 200 * @param propertyType a property type
f@0 201 * @param valueIndex the index of the value to remove
f@0 202 * @return the removed value
f@0 203 * @throws IllegalArgumentException if propertyType
f@0 204 * is not among the ones in the type definition passed as argument to the constructor
f@0 205 */
f@0 206 public String removeValue(String propertyType, int valueIndex){
f@0 207 Entry e = properties.get(propertyType);
f@0 208 if(e == null)
f@0 209 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 210 e.indexes.remove(valueIndex);
f@0 211 return e.values.remove(valueIndex);
f@0 212 }
f@0 213
f@0 214 /**
f@0 215 * Sets the value of a property type at the specified index to a new value.
f@0 216 *
f@0 217 * @param propertyType a property type
f@0 218 * @param valueIndex the index of the value which must be replaced
f@0 219 * @param newValue the new value for the specified index
f@0 220 * @throws IllegalArgumentException if propertyType
f@0 221 * is not among the ones in the type definition passed as argument to the constructor
f@0 222 */
f@0 223 public void setValue(String propertyType, int valueIndex, String newValue){
f@0 224 Entry e = properties.get(propertyType);
f@0 225 if(e == null)
f@0 226 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 227 e.values.set(valueIndex, newValue);
f@0 228 }
f@0 229
f@0 230 /**
f@0 231 * Removes all the values and modifiers for a specific type.
f@0 232 *
f@0 233 * @param propertyType the type whose property and modifiers must be removed
f@0 234 * @throws IllegalArgumentException if propertyType
f@0 235 * is not among the ones in the type definition passed as argument to the constructor
f@0 236 */
f@0 237 public void clear(String propertyType){
f@0 238 Entry e = properties.get(propertyType);
f@0 239 if(e == null)
f@0 240 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 241 e.values.clear();
f@0 242 e.indexes.clear();
f@0 243 }
f@0 244
f@0 245 /**
f@0 246 * Removes all the values and modifiers of this object.
f@0 247 */
f@0 248 public void clear(){
f@0 249 for(String type : types){
f@0 250 clear(type);
f@0 251 }
f@0 252 }
f@0 253
f@0 254 /**
f@0 255 * Returns true if this NodeProperties contains no values.
f@0 256 *
f@0 257 * @return true if this NodeProperties contains no values
f@0 258 */
f@0 259 public boolean isEmpty(){
f@0 260 boolean empty = true;
f@0 261 for(String type : types)
f@0 262 if(!properties.get(type).values.isEmpty()){
f@0 263 empty = false;
f@0 264 break;
f@0 265 }
f@0 266 return empty;
f@0 267 }
f@0 268
f@0 269 /**
f@0 270 * Returns true if there are no values for the specified type in this NodeProperties instance.
f@0 271 *
f@0 272 * @param propertyType the property type to be checked for value presence
f@0 273 * @return true if there are no values for the specified type in this NodeProperties instance
f@0 274 */
f@0 275 public boolean typeIsEmpty(String propertyType){
f@0 276 Entry e = properties.get(propertyType);
f@0 277 if(e == null)
f@0 278 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+propertyType);
f@0 279 return e.values.isEmpty();
f@0 280 }
f@0 281
f@0 282 /**
f@0 283 * true if this NodeProperties object has no types. This can happen if the constructor
f@0 284 * has been called with an empty or null property type definition.
f@0 285 *
f@0 286 * @return true if this NodeProperties object has no types
f@0 287 */
f@0 288 public boolean isNull(){
f@0 289 return types.isEmpty();
f@0 290 }
f@0 291
f@0 292 /**
f@0 293 * Returns a string representation of types, value and modifiers of this property. Such a
f@0 294 * representation can be passed as argument to {@link #fill(String)} to populate a NodeProperties
f@0 295 * object. Such NodeProperties object though must have the same type and modifier definition of
f@0 296 * the object this method is called on.
f@0 297 *
f@0 298 * @return a string representation of the values and modifiers of this object
f@0 299 */
f@0 300 @Override
f@0 301 public String toString(){
f@0 302 StringBuilder builder = new StringBuilder();
f@0 303 for(String type : types){
f@0 304 builder.append(TYPE_ENTRY_SEPARATOR).append(type);
f@0 305 int propertyValueIndex = 0;
f@0 306 for(String value : properties.get(type).values){
f@0 307 builder.append(VALUE_ENTRY_SEPARATOR);
f@0 308 builder.append(value);
f@0 309 for(int modifierIndex : getModifiers(type).getIndexes(propertyValueIndex)){
f@0 310 builder.append(MODIFIER_ENTRY_SEPARATOR);
f@0 311 builder.append(modifierIndex);
f@0 312 }
f@0 313 propertyValueIndex++;
f@0 314 }
f@0 315 }
f@0 316 return builder.toString();
f@0 317 }
f@0 318
f@0 319 /**
f@0 320 * Fills up the this property according to the string passed as arguments
f@0 321 * The string must be generated by calling toString on a NodeProperty instance
f@0 322 * holding the same property types as type, otherwise an IllegalArgumentException
f@0 323 * is likely to be thrown.
f@0 324 *
f@0 325 * @param s the string representation of the property values, such as the one returned
f@0 326 * by toString()
f@0 327 * @throws IllegalArgumentException if s contains property types which
f@0 328 * are not among the ones in the type definition passed as argument to the constructor
f@0 329 */
f@0 330 public void fill(String s){
f@0 331 /* clear up previous values */
f@0 332 clear();
f@0 333
f@0 334 /* a property entry is a string with the type of the property followed by value *
f@0 335 * entries of that type. all value entries begin with the VALUE_SEPARATOR. *
f@0 336 * a value entry is a property value followed by its modifiers entries, a modifier entry *
f@0 337 * is a modifier beginning with the MODIFIER_SEPARATOR */
f@0 338 String propertyEntries[] = s.split(TYPE_ENTRY_SEPARATOR);
f@0 339 for(String propertyEntry : propertyEntries){
f@0 340 String[] typeEntries = propertyEntry.split(VALUE_ENTRY_SEPARATOR);
f@0 341 String type = typeEntries[0];
f@0 342 for(int i=1;i<typeEntries.length;i++){
f@0 343 Entry e = properties.get(type);
f@0 344 if(e == null)
f@0 345 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+type);
f@0 346 String valueEntries[] = typeEntries[i].split(MODIFIER_ENTRY_SEPARATOR);
f@0 347 String value = valueEntries[0];
f@0 348 LinkedHashSet<Integer> modifiers = new LinkedHashSet<Integer>();
f@0 349 for(int j=1;j<valueEntries.length;j++){
f@0 350 modifiers.add(Integer.valueOf(valueEntries[j]));
f@0 351 }
f@0 352 addValue(type,value,modifiers);
f@0 353 }
f@0 354 }
f@0 355 }
f@0 356
f@0 357 @Override
f@0 358 @SuppressWarnings(value = "unchecked")
f@0 359 public Object clone(){
f@0 360 NodeProperties p = null;
f@0 361 try {
f@0 362 p = (NodeProperties)super.clone();
f@0 363 } catch (CloneNotSupportedException e) {
f@0 364 e.printStackTrace();
f@0 365 }
f@0 366 p.properties = (LinkedHashMap<String,Entry>)properties.clone();
f@0 367 for(String key : p.properties.keySet()){
f@0 368 Entry old = p.properties.get(key);
f@0 369 Entry q = new Entry();
f@0 370 q.values = new ArrayList<String>();
f@0 371 q.indexes = new ArrayList<Set<Integer>>();
f@0 372 q.view = old.view;
f@0 373 if(old.modifiers != null){
f@0 374 q.modifiers = new Modifiers(old.modifiers.modifierTypes, q.indexes);
f@0 375 for(String modifierType : q.modifiers.getTypes())
f@0 376 q.modifiers.setView(modifierType, old.modifiers.getView(modifierType));
f@0 377 }
f@0 378 p.properties.put(key, q);
f@0 379 }
f@0 380 return p;
f@0 381 }
f@0 382
f@0 383 private class Entry{
f@0 384 List<String> values;
f@0 385 List<Set<Integer>> indexes;
f@0 386 Modifiers modifiers;
f@0 387 Object view;
f@0 388 }
f@0 389
f@0 390 /**
f@0 391 * A modifier is a label peculiar of a certain subset of properties. For example in
f@0 392 * a UML class diagram one or more methods can be labelled as <i>public</i>, <i>private</i> or <i>protected</i>.
f@0 393 * Had a NodeProperties instance been used to represent the methods of a class node, there would be then
f@0 394 * one modifier for each label: one for <i>public</i>, one for <i>private</i>, and one for <i>protected</i>. To each modifier
f@0 395 * a view-object can be associated, which describes how these labels would be rendered visually.
f@0 396 * Following on from the UML example, a view-object would be used with the protected modifier
f@0 397 * to hold the information that the properties which are assigned such a modifier must be prefixed
f@0 398 * with the '#' sign.
f@0 399 */
f@0 400 public class Modifiers{
f@0 401 private Modifiers(Set<String> modifierTypes, List<Set<Integer>> indexes){
f@0 402 views = new LinkedHashMap<String,Object>();
f@0 403 indexesRef = indexes;
f@0 404 this.modifierTypes = Collections.unmodifiableList(new ArrayList<String>(modifierTypes));
f@0 405 for(String modifierType : modifierTypes){
f@0 406 views.put(modifierType,null);
f@0 407 }
f@0 408 }
f@0 409
f@0 410 /* only used by NodeProperties.clone() method */
f@0 411 private Modifiers(List<String> modifierTypes, List<Set<Integer>> indexes){
f@0 412 views = new LinkedHashMap<String,Object>();
f@0 413 indexesRef = indexes;
f@0 414 this.modifierTypes = modifierTypes;
f@0 415 for(String modifierType : modifierTypes){
f@0 416 views.put(modifierType,null);
f@0 417 }
f@0 418 }
f@0 419
f@0 420 /**
f@0 421 * Returns the list of modifier types, as per the type definition passed as argument to the NodeProperties
f@0 422 * constructor.
f@0 423 *
f@0 424 * @return a list of modifier types
f@0 425 * @see NodeProperties#NodeProperties(LinkedHashMap)
f@0 426 */
f@0 427 public List<String> getTypes(){
f@0 428 return modifierTypes;
f@0 429 }
f@0 430
f@0 431 /**
f@0 432 * Returns the view object associated with a modifier type in this Modifier instance. A view object is
f@0 433 * defined by the client of this class and it holds the information needed for a visual representation
f@0 434 * of the modifier.
f@0 435 *
f@0 436 * @param modifierType the property type the returned view is associated with
f@0 437 * @return the View object or null if non has been set previously
f@0 438 */
f@0 439 public Object getView(String modifierType){
f@0 440 return views.get(modifierType);
f@0 441 }
f@0 442
f@0 443 /**
f@0 444 * Sets the View object for the a type of modifier. The NodeProperties only works
f@0 445 * as a holder as for the view objects. The client code of this class has to define
f@0 446 * its own view, which will then be used by the client itself to visualise the modifier
f@0 447 *
f@0 448 * @param modifierType the type of modifier the view is associated with.
f@0 449 * @param view an object defined by user defining how this property looks like
f@0 450 * @see #getView(String)
f@0 451 * @throws IllegalArgumentException if modifierType
f@0 452 * is not among the ones in the type definition passed as argument to the constructor
f@0 453 */
f@0 454 public void setView(String modifierType, Object view){
f@0 455 if(!views.containsKey(modifierType))
f@0 456 throw new IllegalArgumentException(ILLEGAL_TYPE_MSG+modifierType);
f@0 457 views.put(modifierType,view);
f@0 458 }
f@0 459
f@0 460 /**
f@0 461 * Returns the modifier indexes for the specified property value. Each property type can be associated
f@0 462 * with one or more modifier type and each property value can be assigned one or more modifier. The
f@0 463 * integer set returned by this method tells the client code to which modifiers the property value at the index
f@0 464 * passed as argument is assigned. The returned indexes refer to the modifier list returned by {@link #getTypes()}
f@0 465 *
f@0 466 * @param propertyValueIndex the index of the property value for which the set of modifier indexes
f@0 467 * is being queried
f@0 468 * @return a set of indexes of the modifier types the property value at the index passed as argument
f@0 469 * is assigned to
f@0 470 */
f@0 471 public Set<Integer> getIndexes(int propertyValueIndex){
f@0 472 Set<Integer> set = indexesRef.get(propertyValueIndex);
f@0 473 return (new LinkedHashSet<Integer>(set));
f@0 474 }
f@0 475
f@0 476 /**
f@0 477 * Set the modifier indexes for the property value at the index passed as argument
f@0 478 *
f@0 479 * @param propertyValueIndex the index of the property value
f@0 480 * @param modifierIndexes a set of indexes which refer to the list returned by {@link #getTypes()}
f@0 481 * @throws ArrayIndexOutOfBoundsException if one or more of the indexes in modifierIndexes are lower than 0 or greater
f@0 482 * or equal to the size of the modifier type list returned by {@link #getTypes()}. The same exception is also thrown
f@0 483 * if propertyValueIndex is lower than 0 or greater or equal to the property values list returned by {@link NodeProperties#getValues(String)}
f@0 484 * passing as argument the same property type passed to {@link NodeProperties#getModifiers(String)} to obtain
f@0 485 * this Modifiers instance.
f@0 486 * @see #getIndexes(int)
f@0 487 */
f@0 488 public void setIndexes(int propertyValueIndex, Set<Integer> modifierIndexes){
f@0 489 for(Integer i : modifierIndexes)
f@0 490 if((i < 0)||(i >= getTypes().size()))
f@0 491 throw new ArrayIndexOutOfBoundsException("Index "+ i + " corresponds to no Modifier Type (modifierType size = "+getTypes().size()+")" );
f@0 492
f@0 493 Set<Integer> m = indexesRef.get(propertyValueIndex);
f@0 494 m.clear();
f@0 495 m.addAll(modifierIndexes);
f@0 496 }
f@0 497
f@0 498 /**
f@0 499 * Removes all the modifier indexes for a property value at the specified index.
f@0 500 *
f@0 501 * @param propertyValueIndex the index of the property value
f@0 502 */
f@0 503 public void clear(int propertyValueIndex){
f@0 504 Set<Integer> m = indexesRef.get(propertyValueIndex);
f@0 505 m.clear();
f@0 506 }
f@0 507
f@0 508 /**
f@0 509 * true if this Modifiers object has no types. This can happen if the constructor
f@0 510 * has been called with an empty or null modifier in the type definition passed as argument
f@0 511 * to the constructor of the NodeProperties object holding this Modifiers object.
f@0 512 *
f@0 513 * @return true if this Modifiers object has no types
f@0 514 */
f@0 515 public boolean isNull(){
f@0 516 return modifierTypes.isEmpty();
f@0 517 }
f@0 518
f@0 519 private LinkedHashMap<String,Object> views;
f@0 520 private final List<String> modifierTypes;
f@0 521 private List<Set<Integer>> indexesRef;
f@0 522 }
f@0 523
f@0 524 /* for each property (key) I associate a Couple (value) made out of *
f@0 525 * a list of the property values plus a list of possible modifiers */
f@0 526 private LinkedHashMap<String,Entry> properties;
f@0 527 private final List<String> types;
f@0 528 private Map<String,Set<String>> typeDefinition;
f@0 529
f@0 530 private static final LinkedHashMap<String,Set<String>> EMPTY_PROPERTY_TYPE_DEFINITION = new LinkedHashMap<String,Set<String>>();
f@0 531 private static final Set<String> EMPTY_MODIFIER_TYPE_DEFINITION = Collections.emptySet();
f@0 532 private static final String ILLEGAL_TYPE_MSG = "argument must be in type definition list: ";
f@0 533 /**
f@0 534 * A special static instance of the class corresponding to the null NodeProperties. A null NodeProperties instance will have isNull() returning true,
f@0 535 * which means it has no property types associated.
f@0 536 * @see #isNull()
f@0 537 */
f@0 538 public static final NodeProperties NULL_PROPERTIES = new NodeProperties(EMPTY_PROPERTY_TYPE_DEFINITION);
f@0 539
f@0 540 private final static String TYPE_ENTRY_SEPARATOR = "\n:";
f@0 541 private final static String VALUE_ENTRY_SEPARATOR = "\n;";
f@0 542 private final static String MODIFIER_ENTRY_SEPARATOR = "\n,";
f@0 543 }