/*-------------------------------------------------------------------------------
Copyright (c)2000 TogetherSoft Corporation. Patents pending. All rights reserved.
-------------------------------------------------------------------------------*/

package com.togethersoft.modules.showdependencies;

import com.togethersoft.openapi.sci.SciTextPositions;

/**
  * Represents a code framgent causing a dependency between two SciClasses.
  * Contains the information about its SciTextPositions, its name and
  * the category of this code fragment (used to highlight CodeFragments
  * in the tree with different colors)
  *
  * @author TogetherSoft
  */
class CodeFragment
{
    /**
     * Creates instance of class with specified parameters.
     *
     * @param visisbleText text taht will be displayed in the tree
     * @param kind kind of code fragment (look below)
     * @pos SciTextPosition object
     * @comment  string comment used as tooltip
     */
    public CodeFragment
    (String visibleText, int kind, SciTextPositions pos, String comment)
    {
        myVisibleText = visibleText;
        myKind = kind;
        myPos = pos;
        myComment = comment;
    }

    /**
     * Returns visible text. This text will be displayed in the tree.
     *
     * @return visible text.
     */
    public String getVisibleText()
    {
        return myVisibleText;
    }

    /**
     * Returns code fragment kind
     *
     * @return code fragment kind
     */
    public int getKind()
    {
        return myKind;
    }

    /**
     * Returns the SciTextPositions object
     *
     * @return the SciTextPositions object
     */
    public SciTextPositions getSciPositions()
    {
        return myPos;
    }

    /**
     * Returns the comment used as a tooltip
     *
     * @return the comment used as a tooltip
     */
    public String getComment()
    {
        return myComment;
    }

    // These constants define all the possible kinds of CodeFragments.
    // These kinds are used to highlight CodeFragments with different colors.
    public final static int REFERENCE_EXPRESSION = 0;
    public final static int DECLARATION = 1;
    public final static int ATTRIBUTE = 2;
    public final static int OPERATION = 3;
    public final static int INHERITANCE = 4;

    private String myVisibleText;
    private int myKind;
    private SciTextPositions myPos;
    private String myComment;

}


