@param nie ma w dokumentacji

0

po przepuszczeniu przez javadoc takiego kodu jak ponizej informacje zawarte w @param nie były umieszczonie nigdzie w dokumentacji. Były tylko metody
Tak ma być? Czy może w zlym miejscu umieszczam @param. Jesli nie jest on czytany to poco on komu?

//:AXJ/src/AXJAplet.java

import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.applet.*;
/**Program zaliczeniowy imustrujacy dzialnie sieci sieci p2p
 * @author xxxxxxxxx
 * @version 1.0 
 */

public class AXJAplet extends Applet implements Runnable,MouseListener
{
	/**
	 * @param px1 wspolrzedne odcietych polozenia kulek
	 * @param py1 wspolrzedne rzednych polozenia kulek
	 */
	int px1,py1,
		px2,py2,
		px3,py3,
		px4,py4,
		bX=0,bY=0;
	/**
	 * @param msX odcieta polozenia kursora myszki
	 * @param msY rzedna polozenia kursora myszki
	 */
	int	msX,msY;
	/**
	 * @param R rozmiar kulki
	 */
	static int R=20;
	/**
	 * @param running true, aplet dzila false aplet nie dziala
	 */
	boolean running=false;
	/**
	 * @param mn [gdzie n =<1..4>] punkty miedzy ktorymi przesuwa sie kropa 
	 */
	Punkt m1,m2,m3,m4;
	/**
	 * @param obr obazek komputera
	 */
	Image obr;
	/**
	 * @param p przesuniecie punktow wzgledem obrazka 
	 */
	static int p=25;
	/**
	 * @param t zmienna do obslugi watku
	 */
	Thread t;
	/**
	 * @param kol kolory dla elemntow naaolecie, deklaracja tego pozwala zminiac kolory w innych mijscach niz metoda paint()
	 */
	Color kol=Color.black;
	/**
	 * wykonywana na poczotku apletu.Tu wlancza obsluge zdarzen myszy(addmouseListener(). Tworzy punkty krancowe m[gdzie m=<1..4>] tj wspolrzedne rzednych i odcietych  
	 */
	public void init()
	{
		addMouseListener(this);
		m1=new Punkt(150,0);
		m2=new Punkt(0,150);
		m3=new Punkt(150,300);
		m4=new Punkt(300,150);
		obr=getImage(getDocumentBase(), "komp.jpeg");
	}
	/**
	 * rysuje applet
	 */
	public void paint(Graphics d)
	{
		d.setColor(Color.white);
		d.fillRect(0, 0, 350, 350);
		d.setColor(Color.black);
		d.drawLine(m1.x+p, m1.y+p, m4.x+p, m4.y+p);
		d.drawLine(m2.x+p, m2.y+p, m1.x+p, m1.y+p);
		d.drawLine(m2.x+p, m2.y+p, m3.x+p, m3.y+p);
		d.drawLine(m4.x+p, m4.y+p, m3.x+p, m3.y+p);
		d.fillOval(px1, py1, R, R);
		d.fillOval(px2, py2, R, R);
		d.fillOval(px3, py3, R, R);
		d.fillOval(px4, py4, R, R);
		d.drawImage(obr, m1.x, m1.y, this);
		d.drawImage(obr, m2.x, m2.y, this);
		d.drawImage(obr, m3.x, m3.y, this);
		d.drawImage(obr, m4.x, m4.y, this);
		d.fillRect(bX, bY, 70, 30);
		d.setColor(Color.white);
		d.drawString("START", bX+20, bY+20);
	}
	/**
	 * kod wykonywany w momencie uruchomienia watku metodo start(). Zmienia wspolrzedna polozenia kul pxn i pyn[gdzie n=<1..4>.Odswierza miejsca na aplecie w krorych nasopila zmiana a wiec okolice punktow polzenia kuli. Wstrzymuje dzialania watku aby bylo mozliwe uchwycenie ludzkim okiem zmian.
	 */
	public void run()
	{
		running=true;
		kol=Color.DARK_GRAY;
		for(int a=0;a<150;a++)
		{
			px1++;px2++;px3--;px4--;
			py1++;py2--;py3--;py4++;
			repaint(px1-5,py1-5,R+10,R+10);
			repaint(px2-5,py2-5,R+10,R+10);
			repaint(px3,py3,R+5,R+5);
			repaint(px4,py4,R+5,R+5);
			try{Thread.sleep(50);}catch(InterruptedException ex){}
		}
		running=false;
	}
	/**
	 * uchwyt do obslugi klikniecia myszko w obszaze apletu. Pobiera wspolzedne polozenia myszy. Sprwdza czy mysz znajduje sie w obszazee guzika. Sprawdzaczy watek zmiany polozenia kulek dziala. Jesli poprzednie warunki so spelnione to ustawia punkty poczotkowe kul i tworzy i uruchamia watek przesuwania kul.  
	 */
	public void mouseClicked(MouseEvent e)
	{
		msX=e.getX();
		msY=e.getY();
		if(!running && ( msX<bX+70&&msY<bY+30))
		{
			px1=m1.x+13;py1=m1.y+13;
			px2=m2.x+14;py2=m2.y+14;
			px3=m3.x+13;py3=m3.y+13;
			px4=m4.x+14;py4=m4.y+14;
			t=new Thread(this);
			t.start();
		}
	}
	public void mousePressed(MouseEvent e) {}
	public void mouseEntered(MouseEvent e) {}
	public void mouseExited(MouseEvent e) {}
	public void mouseReleased(MouseEvent e) {}
}
class Punkt 
{
	/**
	 * @param x wspolrzedna odcietych punktu krancowego
	 * @param y wspolrzedna rzedych punktu krancowego
	 */
	int x,y;
	Punkt(int x,int y)
	{
		this.x=x;
		this.y=y;
	}
}





0

A wystarczy przeczytać co mówi javadc w trakcie generowania dokumentacji:

AXJAplet.java:19: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:19: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:19: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:19: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:20: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:20: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:20: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:20: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:21: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:21: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:21: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:21: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:22: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:22: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:22: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:22: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:23: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:23: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:23: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:23: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:28: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:28: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:28: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:28: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:36: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:40: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:40: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:40: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:40: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:44: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:52: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.
AXJAplet.java:56: warning - Tag @param cannot be used in field documentation. It can only be used in the following types of documentation: class/interface, constructor, method.

Adnotacji @param można używać tylko w przypadku metod i konstruktorów do opisu ich parametrów, a nie pol! W przypadku dokumentownia pól należy używać zwykłych komentarzy javadoc:

class A{
  /**
   *
   */
   int pole;
}
0

Aby w dokumentacji opisać pola klasy należy plik źródłowy pisać tak:

        /**
         * wspolrzedne odcietych polozenia kulek
         */
        int px1;
        /**
         *  wspolrzedne rzednych polozenia kulek
         */
        int py1;
        ....

pozdrawiam
bogdans

0

@Koziołek Zacząłem pisać, kiedy Twojej odpowiedzi jeszcze nie było.

0

prosze to skasować już wiem o co chodzi, @param jest dla parametrów metody a nie dla zmienych

0

ale javadoc i tak tego:

/**
*opis
*/
int a;

nie przetwarza i nie wstawia do dokumentacji ? bo niewiedze nigdzie

0

po * powinna być spacja. Javadoc dość ostro dba o składnię.

0

a nie wynika to z tego ze javadoc domyslnie przetwarza tylko publiki? a ta zmienna jest domyslnego dostepu
jesli tak to wystarczy podac parametr do javadoca i juz (parametry -package, -private, -protected, -publc)
jesli chcesz widziec wszystko to dajesz -private i juz
odsylam do dokumentacji
pozdro

0

@elczupakabra, domyślnie łapane są protected. Zatem powinno złapać i tego defaulta... hm...

0

Przeprowadziłem doświadczenie, javadoc bez parametrów dokumentuje pola public i protected, pomija private, package i te bez deklaracji.
(spacja po * nie jest konieczna)
pozdrawiam

0

@koziolek - to ma zwiazek z coraz to silniejszymi restrykcjami w dostepie do pol i metod, ktore sa po kolei od najmniej do najbardzoej restrykcyjnego:

  1. public
  2. protected
  3. tzw default. package
  4. private

javadoc domyslnie ma ustaiwany, jak sam napisales, protected, wiec nic dziwnego ze nie lapie defaulta skoro ten jest bardziej restrykcyjny

protected pozwala na odwolanie sie innym klasom z pakietu, jak i rowniez podklasom
default pozwala na odwolanie sie innym klasom z kapietu (inaczej dlatego zwany package protected / private), natomiast zadna inna klasa nie moze sie odwolac, nawet podklasa

rozwiazaniem jest wiec wywolanie javadoca z przelacznikiem -package

pozdrawiam

1 użytkowników online, w tym zalogowanych: 0, gości: 1