Understand the interpreter mode
principle
Define grammar rules for the new "language" and define an interpreter to interpret grammar
Implementation core
Split the operations of different operators into separate operator expression classes to avoid large and complete parsing classes
Best Practices 1
Demand background
Suppose we define a new "language" ...
Added by dc2_jspec on Sat, 18 Dec 2021 04:05:41 +0200
Android realizes global floating pop-up, and beginners can read it
public WindowManager.LayoutParams wmParams;
public WindowManager getWm() {
return wm;
}
public void setWm(WindowManager wm) {
this.wm = wm;
}
public WindowManager.LayoutParams getWmParams() {
return wmParams;
}
public void setWmParams(WindowManager.LayoutParams wmParams) {
this.wmParams = wmParams;
this. ...
Added by JJ123 on Sat, 18 Dec 2021 01:24:25 +0200
23 design modes for learning [200,000 words long notes]
Preface
Tip: Below is the next article to take notes on 23 design modes. For the previous one, go to the home page to view the previous article
17. An overview of behavioral patterns (classification of behavioral patterns)
Behavioral patterns are used to describe complex process control when a program is running, that is, how multipl ...
Added by Weiry on Sat, 18 Dec 2021 01:22:47 +0200
ART virtual machine_ JNI static registration and dynamic registration, deep analysis principle
bool JavaVMExt::IsBadJniVersion(int version) {
// We don't support JNI_VERSION_1_1. These are the only other valid versions.
return version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4 && version != JNI_VERSION_1_6;
}
JNI_Onload function is a treasure place for dynamic registration. We can register in RegisterNatives. T ...
Added by -[ webdreamer ] on Sat, 18 Dec 2021 00:43:31 +0200
Singleton mode implementation
Singleton mode
Singleton Pattern is one of the simplest design patterns in Java. It belongs to creation mode. It is defined as ensuring that a class has only one instance and providing a global access point to access the instance.
The singleton pattern is generally reflected in the class declaration. The singleton class is responsible for cre ...
Added by tomboy78 on Fri, 17 Dec 2021 23:35:55 +0200
Behavioral template approach pattern
1. Definition of template method pattern
An official point: define an algorithm framework in operation, and delay some steps to subclasses, so that subclasses can redefine some specific steps of an algorithm without changing the structure of an algorithm.
More popular: it abstracts some common operations (Methods) and encapsulates them in a t ...
Added by phphelpme on Fri, 17 Dec 2021 20:25:30 +0200
Implementation of singleton mode (C + +)
Implement singleton mode
The purpose of singleton pattern is to make an object of a class the only instance in the system. The class created by the method of singleton mode has only one instance in the current process (if necessary, it may belong to singleton in a thread, for example, only the same instance is used in the thread context)
...
Added by dkphp2 on Fri, 17 Dec 2021 20:19:02 +0200
Design pattern: Command pattern C + + implementation
preface
Today I reviewed the command mode, which is very interesting. Here I share it with you!
1. Command mode understanding
Command mode is to separate the command issuer from the command executor so that they are not directly connected, but record these commands through a third party, and then the third party tells the command exe ...
Added by Design on Fri, 17 Dec 2021 20:16:03 +0200
Android bitmap cache strategy, understand these, and come to Alibaba directly
How to avoid consuming too much traffic? When the program loads a picture from the network for the first time, it caches it on the mobile device, so that when the picture is used again, it does not need to download it from the network again, saving traffic for users.
At present, a commonly used cache algorithm is lru (least recently used). It ...
Added by redmonkey on Fri, 17 Dec 2021 19:51:33 +0200
Singleton mode of Glide design mode
Singleton definition
It belongs to the creation mode; Only one object is created globally.
Glide usage form
Glide.with(context). . .
Glide single case writing
context check
/**
* @see #with(android.app.Activity)
* @see #with(android.app.Fragment)
* @see #with(androidx.fragment.app.Fragment)
* @see #with(androidx.fragment.app ...
Added by mwkdesign on Fri, 17 Dec 2021 13:35:46 +0200