/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package textBox;

import java.awt.geom.*;
import java.awt.font.*;
import util.*;


public class Line{
    int startCharPosition;
    int endCharPosition;
    Point2D textLayoutPosition=null;
    TextLayout textLayout=null;
    String textLayoutString="";
    
    public Line(){}
    public Line(int startCharPosition, int endCharPosition, Point2D textLayoutPosition, 
            TextLayout textLayout, String textLayoutString){
        this.startCharPosition=startCharPosition;
        this.endCharPosition=endCharPosition;
        this.textLayoutPosition=textLayoutPosition;
        this.textLayout=textLayout;
        this.textLayoutString=textLayoutString;
    }
    
    public int getStartCharPosition(){
        return this.startCharPosition;
    }
    public int getEndCharPosition(){
        return this.endCharPosition;
    }
    public Point2D getTextLayoutPosition(){
        return this.textLayoutPosition;
    }
    public TextLayout getTextLayout(){
        return this.textLayout;
    }
    public String getTextLayoutString(){
        return this.textLayoutString;
    }
    public int getStringLength(){
        return this.textLayoutString.length();
    }
    public String toString(){
        String str="Line ";
        str+="CaretPosition start="+this.startCharPosition+", end="+this.endCharPosition;
        str+=", TextLayout position="+Util.Pt(this.textLayoutPosition);
        str+=", ascent="+this.textLayout.getAscent()+", descent="+this.textLayout.getDescent()
                +", leading="+this.textLayout.getLeading();
        str+=", string="+this.textLayoutString.replace("\n", "\\n");
        return str;
    }
}
