package caida.otter;
import java.awt.*;
import java.lang.*;
import caida.tools.PsGenerator;
/**************************************************************************
* File: Link.java Class: Link
* Goal: A self contained class that will maintain its own
* way of draw function, size, color, and a selected color.
*
* Written: Bradley Huffaker (12/17/97)
* Modified: Jaeyeon Jung (3/04/98)
*
* For:Cooperative Association for Internet Data Analysis
***************************************************************************
***************************************************************************
By accessing this software, LINK, you are duly informed of and
agree to be bound by the conditions described below in this notice:
This software product, LINK, is developed by Bradley Huffaker, and
copyrighted(C) 1998 by the University of California, San Diego (UCSD),
with all rights reserved. UCSD administers the NSF grant to CAIDA,
number NCR-9711092, under which this code was developed.
There is no charge for LINK software. You can redistribute it and/or
modify it under the terms of the GNU General Public License, v. 2 dated
June 1991 which is incorporated by reference herein. LINK is
distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use of
it will not infringe on any third party's intellectual property
rights.
You should have received a copy of the GNU GPL along with the LINK
program. Copies can also be obtained from
http://www.gnu.org/copyleft/gpl.html or by writing to
University of California, San Diego
SDSC/CAIDA
9500 Gilman Dr., MS-0505
La Jolla, CA 92093 - 0505 USA
Or contact INFO@CAIDA.ORG
**************************************************************************/
public class Link extends DisplayObject
{
// The to and from node to which it is connected
Node from;
Node to;
// When link is wrapped on the map
boolean wrapped = false;
Node pmirror;
Node cmirror;
// The direction to which this link relation is
int direction;
public static final Color DEFAULT_COLOR = Color.black;
boolean selected = false;
boolean removed = false;
boolean highlighted = false;
public int position = 0;
public int[] fromXY = null;
public int[] toXY = null;
public Link(Node from_input, Node to_input, int direction_input)
{
little_size = 1;
size = 1;
default_color = DEFAULT_COLOR;
color = default_color;
from = from_input;
to = to_input;
from.addLink(this);
to.addLink(this);
direction = direction_input;
}
/****************************************************************
* Purpose: To allow for links to be created where they exists for
* some files and have values that go with them each file
****************************************************************/
public Link(Node from_input,Node to_input, int direction_input,
int fileIndex, int num_files_input)
{
this(from_input, to_input, direction_input);
num_files = num_files_input;
setUpFiles();
setExists(fileIndex);
}
/****************************************************
* Purpose: To have all nodes in order of their names
* and after all lines
*****************************************************/
public boolean greater(DisplayObject object)
{
if (!(object instanceof Link))
return false;
return from.greater(((Link)object).from);
}
public int getMinX()
{
int[] xy=getXY();
int retval;
if (xy[0]>xy[2]){
retval=xy[2]-getSize();
}
else{
retval=xy[0]-getSize();
}
return retval;
}
public int getMaxX()
{
int[] xy=getXY();
int retval;
if (xy[0]>xy[2]){
retval=xy[0]+getSize();
}
else{
retval=xy[2]+getSize();
}
return retval;
}
public int getMinY()
{
int[] xy=getXY();
int retval;
if (xy[1]>xy[3]){
retval=xy[3]-getSize();
}
else{
retval=xy[1]-getSize();
}
return retval;
}
public int getMaxY()
{
int[] xy=getXY();
int retval;
if (xy[1]>xy[3]){
retval=xy[1]+getSize();
}
else{
retval=xy[3]+getSize();
}
return retval;
}
/**************************************************
* Purpose: To find the squared distance from the center of the
* object to the point. I use the squared to avoid needless
* math (ie faster)
*
* Returns : the distance or -1 if distance is greater then size*size
***************************************************/
public double near(int x, int y, int pX, int pY, int cX, int cY)
{
int temp;
int low_x = pX;
int high_x = cX;
if (low_x > high_x)
{
temp = low_x;
low_x = high_x;
high_x = temp;
}
int low_y = pY;
int high_y = cY;
if (low_y > high_y)
{
temp = low_y;
low_y = high_y;
high_y = temp;
}
if (low_x <= x && x <= high_x && low_y <= y && y <= high_y)
{
// REALLY STUPID HACK NO CLUE WHY IT IS NEEDED
x -= pX;
cX -= pX;
pX -= pX;
double Xn = pY - cY;
double Yn = cX - pX;
//jae thinks it's a bug
//double Z = (y*Yn + x*Xn - pY*Yn - pX*Yn);
double Z = (y*Yn + x*Xn - pY*Yn - pX*Xn);
Z = (Z*Z)/(Xn*Xn + Yn*Yn);
if (Z < (size+2)*(2+size))
return Z;
}
return -1;
}
public double near(int x, int y)
{
int pX = from.x;
int pY = from.y;
int cX = to.x;
int cY = to.y;
if (!this.isOnMap())
return near(x,y,pX,pY,cX,cY);
else {
if(!this.isSetLatLon())
return -1;
else if (!wrapped)
return near(x,y,pX,pY,cX,cY);
else {
int pmX = pmirror.x;
int pmY = pmirror.y;
int cmX = cmirror.x;
int cmY = cmirror.y;
double value1 = near(x,y,pmX,pmY,cX,cY);
double value2 = near(x,y,pX,pY,cmX,cmY);
if (value1 > 0 )
return value1;
else
return value2;
}
}
}
public void setSelect(boolean input)
{
if (direction == DIR_ONE)
direction = DIR_TWO;
else
{
Node temp = to;
to = from;
from = temp;
direction = DIR_ONE;
}
}
public boolean isSelected() { return false; }
public void setHighlight(boolean input) { highlighted = input; }
public boolean isHighlighted() { return highlighted; }
public int getDirection()
{
return direction;
}
public void setParent(Node node)
{
from.removeObject(this);
from = node;
from.addLink(this);
}
public DisplayObject getParent() { return from; }
public void setChild(Node node)
{
to.removeObject(this);
to = node;
to.addLink(this);
}
public DisplayObject getChild() { return to; }
public void draw(Graphics g, int x_shift, int y_shift, int x_scale,
int y_scale, Dimension dim, double[] latlon,
boolean drawing_postscript)
{
draw(g,(double)x_shift,(double)y_shift,(double)x_scale,
(double)y_scale,dim,latlon,drawing_postscript);
}
public void draw(Graphics g, double x_shift, double y_shift,
double x_scale,double y_scale, Dimension dim,
double[] latlon, boolean drawing_postscript)
{
if (!exists || hidden || size < 1)
return;
if (removed)
{
System.err.println("Link.draw() Attempt to draw a " +
"removed link");
return;
}
if (selected || highlighted)
g.setColor(selected_color);
else
g.setColor(color);
// We use this for the long names of the nodes at the sides
if (!drawing_postscript) {
x_shift += ShiftImage.getXShift();
y_shift += ShiftImage.getYShift();
}
double pX, pY, cX, cY;
int[] pXY = from.getLineXY(this, currentPaintCounter, true);
int[] cXY = to.getLineXY(this, currentPaintCounter, false);
currentPaintCounter++;
// From DisplayObject shared with Path.
drawLine(g, pXY[0], pXY[1],cXY[0],cXY[1], x_shift, y_shift,
x_scale, y_scale, drawing_postscript);
}
public int[] ToMap(double lat, double lon, double[] latlon, Dimension dim)
{
int height = dim.height;
int width = dim.width;
int[] xy = new int[2];
double boundary = (latlon[1] + latlon[3])/2 - 180;
while (lon < boundary )
lon += 360.0;
xy[0] = (int) (
((lon - latlon[1]) * width) / (latlon[3] - latlon[1]));
xy[1] = (int) (
((latlon[0] - lat) * height) / (latlon[0] - latlon[2]));
return xy;
}
public DisplayObject[] remove()
{
removed = true;
from.removeObject(this);
to.removeObject(this);
return new DisplayObject[0];
}
public void removeObject(DisplayObject object)
{
removed = true;
if (object == from || object == to)
remove();
}
public String getInfo()
{
String middle = " -> ";
String end = "";
if (direction != DIR_ONE)
middle = " <-> ";
if (current_group != null && current_values != null)
{
if (current_group.getType() == ValuesGroup.DOUBLE)
end = " (" + (float)double_value +")";
else
end = " (" + string_value +")";
}
return from.getName() + middle + to.getName() + end;
}
public void setFromXY(int x, int y) {
fromXY = new int[2];
fromXY[0] = x;
fromXY[1] = y;
if (from == to) {
toXY = new int[2];
toXY[0] = x;
toXY[1] = y;
}
}
public void setToXY(int x, int y) {
toXY = new int[2];
toXY[0] = x;
toXY[1] = y;
if (from == to) {
fromXY = new int[2];
fromXY[0] = x;
fromXY[1] = y;
}
}
public void setXY(int x, int y)
{
// It is not allowed to setXY on links
// You change it from and to nodes.
}
public int[] getXY()
{
int[] xy = new int[4];
xy[0] = (from.getLineXY(this, prevPaintCounter, true))[0];
xy[1] = (from.getLineXY(this, prevPaintCounter, true))[1];
xy[2] = (to.getLineXY(this, prevPaintCounter, false))[0];
xy[3] = (to.getLineXY(this, prevPaintCounter, false))[1];
return xy;
}
public void changeXY(int delta_x, int delta_y)
{
// You are not allowed to change the XY of a link
// YOu change it from and to nodes.
}
// ------------------- Animation Stuff -------------------------
public boolean equals(Node server, Node client)
{
return server == from && client == to;
}
public boolean equals(Object obj) {
if (!(obj instanceof Link)) {
return false;
}
if (((Link) obj).from == from &&
((Link) obj).to == to) {
return true;
}
return false;
}
}
There was peace and harmony in the home of the Reverend Taylor. An air of neatness and prosperity was about his four-room adobe house. The mocking-bird that hung in a willow cage against the white wall, by the door, whistled sweet mimicry of the cheep of the little chickens in the back yard, and hopped to and fro and up and down on his perches, pecking at the red chili between the bars. From the corner of his eyes he could peek into the window, and it was bright with potted geraniums, white as the wall, or red as the chili, or pink as the little crumpled palm that patted against the glass to him. It was the first scene of the closing act of the tragic comedy of the Geronimo campaign. That wily old devil, weary temporarily of the bloodshed he had continued with more or less regularity for many years, had[Pg 297] sent word to the officers that he would meet them without their commands, in the Ca?on de los Embudos, across the border line, to discuss the terms of surrender. The officers had forthwith come, Crook yet hopeful that something might be accomplished by honesty and plain dealing; the others, for the most part, doubting. The two rival Ministers of England became every day more embittered against each other; and Bolingbroke grew more daring in his advances towards the Pretender, and towards measures only befitting a Stuart's reign. In order to please the High Church, whilst he was taking the surest measures to ruin it by introducing a popish prince, he consulted with Atterbury, and they agreed to bring in a Bill which should prevent Dissenters from educating their own children. This measure was sure to please the Hanoverian Tories, who were as averse from the Dissenters as the Whigs. Thus it would conciliate them and obtain their support at the[19] very moment that the chief authors of it were planning the ruin of their party. This Bill was called the Schism Bill, and enjoined that no person in Great Britain should keep any school, or act as tutor, who had not first subscribed the declaration to conform to the Church of England, and obtained a licence of the diocesan. Upon failure of so doing, the party might be committed to prison without bail; and no such licence was to be granted before the party produced a certificate of his having received the Sacrament according to the communion of the English Church within the last year, and of his having also subscribed the oaths of Allegiance and Supremacy. The earliest martial event of the year 1760 was the landing of Thurot, the French admiral, at Carrickfergus, on the 28th of February. He had been beating about between Scandinavia and Ireland till he had only three ships left, and but six hundred soldiers. But Carrickfergus being negligently garrisoned, Thurot made his way into the town and plundered it, but was soon obliged to abandon it. He was overtaken by Captain Elliot and three frigates before he had got out to sea, his ships were taken, he himself was killed, and his men were carried prisoners to Ramsey, in the Isle of Man. "I see you've got a cow here," said a large man wearing a dingy blue coat with a Captain's faded shoulder-straps. "I'm a Commissary, and it's my duty to take her." Suddenly they heard little Pete's voice calling: "Stop your ranting and tell me how the hogs got you." "Hold, Lord de Boteler," interrupted Father John, calmly; "the threat need not pass thy lips: I go; but before I depart I shall say, in spite of mortal tongue or mortal hand, that honor and true knighthood no longer preside in this hall, where four generations upheld them unsullied." HoME小明看看台湾视频发布
ENTER NUMBET 0017
svita.com.cn
xiyin0.com.cn
www.fuduo1.com.cn
wudui8.com.cn
niban0.com.cn
www.hezhe2.net.cn
www.nj9424.com.cn
ahwoman.org.cn
ac8news.com.cn
www.ad8news.com.cn