001    package edu.rice.cs.cunit.record.syncPoints.thread;
002    
003    import edu.rice.cs.cunit.record.graph.ThreadInfo;
004    import edu.rice.cs.cunit.record.syncPoints.ISyncPoint;
005    import edu.rice.cs.cunit.instrumentors.DoNotInstrument;
006    
007    /**
008     * General class for thread-related synchronization points.
009     * @author Mathias Ricken
010     */
011    @DoNotInstrument
012    public abstract class AThreadSyncPoint implements ISyncPoint {
013        /**
014         * Thread that whose method was called.
015         */
016        protected final Thread _thread;
017    
018        /**
019         * Constructor for this synchronization point.
020         * @param thread thread whose method was called.
021         */
022        public AThreadSyncPoint(Thread thread) {
023            _thread = thread;
024        }
025    
026        /**
027         * Class for translated versions on the monitor side.
028         */
029        public static abstract class Translated implements ISyncPoint.Translated {
030            /**
031             * Info about the thread.
032             */
033            ThreadInfo _threadInfo;
034    
035            /**
036             * Constructor for translated version on the monitor side.
037             * @param threadInfo info about the thread
038             */
039            public Translated(ThreadInfo threadInfo) {
040                _threadInfo = threadInfo;
041            }
042    
043            /**
044             * Returns the info about the thread.
045             * @return thread info
046             */
047            public ThreadInfo getThreadInfo() {
048                return _threadInfo;
049            }
050    
051            /**
052             * Returns a string representation of the object.
053             * @return a string representation of the object.
054             */
055            public String toString() {
056                return this.getClass().getEnclosingClass().getSimpleName()+": ThreadInfo={"+_threadInfo+"}";
057            }
058    
059        }
060    }