Package com.crawljax.core.state
Class StateVertexImpl
- java.lang.Object
-
- com.crawljax.core.state.StateVertexImpl
-
- All Implemented Interfaces:
StateVertex,Serializable
- Direct Known Subclasses:
AverageImageHashStateVertexImpl,BlockMeanImageHashStateVertexImpl,ColorHistogramStateVertexImpl,ColorMomentImageHashStateVertexImpl,DHashStateVertexImpl,HybridStateVertexImpl,LevenshteinStateVertexImpl,MarrHildrethImageHashStateVertexImpl,PDiffStateVertexImpl,PerceptualImageHashStateVertexImpl,RadialVarianceImageHashStateVertexImpl,RTEDStateVertexImpl,SIFTStateVertexImpl,SSIMStateVertexImpl,StateVertexForElementsWithVisualInfo,TLSHStateVertexImpl
public class StateVertexImpl extends Object implements StateVertex
The state vertex class which represents a state in the browser. When iterating over the possible candidate elements every time a candidate is returned its removed from the list so it is a one time only access to the candidates.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.collect.ImmutableList<CandidateElement>candidateElementsprivate intclusterprivate doubledistToNearestStateprivate Documentdocumentprivate Stringdomprivate intidprivate booleanisNearDuplicateprotected static org.slf4j.LoggerLOGprivate Stringnameprivate intnearestStateprivate HashMap<Node,List<CandidateElement>>nodeCandidateMappingprivate booleanonURLprivate static longserialVersionUIDprivate StringstrippedDomprivate booleanunexploredActionsprivate Stringurl-
Fields inherited from interface com.crawljax.core.state.StateVertex
INDEX_ID
-
-
Constructor Summary
Constructors Constructor Description StateVertexImpl(int id, String name, String dom)Creates a current state without an url and the stripped dom equals the dom.StateVertexImpl(int id, String url, String name, String dom, String strippedDom)Defines a State.
-
Method Summary
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
id
private final int id
-
dom
private final String dom
-
strippedDom
private final String strippedDom
-
url
private final String url
-
document
private transient Document document
-
name
private final String name
-
nodeCandidateMapping
private final transient HashMap<Node,List<CandidateElement>> nodeCandidateMapping
-
candidateElements
private transient com.google.common.collect.ImmutableList<CandidateElement> candidateElements
-
isNearDuplicate
private boolean isNearDuplicate
-
nearestState
private int nearestState
-
distToNearestState
private double distToNearestState
-
cluster
private int cluster
-
unexploredActions
private boolean unexploredActions
-
onURL
private boolean onURL
-
-
Method Detail
-
getSerialversionuid
public static long getSerialversionuid()
-
getName
public String getName()
Description copied from interface:StateVertexRetrieve the name of the StateVertex.- Specified by:
getNamein interfaceStateVertex- Returns:
- the name of the StateVertex
-
getDom
public String getDom()
Description copied from interface:StateVertexRetrieve the DOM String.- Specified by:
getDomin interfaceStateVertex- Returns:
- the dom for this state
-
getStrippedDom
public String getStrippedDom()
- Specified by:
getStrippedDomin interfaceStateVertex- Returns:
- the stripped dom by the oracle comparators
-
getUrl
public String getUrl()
- Specified by:
getUrlin interfaceStateVertex- Returns:
- the url
-
getId
public int getId()
- Specified by:
getIdin interfaceStateVertex- Returns:
- the id. This is guaranteed to be unique per state.
-
getDocument
public Document getDocument() throws IOException
- Specified by:
getDocumentin interfaceStateVertex- Returns:
- a Document instance of the dom string.
- Throws:
IOException- if an exception is thrown.
-
setDocument
public void setDocument(Document dom)
- Specified by:
setDocumentin interfaceStateVertex
-
setElementsFound
public void setElementsFound(LinkedList<CandidateElement> elements)
- Specified by:
setElementsFoundin interfaceStateVertex- Parameters:
elements- Set the candidate elements for this state vertex that might be fired.
-
createNodeCandidateMapping
private void createNodeCandidateMapping()
-
getCandidateElement
public List<CandidateElement> getCandidateElement(Node equivalentNode)
- Specified by:
getCandidateElementin interfaceStateVertex
-
getCandidateElements
public com.google.common.collect.ImmutableList<CandidateElement> getCandidateElements()
- Specified by:
getCandidateElementsin interfaceStateVertex- Returns:
- A list of
CandidateElementthat might have been fired during the crawl. If an event was fired it is registered as anEventablean can be retrieved fromStateFlowGraph.getAllEdges(). If the candidates were not set because of an error it returnsnull.
-
hasNearDuplicate
public boolean hasNearDuplicate()
- Specified by:
hasNearDuplicatein interfaceStateVertex
-
setHasNearDuplicate
public void setHasNearDuplicate(boolean b)
- Specified by:
setHasNearDuplicatein interfaceStateVertex
-
getNearestState
public int getNearestState()
- Specified by:
getNearestStatein interfaceStateVertex
-
setNearestState
public void setNearestState(int vertex)
- Specified by:
setNearestStatein interfaceStateVertex
-
inThreshold
public boolean inThreshold(StateVertex vertexOfGraph)
- Specified by:
inThresholdin interfaceStateVertex
-
getDistToNearestState
public double getDistToNearestState()
- Specified by:
getDistToNearestStatein interfaceStateVertex
-
setDistToNearestState
public void setDistToNearestState(double distToNearestState)
- Specified by:
setDistToNearestStatein interfaceStateVertex
-
getDist
public double getDist(StateVertex vertexOfGraph)
- Specified by:
getDistin interfaceStateVertex
-
getFragments
public ArrayList<Fragment> getFragments()
- Specified by:
getFragmentsin interfaceStateVertex
-
setFragments
public void setFragments(ArrayList<Fragment> fragments)
- Specified by:
setFragmentsin interfaceStateVertex
-
addFragments
public void addFragments(List<VipsRectangle> rectangles, org.openqa.selenium.WebDriver driver)
- Specified by:
addFragmentsin interfaceStateVertex
-
isNearDuplicate
public boolean isNearDuplicate()
-
getRootFragment
public Fragment getRootFragment()
- Specified by:
getRootFragmentin interfaceStateVertex
-
getClosestFragment
public Fragment getClosestFragment(Node node)
- Specified by:
getClosestFragmentin interfaceStateVertex
-
getClosestFragment
public Fragment getClosestFragment(CandidateElement element)
- Specified by:
getClosestFragmentin interfaceStateVertex
-
hasUnexploredActions
public boolean hasUnexploredActions()
- Specified by:
hasUnexploredActionsin interfaceStateVertex
-
getCandidateElement
public CandidateElement getCandidateElement(Eventable event)
- Specified by:
getCandidateElementin interfaceStateVertex
-
getCluster
public int getCluster()
- Specified by:
getClusterin interfaceStateVertex
-
setCluster
public void setCluster(int cluster)
- Specified by:
setClusterin interfaceStateVertex
-
getClosestDomFragment
public Fragment getClosestDomFragment(CandidateElement element)
- Specified by:
getClosestDomFragmentin interfaceStateVertex
-
setDirectAccess
public void setDirectAccess(CandidateElement element)
- Specified by:
setDirectAccessin interfaceStateVertex
-
isOnURL
public boolean isOnURL()
- Specified by:
isOnURLin interfaceStateVertex
-
setOnURL
public void setOnURL(boolean onURL)
- Specified by:
setOnURLin interfaceStateVertex
-
-