开发者

In java, what's the relationship between field and class?

开发者 https://www.devze.com 2023-03-05 00:42 出处:网络
Please refer to this API. The link is: http://download.carrot2.org/stable/javadoc/org/carrot2/text/preprocessing/pipeline/CompletePreprocessingPipeline.html

Please refer to this API. The link is:

http://download.carrot2.org/stable/javadoc/org/carrot2/text/preprocessing/pipeline/CompletePreprocessingPipeline.html

Class CompletePreprocessingPipeline

Field Summary
 DocumentAssigner   documentAssigner
          Document assigner used by the algorithm, contains bindable attributes.

Then I found some example using completePreprocessingPipeline this way

completePreprocessingPipeline().documentAssigner()exactPhraseAssignment(true)

I do not understand the relationship between "completePreprocessingPipeline" and "documentAss开发者_如何学运维igner" in terms of "field vs.class".


A class contains fields. All instance of that class have those fields.

http://download.oracle.com/javase/tutorial/java/javaOO/classes.html

In the first example, The Bicycle class has three fields cadence, dear and speed.

This is standard Java code structure, nothing special about it. I suggest you learn some Java and the Javadocs may make more sense.


Your example must be from some other language. Maybe a scripting language that can run on the JVM or see Java libraries.

What might be true in java:

CompletePreprocessingPipeline completePreprocessingPipeline = new CompletePreprocessingPipeline();
completePreprocessingPipeline.documentAssigner.exactPhraseAssignment = true;

You instantiate a class, and get an object. Then you can refer to fields in the object, if the field modifier allows it (if it were public for example)


A field is a member variable of a class. The type of the field may indeed be another class.

In this case their appears to be a "getter method" .documentAssigner() which returns the documentAssigner field, which is of the type DocumentAssigner.


I do not understand the relationship between "completePreprocessingPipeline" and "documentAssigner" in terms of "field vs.class".

That's because your question doesn't make sense. Both completePreprocessingPipeline() and documentAssigner() are methods. No fields at all in that code. Ad there is a missing '.'.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号