sequence. In addition, Java requires that the enum instance be defined first.
Public Enum color {red ("red", 1), Green ("green", 2), blank ("white", 3), yello ("yellow", 4 ); // member variable private string name; private int index; // constructor private color (string name, int index) {This. name = Name; this. index = index;} // common method public static string getname (INT index) {for (color C: color. values () {If (C. getindex () = index) {retu
DK1.5 introduces a new type-enumeration. In Java, although it is regarded as a "small" function, it brings great convenience to my development. Usage 1: Before JDK1.5, we define all constants as public static fianl ..... Now, with enumeration, You can group related constants into one Enumeration type, and enumeration provides more methods than constants. Public enum Color {RED, GREEN, BLANK, YELLOW} usage 2: switch statements before switch JDK1.6 only support int, char, and enum types, and use e
Before JDK1.5, we defined constants: public static fianl ..... Now, with enumerations, you can group related constants into an enumeration type, and enumerations provide more methods than constants.Java code
Public enum Color {
}
The switch statement before JDK1.6 only supports int,char,enum types, and using enumerations can make our code more readable.Java code
Enum Signal {
}
Public class TrafficLight {
public Void Change () {
switch (color) {
Ca
Usage One: ConstantsBefore JDK1.5, we defined constants: public static fianl ..... Now, with enumerations, you can group related constants into an enumeration type, and enumerations provide more methods than constants. Public enum Color { RED, GREEN, BLANK, YELLOW Usage Two: SwitchThe switch statement before JDK1.6 only supports int,char,enum types, and using enumerations can make our code more readable.enumSignal {GREEN, YELLOW, RED} Public classtrafficlight {Signal color=signal.red; Publi
= signal.yellow;
break;
}}}
Usage Three: Add a new method to the enumeration
The public enum Color {red
("Red", 1), Green ("green", 2), BLANK ("White", 3), Yello ("Yellow", 4);
Member variable
private String name;
private int index;
Construction Method
Private Color (String name, int index) {
this.name = name;
This.index = index;
}
Normal method public
static String getName (int index) {for
(Color c:
) {case
RED:
color = signal.green;
break;
Case YELLOW:
color = signal.red;
break;
Case GREEN:
color = signal.yellow;
break;
}}}
usage Three: Add a new method to the enumeration
If you intend to customize your own method, you must add a semicolon at the end of the sequence of enum instances. and Java requirements must first define an instance of an enum.
The public en
;
Break ;
}
}
}
Usage Three: Add a new method to the enumerationIf you intend to customize your own method, you must add a semicolon at the end of the enum instance sequence. And Java requires that an enum instance be defined first.Java code
Public enum Color {
Red ("Red", 1), Green ("green", 2), BLANK ("White", 3), Yello ("Yellow", 4);
//Member variables
private String name;
private int index;
//Construction method
Privat
Main code Reference 79589506Github:https://github.com/yinghualuowuThe reply has passed, the completion ~This part of the code also includes narrowing the boundariesdefImg_color (CARD_IMGS): Colors= [] forCard_index, card_imginchEnumerate (CARD_IMGS): Green= Yello = Blue = Black = White =0 CARD_IMG_HSV=Cv2.cvtcolor (card_img, Cv2. COLOR_BGR2HSV)#there is a possibility of conversion failure, due to errors in correcting rectangles above ifCard
instances. and Java requirements must first define an instance of an enum.
The public enum Color {red
("Red", 1), Green ("green", 2), BLANK ("White", 3), Yello ("Yellow", 4);
Member variable
private String name;
private int index;
Construction Method
Private Color (String name, int index) {
thisname = name;
Thisindex = index;
}
Normal method public
static String getName (int index) {for
(
of monitoringspecific to the monitoring system, what is the scalability of? Let's start at the beginning. Monitoring system input is monitored by the various monitoring data. These data are processed through a series of processes, which are ultimately stored for post-mortem analysis and offline analysis, while the main function is to make real-time alarms. Throughout this process we can be seen as a process of streaming computation. When it comes to streaming computing, we actually think of sto
switch uplink port policy to User-down
Using the Strom-control (Storm Control) feature in three-layer switching, this feature is based on port-controlled unicast \ Multicast \ Multicast, which can be accurate to 0.01%, but an approximate value. This method is a threshold way, limit the monitoring time per second, more than the set threshold to discard the package, and the user is not aware of the network terminal, or remote unresponsive, obviously t
Distributed computing system framework, according to the characteristics of data set, mainly divided into data-flow and streaming two kinds. Data-flow mainly data blocks for data processing data, representing: MR, Spark, and so on, I call them big data, and streaming is mainly processing the data obtained within the unit, this way, more focus on real-time, mainly including Strom, jstorm and Samza, etc. , I call them fast data.
In this article, I mainl
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.