com.aptana.ide.editor.js.runtime
Class Property

java.lang.Object
  extended by com.aptana.ide.editor.js.runtime.Property
All Implemented Interfaces:
IDocumentationContainer

public class Property
extends java.lang.Object
implements IDocumentationContainer

Author:
Kevin Lindsey

Field Summary
static int DONT_DELETE
          Don't delete
static int DONT_ENUM
          Don't enumerate
static int INTERNAL
          Internal
static int NONE
          None
static int NOT_VISIBLE
          Not visible
static int READ_ONLY
          Read-only
 
Constructor Summary
Property(IObject value, int fileIndex, int attributes)
          Create a new instance of Property
 
Method Summary
 int addReference()
          Increase the number of references to this property
 IDocumentation getAnyValidDocumentation(int sourceFileIndex, int beginOffset)
          Gets the last valid documentation object based on an offset.
 IObject getAssignment(int index)
          Retrieve the assignment at the given index.
 OrderedObjectCollection getAssignments()
          Retrieve the collection of all assignments for this property
 IDocumentation getDocumentation()
          Retrieve any documentation associated with this object
 int getReferenceCount()
          Get the total number of references to this property in all of the source code
 int getSourceFileIndex(int fileIndex, int offset)
          Get the file index associated with this property
 IObject getValue(int fileIndex, int offset)
          Get the value associated with this property
 boolean hasAssignments()
          Determines if this property has any assignments.
 boolean hasDocumentation()
          Determine if this object contains any documentation
 boolean hasReferences()
          Determines if this property has any references in the source code
 boolean isEnumerable()
          Determines if this property is enumerable
 boolean isInternal()
          Determines if this property is internal
 boolean isPermanent()
          Determines if this property is permanent
 boolean isReadOnly()
          Determines if this property is read-only
 boolean isVisible()
          Determines if this property is read-only
 int removeReference()
          Decrease the number of references to this property
 void setDocumentation(IDocumentation documentation)
          Associate documentation with this object
 void setValue(IObject value, int fileIndex)
          Set the value associated with this property
 java.lang.String toString()
          Return a String representation of this object
 void unsetValue(int fileIndex, int offset)
          Unset the value associated with this property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
None

See Also:
Constant Field Values

READ_ONLY

public static final int READ_ONLY
Read-only

See Also:
Constant Field Values

DONT_ENUM

public static final int DONT_ENUM
Don't enumerate

See Also:
Constant Field Values

DONT_DELETE

public static final int DONT_DELETE
Don't delete

See Also:
Constant Field Values

INTERNAL

public static final int INTERNAL
Internal

See Also:
Constant Field Values

NOT_VISIBLE

public static final int NOT_VISIBLE
Not visible

See Also:
Constant Field Values
Constructor Detail

Property

public Property(IObject value,
                int fileIndex,
                int attributes)
Create a new instance of Property

Parameters:
value - The value of the property
fileIndex - The index of the file where the property value is located
attributes - The attributes of the property
Method Detail

getAssignment

public IObject getAssignment(int index)
Retrieve the assignment at the given index.

Parameters:
index - The assignment index to retrieve
Returns:
Returns the assignment at the given index

getReferenceCount

public int getReferenceCount()
Get the total number of references to this property in all of the source code

Returns:
The number of references to this property

getSourceFileIndex

public int getSourceFileIndex(int fileIndex,
                              int offset)
Get the file index associated with this property

Parameters:
fileIndex - The file index of the value
offset - The offset of the value
Returns:
Returns the file index (in ordered array) at the specified file index and offset

getValue

public IObject getValue(int fileIndex,
                        int offset)
Get the value associated with this property

Parameters:
fileIndex - The file index of the value
offset - The offset of the value
Returns:
Returns the object at the specified file index and offset

setValue

public void setValue(IObject value,
                     int fileIndex)
Set the value associated with this property

Parameters:
value - The value to assign to this property
fileIndex - The file index of the value

unsetValue

public void unsetValue(int fileIndex,
                       int offset)
Unset the value associated with this property

Parameters:
fileIndex - The file index of the value to remove
offset - The file offset of the value to remove

hasReferences

public boolean hasReferences()
Determines if this property has any references in the source code

Returns:
Returns true if there are references to this property

getAssignments

public OrderedObjectCollection getAssignments()
Retrieve the collection of all assignments for this property

Returns:
Returns an OrderedObjectCollection that contains all assignments for this property

hasAssignments

public boolean hasAssignments()
Determines if this property has any assignments. If a property is undefined, it will exist (reference count > 0), but it will have no values

Returns:
Returns true if this property contains one or more assignment values

isEnumerable

public boolean isEnumerable()
Determines if this property is enumerable

Returns:
Returns true if this property is enumerable

isInternal

public boolean isInternal()
Determines if this property is internal

Returns:
Returns true if this property is internal

isPermanent

public boolean isPermanent()
Determines if this property is permanent

Returns:
Returns true if this property is permanent

isReadOnly

public boolean isReadOnly()
Determines if this property is read-only

Returns:
Returns true if this property is read-only

isVisible

public boolean isVisible()
Determines if this property is read-only

Returns:
Returns true if this property is read-only

addReference

public int addReference()
Increase the number of references to this property

Returns:
Returns the total number of references on this property after adding this reference

removeReference

public int removeReference()
Decrease the number of references to this property

Returns:
Returns the total number of references on this property after removing this reference.

toString

public java.lang.String toString()
Return a String representation of this object

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this object

getDocumentation

public IDocumentation getDocumentation()
Description copied from interface: IDocumentationContainer
Retrieve any documentation associated with this object

Specified by:
getDocumentation in interface IDocumentationContainer
Returns:
Returns this object's documentation object
See Also:
IDocumentationContainer.getDocumentation()

hasDocumentation

public boolean hasDocumentation()
Description copied from interface: IDocumentationContainer
Determine if this object contains any documentation

Specified by:
hasDocumentation in interface IDocumentationContainer
Returns:
Returns true if this object contains documentation
See Also:
IDocumentationContainer.hasDocumentation()

setDocumentation

public void setDocumentation(IDocumentation documentation)
Description copied from interface: IDocumentationContainer
Associate documentation with this object

Specified by:
setDocumentation in interface IDocumentationContainer
Parameters:
documentation - The new documentation for this object
See Also:
IDocumentationContainer.setDocumentation(com.aptana.ide.metadata.IDocumentation)

getAnyValidDocumentation

public IDocumentation getAnyValidDocumentation(int sourceFileIndex,
                                               int beginOffset)
Gets the last valid documentation object based on an offset. This is used when a property is hidden by reassignment. This will prefer the last declared doc (before cursor position) but will take forward declared docs as well (user code may doc things in prototype assignments but reassign in ctors for example).

Parameters:
sourceFileIndex -
beginOffset -
Returns:
Returns a valid documentation object based on an offset.