org.sonar.squid.api
Class SourceCode

java.lang.Object
  extended by org.sonar.squid.api.SourceCode
All Implemented Interfaces:
Comparable<SourceCode>, Measurable
Direct Known Subclasses:
SourceClass, SourceFile, SourceFunction, SourceMethod, SourcePackage, SourceProject

public abstract class SourceCode
extends Object
implements Measurable, Comparable<SourceCode>


Constructor Summary
SourceCode(String key)
           
SourceCode(String key, String name)
           
 
Method Summary
 void add(MetricDef metric, double value)
           
 void add(MetricDef metric, SourceCode child)
           
 SourceCode addChild(SourceCode sourceCode)
           
 void addData(MetricDef metric, Object data)
           
 int compareTo(SourceCode resource)
           
 boolean equals(Object obj)
           
<SOURCECODE extends SourceCode>
SOURCECODE
getAncestor(Class<SOURCECODE> withClass)
           
 Set<CheckMessage> getCheckMessages()
           
 Set<SourceCode> getChildren()
           
 Object getData(Metric metric)
          Deprecated. since 2.1. It's replaced by getData(MetricDef). It's still defined for binary compatibility.
 Object getData(MetricDef metric)
           
 double getDouble(Metric metric)
          Deprecated. since 2.1. It's replaced by getDouble(MetricDef). It's still defined for binary compatibility.
 double getDouble(MetricDef metric)
          
 int getEndAtLine()
           
 SourceCode getFirstChild()
           
 int getInt(Metric metric)
          Deprecated. since 2.1. It's replaced by getInt(MetricDef). It's still defined for binary compatibility.
 int getInt(MetricDef metric)
          
 String getKey()
           
 SourceCode getLastChild()
           
 String getName()
           
 SourceCode getParent()
           
<SOURCECODE extends SourceCode>
SOURCECODE
getParent(Class<SOURCECODE> sourceCode)
           
 int getStartAtLine()
           
 boolean hasAmongParents(SourceCode expectedParent)
           
 boolean hasCheckMessages()
           
 boolean hasChild(SourceCode squidUnit)
           
 boolean hasChildren()
           
 int hashCode()
           
 boolean isType(Class<? extends SourceCode> resourceType)
           
 void log(CheckMessage message)
           
 void removeMeasure(MetricDef metric)
           
 void setEndAtLine(int endAtLine)
           
 void setMeasure(MetricDef metric, double measure)
          
 void setMeasure(MetricDef metric, int measure)
          
 void setSourceCodeIndexer(SourceCodeIndexer indexer)
           
 void setStartAtLine(int startAtLine)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SourceCode

public SourceCode(String key)

SourceCode

public SourceCode(String key,
                  String name)
Method Detail

getKey

public String getKey()

compareTo

public int compareTo(SourceCode resource)
Specified by:
compareTo in interface Comparable<SourceCode>

getName

public String getName()

setSourceCodeIndexer

public final void setSourceCodeIndexer(SourceCodeIndexer indexer)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

isType

public boolean isType(Class<? extends SourceCode> resourceType)

getInt

public int getInt(MetricDef metric)

Specified by:
getInt in interface Measurable

getInt

@Deprecated
public int getInt(Metric metric)
Deprecated. since 2.1. It's replaced by getInt(MetricDef). It's still defined for binary compatibility.


getDouble

public double getDouble(MetricDef metric)

Specified by:
getDouble in interface Measurable

getDouble

@Deprecated
public double getDouble(Metric metric)
Deprecated. since 2.1. It's replaced by getDouble(MetricDef). It's still defined for binary compatibility.


add

public void add(MetricDef metric,
                SourceCode child)

add

public void add(MetricDef metric,
                double value)

addData

public void addData(MetricDef metric,
                    Object data)

getData

public Object getData(MetricDef metric)

getData

@Deprecated
public Object getData(Metric metric)
Deprecated. since 2.1. It's replaced by getData(MetricDef). It's still defined for binary compatibility.


setMeasure

public void setMeasure(MetricDef metric,
                       double measure)

Specified by:
setMeasure in interface Measurable

setMeasure

public void setMeasure(MetricDef metric,
                       int measure)

Specified by:
setMeasure in interface Measurable

removeMeasure

public void removeMeasure(MetricDef metric)

setStartAtLine

public void setStartAtLine(int startAtLine)

setEndAtLine

public void setEndAtLine(int endAtLine)

getStartAtLine

public int getStartAtLine()

getEndAtLine

public int getEndAtLine()

addChild

public SourceCode addChild(SourceCode sourceCode)

getParent

public <SOURCECODE extends SourceCode> SOURCECODE getParent(Class<SOURCECODE> sourceCode)

getAncestor

public <SOURCECODE extends SourceCode> SOURCECODE getAncestor(Class<SOURCECODE> withClass)

log

public void log(CheckMessage message)

getCheckMessages

public Set<CheckMessage> getCheckMessages()

hasCheckMessages

public boolean hasCheckMessages()

getFirstChild

public SourceCode getFirstChild()

getLastChild

public SourceCode getLastChild()

getParent

public SourceCode getParent()

getChildren

public Set<SourceCode> getChildren()

hasChild

public boolean hasChild(SourceCode squidUnit)

hasChildren

public boolean hasChildren()

hasAmongParents

public boolean hasAmongParents(SourceCode expectedParent)


Copyright © 2009-2012 SonarSource. All Rights Reserved.