de.tuberlin.cs.cis.ocl.util
Class QualifiedName

java.lang.Object
  |
  +--de.tuberlin.cs.cis.ocl.util.QualifiedName

public class QualifiedName
extends java.lang.Object

A QualifiedName trying to abstract from seperators like '.' or '::' seperating containers or names respectivly in a qualified name.

Author:
fchabar

Field Summary
static java.lang.String DOT_SEPERATOR
          Contains the standard '.' seperator widly used.
static java.lang.String OCL_SEPERATOR
          Contains the ocl path name seperator '::'
 
Constructor Summary
QualifiedName(java.util.List qualifiedName)
          Constructs a QualifiedName from an ordered list starting with the outmost container and ending with the to be described model element.
QualifiedName(java.util.List qualifiedName, java.lang.String seperator)
          Constructs a QualifiedName from an ordered list starting with the outmost container and ending with the to be described model element.
QualifiedName(java.lang.String qualifiedName, java.lang.String seperator)
          Constructs a QualifiedName by abstracting from its original string presentation.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks whether the given qualfied name matchs exactly with the given object.
 boolean equalsIgnoreRepresentation(java.lang.Object o)
          Checks whether this QualifiedName equals the given object regardless of the objects representation.
 java.lang.String getSeperator()
          Returns the given seperator of this QualifiedName.
 void setSeperator(java.lang.String string)
          Sets the seperator of this QualifiedName.
 java.util.List toList()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OCL_SEPERATOR

public static final java.lang.String OCL_SEPERATOR
Contains the ocl path name seperator '::'

See Also:
Constant Field Values

DOT_SEPERATOR

public static final java.lang.String DOT_SEPERATOR
Contains the standard '.' seperator widly used.

See Also:
Constant Field Values
Constructor Detail

QualifiedName

public QualifiedName(java.lang.String qualifiedName,
                     java.lang.String seperator)
Constructs a QualifiedName by abstracting from its original string presentation.

Parameters:
qualifiedName - a string containing names seperated by seperator.
seperator - a seperator symbol/token seperating the string into a container-path ending with the described model element.

QualifiedName

public QualifiedName(java.util.List qualifiedName)
Constructs a QualifiedName from an ordered list starting with the outmost container and ending with the to be described model element. For cases where the qualified name must match exactly and not by abstracting from its seperator the default seperator OCL_SEPERATOR is assumed.

Parameters:
qualifiedName - an ordered qualified name list.

QualifiedName

public QualifiedName(java.util.List qualifiedName,
                     java.lang.String seperator)
Constructs a QualifiedName from an ordered list starting with the outmost container and ending with the to be described model element. For cases where the qualified name must match exactly and not by abstracting from its seperator the given seperator is used. If the given seperator is equal null the default seperator OCL_SEPERATOR is assumed.

Parameters:
qualifiedName - an ordered qualified name list.
seperator - an arbitrary seperator.
Method Detail

toList

public java.util.List toList()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Checks whether the given qualfied name matchs exactly with the given object. That means the object must be of type QualifiedName, it must have the same string representation (same names plus same seperator).

Overrides:
equals in class java.lang.Object

equalsIgnoreRepresentation

public boolean equalsIgnoreRepresentation(java.lang.Object o)
Checks whether this QualifiedName equals the given object regardless of the objects representation. There are three known representations in this context an object can take to represent a qualified name: 1) as an instance of this class. 2) as an instance of List. 3) as an instance of String.

Parameters:
o - an arbitrary object not equal null
Returns:
true if and only if an object is instance of this class or of List and is representating the same model element like this object or is an instance of String having the same seperator like this object and of course representing the same model element like this object.

getSeperator

public java.lang.String getSeperator()
Returns the given seperator of this QualifiedName.

Returns:
the seperator of this qualified name.

setSeperator

public void setSeperator(java.lang.String string)
Sets the seperator of this QualifiedName.

Parameters:
string - an arbitrary seperator not equal null.