Advertisement
Guest User

Untitled

a guest
Mar 13th, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. /**
  2. * Constructor for nominal attributes and string attributes. If a null vector
  3. * of attribute values is passed to the method, the attribute is assumed to be
  4. * a string.
  5. *
  6. * @param attributeName the name for the attribute
  7. * @param attributeValues a vector of strings denoting the attribute values.
  8. * Null if the attribute is a string attribute.
  9. */
  10. // @ requires attributeName != null;
  11. // @ ensures m_Name == attributeName;
  12. public Attribute(String attributeName, List<String> attributeValues) {
  13.  
  14. this(attributeName, attributeValues, (ProtectedProperties)null);
  15. }
  16.  
  17. /**
  18. * Constructor for nominal attributes and string attributes, where metadata is
  19. * supplied. If a null vector of attribute values is passed to the method, the
  20. * attribute is assumed to be a string.
  21. *
  22. * @param attributeName the name for the attribute
  23. * @param attributeValues a vector of strings denoting the attribute values.
  24. * Null if the attribute is a string attribute.
  25. * @param metadata the attribute's properties
  26. */
  27. // @ requires attributeName != null;
  28. // @ requires metadata != null;
  29. /*
  30. * @ ensures m_Name == attributeName; ensures m_Index == -1; ensures
  31. * attributeValues == null && m_Type == STRING || attributeValues != null &&
  32. * m_Type == NOMINAL && m_Values.size() == attributeValues.size(); signals
  33. * (IllegalArgumentException ex) (* if duplicate strings in attributeValues
  34. * *);
  35. */
  36. public Attribute(String attributeName, List<String> attributeValues,
  37. ProtectedProperties metadata) {
  38.  
  39. m_Name = attributeName;
  40. m_AttributeInfo = new NominalAttributeInfo(attributeValues, attributeName);
  41. if (attributeValues == null) {
  42. m_Type = STRING;
  43. } else {
  44. m_Type = NOMINAL;
  45. }
  46. if (metadata != null) {
  47. m_AttributeMetaInfo = new AttributeMetaInfo(metadata, this);
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement