[{"data":1,"prerenderedAt":1484},["ShallowReactive",2],{"i-simple-icons:github":3,"i-simple-icons:x":8,"i-brand:linkedin":10,"i-simple-icons:medium":14,"i-lucide:mail":16,"i-lucide:sun":18,"pattern:\u002Flearn\u002Fdesign-patterns\u002Fvisitor":20,"pattern-group:\u002Flearn\u002Fdesign-patterns\u002Fvisitor":1425,"i-lucide:lightbulb":1462,"i-lucide:workflow":1464,"i-lucide:link":1466,"i-lucide:square-terminal":1468,"i-lucide:list-ordered":1470,"i-lucide:bell":1472,"i-lucide:toggle-left":1474,"i-lucide:shuffle":1476,"i-lucide:layout-template":1478,"i-lucide:footprints":1480,"i-lucide:copy":1482},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":7},0,24,false,"\u003Cpath fill=\"currentColor\" d=\"M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":9},"\u003Cpath fill=\"currentColor\" d=\"M14.234 10.162L22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299l-.929-1.329L3.076 1.56h3.182l5.965 8.532l.929 1.329l7.754 11.09h-3.182z\"\u002F>",{"left":4,"top":11,"width":12,"height":12,"rotate":4,"vFlip":6,"hFlip":6,"body":13},32,448,"\u003Cpath fill=\"currentColor\" d=\"M416 32L31.9 32C14.3 32 0 46.5 0 64.3L0 447.7C0 465.5 14.3 480 31.9 480L416 480c17.6 0 32-14.5 32-32.3l0-383.4C448 46.5 433.6 32 416 32zM135.4 416l-66.4 0 0-213.8 66.5 0 0 213.8-.1 0zM102.2 96a38.5 38.5 0 1 1 0 77 38.5 38.5 0 1 1 0-77zM384.3 416l-66.4 0 0-104c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9l0 105.8-66.4 0 0-213.8 63.7 0 0 29.2 .9 0c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9l0 117.2z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":15},"\u003Cpath fill=\"currentColor\" d=\"M4.21 0A4.2 4.2 0 0 0 0 4.21v15.58A4.2 4.2 0 0 0 4.21 24h15.58A4.2 4.2 0 0 0 24 19.79v-1.093a5 5 0 0 1-.422.02c-2.577 0-4.027-2.146-4.09-4.832a8 8 0 0 1 .022-.708c.093-1.186.475-2.241 1.105-3.022a3.9 3.9 0 0 1 1.395-1.1c.468-.237 1.127-.367 1.664-.367h.023q.151 0 .303.01V4.211A4.2 4.2 0 0 0 19.79 0Zm.198 5.583h4.165l3.588 8.435l3.59-8.435h3.864v.146l-.019.004c-.705.16-1.063.397-1.063 1.254h-.003l.003 10.274c.06.676.424.885 1.063 1.03l.02.004v.145h-4.923v-.145l.019-.005c.639-.144.994-.353 1.054-1.03V7.267l-4.745 11.15h-.261L6.15 7.569v9.445c0 .857.358 1.094 1.063 1.253l.02.004v.147H4.405v-.147l.019-.004c.705-.16 1.065-.397 1.065-1.253V6.987c0-.857-.358-1.094-1.064-1.254l-.018-.004zm19.25 3.668c-1.086.023-1.733 1.323-1.813 3.124H24V9.298a1.4 1.4 0 0 0-.342-.047m-1.862 3.632c-.1 1.756.86 3.239 2.204 3.634v-3.634z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":17},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"m22 7l-8.991 5.727a2 2 0 0 1-2.009 0L2 7\"\u002F>\u003Crect width=\"20\" height=\"16\" x=\"2\" y=\"4\" rx=\"2\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":19},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Ccircle cx=\"12\" cy=\"12\" r=\"4\"\u002F>\u003Cpath d=\"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41\"\u002F>\u003C\u002Fg>",{"id":21,"title":22,"body":23,"description":1411,"example":1412,"extension":1413,"group":1414,"icon":1415,"meta":1416,"navigation":266,"order":452,"path":1417,"rawbody":1418,"seo":1419,"sitemap":1420,"source":1421,"stem":1422,"summary":1423,"__hash__":1424},"patterns\u002Flearn\u002Fdesign-patterns\u002Fvisitor.md","Visitor",{"type":24,"value":25,"toc":1401},"minimark",[26,31,35,62,65,69,89,93,98,109,113,126,130,133,205,209,274,330,584,796,971,1245,1383,1389,1397],[27,28,30],"h2",{"id":29},"the-idea","The idea",[32,33,34],"p",{},"Say you have a stable set of classes, such as kinds of employee, and you keep needing new operations on them: work out pay, export to a spreadsheet, print a report. Adding each operation as a method to every class spreads unrelated code across all of them, and means editing them every time.",[32,36,37,38,42,43,46,47,50,51,54,55,58,59,61],{},"The Visitor pattern moves each operation into its own class, a visitor. The visitor has one ",[39,40,41],"code",{},"visit"," method for each class it can work on. Each of those classes gets a single ",[39,44,45],{},"accept(visitor)"," method that calls ",[39,48,49],{},"visitor.visit(this)",". Inside ",[39,52,53],{},"accept",", ",[39,56,57],{},"this"," has the exact type of the class, so Java picks the matching ",[39,60,41],{}," method.",[32,63,64],{},"This two-step call is known as double dispatch: the code that runs depends on both the type of the visitor and the type of the element. A new operation is now a new visitor class, and the element classes don't change.",[27,66,68],{"id":67},"when-to-use-it","When to use it",[70,71,72,76,79,86],"ul",{},[73,74,75],"li",{},"You need many unrelated operations on a set of classes, and don't want to fill those classes with them.",[73,77,78],{},"The set of classes rarely changes, but new operations are added often.",[73,80,81,82,85],{},"An operation needs different logic for each class, and you want to avoid ",[39,83,84],{},"instanceof"," checks.",[73,87,88],{},"You want to collect results across a structure of objects, such as totals over a list or a tree.",[27,90,92],{"id":91},"pros-and-cons","Pros and cons",[94,95,97],"h3",{"id":96},"pros","Pros",[70,99,100,103,106],{},[73,101,102],{},"Adding a new operation is easy: write a new visitor, without touching the element classes.",[73,104,105],{},"It separates concerns: each operation lives in one class instead of being spread across many.",[73,107,108],{},"A visitor can keep state as it goes, such as a running total.",[94,110,112],{"id":111},"cons","Cons",[70,114,115,118,123],{},[73,116,117],{},"It adds classes to the system: one for every operation.",[73,119,120,121,61],{},"Adding a new element class is hard, because every visitor needs a new ",[39,122,41],{},[73,124,125],{},"Visitors often need public getters on the elements to do their work, which weakens encapsulation.",[27,127,129],{"id":128},"the-example","The example",[32,131,132],{},"The example is a payroll. An organisation has full-time and part-time employees, and their pay is worked out in different ways. That calculation lives in a visitor, not in the employee classes.",[70,134,135,146,157,178,186,197],{},[73,136,137,143,144,61],{},[138,139,140],"strong",{},[39,141,142],{},"Employee",": the element interface, with a single ",[39,145,45],{},[73,147,148,153,154,156],{},[138,149,150],{},[39,151,152],{},"EmployeeVisitor",": the visitor interface, with one ",[39,155,41],{}," method for each kind of employee.",[73,158,159,164,165,170,171,174,175,177],{},[138,160,161],{},[39,162,163],{},"FullTimeEmployee"," and ",[138,166,167],{},[39,168,169],{},"PartTimeEmployee",": concrete elements. Each ",[39,172,173],{},"accept()"," calls ",[39,176,49],{},".",[73,179,180,185],{},[138,181,182],{},[39,183,184],{},"SalaryCalculator",": the concrete visitor. It adds a full-time employee's salary to the total. For a part-time employee, it adds the hourly rate times 20 × 8, that is 160 hours.",[73,187,188,193,194,196],{},[138,189,190],{},[39,191,192],{},"Organization",": the object structure. It holds the employees, passes one ",[39,195,184],{}," to each of them, and prints the total.",[73,198,199,204],{},[138,200,201],{},[39,202,203],{},"Demo",": adds a full-time employee on 10,000 and a part-time one at 30 an hour, then asks for the total: 10,000 plus 30 × 160.",[27,206,208],{"id":207},"the-code","The code",[210,211,217],"pre",{"className":212,"code":213,"filename":214,"language":215,"meta":216,"style":216},"language-java shiki shiki-themes haytham-dark haytham-light","public interface Employee {\n    void accept(EmployeeVisitor visitor);\n\n}\n","Employee.java","java","",[39,218,219,239,261,268],{"__ignoreMap":216},[220,221,224,228,231,235],"span",{"class":222,"line":223},"line",1,[220,225,227],{"class":226},"sVsk0","public",[220,229,230],{"class":226}," interface",[220,232,234],{"class":233},"sNwy7"," Employee",[220,236,238],{"class":237},"sVG6I"," {\n",[220,240,242,245,249,252,254,258],{"class":222,"line":241},2,[220,243,244],{"class":226},"    void",[220,246,248],{"class":247},"sVz7n"," accept",[220,250,251],{"class":237},"(",[220,253,152],{"class":226},[220,255,257],{"class":256},"sWFPS"," visitor",[220,259,260],{"class":237},");\n",[220,262,264],{"class":222,"line":263},3,[220,265,267],{"emptyLinePlaceholder":266},true,"\n",[220,269,271],{"class":222,"line":270},4,[220,272,273],{"class":237},"}\n",[210,275,278],{"className":212,"code":276,"filename":277,"language":215,"meta":216,"style":216},"public interface EmployeeVisitor {\n    void visit(FullTimeEmployee employee);\n\n    void visit(PartTimeEmployee employee);\n}\n","EmployeeVisitor.java",[39,279,280,291,307,311,325],{"__ignoreMap":216},[220,281,282,284,286,289],{"class":222,"line":223},[220,283,227],{"class":226},[220,285,230],{"class":226},[220,287,288],{"class":233}," EmployeeVisitor",[220,290,238],{"class":237},[220,292,293,295,298,300,302,305],{"class":222,"line":241},[220,294,244],{"class":226},[220,296,297],{"class":247}," visit",[220,299,251],{"class":237},[220,301,163],{"class":226},[220,303,304],{"class":256}," employee",[220,306,260],{"class":237},[220,308,309],{"class":222,"line":263},[220,310,267],{"emptyLinePlaceholder":266},[220,312,313,315,317,319,321,323],{"class":222,"line":270},[220,314,244],{"class":226},[220,316,297],{"class":247},[220,318,251],{"class":237},[220,320,169],{"class":226},[220,322,304],{"class":256},[220,324,260],{"class":237},[220,326,328],{"class":222,"line":327},5,[220,329,273],{"class":237},[210,331,334],{"className":212,"code":332,"filename":333,"language":215,"meta":216,"style":216},"public class FullTimeEmployee implements Employee {\n    private final String name;\n    private final double salary;\n\n    public FullTimeEmployee(String name, double salary) {\n        this.name = name;\n        this.salary = salary;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public double getSalary() {\n        return salary;\n    }\n\n    @Override\n    public void accept(EmployeeVisitor visitor) {\n        visitor.visit(this);\n    }\n}\n","FullTimeEmployee.java",[39,335,336,353,370,384,388,414,434,450,456,461,476,486,491,496,510,519,524,529,538,558,574,579],{"__ignoreMap":216},[220,337,338,340,343,346,349,351],{"class":222,"line":223},[220,339,227],{"class":226},[220,341,342],{"class":226}," class",[220,344,345],{"class":233}," FullTimeEmployee",[220,347,348],{"class":226}," implements",[220,350,234],{"class":233},[220,352,238],{"class":237},[220,354,355,358,361,364,367],{"class":222,"line":241},[220,356,357],{"class":226},"    private",[220,359,360],{"class":226}," final",[220,362,363],{"class":226}," String",[220,365,366],{"class":256}," name",[220,368,369],{"class":237},";\n",[220,371,372,374,376,379,382],{"class":222,"line":263},[220,373,357],{"class":226},[220,375,360],{"class":226},[220,377,378],{"class":226}," double",[220,380,381],{"class":256}," salary",[220,383,369],{"class":237},[220,385,386],{"class":222,"line":270},[220,387,267],{"emptyLinePlaceholder":266},[220,389,390,393,395,397,400,402,405,407,409,412],{"class":222,"line":327},[220,391,392],{"class":226},"    public",[220,394,345],{"class":247},[220,396,251],{"class":237},[220,398,399],{"class":226},"String",[220,401,366],{"class":256},[220,403,404],{"class":237},",",[220,406,378],{"class":226},[220,408,381],{"class":256},[220,410,411],{"class":237},")",[220,413,238],{"class":237},[220,415,417,421,423,427,430,432],{"class":222,"line":416},6,[220,418,420],{"class":419},"sheII","        this",[220,422,177],{"class":237},[220,424,426],{"class":425},"s4Awn","name",[220,428,429],{"class":237}," =",[220,431,366],{"class":256},[220,433,369],{"class":237},[220,435,437,439,441,444,446,448],{"class":222,"line":436},7,[220,438,420],{"class":419},[220,440,177],{"class":237},[220,442,443],{"class":425},"salary",[220,445,429],{"class":237},[220,447,381],{"class":256},[220,449,369],{"class":237},[220,451,453],{"class":222,"line":452},8,[220,454,455],{"class":237},"    }\n",[220,457,459],{"class":222,"line":458},9,[220,460,267],{"emptyLinePlaceholder":266},[220,462,464,466,468,471,474],{"class":222,"line":463},10,[220,465,392],{"class":226},[220,467,363],{"class":226},[220,469,470],{"class":247}," getName",[220,472,473],{"class":237},"()",[220,475,238],{"class":237},[220,477,479,482,484],{"class":222,"line":478},11,[220,480,481],{"class":226},"        return",[220,483,366],{"class":256},[220,485,369],{"class":237},[220,487,489],{"class":222,"line":488},12,[220,490,455],{"class":237},[220,492,494],{"class":222,"line":493},13,[220,495,267],{"emptyLinePlaceholder":266},[220,497,499,501,503,506,508],{"class":222,"line":498},14,[220,500,392],{"class":226},[220,502,378],{"class":226},[220,504,505],{"class":247}," getSalary",[220,507,473],{"class":237},[220,509,238],{"class":237},[220,511,513,515,517],{"class":222,"line":512},15,[220,514,481],{"class":226},[220,516,381],{"class":256},[220,518,369],{"class":237},[220,520,522],{"class":222,"line":521},16,[220,523,455],{"class":237},[220,525,527],{"class":222,"line":526},17,[220,528,267],{"emptyLinePlaceholder":266},[220,530,532,535],{"class":222,"line":531},18,[220,533,534],{"class":237},"    @",[220,536,537],{"class":226},"Override\n",[220,539,541,543,546,548,550,552,554,556],{"class":222,"line":540},19,[220,542,392],{"class":226},[220,544,545],{"class":226}," void",[220,547,248],{"class":247},[220,549,251],{"class":237},[220,551,152],{"class":226},[220,553,257],{"class":256},[220,555,411],{"class":237},[220,557,238],{"class":237},[220,559,561,564,566,568,570,572],{"class":222,"line":560},20,[220,562,563],{"class":256},"        visitor",[220,565,177],{"class":237},[220,567,41],{"class":247},[220,569,251],{"class":237},[220,571,57],{"class":419},[220,573,260],{"class":237},[220,575,577],{"class":222,"line":576},21,[220,578,455],{"class":237},[220,580,582],{"class":222,"line":581},22,[220,583,273],{"class":237},[210,585,588],{"className":212,"code":586,"filename":587,"language":215,"meta":216,"style":216},"public class PartTimeEmployee implements Employee {\n    private final String name;\n    private final double hourlyRate;\n\n    public PartTimeEmployee(String name, double hourlyRate) {\n        this.name = name;\n        this.hourlyRate = hourlyRate;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public double getHourlyRate() {\n        return hourlyRate;\n    }\n\n    @Override\n    public void accept(EmployeeVisitor visitor) {\n        visitor.visit(this);\n    }\n}\n","PartTimeEmployee.java",[39,589,590,605,617,630,634,656,670,685,689,693,705,713,717,721,734,742,746,750,756,774,788,792],{"__ignoreMap":216},[220,591,592,594,596,599,601,603],{"class":222,"line":223},[220,593,227],{"class":226},[220,595,342],{"class":226},[220,597,598],{"class":233}," PartTimeEmployee",[220,600,348],{"class":226},[220,602,234],{"class":233},[220,604,238],{"class":237},[220,606,607,609,611,613,615],{"class":222,"line":241},[220,608,357],{"class":226},[220,610,360],{"class":226},[220,612,363],{"class":226},[220,614,366],{"class":256},[220,616,369],{"class":237},[220,618,619,621,623,625,628],{"class":222,"line":263},[220,620,357],{"class":226},[220,622,360],{"class":226},[220,624,378],{"class":226},[220,626,627],{"class":256}," hourlyRate",[220,629,369],{"class":237},[220,631,632],{"class":222,"line":270},[220,633,267],{"emptyLinePlaceholder":266},[220,635,636,638,640,642,644,646,648,650,652,654],{"class":222,"line":327},[220,637,392],{"class":226},[220,639,598],{"class":247},[220,641,251],{"class":237},[220,643,399],{"class":226},[220,645,366],{"class":256},[220,647,404],{"class":237},[220,649,378],{"class":226},[220,651,627],{"class":256},[220,653,411],{"class":237},[220,655,238],{"class":237},[220,657,658,660,662,664,666,668],{"class":222,"line":416},[220,659,420],{"class":419},[220,661,177],{"class":237},[220,663,426],{"class":425},[220,665,429],{"class":237},[220,667,366],{"class":256},[220,669,369],{"class":237},[220,671,672,674,676,679,681,683],{"class":222,"line":436},[220,673,420],{"class":419},[220,675,177],{"class":237},[220,677,678],{"class":425},"hourlyRate",[220,680,429],{"class":237},[220,682,627],{"class":256},[220,684,369],{"class":237},[220,686,687],{"class":222,"line":452},[220,688,455],{"class":237},[220,690,691],{"class":222,"line":458},[220,692,267],{"emptyLinePlaceholder":266},[220,694,695,697,699,701,703],{"class":222,"line":463},[220,696,392],{"class":226},[220,698,363],{"class":226},[220,700,470],{"class":247},[220,702,473],{"class":237},[220,704,238],{"class":237},[220,706,707,709,711],{"class":222,"line":478},[220,708,481],{"class":226},[220,710,366],{"class":256},[220,712,369],{"class":237},[220,714,715],{"class":222,"line":488},[220,716,455],{"class":237},[220,718,719],{"class":222,"line":493},[220,720,267],{"emptyLinePlaceholder":266},[220,722,723,725,727,730,732],{"class":222,"line":498},[220,724,392],{"class":226},[220,726,378],{"class":226},[220,728,729],{"class":247}," getHourlyRate",[220,731,473],{"class":237},[220,733,238],{"class":237},[220,735,736,738,740],{"class":222,"line":512},[220,737,481],{"class":226},[220,739,627],{"class":256},[220,741,369],{"class":237},[220,743,744],{"class":222,"line":521},[220,745,455],{"class":237},[220,747,748],{"class":222,"line":526},[220,749,267],{"emptyLinePlaceholder":266},[220,751,752,754],{"class":222,"line":531},[220,753,534],{"class":237},[220,755,537],{"class":226},[220,757,758,760,762,764,766,768,770,772],{"class":222,"line":540},[220,759,392],{"class":226},[220,761,545],{"class":226},[220,763,248],{"class":247},[220,765,251],{"class":237},[220,767,152],{"class":226},[220,769,257],{"class":256},[220,771,411],{"class":237},[220,773,238],{"class":237},[220,775,776,778,780,782,784,786],{"class":222,"line":560},[220,777,563],{"class":256},[220,779,177],{"class":237},[220,781,41],{"class":247},[220,783,251],{"class":237},[220,785,57],{"class":419},[220,787,260],{"class":237},[220,789,790],{"class":222,"line":576},[220,791,455],{"class":237},[220,793,794],{"class":222,"line":581},[220,795,273],{"class":237},[210,797,800],{"className":212,"code":798,"filename":799,"language":215,"meta":216,"style":216},"public class SalaryCalculator implements EmployeeVisitor {\n    private double totalSalary;\n\n    @Override\n    public void visit(FullTimeEmployee employee) {\n        totalSalary += employee.getSalary();\n    }\n\n    @Override\n    public void visit(PartTimeEmployee employee) {\n        totalSalary += employee.getHourlyRate() * 20 * 8;\n    }\n\n    public double getTotalSalary() {\n        return totalSalary;\n    }\n}\n","SalaryCalculator.java",[39,801,802,817,828,832,838,856,874,878,882,888,906,934,938,942,955,963,967],{"__ignoreMap":216},[220,803,804,806,808,811,813,815],{"class":222,"line":223},[220,805,227],{"class":226},[220,807,342],{"class":226},[220,809,810],{"class":233}," SalaryCalculator",[220,812,348],{"class":226},[220,814,288],{"class":233},[220,816,238],{"class":237},[220,818,819,821,823,826],{"class":222,"line":241},[220,820,357],{"class":226},[220,822,378],{"class":226},[220,824,825],{"class":256}," totalSalary",[220,827,369],{"class":237},[220,829,830],{"class":222,"line":263},[220,831,267],{"emptyLinePlaceholder":266},[220,833,834,836],{"class":222,"line":270},[220,835,534],{"class":237},[220,837,537],{"class":226},[220,839,840,842,844,846,848,850,852,854],{"class":222,"line":327},[220,841,392],{"class":226},[220,843,545],{"class":226},[220,845,297],{"class":247},[220,847,251],{"class":237},[220,849,163],{"class":226},[220,851,304],{"class":256},[220,853,411],{"class":237},[220,855,238],{"class":237},[220,857,858,861,864,866,868,871],{"class":222,"line":416},[220,859,860],{"class":256},"        totalSalary ",[220,862,863],{"class":237},"+=",[220,865,304],{"class":256},[220,867,177],{"class":237},[220,869,870],{"class":247},"getSalary",[220,872,873],{"class":237},"();\n",[220,875,876],{"class":222,"line":436},[220,877,455],{"class":237},[220,879,880],{"class":222,"line":452},[220,881,267],{"emptyLinePlaceholder":266},[220,883,884,886],{"class":222,"line":458},[220,885,534],{"class":237},[220,887,537],{"class":226},[220,889,890,892,894,896,898,900,902,904],{"class":222,"line":463},[220,891,392],{"class":226},[220,893,545],{"class":226},[220,895,297],{"class":247},[220,897,251],{"class":237},[220,899,169],{"class":226},[220,901,304],{"class":256},[220,903,411],{"class":237},[220,905,238],{"class":237},[220,907,908,910,912,914,916,919,921,924,927,929,932],{"class":222,"line":478},[220,909,860],{"class":256},[220,911,863],{"class":237},[220,913,304],{"class":256},[220,915,177],{"class":237},[220,917,918],{"class":247},"getHourlyRate",[220,920,473],{"class":237},[220,922,923],{"class":237}," *",[220,925,926],{"class":419}," 20",[220,928,923],{"class":237},[220,930,931],{"class":419}," 8",[220,933,369],{"class":237},[220,935,936],{"class":222,"line":488},[220,937,455],{"class":237},[220,939,940],{"class":222,"line":493},[220,941,267],{"emptyLinePlaceholder":266},[220,943,944,946,948,951,953],{"class":222,"line":498},[220,945,392],{"class":226},[220,947,378],{"class":226},[220,949,950],{"class":247}," getTotalSalary",[220,952,473],{"class":237},[220,954,238],{"class":237},[220,956,957,959,961],{"class":222,"line":512},[220,958,481],{"class":226},[220,960,825],{"class":256},[220,962,369],{"class":237},[220,964,965],{"class":222,"line":521},[220,966,455],{"class":237},[220,968,969],{"class":222,"line":526},[220,970,273],{"class":237},[210,972,975],{"className":212,"code":973,"filename":974,"language":215,"meta":216,"style":216},"import java.util.ArrayList;\nimport java.util.List;\n\npublic class Organization {\n    List\u003CEmployee> employees;\n\n    public Organization() {\n        employees = new ArrayList\u003C>();\n    }\n\n    public void addEmployee(Employee employee) {\n        employees.add(employee);\n    }\n\n    public void calculateSalary() {\n        SalaryCalculator calculator = new SalaryCalculator();\n        for (Employee employee : employees) {\n            employee.accept(calculator);\n        }\n        System.out.println(\"Total salary: \" + calculator.getTotalSalary());\n    }\n}\n","Organization.java",[39,976,977,997,1014,1018,1029,1047,1051,1061,1078,1082,1086,1105,1122,1126,1130,1143,1159,1181,1197,1202,1237,1241],{"__ignoreMap":216},[220,978,979,982,985,987,990,992,995],{"class":222,"line":223},[220,980,981],{"class":226},"import",[220,983,984],{"class":226}," java",[220,986,177],{"class":237},[220,988,989],{"class":226},"util",[220,991,177],{"class":237},[220,993,994],{"class":226},"ArrayList",[220,996,369],{"class":237},[220,998,999,1001,1003,1005,1007,1009,1012],{"class":222,"line":241},[220,1000,981],{"class":226},[220,1002,984],{"class":226},[220,1004,177],{"class":237},[220,1006,989],{"class":226},[220,1008,177],{"class":237},[220,1010,1011],{"class":226},"List",[220,1013,369],{"class":237},[220,1015,1016],{"class":222,"line":263},[220,1017,267],{"emptyLinePlaceholder":266},[220,1019,1020,1022,1024,1027],{"class":222,"line":270},[220,1021,227],{"class":226},[220,1023,342],{"class":226},[220,1025,1026],{"class":233}," Organization",[220,1028,238],{"class":237},[220,1030,1031,1034,1037,1039,1042,1045],{"class":222,"line":327},[220,1032,1033],{"class":226},"    List",[220,1035,1036],{"class":237},"\u003C",[220,1038,142],{"class":226},[220,1040,1041],{"class":237},">",[220,1043,1044],{"class":256}," employees",[220,1046,369],{"class":237},[220,1048,1049],{"class":222,"line":416},[220,1050,267],{"emptyLinePlaceholder":266},[220,1052,1053,1055,1057,1059],{"class":222,"line":436},[220,1054,392],{"class":226},[220,1056,1026],{"class":247},[220,1058,473],{"class":237},[220,1060,238],{"class":237},[220,1062,1063,1066,1069,1072,1075],{"class":222,"line":452},[220,1064,1065],{"class":256},"        employees ",[220,1067,1068],{"class":237},"=",[220,1070,1071],{"class":226}," new",[220,1073,1074],{"class":226}," ArrayList",[220,1076,1077],{"class":237},"\u003C>();\n",[220,1079,1080],{"class":222,"line":458},[220,1081,455],{"class":237},[220,1083,1084],{"class":222,"line":463},[220,1085,267],{"emptyLinePlaceholder":266},[220,1087,1088,1090,1092,1095,1097,1099,1101,1103],{"class":222,"line":478},[220,1089,392],{"class":226},[220,1091,545],{"class":226},[220,1093,1094],{"class":247}," addEmployee",[220,1096,251],{"class":237},[220,1098,142],{"class":226},[220,1100,304],{"class":256},[220,1102,411],{"class":237},[220,1104,238],{"class":237},[220,1106,1107,1110,1112,1115,1117,1120],{"class":222,"line":488},[220,1108,1109],{"class":256},"        employees",[220,1111,177],{"class":237},[220,1113,1114],{"class":247},"add",[220,1116,251],{"class":237},[220,1118,1119],{"class":256},"employee",[220,1121,260],{"class":237},[220,1123,1124],{"class":222,"line":493},[220,1125,455],{"class":237},[220,1127,1128],{"class":222,"line":498},[220,1129,267],{"emptyLinePlaceholder":266},[220,1131,1132,1134,1136,1139,1141],{"class":222,"line":512},[220,1133,392],{"class":226},[220,1135,545],{"class":226},[220,1137,1138],{"class":247}," calculateSalary",[220,1140,473],{"class":237},[220,1142,238],{"class":237},[220,1144,1145,1148,1151,1153,1155,1157],{"class":222,"line":521},[220,1146,1147],{"class":226},"        SalaryCalculator",[220,1149,1150],{"class":256}," calculator ",[220,1152,1068],{"class":237},[220,1154,1071],{"class":226},[220,1156,810],{"class":247},[220,1158,873],{"class":237},[220,1160,1161,1164,1167,1169,1172,1175,1177,1179],{"class":222,"line":526},[220,1162,1163],{"class":226},"        for",[220,1165,1166],{"class":237}," (",[220,1168,142],{"class":226},[220,1170,1171],{"class":256}," employee ",[220,1173,1174],{"class":226},":",[220,1176,1044],{"class":256},[220,1178,411],{"class":237},[220,1180,238],{"class":237},[220,1182,1183,1186,1188,1190,1192,1195],{"class":222,"line":531},[220,1184,1185],{"class":256},"            employee",[220,1187,177],{"class":237},[220,1189,53],{"class":247},[220,1191,251],{"class":237},[220,1193,1194],{"class":256},"calculator",[220,1196,260],{"class":237},[220,1198,1199],{"class":222,"line":540},[220,1200,1201],{"class":237},"        }\n",[220,1203,1204,1207,1209,1212,1214,1217,1219,1223,1226,1229,1231,1234],{"class":222,"line":560},[220,1205,1206],{"class":256},"        System",[220,1208,177],{"class":237},[220,1210,1211],{"class":425},"out",[220,1213,177],{"class":237},[220,1215,1216],{"class":247},"println",[220,1218,251],{"class":237},[220,1220,1222],{"class":1221},"sUOzB","\"Total salary: \"",[220,1224,1225],{"class":237}," +",[220,1227,1228],{"class":256}," calculator",[220,1230,177],{"class":237},[220,1232,1233],{"class":247},"getTotalSalary",[220,1235,1236],{"class":237},"());\n",[220,1238,1239],{"class":222,"line":576},[220,1240,455],{"class":237},[220,1242,1243],{"class":222,"line":581},[220,1244,273],{"class":237},[210,1246,1249],{"className":212,"code":1247,"filename":1248,"language":215,"meta":216,"style":216},"public class Demo {\n    public static void main(String[] args) {\n        Organization company = new Organization();\n\n        company.addEmployee(new FullTimeEmployee(\"Haytham\", 10000));\n        company.addEmployee(new PartTimeEmployee(\"Hamza\", 30));\n        company.calculateSalary();\n    }\n}\n","Demo.java",[39,1250,1251,1262,1288,1304,1308,1338,1364,1375,1379],{"__ignoreMap":216},[220,1252,1253,1255,1257,1260],{"class":222,"line":223},[220,1254,227],{"class":226},[220,1256,342],{"class":226},[220,1258,1259],{"class":233}," Demo",[220,1261,238],{"class":237},[220,1263,1264,1266,1269,1271,1274,1276,1278,1281,1284,1286],{"class":222,"line":241},[220,1265,392],{"class":226},[220,1267,1268],{"class":226}," static",[220,1270,545],{"class":226},[220,1272,1273],{"class":247}," main",[220,1275,251],{"class":237},[220,1277,399],{"class":226},[220,1279,1280],{"class":237},"[]",[220,1282,1283],{"class":256}," args",[220,1285,411],{"class":237},[220,1287,238],{"class":237},[220,1289,1290,1293,1296,1298,1300,1302],{"class":222,"line":263},[220,1291,1292],{"class":226},"        Organization",[220,1294,1295],{"class":256}," company ",[220,1297,1068],{"class":237},[220,1299,1071],{"class":226},[220,1301,1026],{"class":247},[220,1303,873],{"class":237},[220,1305,1306],{"class":222,"line":270},[220,1307,267],{"emptyLinePlaceholder":266},[220,1309,1310,1313,1315,1318,1320,1323,1325,1327,1330,1332,1335],{"class":222,"line":327},[220,1311,1312],{"class":256},"        company",[220,1314,177],{"class":237},[220,1316,1317],{"class":247},"addEmployee",[220,1319,251],{"class":237},[220,1321,1322],{"class":226},"new",[220,1324,345],{"class":247},[220,1326,251],{"class":237},[220,1328,1329],{"class":1221},"\"Haytham\"",[220,1331,404],{"class":237},[220,1333,1334],{"class":419}," 10000",[220,1336,1337],{"class":237},"));\n",[220,1339,1340,1342,1344,1346,1348,1350,1352,1354,1357,1359,1362],{"class":222,"line":416},[220,1341,1312],{"class":256},[220,1343,177],{"class":237},[220,1345,1317],{"class":247},[220,1347,251],{"class":237},[220,1349,1322],{"class":226},[220,1351,598],{"class":247},[220,1353,251],{"class":237},[220,1355,1356],{"class":1221},"\"Hamza\"",[220,1358,404],{"class":237},[220,1360,1361],{"class":419}," 30",[220,1363,1337],{"class":237},[220,1365,1366,1368,1370,1373],{"class":222,"line":436},[220,1367,1312],{"class":256},[220,1369,177],{"class":237},[220,1371,1372],{"class":247},"calculateSalary",[220,1374,873],{"class":237},[220,1376,1377],{"class":222,"line":452},[220,1378,455],{"class":237},[220,1380,1381],{"class":222,"line":458},[220,1382,273],{"class":237},[32,1384,1385,1386,1388],{},"Running ",[39,1387,203],{}," prints:",[210,1390,1395],{"className":1391,"code":1393,"language":1394,"meta":216},[1392],"language-text","Total salary: 14800.0\n","text",[39,1396,1393],{"__ignoreMap":216},[1398,1399,1400],"style",{},"html pre.shiki code .sVsk0, html code.shiki .sVsk0{--shiki-default:#9D9FFE;--shiki-light:#6762D3}html pre.shiki code .sNwy7, html code.shiki .sNwy7{--shiki-default:#D4D7FE;--shiki-light:#3F3B87}html pre.shiki code .sVG6I, html code.shiki .sVG6I{--shiki-default:#85858F;--shiki-light:#71717A}html pre.shiki code .sVz7n, html code.shiki .sVz7n{--shiki-default:#EDEDEF;--shiki-light:#0B0B0C}html pre.shiki code .sWFPS, html code.shiki .sWFPS{--shiki-default:#C4C4CC;--shiki-light:#3F3F46}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html pre.shiki code .sheII, html code.shiki .sheII{--shiki-default:#70ADFF;--shiki-light:#195CAE}html pre.shiki code .s4Awn, html code.shiki .s4Awn{--shiki-default:#C5DDFE;--shiki-light:#534DAF}html pre.shiki code .sUOzB, html code.shiki .sUOzB{--shiki-default:#9EC7FE;--shiki-light:#2873D1}",{"title":216,"searchDepth":241,"depth":241,"links":1402},[1403,1404,1405,1409,1410],{"id":29,"depth":241,"text":30},{"id":67,"depth":241,"text":68},{"id":91,"depth":241,"text":92,"children":1406},[1407,1408],{"id":96,"depth":263,"text":97},{"id":111,"depth":263,"text":112},{"id":128,"depth":241,"text":129},{"id":207,"depth":241,"text":208},"The Visitor pattern lets you add new operations to a set of classes without changing them, by moving each operation into a visitor object. Explained with a worked Java example of a payroll.","A payroll for full-time and part-time staff","md","Behavioral","lucide:footprints",{},"\u002Flearn\u002Fdesign-patterns\u002Fvisitor","---\ntitle: Visitor\ngroup: Behavioral\nicon: lucide:footprints\nsummary: 'Add new operations to a set of classes without changing them, by moving each operation into its own visitor.'\ndescription: 'The Visitor pattern lets you add new operations to a set of classes without changing them, by moving each operation into a visitor object. Explained with a worked Java example of a payroll.'\nexample: 'A payroll for full-time and part-time staff'\norder: 8\nsource: https:\u002F\u002Fgithub.com\u002FHaythamasalama\u002FdesignPattern\u002Ftree\u002Fmaster\u002Fsrc\u002FBehavioral\u002FVisitor\n---\n\n## The idea\n\nSay you have a stable set of classes, such as kinds of employee, and you keep needing new operations on them: work out pay, export to a spreadsheet, print a report. Adding each operation as a method to every class spreads unrelated code across all of them, and means editing them every time.\n\nThe Visitor pattern moves each operation into its own class, a visitor. The visitor has one `visit` method for each class it can work on. Each of those classes gets a single `accept(visitor)` method that calls `visitor.visit(this)`. Inside `accept`, `this` has the exact type of the class, so Java picks the matching `visit` method.\n\nThis two-step call is known as double dispatch: the code that runs depends on both the type of the visitor and the type of the element. A new operation is now a new visitor class, and the element classes don't change.\n\n## When to use it\n\n- You need many unrelated operations on a set of classes, and don't want to fill those classes with them.\n- The set of classes rarely changes, but new operations are added often.\n- An operation needs different logic for each class, and you want to avoid `instanceof` checks.\n- You want to collect results across a structure of objects, such as totals over a list or a tree.\n\n## Pros and cons\n\n### Pros\n\n- Adding a new operation is easy: write a new visitor, without touching the element classes.\n- It separates concerns: each operation lives in one class instead of being spread across many.\n- A visitor can keep state as it goes, such as a running total.\n\n### Cons\n\n- It adds classes to the system: one for every operation.\n- Adding a new element class is hard, because every visitor needs a new `visit` method.\n- Visitors often need public getters on the elements to do their work, which weakens encapsulation.\n\n## The example\n\nThe example is a payroll. An organisation has full-time and part-time employees, and their pay is worked out in different ways. That calculation lives in a visitor, not in the employee classes.\n\n- **`Employee`**: the element interface, with a single `accept(visitor)` method.\n- **`EmployeeVisitor`**: the visitor interface, with one `visit` method for each kind of employee.\n- **`FullTimeEmployee`** and **`PartTimeEmployee`**: concrete elements. Each `accept()` calls `visitor.visit(this)`.\n- **`SalaryCalculator`**: the concrete visitor. It adds a full-time employee's salary to the total. For a part-time employee, it adds the hourly rate times 20 × 8, that is 160 hours.\n- **`Organization`**: the object structure. It holds the employees, passes one `SalaryCalculator` to each of them, and prints the total.\n- **`Demo`**: adds a full-time employee on 10,000 and a part-time one at 30 an hour, then asks for the total: 10,000 plus 30 × 160.\n\n## The code\n\n```java [Employee.java]\npublic interface Employee {\n    void accept(EmployeeVisitor visitor);\n\n}\n```\n\n```java [EmployeeVisitor.java]\npublic interface EmployeeVisitor {\n    void visit(FullTimeEmployee employee);\n\n    void visit(PartTimeEmployee employee);\n}\n```\n\n```java [FullTimeEmployee.java]\npublic class FullTimeEmployee implements Employee {\n    private final String name;\n    private final double salary;\n\n    public FullTimeEmployee(String name, double salary) {\n        this.name = name;\n        this.salary = salary;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public double getSalary() {\n        return salary;\n    }\n\n    @Override\n    public void accept(EmployeeVisitor visitor) {\n        visitor.visit(this);\n    }\n}\n```\n\n```java [PartTimeEmployee.java]\npublic class PartTimeEmployee implements Employee {\n    private final String name;\n    private final double hourlyRate;\n\n    public PartTimeEmployee(String name, double hourlyRate) {\n        this.name = name;\n        this.hourlyRate = hourlyRate;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public double getHourlyRate() {\n        return hourlyRate;\n    }\n\n    @Override\n    public void accept(EmployeeVisitor visitor) {\n        visitor.visit(this);\n    }\n}\n```\n\n```java [SalaryCalculator.java]\npublic class SalaryCalculator implements EmployeeVisitor {\n    private double totalSalary;\n\n    @Override\n    public void visit(FullTimeEmployee employee) {\n        totalSalary += employee.getSalary();\n    }\n\n    @Override\n    public void visit(PartTimeEmployee employee) {\n        totalSalary += employee.getHourlyRate() * 20 * 8;\n    }\n\n    public double getTotalSalary() {\n        return totalSalary;\n    }\n}\n```\n\n```java [Organization.java]\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Organization {\n    List\u003CEmployee> employees;\n\n    public Organization() {\n        employees = new ArrayList\u003C>();\n    }\n\n    public void addEmployee(Employee employee) {\n        employees.add(employee);\n    }\n\n    public void calculateSalary() {\n        SalaryCalculator calculator = new SalaryCalculator();\n        for (Employee employee : employees) {\n            employee.accept(calculator);\n        }\n        System.out.println(\"Total salary: \" + calculator.getTotalSalary());\n    }\n}\n```\n\n```java [Demo.java]\npublic class Demo {\n    public static void main(String[] args) {\n        Organization company = new Organization();\n\n        company.addEmployee(new FullTimeEmployee(\"Haytham\", 10000));\n        company.addEmployee(new PartTimeEmployee(\"Hamza\", 30));\n        company.calculateSalary();\n    }\n}\n```\n\nRunning `Demo` prints:\n\n```text\nTotal salary: 14800.0\n```\n",{"title":22,"description":1411},{"loc":1417},"https:\u002F\u002Fgithub.com\u002FHaythamasalama\u002FdesignPattern\u002Ftree\u002Fmaster\u002Fsrc\u002FBehavioral\u002FVisitor","learn\u002Fdesign-patterns\u002Fvisitor","Add new operations to a set of classes without changing them, by moving each operation into its own visitor.","gNJmDEWZwSEg2l0fwHbWdCFTc1b-3vJEkg3CtaK5dug",[1426,1431,1436,1441,1446,1451,1456,1461],{"path":1427,"title":1428,"icon":1429,"summary":1430,"order":223},"\u002Flearn\u002Fdesign-patterns\u002Fchain-of-responsibility","Chain of Responsibility","lucide:link","Pass a request along a chain of handlers, where each one can deal with it or hand it to the next.",{"path":1432,"title":1433,"icon":1434,"summary":1435,"order":241},"\u002Flearn\u002Fdesign-patterns\u002Fcommand","Command","lucide:square-terminal","Turn a request into an object, so it can be passed around, queued, logged or undone.",{"path":1437,"title":1438,"icon":1439,"summary":1440,"order":263},"\u002Flearn\u002Fdesign-patterns\u002Fiterator","Iterator","lucide:list-ordered","Walk through the items of a collection one by one, without knowing how the collection stores them.",{"path":1442,"title":1443,"icon":1444,"summary":1445,"order":270},"\u002Flearn\u002Fdesign-patterns\u002Fobserver","Observer","lucide:bell","One object announces a change, and every object that subscribed to it hears about it.",{"path":1447,"title":1448,"icon":1449,"summary":1450,"order":327},"\u002Flearn\u002Fdesign-patterns\u002Fstate","State","lucide:toggle-left","An object changes its behaviour when its internal state changes, as if it had changed its class.",{"path":1452,"title":1453,"icon":1454,"summary":1455,"order":416},"\u002Flearn\u002Fdesign-patterns\u002Fstrategy","Strategy","lucide:shuffle","Put each way of doing a task in its own class, and choose which one to use while the program runs.",{"path":1457,"title":1458,"icon":1459,"summary":1460,"order":436},"\u002Flearn\u002Fdesign-patterns\u002Ftemplate-method","Template Method","lucide:layout-template","A base class fixes the steps of a task, and subclasses fill in the steps that differ.",{"path":1417,"title":22,"icon":1415,"summary":1423,"order":452},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1463},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M15 14c.2-1 .7-1.7 1.5-2.5c1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5c.7.7 1.3 1.5 1.5 2.5m0 4h6m-5 4h4\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1465},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Crect width=\"8\" height=\"8\" x=\"3\" y=\"3\" rx=\"2\"\u002F>\u003Cpath d=\"M7 11v4a2 2 0 0 0 2 2h4\"\u002F>\u003Crect width=\"8\" height=\"8\" x=\"13\" y=\"13\" rx=\"2\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1467},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"\u002F>\u003Cpath d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1469},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"m7 11l2-2l-2-2m4 6h4\"\u002F>\u003Crect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1471},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M11 5h10m-10 7h10m-10 7h10M4 4h1v5M4 9h2m.5 11H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1473},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M10.268 21a2 2 0 0 0 3.464 0m-10.47-5.674A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1475},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Ccircle cx=\"9\" cy=\"12\" r=\"3\"\u002F>\u003Crect width=\"20\" height=\"14\" x=\"2\" y=\"5\" rx=\"7\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1477},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"m18 14l4 4l-4 4m0-20l4 4l-4 4\"\u002F>\u003Cpath d=\"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22M2 6h1.972a4 4 0 0 1 3.6 2.2M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1479},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Crect width=\"18\" height=\"7\" x=\"3\" y=\"3\" rx=\"1\"\u002F>\u003Crect width=\"9\" height=\"7\" x=\"3\" y=\"14\" rx=\"1\"\u002F>\u003Crect width=\"5\" height=\"7\" x=\"16\" y=\"14\" rx=\"1\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1481},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0m16 4v-2.38c0-2.12 1.03-3.12 1-5.62c-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0m-4-3h4M4 13h4\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1483},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Crect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"\u002F>\u003Cpath d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"\u002F>\u003C\u002Fg>",1793131417023]