com.jezhumble.javasysmon
Class OsProcess

java.lang.Object
  extended by com.jezhumble.javasysmon.OsProcess

public class OsProcess
extends java.lang.Object

This object represents a node in the process tree. It knows information about the process it represents, and also what its children are.


Method Summary
 void accept(ProcessVisitor processVisitor, int level)
          Method to allow visiting the process tree.
 java.util.List children()
          Gets the list of child processes of this object.
static OsProcess createTree(ProcessInfo[] processTable)
          This method is the only way to create an OsProcess object.
 OsProcess find(int pid)
          Finds and returns a particular node in the process tree by its id.
 ProcessInfo processInfo()
          Information about this process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createTree

public static OsProcess createTree(ProcessInfo[] processTable)
This method is the only way to create an OsProcess object. It creates a graph of OsProcess objects from an array of ProcessInfo objects representing the processes in the system.

Parameters:
processTable - An array of objects representing the processes in the system.
Returns:
A graph of OsProcess objects.

children

public java.util.List children()
Gets the list of child processes of this object.

Returns:
The list of child processes of this object.

processInfo

public ProcessInfo processInfo()
Information about this process.

Returns:
Information about this process.

find

public OsProcess find(int pid)
Finds and returns a particular node in the process tree by its id.

Parameters:
pid - the id of the process to find.
Returns:
The process node in the tree.

accept

public void accept(ProcessVisitor processVisitor,
                   int level)
Method to allow visiting the process tree. Use the convenience method JavaSysMon.visitProcessTree(int, com.jezhumble.javasysmon.ProcessVisitor)

Parameters:
processVisitor - An instance of ProcessVisitor
level - The level currently being visited


Copyright © 2009 ThoughtWorks. All Rights Reserved.