Model class, model Model
In this example, the class that describes an algorithm is called a model class. In this example, the functions are relatively simple. After you click a window, draw a line in the window and record all the lines so that the window can be displayed when being refreshed. To achieve this goal, you need to use a Data Structure to store the start and end positions of the straight line. Models are responsible for this. The built-in type list in Python is used to save all coordinate points. The code for this example is as follows:
# Developer: Cai junsheng (QQ: 9073204) Shenzhen 2014-9-6 # Model class Model: def _ init _ (self): self. ptList = [] self. maxList = 2000 def AddPoint (self, x, y, isStart): if len (self. ptList)> self. maxList: self. ptList. remove (0) # Save As a tuples to the list self. ptList. append (x, y, isStart) def GetPoint (self): return self. ptList
In the Model class, a list self is defined in the constructor _ init. ptList, which limits the maximum number of data points to be saved. with these two data structures, maxList can store the start and end data of a straight line, and limit the size of the list. Otherwise, the list will increase infinitely, resulting in no memory available. The AddPoint function is defined to add the starting and ending points of a straight line. Here, the form of tuples (x, y, isStart) is used to record the attributes of a coordinate point, x and y coordinate points on the x and y axes, respectively. isStart indicates whether the start point of the point is a straight line. Otherwise, it indicates the end point. Finally, the GetPoint function is defined to obtain the data in the list. From the code of this class, this class only defines the function interfaces for adding data and getting data. As for how to save and process data, it is completely internal transactions of the class. If you need to add an offset to the coordinate point value on that day to return the result, you can directly calculate it in the return function. The caller does not care about this service change, to hide business logic and algorithms.
What classes should TableRowSorter (model) Reference in Java?
Javax. swing. table
Type TableRowSorter <M extends TableModel>
Java. lang. Object
Javax. swing. RowSorter <M>
Javax. swing. DefaultRowSorter <M, Integer>
Javax. swing. table. TableRowSorter <M>
Type parameter:
M-model type, which must be an implementation of TableModel
--------------------------------------------------------------------------------
Public class TableRowSorter is an implementation of <M extends TableModel> extends DefaultRowSorter <M, Integer> RowSorter. It uses TableModel to provide sorting and filtering operations. The following example shows how to add a sorting operation to a JTable:
TableModel myModel = createMyTableModel ();
JTable table = new JTable (myModel );
Table. setRowSorter (new TableRowSorter (myModel ));
This class completes all the connections, so that the table will be intuitively sorted when the user makes the appropriate behavior (such as clicking the column title.
The row-based JTable method and JTable Selection Model Reference view instead of the underlying model. Therefore, it is necessary to convert the two before. For example, to obtain the Selection Based on myModel, You need to convert the index:
Int [] selection = table. getSelectedRows ();
For (int I = 0; I <selection. length; I ++ ){
Selection [I] = table. convertRowIndexToModel (selection [I]);
}
Similarly, select a row in the JTable based on the underlying model coordinates and perform the following operations:
Table. setRowSelectionInterval (table. convertRowIndexToView (row ),
Table. convertRowIndexToView (row ));
The previous example assumes that the filter operation cannot be performed. If it can be filtered, convertRowIndexToView returns-1 for invisible positions in the view.
TableRowSorter uses Comparator for comparison. The following describes how to select a Comparator for a column:
If you have specified a Comparator for a column by using the setComparator method, use it.
If the column Class returned by getColumnClass is String, Comparator returned by Collator. getInstance () is used.
If the column class implements Comparable, use the Comparator that calls the compareTo method.
If TableStringConverter has been specified, use TableStringConverter to convert the value to String, and then use the Comparator returned by Collator. getInstance.
Otherwise, call toString on the object first, and then call Collato ...... the remaining full text>
For up to model types
GUNDAM (up to) plastic model, referred to as "GUNPLA", developed and produced by BANDAI.
There are multiple specifications, including SD, FG (First Grade), HG (High Grade), HGUC (High Grade Universal Century), MG (Master Grade), and PG (Perfect Grade, the proportion is mainly 1/144, 1/100, and 1/60, and there is a special proportion for some large original types. Since the advent of the animation "Mobile warrior up to" in 1980, its development has continued so far. Exquisite workmanship and excellent quality have become a unique category and brand in the plastic model market.
See GUNDAM (up ).
GUNPLA-gundam plastic model is a plastic model.
GUNPLA:
「 PG 」 -- Perfect Grade (Perfect)
"MG" -- Master Grade (Master level)
「 HG 」 -- High Grade (advanced)
「 HGUC 」 -- High Grade Universal Century (Advanced universe Century)
「 FG 」 -- First Grade (level 1)
「 GF 」 -- G-Generation (doll level)
「 TV 」 -- TV Series (original TV Series)
Proportion of "GUNPLA:
「 PG 」 -- 1/60
「 MG 」 -- 1/100
「 TV 」 -- 1/60 1/100 1/144
「 HG 」 -- 1/144
"HGUC" -- 1/144
「 FG 」 -- 1/144
First, let's talk about the so-called TV SCALE series. Now we have seen the SEED series and all models of the SEED series, with a ratio of 1/144, 1/100, and 1/60. 1/144 of the mobility is poor, and the color separation is not good. Although the price is cheap, we do not recommend you to buy it (especially those who are just starting to make models ). 1/100 can faithfully reproduce the image in the original, and the mobility is greatly improved. The color separation is also possible, and there is basically no need to re-color it. Especially in the later stages, the quality and playability of SEED-DESTINY are superior. Although the mobility of the 1/60 series is higher, I personally feel that the price/performance ratio is a little lower, and the proportion is increased, but the 1/100 series is not exquisite.
Then HG (high grade ). The ratio of this series is usually 1/144, and there was also 1/100, but now it is relatively small. The quality is getting better and better. Basically, the prime group can receive very good results with relatively high mobility. More and more HG details are currently available.
HGUC, dedicated to U. c. series of HG, only U. c. although the same as the HG version, but because U. c. the setup is meticulous and rigorous. Compared with General HG, UCHG is richer in details and more calm, some of the high-priced UCHG is even close to the early MG version level, and the model specification also has rich body information.
MG (marster grade), with a ratio of 1/100, is currently the most playable and cost-effective with HG. It is the trump card of BANDAI, in addition to multi-color molding technology and better color separation, rich internal structures and high activity are the biggest selling points. The appearance of MG in has been a big blow to the prosperous hand-run market. There was no internal structure for MG in the early stage, but the later internal structure and details were constantly increasing. Basically, the whole body was constructed from around 80th, the removal of all external armor is very good. With the advancement of technology, the internal structure of MG is becoming more and more refined, and it is close to the level of PG.
PG (perfect grade), just like the name, is a PERFECT reproduction of the various internal structures and details in the body settings, BANDAI is like the industry to show off its technology ...... remaining full text>