Dab tsi yog aggregation hauv Java?
Dab tsi yog aggregation hauv Java?

Video: Dab tsi yog aggregation hauv Java?

Video: Dab tsi yog aggregation hauv Java?
Video: Big Data and Machine Learning - Microsoft TechForum Insights 2024, Kaum ib hlis
Anonim

Aggregation hauv Java yog kev sib raug zoo ntawm ob chav kawm uas zoo tshaj plaws piav raws li "has-a" thiab "tag nrho / ib feem" kev sib raug zoo. Yog tias Chav A muaj cov ntaub ntawv siv rau Chav B thiab Chav B muaj cov lus siv rau Chav A ces tsis muaj tswv cuab meej tuaj yeem txiav txim siab thiab kev sib raug zoo tsuas yog ib qho kev koom tes.

Ib yam li ntawd, nws raug nug, dab tsi yog qhov muaj pes tsawg leeg thiab kev sib sau ua ke hauv Java?

Hauv luv luv, kev sib raug zoo ntawm ob yam khoom raug xa mus ua kev koom tes, thiab lub koom haum hu ua muaj pes tsawg leeg thaum ib yam khoom muaj lwm tus thaum lub koom haum hu ua kev sib sau thaum ib yam khoom siv lwm yam khoom.

Aggregation piav nrog piv txwv yog dab tsi? Kev sib sau ua ke yog ib txoj hauv kev los sau cov ntsiab lus sib txawv ua ke hauv kev txhais cov chav kawm. Rau piv txwv , chav kawm tsheb tuaj yeem ua tau txhais kom muaj lwm chav kawm xws li chav cav, chav zaum, chav log thiab lwm yam piv txwv ntawm kev sib sau yog: Chav kawm qhov rais uas muaj cov chav kawm ntawv qhia zaub mov, chav kos-box thiab lwm yam.

Hais txog qhov no, dab tsi yog qhov khoom sib sau ua ke hauv Java?

Aggregate khoom yog ib pawg ntawm kev koom tes khoom uas raug kho raws li ib chav tsev rau lub hom phiaj ntawm kev hloov cov ntaub ntawv. Tsuas yog ib tug tswv cuab ntawm ib lub sij hawm tuaj yeem siv cov ntaub ntawv sab nraud ntawm lub Ua ke , uas raug xaiv raws li lub hauv paus.

Dab tsi yog qhov sib txawv ntawm qhov qub txeeg qub teg thiab kev sib sau ua ke?

Keeb kwm : ncua kev ua haujlwm ntawm chav kawm los ntawm kev tsim subclass. Override cov tswv cuab superclass hauv subclasses los muab kev ua haujlwm tshiab. Kev sib sau ua ke : tsim kev ua haujlwm tshiab los ntawm kev noj lwm cov chav kawm thiab muab lawv tso rau hauv chav kawm tshiab.

Pom zoo: