blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
4423b155be52e7ff2edf33942407dce24c83f75c
601,295,488,768
a06d99697017335956e2f1fac76ffc749af5183a
/com/dp/devweb/common/CommonObject.java
812bd640a4e7de271f23de6d9b19bcd4c0a749e3
[]
no_license
mygitzj/javaTest
https://github.com/mygitzj/javaTest
d0a1c7da745df04c497539c302bb93c210e965be
8cc1a46aa5d0c1f50753fe587637b188b859b6a5
refs/heads/master
2020-06-13T22:40:50.452000
2019-07-02T07:49:00
2019-07-02T07:49:00
194,811,356
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dp.devweb.common; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; /** * @Title: CommonObject.java * @Description: 获取页面元素公共方法 * @author w01866 * @date 2014年12月21日 下午15:28:52 * @version V4.4 */ public class CommonObject extends CommonObjectScript { // 实例化公共操作方法 public CommonOperator opr = new CommonOperator(); /** * 根据链接文本内容定位link页面元素 * * @param str * 文本内容 * @return 链接对象 */ public WebElement getElementByLink(String str) { return driver.findElement(By.linkText(str)); } /** * 根据父对象、链接文本内容定位link页面元素 * * @param obj * 父对象 * @param str * 文本内容 * @return 链接对象 */ public WebElement getElementByLink(WebElement obj, String str) { return obj.findElement(By.linkText(str)); } /** * 根据ID值定位页面元素 * * @param str * 文本内容 * @return 页面元素 */ public WebElement getElementById(String str) { return driver.findElement(By.id(str)); } /** * 根据父对象、ID值定位页面元素 * * @param obj * 父对象 * @param str * 文本内容 * @return 页面元素 */ public WebElement getElementById(WebElement obj, String str) { return obj.findElement(By.id(str)); } /** * 根据xpath定位页面元素 * * @param str * xpath值 * * @return 页面元素 */ public WebElement getElementByXpath(String str) { return driver.findElement(By.xpath(str)); } /** * 根据父对象、xpath值定位页面元素 * * @param obj * 父对象 * @param str * xpath值 * @return 页面元素 */ public WebElement getElementByXpath(WebElement obj, String str) { return obj.findElement(By.xpath(str)); } /** * 根据xpath值定位页面元素 * * @param str * xpath值 * @return 页面元素列表 */ public List<WebElement> getElementsByXpath(String str) { return driver.findElements(By.xpath(str)); } /** * 根据tagName定位页面元素 * * @param str * tagName * @return 页面元素列表 */ public List<WebElement> getElementsByTagname(String str) { return driver.findElements(By.tagName(str)); } /** * 根据className定位页面元素 * * @param str * class值 * @return */ public WebElement getElementsByClassname(String str) { return driver.findElement(By.className(str)); } /** * 根据父对象、className定位页面元素 * * @param obj * 父对象 * @param str * class值 * @return */ public WebElement getElementByClassname(WebElement obj, String str) { return obj.findElement(By.className(str)); } //---------------------------------------------------------- /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public WebElement getElement(By by, long timeout) { try { if (opr.isElementPresent(by, timeout)) { return driver.findElement(by); } } catch (Exception e) { System.out.println(e + ""); } return null; } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param obj * 父对象 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public WebElement getElement(By by) { return getElement(by, 0); } public WebElement getElement(WebElement obj, By by, long timeout) { // boolean isSucceed = false; try { if (opr.isElementPresent(obj, by, timeout)) { // isSucceed = true; } } catch (Exception e) { System.out.println(e + ""); } // operationCheck("getElement", isSucceed); return obj.findElement(by); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param obj 父对象 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public WebElement getElement(WebElement obj, By by) { return getElement(obj, by, 0); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(By by, long timeout) { // boolean isSucceed = false; try { if (opr.isElementPresent(by, timeout)) { // isSucceed = true; } } catch (Exception e) { System.out.println(e + ""); } // operationCheck("getElement", isSucceed); return driver.findElements(by); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(By by) { return getElements(by, 0); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(WebElement obj, By by, long timeout) { // boolean isSucceed = false; try { if (opr.isElementPresent(obj, by, timeout)) { // isSucceed = true; } } catch (Exception e) { System.out.println(e + ""); } // operationCheck("getElement", isSucceed); return driver.findElements(by); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(WebElement obj, By by) { return getElements(obj, by, 0); } }
UTF-8
Java
6,257
java
CommonObject.java
Java
[ { "context": "Object.java\n * @Description: 获取页面元素公共方法\n * @author w01866\n * @date 2014年12月21日 下午15:28:52\n * @version V4.4\n", "end": 200, "score": 0.9994228482246399, "start": 194, "tag": "USERNAME", "value": "w01866" } ]
null
[]
package dp.devweb.common; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; /** * @Title: CommonObject.java * @Description: 获取页面元素公共方法 * @author w01866 * @date 2014年12月21日 下午15:28:52 * @version V4.4 */ public class CommonObject extends CommonObjectScript { // 实例化公共操作方法 public CommonOperator opr = new CommonOperator(); /** * 根据链接文本内容定位link页面元素 * * @param str * 文本内容 * @return 链接对象 */ public WebElement getElementByLink(String str) { return driver.findElement(By.linkText(str)); } /** * 根据父对象、链接文本内容定位link页面元素 * * @param obj * 父对象 * @param str * 文本内容 * @return 链接对象 */ public WebElement getElementByLink(WebElement obj, String str) { return obj.findElement(By.linkText(str)); } /** * 根据ID值定位页面元素 * * @param str * 文本内容 * @return 页面元素 */ public WebElement getElementById(String str) { return driver.findElement(By.id(str)); } /** * 根据父对象、ID值定位页面元素 * * @param obj * 父对象 * @param str * 文本内容 * @return 页面元素 */ public WebElement getElementById(WebElement obj, String str) { return obj.findElement(By.id(str)); } /** * 根据xpath定位页面元素 * * @param str * xpath值 * * @return 页面元素 */ public WebElement getElementByXpath(String str) { return driver.findElement(By.xpath(str)); } /** * 根据父对象、xpath值定位页面元素 * * @param obj * 父对象 * @param str * xpath值 * @return 页面元素 */ public WebElement getElementByXpath(WebElement obj, String str) { return obj.findElement(By.xpath(str)); } /** * 根据xpath值定位页面元素 * * @param str * xpath值 * @return 页面元素列表 */ public List<WebElement> getElementsByXpath(String str) { return driver.findElements(By.xpath(str)); } /** * 根据tagName定位页面元素 * * @param str * tagName * @return 页面元素列表 */ public List<WebElement> getElementsByTagname(String str) { return driver.findElements(By.tagName(str)); } /** * 根据className定位页面元素 * * @param str * class值 * @return */ public WebElement getElementsByClassname(String str) { return driver.findElement(By.className(str)); } /** * 根据父对象、className定位页面元素 * * @param obj * 父对象 * @param str * class值 * @return */ public WebElement getElementByClassname(WebElement obj, String str) { return obj.findElement(By.className(str)); } //---------------------------------------------------------- /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public WebElement getElement(By by, long timeout) { try { if (opr.isElementPresent(by, timeout)) { return driver.findElement(by); } } catch (Exception e) { System.out.println(e + ""); } return null; } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param obj * 父对象 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public WebElement getElement(By by) { return getElement(by, 0); } public WebElement getElement(WebElement obj, By by, long timeout) { // boolean isSucceed = false; try { if (opr.isElementPresent(obj, by, timeout)) { // isSucceed = true; } } catch (Exception e) { System.out.println(e + ""); } // operationCheck("getElement", isSucceed); return obj.findElement(by); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param obj 父对象 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public WebElement getElement(WebElement obj, By by) { return getElement(obj, by, 0); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(By by, long timeout) { // boolean isSucceed = false; try { if (opr.isElementPresent(by, timeout)) { // isSucceed = true; } } catch (Exception e) { System.out.println(e + ""); } // operationCheck("getElement", isSucceed); return driver.findElements(by); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(By by) { return getElements(by, 0); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(WebElement obj, By by, long timeout) { // boolean isSucceed = false; try { if (opr.isElementPresent(obj, by, timeout)) { // isSucceed = true; } } catch (Exception e) { System.out.println(e + ""); } // operationCheck("getElement", isSucceed); return driver.findElements(by); } /** * 定位页面元素,超时时间内反复判断元素是否出现。若元素定位失败,则截图 * * @param by * 页面元素 * @param timeout * 超时时间 * @return 页面元素 */ public List<WebElement> getElements(WebElement obj, By by) { return getElements(obj, by, 0); } }
6,257
0.586207
0.581391
276
17.807972
16.927683
75
false
false
0
0
0
0
0
0
1.460145
false
false
8
a75e1e45e7e9ec7f0fd5942296a5bde5b86b5d0e
9,629,316,746,471
f7e403459a83e0177b6a92e2a64d76de3eead4d5
/java_design_web/src/main/java/com/haohao/designpatterns/f_delegate/demo1/Leader.java
fd6fa455b0b144c38d73e4a7b5e46805660c014d
[]
no_license
guanhao20170227/gupao_test_code
https://github.com/guanhao20170227/gupao_test_code
19af55e041543ab4ed7b02e4ac64b626d6154102
66a5ccfc3d6a2b5f3b528a2b56ce53247634b7bc
refs/heads/master
2021-07-16T09:34:41.707000
2019-12-12T12:24:08
2019-12-12T12:24:08
218,044,917
0
0
null
false
2020-10-13T18:10:18
2019-10-28T12:47:08
2019-12-12T12:24:19
2020-10-13T18:10:16
222
0
0
4
Java
false
false
package com.haohao.designpatterns.f_delegate.demo1; public class Leader { public String acceptCommandFromBoss(String command) { // 关于这里的 if-else 的优化, 等学习完成策略模式后在优化; if ("加密".equals(command)) { return new EmployeeA().acceptCommandFromLeader(command); } else if ("架构".equals(command)) { return new EmployeeB().acceptCommandFromLeader(command); } else { return "接收到的任务是 " + command + " , 现在没有员工可以处理这些事情."; } } }
UTF-8
Java
589
java
Leader.java
Java
[]
null
[]
package com.haohao.designpatterns.f_delegate.demo1; public class Leader { public String acceptCommandFromBoss(String command) { // 关于这里的 if-else 的优化, 等学习完成策略模式后在优化; if ("加密".equals(command)) { return new EmployeeA().acceptCommandFromLeader(command); } else if ("架构".equals(command)) { return new EmployeeB().acceptCommandFromLeader(command); } else { return "接收到的任务是 " + command + " , 现在没有员工可以处理这些事情."; } } }
589
0.615694
0.613682
16
30.0625
25.525646
68
false
false
0
0
0
0
0
0
0.4375
false
false
8
0176275772b1d4a34922485d20f97a5ef5fac354
23,596,550,390,365
6c02c05e5556bc2685b227683557be244894fa02
/JHangmanClient/src/jhangmanclient/game_data/NoGameException.java
37855571770eb5ca8c75ce935d32d67052457132
[]
no_license
gcali/jhangman
https://github.com/gcali/jhangman
0c821c05f591135d151749d0275750a6847bed79
592acd84385a2ff47975dcaf77f6a5380b531c87
refs/heads/master
2021-01-13T10:07:07.247000
2016-10-27T14:23:32
2016-10-27T14:23:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jhangmanclient.game_data; public class NoGameException extends Exception { /** * */ private static final long serialVersionUID = 1L; public NoGameException() { // TODO Auto-generated constructor stub } public NoGameException(String message) { super(message); // TODO Auto-generated constructor stub } public NoGameException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } public NoGameException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } public NoGameException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); // TODO Auto-generated constructor stub } }
UTF-8
Java
900
java
NoGameException.java
Java
[]
null
[]
package jhangmanclient.game_data; public class NoGameException extends Exception { /** * */ private static final long serialVersionUID = 1L; public NoGameException() { // TODO Auto-generated constructor stub } public NoGameException(String message) { super(message); // TODO Auto-generated constructor stub } public NoGameException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } public NoGameException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } public NoGameException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); // TODO Auto-generated constructor stub } }
900
0.663333
0.662222
35
24.714285
23.516039
69
false
false
0
0
0
0
0
0
0.4
false
false
8
52a9decb83fef645c043384c556af6cfa8c6f750
17,935,783,430,907
cca12317117d6fa84414826d355aa1bd0877ded5
/auto-value-utils/src/test/resources/input/SampleNestedTypePrototype.java
46c2e7c25f9cb715c671534cc67b18c130972100
[ "MIT" ]
permissive
slim-gears/utils
https://github.com/slim-gears/utils
dac9c3ad73cc513b48b096314ab6e22545bb2a47
ad32f3652ea3ded911ff328e813fec64bba00b1a
refs/heads/master
2022-08-31T19:34:38.819000
2022-07-21T03:58:20
2022-07-21T03:58:20
145,894,323
1
3
MIT
false
2020-08-30T08:28:54
2018-08-23T18:47:58
2020-08-30T08:13:31
2020-08-30T08:27:12
863
1
3
0
Java
false
false
package com.slimgears.sample; import com.slimgears.util.autovalue.annotations.UseMetaDataExtension; import com.slimgears.util.autovalue.annotations.AutoValuePrototype; @AutoValuePrototype @UseMetaDataExtension public interface SampleNestedTypePrototype { enum NestedEnum { Value1, Value2 } NestedEnum value(); }
UTF-8
Java
343
java
SampleNestedTypePrototype.java
Java
[]
null
[]
package com.slimgears.sample; import com.slimgears.util.autovalue.annotations.UseMetaDataExtension; import com.slimgears.util.autovalue.annotations.AutoValuePrototype; @AutoValuePrototype @UseMetaDataExtension public interface SampleNestedTypePrototype { enum NestedEnum { Value1, Value2 } NestedEnum value(); }
343
0.77551
0.769679
15
21.866667
21.715944
69
false
false
0
0
0
0
0
0
0.333333
false
false
8
e140101e9619c8384fd23bf7d4222e36a4f3326a
17,935,783,433,537
cdbb5c37ce90afd068a8744be279c8a7dc4708cd
/src/com/hillel/lesson9/classwork/Cat.java
dd40a7c5cc83097c7ab1565f61719290ca8912a0
[]
no_license
vladimirvasylenko/HillelJava
https://github.com/vladimirvasylenko/HillelJava
731d749cb970fee94a413cb7a06e046b8a01b908
131df354044040853ccfc06a31f42cf97c57c5e2
refs/heads/master
2023-07-01T15:50:11.333000
2021-08-08T12:15:22
2021-08-08T12:15:22
345,041,809
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hillel.lesson9.classwork; public class Cat extends Animal { private int energy; public Cat(String name, int age) { // call the parent constructor super(name, age); this.energy = 100; } @Override public void getAnimalSound() { System.out.println("cat sound : Miua"); } public void play() { if (energy > 0) { System.out.println("cat is playing"); energy = energy - 30; System.out.println("cat energy :" + energy); } else { System.out.println("cat is tired : energy is low level"); } } }
UTF-8
Java
637
java
Cat.java
Java
[]
null
[]
package com.hillel.lesson9.classwork; public class Cat extends Animal { private int energy; public Cat(String name, int age) { // call the parent constructor super(name, age); this.energy = 100; } @Override public void getAnimalSound() { System.out.println("cat sound : Miua"); } public void play() { if (energy > 0) { System.out.println("cat is playing"); energy = energy - 30; System.out.println("cat energy :" + energy); } else { System.out.println("cat is tired : energy is low level"); } } }
637
0.55102
0.540031
27
22.592592
19.104506
69
false
false
0
0
0
0
0
0
0.407407
false
false
8
0d3fa98816a49f1f5ff554a06830468b9c35ac97
3,032,246,972,400
c42bb1dcc3814c618f4eddccf4cc0aa21a767d25
/app/src/main/java/com/mf/myapp/MainActivity.java
d45cf18a97bbaf8de20bbace9e8484cd279927ce
[]
no_license
fahedawad/myapp
https://github.com/fahedawad/myapp
d8609759d4a323ff17ccfb05d320a7512d71fe26
c3d8c77ca37ac60603384c7c2673635ae903853a
refs/heads/master
2020-05-01T01:15:53.664000
2019-03-22T18:31:02
2019-03-22T18:31:02
177,191,169
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mf.myapp; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView create; LinearLayout account , pass,email; Button company , student; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); company =findViewById(R.id.company); email =findViewById(R.id.email); student =findViewById(R.id.student); pass =findViewById(R.id.pass); account = findViewById(R.id.x); create =findViewById(R.id.creat); create.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { email.setVisibility(View.GONE); pass.setVisibility(View.GONE); account.setVisibility(View.VISIBLE); } }); company.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, Student.class); startActivity(intent); } }); student.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Student =new Intent(MainActivity.this, Company.class); startActivity(Student); } }); } }
UTF-8
Java
1,671
java
MainActivity.java
Java
[]
null
[]
package com.mf.myapp; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView create; LinearLayout account , pass,email; Button company , student; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); company =findViewById(R.id.company); email =findViewById(R.id.email); student =findViewById(R.id.student); pass =findViewById(R.id.pass); account = findViewById(R.id.x); create =findViewById(R.id.creat); create.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { email.setVisibility(View.GONE); pass.setVisibility(View.GONE); account.setVisibility(View.VISIBLE); } }); company.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, Student.class); startActivity(intent); } }); student.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Student =new Intent(MainActivity.this, Company.class); startActivity(Student); } }); } }
1,671
0.62298
0.622382
54
29.944445
20.804573
77
false
false
0
0
0
0
0
0
0.62963
false
false
8
5763577cecf457d693869a06afb01c8b59f09b4b
1,125,281,489,633
44b9ad1c86d67376d9ececffc9dd18a8b7829a4e
/MicoservicesLearning/movie-rating-with-hystrix/src/main/java/com/example/movieratingwithhystrix/service/MovieService.java
c20f60d6a733645f994baeda586c08f946e57105
[]
no_license
mdfraz13/MicroservicesLearning
https://github.com/mdfraz13/MicroservicesLearning
8aea844b2303cf4a56cb6c5b01ff9464593183e9
6e14513aa1d8af2f4f713a628bd7adf8af227f43
refs/heads/master
2023-04-20T19:29:12.943000
2021-05-15T04:31:03
2021-05-15T04:31:03
336,275,315
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.movieratingwithhystrix.service; import com.example.movieratingwithhystrix.beans.Movie; import com.example.movieratingwithhystrix.beans.MovieRatings; import com.example.movieratingwithhystrix.beans.Rating; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import java.util.ArrayList; import java.util.List; @Service public class MovieService { @Autowired private RestTemplate restTemplate; @HystrixCommand(fallbackMethod = "getMovieFallback") public Movie getMovie(String id) { final var movieResp = restTemplate.getForEntity("http://movie-service/v1/movie/"+id, Movie.class); if (HttpStatus.OK.equals(movieResp.getStatusCode())) { System.out.println("recieved success response from Movie service .."); final var movie = movieResp.getBody(); return movie; } else { System.out.println("failure response from movie"); } return null; } public Movie getMovieFallback(String id) { System.out.println("fallback to default movie..."); return new Movie("00", "Dummy Movie"); } }
UTF-8
Java
1,364
java
MovieService.java
Java
[]
null
[]
package com.example.movieratingwithhystrix.service; import com.example.movieratingwithhystrix.beans.Movie; import com.example.movieratingwithhystrix.beans.MovieRatings; import com.example.movieratingwithhystrix.beans.Rating; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import java.util.ArrayList; import java.util.List; @Service public class MovieService { @Autowired private RestTemplate restTemplate; @HystrixCommand(fallbackMethod = "getMovieFallback") public Movie getMovie(String id) { final var movieResp = restTemplate.getForEntity("http://movie-service/v1/movie/"+id, Movie.class); if (HttpStatus.OK.equals(movieResp.getStatusCode())) { System.out.println("recieved success response from Movie service .."); final var movie = movieResp.getBody(); return movie; } else { System.out.println("failure response from movie"); } return null; } public Movie getMovieFallback(String id) { System.out.println("fallback to default movie..."); return new Movie("00", "Dummy Movie"); } }
1,364
0.723607
0.721408
40
33.099998
27.050694
106
false
false
0
0
0
0
0
0
0.55
false
false
8
74d31e03228b6f7dc0fc4c79d7e74dd015dc7493
4,037,269,326,259
1813f1c35ebcf2995a9746433ff7f908bc15a51c
/Simmapservice/src/test/java/testenvironment/TestConnection.java
50492f0ff31aece484b9e891c9d9ab274e05ab9b
[]
no_license
HSR-Bachelor-Dominik-Fabian/traffic-model-case-study-editor
https://github.com/HSR-Bachelor-Dominik-Fabian/traffic-model-case-study-editor
2f6078d4d32b2e189e55bf1508259bc81e0bbe15
5585cf6656b41db350a693e6a3cd75199de99f61
refs/heads/master
2021-06-03T19:25:45.132000
2016-06-14T12:25:16
2016-06-14T12:25:16
52,432,151
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package testenvironment; import dataaccess.connectionutils.IConnection; import org.jooq.tools.jdbc.MockConnection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class TestConnection implements IConnection { public TestConnection(ConnectionMode connectionMode) { this.connectionMode = connectionMode; } private final ConnectionMode connectionMode; @Override public Connection getConnectionFromProps(Properties properties) throws SQLException { if (this.connectionMode != ConnectionMode.NOCONNECTION) { TestDatabaseProviderPositive provider = new TestDatabaseProviderPositive(); provider.setConnectionMode(this.connectionMode); return new MockConnection(provider); } else { return DriverManager.getConnection(TestDataUtil.getTestPSQLPath(), TestDataUtil.getTestUsername() , TestDataUtil.getTestPassword()); } } }
UTF-8
Java
1,019
java
TestConnection.java
Java
[]
null
[]
package testenvironment; import dataaccess.connectionutils.IConnection; import org.jooq.tools.jdbc.MockConnection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class TestConnection implements IConnection { public TestConnection(ConnectionMode connectionMode) { this.connectionMode = connectionMode; } private final ConnectionMode connectionMode; @Override public Connection getConnectionFromProps(Properties properties) throws SQLException { if (this.connectionMode != ConnectionMode.NOCONNECTION) { TestDatabaseProviderPositive provider = new TestDatabaseProviderPositive(); provider.setConnectionMode(this.connectionMode); return new MockConnection(provider); } else { return DriverManager.getConnection(TestDataUtil.getTestPSQLPath(), TestDataUtil.getTestUsername() , TestDataUtil.getTestPassword()); } } }
1,019
0.737978
0.737978
29
34.137932
29.526989
109
false
false
0
0
0
0
0
0
0.517241
false
false
8
bc15f04f2e75b156bdae91f236931619a7a16f93
24,799,141,231,894
959fac1472ba9a9138ac7bce59e35db498a273dd
/app/src/main/java/org/tensorflow/lite/examples/detection/Retrofit/Service.java
ee66a02a14d16564e5fa4d069bffcae25368e34c
[]
no_license
phamthaicong/android
https://github.com/phamthaicong/android
777e43143b553fecfe721031683c356e7ab4ecfb
4d7416440dbf1ba705e1b11c01c64b4b86f2eba2
refs/heads/master
2023-03-13T06:58:23.925000
2021-03-01T01:52:25
2021-03-01T01:52:25
343,260,664
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.tensorflow.lite.examples.detection.Retrofit; import org.tensorflow.lite.examples.detection.Model.ChooseCheckIn; import org.tensorflow.lite.examples.detection.Model.PostImage; import java.util.List; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; public interface Service { @POST("/user") Call<List<PostImage>> testRetrofit(@Body PostImage postImage); @POST("/check-in-tablet") Call<List<PostImage>> postImage(@Body PostImage postImage); @POST("/choose-to-check-in") Call<List<ChooseCheckIn>> chooseUserCheckIn(@Body ChooseCheckIn chooseCheckIn); @GET("/user") Call<List<PostImage>> getUserSuccessTest(); }
UTF-8
Java
720
java
Service.java
Java
[]
null
[]
package org.tensorflow.lite.examples.detection.Retrofit; import org.tensorflow.lite.examples.detection.Model.ChooseCheckIn; import org.tensorflow.lite.examples.detection.Model.PostImage; import java.util.List; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; public interface Service { @POST("/user") Call<List<PostImage>> testRetrofit(@Body PostImage postImage); @POST("/check-in-tablet") Call<List<PostImage>> postImage(@Body PostImage postImage); @POST("/choose-to-check-in") Call<List<ChooseCheckIn>> chooseUserCheckIn(@Body ChooseCheckIn chooseCheckIn); @GET("/user") Call<List<PostImage>> getUserSuccessTest(); }
720
0.751389
0.745833
25
27.799999
25.201588
84
false
false
0
0
0
0
0
0
0.48
false
false
8
38de1649625c468462516ddd1af7288f188b5513
9,070,970,931,185
c2b273cdc2fd2eb21c5d59e32a9dd372c6b1376e
/src/main/java/ContactData.java
428d056d12c422ab687c4bb43fdc7139e7d4f45b
[]
no_license
MocaDD/Module_5_AddressBook
https://github.com/MocaDD/Module_5_AddressBook
74fdf75d51b8018ec1196ad63a1cf0842b37f719
c93db6e8939613d0b097e94b8c65e260c635ee8e
refs/heads/master
2020-07-08T06:15:12.449000
2019-08-21T14:02:40
2019-08-21T14:02:40
203,589,771
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class ContactData implements java.io.Serializable { }
UTF-8
Java
69
java
ContactData.java
Java
[]
null
[]
public class ContactData implements java.io.Serializable { }
69
0.724638
0.724638
5
11.8
23.103247
58
false
false
0
0
0
0
0
0
0
false
false
8
ace380912b8758b8f55f688cf0a28dfd006f00e4
12,824,772,405,594
d604aca819874fd82840ccbd96388230ad5399e7
/src/main/java/controller/OrderController.java
bacbd5b03e9924535360b5bf87b6cea532546a55
[]
no_license
filipiakp/Hurtownia
https://github.com/filipiakp/Hurtownia
fe44dc61f8e5a96f4dd3093ce2d0f90b041e61ed
dd0cb35105fcf8fe5984522fc85a3520483a6a3e
refs/heads/master
2020-03-18T08:43:06.218000
2018-10-04T17:48:55
2018-10-04T17:48:55
134,523,755
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import entities.OrderProduct; import entities.PurchaseOrder; import model.OrderModel; import model.OrderProductModel; import view.OrderView; /** * Klasa odpowiadająca za reakcję na akcje użytkownika, wsyłane przez przyciski. * Kontroler modyfikuje model i zmusza go do powiadomienia obserwujących o zmianie. * Implementuje interfejs ActionListener. * */ public class OrderController implements ActionListener{ private OrderModel model; private OrderView view; private OrderProductModel orderProductModel; /** * @param orderProductModel the orderProductModel to set */ public void setOrderProductModel(OrderProductModel orderProductModel) { this.orderProductModel = orderProductModel; } /** * @param model the model to set */ public void setModel(OrderModel model) { this.model = model; } /** * @param view the view to set */ public void setView(OrderView view) { this.view = view; } @Override public void actionPerformed(ActionEvent e) { JButton source = (JButton) e.getSource(); //table buttons panel if (source.equals(view.getTableButtonsPanel().getRemoveBttn())) { PurchaseOrder purchaseOrder = view.getSelectedOrder(); if(purchaseOrder != null){ model.removeOrder(purchaseOrder); model.notifyAllObservers(); } }else if(source.equals(view.getTableButtonsPanel().getEditBttn())) { PurchaseOrder purchaseOrder = view.getSelectedOrder(); if(purchaseOrder != null){ view.showDialog(purchaseOrder, false); } } else if(source.equals(view.getTableButtonsPanel().getAddBttn())) { view.showDialog(new PurchaseOrder(), true); //dialog //ok cancel buttons } else if(source.equals(view.getDialog().getOkCancelButtonsPanel().getOkBttn())){ if(view.getDialog().validateFields()){ if(view.getDialog().isNew()){ model.addOrder(view.getDialog().getOrder()); model.notifyAllObservers(); }else{ model.updateOrder(view.getDialog().getContext(), view.getDialog().getOrder()); model.notifyAllObservers(); } view.getDialog().dispose(); } } else if(source.equals(view.getDialog().getOkCancelButtonsPanel().getCancelBttn())){ view.getDialog().dispose(); //add remove from orderProductList buttons } else if(source.equals(view.getDialog().getAddBttn())){ if(view.getDialog().validateProductFields() && !view.getDialog().isProductAdded(view.getDialog().getSelectedProduct().getCode())){ OrderProduct orderProduct = new OrderProduct(); orderProduct.setNumberOfProducts(Integer.parseInt(view.getDialog().getAmountTF().getText())); orderProduct.setProduct(view.getDialog().getSelectedProduct()); orderProductModel.addOrderProduct(orderProduct); view.getDialog().addOrderProduct(orderProduct);; } } else if(source.equals(view.getDialog().getRemoveBttn())){ OrderProduct orderProductOld = view.getDialog().removeSelectedOrderProduct(); if(orderProductOld != null){ OrderProduct orderProductNew = new OrderProduct(); orderProductNew.setId(orderProductOld.getId()); orderProductNew.setNumberOfProducts(orderProductOld.getNumberOfProducts()); orderProductModel.updateOrderProduct(orderProductOld, orderProductNew); orderProductModel.removeOrderProduct(orderProductNew); } } } }
UTF-8
Java
3,407
java
OrderController.java
Java
[]
null
[]
package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import entities.OrderProduct; import entities.PurchaseOrder; import model.OrderModel; import model.OrderProductModel; import view.OrderView; /** * Klasa odpowiadająca za reakcję na akcje użytkownika, wsyłane przez przyciski. * Kontroler modyfikuje model i zmusza go do powiadomienia obserwujących o zmianie. * Implementuje interfejs ActionListener. * */ public class OrderController implements ActionListener{ private OrderModel model; private OrderView view; private OrderProductModel orderProductModel; /** * @param orderProductModel the orderProductModel to set */ public void setOrderProductModel(OrderProductModel orderProductModel) { this.orderProductModel = orderProductModel; } /** * @param model the model to set */ public void setModel(OrderModel model) { this.model = model; } /** * @param view the view to set */ public void setView(OrderView view) { this.view = view; } @Override public void actionPerformed(ActionEvent e) { JButton source = (JButton) e.getSource(); //table buttons panel if (source.equals(view.getTableButtonsPanel().getRemoveBttn())) { PurchaseOrder purchaseOrder = view.getSelectedOrder(); if(purchaseOrder != null){ model.removeOrder(purchaseOrder); model.notifyAllObservers(); } }else if(source.equals(view.getTableButtonsPanel().getEditBttn())) { PurchaseOrder purchaseOrder = view.getSelectedOrder(); if(purchaseOrder != null){ view.showDialog(purchaseOrder, false); } } else if(source.equals(view.getTableButtonsPanel().getAddBttn())) { view.showDialog(new PurchaseOrder(), true); //dialog //ok cancel buttons } else if(source.equals(view.getDialog().getOkCancelButtonsPanel().getOkBttn())){ if(view.getDialog().validateFields()){ if(view.getDialog().isNew()){ model.addOrder(view.getDialog().getOrder()); model.notifyAllObservers(); }else{ model.updateOrder(view.getDialog().getContext(), view.getDialog().getOrder()); model.notifyAllObservers(); } view.getDialog().dispose(); } } else if(source.equals(view.getDialog().getOkCancelButtonsPanel().getCancelBttn())){ view.getDialog().dispose(); //add remove from orderProductList buttons } else if(source.equals(view.getDialog().getAddBttn())){ if(view.getDialog().validateProductFields() && !view.getDialog().isProductAdded(view.getDialog().getSelectedProduct().getCode())){ OrderProduct orderProduct = new OrderProduct(); orderProduct.setNumberOfProducts(Integer.parseInt(view.getDialog().getAmountTF().getText())); orderProduct.setProduct(view.getDialog().getSelectedProduct()); orderProductModel.addOrderProduct(orderProduct); view.getDialog().addOrderProduct(orderProduct);; } } else if(source.equals(view.getDialog().getRemoveBttn())){ OrderProduct orderProductOld = view.getDialog().removeSelectedOrderProduct(); if(orderProductOld != null){ OrderProduct orderProductNew = new OrderProduct(); orderProductNew.setId(orderProductOld.getId()); orderProductNew.setNumberOfProducts(orderProductOld.getNumberOfProducts()); orderProductModel.updateOrderProduct(orderProductOld, orderProductNew); orderProductModel.removeOrderProduct(orderProductNew); } } } }
3,407
0.738977
0.738977
106
31.094339
28.184544
133
false
false
0
0
0
0
0
0
2.367924
false
false
8
902c108de59286cae3915cb23e89a7bfddb3937a
68,719,526,650
804d82d9974f2a0b17398c3558fd3fd68f170398
/src/main/java/com/upgrade/islandreservationsapi/exception/ReservationNotFoundException.java
849db9e661b8be918eca6d6973491ce88a600a94
[]
no_license
damiancardozo/island-reservations-api
https://github.com/damiancardozo/island-reservations-api
83bd428f00fcfebf08f48a386487bc360df491bd
c0565f04f640612a847f35ccd01b22bef9cad668
refs/heads/master
2020-04-20T01:01:57.961000
2019-03-11T06:07:46
2019-03-11T06:07:46
168,534,598
0
0
null
false
2019-03-11T06:07:47
2019-01-31T14:02:46
2019-03-09T15:12:14
2019-03-11T06:07:47
81
0
0
0
Java
false
null
package com.upgrade.islandreservationsapi.exception; public class ReservationNotFoundException extends Exception { public ReservationNotFoundException() { super("Reservation not found"); } public ReservationNotFoundException(Integer id) { super(String.format("Reservation with id %d not found", id)); } }
UTF-8
Java
341
java
ReservationNotFoundException.java
Java
[]
null
[]
package com.upgrade.islandreservationsapi.exception; public class ReservationNotFoundException extends Exception { public ReservationNotFoundException() { super("Reservation not found"); } public ReservationNotFoundException(Integer id) { super(String.format("Reservation with id %d not found", id)); } }
341
0.727273
0.727273
13
25.23077
26.516045
69
false
false
0
0
0
0
0
0
0.307692
false
false
8
4122133a11a304a17e6152e9e98f156781867dac
10,617,159,218,359
3bdb4e8aadd1af974355cd4860658a5fd7e78df2
/ImputationAlgorithms/src/hotdeckimputation/HotDeck.java
6698b44e257d6c0251c81a8db53805d16b328368
[]
no_license
kaplansinan/Imputation-of-Missing-Data
https://github.com/kaplansinan/Imputation-of-Missing-Data
f46baecdc0a046a4a49b95aa9223d60276b9fad7
97b34358e709b66d061fcaf2de4f6a7381acdac7
refs/heads/master
2021-03-12T23:57:33.180000
2015-03-30T16:01:57
2015-03-30T16:01:57
33,132,897
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hotdeckimputation; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Random; import java.util.Scanner; /** * * @author Sin@n K@pl@n * This class implements the hot deck technique to impute missing * data the column/feature/variable to be sorted based on chosen attribute if * there is no missing variable on this attribute */ public class HotDeck { private double[] means;//means for each variable/feature private double[] stdeviations;// standart deviations for each variable/features public static double[][] data; private int[] tot_mis_atr;// holds the total missing instance of the each atrribute public static int selected_atr;// to perform hot deck algorithm public static boolean select_atr;// if the hot deck performs on the selected item public int countb, countf; public double[][] modes; public static String[] header; public HotDeck() { } public void prepareData() { //initialize tot_mis_atr array tot_mis_atr = new int[data[0].length]; //initialize means array means = new double[data[0].length]; modes = new double[2][2]; // count the total missing instances that have missing value on j th attribute for (double[] data1 : data) { for (int j = 0; j < data[0].length; j++) { if (data1[j] == 0) { tot_mis_atr[j]++; } } } // just for debugging purpose for (int j = 0; j < data[0].length; j++) { System.out.println("Total missing attribute " + j + " is: " + tot_mis_atr[j]); } } public void Sort() { // Arrays.sort(data, new ColumnComparator(selected_atr, SortingOrder.ASCENDING)); // randomly generated column int hot_deck_column = 0; // if the user select the specific atribute to perform hot deck if ((select_atr) == true) { System.out.println("select atr is true"); // if all instances of the selected attribute are not missing // then perform hot deck on the selected attribute if (tot_mis_atr[selected_atr] != data.length) { // perform sorting on this column Arrays.sort(data, new ColumnComparator(selected_atr, SortingOrder.ASCENDING)); } //otherwise select a random attribute to perform hot deck else { hot_deck_column = SelectRandomAttribute(); //perform sorting on this column Arrays.sort(data, new ColumnComparator(hot_deck_column, SortingOrder.ASCENDING)); } } //otherwise choose a random atribute that has all the instances observed else { hot_deck_column = SelectRandomAttribute(); System.out.println("select atr is false"); //perform sorting on this column Arrays.sort(data, new ColumnComparator(hot_deck_column, SortingOrder.ASCENDING)); } } /* * Simple Enum to represent sorting order e.g. ascending and descending order */ enum SortingOrder { ASCENDING, DESCENDING; }; /* * Utility Comparator class to sort multi dimensional array in Java */ class ColumnComparator implements Comparator<double[]> { private final int iColumn; private final SortingOrder order; public ColumnComparator(int column, SortingOrder order) { this.iColumn = column; this.order = order; } @Override public int compare(double[] o1, double[] o2) { return Double.valueOf(o1[iColumn]).compareTo(o2[iColumn]); } } /** *This method selects the random attribute to sort the data * when it selects the attribute it checks if there is any missing value on this attribute or not. * Simply,the attribute which has no missing value is chosen * @return the attribute */ private int SelectRandomAttribute() { int sel_atr = 0; // random number generator Random r = new Random(); int k = 0; int j = 0; //check if there is a attribute(s) that has all the instances observed for (int i = 0; i < data[0].length; i++) { if (tot_mis_atr[i] == 0) { k++; } } //if there is a attribute(s) that has all instances observed // then perform hot deck on one of the these attributes randomly choosed if (k != 0) { while ((j < data[0].length)) { System.out.println("data[0] length :" + data[0].length); j = 0 + r.nextInt(data[0].length); System.out.println("Random j is :" + j); // if j th attribute has all instancess observed then // perform sorting o this attribute if (tot_mis_atr[j] == 0) { // select j to perform hot deck sel_atr = j; j = data[0].length + 1;// to exit the while loop } } } // if there is no attribute that has all instances observed // choose randomly to perform hot deck else { // attribute to perform hot deck j = 0 + r.nextInt(data[0].length); sel_atr = j; } return sel_atr; } /** * impute the missing values according to the class that instances belongs */ public void impute() { double valuef, valueb; // replace missing values of first instance for (int j = 0; j < data[0].length; j++) { if (data[0][j] == 0) { //go forward to fill it valuef = moveforward(0, j); data[0][j] = valuef / countf; } } // replace the missing values of i th instance for (int i = 1; i < data.length - 1; i++) { for (int j = 0; j < data[0].length; j++) { // if the attribute j th of instance i is missing then perform imputation if (data[i][j] == 0) { //if i th instance b/w same classes according to the selected attribute //the go forward and go back if (data[i - 1][selected_atr] == data[i + 1][selected_atr]) { valuef = moveforward(i, j); System.out.println("count f: " + countf); valueb = moveback(i, j); System.out.println("count b: " + countb); data[i][j] = (valuef + valueb) / (countf + countb); } else { //if i th instance belongs to the previous clas then go back to fill it. if (data[i - 1][selected_atr] == data[i][selected_atr]) { valueb = moveback(i, j); data[i][j] = (valueb) / (countb); } else { //if i th instance belongs to the next class then go forward to fill it. if (data[i + 1][selected_atr] == data[i][selected_atr]) { valuef = moveforward(i, j); data[i][j] = (valuef) / (countf); } else { //if i th instance does not belong to either previous and next classes // go back and go forward valuef = moveforward(i, j); valueb = moveback(i, j); data[i][j] = (valuef + valueb) / (countf + countb); } } } } } } // replace missing values of the last instances for (int j = 0; j < data[0].length; j++) { if (data[data.length - 1][j] == 0) { //go back to fill it valueb = moveback(data.length - 1, j); data[data.length - 1][j] = valueb / countb; } } Arrays.sort(data, new ColumnComparator(0, SortingOrder.ASCENDING)); } /** * this method goes back through same class * * @param i from which instance goes back * @param j the attribute to be filled * @return */ private double moveback(int i, int j) { double value = 0; countb = 1; int b = i - 1; value = value + data[b][j]; while (((b - 1) >= 0) && (data[b][selected_atr] == data[b - 1][selected_atr])) { b--; if (data[b][j] != 0) { value = value + data[b][j]; countb++; } } return value; } /** * this method goes forward through same class * * @param i from which instance goes forward * @param j * @return */ private double moveforward(int i, int j) { double value = 0; countf = 0; int f = i + 1; //value = value + data[f][j]; System.out.println("f is: " + f); while ((f < data.length - 1) && (data[f][selected_atr] == data[f + 1][selected_atr])) { if (data[f][j] != 0) { value = value + data[f][j]; countf++; } f++; } if ((f <= data.length - 1) && (data[f][j] != 0)) { value = value + data[f][j]; countf++; } if (j == selected_atr) { // if j==selected attribute and it is missing the perform this special case if ((f <= data.length - 1) && (data[f][j] == 0)) { f++; while ((f < data.length - 1) && (data[f][selected_atr] == data[f + 1][selected_atr])) { if (data[f][j] != 0) { value = value + data[f][j]; countf++; } f++; } if ((f <= data.length - 1) && (data[f][j] != 0)) { value = value + data[f][j]; countf++; } } } return value; } private void findmodeofnextclass(int row, int column, int max) { int f = row + 1; int[] frequency = new int[max + 1]; } /** * read the data from the .csv file * * @param filename * @param data * @throws Exception */ private void read_data(String filename) throws Exception { ArrayList<ArrayList<Double>> arr; /* String[] dims = inFile.readLine().split(","); if (dims.length != 2) { throw new Exception("Error: malformed dimensions line"); }*/ try (BufferedReader inFile = new BufferedReader(new FileReader(filename))) { /* String[] dims = inFile.readLine().split(","); if (dims.length != 2) { throw new Exception("Error: malformed dimensions line"); }*/ header = inFile.readLine().split(","); arr = new ArrayList<>(); //data = new double[Integer.parseInt(dims[0])][Integer.parseInt(dims[1])]; String str; // int j = 0; while ((str = inFile.readLine()) != null) { String[] ins = str.split(","); ArrayList<Double> temp = new ArrayList<>(); for (int i = 0; i < ins.length; i++) { if (!"?".equals(ins[i])) { temp.add(Double.parseDouble(ins[i])); // data[j][i] = Double.parseDouble(ins[i]); } else { //data[j][i] = 0; temp.add(0.0); } } arr.add(temp); // j++; } //System.out.println(arr.size()); //System.out.println(data[0].length); } data = new double[arr.size()][arr.get(0).size()]; // System.out.println(data.length); //System.out.println(data[0].length); for (int i = 0; i < data.length; i++) { // System.out.println(i); for (int j = 0; j < data[0].length; j++) { data[i][j] = arr.get(i).get(j); // System.out.print(data[i][j]+"\t"); } //System.out.println(); } arr = null; //System.out.println(arr.size()); } public void generateCSVFile(String filename) { try { try (FileWriter writer = new FileWriter(filename, true)) { for (int i = 0; i < header.length - 1; i++) { writer.append(String.valueOf(header[i])); writer.append(','); } writer.append(String.valueOf(header[header.length - 1])); writer.append('\n'); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length - 1; j++) { //for normalization //data[i][j]=((data[i][j])*(max[j]-min[j]))+min[j]; writer.append(String.valueOf(data[i][j])); writer.append(','); } writer.append(String.valueOf(data[i][data[0].length - 1])); writer.append('\n'); } writer.flush(); } } catch (IOException e) { e.printStackTrace(); } } public void RunHotDeck(String filename, String outputfile) throws Exception { char c; Scanner sc = new Scanner(System.in); read_data(filename); prepareData(); System.out.println("Would you like to select the atribute to sort the data?[true/false]"); select_atr = sc.nextBoolean(); System.out.println(select_atr); if (select_atr) { System.out.println("Select attribute"); selected_atr = sc.nextInt(); } else{ // if no attribute is selected to sort the data initial is 0 selected_atr = 0; } System.out.println("Selected attribute is: " + selected_atr); //sort the data Sort(); //impute the missing values according to the choosen attrbiute impute(); //write values to the file generateCSVFile(outputfile); System.out.println("After Imputation"); for (double[] data1 : data) { for (int t = 0; t < data[0].length; t++) { System.out.print(data1[t] + "\t"); } System.out.print("\n"); } } public static void main(String[] args) throws Exception { String filename = "C:\\Users\\Sinan\\Desktop\\Tests\\Gamma\\DIM128_gamma_30mv.csv"; String output = "C:\\Users\\Sinan\\Desktop\\test_em_10_gamma_newwwww.csv"; HotDeck hd = new HotDeck(); hd.RunHotDeck(filename, output); } }
UTF-8
Java
15,552
java
HotDeck.java
Java
[ { "context": "ndom;\nimport java.util.Scanner;\n\n/**\n *\n * @author Sin@n K@pl@n\n * This class implements the hot deck tec", "end": 483, "score": 0.6645218729972839, "start": 478, "tag": "NAME", "value": "Sin@n" }, { "context": "mport java.util.Scanner;\n\n/**\n *\n * @author Sin@n K@pl@n\n * This class implements the hot deck techni", "end": 486, "score": 0.585510790348053, "start": 485, "tag": "EMAIL", "value": "K" }, { "context": "rt java.util.Scanner;\n\n/**\n *\n * @author Sin@n K@pl@n\n * This class implements the hot deck technique", "end": 489, "score": 0.4960550367832184, "start": 487, "tag": "EMAIL", "value": "pl" }, { "context": "java.util.Scanner;\n\n/**\n *\n * @author Sin@n K@pl@n\n * This class implements the hot deck technique t", "end": 491, "score": 0.48907649517059326, "start": 490, "tag": "EMAIL", "value": "n" }, { "context": "xception {\n\n String filename = \"C:\\\\Users\\\\Sinan\\\\Desktop\\\\Tests\\\\Gamma\\\\DIM128_gamma_30mv.csv\";\n ", "end": 15332, "score": 0.8775249719619751, "start": 15327, "tag": "NAME", "value": "Sinan" }, { "context": "ma_30mv.csv\";\n String output = \"C:\\\\Users\\\\Sinan\\\\Desktop\\\\test_em_10_gamma_newwwww.csv\";\n\n ", "end": 15420, "score": 0.4913787841796875, "start": 15417, "tag": "NAME", "value": "Sin" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hotdeckimputation; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Random; import java.util.Scanner; /** * * @author Sin@n K@pl@n * This class implements the hot deck technique to impute missing * data the column/feature/variable to be sorted based on chosen attribute if * there is no missing variable on this attribute */ public class HotDeck { private double[] means;//means for each variable/feature private double[] stdeviations;// standart deviations for each variable/features public static double[][] data; private int[] tot_mis_atr;// holds the total missing instance of the each atrribute public static int selected_atr;// to perform hot deck algorithm public static boolean select_atr;// if the hot deck performs on the selected item public int countb, countf; public double[][] modes; public static String[] header; public HotDeck() { } public void prepareData() { //initialize tot_mis_atr array tot_mis_atr = new int[data[0].length]; //initialize means array means = new double[data[0].length]; modes = new double[2][2]; // count the total missing instances that have missing value on j th attribute for (double[] data1 : data) { for (int j = 0; j < data[0].length; j++) { if (data1[j] == 0) { tot_mis_atr[j]++; } } } // just for debugging purpose for (int j = 0; j < data[0].length; j++) { System.out.println("Total missing attribute " + j + " is: " + tot_mis_atr[j]); } } public void Sort() { // Arrays.sort(data, new ColumnComparator(selected_atr, SortingOrder.ASCENDING)); // randomly generated column int hot_deck_column = 0; // if the user select the specific atribute to perform hot deck if ((select_atr) == true) { System.out.println("select atr is true"); // if all instances of the selected attribute are not missing // then perform hot deck on the selected attribute if (tot_mis_atr[selected_atr] != data.length) { // perform sorting on this column Arrays.sort(data, new ColumnComparator(selected_atr, SortingOrder.ASCENDING)); } //otherwise select a random attribute to perform hot deck else { hot_deck_column = SelectRandomAttribute(); //perform sorting on this column Arrays.sort(data, new ColumnComparator(hot_deck_column, SortingOrder.ASCENDING)); } } //otherwise choose a random atribute that has all the instances observed else { hot_deck_column = SelectRandomAttribute(); System.out.println("select atr is false"); //perform sorting on this column Arrays.sort(data, new ColumnComparator(hot_deck_column, SortingOrder.ASCENDING)); } } /* * Simple Enum to represent sorting order e.g. ascending and descending order */ enum SortingOrder { ASCENDING, DESCENDING; }; /* * Utility Comparator class to sort multi dimensional array in Java */ class ColumnComparator implements Comparator<double[]> { private final int iColumn; private final SortingOrder order; public ColumnComparator(int column, SortingOrder order) { this.iColumn = column; this.order = order; } @Override public int compare(double[] o1, double[] o2) { return Double.valueOf(o1[iColumn]).compareTo(o2[iColumn]); } } /** *This method selects the random attribute to sort the data * when it selects the attribute it checks if there is any missing value on this attribute or not. * Simply,the attribute which has no missing value is chosen * @return the attribute */ private int SelectRandomAttribute() { int sel_atr = 0; // random number generator Random r = new Random(); int k = 0; int j = 0; //check if there is a attribute(s) that has all the instances observed for (int i = 0; i < data[0].length; i++) { if (tot_mis_atr[i] == 0) { k++; } } //if there is a attribute(s) that has all instances observed // then perform hot deck on one of the these attributes randomly choosed if (k != 0) { while ((j < data[0].length)) { System.out.println("data[0] length :" + data[0].length); j = 0 + r.nextInt(data[0].length); System.out.println("Random j is :" + j); // if j th attribute has all instancess observed then // perform sorting o this attribute if (tot_mis_atr[j] == 0) { // select j to perform hot deck sel_atr = j; j = data[0].length + 1;// to exit the while loop } } } // if there is no attribute that has all instances observed // choose randomly to perform hot deck else { // attribute to perform hot deck j = 0 + r.nextInt(data[0].length); sel_atr = j; } return sel_atr; } /** * impute the missing values according to the class that instances belongs */ public void impute() { double valuef, valueb; // replace missing values of first instance for (int j = 0; j < data[0].length; j++) { if (data[0][j] == 0) { //go forward to fill it valuef = moveforward(0, j); data[0][j] = valuef / countf; } } // replace the missing values of i th instance for (int i = 1; i < data.length - 1; i++) { for (int j = 0; j < data[0].length; j++) { // if the attribute j th of instance i is missing then perform imputation if (data[i][j] == 0) { //if i th instance b/w same classes according to the selected attribute //the go forward and go back if (data[i - 1][selected_atr] == data[i + 1][selected_atr]) { valuef = moveforward(i, j); System.out.println("count f: " + countf); valueb = moveback(i, j); System.out.println("count b: " + countb); data[i][j] = (valuef + valueb) / (countf + countb); } else { //if i th instance belongs to the previous clas then go back to fill it. if (data[i - 1][selected_atr] == data[i][selected_atr]) { valueb = moveback(i, j); data[i][j] = (valueb) / (countb); } else { //if i th instance belongs to the next class then go forward to fill it. if (data[i + 1][selected_atr] == data[i][selected_atr]) { valuef = moveforward(i, j); data[i][j] = (valuef) / (countf); } else { //if i th instance does not belong to either previous and next classes // go back and go forward valuef = moveforward(i, j); valueb = moveback(i, j); data[i][j] = (valuef + valueb) / (countf + countb); } } } } } } // replace missing values of the last instances for (int j = 0; j < data[0].length; j++) { if (data[data.length - 1][j] == 0) { //go back to fill it valueb = moveback(data.length - 1, j); data[data.length - 1][j] = valueb / countb; } } Arrays.sort(data, new ColumnComparator(0, SortingOrder.ASCENDING)); } /** * this method goes back through same class * * @param i from which instance goes back * @param j the attribute to be filled * @return */ private double moveback(int i, int j) { double value = 0; countb = 1; int b = i - 1; value = value + data[b][j]; while (((b - 1) >= 0) && (data[b][selected_atr] == data[b - 1][selected_atr])) { b--; if (data[b][j] != 0) { value = value + data[b][j]; countb++; } } return value; } /** * this method goes forward through same class * * @param i from which instance goes forward * @param j * @return */ private double moveforward(int i, int j) { double value = 0; countf = 0; int f = i + 1; //value = value + data[f][j]; System.out.println("f is: " + f); while ((f < data.length - 1) && (data[f][selected_atr] == data[f + 1][selected_atr])) { if (data[f][j] != 0) { value = value + data[f][j]; countf++; } f++; } if ((f <= data.length - 1) && (data[f][j] != 0)) { value = value + data[f][j]; countf++; } if (j == selected_atr) { // if j==selected attribute and it is missing the perform this special case if ((f <= data.length - 1) && (data[f][j] == 0)) { f++; while ((f < data.length - 1) && (data[f][selected_atr] == data[f + 1][selected_atr])) { if (data[f][j] != 0) { value = value + data[f][j]; countf++; } f++; } if ((f <= data.length - 1) && (data[f][j] != 0)) { value = value + data[f][j]; countf++; } } } return value; } private void findmodeofnextclass(int row, int column, int max) { int f = row + 1; int[] frequency = new int[max + 1]; } /** * read the data from the .csv file * * @param filename * @param data * @throws Exception */ private void read_data(String filename) throws Exception { ArrayList<ArrayList<Double>> arr; /* String[] dims = inFile.readLine().split(","); if (dims.length != 2) { throw new Exception("Error: malformed dimensions line"); }*/ try (BufferedReader inFile = new BufferedReader(new FileReader(filename))) { /* String[] dims = inFile.readLine().split(","); if (dims.length != 2) { throw new Exception("Error: malformed dimensions line"); }*/ header = inFile.readLine().split(","); arr = new ArrayList<>(); //data = new double[Integer.parseInt(dims[0])][Integer.parseInt(dims[1])]; String str; // int j = 0; while ((str = inFile.readLine()) != null) { String[] ins = str.split(","); ArrayList<Double> temp = new ArrayList<>(); for (int i = 0; i < ins.length; i++) { if (!"?".equals(ins[i])) { temp.add(Double.parseDouble(ins[i])); // data[j][i] = Double.parseDouble(ins[i]); } else { //data[j][i] = 0; temp.add(0.0); } } arr.add(temp); // j++; } //System.out.println(arr.size()); //System.out.println(data[0].length); } data = new double[arr.size()][arr.get(0).size()]; // System.out.println(data.length); //System.out.println(data[0].length); for (int i = 0; i < data.length; i++) { // System.out.println(i); for (int j = 0; j < data[0].length; j++) { data[i][j] = arr.get(i).get(j); // System.out.print(data[i][j]+"\t"); } //System.out.println(); } arr = null; //System.out.println(arr.size()); } public void generateCSVFile(String filename) { try { try (FileWriter writer = new FileWriter(filename, true)) { for (int i = 0; i < header.length - 1; i++) { writer.append(String.valueOf(header[i])); writer.append(','); } writer.append(String.valueOf(header[header.length - 1])); writer.append('\n'); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length - 1; j++) { //for normalization //data[i][j]=((data[i][j])*(max[j]-min[j]))+min[j]; writer.append(String.valueOf(data[i][j])); writer.append(','); } writer.append(String.valueOf(data[i][data[0].length - 1])); writer.append('\n'); } writer.flush(); } } catch (IOException e) { e.printStackTrace(); } } public void RunHotDeck(String filename, String outputfile) throws Exception { char c; Scanner sc = new Scanner(System.in); read_data(filename); prepareData(); System.out.println("Would you like to select the atribute to sort the data?[true/false]"); select_atr = sc.nextBoolean(); System.out.println(select_atr); if (select_atr) { System.out.println("Select attribute"); selected_atr = sc.nextInt(); } else{ // if no attribute is selected to sort the data initial is 0 selected_atr = 0; } System.out.println("Selected attribute is: " + selected_atr); //sort the data Sort(); //impute the missing values according to the choosen attrbiute impute(); //write values to the file generateCSVFile(outputfile); System.out.println("After Imputation"); for (double[] data1 : data) { for (int t = 0; t < data[0].length; t++) { System.out.print(data1[t] + "\t"); } System.out.print("\n"); } } public static void main(String[] args) throws Exception { String filename = "C:\\Users\\Sinan\\Desktop\\Tests\\Gamma\\DIM128_gamma_30mv.csv"; String output = "C:\\Users\\Sinan\\Desktop\\test_em_10_gamma_newwwww.csv"; HotDeck hd = new HotDeck(); hd.RunHotDeck(filename, output); } }
15,552
0.493634
0.486175
442
34.18552
26.445059
103
false
false
0
0
0
0
0
0
0.513575
false
false
8
1e84a26668b3dabe8d7621a72e93ab73f25368ed
13,864,154,479,000
f0280acaa007f9afab1585a74f79b55be19b0441
/app/src/main/java/com/sarahehabm/orangerx/business/MainBusiness.java
2fc0ef5676b6abcfc1172468b2810095605f9e56
[]
no_license
SarahEhabMostafa/OrangeRx
https://github.com/SarahEhabMostafa/OrangeRx
371ab98cf8a18798d5fc5a13674da2be7d3b63cb
cd697e10da0c306decd8a235923b87f177c8ec1a
refs/heads/master
2020-05-24T20:23:03.444000
2017-03-16T01:02:27
2017-03-16T01:02:27
84,878,130
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sarahehabm.orangerx.business; import com.sarahehabm.orangerx.model.LocationList; import com.sarahehabm.orangerx.model.User; import com.sarahehabm.orangerx.model.UserList; import rx.Observer; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by Sarah E. Mostafa on 12-Mar-17. */ public class MainBusiness { private Services services; public MainBusiness(Services services) { this.services = services; } public void getUser(final OnUserRetrievedListener userRetrievedListener) { services.getApi() .getUser() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<User>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { String errorMessage = e == null ? null : e.getLocalizedMessage(); userRetrievedListener.onUserRetrievedFailure(errorMessage); } @Override public void onNext(User user) { userRetrievedListener.onUserRetrievedSuccess(user); } }); } public void getUserList(final OnUserRetrievedListener userRetrievedListener) { services.getApi() .getUserList() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<UserList>(){ @Override public void onCompleted() { } @Override public void onError(Throwable e) { String errorMessage = e == null ? null : e.getLocalizedMessage(); userRetrievedListener.onUserListRetrievedFailure(errorMessage); } @Override public void onNext(UserList userList) { userRetrievedListener.onUserListRetrievedSuccess(userList); } }); } public void getLocationList(final OnLocationsRetrievedListener locationsRetrievedListener) { services.getApi() .getLocationList() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<LocationList>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { String errorMessage = e == null ? null : e.getLocalizedMessage(); locationsRetrievedListener.onLocationListRetrievedFailure(errorMessage); } @Override public void onNext(LocationList locationList) { locationsRetrievedListener.onLocationListRetrievedSuccess(locationList); } }); } }
UTF-8
Java
3,258
java
MainBusiness.java
Java
[ { "context": "mport rx.schedulers.Schedulers;\n\n/**\n * Created by Sarah E. Mostafa on 12-Mar-17.\n */\npublic class MainBusiness {\n ", "end": 321, "score": 0.999883234500885, "start": 305, "tag": "NAME", "value": "Sarah E. Mostafa" } ]
null
[]
package com.sarahehabm.orangerx.business; import com.sarahehabm.orangerx.model.LocationList; import com.sarahehabm.orangerx.model.User; import com.sarahehabm.orangerx.model.UserList; import rx.Observer; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by <NAME> on 12-Mar-17. */ public class MainBusiness { private Services services; public MainBusiness(Services services) { this.services = services; } public void getUser(final OnUserRetrievedListener userRetrievedListener) { services.getApi() .getUser() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<User>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { String errorMessage = e == null ? null : e.getLocalizedMessage(); userRetrievedListener.onUserRetrievedFailure(errorMessage); } @Override public void onNext(User user) { userRetrievedListener.onUserRetrievedSuccess(user); } }); } public void getUserList(final OnUserRetrievedListener userRetrievedListener) { services.getApi() .getUserList() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<UserList>(){ @Override public void onCompleted() { } @Override public void onError(Throwable e) { String errorMessage = e == null ? null : e.getLocalizedMessage(); userRetrievedListener.onUserListRetrievedFailure(errorMessage); } @Override public void onNext(UserList userList) { userRetrievedListener.onUserListRetrievedSuccess(userList); } }); } public void getLocationList(final OnLocationsRetrievedListener locationsRetrievedListener) { services.getApi() .getLocationList() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<LocationList>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { String errorMessage = e == null ? null : e.getLocalizedMessage(); locationsRetrievedListener.onLocationListRetrievedFailure(errorMessage); } @Override public void onNext(LocationList locationList) { locationsRetrievedListener.onLocationListRetrievedSuccess(locationList); } }); } }
3,248
0.538674
0.537446
93
34.032257
27.742073
96
false
false
0
0
0
0
0
0
0.225806
false
false
8
26e4c82685831d7bfaf94d791699f9512b60b6b8
2,164,663,569,347
3fe383525b2dcd3f9a405c5105a4562983c7f7fa
/mlod/src/main/java/wvw/utils/log/target/FileTarget.java
6a27d6773fd779e289d0ec4ae8102d5b9d5682de
[ "Apache-2.0" ]
permissive
william-vw/mlod
https://github.com/william-vw/mlod
7e013d999878a1fcd16e4add94e62626a16875a5
20d67f8790ef24527d2e0baff4b5dd053b5ab621
refs/heads/master
2023-07-25T12:35:00.658000
2022-03-02T16:03:55
2022-03-02T16:03:55
253,907,808
0
0
Apache-2.0
false
2023-07-23T11:15:08
2020-04-07T20:44:36
2022-03-02T15:11:20
2023-07-23T11:15:04
11,572
0
0
10
HTML
false
false
package wvw.utils.log.target; import java.io.File; import java.io.FileWriter; import java.io.IOException; import wvw.utils.log.format.Formatter; public class FileTarget extends FormattedLogTarget { // private int cnt = 0; // private int limit = 10; private FileWriter writer; public FileTarget(String path) { this(path, true); } public FileTarget(String path, boolean append) { createWriter(path, append); } public FileTarget(String path, Formatter formatter) { this(path, true, formatter); } public FileTarget(String path, boolean append, Formatter formatter) { super(formatter); createWriter(path, append); } private void createWriter(String path, boolean append) { try { writer = new FileWriter(new File(path), append); } catch (IOException e) { e.printStackTrace(); } } protected void out(String msg) { try { writer.write(msg + "\n"); // if (++cnt == limit) { writer.flush(); // cnt = 0; // } } catch (IOException e) { e.printStackTrace(); } } public void done() { try { writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
1,155
java
FileTarget.java
Java
[]
null
[]
package wvw.utils.log.target; import java.io.File; import java.io.FileWriter; import java.io.IOException; import wvw.utils.log.format.Formatter; public class FileTarget extends FormattedLogTarget { // private int cnt = 0; // private int limit = 10; private FileWriter writer; public FileTarget(String path) { this(path, true); } public FileTarget(String path, boolean append) { createWriter(path, append); } public FileTarget(String path, Formatter formatter) { this(path, true, formatter); } public FileTarget(String path, boolean append, Formatter formatter) { super(formatter); createWriter(path, append); } private void createWriter(String path, boolean append) { try { writer = new FileWriter(new File(path), append); } catch (IOException e) { e.printStackTrace(); } } protected void out(String msg) { try { writer.write(msg + "\n"); // if (++cnt == limit) { writer.flush(); // cnt = 0; // } } catch (IOException e) { e.printStackTrace(); } } public void done() { try { writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); } } }
1,155
0.662338
0.658874
67
16.253731
17.201477
70
false
false
0
0
0
0
0
0
1.656716
false
false
8
80a804132dec4b0a7b535b764495f2241c739864
38,431,367,392,969
e346b0875aa38f051fc4001eb77ab167c9031f4e
/src/main/java/com/netty/proj/NettyDemo/aio/AsyncTimeServerHandler.java
63092b74446a9edcd88621b2bde02bf6521e7f00
[]
no_license
edisongchen/NettyDemo
https://github.com/edisongchen/NettyDemo
e1628d3ecc3a8ac662c4fbbfcfd4cdeb602e2e00
d62dbd395bfc5b94a7325a64315dd50590e4fee5
refs/heads/master
2021-06-10T03:51:52.236000
2016-12-13T13:50:51
2016-12-13T13:50:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.netty.proj.NettyDemo.aio; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.channels.AsynchronousServerSocketChannel; import java.util.concurrent.CountDownLatch; /** * 忽略半包处理 * Created by ctg on 2016/11/8. */ public class AsyncTimeServerHandler implements Runnable { private int port; CountDownLatch latch; AsynchronousServerSocketChannel asynchronousServerSocketChannel ; public AsyncTimeServerHandler(int port){ this.port = port; try { asynchronousServerSocketChannel = AsynchronousServerSocketChannel.open(); asynchronousServerSocketChannel.bind(new InetSocketAddress(port)); System.out.println("The time server is start in port:" +port); } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { latch = new CountDownLatch(1);//这里是个demo,为了防止主线程退出 doAccept(); try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } } /** * 接受客户端的连接,由于是异步操作,可以传递一个CompletionHandler<AsynchronousSocketChannel,? super A> * 类型的handler实力接收accet操作成功的通知消息 */ private void doAccept() { asynchronousServerSocketChannel.accept(this,new AcceptCompletionHandler()); } }
UTF-8
Java
1,472
java
AsyncTimeServerHandler.java
Java
[ { "context": "rrent.CountDownLatch;\n\n/**\n * 忽略半包处理\n * Created by ctg on 2016/11/8.\n */\npublic class AsyncTimeServerHan", "end": 236, "score": 0.9996325969696045, "start": 233, "tag": "USERNAME", "value": "ctg" } ]
null
[]
package com.netty.proj.NettyDemo.aio; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.channels.AsynchronousServerSocketChannel; import java.util.concurrent.CountDownLatch; /** * 忽略半包处理 * Created by ctg on 2016/11/8. */ public class AsyncTimeServerHandler implements Runnable { private int port; CountDownLatch latch; AsynchronousServerSocketChannel asynchronousServerSocketChannel ; public AsyncTimeServerHandler(int port){ this.port = port; try { asynchronousServerSocketChannel = AsynchronousServerSocketChannel.open(); asynchronousServerSocketChannel.bind(new InetSocketAddress(port)); System.out.println("The time server is start in port:" +port); } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { latch = new CountDownLatch(1);//这里是个demo,为了防止主线程退出 doAccept(); try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } } /** * 接受客户端的连接,由于是异步操作,可以传递一个CompletionHandler<AsynchronousSocketChannel,? super A> * 类型的handler实力接收accet操作成功的通知消息 */ private void doAccept() { asynchronousServerSocketChannel.accept(this,new AcceptCompletionHandler()); } }
1,472
0.669617
0.663717
47
27.851065
25.430738
85
false
false
0
0
0
0
0
0
0.446809
false
false
8
cf93889a06864616804a9791fd9908a313bc64ee
2,954,937,544,527
fc160694094b89ab09e5c9a0f03db80437eabc93
/java-compute/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RoutersClient.java
790d676745f889f668619d2cc5dbd5c9840f10b5
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
googleapis/google-cloud-java
https://github.com/googleapis/google-cloud-java
4f4d97a145e0310db142ecbc3340ce3a2a444e5e
6e23c3a406e19af410a1a1dd0d0487329875040e
refs/heads/main
2023-09-04T09:09:02.481000
2023-08-31T20:45:11
2023-08-31T20:45:11
26,181,278
1,122
685
Apache-2.0
false
2023-09-13T21:21:23
2014-11-04T17:57:16
2023-09-13T01:26:53
2023-09-13T21:21:22
662,277
1,769
1,100
75
Java
false
false
/* * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.compute.v1; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.RoutersStub; import com.google.cloud.compute.v1.stub.RoutersStubSettings; import com.google.common.util.concurrent.MoreExecutors; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: The Routers API. * * <p>This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router response = routersClient.get(project, region, router); * } * }</pre> * * <p>Note: close() needs to be called on the RoutersClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * * <p>The surface of this class includes several types of Java methods for each of the API's * methods: * * <ol> * <li>A "flattened" method. With this type of method, the fields of the request type have been * converted into function parameters. It may be the case that not all fields are available as * parameters, and not every API method will have a flattened method entry point. * <li>A "request object" method. This type of method only takes one parameter, a request object, * which must be constructed before the call. Not every API method will have a request object * method. * <li>A "callable" method. This type of method takes no parameters and returns an immutable API * callable object, which can be used to initiate calls to the service. * </ol> * * <p>See the individual methods for example code. * * <p>Many parameters require resource names to be formatted in a particular way. To assist with * these names, this class includes a format method for each type of name, and additionally a parse * method to extract the individual identifiers contained within names that are returned. * * <p>This class can be customized by passing in a custom instance of RoutersSettings to create(). * For example: * * <p>To customize credentials: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * RoutersSettings routersSettings = * RoutersSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) * .build(); * RoutersClient routersClient = RoutersClient.create(routersSettings); * }</pre> * * <p>To customize the endpoint: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * RoutersSettings routersSettings = RoutersSettings.newBuilder().setEndpoint(myEndpoint).build(); * RoutersClient routersClient = RoutersClient.create(routersSettings); * }</pre> * * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class RoutersClient implements BackgroundResource { private final RoutersSettings settings; private final RoutersStub stub; /** Constructs an instance of RoutersClient with default settings. */ public static final RoutersClient create() throws IOException { return create(RoutersSettings.newBuilder().build()); } /** * Constructs an instance of RoutersClient, using the given settings. The channels are created * based on the settings passed in, or defaults for any settings that are not set. */ public static final RoutersClient create(RoutersSettings settings) throws IOException { return new RoutersClient(settings); } /** * Constructs an instance of RoutersClient, using the given stub for making calls. This is for * advanced usage - prefer using create(RoutersSettings). */ public static final RoutersClient create(RoutersStub stub) { return new RoutersClient(stub); } /** * Constructs an instance of RoutersClient, using the given settings. This is protected so that it * is easy to make a subclass, but otherwise, the static factory methods should be preferred. */ protected RoutersClient(RoutersSettings settings) throws IOException { this.settings = settings; this.stub = ((RoutersStubSettings) settings.getStubSettings()).createStub(); } protected RoutersClient(RoutersStub stub) { this.settings = null; this.stub = stub; } public final RoutersSettings getSettings() { return settings; } public RoutersStub getStub() { return stub; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * for (Map.Entry<String, RoutersScopedList> element : * routersClient.aggregatedList(project).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param project Project ID for this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AggregatedListPagedResponse aggregatedList(String project) { AggregatedListRoutersRequest request = AggregatedListRoutersRequest.newBuilder().setProject(project).build(); return aggregatedList(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * AggregatedListRoutersRequest request = * AggregatedListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setIncludeAllScopes(true) * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setReturnPartialSuccess(true) * .build(); * for (Map.Entry<String, RoutersScopedList> element : * routersClient.aggregatedList(request).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AggregatedListPagedResponse aggregatedList(AggregatedListRoutersRequest request) { return aggregatedListPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * AggregatedListRoutersRequest request = * AggregatedListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setIncludeAllScopes(true) * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setReturnPartialSuccess(true) * .build(); * ApiFuture<Map.Entry<String, RoutersScopedList>> future = * routersClient.aggregatedListPagedCallable().futureCall(request); * // Do something. * for (Map.Entry<String, RoutersScopedList> element : future.get().iterateAll()) { * // doThingsWith(element); * } * } * }</pre> */ public final UnaryCallable<AggregatedListRoutersRequest, AggregatedListPagedResponse> aggregatedListPagedCallable() { return stub.aggregatedListPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * AggregatedListRoutersRequest request = * AggregatedListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setIncludeAllScopes(true) * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setReturnPartialSuccess(true) * .build(); * while (true) { * RouterAggregatedList response = routersClient.aggregatedListCallable().call(request); * for (Map.Entry<String, RoutersScopedList> element : response.getItemsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); * if (!Strings.isNullOrEmpty(nextPageToken)) { * request = request.toBuilder().setPageToken(nextPageToken).build(); * } else { * break; * } * } * } * }</pre> */ public final UnaryCallable<AggregatedListRoutersRequest, RouterAggregatedList> aggregatedListCallable() { return stub.aggregatedListCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Operation response = routersClient.deleteAsync(project, region, router).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> deleteAsync( String project, String region, String router) { DeleteRouterRequest request = DeleteRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return deleteAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * DeleteRouterRequest request = * DeleteRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .build(); * Operation response = routersClient.deleteAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> deleteAsync(DeleteRouterRequest request) { return deleteOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * DeleteRouterRequest request = * DeleteRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .build(); * OperationFuture<Operation, Operation> future = * routersClient.deleteOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<DeleteRouterRequest, Operation, Operation> deleteOperationCallable() { return stub.deleteOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * DeleteRouterRequest request = * DeleteRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .build(); * ApiFuture<Operation> future = routersClient.deleteCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<DeleteRouterRequest, Operation> deleteCallable() { return stub.deleteCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router response = routersClient.get(project, region, router); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to return. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Router get(String project, String region, String router) { GetRouterRequest request = GetRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return get(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterRequest request = * GetRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * Router response = routersClient.get(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Router get(GetRouterRequest request) { return getCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterRequest request = * GetRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * ApiFuture<Router> future = routersClient.getCallable().futureCall(request); * // Do something. * Router response = future.get(); * } * }</pre> */ public final UnaryCallable<GetRouterRequest, Router> getCallable() { return stub.getCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * for (VmEndpointNatMappings element : * routersClient.getNatMappingInfo(project, region, router).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to query for Nat Mapping information of VM endpoints. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final GetNatMappingInfoPagedResponse getNatMappingInfo( String project, String region, String router) { GetNatMappingInfoRoutersRequest request = GetNatMappingInfoRoutersRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return getNatMappingInfo(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetNatMappingInfoRoutersRequest request = * GetNatMappingInfoRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setNatName("natName1727733580") * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .setRouter("router-925132983") * .build(); * for (VmEndpointNatMappings element : routersClient.getNatMappingInfo(request).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final GetNatMappingInfoPagedResponse getNatMappingInfo( GetNatMappingInfoRoutersRequest request) { return getNatMappingInfoPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetNatMappingInfoRoutersRequest request = * GetNatMappingInfoRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setNatName("natName1727733580") * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .setRouter("router-925132983") * .build(); * ApiFuture<VmEndpointNatMappings> future = * routersClient.getNatMappingInfoPagedCallable().futureCall(request); * // Do something. * for (VmEndpointNatMappings element : future.get().iterateAll()) { * // doThingsWith(element); * } * } * }</pre> */ public final UnaryCallable<GetNatMappingInfoRoutersRequest, GetNatMappingInfoPagedResponse> getNatMappingInfoPagedCallable() { return stub.getNatMappingInfoPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetNatMappingInfoRoutersRequest request = * GetNatMappingInfoRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setNatName("natName1727733580") * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .setRouter("router-925132983") * .build(); * while (true) { * VmEndpointNatMappingsList response = * routersClient.getNatMappingInfoCallable().call(request); * for (VmEndpointNatMappings element : response.getResultList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); * if (!Strings.isNullOrEmpty(nextPageToken)) { * request = request.toBuilder().setPageToken(nextPageToken).build(); * } else { * break; * } * } * } * }</pre> */ public final UnaryCallable<GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList> getNatMappingInfoCallable() { return stub.getNatMappingInfoCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime information of the specified router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * RouterStatusResponse response = routersClient.getRouterStatus(project, region, router); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to query. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RouterStatusResponse getRouterStatus(String project, String region, String router) { GetRouterStatusRouterRequest request = GetRouterStatusRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return getRouterStatus(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime information of the specified router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterStatusRouterRequest request = * GetRouterStatusRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * RouterStatusResponse response = routersClient.getRouterStatus(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RouterStatusResponse getRouterStatus(GetRouterStatusRouterRequest request) { return getRouterStatusCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime information of the specified router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterStatusRouterRequest request = * GetRouterStatusRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * ApiFuture<RouterStatusResponse> future = * routersClient.getRouterStatusCallable().futureCall(request); * // Do something. * RouterStatusResponse response = future.get(); * } * }</pre> */ public final UnaryCallable<GetRouterStatusRouterRequest, RouterStatusResponse> getRouterStatusCallable() { return stub.getRouterStatusCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * Router routerResource = Router.newBuilder().build(); * Operation response = routersClient.insertAsync(project, region, routerResource).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> insertAsync( String project, String region, Router routerResource) { InsertRouterRequest request = InsertRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouterResource(routerResource) .build(); return insertAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * InsertRouterRequest request = * InsertRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouterResource(Router.newBuilder().build()) * .build(); * Operation response = routersClient.insertAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> insertAsync(InsertRouterRequest request) { return insertOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * InsertRouterRequest request = * InsertRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouterResource(Router.newBuilder().build()) * .build(); * OperationFuture<Operation, Operation> future = * routersClient.insertOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<InsertRouterRequest, Operation, Operation> insertOperationCallable() { return stub.insertOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * InsertRouterRequest request = * InsertRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<Operation> future = routersClient.insertCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<InsertRouterRequest, Operation> insertCallable() { return stub.insertCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * for (Router element : routersClient.list(project, region).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListPagedResponse list(String project, String region) { ListRoutersRequest request = ListRoutersRequest.newBuilder().setProject(project).setRegion(region).build(); return list(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * ListRoutersRequest request = * ListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .build(); * for (Router element : routersClient.list(request).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListPagedResponse list(ListRoutersRequest request) { return listPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * ListRoutersRequest request = * ListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .build(); * ApiFuture<Router> future = routersClient.listPagedCallable().futureCall(request); * // Do something. * for (Router element : future.get().iterateAll()) { * // doThingsWith(element); * } * } * }</pre> */ public final UnaryCallable<ListRoutersRequest, ListPagedResponse> listPagedCallable() { return stub.listPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * ListRoutersRequest request = * ListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .build(); * while (true) { * RouterList response = routersClient.listCallable().call(request); * for (Router element : response.getItemsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); * if (!Strings.isNullOrEmpty(nextPageToken)) { * request = request.toBuilder().setPageToken(nextPageToken).build(); * } else { * break; * } * } * } * }</pre> */ public final UnaryCallable<ListRoutersRequest, RouterList> listCallable() { return stub.listCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router routerResource = Router.newBuilder().build(); * Operation response = routersClient.patchAsync(project, region, router, routerResource).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to patch. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> patchAsync( String project, String region, String router, Router routerResource) { PatchRouterRequest request = PatchRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .setRouterResource(routerResource) .build(); return patchAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PatchRouterRequest request = * PatchRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * Operation response = routersClient.patchAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> patchAsync(PatchRouterRequest request) { return patchOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PatchRouterRequest request = * PatchRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * OperationFuture<Operation, Operation> future = * routersClient.patchOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<PatchRouterRequest, Operation, Operation> patchOperationCallable() { return stub.patchOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PatchRouterRequest request = * PatchRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<Operation> future = routersClient.patchCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<PatchRouterRequest, Operation> patchCallable() { return stub.patchCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Preview fields auto-generated during router create and update operations. Calling this method * does NOT create or update the router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router routerResource = Router.newBuilder().build(); * RoutersPreviewResponse response = * routersClient.preview(project, region, router, routerResource); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to query. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RoutersPreviewResponse preview( String project, String region, String router, Router routerResource) { PreviewRouterRequest request = PreviewRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .setRouterResource(routerResource) .build(); return preview(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Preview fields auto-generated during router create and update operations. Calling this method * does NOT create or update the router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PreviewRouterRequest request = * PreviewRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * RoutersPreviewResponse response = routersClient.preview(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RoutersPreviewResponse preview(PreviewRouterRequest request) { return previewCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Preview fields auto-generated during router create and update operations. Calling this method * does NOT create or update the router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PreviewRouterRequest request = * PreviewRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<RoutersPreviewResponse> future = * routersClient.previewCallable().futureCall(request); * // Do something. * RoutersPreviewResponse response = future.get(); * } * }</pre> */ public final UnaryCallable<PreviewRouterRequest, RoutersPreviewResponse> previewCallable() { return stub.previewCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router routerResource = Router.newBuilder().build(); * Operation response = routersClient.updateAsync(project, region, router, routerResource).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to update. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> updateAsync( String project, String region, String router, Router routerResource) { UpdateRouterRequest request = UpdateRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .setRouterResource(routerResource) .build(); return updateAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * UpdateRouterRequest request = * UpdateRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * Operation response = routersClient.updateAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> updateAsync(UpdateRouterRequest request) { return updateOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * UpdateRouterRequest request = * UpdateRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * OperationFuture<Operation, Operation> future = * routersClient.updateOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<UpdateRouterRequest, Operation, Operation> updateOperationCallable() { return stub.updateOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * UpdateRouterRequest request = * UpdateRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<Operation> future = routersClient.updateCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<UpdateRouterRequest, Operation> updateCallable() { return stub.updateCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class AggregatedListPagedResponse extends AbstractPagedListResponse< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>, AggregatedListPage, AggregatedListFixedSizeCollection> { public static ApiFuture<AggregatedListPagedResponse> createAsync( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, ApiFuture<RouterAggregatedList> futureResponse) { ApiFuture<AggregatedListPage> futurePage = AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new AggregatedListPagedResponse(input), MoreExecutors.directExecutor()); } private AggregatedListPagedResponse(AggregatedListPage page) { super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); } } public static class AggregatedListPage extends AbstractPage< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>, AggregatedListPage> { private AggregatedListPage( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, RouterAggregatedList response) { super(context, response); } private static AggregatedListPage createEmptyPage() { return new AggregatedListPage(null, null); } @Override protected AggregatedListPage createPage( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, RouterAggregatedList response) { return new AggregatedListPage(context, response); } @Override public ApiFuture<AggregatedListPage> createPageAsync( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, ApiFuture<RouterAggregatedList> futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class AggregatedListFixedSizeCollection extends AbstractFixedSizeCollection< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>, AggregatedListPage, AggregatedListFixedSizeCollection> { private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { super(pages, collectionSize); } private static AggregatedListFixedSizeCollection createEmptyCollection() { return new AggregatedListFixedSizeCollection(null, 0); } @Override protected AggregatedListFixedSizeCollection createCollection( List<AggregatedListPage> pages, int collectionSize) { return new AggregatedListFixedSizeCollection(pages, collectionSize); } } public static class GetNatMappingInfoPagedResponse extends AbstractPagedListResponse< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings, GetNatMappingInfoPage, GetNatMappingInfoFixedSizeCollection> { public static ApiFuture<GetNatMappingInfoPagedResponse> createAsync( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, ApiFuture<VmEndpointNatMappingsList> futureResponse) { ApiFuture<GetNatMappingInfoPage> futurePage = GetNatMappingInfoPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new GetNatMappingInfoPagedResponse(input), MoreExecutors.directExecutor()); } private GetNatMappingInfoPagedResponse(GetNatMappingInfoPage page) { super(page, GetNatMappingInfoFixedSizeCollection.createEmptyCollection()); } } public static class GetNatMappingInfoPage extends AbstractPage< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings, GetNatMappingInfoPage> { private GetNatMappingInfoPage( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, VmEndpointNatMappingsList response) { super(context, response); } private static GetNatMappingInfoPage createEmptyPage() { return new GetNatMappingInfoPage(null, null); } @Override protected GetNatMappingInfoPage createPage( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, VmEndpointNatMappingsList response) { return new GetNatMappingInfoPage(context, response); } @Override public ApiFuture<GetNatMappingInfoPage> createPageAsync( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, ApiFuture<VmEndpointNatMappingsList> futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class GetNatMappingInfoFixedSizeCollection extends AbstractFixedSizeCollection< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings, GetNatMappingInfoPage, GetNatMappingInfoFixedSizeCollection> { private GetNatMappingInfoFixedSizeCollection( List<GetNatMappingInfoPage> pages, int collectionSize) { super(pages, collectionSize); } private static GetNatMappingInfoFixedSizeCollection createEmptyCollection() { return new GetNatMappingInfoFixedSizeCollection(null, 0); } @Override protected GetNatMappingInfoFixedSizeCollection createCollection( List<GetNatMappingInfoPage> pages, int collectionSize) { return new GetNatMappingInfoFixedSizeCollection(pages, collectionSize); } } public static class ListPagedResponse extends AbstractPagedListResponse< ListRoutersRequest, RouterList, Router, ListPage, ListFixedSizeCollection> { public static ApiFuture<ListPagedResponse> createAsync( PageContext<ListRoutersRequest, RouterList, Router> context, ApiFuture<RouterList> futureResponse) { ApiFuture<ListPage> futurePage = ListPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); } private ListPagedResponse(ListPage page) { super(page, ListFixedSizeCollection.createEmptyCollection()); } } public static class ListPage extends AbstractPage<ListRoutersRequest, RouterList, Router, ListPage> { private ListPage( PageContext<ListRoutersRequest, RouterList, Router> context, RouterList response) { super(context, response); } private static ListPage createEmptyPage() { return new ListPage(null, null); } @Override protected ListPage createPage( PageContext<ListRoutersRequest, RouterList, Router> context, RouterList response) { return new ListPage(context, response); } @Override public ApiFuture<ListPage> createPageAsync( PageContext<ListRoutersRequest, RouterList, Router> context, ApiFuture<RouterList> futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListFixedSizeCollection extends AbstractFixedSizeCollection< ListRoutersRequest, RouterList, Router, ListPage, ListFixedSizeCollection> { private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { super(pages, collectionSize); } private static ListFixedSizeCollection createEmptyCollection() { return new ListFixedSizeCollection(null, 0); } @Override protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { return new ListFixedSizeCollection(pages, collectionSize); } } }
UTF-8
Java
72,057
java
RoutersClient.java
Java
[ { "context": "rderBy-1207110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"project-309310695\")", "end": 10749, "score": 0.886508584022522, "start": 10731, "tag": "PASSWORD", "value": "pageToken873572522" }, { "context": "rderBy-1207110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"proje", "end": 12314, "score": 0.4932440221309662, "start": 12310, "tag": "KEY", "value": "page" }, { "context": "07110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"project-309310695\")", "end": 12328, "score": 0.673719584941864, "start": 12319, "tag": "PASSWORD", "value": "873572522" }, { "context": "rderBy-1207110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"project-309310695\")", "end": 28367, "score": 0.8191052079200745, "start": 28349, "tag": "PASSWORD", "value": "pageToken873572522" }, { "context": "0587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"project-3093106", "end": 41458, "score": 0.5403445959091187, "start": 41457, "tag": "PASSWORD", "value": "7" }, { "context": "rderBy-1207110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"project-30", "end": 42979, "score": 0.5874493718147278, "start": 42970, "tag": "KEY", "value": "pageToken" }, { "context": "07110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"project-309310695\")", "end": 42988, "score": 0.5951055884361267, "start": 42979, "tag": "PASSWORD", "value": "873572522" }, { "context": "rderBy-1207110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"proje", "end": 44442, "score": 0.42248642444610596, "start": 44438, "tag": "KEY", "value": "page" }, { "context": "07110587\")\n * .setPageToken(\"pageToken873572522\")\n * .setProject(\"project-309310695\")", "end": 44456, "score": 0.7883618474006653, "start": 44447, "tag": "PASSWORD", "value": "873572522" } ]
null
[]
/* * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.compute.v1; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.compute.v1.stub.RoutersStub; import com.google.cloud.compute.v1.stub.RoutersStubSettings; import com.google.common.util.concurrent.MoreExecutors; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: The Routers API. * * <p>This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router response = routersClient.get(project, region, router); * } * }</pre> * * <p>Note: close() needs to be called on the RoutersClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * * <p>The surface of this class includes several types of Java methods for each of the API's * methods: * * <ol> * <li>A "flattened" method. With this type of method, the fields of the request type have been * converted into function parameters. It may be the case that not all fields are available as * parameters, and not every API method will have a flattened method entry point. * <li>A "request object" method. This type of method only takes one parameter, a request object, * which must be constructed before the call. Not every API method will have a request object * method. * <li>A "callable" method. This type of method takes no parameters and returns an immutable API * callable object, which can be used to initiate calls to the service. * </ol> * * <p>See the individual methods for example code. * * <p>Many parameters require resource names to be formatted in a particular way. To assist with * these names, this class includes a format method for each type of name, and additionally a parse * method to extract the individual identifiers contained within names that are returned. * * <p>This class can be customized by passing in a custom instance of RoutersSettings to create(). * For example: * * <p>To customize credentials: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * RoutersSettings routersSettings = * RoutersSettings.newBuilder() * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) * .build(); * RoutersClient routersClient = RoutersClient.create(routersSettings); * }</pre> * * <p>To customize the endpoint: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * RoutersSettings routersSettings = RoutersSettings.newBuilder().setEndpoint(myEndpoint).build(); * RoutersClient routersClient = RoutersClient.create(routersSettings); * }</pre> * * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class RoutersClient implements BackgroundResource { private final RoutersSettings settings; private final RoutersStub stub; /** Constructs an instance of RoutersClient with default settings. */ public static final RoutersClient create() throws IOException { return create(RoutersSettings.newBuilder().build()); } /** * Constructs an instance of RoutersClient, using the given settings. The channels are created * based on the settings passed in, or defaults for any settings that are not set. */ public static final RoutersClient create(RoutersSettings settings) throws IOException { return new RoutersClient(settings); } /** * Constructs an instance of RoutersClient, using the given stub for making calls. This is for * advanced usage - prefer using create(RoutersSettings). */ public static final RoutersClient create(RoutersStub stub) { return new RoutersClient(stub); } /** * Constructs an instance of RoutersClient, using the given settings. This is protected so that it * is easy to make a subclass, but otherwise, the static factory methods should be preferred. */ protected RoutersClient(RoutersSettings settings) throws IOException { this.settings = settings; this.stub = ((RoutersStubSettings) settings.getStubSettings()).createStub(); } protected RoutersClient(RoutersStub stub) { this.settings = null; this.stub = stub; } public final RoutersSettings getSettings() { return settings; } public RoutersStub getStub() { return stub; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * for (Map.Entry<String, RoutersScopedList> element : * routersClient.aggregatedList(project).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param project Project ID for this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AggregatedListPagedResponse aggregatedList(String project) { AggregatedListRoutersRequest request = AggregatedListRoutersRequest.newBuilder().setProject(project).build(); return aggregatedList(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * AggregatedListRoutersRequest request = * AggregatedListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setIncludeAllScopes(true) * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setReturnPartialSuccess(true) * .build(); * for (Map.Entry<String, RoutersScopedList> element : * routersClient.aggregatedList(request).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AggregatedListPagedResponse aggregatedList(AggregatedListRoutersRequest request) { return aggregatedListPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * AggregatedListRoutersRequest request = * AggregatedListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setIncludeAllScopes(true) * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("<PASSWORD>") * .setProject("project-309310695") * .setReturnPartialSuccess(true) * .build(); * ApiFuture<Map.Entry<String, RoutersScopedList>> future = * routersClient.aggregatedListPagedCallable().futureCall(request); * // Do something. * for (Map.Entry<String, RoutersScopedList> element : future.get().iterateAll()) { * // doThingsWith(element); * } * } * }</pre> */ public final UnaryCallable<AggregatedListRoutersRequest, AggregatedListPagedResponse> aggregatedListPagedCallable() { return stub.aggregatedListPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves an aggregated list of routers. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * AggregatedListRoutersRequest request = * AggregatedListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setIncludeAllScopes(true) * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken<PASSWORD>") * .setProject("project-309310695") * .setReturnPartialSuccess(true) * .build(); * while (true) { * RouterAggregatedList response = routersClient.aggregatedListCallable().call(request); * for (Map.Entry<String, RoutersScopedList> element : response.getItemsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); * if (!Strings.isNullOrEmpty(nextPageToken)) { * request = request.toBuilder().setPageToken(nextPageToken).build(); * } else { * break; * } * } * } * }</pre> */ public final UnaryCallable<AggregatedListRoutersRequest, RouterAggregatedList> aggregatedListCallable() { return stub.aggregatedListCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Operation response = routersClient.deleteAsync(project, region, router).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> deleteAsync( String project, String region, String router) { DeleteRouterRequest request = DeleteRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return deleteAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * DeleteRouterRequest request = * DeleteRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .build(); * Operation response = routersClient.deleteAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> deleteAsync(DeleteRouterRequest request) { return deleteOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * DeleteRouterRequest request = * DeleteRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .build(); * OperationFuture<Operation, Operation> future = * routersClient.deleteOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<DeleteRouterRequest, Operation, Operation> deleteOperationCallable() { return stub.deleteOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * DeleteRouterRequest request = * DeleteRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .build(); * ApiFuture<Operation> future = routersClient.deleteCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<DeleteRouterRequest, Operation> deleteCallable() { return stub.deleteCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router response = routersClient.get(project, region, router); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to return. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Router get(String project, String region, String router) { GetRouterRequest request = GetRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return get(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterRequest request = * GetRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * Router response = routersClient.get(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Router get(GetRouterRequest request) { return getCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified Router resource. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterRequest request = * GetRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * ApiFuture<Router> future = routersClient.getCallable().futureCall(request); * // Do something. * Router response = future.get(); * } * }</pre> */ public final UnaryCallable<GetRouterRequest, Router> getCallable() { return stub.getCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * for (VmEndpointNatMappings element : * routersClient.getNatMappingInfo(project, region, router).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to query for Nat Mapping information of VM endpoints. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final GetNatMappingInfoPagedResponse getNatMappingInfo( String project, String region, String router) { GetNatMappingInfoRoutersRequest request = GetNatMappingInfoRoutersRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return getNatMappingInfo(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetNatMappingInfoRoutersRequest request = * GetNatMappingInfoRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setNatName("natName1727733580") * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .setRouter("router-925132983") * .build(); * for (VmEndpointNatMappings element : routersClient.getNatMappingInfo(request).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final GetNatMappingInfoPagedResponse getNatMappingInfo( GetNatMappingInfoRoutersRequest request) { return getNatMappingInfoPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetNatMappingInfoRoutersRequest request = * GetNatMappingInfoRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setNatName("natName1727733580") * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .setRouter("router-925132983") * .build(); * ApiFuture<VmEndpointNatMappings> future = * routersClient.getNatMappingInfoPagedCallable().futureCall(request); * // Do something. * for (VmEndpointNatMappings element : future.get().iterateAll()) { * // doThingsWith(element); * } * } * }</pre> */ public final UnaryCallable<GetNatMappingInfoRoutersRequest, GetNatMappingInfoPagedResponse> getNatMappingInfoPagedCallable() { return stub.getNatMappingInfoPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime Nat mapping information of VM endpoints. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetNatMappingInfoRoutersRequest request = * GetNatMappingInfoRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setNatName("natName1727733580") * .setOrderBy("orderBy-1207110587") * .setPageToken("<PASSWORD>") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .setRouter("router-925132983") * .build(); * while (true) { * VmEndpointNatMappingsList response = * routersClient.getNatMappingInfoCallable().call(request); * for (VmEndpointNatMappings element : response.getResultList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); * if (!Strings.isNullOrEmpty(nextPageToken)) { * request = request.toBuilder().setPageToken(nextPageToken).build(); * } else { * break; * } * } * } * }</pre> */ public final UnaryCallable<GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList> getNatMappingInfoCallable() { return stub.getNatMappingInfoCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime information of the specified router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * RouterStatusResponse response = routersClient.getRouterStatus(project, region, router); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to query. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RouterStatusResponse getRouterStatus(String project, String region, String router) { GetRouterStatusRouterRequest request = GetRouterStatusRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .build(); return getRouterStatus(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime information of the specified router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterStatusRouterRequest request = * GetRouterStatusRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * RouterStatusResponse response = routersClient.getRouterStatus(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RouterStatusResponse getRouterStatus(GetRouterStatusRouterRequest request) { return getRouterStatusCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves runtime information of the specified router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * GetRouterStatusRouterRequest request = * GetRouterStatusRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .build(); * ApiFuture<RouterStatusResponse> future = * routersClient.getRouterStatusCallable().futureCall(request); * // Do something. * RouterStatusResponse response = future.get(); * } * }</pre> */ public final UnaryCallable<GetRouterStatusRouterRequest, RouterStatusResponse> getRouterStatusCallable() { return stub.getRouterStatusCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * Router routerResource = Router.newBuilder().build(); * Operation response = routersClient.insertAsync(project, region, routerResource).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> insertAsync( String project, String region, Router routerResource) { InsertRouterRequest request = InsertRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouterResource(routerResource) .build(); return insertAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * InsertRouterRequest request = * InsertRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouterResource(Router.newBuilder().build()) * .build(); * Operation response = routersClient.insertAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> insertAsync(InsertRouterRequest request) { return insertOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * InsertRouterRequest request = * InsertRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouterResource(Router.newBuilder().build()) * .build(); * OperationFuture<Operation, Operation> future = * routersClient.insertOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<InsertRouterRequest, Operation, Operation> insertOperationCallable() { return stub.insertOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a Router resource in the specified project and region using the data included in the * request. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * InsertRouterRequest request = * InsertRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<Operation> future = routersClient.insertCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<InsertRouterRequest, Operation> insertCallable() { return stub.insertCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * for (Router element : routersClient.list(project, region).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListPagedResponse list(String project, String region) { ListRoutersRequest request = ListRoutersRequest.newBuilder().setProject(project).setRegion(region).build(); return list(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * ListRoutersRequest request = * ListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken873572522") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .build(); * for (Router element : routersClient.list(request).iterateAll()) { * // doThingsWith(element); * } * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListPagedResponse list(ListRoutersRequest request) { return listPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * ListRoutersRequest request = * ListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken<PASSWORD>") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .build(); * ApiFuture<Router> future = routersClient.listPagedCallable().futureCall(request); * // Do something. * for (Router element : future.get().iterateAll()) { * // doThingsWith(element); * } * } * }</pre> */ public final UnaryCallable<ListRoutersRequest, ListPagedResponse> listPagedCallable() { return stub.listPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a list of Router resources available to the specified project. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * ListRoutersRequest request = * ListRoutersRequest.newBuilder() * .setFilter("filter-1274492040") * .setMaxResults(1128457243) * .setOrderBy("orderBy-1207110587") * .setPageToken("pageToken<PASSWORD>") * .setProject("project-309310695") * .setRegion("region-934795532") * .setReturnPartialSuccess(true) * .build(); * while (true) { * RouterList response = routersClient.listCallable().call(request); * for (Router element : response.getItemsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); * if (!Strings.isNullOrEmpty(nextPageToken)) { * request = request.toBuilder().setPageToken(nextPageToken).build(); * } else { * break; * } * } * } * }</pre> */ public final UnaryCallable<ListRoutersRequest, RouterList> listCallable() { return stub.listCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router routerResource = Router.newBuilder().build(); * Operation response = routersClient.patchAsync(project, region, router, routerResource).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to patch. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> patchAsync( String project, String region, String router, Router routerResource) { PatchRouterRequest request = PatchRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .setRouterResource(routerResource) .build(); return patchAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PatchRouterRequest request = * PatchRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * Operation response = routersClient.patchAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> patchAsync(PatchRouterRequest request) { return patchOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PatchRouterRequest request = * PatchRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * OperationFuture<Operation, Operation> future = * routersClient.patchOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<PatchRouterRequest, Operation, Operation> patchOperationCallable() { return stub.patchOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Patches the specified Router resource with the data included in the request. This method * supports PATCH semantics and uses JSON merge patch format and processing rules. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PatchRouterRequest request = * PatchRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<Operation> future = routersClient.patchCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<PatchRouterRequest, Operation> patchCallable() { return stub.patchCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Preview fields auto-generated during router create and update operations. Calling this method * does NOT create or update the router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router routerResource = Router.newBuilder().build(); * RoutersPreviewResponse response = * routersClient.preview(project, region, router, routerResource); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to query. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RoutersPreviewResponse preview( String project, String region, String router, Router routerResource) { PreviewRouterRequest request = PreviewRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .setRouterResource(routerResource) .build(); return preview(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Preview fields auto-generated during router create and update operations. Calling this method * does NOT create or update the router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PreviewRouterRequest request = * PreviewRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * RoutersPreviewResponse response = routersClient.preview(request); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final RoutersPreviewResponse preview(PreviewRouterRequest request) { return previewCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Preview fields auto-generated during router create and update operations. Calling this method * does NOT create or update the router. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * PreviewRouterRequest request = * PreviewRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<RoutersPreviewResponse> future = * routersClient.previewCallable().futureCall(request); * // Do something. * RoutersPreviewResponse response = future.get(); * } * }</pre> */ public final UnaryCallable<PreviewRouterRequest, RoutersPreviewResponse> previewCallable() { return stub.previewCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * String project = "project-309310695"; * String region = "region-934795532"; * String router = "router-925132983"; * Router routerResource = Router.newBuilder().build(); * Operation response = routersClient.updateAsync(project, region, router, routerResource).get(); * } * }</pre> * * @param project Project ID for this request. * @param region Name of the region for this request. * @param router Name of the Router resource to update. * @param routerResource The body resource for this request * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture<Operation, Operation> updateAsync( String project, String region, String router, Router routerResource) { UpdateRouterRequest request = UpdateRouterRequest.newBuilder() .setProject(project) .setRegion(region) .setRouter(router) .setRouterResource(routerResource) .build(); return updateAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * UpdateRouterRequest request = * UpdateRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * Operation response = routersClient.updateAsync(request).get(); * } * }</pre> * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Operation, Operation> updateAsync(UpdateRouterRequest request) { return updateOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * UpdateRouterRequest request = * UpdateRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * OperationFuture<Operation, Operation> future = * routersClient.updateOperationCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final OperationCallable<UpdateRouterRequest, Operation, Operation> updateOperationCallable() { return stub.updateOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified Router resource with the data included in the request. This method * conforms to PUT semantics, which requests that the state of the target resource be created or * replaced with the state defined by the representation enclosed in the request message payload. * * <p>Sample code: * * <pre>{@code * // This snippet has been automatically generated and should be regarded as a code template only. * // It will require modifications to work: * // - It may require correct/in-range values for request initialization. * // - It may require specifying regional endpoints when creating the service client as shown in * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library * try (RoutersClient routersClient = RoutersClient.create()) { * UpdateRouterRequest request = * UpdateRouterRequest.newBuilder() * .setProject("project-309310695") * .setRegion("region-934795532") * .setRequestId("requestId693933066") * .setRouter("router-925132983") * .setRouterResource(Router.newBuilder().build()) * .build(); * ApiFuture<Operation> future = routersClient.updateCallable().futureCall(request); * // Do something. * Operation response = future.get(); * } * }</pre> */ public final UnaryCallable<UpdateRouterRequest, Operation> updateCallable() { return stub.updateCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class AggregatedListPagedResponse extends AbstractPagedListResponse< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>, AggregatedListPage, AggregatedListFixedSizeCollection> { public static ApiFuture<AggregatedListPagedResponse> createAsync( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, ApiFuture<RouterAggregatedList> futureResponse) { ApiFuture<AggregatedListPage> futurePage = AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new AggregatedListPagedResponse(input), MoreExecutors.directExecutor()); } private AggregatedListPagedResponse(AggregatedListPage page) { super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); } } public static class AggregatedListPage extends AbstractPage< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>, AggregatedListPage> { private AggregatedListPage( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, RouterAggregatedList response) { super(context, response); } private static AggregatedListPage createEmptyPage() { return new AggregatedListPage(null, null); } @Override protected AggregatedListPage createPage( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, RouterAggregatedList response) { return new AggregatedListPage(context, response); } @Override public ApiFuture<AggregatedListPage> createPageAsync( PageContext< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>> context, ApiFuture<RouterAggregatedList> futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class AggregatedListFixedSizeCollection extends AbstractFixedSizeCollection< AggregatedListRoutersRequest, RouterAggregatedList, Map.Entry<String, RoutersScopedList>, AggregatedListPage, AggregatedListFixedSizeCollection> { private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { super(pages, collectionSize); } private static AggregatedListFixedSizeCollection createEmptyCollection() { return new AggregatedListFixedSizeCollection(null, 0); } @Override protected AggregatedListFixedSizeCollection createCollection( List<AggregatedListPage> pages, int collectionSize) { return new AggregatedListFixedSizeCollection(pages, collectionSize); } } public static class GetNatMappingInfoPagedResponse extends AbstractPagedListResponse< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings, GetNatMappingInfoPage, GetNatMappingInfoFixedSizeCollection> { public static ApiFuture<GetNatMappingInfoPagedResponse> createAsync( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, ApiFuture<VmEndpointNatMappingsList> futureResponse) { ApiFuture<GetNatMappingInfoPage> futurePage = GetNatMappingInfoPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new GetNatMappingInfoPagedResponse(input), MoreExecutors.directExecutor()); } private GetNatMappingInfoPagedResponse(GetNatMappingInfoPage page) { super(page, GetNatMappingInfoFixedSizeCollection.createEmptyCollection()); } } public static class GetNatMappingInfoPage extends AbstractPage< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings, GetNatMappingInfoPage> { private GetNatMappingInfoPage( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, VmEndpointNatMappingsList response) { super(context, response); } private static GetNatMappingInfoPage createEmptyPage() { return new GetNatMappingInfoPage(null, null); } @Override protected GetNatMappingInfoPage createPage( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, VmEndpointNatMappingsList response) { return new GetNatMappingInfoPage(context, response); } @Override public ApiFuture<GetNatMappingInfoPage> createPageAsync( PageContext< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings> context, ApiFuture<VmEndpointNatMappingsList> futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class GetNatMappingInfoFixedSizeCollection extends AbstractFixedSizeCollection< GetNatMappingInfoRoutersRequest, VmEndpointNatMappingsList, VmEndpointNatMappings, GetNatMappingInfoPage, GetNatMappingInfoFixedSizeCollection> { private GetNatMappingInfoFixedSizeCollection( List<GetNatMappingInfoPage> pages, int collectionSize) { super(pages, collectionSize); } private static GetNatMappingInfoFixedSizeCollection createEmptyCollection() { return new GetNatMappingInfoFixedSizeCollection(null, 0); } @Override protected GetNatMappingInfoFixedSizeCollection createCollection( List<GetNatMappingInfoPage> pages, int collectionSize) { return new GetNatMappingInfoFixedSizeCollection(pages, collectionSize); } } public static class ListPagedResponse extends AbstractPagedListResponse< ListRoutersRequest, RouterList, Router, ListPage, ListFixedSizeCollection> { public static ApiFuture<ListPagedResponse> createAsync( PageContext<ListRoutersRequest, RouterList, Router> context, ApiFuture<RouterList> futureResponse) { ApiFuture<ListPage> futurePage = ListPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); } private ListPagedResponse(ListPage page) { super(page, ListFixedSizeCollection.createEmptyCollection()); } } public static class ListPage extends AbstractPage<ListRoutersRequest, RouterList, Router, ListPage> { private ListPage( PageContext<ListRoutersRequest, RouterList, Router> context, RouterList response) { super(context, response); } private static ListPage createEmptyPage() { return new ListPage(null, null); } @Override protected ListPage createPage( PageContext<ListRoutersRequest, RouterList, Router> context, RouterList response) { return new ListPage(context, response); } @Override public ApiFuture<ListPage> createPageAsync( PageContext<ListRoutersRequest, RouterList, Router> context, ApiFuture<RouterList> futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListFixedSizeCollection extends AbstractFixedSizeCollection< ListRoutersRequest, RouterList, Router, ListPage, ListFixedSizeCollection> { private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { super(pages, collectionSize); } private static ListFixedSizeCollection createEmptyCollection() { return new ListFixedSizeCollection(null, 0); } @Override protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { return new ListFixedSizeCollection(pages, collectionSize); } } }
72,044
0.684236
0.665015
1,738
40.459724
30.718531
101
false
false
0
0
0
0
0
0
0.266398
false
false
8
6bb7b75cdc110afe0a062810cf6d07b8285a782a
33,818,572,513,406
171f47ccb896c182cb37df8bba199885db39b0f0
/src/com/doublesunflower/twask/view/subactivities/TagListSubActivity.java
3e5a7199aff0da99bd3491de95eabe374bff9727
[]
no_license
andrewzeus/twask
https://github.com/andrewzeus/twask
6468847daab3c8646fbfb7144a50d01f941bc7f4
66972afe3011b2857ed54975792cfe788d64d590
refs/heads/master
2021-01-10T19:33:47.542000
2010-04-02T21:18:04
2010-04-02T21:18:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2009 Double Sunflower Holdings Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //changed from Tasklist to Twask //planning to add location-based search to Twask /* * ASTRID: Android's Simple Task Recording Dashboard * * Copyright (c) 2009 Tim Su * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.doublesunflower.twask.view.subactivities; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Color; import android.os.Bundle; import android.view.ContextMenu; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ContextMenu.ContextMenuInfo; import android.view.View.OnCreateContextMenuListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import com.doublesunflower.R; import com.doublesunflower.twask.identifier.TagIdentifier; import com.doublesunflower.twask.identifier.TaskIdentifier; import com.doublesunflower.twask.model.TagModelForView; import com.doublesunflower.twask.model.TaskModelForList; import com.doublesunflower.twask.view.activities.TwaskEdit; import com.doublesunflower.twask.view.activities.Twask; import com.doublesunflower.twask.view.activities.Twask.ActivityCode; /** * List all tags and allows a user to see all tasks for a given tag * * @author Tim Su (timsu@stanfordalumni.org) * */ public class TagListSubActivity extends SubActivity { private static final int ACTIVITY_CREATE = 0; private static final int MENU_SORT_ALPHA_ID = Menu.FIRST; private static final int MENU_SORT_SIZE_ID = Menu.FIRST + 1; private static final int CONTEXT_CREATE_ID = Menu.FIRST + 10; private static final int CONTEXT_DELETE_ID = Menu.FIRST + 11; private static final int CONTEXT_SHOWHIDE_ID = Menu.FIRST + 12; private ListView listView; private List<TagModelForView> tagArray; private Map<Long, TaskModelForList> taskMap; Map<TagModelForView, Integer> tagToTaskCount; private static SortMode sortMode = SortMode.SIZE; private static boolean sortReverse = false; public TagListSubActivity(Twask parent, ActivityCode code, View view) { super(parent, code, view); } @Override public void onDisplay(Bundle variables) { listView = (ListView)findViewById(R.id.taglist); fillData(); } // --- stuff for sorting private enum SortMode { ALPHA { @Override int compareTo(TagListSubActivity self, TagModelForView arg0, TagModelForView arg1) { return arg0.getName().compareTo(arg1.getName()); } }, SIZE { @Override int compareTo(TagListSubActivity self, TagModelForView arg0, TagModelForView arg1) { return self.tagToTaskCount.get(arg1) - self.tagToTaskCount.get(arg0); } }; abstract int compareTo(TagListSubActivity self, TagModelForView arg0, TagModelForView arg1); }; private void sortTagArray() { // get all tasks Cursor taskCursor = getTaskController().getActiveTaskListCursor(); startManagingCursor(taskCursor); List<TaskModelForList> taskArray = getTaskController().createTaskListFromCursor(taskCursor); taskMap = new HashMap<Long, TaskModelForList>(); for(TaskModelForList task : taskArray) { if(task.isHidden()) continue; taskMap.put(task.getTaskIdentifier().getId(), task); } // get accurate task count for each tag tagToTaskCount = new HashMap<TagModelForView, Integer>(); for(TagModelForView tag : tagArray) { int count = 0; List<TaskIdentifier> tasks = getTagController().getTaggedTasks( getParent(), tag.getTagIdentifier()); for(TaskIdentifier taskId : tasks) if(taskMap.containsKey(taskId.getId())) count++; tagToTaskCount.put(tag, count); } // do sort Collections.sort(tagArray, new Comparator<TagModelForView>() { public int compare(TagModelForView arg0, TagModelForView arg1) { return sortMode.compareTo(TagListSubActivity.this, arg0, arg1); } }); if(sortReverse) Collections.reverse(tagArray); } // --- fill data /** Fill in the Tag List with our tags */ private void fillData() { Resources r = getResources(); tagArray = getTagController().getAllTags(getParent()); // perform sort sortTagArray(); // set up the title StringBuilder title = new StringBuilder(). append(r.getString(R.string.tagList_titlePrefix)). append(" ").append(r.getQuantityString(R.plurals.Ntags, tagArray.size(), tagArray.size())); setTitle(title); // set up our adapter TagListAdapter tagAdapter = new TagListAdapter(getParent(), android.R.layout.simple_list_item_1, tagArray); listView.setAdapter(tagAdapter); // list view listener listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TagModelForView tag = (TagModelForView)view.getTag(); Bundle bundle = new Bundle(); bundle.putLong(TwaskListSubActivity.TAG_TOKEN, tag.getTagIdentifier().getId()); switchToActivity(ActivityCode.TASK_LIST_W_TAG, bundle); } }); listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo)menuInfo; int position = adapterMenuInfo.position; menu.add(position, CONTEXT_CREATE_ID, Menu.NONE, R.string.tagList_context_create); menu.add(position, CONTEXT_DELETE_ID, Menu.NONE, R.string.tagList_context_delete); int showHideLabel = R.string.tagList_context_hideTag; if(tagArray.get(position).shouldHideFromMainList()) showHideLabel = R.string.tagList_context_showTag; menu.add(position, CONTEXT_SHOWHIDE_ID, Menu.NONE, showHideLabel); menu.setHeaderTitle(tagArray.get(position).getName()); } }); listView.setOnTouchListener(getGestureListener()); } @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { fillData(); } // --- list adapter private void createTask(TagModelForView tag) { Intent intent = new Intent(getParent(), TwaskEdit.class); intent.putExtra(TwaskEdit.TAG_NAME_TOKEN, tag.getName()); launchActivity(intent, ACTIVITY_CREATE); } private void deleteTag(final TagIdentifier tagId) { new AlertDialog.Builder(getParent()) .setTitle(R.string.delete_title) .setMessage(R.string.delete_this_tag_title) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { getTagController().deleteTag(tagId); fillData(); } }) .setNegativeButton(android.R.string.cancel, null) .show(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK) { switchToActivity(ActivityCode.TASK_LIST, null); return true; } return false; } @Override /** Picked item in the options list */ public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case MENU_SORT_ALPHA_ID: if(sortMode == SortMode.ALPHA) sortReverse = !sortReverse; else { sortMode = SortMode.ALPHA; sortReverse = false; } fillData(); return true; case MENU_SORT_SIZE_ID: if(sortMode == SortMode.SIZE) sortReverse = !sortReverse; else { sortMode = SortMode.SIZE; sortReverse = false; } fillData(); return true; case CONTEXT_CREATE_ID: TagModelForView tag = tagArray.get(item.getGroupId()); createTask(tag); return true; case CONTEXT_DELETE_ID: tag = tagArray.get(item.getGroupId()); deleteTag(tag.getTagIdentifier()); return true; case CONTEXT_SHOWHIDE_ID: tag = tagArray.get(item.getGroupId()); tag.toggleHideFromMainList(); getTagController().saveTag(tag); fillData(); return true; } return false; } // --- creating stuff @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem item; item = menu.add(Menu.NONE, MENU_SORT_ALPHA_ID, Menu.NONE, R.string.tagList_menu_sortAlpha); item.setIcon(android.R.drawable.ic_menu_sort_alphabetically); item.setAlphabeticShortcut('a'); item = menu.add(Menu.NONE, MENU_SORT_SIZE_ID, Menu.NONE, R.string.tagList_menu_sortSize); item.setIcon(android.R.drawable.ic_menu_sort_by_size); item.setAlphabeticShortcut('s'); return true; } private class TagListAdapter extends ArrayAdapter<TagModelForView> { private List<TagModelForView> objects; private int resource; private Context context; private LayoutInflater inflater; public TagListAdapter(Context context, int resource, List<TagModelForView> objects) { super(context, resource, objects); inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.objects = objects; this.resource = resource; this.context = context; } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if(view == null) { view = inflater.inflate(resource, parent, false); } setupView(view, objects.get(position)); return view; } public void setupView(View view, final TagModelForView tag) { Resources r = context.getResources(); view.setTag(tag); final TextView name = ((TextView)view.findViewById(android.R.id.text1)); name.setText(new StringBuilder(tag.getName()). append(" (").append(tagToTaskCount.get(tag)).append(")")); if(tagToTaskCount.get(tag) == 0) name.setTextColor(r.getColor(R.color.task_list_done)); else name.setTextColor(Color.BLACK); } } }
UTF-8
Java
13,228
java
TagListSubActivity.java
Java
[ { "context": " Task Recording Dashboard\n *\n * Copyright (c) 2009 Tim Su\n *\n * This program is free software; you can redi", "end": 791, "score": 0.9976614713668823, "start": 785, "tag": "NAME", "value": "Tim Su" }, { "context": "ser to see all tasks for a given tag\n *\n * @author Tim Su (timsu@stanfordalumni.org)\n *\n */\npublic class Ta", "end": 3062, "score": 0.9774432182312012, "start": 3056, "tag": "NAME", "value": "Tim Su" }, { "context": "e all tasks for a given tag\n *\n * @author Tim Su (timsu@stanfordalumni.org)\n *\n */\npublic class TagListSubActivity extends S", "end": 3088, "score": 0.9999356865882874, "start": 3064, "tag": "EMAIL", "value": "timsu@stanfordalumni.org" } ]
null
[]
/* * Copyright (C) 2009 Double Sunflower Holdings Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //changed from Tasklist to Twask //planning to add location-based search to Twask /* * ASTRID: Android's Simple Task Recording Dashboard * * Copyright (c) 2009 <NAME> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.doublesunflower.twask.view.subactivities; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Color; import android.os.Bundle; import android.view.ContextMenu; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ContextMenu.ContextMenuInfo; import android.view.View.OnCreateContextMenuListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import com.doublesunflower.R; import com.doublesunflower.twask.identifier.TagIdentifier; import com.doublesunflower.twask.identifier.TaskIdentifier; import com.doublesunflower.twask.model.TagModelForView; import com.doublesunflower.twask.model.TaskModelForList; import com.doublesunflower.twask.view.activities.TwaskEdit; import com.doublesunflower.twask.view.activities.Twask; import com.doublesunflower.twask.view.activities.Twask.ActivityCode; /** * List all tags and allows a user to see all tasks for a given tag * * @author <NAME> (<EMAIL>) * */ public class TagListSubActivity extends SubActivity { private static final int ACTIVITY_CREATE = 0; private static final int MENU_SORT_ALPHA_ID = Menu.FIRST; private static final int MENU_SORT_SIZE_ID = Menu.FIRST + 1; private static final int CONTEXT_CREATE_ID = Menu.FIRST + 10; private static final int CONTEXT_DELETE_ID = Menu.FIRST + 11; private static final int CONTEXT_SHOWHIDE_ID = Menu.FIRST + 12; private ListView listView; private List<TagModelForView> tagArray; private Map<Long, TaskModelForList> taskMap; Map<TagModelForView, Integer> tagToTaskCount; private static SortMode sortMode = SortMode.SIZE; private static boolean sortReverse = false; public TagListSubActivity(Twask parent, ActivityCode code, View view) { super(parent, code, view); } @Override public void onDisplay(Bundle variables) { listView = (ListView)findViewById(R.id.taglist); fillData(); } // --- stuff for sorting private enum SortMode { ALPHA { @Override int compareTo(TagListSubActivity self, TagModelForView arg0, TagModelForView arg1) { return arg0.getName().compareTo(arg1.getName()); } }, SIZE { @Override int compareTo(TagListSubActivity self, TagModelForView arg0, TagModelForView arg1) { return self.tagToTaskCount.get(arg1) - self.tagToTaskCount.get(arg0); } }; abstract int compareTo(TagListSubActivity self, TagModelForView arg0, TagModelForView arg1); }; private void sortTagArray() { // get all tasks Cursor taskCursor = getTaskController().getActiveTaskListCursor(); startManagingCursor(taskCursor); List<TaskModelForList> taskArray = getTaskController().createTaskListFromCursor(taskCursor); taskMap = new HashMap<Long, TaskModelForList>(); for(TaskModelForList task : taskArray) { if(task.isHidden()) continue; taskMap.put(task.getTaskIdentifier().getId(), task); } // get accurate task count for each tag tagToTaskCount = new HashMap<TagModelForView, Integer>(); for(TagModelForView tag : tagArray) { int count = 0; List<TaskIdentifier> tasks = getTagController().getTaggedTasks( getParent(), tag.getTagIdentifier()); for(TaskIdentifier taskId : tasks) if(taskMap.containsKey(taskId.getId())) count++; tagToTaskCount.put(tag, count); } // do sort Collections.sort(tagArray, new Comparator<TagModelForView>() { public int compare(TagModelForView arg0, TagModelForView arg1) { return sortMode.compareTo(TagListSubActivity.this, arg0, arg1); } }); if(sortReverse) Collections.reverse(tagArray); } // --- fill data /** Fill in the Tag List with our tags */ private void fillData() { Resources r = getResources(); tagArray = getTagController().getAllTags(getParent()); // perform sort sortTagArray(); // set up the title StringBuilder title = new StringBuilder(). append(r.getString(R.string.tagList_titlePrefix)). append(" ").append(r.getQuantityString(R.plurals.Ntags, tagArray.size(), tagArray.size())); setTitle(title); // set up our adapter TagListAdapter tagAdapter = new TagListAdapter(getParent(), android.R.layout.simple_list_item_1, tagArray); listView.setAdapter(tagAdapter); // list view listener listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TagModelForView tag = (TagModelForView)view.getTag(); Bundle bundle = new Bundle(); bundle.putLong(TwaskListSubActivity.TAG_TOKEN, tag.getTagIdentifier().getId()); switchToActivity(ActivityCode.TASK_LIST_W_TAG, bundle); } }); listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo)menuInfo; int position = adapterMenuInfo.position; menu.add(position, CONTEXT_CREATE_ID, Menu.NONE, R.string.tagList_context_create); menu.add(position, CONTEXT_DELETE_ID, Menu.NONE, R.string.tagList_context_delete); int showHideLabel = R.string.tagList_context_hideTag; if(tagArray.get(position).shouldHideFromMainList()) showHideLabel = R.string.tagList_context_showTag; menu.add(position, CONTEXT_SHOWHIDE_ID, Menu.NONE, showHideLabel); menu.setHeaderTitle(tagArray.get(position).getName()); } }); listView.setOnTouchListener(getGestureListener()); } @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { fillData(); } // --- list adapter private void createTask(TagModelForView tag) { Intent intent = new Intent(getParent(), TwaskEdit.class); intent.putExtra(TwaskEdit.TAG_NAME_TOKEN, tag.getName()); launchActivity(intent, ACTIVITY_CREATE); } private void deleteTag(final TagIdentifier tagId) { new AlertDialog.Builder(getParent()) .setTitle(R.string.delete_title) .setMessage(R.string.delete_this_tag_title) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { getTagController().deleteTag(tagId); fillData(); } }) .setNegativeButton(android.R.string.cancel, null) .show(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK) { switchToActivity(ActivityCode.TASK_LIST, null); return true; } return false; } @Override /** Picked item in the options list */ public boolean onMenuItemSelected(int featureId, MenuItem item) { switch(item.getItemId()) { case MENU_SORT_ALPHA_ID: if(sortMode == SortMode.ALPHA) sortReverse = !sortReverse; else { sortMode = SortMode.ALPHA; sortReverse = false; } fillData(); return true; case MENU_SORT_SIZE_ID: if(sortMode == SortMode.SIZE) sortReverse = !sortReverse; else { sortMode = SortMode.SIZE; sortReverse = false; } fillData(); return true; case CONTEXT_CREATE_ID: TagModelForView tag = tagArray.get(item.getGroupId()); createTask(tag); return true; case CONTEXT_DELETE_ID: tag = tagArray.get(item.getGroupId()); deleteTag(tag.getTagIdentifier()); return true; case CONTEXT_SHOWHIDE_ID: tag = tagArray.get(item.getGroupId()); tag.toggleHideFromMainList(); getTagController().saveTag(tag); fillData(); return true; } return false; } // --- creating stuff @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem item; item = menu.add(Menu.NONE, MENU_SORT_ALPHA_ID, Menu.NONE, R.string.tagList_menu_sortAlpha); item.setIcon(android.R.drawable.ic_menu_sort_alphabetically); item.setAlphabeticShortcut('a'); item = menu.add(Menu.NONE, MENU_SORT_SIZE_ID, Menu.NONE, R.string.tagList_menu_sortSize); item.setIcon(android.R.drawable.ic_menu_sort_by_size); item.setAlphabeticShortcut('s'); return true; } private class TagListAdapter extends ArrayAdapter<TagModelForView> { private List<TagModelForView> objects; private int resource; private Context context; private LayoutInflater inflater; public TagListAdapter(Context context, int resource, List<TagModelForView> objects) { super(context, resource, objects); inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.objects = objects; this.resource = resource; this.context = context; } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if(view == null) { view = inflater.inflate(resource, parent, false); } setupView(view, objects.get(position)); return view; } public void setupView(View view, final TagModelForView tag) { Resources r = context.getResources(); view.setTag(tag); final TextView name = ((TextView)view.findViewById(android.R.id.text1)); name.setText(new StringBuilder(tag.getName()). append(" (").append(tagToTaskCount.get(tag)).append(")")); if(tagToTaskCount.get(tag) == 0) name.setTextColor(r.getColor(R.color.task_list_done)); else name.setTextColor(Color.BLACK); } } }
13,211
0.633429
0.629422
378
33.997353
25.512886
100
false
false
0
0
0
0
0
0
0.690476
false
false
8
fb0a4aa993dcad50acdb67ee17d49ce57aac7a3e
27,994,596,892,548
d142c8b8a3aa73b52c3e02c6af9ac3016898cbdb
/Box.java
495afc6e7c6147d7b3d1e9e1ef290fc70d254a06
[]
no_license
zepedak1/Java-Works
https://github.com/zepedak1/Java-Works
1768b4c5c8672667365f96c4d065068eb8765edd
0bf871e5444482d756b34ad48b74300379d01739
refs/heads/master
2020-08-29T16:55:53.300000
2019-10-30T17:41:20
2019-10-30T17:41:20
218,101,499
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Box { public int length, width, height; public void make(int length) { this.width = 0; this.height = 0; System.out.println("Length: " + length); System.out.println("Width: " + this.width); System.out.println("Height: " + this.height); System.out.println("Line Created"); } public void make(int length, int width) { this.height = 0; System.out.println("Length: " + length); System.out.println("Width: " + width); System.out.println("Height: " + this.height); System.out.println("Rectangle Created"); } public void make(int length, int width, int height) { System.out.println("Length: " + length); System.out.println("Width: " + width); System.out.println("Height: " + height); System.out.println("Box Created"); } }
UTF-8
Java
782
java
Box.java
Java
[]
null
[]
public class Box { public int length, width, height; public void make(int length) { this.width = 0; this.height = 0; System.out.println("Length: " + length); System.out.println("Width: " + this.width); System.out.println("Height: " + this.height); System.out.println("Line Created"); } public void make(int length, int width) { this.height = 0; System.out.println("Length: " + length); System.out.println("Width: " + width); System.out.println("Height: " + this.height); System.out.println("Rectangle Created"); } public void make(int length, int width, int height) { System.out.println("Length: " + length); System.out.println("Width: " + width); System.out.println("Height: " + height); System.out.println("Box Created"); } }
782
0.650895
0.647059
28
26.964285
17.203575
55
false
false
0
0
0
0
0
0
1.285714
false
false
8
cddd4fed4bb071106ac77509a58ba3b36744f1a1
17,454,747,127,724
3b8dd605f64f206b8bf54b90550894f1ff25f96a
/src/com/haojiahong/weixin/message/menu/Menu.java
9360f3132ee07e17a23fb1601788f6d858eafd1c
[]
no_license
haojiahong/wechat
https://github.com/haojiahong/wechat
b9e6889cb93f036fee28c8d17d9dcf2c5d44267a
5462aecd8f48fa9b24179911ec428473da8d7f53
refs/heads/master
2021-01-10T11:38:01.467000
2016-02-18T13:55:53
2016-02-18T13:55:53
45,046,356
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.haojiahong.weixin.message.menu; /** * ²Ëµ¥ * @author haojiahong * * @createtime 2015-7-16 */ public class Menu { private BaseButton[] button; public BaseButton[] getButton() { return button; } public void setButton(BaseButton[] button) { this.button = button; } }
WINDOWS-1252
Java
296
java
Menu.java
Java
[ { "context": "iahong.weixin.message.menu;\n/**\n * ²Ëµ¥\n * @author haojiahong\n *\n * @createtime 2015-7-16\n */\npublic class Menu", "end": 77, "score": 0.9994429349899292, "start": 67, "tag": "USERNAME", "value": "haojiahong" } ]
null
[]
package com.haojiahong.weixin.message.menu; /** * ²Ëµ¥ * @author haojiahong * * @createtime 2015-7-16 */ public class Menu { private BaseButton[] button; public BaseButton[] getButton() { return button; } public void setButton(BaseButton[] button) { this.button = button; } }
296
0.681507
0.65411
18
15.222222
14.800735
45
false
false
0
0
0
0
0
0
0.722222
false
false
8
a312302b241c847898acb1edd5ec4853ad656da2
15,839,839,428,628
e377f4338bf44ada428eb1236aa964ab32bd0876
/src/main/java/com/yozora/pojo/MeettingNews.java
cbcb588e28bb5da348679d4fe3e89ee036f8ce8f
[]
no_license
yonusona/meetting
https://github.com/yonusona/meetting
1cad8190758b9bfef4cfd14ae0844fc852c56afe
482e13a3149526339711ac75d27a70d688610224
refs/heads/master
2020-04-02T16:10:25.942000
2018-11-13T02:51:46
2018-11-13T02:51:46
154,601,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yozora.pojo; /** * @Auther: yozora * @Date: 2018/10/23 20:27 * @Description: */ public class MeettingNews { private String meettingNewsId; private String meettingNewsName; private String meettingNewsDes; private String meettingNewsUrl; private String meettingNewsHead; private Integer type; public MeettingNews() { } public MeettingNews(String meettingNewsId, String meettingNewsName, String meettingNewsDes, String meettingNewsUrl, String meettingNewsHead, Integer type) { this.meettingNewsId = meettingNewsId; this.meettingNewsName = meettingNewsName; this.meettingNewsDes = meettingNewsDes; this.meettingNewsUrl = meettingNewsUrl; this.meettingNewsHead = meettingNewsHead; this.type = type; } public String getMeettingNewsId() { return meettingNewsId; } public void setMeettingNewsId(String meettingNewsId) { this.meettingNewsId = meettingNewsId; } public String getMeettingNewsName() { return meettingNewsName; } public void setMeettingNewsName(String meettingNewsName) { this.meettingNewsName = meettingNewsName; } public String getMeettingNewsDes() { return meettingNewsDes; } public void setMeettingNewsDes(String meettingNewsDes) { this.meettingNewsDes = meettingNewsDes; } public String getMeettingNewsUrl() { return meettingNewsUrl; } public void setMeettingNewsUrl(String meettingNewsUrl) { this.meettingNewsUrl = meettingNewsUrl; } public String getMeettingNewsHead() { return meettingNewsHead; } public void setMeettingNewsHead(String meettingNewsHead) { this.meettingNewsHead = meettingNewsHead; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } }
UTF-8
Java
1,925
java
MeettingNews.java
Java
[ { "context": "package com.yozora.pojo;\n\n/**\n * @Auther: yozora\n * @Date: 2018/10/23 20:27\n * @Description:\n */\n\n", "end": 48, "score": 0.9996318817138672, "start": 42, "tag": "USERNAME", "value": "yozora" } ]
null
[]
package com.yozora.pojo; /** * @Auther: yozora * @Date: 2018/10/23 20:27 * @Description: */ public class MeettingNews { private String meettingNewsId; private String meettingNewsName; private String meettingNewsDes; private String meettingNewsUrl; private String meettingNewsHead; private Integer type; public MeettingNews() { } public MeettingNews(String meettingNewsId, String meettingNewsName, String meettingNewsDes, String meettingNewsUrl, String meettingNewsHead, Integer type) { this.meettingNewsId = meettingNewsId; this.meettingNewsName = meettingNewsName; this.meettingNewsDes = meettingNewsDes; this.meettingNewsUrl = meettingNewsUrl; this.meettingNewsHead = meettingNewsHead; this.type = type; } public String getMeettingNewsId() { return meettingNewsId; } public void setMeettingNewsId(String meettingNewsId) { this.meettingNewsId = meettingNewsId; } public String getMeettingNewsName() { return meettingNewsName; } public void setMeettingNewsName(String meettingNewsName) { this.meettingNewsName = meettingNewsName; } public String getMeettingNewsDes() { return meettingNewsDes; } public void setMeettingNewsDes(String meettingNewsDes) { this.meettingNewsDes = meettingNewsDes; } public String getMeettingNewsUrl() { return meettingNewsUrl; } public void setMeettingNewsUrl(String meettingNewsUrl) { this.meettingNewsUrl = meettingNewsUrl; } public String getMeettingNewsHead() { return meettingNewsHead; } public void setMeettingNewsHead(String meettingNewsHead) { this.meettingNewsHead = meettingNewsHead; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } }
1,925
0.687792
0.681558
77
24
25.353603
160
false
false
0
0
0
0
0
0
0.38961
false
false
8
db3157e49d3f0a3d6c687d12f0b59ed96ca2a727
32,091,995,686,774
9d18776fd39c8fd4546e496b59a4ae8491736abb
/028-api-hu/src/main/java/com/keqi/apihu/pj/service/PjDatasourceTableColumnService.java
e0ed8832783469d4a2fe1746b1b932366f898d69
[ "Apache-2.0" ]
permissive
WendellTeam/code-java
https://github.com/WendellTeam/code-java
2da6d127fcd7ccbe59ec5b7d4b92904a43614f65
054aee871f7e25c0a5766ce5422e71be49dd543f
refs/heads/master
2023-06-11T23:53:22.087000
2021-07-02T13:51:46
2021-07-02T13:51:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.keqi.apihu.pj.service; import com.keqi.apihu.pj.domain.PjDatasourceTableColumnDO; import java.util.List; public interface PjDatasourceTableColumnService { int deleteByPrimaryKey(Long id); int insert(PjDatasourceTableColumnDO record); int insertSelective(PjDatasourceTableColumnDO record); PjDatasourceTableColumnDO selectByPrimaryKey(Long id); int updateByPrimaryKeySelective(PjDatasourceTableColumnDO record); int updateByPrimaryKey(PjDatasourceTableColumnDO record); void deleteByDatasourceId(Long datasourceId); void insertList(List<PjDatasourceTableColumnDO> pjDatasourceTableColumnDOList); }
UTF-8
Java
630
java
PjDatasourceTableColumnService.java
Java
[]
null
[]
package com.keqi.apihu.pj.service; import com.keqi.apihu.pj.domain.PjDatasourceTableColumnDO; import java.util.List; public interface PjDatasourceTableColumnService { int deleteByPrimaryKey(Long id); int insert(PjDatasourceTableColumnDO record); int insertSelective(PjDatasourceTableColumnDO record); PjDatasourceTableColumnDO selectByPrimaryKey(Long id); int updateByPrimaryKeySelective(PjDatasourceTableColumnDO record); int updateByPrimaryKey(PjDatasourceTableColumnDO record); void deleteByDatasourceId(Long datasourceId); void insertList(List<PjDatasourceTableColumnDO> pjDatasourceTableColumnDOList); }
630
0.844444
0.844444
26
23.23077
27.031759
80
false
false
0
0
0
0
0
0
0.730769
false
false
8
63db91f55def8def9672285ca8c4ec35dba5d0e1
10,050,223,512,323
a3eecdc4f5f980f89179a0e1cc98cb4af45db7a9
/src/main/java/org/reso/service/security/Provider.java
81e82129759d39eb613a8e0749dc3ba8477391da
[ "MIT" ]
permissive
pedem/reso-web-api-reference-server
https://github.com/pedem/reso-web-api-reference-server
fd25e7091d797e7e4ed7888f3cdbbfe0d9b44ead
77b723f95a92417f9438d8153344953bd0560565
refs/heads/main
2023-07-11T01:13:13.641000
2021-08-18T21:45:31
2021-08-18T21:45:31
397,369,464
0
0
MIT
true
2021-08-17T19:26:55
2021-08-17T19:26:55
2021-08-10T02:26:04
2021-07-22T23:25:38
1,231
0
0
0
null
false
false
package org.reso.service.security; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public interface Provider { boolean verify(final HttpServletRequest req); void unauthorizedResponse(final HttpServletResponse resp); }
UTF-8
Java
273
java
Provider.java
Java
[]
null
[]
package org.reso.service.security; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public interface Provider { boolean verify(final HttpServletRequest req); void unauthorizedResponse(final HttpServletResponse resp); }
273
0.820513
0.820513
12
21.75
22.86236
61
false
false
0
0
0
0
0
0
0.416667
false
false
8
06b11342ff7b960c8d050f945067c33847c3ec96
24,464,133,760,337
ac3d086a36109cdecc1e2f92e01a4b072fa9cfb4
/howto-java-coding/src/com/software/basic/problem/FloatExample2.java
ce806bb0e64d1ede8687c7c0ed75d3d47a6982ee
[]
no_license
uuin99/howto-java-coding
https://github.com/uuin99/howto-java-coding
57fdd6165a5c3406f05a606eadfda4bdefd40bf5
8760919c1b759df63bd7cc588fb7c1d4859c813c
refs/heads/master
2020-12-25T07:44:45.278000
2016-08-02T16:15:25
2016-08-02T16:15:25
63,481,308
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.software.basic.problem; public class FloatExample2 { public static void main(String[] args) { // 자바 7에서는 아래와 같이 숫자 사이에 언더바로 자릿수를 구분할 수 있다. // 하지만 자바 7 이전 버전에서는 적용되지 않는다. int value1 = 2_000_000_000; int value2 = 2_000_000_050; float fValue1 = 2_000_000_000; float fValue2 = 2_000_000_050; // int 형의 value1과 value2는 다른 값이다. System.out.println("int 형 " + value1 + "은 " + value2 + "와 " + (value1 == value2 ? "같다" : "다르다")); System.out.println("float 형 " + fValue1 + "은 " + fValue2 + "와 " + (fValue1 == fValue2 ? "같다" : "다르다")); } }
UTF-8
Java
713
java
FloatExample2.java
Java
[]
null
[]
package com.software.basic.problem; public class FloatExample2 { public static void main(String[] args) { // 자바 7에서는 아래와 같이 숫자 사이에 언더바로 자릿수를 구분할 수 있다. // 하지만 자바 7 이전 버전에서는 적용되지 않는다. int value1 = 2_000_000_000; int value2 = 2_000_000_050; float fValue1 = 2_000_000_000; float fValue2 = 2_000_000_050; // int 형의 value1과 value2는 다른 값이다. System.out.println("int 형 " + value1 + "은 " + value2 + "와 " + (value1 == value2 ? "같다" : "다르다")); System.out.println("float 형 " + fValue1 + "은 " + fValue2 + "와 " + (fValue1 == fValue2 ? "같다" : "다르다")); } }
713
0.613757
0.513228
17
32.35294
29.937073
106
false
false
0
0
0
0
0
0
1.705882
false
false
8
a3687109a2ebb15f2053898ec9e5e60ee05dffac
28,123,445,899,491
f6a9e18edd22aa7aad3f98a1c124975b3c126a03
/src/test/java/net/digitaltsunami/tmeter/KeyedTimerNotesTest.java
1f41aea7310b4691fc54b9638aa63218fd3a8263
[]
no_license
danhagberg/TMeter
https://github.com/danhagberg/TMeter
97410bd9ef495c610baaff2a1647ac3ec5ede26b
dfde28124548d602411e70b8bfe0d6e4aad580cd
refs/heads/master
2021-01-21T21:48:36.366000
2014-09-30T02:40:06
2014-09-30T02:40:06
1,627,061
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.digitaltsunami.tmeter; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class KeyedTimerNotesTest extends TimerNotesTest { @Override protected TimerNotes createTimerNotes(String[] keys, Object[] vals) { Object[] interleaved = new Object[keys.length * 2]; for(int i=0;i<keys.length;i++) { interleaved[i*2] = keys[i]; interleaved[i*2+1] = vals[i]; } return new KeyedTimerNotes(interleaved); } @Before public void setUp() { super.setUp(); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#TimerNotes(boolean, java.lang.Object[])} * . */ @Test public void testTimerNotesFullConstructor() { // Test with keyed values TimerNotes timerNotes = new KeyedTimerNotes("Int", 1, "Char", 'a', "String", "Test", "Double", 3.4); assertEquals(4, timerNotes.getLength()); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#TimerNotes(boolean, java.lang.Object[])} * . */ @Test(expected=IllegalArgumentException.class) public void testTimerNotesFullConstructorInvalid() { // Test with keyed values // Missing value for last key. TimerNotes timerNotes = new KeyedTimerNotes("Int", 1, "Char", 'a', "String", "Test", "Double"); assertEquals(4, timerNotes.getLength()); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#getValue(java.lang.String)}. * Tests to ensure all note values are returned as the original datatype. */ @Test public void testGetValueUsingKey() { assertEquals(1, testTimerNotes.getValue("Int")); assertTrue(testTimerNotes.getValue("Int") instanceof Integer); assertEquals('a', testTimerNotes.getValue("Char")); assertTrue(testTimerNotes.getValue("Char") instanceof Character); assertEquals("Test", testTimerNotes.getValue("String")); assertTrue(testTimerNotes.getValue("String") instanceof String); assertEquals(3.4, testTimerNotes.getValue("Double")); assertTrue(testTimerNotes.getValue("Double") instanceof Double); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#getValue(java.lang.String)}. */ @Test public void testGetValueUsingKeyNotFound() { assertNull("Should have returned null", testTimerNotes.getValue("NotFound")); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#getStringValue(java.lang.String)} * . Tests to ensure all note values are returned as {@link String}. */ @Test public void testGetStringValueUsingKey() { assertEquals("1", testTimerNotes.getStringValue("Int")); assertEquals("a", testTimerNotes.getStringValue("Char")); assertEquals("Test", testTimerNotes.getStringValue("String")); assertEquals("3.4", testTimerNotes.getStringValue("Double")); } /** * Test method for {@link net.digitaltsunami.tmeter.TimerNoteList#isKeyed()}. */ @Override @Test public void testIsKeyed() { assertTrue(testTimerNotes.isKeyed()); } /** * Test method for {@link net.digitaltsunami.tmeter.TimerNoteList#getKeys()}. */ @Test public void testGetKeys() { String[] keys = testTimerNotes.getKeys(); assertEquals("Int", keys[0]); assertEquals("String", keys[2]); } @Test public void testSerializeKeyedNotes() { String keyedString = testTimerNotes.toSingleValue(); String expected = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + TimerNotes.NOTE_DELIMITER + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + TimerNotes.NOTE_DELIMITER + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + TimerNotes.NOTE_DELIMITER + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideNotesDelimiter() { char notesDelimiter = ','; String keyedString = testTimerNotes.toSingleValue(notesDelimiter); String expected = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + notesDelimiter + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + notesDelimiter + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + notesDelimiter + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideBothDelimiters() { char notesDelimiter = ','; char keyValueDelimiter = ':'; String keyedString = testTimerNotes.toSingleValue(notesDelimiter, keyValueDelimiter); String expected = "Int" + keyValueDelimiter + 1 + notesDelimiter + "Char" + keyValueDelimiter + 'a' + notesDelimiter + "String" + keyValueDelimiter + "Test" + notesDelimiter + "Double" + keyValueDelimiter + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideNotesDelimiterAllNotes() { char notesDelimiter = ','; String keyedString = testTimerNotes.toSingleValue(notesDelimiter); String expected = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + notesDelimiter + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + notesDelimiter + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + notesDelimiter + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideBothDelimitersAllNotes() { char notesDelimiter = ','; char keyValueDelimiter = ':'; String keyedString = testTimerNotes.toSingleValue(notesDelimiter, keyValueDelimiter); String expected = "Int" + keyValueDelimiter + 1 + notesDelimiter + "Char" + keyValueDelimiter + 'a' + notesDelimiter + "String" + keyValueDelimiter + "Test" + notesDelimiter + "Double" + keyValueDelimiter + 3.4; assertEquals(expected, keyedString); } @Test public void testParseKeyedNotes() { String keyedString = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + TimerNotes.NOTE_DELIMITER + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + TimerNotes.NOTE_DELIMITER + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + TimerNotes.NOTE_DELIMITER + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; TimerNotes parsed = TimerNotesParser.parse(keyedString); // Test that keys and notes were correctly extracted. assertTrue(parsed.isKeyed()); assertEquals("1", parsed.getStringValue("Int")); assertEquals("a", parsed.getStringValue("Char")); assertEquals("Test", parsed.getStringValue("String")); assertEquals("3.4", parsed.getStringValue("Double")); // Test that order was maintained during extraction assertEquals(1, testTimerNotes.getValue(0)); assertEquals('a', testTimerNotes.getValue(1)); assertEquals("Test", testTimerNotes.getValue(2)); assertEquals(3.4, testTimerNotes.getValue(3)); } @Test public void testParseKeyedNotesOverrideNotesDelimiter() { char notesDelimiter = ','; String keyedString = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + notesDelimiter + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + notesDelimiter + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + notesDelimiter + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; TimerNotes parsed = TimerNotesParser.parse(keyedString, notesDelimiter); // Test that keys and notes were correctly extracted. assertTrue(parsed.isKeyed()); assertEquals("1", parsed.getStringValue("Int")); assertEquals("a", parsed.getStringValue("Char")); assertEquals("Test", parsed.getStringValue("String")); assertEquals("3.4", parsed.getStringValue("Double")); // Test that order was maintained during extraction assertEquals(1, testTimerNotes.getValue(0)); assertEquals('a', testTimerNotes.getValue(1)); assertEquals("Test", testTimerNotes.getValue(2)); assertEquals(3.4, testTimerNotes.getValue(3)); } @Test public void testParseKeyedNotesOverrideBothDelimiters() { char notesDelimiter = ','; char keyValueDelimiter = ':'; String keyedString = "Int" + keyValueDelimiter + 1 + notesDelimiter + "Char" + keyValueDelimiter + 'a' + notesDelimiter + "String" + keyValueDelimiter + "Test" + notesDelimiter + "Double" + keyValueDelimiter + 3.4; TimerNotes parsed = TimerNotesParser.parse(keyedString, notesDelimiter, keyValueDelimiter); // Test that keys and notes were correctly extracted. assertTrue(parsed.isKeyed()); assertEquals("1", parsed.getStringValue("Int")); assertEquals("a", parsed.getStringValue("Char")); assertEquals("Test", parsed.getStringValue("String")); assertEquals("3.4", parsed.getStringValue("Double")); // Test that order was maintained during extraction assertEquals(1, testTimerNotes.getValue(0)); assertEquals('a', testTimerNotes.getValue(1)); assertEquals("Test", testTimerNotes.getValue(2)); assertEquals(3.4, testTimerNotes.getValue(3)); } @Override @Test public void testGetIndexForKey() { assertEquals(1,testTimerNotes.getIndexForKey("Char")); } @Override @Test public void testGetIndexForKeyNotFound() { assertEquals(-1,testTimerNotes.getIndexForKey("NotFound")); } }
UTF-8
Java
10,235
java
KeyedTimerNotesTest.java
Java
[]
null
[]
package net.digitaltsunami.tmeter; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class KeyedTimerNotesTest extends TimerNotesTest { @Override protected TimerNotes createTimerNotes(String[] keys, Object[] vals) { Object[] interleaved = new Object[keys.length * 2]; for(int i=0;i<keys.length;i++) { interleaved[i*2] = keys[i]; interleaved[i*2+1] = vals[i]; } return new KeyedTimerNotes(interleaved); } @Before public void setUp() { super.setUp(); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#TimerNotes(boolean, java.lang.Object[])} * . */ @Test public void testTimerNotesFullConstructor() { // Test with keyed values TimerNotes timerNotes = new KeyedTimerNotes("Int", 1, "Char", 'a', "String", "Test", "Double", 3.4); assertEquals(4, timerNotes.getLength()); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#TimerNotes(boolean, java.lang.Object[])} * . */ @Test(expected=IllegalArgumentException.class) public void testTimerNotesFullConstructorInvalid() { // Test with keyed values // Missing value for last key. TimerNotes timerNotes = new KeyedTimerNotes("Int", 1, "Char", 'a', "String", "Test", "Double"); assertEquals(4, timerNotes.getLength()); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#getValue(java.lang.String)}. * Tests to ensure all note values are returned as the original datatype. */ @Test public void testGetValueUsingKey() { assertEquals(1, testTimerNotes.getValue("Int")); assertTrue(testTimerNotes.getValue("Int") instanceof Integer); assertEquals('a', testTimerNotes.getValue("Char")); assertTrue(testTimerNotes.getValue("Char") instanceof Character); assertEquals("Test", testTimerNotes.getValue("String")); assertTrue(testTimerNotes.getValue("String") instanceof String); assertEquals(3.4, testTimerNotes.getValue("Double")); assertTrue(testTimerNotes.getValue("Double") instanceof Double); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#getValue(java.lang.String)}. */ @Test public void testGetValueUsingKeyNotFound() { assertNull("Should have returned null", testTimerNotes.getValue("NotFound")); } /** * Test method for * {@link net.digitaltsunami.tmeter.TimerNoteList#getStringValue(java.lang.String)} * . Tests to ensure all note values are returned as {@link String}. */ @Test public void testGetStringValueUsingKey() { assertEquals("1", testTimerNotes.getStringValue("Int")); assertEquals("a", testTimerNotes.getStringValue("Char")); assertEquals("Test", testTimerNotes.getStringValue("String")); assertEquals("3.4", testTimerNotes.getStringValue("Double")); } /** * Test method for {@link net.digitaltsunami.tmeter.TimerNoteList#isKeyed()}. */ @Override @Test public void testIsKeyed() { assertTrue(testTimerNotes.isKeyed()); } /** * Test method for {@link net.digitaltsunami.tmeter.TimerNoteList#getKeys()}. */ @Test public void testGetKeys() { String[] keys = testTimerNotes.getKeys(); assertEquals("Int", keys[0]); assertEquals("String", keys[2]); } @Test public void testSerializeKeyedNotes() { String keyedString = testTimerNotes.toSingleValue(); String expected = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + TimerNotes.NOTE_DELIMITER + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + TimerNotes.NOTE_DELIMITER + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + TimerNotes.NOTE_DELIMITER + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideNotesDelimiter() { char notesDelimiter = ','; String keyedString = testTimerNotes.toSingleValue(notesDelimiter); String expected = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + notesDelimiter + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + notesDelimiter + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + notesDelimiter + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideBothDelimiters() { char notesDelimiter = ','; char keyValueDelimiter = ':'; String keyedString = testTimerNotes.toSingleValue(notesDelimiter, keyValueDelimiter); String expected = "Int" + keyValueDelimiter + 1 + notesDelimiter + "Char" + keyValueDelimiter + 'a' + notesDelimiter + "String" + keyValueDelimiter + "Test" + notesDelimiter + "Double" + keyValueDelimiter + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideNotesDelimiterAllNotes() { char notesDelimiter = ','; String keyedString = testTimerNotes.toSingleValue(notesDelimiter); String expected = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + notesDelimiter + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + notesDelimiter + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + notesDelimiter + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; assertEquals(expected, keyedString); } @Test public void testSerializeKeyedNotesOverrideBothDelimitersAllNotes() { char notesDelimiter = ','; char keyValueDelimiter = ':'; String keyedString = testTimerNotes.toSingleValue(notesDelimiter, keyValueDelimiter); String expected = "Int" + keyValueDelimiter + 1 + notesDelimiter + "Char" + keyValueDelimiter + 'a' + notesDelimiter + "String" + keyValueDelimiter + "Test" + notesDelimiter + "Double" + keyValueDelimiter + 3.4; assertEquals(expected, keyedString); } @Test public void testParseKeyedNotes() { String keyedString = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + TimerNotes.NOTE_DELIMITER + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + TimerNotes.NOTE_DELIMITER + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + TimerNotes.NOTE_DELIMITER + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; TimerNotes parsed = TimerNotesParser.parse(keyedString); // Test that keys and notes were correctly extracted. assertTrue(parsed.isKeyed()); assertEquals("1", parsed.getStringValue("Int")); assertEquals("a", parsed.getStringValue("Char")); assertEquals("Test", parsed.getStringValue("String")); assertEquals("3.4", parsed.getStringValue("Double")); // Test that order was maintained during extraction assertEquals(1, testTimerNotes.getValue(0)); assertEquals('a', testTimerNotes.getValue(1)); assertEquals("Test", testTimerNotes.getValue(2)); assertEquals(3.4, testTimerNotes.getValue(3)); } @Test public void testParseKeyedNotesOverrideNotesDelimiter() { char notesDelimiter = ','; String keyedString = "Int" + TimerNotes.KEY_VALUE_DELIMITER + 1 + notesDelimiter + "Char" + TimerNotes.KEY_VALUE_DELIMITER + 'a' + notesDelimiter + "String" + TimerNotes.KEY_VALUE_DELIMITER + "Test" + notesDelimiter + "Double" + TimerNotes.KEY_VALUE_DELIMITER + 3.4; TimerNotes parsed = TimerNotesParser.parse(keyedString, notesDelimiter); // Test that keys and notes were correctly extracted. assertTrue(parsed.isKeyed()); assertEquals("1", parsed.getStringValue("Int")); assertEquals("a", parsed.getStringValue("Char")); assertEquals("Test", parsed.getStringValue("String")); assertEquals("3.4", parsed.getStringValue("Double")); // Test that order was maintained during extraction assertEquals(1, testTimerNotes.getValue(0)); assertEquals('a', testTimerNotes.getValue(1)); assertEquals("Test", testTimerNotes.getValue(2)); assertEquals(3.4, testTimerNotes.getValue(3)); } @Test public void testParseKeyedNotesOverrideBothDelimiters() { char notesDelimiter = ','; char keyValueDelimiter = ':'; String keyedString = "Int" + keyValueDelimiter + 1 + notesDelimiter + "Char" + keyValueDelimiter + 'a' + notesDelimiter + "String" + keyValueDelimiter + "Test" + notesDelimiter + "Double" + keyValueDelimiter + 3.4; TimerNotes parsed = TimerNotesParser.parse(keyedString, notesDelimiter, keyValueDelimiter); // Test that keys and notes were correctly extracted. assertTrue(parsed.isKeyed()); assertEquals("1", parsed.getStringValue("Int")); assertEquals("a", parsed.getStringValue("Char")); assertEquals("Test", parsed.getStringValue("String")); assertEquals("3.4", parsed.getStringValue("Double")); // Test that order was maintained during extraction assertEquals(1, testTimerNotes.getValue(0)); assertEquals('a', testTimerNotes.getValue(1)); assertEquals("Test", testTimerNotes.getValue(2)); assertEquals(3.4, testTimerNotes.getValue(3)); } @Override @Test public void testGetIndexForKey() { assertEquals(1,testTimerNotes.getIndexForKey("Char")); } @Override @Test public void testGetIndexForKeyNotFound() { assertEquals(-1,testTimerNotes.getIndexForKey("NotFound")); } }
10,235
0.627455
0.620127
245
40.775509
29.158726
99
false
false
0
0
0
0
0
0
0.661224
false
false
8
6f38477ce8246e97109f9612f755ef47d325d590
128,849,072,670
86f90c34fb43c7b8501da714aaf67f1dbd32cbb8
/src/main/java/us/rlit/arrays/ResizingArrays.java
984ce292a2e2c09e319679514910aa4dbdef8206
[]
no_license
rDevelop/master-class
https://github.com/rDevelop/master-class
01e1a2af4fccd713aa231011eb895f7a592d6806
fa5acfe107b723c83ceab0d338435b69e57263c4
refs/heads/master
2020-03-28T15:01:34.283000
2018-11-30T21:51:53
2018-11-30T21:51:53
148,547,784
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package us.rlit.arrays; import java.util.Arrays; import java.util.Scanner; public class ResizingArrays { private static Scanner s = new Scanner(System.in); private static int[] baseData = new int[10]; public static void main(String[] args) { System.out.println("Enter 10 numbers:"); readInput(); printArray(); System.out.println("Enter 15 numbers:"); resizeArray(15); readInput(); printArray(); } private static void readInput() { for(int i=0; i< baseData.length; i++) { baseData[i] = s.nextInt(); } } private static void printArray() { System.out.println(Arrays.toString(baseData)); } private static void resizeArray(int size) { int[] original = baseData; baseData = new int[size]; for(int i=0; i<original.length; i++) { baseData[i] = original[i]; } } }
UTF-8
Java
940
java
ResizingArrays.java
Java
[]
null
[]
package us.rlit.arrays; import java.util.Arrays; import java.util.Scanner; public class ResizingArrays { private static Scanner s = new Scanner(System.in); private static int[] baseData = new int[10]; public static void main(String[] args) { System.out.println("Enter 10 numbers:"); readInput(); printArray(); System.out.println("Enter 15 numbers:"); resizeArray(15); readInput(); printArray(); } private static void readInput() { for(int i=0; i< baseData.length; i++) { baseData[i] = s.nextInt(); } } private static void printArray() { System.out.println(Arrays.toString(baseData)); } private static void resizeArray(int size) { int[] original = baseData; baseData = new int[size]; for(int i=0; i<original.length; i++) { baseData[i] = original[i]; } } }
940
0.57766
0.567021
40
22.5
18.709623
54
false
false
0
0
0
0
0
0
0.525
false
false
8
672ae363155430905eed8cca58f5a8045d9aa3e8
27,462,020,949,162
fdd4072511585ac8f53ca1122695e89d4db680ca
/InCycle/src/kh/com/a/service/PdsService.java
61e2edc8df55887178e31773b64769c7122ad373
[]
no_license
hyunwoo11/CycleFinalProject
https://github.com/hyunwoo11/CycleFinalProject
296be4e293d564f65d753afec4e43e36960aae51
9648ae47778d211a640b385402de6ad67a528027
refs/heads/master
2020-03-31T19:46:21.532000
2018-10-12T00:49:34
2018-10-12T00:49:34
152,510,789
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kh.com.a.service; public interface PdsService { }
UTF-8
Java
60
java
PdsService.java
Java
[]
null
[]
package kh.com.a.service; public interface PdsService { }
60
0.75
0.75
5
11
13.130118
29
false
false
0
0
0
0
0
0
0.2
false
false
8
487f680b5acd77e772b785102ee49a3303e58c5a
28,303,834,488,880
abee125f2b40990e507cfbe7f54a2698172ce03d
/app/src/main/java/com/example/realwhatsappclone/users/adapter/UsersRepositories.java
f6028caccd09e8b434e897473af74169515d19b8
[]
no_license
mishafauzel/RealWhatsappClone
https://github.com/mishafauzel/RealWhatsappClone
fa197b66ff37c63ee0816a717a70169c0bcf332d
986116422c26de9f4783adb8af2e14e75f51bb6f
refs/heads/master
2020-09-07T16:52:26.654000
2019-11-10T21:09:37
2019-11-10T21:09:37
214,315,320
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.realwhatsappclone.users.adapter; import android.content.ContentResolver; import com.example.realwhatsappclone.room.UserDatabase; import com.example.realwhatsappclone.room.Users; import com.example.realwhatsappclone.room.UsersDao; import com.google.firebase.database.FirebaseDatabase; import java.util.List; import javax.inject.Inject; public class UsersRepositories { UserDatabase database; UsersDao dao; @Inject public UsersRepositories(UserDatabase database) { dao = database.usersDao(); } public List<Users> getPagedUsers(int limit,int offset) { return dao.getusersByPage(limit, offset); } }
UTF-8
Java
679
java
UsersRepositories.java
Java
[]
null
[]
package com.example.realwhatsappclone.users.adapter; import android.content.ContentResolver; import com.example.realwhatsappclone.room.UserDatabase; import com.example.realwhatsappclone.room.Users; import com.example.realwhatsappclone.room.UsersDao; import com.google.firebase.database.FirebaseDatabase; import java.util.List; import javax.inject.Inject; public class UsersRepositories { UserDatabase database; UsersDao dao; @Inject public UsersRepositories(UserDatabase database) { dao = database.usersDao(); } public List<Users> getPagedUsers(int limit,int offset) { return dao.getusersByPage(limit, offset); } }
679
0.752577
0.752577
29
22.413794
21.490202
58
false
false
0
0
0
0
0
0
0.482759
false
false
8
0675af1aec6519251ebf1bc6896214264169292b
11,347,303,635,035
5ebbb9b598883fa0f3d2bf7edd3eb68e512d74e8
/src/com/BSISJ7/TestMaker/utilities/BracketChecker.java
24d65bea35f7c01c0c685a200a1111fd74aac5e8
[]
no_license
BSISJ7/Vocabulary-Quizzer-v2.0
https://github.com/BSISJ7/Vocabulary-Quizzer-v2.0
a930957b67df3e602f6e92f6477b2e42801454fa
0c635805176da9047fd279137a908d3c65f80156
refs/heads/master
2018-12-16T14:16:15.094000
2018-09-08T22:26:07
2018-09-08T22:26:07
95,496,668
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.BSISJ7.TestMaker.utilities; import javafx.scene.control.TextArea; import javax.swing.*; public class BracketChecker { public static boolean leftIsOpen(String checkString){ int leftBrackets = checkString.split("\\[").length; int rightBrackets = checkString.split("]").length; return (leftBrackets > rightBrackets); } public static boolean rightIsOpen(String checkString){ int leftBrackets = checkString.split("\\[").length; int rightBrackets = checkString.split("]").length; return (leftBrackets > rightBrackets); } public static void removeLeftBracket(){ } public static void removeRightBracket(){ } public static boolean insideBrackets(TextArea pane){ boolean inside = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String rightText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()){ if(rightText.lastIndexOf("[") == -1 || rightText.lastIndexOf("]") < rightText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()){ inside = true; } } return inside; } public static boolean insideBrackets(JTextPane pane){ boolean inside = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String righText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()){ if(righText.lastIndexOf("[") == -1 || righText.lastIndexOf("]") < righText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()){ inside = true; } } return inside; } public static boolean insideBrackets(JTextPane pane, int position){ //try { //System.out.println(); //System.out.println("Text: \"" +(pane.getText(pane.getSelectionEnd(), 1))+"\""); //} catch (BadLocationException e) {} boolean inside = false; String leftText = pane.getText().substring(0, position); String righText = pane.getText().substring(position, pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]")){ if((righText.lastIndexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[")) && righText.indexOf("]") != -1){ inside = true; } } return inside; } public static boolean insideBracketsEnd(JTextPane pane){ boolean inside = false; int position = pane.getSelectionEnd(); String leftText = pane.getText().substring(0, position); String righText = pane.getText().substring(position, pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]")){ if(righText.indexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[")){ inside = true; } } return inside; } public static boolean insideBracketsStart(JTextPane pane){ boolean inside = false; int position = pane.getSelectionStart(); String leftText = pane.getText().substring(0, position); String righText = pane.getText().substring(position, pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < position){ if(righText.lastIndexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[")){ inside = true; } } return inside; } /** * * @param pane * @return whether the first letter to the right of the caret is a bracket or not */ public static boolean isRightBracket(JTextPane pane){ boolean isBracket = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()+1); String righText = pane.getText().substring(pane.getCaretPosition()+1, pane.getText().length()); //Checks if the [ bracket is the fist bracket on the left side of the caret if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()+1){ //Checks if the ] bracket is the first bracket on the right side of the caret if(righText.lastIndexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()+1){ isBracket = true; } } return isBracket; } public static boolean isLeftBracketSelection(JTextPane pane){ boolean isBracket = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String righText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); //firstBracketLocation = pane.getSelectedText().indexOf("]"); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()+1){ if(righText.lastIndexOf("[") == -1 || righText.lastIndexOf("]") < righText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()+1){ isBracket = true; } } return isBracket; } public static boolean isRightBracketSelection(JTextPane pane){ boolean isBracket = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String righText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); //firstBracketLocation = pane.getSelectedText().indexOf("]"); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()+1){ if(righText.lastIndexOf("[") == -1 || righText.lastIndexOf("]") < righText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()+1){ isBracket = true; } } return isBracket; } public static boolean isLeftBracket(JTextPane pane, int checkPosition){ boolean isBracket = false; String startText = pane.getText().substring(checkPosition); try{ String nextText = pane.getText().substring(checkPosition+1); if(startText.indexOf("[") == 0){ if((nextText.indexOf("[") == -1 || nextText.indexOf("]") < nextText.indexOf("[")) && insideBrackets(pane, checkPosition+1)){ isBracket = true; } } }catch(IndexOutOfBoundsException IOOBE){System.out.println("IsLeftBracket: "+IOOBE);} return isBracket; } /** * If the brackets on the left or right side of the selection are open, the closing brackets are selected on either side. * @param textPane */ public static void closeBrackets(JTextPane textPane){ String wholeText = textPane.getText(); String selectedText = textPane.getSelectedText(); System.out.println("closeBrackets Selected Text :"+selectedText); if((selectedText.indexOf("]") < selectedText.indexOf("[") || selectedText.indexOf("[") == -1) && selectedText.indexOf("]") != -1 && insideBracketsStart(textPane)){ String startString = wholeText.substring(0, textPane.getSelectionStart()); textPane.setSelectionStart(startString.lastIndexOf("[")); } if((selectedText.lastIndexOf("[") > selectedText.lastIndexOf("]") || selectedText.indexOf("]") == -1) && selectedText.indexOf("[") != -1 && insideBracketsEnd(textPane)){ String endString = wholeText.substring(textPane.getSelectionEnd(), wholeText.length()); textPane.setSelectionEnd(wholeText.length() - endString.length() + endString.indexOf("]") + 1); } } public static void closeBrackets(JTextPane textPane, int position){ String wholeText = textPane.getText(); int startPos = wholeText.substring(0, position).lastIndexOf(" "); if(startPos > wholeText.length()) {startPos = wholeText.length();} int endPos = wholeText.substring(position, wholeText.length()).indexOf(" "); if(endPos < 0) {endPos = 0;} String selectedWord = wholeText.substring(startPos, endPos); selectedWord.replaceAll("\\.|\\?|!",""); textPane.setText(wholeText.replace(selectedWord, selectedWord)); } }
UTF-8
Java
7,920
java
BracketChecker.java
Java
[]
null
[]
package com.BSISJ7.TestMaker.utilities; import javafx.scene.control.TextArea; import javax.swing.*; public class BracketChecker { public static boolean leftIsOpen(String checkString){ int leftBrackets = checkString.split("\\[").length; int rightBrackets = checkString.split("]").length; return (leftBrackets > rightBrackets); } public static boolean rightIsOpen(String checkString){ int leftBrackets = checkString.split("\\[").length; int rightBrackets = checkString.split("]").length; return (leftBrackets > rightBrackets); } public static void removeLeftBracket(){ } public static void removeRightBracket(){ } public static boolean insideBrackets(TextArea pane){ boolean inside = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String rightText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()){ if(rightText.lastIndexOf("[") == -1 || rightText.lastIndexOf("]") < rightText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()){ inside = true; } } return inside; } public static boolean insideBrackets(JTextPane pane){ boolean inside = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String righText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()){ if(righText.lastIndexOf("[") == -1 || righText.lastIndexOf("]") < righText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()){ inside = true; } } return inside; } public static boolean insideBrackets(JTextPane pane, int position){ //try { //System.out.println(); //System.out.println("Text: \"" +(pane.getText(pane.getSelectionEnd(), 1))+"\""); //} catch (BadLocationException e) {} boolean inside = false; String leftText = pane.getText().substring(0, position); String righText = pane.getText().substring(position, pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]")){ if((righText.lastIndexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[")) && righText.indexOf("]") != -1){ inside = true; } } return inside; } public static boolean insideBracketsEnd(JTextPane pane){ boolean inside = false; int position = pane.getSelectionEnd(); String leftText = pane.getText().substring(0, position); String righText = pane.getText().substring(position, pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]")){ if(righText.indexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[")){ inside = true; } } return inside; } public static boolean insideBracketsStart(JTextPane pane){ boolean inside = false; int position = pane.getSelectionStart(); String leftText = pane.getText().substring(0, position); String righText = pane.getText().substring(position, pane.getText().length()); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < position){ if(righText.lastIndexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[")){ inside = true; } } return inside; } /** * * @param pane * @return whether the first letter to the right of the caret is a bracket or not */ public static boolean isRightBracket(JTextPane pane){ boolean isBracket = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()+1); String righText = pane.getText().substring(pane.getCaretPosition()+1, pane.getText().length()); //Checks if the [ bracket is the fist bracket on the left side of the caret if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()+1){ //Checks if the ] bracket is the first bracket on the right side of the caret if(righText.lastIndexOf("[") == -1 || righText.indexOf("]") < righText.indexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()+1){ isBracket = true; } } return isBracket; } public static boolean isLeftBracketSelection(JTextPane pane){ boolean isBracket = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String righText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); //firstBracketLocation = pane.getSelectedText().indexOf("]"); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()+1){ if(righText.lastIndexOf("[") == -1 || righText.lastIndexOf("]") < righText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()+1){ isBracket = true; } } return isBracket; } public static boolean isRightBracketSelection(JTextPane pane){ boolean isBracket = false; String leftText = pane.getText().substring(0, pane.getCaretPosition()); String righText = pane.getText().substring(pane.getCaretPosition(), pane.getText().length()); //firstBracketLocation = pane.getSelectedText().indexOf("]"); if(leftText.lastIndexOf("[") > leftText.lastIndexOf("]") && leftText.lastIndexOf("[") < pane.getCaretPosition()+1){ if(righText.lastIndexOf("[") == -1 || righText.lastIndexOf("]") < righText.lastIndexOf("[") && leftText.lastIndexOf("]") >= pane.getCaretPosition()+1){ isBracket = true; } } return isBracket; } public static boolean isLeftBracket(JTextPane pane, int checkPosition){ boolean isBracket = false; String startText = pane.getText().substring(checkPosition); try{ String nextText = pane.getText().substring(checkPosition+1); if(startText.indexOf("[") == 0){ if((nextText.indexOf("[") == -1 || nextText.indexOf("]") < nextText.indexOf("[")) && insideBrackets(pane, checkPosition+1)){ isBracket = true; } } }catch(IndexOutOfBoundsException IOOBE){System.out.println("IsLeftBracket: "+IOOBE);} return isBracket; } /** * If the brackets on the left or right side of the selection are open, the closing brackets are selected on either side. * @param textPane */ public static void closeBrackets(JTextPane textPane){ String wholeText = textPane.getText(); String selectedText = textPane.getSelectedText(); System.out.println("closeBrackets Selected Text :"+selectedText); if((selectedText.indexOf("]") < selectedText.indexOf("[") || selectedText.indexOf("[") == -1) && selectedText.indexOf("]") != -1 && insideBracketsStart(textPane)){ String startString = wholeText.substring(0, textPane.getSelectionStart()); textPane.setSelectionStart(startString.lastIndexOf("[")); } if((selectedText.lastIndexOf("[") > selectedText.lastIndexOf("]") || selectedText.indexOf("]") == -1) && selectedText.indexOf("[") != -1 && insideBracketsEnd(textPane)){ String endString = wholeText.substring(textPane.getSelectionEnd(), wholeText.length()); textPane.setSelectionEnd(wholeText.length() - endString.length() + endString.indexOf("]") + 1); } } public static void closeBrackets(JTextPane textPane, int position){ String wholeText = textPane.getText(); int startPos = wholeText.substring(0, position).lastIndexOf(" "); if(startPos > wholeText.length()) {startPos = wholeText.length();} int endPos = wholeText.substring(position, wholeText.length()).indexOf(" "); if(endPos < 0) {endPos = 0;} String selectedWord = wholeText.substring(startPos, endPos); selectedWord.replaceAll("\\.|\\?|!",""); textPane.setText(wholeText.replace(selectedWord, selectedWord)); } }
7,920
0.671591
0.66654
197
38.203045
41.164021
171
false
false
0
0
0
0
0
0
2.497462
false
false
8
928e97bc56e043976c4953e834071d800a537bc5
25,864,293,075,904
7673075de55819545823370421ae86234551e7c7
/Main.java
0afca592f6e61357be869fccbd79dc7ec2244f9c
[]
no_license
latter-yu/200929
https://github.com/latter-yu/200929
cddcdb6d9d10a5b039397abdbd37d5dacd83119b
909e8864072b4de6c693e3d4c357a75ccce18cd9
refs/heads/master
2022-12-23T06:08:24.408000
2020-09-29T12:52:04
2020-09-29T12:52:04
299,614,946
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class Main { public static void main(String[] args) { // 搬家公司正在帮助一家人将小物体装箱。 // 一个箱子的大小是有限的,公司可以把一个箱子分成最多k个独立的隔间 // 将一个箱子分成r个隔间需要r-1个隔板(这一个箱子没有放隔板也拥有一个本身的隔间)。 // 而这一次搬家工作只携带了b个隔板。 // 在每一个隔间中,由于物件放多了容易损坏,最多只能放v个物体。 // 现在这家人有a个物体,请问最少需要多少个箱子,才能将所有的物体装箱? // 输入描述 // 多组数据,每一行一组数据包含4个数,a,b,k,v,空格隔开 // 输出描述 // 输出包含一个数,即最少的箱子数 // 样例输入 // 10 3 2 1 // 10 3 2 2 // 样例输出 // 7 // 3 // 提示 // 范围:1<=a,b,k,v<=100000,数据组数不会超过1000组 // 样例解释: // 对于样例1,第1,2,3个箱子分成两个隔间,使用掉了3个隔板,装了6个物件。第4,5,6,7个箱子没有使用隔板,装了4个物件。共7个箱子装完了所有物件。 // 对于样例2,第1,2个箱子分成两个隔间,使用掉了2个隔板,装了8个物件,最后两个物件装在第三个箱子中。 Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int a = sc.nextInt(); // 总共 a 个物体 int b = sc.nextInt(); // 总共 b 个隔板 int k = sc.nextInt(); // 每个箱子最多 k 个独立空间 int v = sc.nextInt(); // 每个隔间最多放 v 个物品 int s = (b + 1) / k; int count = a / ((b + 1) * v); if (count <= b + 1) { System.out.println(count); } else { int c = a - (b + 1) * v; count += c; count += (c / v); System.out.println(count); } } } }
UTF-8
Java
2,137
java
Main.java
Java
[]
null
[]
import java.util.Scanner; public class Main { public static void main(String[] args) { // 搬家公司正在帮助一家人将小物体装箱。 // 一个箱子的大小是有限的,公司可以把一个箱子分成最多k个独立的隔间 // 将一个箱子分成r个隔间需要r-1个隔板(这一个箱子没有放隔板也拥有一个本身的隔间)。 // 而这一次搬家工作只携带了b个隔板。 // 在每一个隔间中,由于物件放多了容易损坏,最多只能放v个物体。 // 现在这家人有a个物体,请问最少需要多少个箱子,才能将所有的物体装箱? // 输入描述 // 多组数据,每一行一组数据包含4个数,a,b,k,v,空格隔开 // 输出描述 // 输出包含一个数,即最少的箱子数 // 样例输入 // 10 3 2 1 // 10 3 2 2 // 样例输出 // 7 // 3 // 提示 // 范围:1<=a,b,k,v<=100000,数据组数不会超过1000组 // 样例解释: // 对于样例1,第1,2,3个箱子分成两个隔间,使用掉了3个隔板,装了6个物件。第4,5,6,7个箱子没有使用隔板,装了4个物件。共7个箱子装完了所有物件。 // 对于样例2,第1,2个箱子分成两个隔间,使用掉了2个隔板,装了8个物件,最后两个物件装在第三个箱子中。 Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int a = sc.nextInt(); // 总共 a 个物体 int b = sc.nextInt(); // 总共 b 个隔板 int k = sc.nextInt(); // 每个箱子最多 k 个独立空间 int v = sc.nextInt(); // 每个隔间最多放 v 个物品 int s = (b + 1) / k; int count = a / ((b + 1) * v); if (count <= b + 1) { System.out.println(count); } else { int c = a - (b + 1) * v; count += c; count += (c / v); System.out.println(count); } } } }
2,137
0.470926
0.437904
49
27.428572
19.034876
87
false
false
0
0
0
0
0
0
0.530612
false
false
8
7a41bed683a742c227d02abf6223c3b714d960a0
25,280,177,539,391
0ae3172b6f3495e166c7bb6def111acadc7c49ab
/src/com/irisida/lang/part03/chapter10/projects/eggtimer/App.java
40accde81ec9a705d462616506c1083a897288ea
[]
no_license
irisida/javalang
https://github.com/irisida/javalang
db38592efe8ab1b543775ab8c126ed1a99300da7
06e5a023125a7dd1e11c253a41235780b79ecf82
refs/heads/main
2023-02-14T03:42:20.523000
2021-01-11T16:27:15
2021-01-11T16:27:15
321,337,643
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.irisida.lang.part03.chapter10.projects.eggtimer; import java.util.Timer; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class App { public static void main(String[] args) { Timer timer = new Timer(); timer.scheduleAtFixedRate(new IntervalCounter(), 0L, 1000L); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); executor.scheduleAtFixedRate(new Completed(), 0L, 1L, TimeUnit.MINUTES); } }
UTF-8
Java
558
java
App.java
Java
[]
null
[]
package com.irisida.lang.part03.chapter10.projects.eggtimer; import java.util.Timer; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class App { public static void main(String[] args) { Timer timer = new Timer(); timer.scheduleAtFixedRate(new IntervalCounter(), 0L, 1000L); ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); executor.scheduleAtFixedRate(new Completed(), 0L, 1L, TimeUnit.MINUTES); } }
558
0.747312
0.725806
17
31.82353
28.076021
80
false
false
0
0
0
0
0
0
0.823529
false
false
8
d4ec3e666301f282599ab43c72aa356b563aa530
18,107,582,138,240
912e732bdfd424674b4323197321aba849eff0ee
/src/main/java/com/wwwy/liuxing/area/dao/impl/AreaDAO.java
7af9e1513eefc62857a5f9b3b09d13660c72b0f8
[]
no_license
OdyWANGJIAN/buyTicket
https://github.com/OdyWANGJIAN/buyTicket
4817645632e307ee01bb343fc4ace5c268dbb3f9
af2aaa4dde685e6018fc964419e8e7b6bdd6aeb3
refs/heads/master
2020-03-27T23:20:13.330000
2018-09-04T08:20:41
2018-09-04T08:20:41
147,310,857
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wwwy.liuxing.area.dao.impl; import com.wwwy.liuxing.area.dao.IAreaDAO; import com.wwwy.liuxing.area.dto.AreaDTO; import com.wwwy.liuxing.city.dto.CityDTO; import com.wwwy.liuxing.system.SysConfig; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.support.SqlSessionDaoSupport; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * @author W1665 * @date 2018/4/11 */ @Repository public class AreaDAO extends SqlSessionDaoSupport implements IAreaDAO { @Autowired @Override public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { super.setSqlSessionFactory(sqlSessionFactory); } /** * 根据城市查询所有地区 * @param cityId * @return * @throws Exception */ @Override public List<AreaDTO> queryAll(Integer cityId) throws Exception { List<AreaDTO> list = getSqlSession().selectList("com.wwwy.liuxin.area.dto.AreaMapper.queryAllArea",cityId); return list; } @Override public List<AreaDTO> queryAllArea(Integer cityId) throws Exception{ List<AreaDTO> list = getSqlSession().selectList("com.wwwy.liuxin.area.dto.AreaMapper.queryAllArea",cityId); return list; } @Override public AreaDTO queryAreaById(Integer areaId) throws Exception { AreaDTO area = getSqlSession().selectOne("com.wwwy.liuxin.area.dto.AreaMapper.queryAreaById", areaId); return area; } @Override public Boolean insertArea(AreaDTO areaDTO)throws Exception { int insert = getSqlSession().insert("com.wwwy.liuxin.area.dto.AreaMapper.insertArea", areaDTO); return insert< SysConfig.BeforeConfig.PAGE_START?false:true; } @Override public Boolean deleteArea(Integer areaId)throws Exception { int delete = getSqlSession().delete("com.wwwy.liuxin.area.dto.AreaMapper.deleteArea", areaId); return delete< SysConfig.BeforeConfig.PAGE_START?false:true; } @Override public Boolean updateArea(AreaDTO areaDTO)throws Exception { int update = getSqlSession().update("com.wwwy.liuxin.area.dto.AreaMapper.updateArea", areaDTO); return update< SysConfig.BeforeConfig.PAGE_START?false:true; } @Override public List<AreaDTO> queryAreaByAny(String anyInfo) throws Exception { List<AreaDTO> list = getSqlSession().selectList("com.wwwy.liuxin.area.dto.AreaMapper.queryAny", anyInfo); return list; } @Override public Boolean deleteBatchAreas(int[] areaId) throws Exception { int delete = getSqlSession().delete("com.wwwy.liuxin.area.dto.AreaMapper.batchDeleteAreas", areaId); return delete< SysConfig.BeforeConfig.PAGE_START?false:true; } }
UTF-8
Java
2,872
java
AreaDAO.java
Java
[ { "context": "til.List;\nimport java.util.Map;\n\n/**\n *\n * @author W1665\n * @date 2018/4/11\n */\n@Repository\npublic class A", "end": 527, "score": 0.9994797706604004, "start": 522, "tag": "USERNAME", "value": "W1665" } ]
null
[]
package com.wwwy.liuxing.area.dao.impl; import com.wwwy.liuxing.area.dao.IAreaDAO; import com.wwwy.liuxing.area.dto.AreaDTO; import com.wwwy.liuxing.city.dto.CityDTO; import com.wwwy.liuxing.system.SysConfig; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.support.SqlSessionDaoSupport; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * @author W1665 * @date 2018/4/11 */ @Repository public class AreaDAO extends SqlSessionDaoSupport implements IAreaDAO { @Autowired @Override public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) { super.setSqlSessionFactory(sqlSessionFactory); } /** * 根据城市查询所有地区 * @param cityId * @return * @throws Exception */ @Override public List<AreaDTO> queryAll(Integer cityId) throws Exception { List<AreaDTO> list = getSqlSession().selectList("com.wwwy.liuxin.area.dto.AreaMapper.queryAllArea",cityId); return list; } @Override public List<AreaDTO> queryAllArea(Integer cityId) throws Exception{ List<AreaDTO> list = getSqlSession().selectList("com.wwwy.liuxin.area.dto.AreaMapper.queryAllArea",cityId); return list; } @Override public AreaDTO queryAreaById(Integer areaId) throws Exception { AreaDTO area = getSqlSession().selectOne("com.wwwy.liuxin.area.dto.AreaMapper.queryAreaById", areaId); return area; } @Override public Boolean insertArea(AreaDTO areaDTO)throws Exception { int insert = getSqlSession().insert("com.wwwy.liuxin.area.dto.AreaMapper.insertArea", areaDTO); return insert< SysConfig.BeforeConfig.PAGE_START?false:true; } @Override public Boolean deleteArea(Integer areaId)throws Exception { int delete = getSqlSession().delete("com.wwwy.liuxin.area.dto.AreaMapper.deleteArea", areaId); return delete< SysConfig.BeforeConfig.PAGE_START?false:true; } @Override public Boolean updateArea(AreaDTO areaDTO)throws Exception { int update = getSqlSession().update("com.wwwy.liuxin.area.dto.AreaMapper.updateArea", areaDTO); return update< SysConfig.BeforeConfig.PAGE_START?false:true; } @Override public List<AreaDTO> queryAreaByAny(String anyInfo) throws Exception { List<AreaDTO> list = getSqlSession().selectList("com.wwwy.liuxin.area.dto.AreaMapper.queryAny", anyInfo); return list; } @Override public Boolean deleteBatchAreas(int[] areaId) throws Exception { int delete = getSqlSession().delete("com.wwwy.liuxin.area.dto.AreaMapper.batchDeleteAreas", areaId); return delete< SysConfig.BeforeConfig.PAGE_START?false:true; } }
2,872
0.72195
0.718093
84
32.952381
34.409962
115
false
false
0
0
0
0
0
0
0.440476
false
false
8
d4f4d525e194e51322a9924e944f9ba26d0fe4f9
30,794,915,532,299
4e6cd658b49fd53cee639cd8c4809fd072947662
/src/sam/tictactoe/TCPLink.java
800fae3656fb8b70788bdaca147f2c2fdaa06fab
[ "Unlicense" ]
permissive
samcarlinone/TicTacJavac
https://github.com/samcarlinone/TicTacJavac
eca01d6c67674ef34f5b16cf19fc9768d4dfe5fd
60d74ed87789ef5827c9c10c7d97c846da7dbcf0
refs/heads/master
2021-01-11T14:57:13.731000
2017-02-03T14:45:55
2017-02-03T14:45:55
80,258,744
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sam.tictactoe; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; /** * Created by CARLINSE1 on 1/31/2017. */ public class TCPLink { public Boolean isHost = false; private ServerSocket server_socket; private Socket socket; private BufferedReader read; private DataOutputStream write; static private int PORT = 23658; public TCPLink(String host) throws IOException { if(host == "") { server_socket = new ServerSocket(PORT); socket = server_socket.accept(); isHost = true; } else { socket = new Socket(host, PORT); } read = new BufferedReader(new InputStreamReader(socket.getInputStream())); write = new DataOutputStream(socket.getOutputStream()); } /** * Get the first message from connected TCPLink * @return String containing message */ public String read() { try { return read.readLine(); } catch(IOException e) { System.out.println("TCP Recieve Failed"); return ""; } } /** * Sends a message to connected TCPLink * @param tx String containing message, does not need to be newline terminated */ public void write(String tx) { if(!tx.endsWith("\n")) tx = tx+"\n"; try { write.writeBytes(tx); } catch(IOException e) { System.out.println("TCP Send Failed"); return; } } }
UTF-8
Java
1,634
java
TCPLink.java
Java
[ { "context": "Socket;\nimport java.net.Socket;\n\n/**\n * Created by CARLINSE1 on 1/31/2017.\n */\npublic class TCPLink {\n publ", "end": 232, "score": 0.9996505379676819, "start": 223, "tag": "USERNAME", "value": "CARLINSE1" } ]
null
[]
package sam.tictactoe; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; /** * Created by CARLINSE1 on 1/31/2017. */ public class TCPLink { public Boolean isHost = false; private ServerSocket server_socket; private Socket socket; private BufferedReader read; private DataOutputStream write; static private int PORT = 23658; public TCPLink(String host) throws IOException { if(host == "") { server_socket = new ServerSocket(PORT); socket = server_socket.accept(); isHost = true; } else { socket = new Socket(host, PORT); } read = new BufferedReader(new InputStreamReader(socket.getInputStream())); write = new DataOutputStream(socket.getOutputStream()); } /** * Get the first message from connected TCPLink * @return String containing message */ public String read() { try { return read.readLine(); } catch(IOException e) { System.out.println("TCP Recieve Failed"); return ""; } } /** * Sends a message to connected TCPLink * @param tx String containing message, does not need to be newline terminated */ public void write(String tx) { if(!tx.endsWith("\n")) tx = tx+"\n"; try { write.writeBytes(tx); } catch(IOException e) { System.out.println("TCP Send Failed"); return; } } }
1,634
0.596695
0.588739
65
24.138462
19.756111
82
false
false
0
0
0
0
0
0
0.430769
false
false
8
b5ee8b5eb249ca83c1879c53cd32815ea28134d7
22,316,650,111,653
bfcf8981e22178b70a7e82c65226be65811db6a0
/spring-01-ioc/src/test/java/MyTest.java
14eacb04fc8bf138ceb50bb9904a77bc7ac25855
[]
no_license
PXNPXN/spring_study
https://github.com/PXNPXN/spring_study
18a2210575a9a3c185302fcdf9c794467b1af13d
728ac08bf1f0b14ef6a53c003db24a782d809ab8
refs/heads/master
2023-06-15T23:19:04.963000
2021-07-14T16:25:07
2021-07-14T16:25:07
386,004,180
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import com.cunshan.dao.UserDaoMysqlImpl; import com.cunshan.dao.UserDaoOracleImpl; import com.cunshan.service.UserService; import com.cunshan.service.UserServiceImpl; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MyTest { public static void main(String[] args) { //用户实际上是调业务层,dao层他们不需要解除! // UserService userService = new UserServiceImpl(); // userService.setUser(new UserDaoOracleImpl()); // userService.getUser(); //获取ApplicationContext,拿到spring的容器 ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); //容器在手,天下我有,需要什么,就直接get什么! UserServiceImpl userServiceImpl = (UserServiceImpl) context.getBean("UserServiceImpl"); userServiceImpl.getUser(); } }
GB18030
Java
963
java
MyTest.java
Java
[]
null
[]
import com.cunshan.dao.UserDaoMysqlImpl; import com.cunshan.dao.UserDaoOracleImpl; import com.cunshan.service.UserService; import com.cunshan.service.UserServiceImpl; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MyTest { public static void main(String[] args) { //用户实际上是调业务层,dao层他们不需要解除! // UserService userService = new UserServiceImpl(); // userService.setUser(new UserDaoOracleImpl()); // userService.getUser(); //获取ApplicationContext,拿到spring的容器 ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); //容器在手,天下我有,需要什么,就直接get什么! UserServiceImpl userServiceImpl = (UserServiceImpl) context.getBean("UserServiceImpl"); userServiceImpl.getUser(); } }
963
0.749712
0.749712
24
35.125
28.168116
98
false
false
0
0
0
0
0
0
0.5
false
false
8
c0760d1108815b2f75ecfc3266bd9b0df9af485e
12,017,318,535,839
a88e8ffff5e61f86afe1915e548625e23eb354f1
/mom/src/main/java/vancanh1/entity/ThongKe.java
6534003ec41f622500cb214719bb1dbd91cc89e1
[]
no_license
vancanh3/adam12
https://github.com/vancanh3/adam12
2765497cfe0ab6e8208f2940a71cf67c2af5e77b
f983c0ca12266c3d0932f80f52b05eb54169ff58
refs/heads/master
2020-04-30T08:06:03.168000
2019-03-21T08:22:20
2019-03-21T08:22:20
176,705,022
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vancanh1.entity; public class ThongKe { private String xepLoai; private int soLuong; private double tyle; public ThongKe() { } public String getXepLoai() { return xepLoai; } public void setXepLoai(String xepLoai) { this.xepLoai = xepLoai; } public int getSoLuong() { return soLuong; } public void setSoLuong(int soLuong) { this.soLuong = soLuong; } public double getTyle() { return tyle; } public void setTyle(double tyle) { this.tyle = tyle; } }
UTF-8
Java
579
java
ThongKe.java
Java
[]
null
[]
package vancanh1.entity; public class ThongKe { private String xepLoai; private int soLuong; private double tyle; public ThongKe() { } public String getXepLoai() { return xepLoai; } public void setXepLoai(String xepLoai) { this.xepLoai = xepLoai; } public int getSoLuong() { return soLuong; } public void setSoLuong(int soLuong) { this.soLuong = soLuong; } public double getTyle() { return tyle; } public void setTyle(double tyle) { this.tyle = tyle; } }
579
0.587219
0.585492
34
16.029411
13.971579
44
false
false
0
0
0
0
0
0
0.294118
false
false
8
2ec1f89656d7b4c37e7888799dc834fce2f58bd3
33,191,507,302,323
d6a3dca91086fa9cd3ffd583f00362e9e5fb1a70
/ELS_server/src/data_server/documentsdata/DeliveryOrderdata.java
17469c2eebd3243cab838387ca638fb208fb5d77
[]
no_license
zttttt/ELS
https://github.com/zttttt/ELS
4ba102735aa8befaa1a8347040802d5d6a43b959
5e994505c60e7de31347599e3a8fec3d2d9c7cb6
refs/heads/master
2021-01-15T14:01:51.340000
2015-10-23T07:21:59
2015-10-23T07:21:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package data_server.documentsdata; import dataservice_server.documentsdataservice.DeliveryOrderdataservice; public class DeliveryOrderdata implements DeliveryOrderdataservice { }
UTF-8
Java
182
java
DeliveryOrderdata.java
Java
[]
null
[]
package data_server.documentsdata; import dataservice_server.documentsdataservice.DeliveryOrderdataservice; public class DeliveryOrderdata implements DeliveryOrderdataservice { }
182
0.873626
0.873626
7
25
30.682709
72
false
false
0
0
0
0
0
0
0.285714
false
false
8
5fe82c0af28925a897bc72afde639619c307038a
14,087,492,750,668
0d1cfbb2746620154f785eb439cdfec6cee2cbd4
/src/dev/soli/productionWatchdog/mobileStations/MobileStationServer.java
bf0081afdb8dd4f7e0f4a4a3f979d8341933071e
[]
no_license
soli1411/Controller
https://github.com/soli1411/Controller
e254b3e0932d3427acf1b4efbfa21687d59107c3
02346b5e53150f01fe939f0959133b10911376e2
refs/heads/master
2016-09-22T07:33:47.197000
2016-07-12T09:47:18
2016-07-12T09:47:18
62,085,159
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dev.soli.productionWatchdog.mobileStations; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.InetAddress; import java.net.Socket; public class MobileStationServer extends Thread{ private Socket socket=null; /** * * Creates a listener over the specified socket for a mobile station. * * @param socket * */ public MobileStationServer(Socket socket){ this.socket=socket; } /** * * Gets the string data sent by the mobile station over TCP/IP protocol and handles it. * */ @Override public void run(){ InetAddress address = socket.getInetAddress(); String client = address.getHostName(); int porta = socket.getPort(); System.out.println("Connected with client: "+ client + " porta: " + porta); try { new DataInputStream(socket.getInputStream()); } catch (IOException e) { e.printStackTrace(); } BufferedReader d = null; try { d = new BufferedReader(new InputStreamReader(socket.getInputStream())); } catch (IOException e) { e.printStackTrace(); } try { new DataOutputStream(socket.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } while (true) { String input = null; try { input = d.readLine(); } catch (IOException e) { e.printStackTrace(); } System.out.println(input); if (input==null){ System.out.println("Connection interrupted with client: "+ client + " porta: " + porta); break; } else { handleInput(input); } } try { this.join(); } catch (InterruptedException e) { e.printStackTrace(); } } /** * * Handles received input from the mobile station. * * @param input * */ private void handleInput(String input) { //TODO: database related part. String[] inputParts=input.split(" "); String role=inputParts[0]; String id_number=inputParts[1]; String actionTaken=inputParts[2]; StringBuilder desc = new StringBuilder(inputParts[3]); for (int i = 3; i < inputParts.length; i++){ desc.append(" "+inputParts[i]); } String description=desc.toString(); System.out.println("Agent="+role+" "+id_number); System.out.println("Action="+actionTaken); System.out.println("Description="+description); } }
UTF-8
Java
2,437
java
MobileStationServer.java
Java
[]
null
[]
package dev.soli.productionWatchdog.mobileStations; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.InetAddress; import java.net.Socket; public class MobileStationServer extends Thread{ private Socket socket=null; /** * * Creates a listener over the specified socket for a mobile station. * * @param socket * */ public MobileStationServer(Socket socket){ this.socket=socket; } /** * * Gets the string data sent by the mobile station over TCP/IP protocol and handles it. * */ @Override public void run(){ InetAddress address = socket.getInetAddress(); String client = address.getHostName(); int porta = socket.getPort(); System.out.println("Connected with client: "+ client + " porta: " + porta); try { new DataInputStream(socket.getInputStream()); } catch (IOException e) { e.printStackTrace(); } BufferedReader d = null; try { d = new BufferedReader(new InputStreamReader(socket.getInputStream())); } catch (IOException e) { e.printStackTrace(); } try { new DataOutputStream(socket.getOutputStream()); } catch (IOException e) { e.printStackTrace(); } while (true) { String input = null; try { input = d.readLine(); } catch (IOException e) { e.printStackTrace(); } System.out.println(input); if (input==null){ System.out.println("Connection interrupted with client: "+ client + " porta: " + porta); break; } else { handleInput(input); } } try { this.join(); } catch (InterruptedException e) { e.printStackTrace(); } } /** * * Handles received input from the mobile station. * * @param input * */ private void handleInput(String input) { //TODO: database related part. String[] inputParts=input.split(" "); String role=inputParts[0]; String id_number=inputParts[1]; String actionTaken=inputParts[2]; StringBuilder desc = new StringBuilder(inputParts[3]); for (int i = 3; i < inputParts.length; i++){ desc.append(" "+inputParts[i]); } String description=desc.toString(); System.out.println("Agent="+role+" "+id_number); System.out.println("Action="+actionTaken); System.out.println("Description="+description); } }
2,437
0.646697
0.644645
99
22.616161
20.825251
92
false
false
0
0
0
0
0
0
2.111111
false
false
8
7db6dcb810fa84c30d1851d739ce379d12c0854f
1,597,727,866,054
ac2fe779c4df821dd4224358ac9c4744c3d077f6
/nacos_config_test/src/main/java/com/java123/controller/NaCosConfigController.java
305a87d980d4f9c95262a2fd6686d0598da8facb
[]
no_license
yu1085/springcloudAlibaba
https://github.com/yu1085/springcloudAlibaba
d401d0df345cd9fc17fb72857bc6e999f29cf03a
50d05ce60dd7bfabdb38ae18d5b71d1727e42298
refs/heads/master
2023-07-19T19:54:21.032000
2021-09-01T01:23:27
2021-09-01T01:23:27
396,272,516
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.java123.controller; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RefreshScope @RestController @RequestMapping("/nacos") public class NaCosConfigController { @Value("${java1234.name}") private String name; @Value("${java1234.age}") private String age; @RequestMapping("/test") public String getConfigInfo() { return name + " : " + age; } }
UTF-8
Java
607
java
NaCosConfigController.java
Java
[]
null
[]
package com.java123.controller; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RefreshScope @RestController @RequestMapping("/nacos") public class NaCosConfigController { @Value("${java1234.name}") private String name; @Value("${java1234.age}") private String age; @RequestMapping("/test") public String getConfigInfo() { return name + " : " + age; } }
607
0.742998
0.724876
24
24.291666
21.782024
72
false
false
0
0
0
0
0
0
0.333333
false
false
8
0b3780b2242a2dbcb870a4d3f057b4476e1030cf
515,396,083,036
6d6e94f165f1d80fb11b604f080b4b0828f81b9c
/src/main/java/com/rectuscorp/evetool/dao/IdaoCorporation.java
90b326b19eb9ee531c9ae57127d2649e092cad65
[]
no_license
rectus29/Bait-for-Eve
https://github.com/rectus29/Bait-for-Eve
cca3f9bd79b5a610098a274178c2a906d2cb4138
36960395702f3616a48739b2d9739b8faee24b1d
refs/heads/master
2021-01-18T03:09:44.567000
2018-05-30T13:22:37
2018-05-30T13:22:37
28,225,895
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rectuscorp.evetool.dao; import com.rectuscorp.evetool.entities.crest.Corporation; /** * User: Rectus_29 * Date: 10/02/16 */ public interface IdaoCorporation extends GenericDao<Corporation, Long> { }
UTF-8
Java
217
java
IdaoCorporation.java
Java
[ { "context": ".evetool.entities.crest.Corporation;\n\n/**\n * User: Rectus_29\n * Date: 10/02/16\n */\npublic interface IdaoCorpor", "end": 118, "score": 0.9995834231376648, "start": 109, "tag": "USERNAME", "value": "Rectus_29" } ]
null
[]
package com.rectuscorp.evetool.dao; import com.rectuscorp.evetool.entities.crest.Corporation; /** * User: Rectus_29 * Date: 10/02/16 */ public interface IdaoCorporation extends GenericDao<Corporation, Long> { }
217
0.75576
0.718894
11
18.727272
24.181477
72
false
false
0
0
0
0
0
0
0.272727
false
false
8
36ed8a9c5ab18755f0d7fd6e1802a0a4481ff59e
19,378,892,462,881
61f6861dd149115109d2ef3bb8ce0e16264429dd
/app/src/main/java/is/arnarjons/example/testing/DataStorage/Instances/EntryStamp.java
38ac6c12fac5195c2db0772788e841745b8b6224
[]
no_license
ArnJonsson/Testing
https://github.com/ArnJonsson/Testing
acbac9fa37828c6a4515cc58674bc2a8e1fd3878
c3cf9a1e2a95aaa0ad06304eb82520db5fb3eab0
refs/heads/master
2015-08-23T22:52:55.722000
2015-05-03T07:38:31
2015-05-03T07:38:31
34,902,130
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package is.arnarjons.example.testing.DataStorage.Instances; import is.arnarjons.example.testing.DataStorage.Objects.DataStamp; /** * Created by arnarjons on 1.5.2015. */ public class EntryStamp extends DataStamp { /// // EntryStamp - FS without timestamps /// public EntryStamp(int id, double latitude, double longitude, String name, String cardGroup, String mallGroup, boolean timeStamp, String longDescription, String shortDescription, boolean enable, int pingRadius) { super(DataStamp.DATASTAMP_TYPE_ENTRY, DataStamp.ENTRYSTAMP_TYPE_FS, id, latitude, longitude, name, cardGroup, mallGroup, timeStamp, longDescription, shortDescription, enable, pingRadius); } /// // EntryStamp - FS with timestamps /// public EntryStamp(int id, double latitude, double longitude, String name, String cardGroup, String mallGroup, boolean timeStamp, String longDescription, String shortDescription, boolean enable, int pingRadius, String timeStart, String timeStop) { super(DataStamp.DATASTAMP_TYPE_ENTRY, DataStamp.ENTRYSTAMP_TYPE_FS, id, latitude, longitude, name, cardGroup, mallGroup, timeStamp, longDescription, shortDescription, enable, pingRadius, timeStart, timeStop); } /// // EntryStamp - FSMG stamp /// public EntryStamp(int id, double latitude, double longitude, String name, boolean enable, int pingRadius) { super(DataStamp.DATASTAMP_TYPE_ENTRY, DataStamp.ENTRYSTAMP_TYPE_FSMG, id, latitude, longitude, name, enable, pingRadius); } }
UTF-8
Java
2,251
java
EntryStamp.java
Java
[ { "context": ".DataStorage.Objects.DataStamp;\n\n/**\n * Created by arnarjons on 1.5.2015.\n */\npublic class EntryStamp extends ", "end": 156, "score": 0.9996294975280762, "start": 147, "tag": "USERNAME", "value": "arnarjons" } ]
null
[]
package is.arnarjons.example.testing.DataStorage.Instances; import is.arnarjons.example.testing.DataStorage.Objects.DataStamp; /** * Created by arnarjons on 1.5.2015. */ public class EntryStamp extends DataStamp { /// // EntryStamp - FS without timestamps /// public EntryStamp(int id, double latitude, double longitude, String name, String cardGroup, String mallGroup, boolean timeStamp, String longDescription, String shortDescription, boolean enable, int pingRadius) { super(DataStamp.DATASTAMP_TYPE_ENTRY, DataStamp.ENTRYSTAMP_TYPE_FS, id, latitude, longitude, name, cardGroup, mallGroup, timeStamp, longDescription, shortDescription, enable, pingRadius); } /// // EntryStamp - FS with timestamps /// public EntryStamp(int id, double latitude, double longitude, String name, String cardGroup, String mallGroup, boolean timeStamp, String longDescription, String shortDescription, boolean enable, int pingRadius, String timeStart, String timeStop) { super(DataStamp.DATASTAMP_TYPE_ENTRY, DataStamp.ENTRYSTAMP_TYPE_FS, id, latitude, longitude, name, cardGroup, mallGroup, timeStamp, longDescription, shortDescription, enable, pingRadius, timeStart, timeStop); } /// // EntryStamp - FSMG stamp /// public EntryStamp(int id, double latitude, double longitude, String name, boolean enable, int pingRadius) { super(DataStamp.DATASTAMP_TYPE_ENTRY, DataStamp.ENTRYSTAMP_TYPE_FSMG, id, latitude, longitude, name, enable, pingRadius); } }
2,251
0.50422
0.501555
71
30.704226
22.625795
96
false
false
0
0
0
0
0
0
0.915493
false
false
8
e577522ee9d3ca625f30aaf4bfa0011759488cb1
19,378,892,465,964
71d343c7c5d329e1e4852118dbb56bc1d9d3d28b
/app/src/main/java/com/WZYHome/Study/Demo/Adapter/pulldownBaseAdapter.java
d95242baeb9d6102c97d00226e26665f3da664c6
[]
no_license
jackjames8/WZYHome
https://github.com/jackjames8/WZYHome
210f04bc3587754e3ea2f5464ac03532c0fbdc5b
9aa7bade05e10e6650e73a161a8232e9cd73c2e4
refs/heads/master
2020-03-18T19:45:48.943000
2019-10-20T03:43:25
2019-10-20T03:43:25
135,176,244
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.WZYHome.Study.Demo.Adapter; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import java.util.List; /** * Created by Administrator on 2018/7/23. */ public class pulldownBaseAdapter extends BaseAdapter { private List<String> mList; private Context mContext; public pulldownBaseAdapter(List<String> mList1,Context mContext1) { this.mList=mList1; this.mContext=mContext1; } @Override public int getCount() { return mList.size(); } @Override public Object getItem(int position) { return mList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView = new TextView(mContext); textView.setText(mList.get(position)); textView.setTextColor(mContext.getResources() .getColor(android.R.color.black)); textView.setBackgroundColor(mContext.getResources() .getColor(android.R.color.white)); textView.setTextSize(25); return textView; } }
UTF-8
Java
1,360
java
pulldownBaseAdapter.java
Java
[ { "context": "xtView;\n\nimport java.util.List;\n\n/**\n * Created by Administrator on 2018/7/23.\n */\n\npublic class pulldownBaseAdapt", "end": 253, "score": 0.9144649505615234, "start": 240, "tag": "NAME", "value": "Administrator" } ]
null
[]
package com.WZYHome.Study.Demo.Adapter; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import java.util.List; /** * Created by Administrator on 2018/7/23. */ public class pulldownBaseAdapter extends BaseAdapter { private List<String> mList; private Context mContext; public pulldownBaseAdapter(List<String> mList1,Context mContext1) { this.mList=mList1; this.mContext=mContext1; } @Override public int getCount() { return mList.size(); } @Override public Object getItem(int position) { return mList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView = new TextView(mContext); textView.setText(mList.get(position)); textView.setTextColor(mContext.getResources() .getColor(android.R.color.black)); textView.setBackgroundColor(mContext.getResources() .getColor(android.R.color.white)); textView.setTextSize(25); return textView; } }
1,360
0.628676
0.619118
50
26.18
21.078606
79
false
false
0
0
0
0
0
0
0.46
false
false
8
548a5e542f24a50488a0ae0959ceded189284618
962,072,710,390
ba332ad15fdc38d1120cbd0069f89e672ff1525e
/src/main/java/com/hkesports/matchticker/service/impl/ScheduleGameServiceImpl.java
6d6a6d2ff6f3b7b4eb1cc507f97d4020b980b442
[]
no_license
ilee9999/testinghub1026
https://github.com/ilee9999/testinghub1026
d9aed611e67e2e9b6a7265db61ab292516ed2c74
69c42f58dcbe8fb9e84fdc86f2ec7fd556a20d36
refs/heads/master
2021-01-10T09:43:11.590000
2015-10-26T09:02:04
2015-10-26T09:02:04
44,956,956
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hkesports.matchticker.service.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.hkesports.matchticker.model.batchJob.ScheduleGame; import com.hkesports.matchticker.repository.ScheduleGameDao; import com.hkesports.matchticker.repository.factory.GenericRepository; import com.hkesports.matchticker.service.ScheduleGameService; @Service("scheduleGameService") public class ScheduleGameServiceImpl extends BasicServiceImpl<ScheduleGame> implements ScheduleGameService { @Resource private ScheduleGameDao scheduleGameDao; @Override protected GenericRepository<ScheduleGame, Long> getDao() { return scheduleGameDao; } }
UTF-8
Java
689
java
ScheduleGameServiceImpl.java
Java
[]
null
[]
package com.hkesports.matchticker.service.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.hkesports.matchticker.model.batchJob.ScheduleGame; import com.hkesports.matchticker.repository.ScheduleGameDao; import com.hkesports.matchticker.repository.factory.GenericRepository; import com.hkesports.matchticker.service.ScheduleGameService; @Service("scheduleGameService") public class ScheduleGameServiceImpl extends BasicServiceImpl<ScheduleGame> implements ScheduleGameService { @Resource private ScheduleGameDao scheduleGameDao; @Override protected GenericRepository<ScheduleGame, Long> getDao() { return scheduleGameDao; } }
689
0.846154
0.846154
23
28.956522
29.991997
108
false
false
0
0
0
0
0
0
0.782609
false
false
8
990b0d593a95430c9b71fe21bb573fdff269a006
32,590,211,889,216
40d0f44a9399a70bba22e1d0316a6413788d89cd
/analyzer/src/test/java/pro/crypto/analyzer/cfo/CFOAnalyzerTest.java
5316e5908de8be3e643d465f9e33782f5bdb32de
[]
no_license
CaymanJava/crypto-analyzer
https://github.com/CaymanJava/crypto-analyzer
45352dbe84ae7d98b8b117c54abc0e0b418fd531
91f0965b36a5f221fedce53abeb6fa5fb83b4cc3
refs/heads/master
2023-02-20T03:52:54.798000
2019-12-20T14:55:41
2019-12-20T14:55:41
122,776,981
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pro.crypto.analyzer.cfo; import org.junit.Test; import pro.crypto.analyzer.AnalyzerBaseTest; import pro.crypto.indicator.cfo.CFOResult; import pro.crypto.model.AnalyzerRequest; import pro.crypto.model.result.AnalyzerResult; import static org.junit.Assert.assertArrayEquals; public class CFOAnalyzerTest extends AnalyzerBaseTest { @Test public void testChandeForecastOscillatorAnalyzer() { AnalyzerResult[] expectedResult = loadAnalyzerExpectedResult("cfo_analyzer.json", CFOAnalyzerResult[].class); CFOAnalyzerResult[] actualResult = new CFOAnalyzer(buildCFOAnalyzerRequest()).getResult(); assertArrayEquals(expectedResult, actualResult); } private AnalyzerRequest buildCFOAnalyzerRequest() { return CFOAnalyzerRequest.builder() .originalData(originalData) .indicatorResults(loadIndicatorResult("cfo_indicator.json", CFOResult[].class)) .oversoldLevel(-0.5) .overboughtLevel(0.5) .build(); } }
UTF-8
Java
1,040
java
CFOAnalyzerTest.java
Java
[]
null
[]
package pro.crypto.analyzer.cfo; import org.junit.Test; import pro.crypto.analyzer.AnalyzerBaseTest; import pro.crypto.indicator.cfo.CFOResult; import pro.crypto.model.AnalyzerRequest; import pro.crypto.model.result.AnalyzerResult; import static org.junit.Assert.assertArrayEquals; public class CFOAnalyzerTest extends AnalyzerBaseTest { @Test public void testChandeForecastOscillatorAnalyzer() { AnalyzerResult[] expectedResult = loadAnalyzerExpectedResult("cfo_analyzer.json", CFOAnalyzerResult[].class); CFOAnalyzerResult[] actualResult = new CFOAnalyzer(buildCFOAnalyzerRequest()).getResult(); assertArrayEquals(expectedResult, actualResult); } private AnalyzerRequest buildCFOAnalyzerRequest() { return CFOAnalyzerRequest.builder() .originalData(originalData) .indicatorResults(loadIndicatorResult("cfo_indicator.json", CFOResult[].class)) .oversoldLevel(-0.5) .overboughtLevel(0.5) .build(); } }
1,040
0.719231
0.715385
29
34.862068
30.983561
117
false
false
0
0
0
0
0
0
0.482759
false
false
8
e60197d099038a174f397a670d4bb9f02fa77845
28,535,762,762,683
eb49726e18394eb07b9ddaa0eb4826895973a6e9
/src/org/apache/catalina/session/PersistentManagerBaseRemoteInterface.java
46d65c8dd6c39706a2a99da37d2afe2d30a67f93
[]
no_license
dexterorion/2nuvensprocessado
https://github.com/dexterorion/2nuvensprocessado
a00ca8869bf40383546316f8fc10c6226d92400d
02ec43a1eee19dcf9e02284393084199a426e415
refs/heads/master
2019-05-24T21:11:30.409000
2015-07-02T13:15:43
2015-07-02T13:15:43
38,433,657
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apache.catalina.session; import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.catalina.DistributedManager; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; import org.apache.catalina.Session2; import org.apache.catalina.Store; import org.apache.catalina.security.SecurityUtil; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.catalina.session.ManagerBaseRemoteInterface; import java.rmi.Remote; import java.rmi.RemoteException; import java.io.Serializable; public interface PersistentManagerBaseRemoteInterface extends Remote, Serializable, ManagerBaseRemoteInterface, DistributedManager{ public int getMaxIdleBackup() throws RemoteException, RemoteException; public void setMaxIdleBackup(int backup) throws RemoteException, RemoteException; public int getMaxIdleSwap() throws RemoteException, RemoteException; public void setMaxIdleSwap(int max) throws RemoteException, RemoteException; public int getMinIdleSwap() throws RemoteException, RemoteException; public void setMinIdleSwap(int min) throws RemoteException, RemoteException; public String getInfo() throws RemoteException, RemoteException; public boolean isLoaded(String id) throws RemoteException, RemoteException; public String getName() throws RemoteException, RemoteException; public void setStore(Store store) throws RemoteException, RemoteException; public Store getStore() throws RemoteException, RemoteException; public boolean getSaveOnRestart() throws RemoteException, RemoteException; public void setSaveOnRestart(boolean saveOnRestart) throws RemoteException, RemoteException; public void clearStore() throws RemoteException, RemoteException; public void processExpires() throws RemoteException, RemoteException; public void processPersistenceChecks() throws RemoteException, RemoteException; public Session2 findSession(String id) throws IOException, RemoteException, RemoteException; public void removeSuper(Session2 session) throws RemoteException, RemoteException; public void load() throws RemoteException, RemoteException; public void remove(Session2 session, boolean update) throws RemoteException, RemoteException; public void removeSession(String id) throws RemoteException, RemoteException; public void unload() throws RemoteException, RemoteException; public int getActiveSessionsFull() throws RemoteException, RemoteException; public Set<String> getSessionIdsFull() throws RemoteException, RemoteException; public Session2 swapIn(String id) throws IOException, RemoteException, RemoteException; public void swapOut(Session2 session) throws IOException, RemoteException, RemoteException; public void writeSession(Session2 session) throws IOException, RemoteException, RemoteException; public void startInternal() throws LifecycleException, RemoteException, RemoteException; public void stopInternal() throws LifecycleException, RemoteException, RemoteException; public void processMaxIdleSwaps() throws RemoteException, RemoteException; public void processMaxActiveSwaps() throws RemoteException, RemoteException; public void processMaxIdleBackups() throws RemoteException, RemoteException; public Map<String, Object> getSessionSwapInLocks() throws RemoteException, RemoteException;}
UTF-8
Java
3,590
java
PersistentManagerBaseRemoteInterface.java
Java
[]
null
[]
package org.apache.catalina.session; import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.catalina.DistributedManager; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; import org.apache.catalina.Session2; import org.apache.catalina.Store; import org.apache.catalina.security.SecurityUtil; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.catalina.session.ManagerBaseRemoteInterface; import java.rmi.Remote; import java.rmi.RemoteException; import java.io.Serializable; public interface PersistentManagerBaseRemoteInterface extends Remote, Serializable, ManagerBaseRemoteInterface, DistributedManager{ public int getMaxIdleBackup() throws RemoteException, RemoteException; public void setMaxIdleBackup(int backup) throws RemoteException, RemoteException; public int getMaxIdleSwap() throws RemoteException, RemoteException; public void setMaxIdleSwap(int max) throws RemoteException, RemoteException; public int getMinIdleSwap() throws RemoteException, RemoteException; public void setMinIdleSwap(int min) throws RemoteException, RemoteException; public String getInfo() throws RemoteException, RemoteException; public boolean isLoaded(String id) throws RemoteException, RemoteException; public String getName() throws RemoteException, RemoteException; public void setStore(Store store) throws RemoteException, RemoteException; public Store getStore() throws RemoteException, RemoteException; public boolean getSaveOnRestart() throws RemoteException, RemoteException; public void setSaveOnRestart(boolean saveOnRestart) throws RemoteException, RemoteException; public void clearStore() throws RemoteException, RemoteException; public void processExpires() throws RemoteException, RemoteException; public void processPersistenceChecks() throws RemoteException, RemoteException; public Session2 findSession(String id) throws IOException, RemoteException, RemoteException; public void removeSuper(Session2 session) throws RemoteException, RemoteException; public void load() throws RemoteException, RemoteException; public void remove(Session2 session, boolean update) throws RemoteException, RemoteException; public void removeSession(String id) throws RemoteException, RemoteException; public void unload() throws RemoteException, RemoteException; public int getActiveSessionsFull() throws RemoteException, RemoteException; public Set<String> getSessionIdsFull() throws RemoteException, RemoteException; public Session2 swapIn(String id) throws IOException, RemoteException, RemoteException; public void swapOut(Session2 session) throws IOException, RemoteException, RemoteException; public void writeSession(Session2 session) throws IOException, RemoteException, RemoteException; public void startInternal() throws LifecycleException, RemoteException, RemoteException; public void stopInternal() throws LifecycleException, RemoteException, RemoteException; public void processMaxIdleSwaps() throws RemoteException, RemoteException; public void processMaxActiveSwaps() throws RemoteException, RemoteException; public void processMaxIdleBackups() throws RemoteException, RemoteException; public Map<String, Object> getSessionSwapInLocks() throws RemoteException, RemoteException;}
3,590
0.831198
0.829248
104
33.528847
30.706413
131
false
false
0
0
0
0
0
0
1.663462
false
false
8
a7777a240c8bc084819b8e6d8837b14ab7c57c2d
26,534,307,982,480
4f5e2180955ceea2d83e4395b78e2e4375165c53
/aggregation/src/main/java/xdean/annotation/processor/AggregationChecker.java
53bae9139c4e0c8fd9a1cf5c136fff5ac5d08c8a
[ "Apache-2.0" ]
permissive
XDean/Deannotation
https://github.com/XDean/Deannotation
2616f85a44699c302a0975cdaad4944e27d45da0
a8f47367d7a47c469d113a8525ab16cfdac41161
refs/heads/master
2021-09-18T18:14:21.874000
2018-07-18T03:45:12
2018-07-18T03:45:12
111,860,123
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package xdean.annotation.processor; import java.util.Set; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.TypeElement; import xdean.annotation.processor.toolkit.AssertException; import xdean.annotation.processor.toolkit.XAbstractProcessor; public class AggregationChecker extends XAbstractProcessor { @Override public boolean processActual(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws AssertException { if (roundEnv.processingOver()) { return false; } return false; } }
UTF-8
Java
585
java
AggregationChecker.java
Java
[]
null
[]
package xdean.annotation.processor; import java.util.Set; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.TypeElement; import xdean.annotation.processor.toolkit.AssertException; import xdean.annotation.processor.toolkit.XAbstractProcessor; public class AggregationChecker extends XAbstractProcessor { @Override public boolean processActual(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws AssertException { if (roundEnv.processingOver()) { return false; } return false; } }
585
0.77094
0.77094
20
27.25
30.923899
122
false
false
0
0
0
0
0
0
0.45
false
false
8
22659460a045de1b9eb58e0d24d87f8030cdcc0c
26,980,984,601,889
df041bb90ab7c80f4d65ee057f96411b058c92d8
/src/fr/upem/capcha/images/car/yellow/Yellow.java
f59414a4c2a8e94aec8a5880013ab7e4e232c1f7
[]
no_license
Lyadrielle/Captcha
https://github.com/Lyadrielle/Captcha
01ecc9c469ec74840012a1f37c425bec54d137c9
1ca3feca4367a0378e3813d7752627028ae3969f
refs/heads/master
2020-03-15T11:43:40.692000
2018-05-11T08:43:13
2018-05-11T08:43:13
132,126,569
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.upem.capcha.images.car.yellow; public class Yellow { }
UTF-8
Java
68
java
Yellow.java
Java
[]
null
[]
package fr.upem.capcha.images.car.yellow; public class Yellow { }
68
0.75
0.75
5
12.6
16.3046
41
false
false
0
0
0
0
0
0
0.2
false
false
8
61bb73a981c5dd3165b5999d9942f57063bc35a5
17,248,588,705,813
96a2a67e70a69f7277a0d5ede025e54afb9633a0
/sylph-runners/batch/src/test/java/ideal/sylph/runner/batch/TestQuartzScheduling.java
3e13f1e83dbb10826189cc2d028f38140f3b8afb
[ "Apache-2.0" ]
permissive
jeific/sylph
https://github.com/jeific/sylph
33f8fd93de890c251a8b40379fb0c0ff2525fdd8
4436db87adbb613ffb177a65475f6fd5c1f0c898
refs/heads/master
2022-02-13T17:28:29.830000
2018-11-22T13:58:29
2018-11-22T13:58:29
158,226,857
1
0
Apache-2.0
true
2018-11-22T13:50:45
2018-11-19T13:23:10
2018-11-19T13:59:04
2018-11-22T13:50:45
4,868
1
0
1
Java
false
null
/* * Copyright (C) 2018 The Sylph Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ideal.sylph.runner.batch; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; import org.quartz.Job; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.JobKey; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SchedulerFactory; import org.quartz.TriggerBuilder; import org.quartz.impl.StdSchedulerFactory; import org.quartz.impl.matchers.GroupMatcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Set; import java.util.concurrent.TimeUnit; public class TestQuartzScheduling { private final static Logger logger = LoggerFactory.getLogger(TestQuartzScheduling.class); private Scheduler scheduler; @Before public void setUp() throws Exception { SchedulerFactory schedulerFactory = new StdSchedulerFactory(); scheduler = schedulerFactory.getScheduler(); scheduler.start(); Assert.assertTrue(scheduler.isStarted()); } @After public void tearDown() throws Exception { scheduler.shutdown(); Assert.assertTrue(scheduler.isShutdown()); } @Test public void testAddJob() throws SchedulerException { JobDetail jobDetail = JobBuilder.newJob(HelloQuartzJob.class) .withIdentity("testJob", Scheduler.DEFAULT_GROUP) .build(); String cronExpression = "30/5 * * * * ?"; // 每分钟的30s起,每5s触发任务 CronTrigger cronTrigger = TriggerBuilder.newTrigger() .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)) .build(); scheduler.scheduleJob(jobDetail, cronTrigger); Set<JobKey> jobKeys = scheduler.getJobKeys(GroupMatcher.anyGroup()); Assert.assertEquals(1, jobKeys.size()); logger.info("job list:{}",jobKeys); } @Test public void testDelete() throws InterruptedException, SchedulerException { TimeUnit.SECONDS.sleep(1); logger.info("remove job delayDataSchdule"); scheduler.deleteJob(JobKey.jobKey("testJob")); Set<JobKey> jobKeys = scheduler.getJobKeys(GroupMatcher.anyGroup()); Assert.assertEquals(0, jobKeys.size()); } public static class HelloQuartzJob implements Job { @Override public void execute(JobExecutionContext context) throws JobExecutionException { logger.info("HelloQuartzJob ....FireTime:{} , ScheduledFireTime:{}", context.getFireTime(), context.getScheduledFireTime()); } } }
UTF-8
Java
3,421
java
TestQuartzScheduling.java
Java
[]
null
[]
/* * Copyright (C) 2018 The Sylph Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ideal.sylph.runner.batch; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; import org.quartz.Job; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.JobKey; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SchedulerFactory; import org.quartz.TriggerBuilder; import org.quartz.impl.StdSchedulerFactory; import org.quartz.impl.matchers.GroupMatcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Set; import java.util.concurrent.TimeUnit; public class TestQuartzScheduling { private final static Logger logger = LoggerFactory.getLogger(TestQuartzScheduling.class); private Scheduler scheduler; @Before public void setUp() throws Exception { SchedulerFactory schedulerFactory = new StdSchedulerFactory(); scheduler = schedulerFactory.getScheduler(); scheduler.start(); Assert.assertTrue(scheduler.isStarted()); } @After public void tearDown() throws Exception { scheduler.shutdown(); Assert.assertTrue(scheduler.isShutdown()); } @Test public void testAddJob() throws SchedulerException { JobDetail jobDetail = JobBuilder.newJob(HelloQuartzJob.class) .withIdentity("testJob", Scheduler.DEFAULT_GROUP) .build(); String cronExpression = "30/5 * * * * ?"; // 每分钟的30s起,每5s触发任务 CronTrigger cronTrigger = TriggerBuilder.newTrigger() .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)) .build(); scheduler.scheduleJob(jobDetail, cronTrigger); Set<JobKey> jobKeys = scheduler.getJobKeys(GroupMatcher.anyGroup()); Assert.assertEquals(1, jobKeys.size()); logger.info("job list:{}",jobKeys); } @Test public void testDelete() throws InterruptedException, SchedulerException { TimeUnit.SECONDS.sleep(1); logger.info("remove job delayDataSchdule"); scheduler.deleteJob(JobKey.jobKey("testJob")); Set<JobKey> jobKeys = scheduler.getJobKeys(GroupMatcher.anyGroup()); Assert.assertEquals(0, jobKeys.size()); } public static class HelloQuartzJob implements Job { @Override public void execute(JobExecutionContext context) throws JobExecutionException { logger.info("HelloQuartzJob ....FireTime:{} , ScheduledFireTime:{}", context.getFireTime(), context.getScheduledFireTime()); } } }
3,421
0.694028
0.688438
107
30.766356
25.685219
136
false
false
0
0
0
0
0
0
0.542056
false
false
8
2c29b6748052d30e3bc9360437c788cbecc59c67
1,992,864,886,414
0ede86bf269020f7483fa69ae7dd9b21902974f2
/src/main/java/com/sgai/cxmc/util/ReadJsonFileUtil.java
f41b1eccf0f31ef6ac7463fea5c8d93f39c8d796
[]
no_license
lmxss158/cxmc
https://github.com/lmxss158/cxmc
6741de17c28674a317bb70789fedf1e821f6bfce
0953a909a47c6d4ace9c63b149d2a1293d65fd2b
refs/heads/master
2022-06-24T06:57:02.187000
2019-10-17T08:28:07
2019-10-17T08:28:07
213,934,398
2
0
null
false
2022-06-17T02:34:12
2019-10-09T14:03:21
2021-05-10T08:50:13
2022-06-17T02:34:09
170
0
0
1
Java
false
false
package com.sgai.cxmc.util; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import java.io.*; /** * @Description: * @Author: 李锐平 * @Date: 2019/8/3 12:28 * @Version 1.0 */ public class ReadJsonFileUtil { public static String readJsonFile(String fileName) { String jsonStr = ""; try { File jsonFile = new File(fileName); FileReader fileReader = new FileReader(jsonFile); Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8"); int ch = 0; StringBuffer sb = new StringBuffer(); while ((ch = reader.read()) != -1) { sb.append((char) ch); } fileReader.close(); reader.close(); jsonStr = sb.toString(); return jsonStr; } catch (IOException e) { e.printStackTrace(); return null; } } /** * 从类路径读json文件 * @param fileName 文件名,不包含全路径 * @return */ public static String readFromClassPath(String fileName){ String path = ReadJsonFileUtil.class.getClassLoader().getResource(fileName).getPath(); return readJsonFile(path); } private static void readAllAppItem(){ String path = ReadJsonFileUtil.class.getClassLoader().getResource("jtqx.json").getPath(); String s = readJsonFile(path); JSONObject jobj = JSON.parseObject(s); JSONArray applicationItmes = jobj.getJSONArray("items"); JSONObject item = null; for (int i = 0; i < applicationItmes.size(); i++) { //管理驾驶舱的代码为:CXMC if ("CXMC".equals(applicationItmes.getJSONObject(i).getString("resId"))){ item = applicationItmes.getJSONObject(i); break; } } System.out.println(item.toJSONString()); } private static void processTreeArray(JSONArray items){ for (int i=0; i<items.size(); i++) { JSONObject item = items.getJSONObject(i); // String resId = item.getString("resId"); // String resName = item.getString("resName"); // String parentSid = item.getString("parentSid"); // String sid = item.getString("sid"); item.remove("resVisibility"); item.remove("updatedBy"); item.remove("resType"); item.remove("version"); item.remove("connected"); item.remove("createdDt"); item.remove("resSeq"); item.remove("resLevel"); item.remove("createdBy"); item.remove("updatedDt"); item.remove("iconCls"); item.remove("relAccessRul"); if (!item.getBoolean("leaf")) { processTreeArray(item.getJSONArray("items")); } } } static JSONObject obj = null; static StringBuffer strs = new StringBuffer(); private static void processTree(JSONObject item){ item.remove("resVisibility"); item.remove("updatedBy"); item.remove("resType"); item.remove("version"); item.remove("connected"); item.remove("createdDt"); item.remove("resSeq"); item.remove("resLevel"); item.remove("createdBy"); item.remove("updatedDt"); item.remove("iconCls"); item.remove("relAccessRul"); item.remove("resPageUrl"); // strs.append(item.getString("resId")).append(","); strs.append(item.getString("sid")).append(","); if (!item.getBoolean("leaf")) { JSONArray items = item.getJSONArray("items"); for (int i=0; i<items.size(); i++) { processTree(items.getJSONObject(i)); } } } private static void readGljscQx(){ String path = ReadJsonFileUtil.class.getClassLoader().getResource("gljscgf.json").getPath(); String s = readJsonFile(path); // JSONObject jobj = JSON.parseObject(s); obj = JSON.parseObject(s); // 读取的文件为菜单树,递归删除多余的属性 processTree(obj); System.out.println(obj.toJSONString()); System.out.println("==========="); System.out.println(strs.toString()); } public static void main(String[] args) { // readAllAppItem(); readGljscQx(); } }
UTF-8
Java
4,505
java
ReadJsonFileUtil.java
Java
[ { "context": "port java.io.*;\n\n/**\n * @Description:\n * @Author: 李锐平\n * @Date: 2019/8/3 12:28\n * @Version 1.0\n */\n\npub", "end": 198, "score": 0.9997355341911316, "start": 195, "tag": "NAME", "value": "李锐平" } ]
null
[]
package com.sgai.cxmc.util; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import java.io.*; /** * @Description: * @Author: 李锐平 * @Date: 2019/8/3 12:28 * @Version 1.0 */ public class ReadJsonFileUtil { public static String readJsonFile(String fileName) { String jsonStr = ""; try { File jsonFile = new File(fileName); FileReader fileReader = new FileReader(jsonFile); Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8"); int ch = 0; StringBuffer sb = new StringBuffer(); while ((ch = reader.read()) != -1) { sb.append((char) ch); } fileReader.close(); reader.close(); jsonStr = sb.toString(); return jsonStr; } catch (IOException e) { e.printStackTrace(); return null; } } /** * 从类路径读json文件 * @param fileName 文件名,不包含全路径 * @return */ public static String readFromClassPath(String fileName){ String path = ReadJsonFileUtil.class.getClassLoader().getResource(fileName).getPath(); return readJsonFile(path); } private static void readAllAppItem(){ String path = ReadJsonFileUtil.class.getClassLoader().getResource("jtqx.json").getPath(); String s = readJsonFile(path); JSONObject jobj = JSON.parseObject(s); JSONArray applicationItmes = jobj.getJSONArray("items"); JSONObject item = null; for (int i = 0; i < applicationItmes.size(); i++) { //管理驾驶舱的代码为:CXMC if ("CXMC".equals(applicationItmes.getJSONObject(i).getString("resId"))){ item = applicationItmes.getJSONObject(i); break; } } System.out.println(item.toJSONString()); } private static void processTreeArray(JSONArray items){ for (int i=0; i<items.size(); i++) { JSONObject item = items.getJSONObject(i); // String resId = item.getString("resId"); // String resName = item.getString("resName"); // String parentSid = item.getString("parentSid"); // String sid = item.getString("sid"); item.remove("resVisibility"); item.remove("updatedBy"); item.remove("resType"); item.remove("version"); item.remove("connected"); item.remove("createdDt"); item.remove("resSeq"); item.remove("resLevel"); item.remove("createdBy"); item.remove("updatedDt"); item.remove("iconCls"); item.remove("relAccessRul"); if (!item.getBoolean("leaf")) { processTreeArray(item.getJSONArray("items")); } } } static JSONObject obj = null; static StringBuffer strs = new StringBuffer(); private static void processTree(JSONObject item){ item.remove("resVisibility"); item.remove("updatedBy"); item.remove("resType"); item.remove("version"); item.remove("connected"); item.remove("createdDt"); item.remove("resSeq"); item.remove("resLevel"); item.remove("createdBy"); item.remove("updatedDt"); item.remove("iconCls"); item.remove("relAccessRul"); item.remove("resPageUrl"); // strs.append(item.getString("resId")).append(","); strs.append(item.getString("sid")).append(","); if (!item.getBoolean("leaf")) { JSONArray items = item.getJSONArray("items"); for (int i=0; i<items.size(); i++) { processTree(items.getJSONObject(i)); } } } private static void readGljscQx(){ String path = ReadJsonFileUtil.class.getClassLoader().getResource("gljscgf.json").getPath(); String s = readJsonFile(path); // JSONObject jobj = JSON.parseObject(s); obj = JSON.parseObject(s); // 读取的文件为菜单树,递归删除多余的属性 processTree(obj); System.out.println(obj.toJSONString()); System.out.println("==========="); System.out.println(strs.toString()); } public static void main(String[] args) { // readAllAppItem(); readGljscQx(); } }
4,505
0.563422
0.559337
146
29.184931
22.426441
100
false
false
0
0
0
0
0
0
0.575342
false
false
8
be38212dfd932cedc7bf27a1e288bad72257c59c
18,511,309,098,285
dcf64357ec5b2af99c3872d7a534a9d2117723f8
/tests/src/main/java/org/corfudb/universe/test/log/TestLogHelper.java
2cc00526925d169ffc2fbd13050ebf66eb06f976
[]
no_license
CorfuDB/corfudb-tests
https://github.com/CorfuDB/corfudb-tests
abe5d73f9646dc4c0475a08017c11e6da6aa6db4
a79be5ceb82be0da50fd39153d02736e47d0a63d
refs/heads/master
2020-10-01T07:34:38.180000
2020-09-30T03:29:24
2020-09-30T03:29:24
227,490,263
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.corfudb.universe.test.log; import org.slf4j.MDC; /** * Class to handle setting/removing MDC on per test case basis. This helps * us log each test case into it's own log file. * See reference @url http://www.nullin.com/2010/07/28/logging-tests-to-separate-files/ */ public final class TestLogHelper { private static final String TEST_NAME = "testName"; private TestLogHelper() { //prevent creating class util instances } /** * Adds the test name to MDC so that sift appender can use it and log the new * log events to a different file * * @param name Class name of the test log */ public static void startTestLogging(Class<?> name) { MDC.put(TEST_NAME, name.getCanonicalName()); } /** * Removes the key (log file name) from MDC */ public static void stopTestLogging() { MDC.remove(TEST_NAME); } }
UTF-8
Java
912
java
TestLogHelper.java
Java
[]
null
[]
package org.corfudb.universe.test.log; import org.slf4j.MDC; /** * Class to handle setting/removing MDC on per test case basis. This helps * us log each test case into it's own log file. * See reference @url http://www.nullin.com/2010/07/28/logging-tests-to-separate-files/ */ public final class TestLogHelper { private static final String TEST_NAME = "testName"; private TestLogHelper() { //prevent creating class util instances } /** * Adds the test name to MDC so that sift appender can use it and log the new * log events to a different file * * @param name Class name of the test log */ public static void startTestLogging(Class<?> name) { MDC.put(TEST_NAME, name.getCanonicalName()); } /** * Removes the key (log file name) from MDC */ public static void stopTestLogging() { MDC.remove(TEST_NAME); } }
912
0.653509
0.64364
33
26.636364
25.846655
87
false
false
0
0
0
0
0
0
0.181818
false
false
8
65f5cf2f8392c63528f2ce94b97e7148c5d8414c
27,522,150,462,281
33cb64fea801fde2ac61d9b040bb86eed0f5f2c0
/daxia-java2ios/src/main/java/com/daxia/wy/web/controller/Java2iosUtils.java
8dae43674053a036f6e5a85abaa0ad4b4752486a
[]
no_license
jklmnlkevin/myworld
https://github.com/jklmnlkevin/myworld
cdaab9db513c231d34f3f0ca40016ff417f6b949
4bc484131193104df8b1b7daea7bf477c96d2336
refs/heads/master
2020-03-30T21:04:23.642000
2014-11-20T00:35:56
2014-11-20T00:35:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.daxia.wy.web.controller; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import com.daxia.core.util.dev.FreeMarkerUtils; public class Java2iosUtils { private static String targetPath = "/Users/kevin/code/yc/trunk/ios/DaXiaProject/Classes/model"; private static Set<String> invalidModules = new HashSet<String>(); static { invalidModules.add("Base"); invalidModules.add("BaseAPIOutput"); invalidModules.add("City"); invalidModules.add("District"); invalidModules.add("MobileApiOutput"); invalidModules.add("info"); invalidModules.add("Order2"); invalidModules.add("Province"); invalidModules.add("SystemConfig"); invalidModules.add("UserSimple"); invalidModules.add("UserSimple2"); } public static void java2ios() throws Exception { String path = "/Users/kevin/code/yc_java/trunk/src/main/java"; String apiDTOPath = path + "/com/daxia/wy/dto/api"; String templatePath = "src/main/resources/ios/"; List<File> templateList = new ArrayList<File>(); templateList.add(new File(templatePath + "Model.h.ftl")); templateList.add(new File(templatePath + "Model.m.ftl")); File[] dtos = new File(apiDTOPath).listFiles(); for (File dto : dtos) { for (File template : templateList) { bean2ios(dto, template, new File(targetPath)); } } } private static void bean2ios(File dto, File template, File targetDir) throws Exception { // get extract model and felds from file String moduleName = dto.getName(); moduleName = moduleName.replace(".java", ""); moduleName = moduleName.replace("APIDTO", ""); if (invalidModules.contains(moduleName)) { return; } List<ModuleField> moduleFields = ModuleFieldUtils.parseFields(dto); boolean hasImageDTO = false; boolean hasUser = false; for (ModuleField moduleField : moduleFields) { if (moduleField.getType().equals("ImageDTO")) { hasImageDTO = true; } else if (moduleField.getType().equals("UserAPIDTO")) { hasUser = true; moduleField.setType("User"); } } Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("Model", moduleName); paramMap.put("fields", moduleFields); paramMap.put("hasImageDTO", hasImageDTO); paramMap.put("hasUser", hasUser); // get tmeplate filef String fileName = template.getName().replace(".ftl", "").replace("Model", moduleName); File target = new File(targetDir, fileName); FreeMarkerUtils.generate(template, target, paramMap); // } public static void main(String[] args) { } }
UTF-8
Java
3,042
java
Java2iosUtils.java
Java
[ { "context": " {\n private static String targetPath = \"/Users/kevin/code/yc/trunk/ios/DaXiaProject/Classes/model\";\n ", "end": 337, "score": 0.9099332094192505, "start": 332, "tag": "USERNAME", "value": "kevin" } ]
null
[]
package com.daxia.wy.web.controller; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import com.daxia.core.util.dev.FreeMarkerUtils; public class Java2iosUtils { private static String targetPath = "/Users/kevin/code/yc/trunk/ios/DaXiaProject/Classes/model"; private static Set<String> invalidModules = new HashSet<String>(); static { invalidModules.add("Base"); invalidModules.add("BaseAPIOutput"); invalidModules.add("City"); invalidModules.add("District"); invalidModules.add("MobileApiOutput"); invalidModules.add("info"); invalidModules.add("Order2"); invalidModules.add("Province"); invalidModules.add("SystemConfig"); invalidModules.add("UserSimple"); invalidModules.add("UserSimple2"); } public static void java2ios() throws Exception { String path = "/Users/kevin/code/yc_java/trunk/src/main/java"; String apiDTOPath = path + "/com/daxia/wy/dto/api"; String templatePath = "src/main/resources/ios/"; List<File> templateList = new ArrayList<File>(); templateList.add(new File(templatePath + "Model.h.ftl")); templateList.add(new File(templatePath + "Model.m.ftl")); File[] dtos = new File(apiDTOPath).listFiles(); for (File dto : dtos) { for (File template : templateList) { bean2ios(dto, template, new File(targetPath)); } } } private static void bean2ios(File dto, File template, File targetDir) throws Exception { // get extract model and felds from file String moduleName = dto.getName(); moduleName = moduleName.replace(".java", ""); moduleName = moduleName.replace("APIDTO", ""); if (invalidModules.contains(moduleName)) { return; } List<ModuleField> moduleFields = ModuleFieldUtils.parseFields(dto); boolean hasImageDTO = false; boolean hasUser = false; for (ModuleField moduleField : moduleFields) { if (moduleField.getType().equals("ImageDTO")) { hasImageDTO = true; } else if (moduleField.getType().equals("UserAPIDTO")) { hasUser = true; moduleField.setType("User"); } } Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("Model", moduleName); paramMap.put("fields", moduleFields); paramMap.put("hasImageDTO", hasImageDTO); paramMap.put("hasUser", hasUser); // get tmeplate filef String fileName = template.getName().replace(".ftl", "").replace("Model", moduleName); File target = new File(targetDir, fileName); FreeMarkerUtils.generate(template, target, paramMap); // } public static void main(String[] args) { } }
3,042
0.614727
0.612755
87
33.965519
24.424149
99
false
false
0
0
0
0
0
0
0.747126
false
false
8
08b339652c515c29abba99b1ae4e10cc4b745164
27,479,200,807,778
6a4559101bed2ee7abd5256bc47ee848403aadc8
/Excelsior-userregistration/ExcelsiorHousingLoan/src/com/loan/service/AdminService.java
dfe93660b6c92a411849945a544fa29e8d2e684a
[]
no_license
madhurapurohit/friday_Excelsior
https://github.com/madhurapurohit/friday_Excelsior
f55e5c39ef47fe7ef74777a76e04c8f7b5ce441c
1ab376d0059e920a233216f9a7fce47c579a9df5
refs/heads/master
2022-12-21T09:36:31.578000
2019-11-22T11:45:22
2019-11-22T11:45:22
223,391,455
0
0
null
false
2022-12-15T23:39:02
2019-11-22T11:42:29
2019-11-22T11:45:25
2022-12-15T23:39:01
4,978
0
0
3
Java
false
false
package com.loan.service; public interface AdminService { public boolean checkLogin(String email, String password); }
UTF-8
Java
130
java
AdminService.java
Java
[]
null
[]
package com.loan.service; public interface AdminService { public boolean checkLogin(String email, String password); }
130
0.738462
0.738462
7
16.571428
20.804237
58
false
false
0
0
0
0
0
0
0.714286
false
false
8
673ab85a9e8e5c3db81aa35c478ed43efb700654
23,484,881,189,825
bbd7a9acc647c10b3d5760b7d7977a10c5c1e12f
/unittests/coffeemaker/InventoryTest.java
06ea1738ebdfef112e7388aef9c7d14e5acd865c
[]
no_license
tjm8975/swen352-activity1
https://github.com/tjm8975/swen352-activity1
020e23c05190ad2846ced6aa4c09886c454a1e0a
70883ee47f429ac153f7bbf9f6bf43a3736db235
refs/heads/master
2023-07-29T04:53:51.611000
2021-09-12T21:16:30
2021-09-12T21:16:30
404,128,133
0
0
null
false
2021-09-12T21:07:48
2021-09-07T21:31:40
2021-09-11T18:28:59
2021-09-12T21:07:48
57
0
0
0
Java
false
false
package coffeemaker; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import coffeemaker.exceptions.InventoryException; import coffeemaker.exceptions.RecipeException; import junit.framework.TestCase; public class InventoryTest extends TestCase { private Inventory inv; private Recipe rec; @Before public void setUp() throws Exception { inv = new Inventory(); rec = new Recipe(); super.setUp(); } @After public void tearDown() throws Exception { inv = null; rec = null; super.tearDown(); } /** * Tests for chocolate methods */ @Test public void testGetChocolate() { assertEquals(inv.getChocolate(), 15); } @Test public void testSetChocolate0() { inv.setChocolate(0); assertEquals(inv.getChocolate(), 0); } @Test public void testSetChocolateNeg1() { inv.setChocolate(-1); assertEquals(inv.getChocolate(), 15); } @Test public void testSetChocolate1() { inv.setChocolate(1); assertEquals(inv.getChocolate(), 1); } @Test public void testSetChocolate10() { inv.setChocolate(10); assertEquals(inv.getChocolate(), 10); } @Test public void testAddChocolateNaN() { try { inv.addChocolate("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of chocolate must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddChocolateNeg1() { try { inv.addChocolate("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of chocolate must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddChocolate0() { try { inv.addChocolate("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getChocolate(), 15); } @Test public void testAddChocolate1() { try { inv.addChocolate("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getChocolate(), 16); } /** * Tests for coffee methods */ @Test public void testGetCoffee() { assertEquals(inv.getCoffee(), 15); } @Test public void testSetCoffee0() { inv.setCoffee(0); assertEquals(inv.getCoffee(), 0); } @Test public void testSetCoffeeNeg1() { inv.setCoffee(-1); assertEquals(inv.getCoffee(), 15); } @Test public void testSetCoffee1() { inv.setCoffee(1); assertEquals(inv.getCoffee(), 1); } @Test public void testSetCoffee10() { inv.setCoffee(10); assertEquals(inv.getCoffee(), 10); } @Test public void testAddCoffeeNaN() { try { inv.addCoffee("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of coffee must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddCoffeeNeg1() { try { inv.addCoffee("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of coffee must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddCoffee0() { try { inv.addCoffee("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getCoffee(), 15); } @Test public void testAddCoffee1() { try { inv.addCoffee("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getCoffee(), 16); } /** * Tests for milk methods */ @Test public void testGetMilk() { assertEquals(inv.getMilk(), 15); } @Test public void testSetMilk0() { inv.setMilk(0); assertEquals(inv.getMilk(), 0); } @Test public void testSetMilkNeg1() { inv.setMilk(-1); assertEquals(inv.getMilk(), 15); } @Test public void testSetMilk1() { inv.setMilk(1); assertEquals(inv.getMilk(), 1); } @Test public void testSetMilk10() { inv.setMilk(10); assertEquals(inv.getMilk(), 10); } @Test public void testAddMilkNaN() { try { inv.addMilk("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of milk must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddMilkNeg1() { try { inv.addMilk("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of milk must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddMilk0() { try { inv.addMilk("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getMilk(), 15); } @Test public void testAddMilk1() { try { inv.addMilk("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getMilk(), 16); } /** * Tests for sugar methods */ @Test public void testGetSugar() { assertEquals(inv.getSugar(), 15); } @Test public void testSetSugar0() { inv.setSugar(0); assertEquals(inv.getSugar(), 0); } @Test public void testSetSugarNeg1() { inv.setSugar(-1); assertEquals(inv.getSugar(), 15); } @Test public void testSetSugar1() { inv.setSugar(1); assertEquals(inv.getSugar(), 1); } @Test public void testSetSugar10() { inv.setSugar(10); assertEquals(inv.getSugar(), 10); } @Test public void testAddSugarNaN() { try { inv.addSugar("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of sugar must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddSugarNeg1() { try { inv.addSugar("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of sugar must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddSugar0() { try { inv.addSugar("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getSugar(), 15); } @Test public void testAddSugar1() { try { inv.addSugar("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getSugar(), 16); } /** * Tests for enough coffee */ @Test public void testEnoughIngredientsCoffeeYes() { try { rec.setAmtCoffee("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsCoffeeNo() { try { rec.setAmtCoffee("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for enough milk */ @Test public void testEnoughIngredientsMilkYes() { try { rec.setAmtMilk("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsMilkNo() { try { rec.setAmtMilk("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for enough sugar */ @Test public void testEnoughIngredientsSugarYes() { try { rec.setAmtSugar("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsSugarNo() { try { rec.setAmtSugar("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for enough chocolate */ @Test public void testEnoughIngredientsChocolateYes() { try { rec.setAmtChocolate("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsChocolateNo() { try { rec.setAmtChocolate("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for using ingredients */ @Test public void testUseIngredientsNotEnough() { try { rec.setAmtMilk("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.useIngredients(rec)); } @Test public void testUseIngredientsCoffee() { try { rec.setAmtCoffee("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getCoffee(), 0); } @Test public void testUseIngredientsMilk() { try { rec.setAmtMilk("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getMilk(), 0); } @Test public void testUseIngredientsSugar() { try { rec.setAmtSugar("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getSugar(), 0); } @Test public void testUseIngredientsChocolate() { try { rec.setAmtChocolate("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getChocolate(), 0); } /** * Tests for toString method */ @Test public void testToString() { assertEquals(inv.toString(), "Coffee: 15\nMilk: 15\nSugar: 15\nChocolate: 15\n"); } }
UTF-8
Java
9,208
java
InventoryTest.java
Java
[]
null
[]
package coffeemaker; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import coffeemaker.exceptions.InventoryException; import coffeemaker.exceptions.RecipeException; import junit.framework.TestCase; public class InventoryTest extends TestCase { private Inventory inv; private Recipe rec; @Before public void setUp() throws Exception { inv = new Inventory(); rec = new Recipe(); super.setUp(); } @After public void tearDown() throws Exception { inv = null; rec = null; super.tearDown(); } /** * Tests for chocolate methods */ @Test public void testGetChocolate() { assertEquals(inv.getChocolate(), 15); } @Test public void testSetChocolate0() { inv.setChocolate(0); assertEquals(inv.getChocolate(), 0); } @Test public void testSetChocolateNeg1() { inv.setChocolate(-1); assertEquals(inv.getChocolate(), 15); } @Test public void testSetChocolate1() { inv.setChocolate(1); assertEquals(inv.getChocolate(), 1); } @Test public void testSetChocolate10() { inv.setChocolate(10); assertEquals(inv.getChocolate(), 10); } @Test public void testAddChocolateNaN() { try { inv.addChocolate("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of chocolate must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddChocolateNeg1() { try { inv.addChocolate("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of chocolate must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddChocolate0() { try { inv.addChocolate("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getChocolate(), 15); } @Test public void testAddChocolate1() { try { inv.addChocolate("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getChocolate(), 16); } /** * Tests for coffee methods */ @Test public void testGetCoffee() { assertEquals(inv.getCoffee(), 15); } @Test public void testSetCoffee0() { inv.setCoffee(0); assertEquals(inv.getCoffee(), 0); } @Test public void testSetCoffeeNeg1() { inv.setCoffee(-1); assertEquals(inv.getCoffee(), 15); } @Test public void testSetCoffee1() { inv.setCoffee(1); assertEquals(inv.getCoffee(), 1); } @Test public void testSetCoffee10() { inv.setCoffee(10); assertEquals(inv.getCoffee(), 10); } @Test public void testAddCoffeeNaN() { try { inv.addCoffee("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of coffee must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddCoffeeNeg1() { try { inv.addCoffee("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of coffee must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddCoffee0() { try { inv.addCoffee("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getCoffee(), 15); } @Test public void testAddCoffee1() { try { inv.addCoffee("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getCoffee(), 16); } /** * Tests for milk methods */ @Test public void testGetMilk() { assertEquals(inv.getMilk(), 15); } @Test public void testSetMilk0() { inv.setMilk(0); assertEquals(inv.getMilk(), 0); } @Test public void testSetMilkNeg1() { inv.setMilk(-1); assertEquals(inv.getMilk(), 15); } @Test public void testSetMilk1() { inv.setMilk(1); assertEquals(inv.getMilk(), 1); } @Test public void testSetMilk10() { inv.setMilk(10); assertEquals(inv.getMilk(), 10); } @Test public void testAddMilkNaN() { try { inv.addMilk("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of milk must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddMilkNeg1() { try { inv.addMilk("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of milk must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddMilk0() { try { inv.addMilk("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getMilk(), 15); } @Test public void testAddMilk1() { try { inv.addMilk("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getMilk(), 16); } /** * Tests for sugar methods */ @Test public void testGetSugar() { assertEquals(inv.getSugar(), 15); } @Test public void testSetSugar0() { inv.setSugar(0); assertEquals(inv.getSugar(), 0); } @Test public void testSetSugarNeg1() { inv.setSugar(-1); assertEquals(inv.getSugar(), 15); } @Test public void testSetSugar1() { inv.setSugar(1); assertEquals(inv.getSugar(), 1); } @Test public void testSetSugar10() { inv.setSugar(10); assertEquals(inv.getSugar(), 10); } @Test public void testAddSugarNaN() { try { inv.addSugar("abc"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of sugar must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddSugarNeg1() { try { inv.addSugar("-1"); } catch (InventoryException e) { assertEquals(e.getMessage(), "Units of sugar must be a positive integer"); return; }; fail("Should not parse invalid input"); } @Test public void testAddSugar0() { try { inv.addSugar("0"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getSugar(), 15); } @Test public void testAddSugar1() { try { inv.addSugar("1"); } catch (InventoryException e) { fail("Should parse int"); }; assertEquals(inv.getSugar(), 16); } /** * Tests for enough coffee */ @Test public void testEnoughIngredientsCoffeeYes() { try { rec.setAmtCoffee("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsCoffeeNo() { try { rec.setAmtCoffee("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for enough milk */ @Test public void testEnoughIngredientsMilkYes() { try { rec.setAmtMilk("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsMilkNo() { try { rec.setAmtMilk("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for enough sugar */ @Test public void testEnoughIngredientsSugarYes() { try { rec.setAmtSugar("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsSugarNo() { try { rec.setAmtSugar("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for enough chocolate */ @Test public void testEnoughIngredientsChocolateYes() { try { rec.setAmtChocolate("15"); } catch (RecipeException e) { fail("Should parse int"); }; assertTrue(inv.enoughIngredients(rec)); } @Test public void testEnoughIngredientsChocolateNo() { try { rec.setAmtChocolate("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.enoughIngredients(rec)); } /** * Tests for using ingredients */ @Test public void testUseIngredientsNotEnough() { try { rec.setAmtMilk("16"); } catch (RecipeException e) { fail("Should parse int"); }; assertFalse(inv.useIngredients(rec)); } @Test public void testUseIngredientsCoffee() { try { rec.setAmtCoffee("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getCoffee(), 0); } @Test public void testUseIngredientsMilk() { try { rec.setAmtMilk("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getMilk(), 0); } @Test public void testUseIngredientsSugar() { try { rec.setAmtSugar("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getSugar(), 0); } @Test public void testUseIngredientsChocolate() { try { rec.setAmtChocolate("15"); } catch (RecipeException e) { fail("Should parse int"); }; inv.useIngredients(rec); assertEquals(inv.getChocolate(), 0); } /** * Tests for toString method */ @Test public void testToString() { assertEquals(inv.toString(), "Coffee: 15\nMilk: 15\nSugar: 15\nChocolate: 15\n"); } }
9,208
0.654214
0.637924
493
17.677485
16.726637
83
false
false
0
0
0
0
0
0
2.01217
false
false
8
e0b7f4a03d40c131780004399a93e381164d9d52
26,534,307,964,694
d524b860a2c2900ebbe1bc69fd43626f6b7afbdd
/app/src/main/java/uit/linh/ui/GroupControlFragment.java
c620ed3ea8d29e64012376fd7ca234c4475112f6
[]
no_license
linhphan0108/MemeCreater
https://github.com/linhphan0108/MemeCreater
0de980d7f577be7e8535a631229a6955160d5bfc
6c3066d000894dd1e7eb374d0947da3ec5062fe8
refs/heads/master
2020-05-02T18:16:37.927000
2015-07-12T13:43:33
2015-07-12T13:43:33
38,963,335
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uit.linh.ui; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; /** * A simple {@link android.app.Fragment} subclass. * Activities that contain this fragment must implement the * {@link uit.linh.ui.GroupControlFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link uit.linh.ui.GroupControlFragment#newInstance} factory method to * create an instance of this fragment. */ public class GroupControlFragment extends android.support.v4.app.Fragment implements View.OnClickListener { private static final String TAG = "GroupControlFragment"; private static final String SHARE_REFERENCE_FILE = "meme_creater"; private static final String CAPTION_PREFERENCE = "caption"; private OnFragmentInteractionListener mListener; Button btnFragmentEditText, btnClear, btnNewCaption; EditText edtCaption; /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * @return A new instance of fragment GroupControl. */ public static GroupControlFragment newInstance() { GroupControlFragment fragment = new GroupControlFragment(); Bundle args = new Bundle(); fragment.setArguments(args); return fragment; } public GroupControlFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_group_control, container, false); btnFragmentEditText = (Button) view.findViewById(R.id.btn_frament_edit_text); btnClear = (Button) view.findViewById(R.id.btn_clear); btnNewCaption = (Button) view.findViewById(R.id.btn_new_caption); edtCaption = (EditText) view.findViewById(R.id.edt_caption); btnFragmentEditText.setOnClickListener(this); btnNewCaption.setOnClickListener(this); btnClear.setOnClickListener(this); edtCaption.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { mListener.setCaption(edtCaption.getText().toString()); } @Override public void afterTextChanged(Editable editable) { } }); return view; } @Override public void onResume() { super.onResume(); // Log.d(TAG, "onResume"); SharedPreferences preferences = getActivity().getSharedPreferences(SHARE_REFERENCE_FILE, Context.MODE_PRIVATE); String caption = preferences.getString(CAPTION_PREFERENCE, MemeCreator.defaultCaption); if (caption.equals("")){ edtCaption.setText(MemeCreator.defaultCaption); } } @Override public void onPause() { super.onPause(); // Log.d(TAG, "onPause"); SharedPreferences preferences = getActivity().getSharedPreferences(SHARE_REFERENCE_FILE, Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString(CAPTION_PREFERENCE, edtCaption.getText().toString()); editor.apply(); } @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (OnFragmentInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } } @Override public void onDetach() { super.onDetach(); mListener = null; } @Override public void onClick(View view) { if (mListener.isButtonEnabled()){ switch (view.getId()){ case R.id.btn_frament_edit_text: mListener.replaceFragment(); break; case R.id.btn_clear: mListener.clear(); edtCaption.setText(MemeCreator.defaultCaption); break; case R.id.btn_new_caption: mListener.createNewCaption(); edtCaption.setText(MemeCreator.defaultCaption); break; } } } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p/> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { public void replaceFragment(); public boolean isButtonEnabled(); public void setCaption(String caption); public void createNewCaption(); public void clear(); } }
UTF-8
Java
5,779
java
GroupControlFragment.java
Java
[]
null
[]
package uit.linh.ui; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; /** * A simple {@link android.app.Fragment} subclass. * Activities that contain this fragment must implement the * {@link uit.linh.ui.GroupControlFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link uit.linh.ui.GroupControlFragment#newInstance} factory method to * create an instance of this fragment. */ public class GroupControlFragment extends android.support.v4.app.Fragment implements View.OnClickListener { private static final String TAG = "GroupControlFragment"; private static final String SHARE_REFERENCE_FILE = "meme_creater"; private static final String CAPTION_PREFERENCE = "caption"; private OnFragmentInteractionListener mListener; Button btnFragmentEditText, btnClear, btnNewCaption; EditText edtCaption; /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * @return A new instance of fragment GroupControl. */ public static GroupControlFragment newInstance() { GroupControlFragment fragment = new GroupControlFragment(); Bundle args = new Bundle(); fragment.setArguments(args); return fragment; } public GroupControlFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_group_control, container, false); btnFragmentEditText = (Button) view.findViewById(R.id.btn_frament_edit_text); btnClear = (Button) view.findViewById(R.id.btn_clear); btnNewCaption = (Button) view.findViewById(R.id.btn_new_caption); edtCaption = (EditText) view.findViewById(R.id.edt_caption); btnFragmentEditText.setOnClickListener(this); btnNewCaption.setOnClickListener(this); btnClear.setOnClickListener(this); edtCaption.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { mListener.setCaption(edtCaption.getText().toString()); } @Override public void afterTextChanged(Editable editable) { } }); return view; } @Override public void onResume() { super.onResume(); // Log.d(TAG, "onResume"); SharedPreferences preferences = getActivity().getSharedPreferences(SHARE_REFERENCE_FILE, Context.MODE_PRIVATE); String caption = preferences.getString(CAPTION_PREFERENCE, MemeCreator.defaultCaption); if (caption.equals("")){ edtCaption.setText(MemeCreator.defaultCaption); } } @Override public void onPause() { super.onPause(); // Log.d(TAG, "onPause"); SharedPreferences preferences = getActivity().getSharedPreferences(SHARE_REFERENCE_FILE, Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putString(CAPTION_PREFERENCE, edtCaption.getText().toString()); editor.apply(); } @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (OnFragmentInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } } @Override public void onDetach() { super.onDetach(); mListener = null; } @Override public void onClick(View view) { if (mListener.isButtonEnabled()){ switch (view.getId()){ case R.id.btn_frament_edit_text: mListener.replaceFragment(); break; case R.id.btn_clear: mListener.clear(); edtCaption.setText(MemeCreator.defaultCaption); break; case R.id.btn_new_caption: mListener.createNewCaption(); edtCaption.setText(MemeCreator.defaultCaption); break; } } } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p/> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { public void replaceFragment(); public boolean isButtonEnabled(); public void setCaption(String caption); public void createNewCaption(); public void clear(); } }
5,779
0.652881
0.652016
169
33.195267
27.743389
119
false
false
0
0
0
0
0
0
0.485207
false
false
8
bb6c4cf934fa6b6e0b64fa059555ad8d9fbbc639
3,839,700,778,125
b0de0abc38727db9c219c0dab1990de93ec97e26
/src/Cards/CardFactory.java
e9e1dc552a6606b1404d3d32374e5b207fb7b8e8
[]
no_license
RodrigoGontijo/TP2PM
https://github.com/RodrigoGontijo/TP2PM
e91809efe505db0a1e03df140ab23086bf8e731e
c8c448b16152b2aaa5d3f83d51dde02ab0fb2db3
refs/heads/master
2021-01-01T04:11:28.048000
2016-05-11T05:13:25
2016-05-11T05:13:25
58,229,549
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Cards; import Cards.Card; public class CardFactory { public static CardInterface getCard(SuitEnum cardSuitEnum, Boolean multipleValue, String name, int[] value) { Card card = new Card(cardSuitEnum,multipleValue,name,value); return card; } }
UTF-8
Java
280
java
CardFactory.java
Java
[]
null
[]
package Cards; import Cards.Card; public class CardFactory { public static CardInterface getCard(SuitEnum cardSuitEnum, Boolean multipleValue, String name, int[] value) { Card card = new Card(cardSuitEnum,multipleValue,name,value); return card; } }
280
0.707143
0.707143
12
22.333334
32.412273
111
false
false
0
0
0
0
0
0
0.833333
false
false
8
bc616258f0c3893944d5b1c5214f6cbd8325edb2
9,191,230,044,317
eba82c4cfef3e691767ad6d6ee3b8fd7bdd32a6e
/src/android/DiskUsagePlugin.java
3fb4f1c95b2ae95b15f73ff6614719d407aafca2
[ "MIT" ]
permissive
happinov/cordova-plugin-diskusage
https://github.com/happinov/cordova-plugin-diskusage
1bcd15aefd802ff30a2cab01255571b95824b9bb
e2ab52664c0aa3e3e9e7886c62483b2683355316
refs/heads/master
2021-08-29T09:03:47.636000
2021-08-23T16:36:38
2021-08-23T16:36:38
138,326,396
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.happinov.cordova.plugin.diskusage; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.os.Environment; import android.os.StatFs; import android.util.Log; import java.io.File; import java.util.HashMap; import java.util.Map; public class DiskUsagePlugin extends CordovaPlugin { private static final String TAG = DiskUsagePlugin.class.getSimpleName(); private static final String FREE_KEY = "free"; private static final String TOTAL_KEY = "total"; private static final String INTERNAL_KEY = "internal"; private static final String EXTERNAL_KEY = "external"; public DiskUsagePlugin() { } @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals("read")) readDiskData(callbackContext); else return false; return true; } private void readDiskData(CallbackContext callbackContext) throws JSONException { JSONObject result = new JSONObject(); result.put(INTERNAL_KEY,getStorageData(Environment.getDataDirectory())); if (isExternalStorageAvailable()) result.put(EXTERNAL_KEY,getStorageData(Environment.getExternalStorageDirectory())); Log.d(TAG,"Sending result:"+result); callbackContext.success(result); } private static boolean isExternalStorageAvailable() { //return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); return false; // Don't allow external storage support for now since it's broken. } private static JSONObject getStorageData(File refFile) throws JSONException { Log.d(TAG,"Getting storage data:"+refFile.getPath()); JSONObject result = new JSONObject(); StatFs stat = new StatFs(refFile.getPath()); result.put(FREE_KEY,stat.getAvailableBytes()); result.put(TOTAL_KEY,stat.getTotalBytes()); return result; } }
UTF-8
Java
1,942
java
DiskUsagePlugin.java
Java
[]
null
[]
package fr.happinov.cordova.plugin.diskusage; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.os.Environment; import android.os.StatFs; import android.util.Log; import java.io.File; import java.util.HashMap; import java.util.Map; public class DiskUsagePlugin extends CordovaPlugin { private static final String TAG = DiskUsagePlugin.class.getSimpleName(); private static final String FREE_KEY = "free"; private static final String TOTAL_KEY = "total"; private static final String INTERNAL_KEY = "internal"; private static final String EXTERNAL_KEY = "external"; public DiskUsagePlugin() { } @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals("read")) readDiskData(callbackContext); else return false; return true; } private void readDiskData(CallbackContext callbackContext) throws JSONException { JSONObject result = new JSONObject(); result.put(INTERNAL_KEY,getStorageData(Environment.getDataDirectory())); if (isExternalStorageAvailable()) result.put(EXTERNAL_KEY,getStorageData(Environment.getExternalStorageDirectory())); Log.d(TAG,"Sending result:"+result); callbackContext.success(result); } private static boolean isExternalStorageAvailable() { //return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); return false; // Don't allow external storage support for now since it's broken. } private static JSONObject getStorageData(File refFile) throws JSONException { Log.d(TAG,"Getting storage data:"+refFile.getPath()); JSONObject result = new JSONObject(); StatFs stat = new StatFs(refFile.getPath()); result.put(FREE_KEY,stat.getAvailableBytes()); result.put(TOTAL_KEY,stat.getTotalBytes()); return result; } }
1,942
0.774459
0.774459
67
27.985075
27.750214
110
false
false
0
0
0
0
0
0
1.462687
false
false
8
1fbdf6135096ab64e65539357d822a4f1761275d
11,467,562,699,586
3abea87dcf37a23eb3b39bf5ffe395d24e7176a3
/src/RPG.java
4c34724b842553ee209bfbeaa1a47d8dab095a7c
[]
no_license
btaylor4/elsweyr
https://github.com/btaylor4/elsweyr
c7a49653e677d15eaf78cd80711a504c9c40fd07
7c807b05435efa98473fe1ec850447ed8a5b73ef
refs/heads/master
2021-03-27T10:29:57.750000
2018-02-03T23:11:48
2018-02-03T23:11:48
120,028,029
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javafx.application.Application; import javafx.stage.Stage; /** * Created by Bryan on 2/2/18. */ public class RPG extends Application{ @Override public void start(Stage stage) throws Exception { } public static void main(String[] args) { launch(args); } }
UTF-8
Java
296
java
RPG.java
Java
[ { "context": "ion;\nimport javafx.stage.Stage;\n\n/**\n * Created by Bryan on 2/2/18.\n */\npublic class RPG extends Applicati", "end": 90, "score": 0.9801384806632996, "start": 85, "tag": "NAME", "value": "Bryan" } ]
null
[]
import javafx.application.Application; import javafx.stage.Stage; /** * Created by Bryan on 2/2/18. */ public class RPG extends Application{ @Override public void start(Stage stage) throws Exception { } public static void main(String[] args) { launch(args); } }
296
0.662162
0.648649
17
16.411764
17.546774
53
false
false
0
0
0
0
0
0
0.176471
false
false
8
e2d0f0b4d06949d6818e3f159b10448538648510
26,869,315,469,328
55cdb08fead0c76af290d6e133718e52de9437c8
/src/finalproject/Deck.java
554f5cf032dc8f58522e5b46a203ed33167d788e
[]
no_license
LoLouise/War-Card-Game
https://github.com/LoLouise/War-Card-Game
23ef09ff8c5d13557e302795cfb641475fb819a4
347b6f16998245b6edad83a288504bb28f1adce0
refs/heads/master
2016-09-06T05:12:18.647000
2015-03-05T05:49:33
2015-03-05T05:49:33
31,698,023
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package finalproject; //ISE208 HW3 //Louise Lo //105884422 import java.util.*; public class Deck { ArrayList<Card> deck; Random generator = new Random(); //Constructor - creates a deck public Deck() { deck = new ArrayList<Card>(52); deckfiller(); } //Note D = Diamond, C = Clubs, H = Hearts, S = Spades, 1 = Ace, 11 = Jack, 12 = Queen, 13 = King //Fills the deck of cards in accending value with //Ace of Diamonds as the lowest and King of Spades as the highest public void deckfiller() { int i; for (i=1; i<=13; i++) { Card tempD = new Card (i, 'D'); deck.add(tempD); Card tempC = new Card (i, 'C'); deck.add(tempC); Card tempH = new Card (i, 'H'); deck.add(tempH); Card tempS = new Card (i, 'S'); deck.add(tempS); } } public void addCard (Card cardtoadd) { deck.add(cardtoadd); } public Card getCard(int position) { return deck.get(position); } public void removeCard(int position) { deck.remove(position); } public void addCards(ArrayList<Card> cards) { int i; for (i=0; i<cards.size();i++) { deck.add(cards.get(i)); } } //I chose to write a print method instead of a toString method since //I already wrote a toString method for the Card Class //This better facilitates printing each Card on a different line public void print() { int a; for (a=0;a<deck.size(); a++) { System.out.println(a + ": " + deck.get(a).toString()); } } //Shuffle method that removes a random card and places it at the end of the deck //Repeats 25 times public void shuffle() { //System.out.print("Shuffling numbers: "); int x; //Change max of x to shuffle a different number of times for (x=0;x<25;x++) { int randomIndex = generator.nextInt(52); //System.out.print(randomIndex+ ","); Card temptomove = deck.get(randomIndex); deck.remove(randomIndex); deck.add(temptomove); } System.out.println(); } //Extra Credit Shuffle Method: swaps two random cards //Repeats 25 times public void shuffle2() { //System.out.print("Shuffling numbers pairs: "); int y; //Change max of y to shuffle a different number of times for (y=0;y<25;y++) { int randomIndex1 = generator.nextInt(52); int randomIndex2 = generator.nextInt(52); //System.out.print("(" + randomIndex1+ "," + randomIndex2 + ") "); Card temptoswap1 = deck.get(randomIndex1); Card temptoswap2 = deck.get(randomIndex2); deck.set(randomIndex1, temptoswap2); deck.set(randomIndex2, temptoswap1); } System.out.println(); } public static void main (String [] args) { //Creates a new test deck Deck test = new Deck(); //Prints the new ordered deck before shuffling System.out.println("New Ordered Deck"); test.print(); //Shuffles by removing and adding to end (25 times) System.out.println(); System.out.println("Deck after using move to end shuffling"); test.shuffle(); test.print(); //Creates a second test deck Deck test2 = new Deck(); //Shuffles by swapping two cards (25 times) System.out.println(); System.out.println("Deck after using swap shuffling"); test2.shuffle2(); test2.print(); System.out.print("Card at position 5: " + test2.getCard(5).toString()); //Example of creating a new card and calling the card methods Card myCard = new Card (12, 'H'); System.out.println(); System.out.println("Value of my Card: " + myCard.getValue()); System.out.println("Suit of my Card: " + myCard.getSuit()); System.out.println("My Card: " + myCard.toString()); } }
UTF-8
Java
3,389
java
Deck.java
Java
[ { "context": "package finalproject;\n\n//ISE208 HW3\n//Louise Lo\n//105884422\n\nimport java.util.*;\npublic class Dec", "end": 47, "score": 0.9998481869697571, "start": 38, "tag": "NAME", "value": "Louise Lo" } ]
null
[]
package finalproject; //ISE208 HW3 //<NAME> //105884422 import java.util.*; public class Deck { ArrayList<Card> deck; Random generator = new Random(); //Constructor - creates a deck public Deck() { deck = new ArrayList<Card>(52); deckfiller(); } //Note D = Diamond, C = Clubs, H = Hearts, S = Spades, 1 = Ace, 11 = Jack, 12 = Queen, 13 = King //Fills the deck of cards in accending value with //Ace of Diamonds as the lowest and King of Spades as the highest public void deckfiller() { int i; for (i=1; i<=13; i++) { Card tempD = new Card (i, 'D'); deck.add(tempD); Card tempC = new Card (i, 'C'); deck.add(tempC); Card tempH = new Card (i, 'H'); deck.add(tempH); Card tempS = new Card (i, 'S'); deck.add(tempS); } } public void addCard (Card cardtoadd) { deck.add(cardtoadd); } public Card getCard(int position) { return deck.get(position); } public void removeCard(int position) { deck.remove(position); } public void addCards(ArrayList<Card> cards) { int i; for (i=0; i<cards.size();i++) { deck.add(cards.get(i)); } } //I chose to write a print method instead of a toString method since //I already wrote a toString method for the Card Class //This better facilitates printing each Card on a different line public void print() { int a; for (a=0;a<deck.size(); a++) { System.out.println(a + ": " + deck.get(a).toString()); } } //Shuffle method that removes a random card and places it at the end of the deck //Repeats 25 times public void shuffle() { //System.out.print("Shuffling numbers: "); int x; //Change max of x to shuffle a different number of times for (x=0;x<25;x++) { int randomIndex = generator.nextInt(52); //System.out.print(randomIndex+ ","); Card temptomove = deck.get(randomIndex); deck.remove(randomIndex); deck.add(temptomove); } System.out.println(); } //Extra Credit Shuffle Method: swaps two random cards //Repeats 25 times public void shuffle2() { //System.out.print("Shuffling numbers pairs: "); int y; //Change max of y to shuffle a different number of times for (y=0;y<25;y++) { int randomIndex1 = generator.nextInt(52); int randomIndex2 = generator.nextInt(52); //System.out.print("(" + randomIndex1+ "," + randomIndex2 + ") "); Card temptoswap1 = deck.get(randomIndex1); Card temptoswap2 = deck.get(randomIndex2); deck.set(randomIndex1, temptoswap2); deck.set(randomIndex2, temptoswap1); } System.out.println(); } public static void main (String [] args) { //Creates a new test deck Deck test = new Deck(); //Prints the new ordered deck before shuffling System.out.println("New Ordered Deck"); test.print(); //Shuffles by removing and adding to end (25 times) System.out.println(); System.out.println("Deck after using move to end shuffling"); test.shuffle(); test.print(); //Creates a second test deck Deck test2 = new Deck(); //Shuffles by swapping two cards (25 times) System.out.println(); System.out.println("Deck after using swap shuffling"); test2.shuffle2(); test2.print(); System.out.print("Card at position 5: " + test2.getCard(5).toString()); //Example of creating a new card and calling the card methods Card myCard = new Card (12, 'H'); System.out.println(); System.out.println("Value of my Card: " + myCard.getValue()); System.out.println("Suit of my Card: " + myCard.getSuit()); System.out.println("My Card: " + myCard.toString()); } }
3,386
0.685158
0.664798
141
23.035461
21.379189
96
false
false
0
0
0
0
0
0
1.234043
false
false
8
a5a44da4f5731285d91d425f87d50d598bb92264
6,605,659,733,599
0e5990224a786b4b59c60245cf23725e74c44d85
/jsd-manager/src/main/java/com/ald/jsd/mgr/web/controller/OperatorController.java
688132ee1642afab8f43e5c2be9a955b0e5ffb9f
[]
no_license
hctwgl/test3
https://github.com/hctwgl/test3
66a80b28794138995a6ecfc2d166496d40db4d44
dfb14b11336f2df2ce2c1eebeee164ba9cf1110f
refs/heads/master
2020-06-17T01:13:08.524000
2019-01-29T09:44:32
2019-01-29T09:44:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ald.jsd.mgr.web.controller; import java.nio.charset.Charset; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ald.fanbei.api.common.Constants; import com.ald.fanbei.api.common.util.DigestUtil; import com.ald.fanbei.api.common.util.StringUtil; import com.ald.jsd.mgr.dal.dao.MgrOperatorDao; import com.ald.jsd.mgr.dal.domain.MgrOperatorDo; import com.ald.jsd.mgr.spring.NotNeedLogin; import com.ald.jsd.mgr.web.LocalConstants; import com.ald.jsd.mgr.web.Sessions; import com.ald.jsd.mgr.web.dto.req.ModPwdReq; import com.ald.jsd.mgr.web.dto.req.OperatorEditReq; import com.ald.jsd.mgr.web.dto.resp.Resp; @Controller @ResponseBody @RequestMapping("/api/operator") public class OperatorController extends BaseController { @Resource private MgrOperatorDao mgrOperatorDao; @NotNeedLogin @RequestMapping(value = "/edit.json") public Resp<?> edit(@RequestBody @Valid OperatorEditReq params, HttpServletRequest request) { String operator = "byInvoke"; MgrOperatorDo operatorDo = null; if(params.id != null){ //edit operatorDo = mgrOperatorDao.getById(params.id); if(operatorDo == null) return Resp.fail("用户不存在"); }else{ //add operatorDo = mgrOperatorDao.getByUsername(params.username); if (null != operatorDo) return Resp.fail("用户名已存在"); operatorDo = new MgrOperatorDo(); operatorDo.setCreator(operator); operatorDo.setStatus(1); operatorDo.setUserName(params.username); } this.setPassword(operatorDo, params.passwd); operatorDo.setModifier(operator); operatorDo.setName(params.realName); operatorDo.setEmail(params.email); operatorDo.setMobile(params.phone); operatorDo.setPhone(params.phone); if (params.id != null) {//edit mgrOperatorDao.updateById(operatorDo); logger.info("do update operator success with operatorDo="+operatorDo); }else{ //add mgrOperatorDao.saveRecord(operatorDo); logger.info("do add operator success with operatorDo="+operatorDo); } return Resp.succ(); } /** * 修改密码 * @return */ @RequestMapping(value = "/modPwd.json") public Resp<?> modPwd(@RequestBody @Valid ModPwdReq params, HttpServletRequest request){ Long uid = Sessions.getUid(request); MgrOperatorDo optDo = mgrOperatorDao.getById(uid); byte[] saltBytes = DigestUtil.decodeHex(optDo.getSalt()); byte[] oriPwdBytes = DigestUtil.digestString(params.oriPasswd.getBytes(LocalConstants.UTF_8), saltBytes, Constants.DEFAULT_DIGEST_TIMES, Constants.SHA1); String oriPwd = DigestUtil.encodeHex(oriPwdBytes); String dbPwd = optDo.getPassword(); if (!StringUtils.equals(oriPwd, dbPwd)) { return Resp.fail("原密码错误!"); } byte[] newPwdBytes = DigestUtil.digestString(params.newPasswd.getBytes(LocalConstants.UTF_8), saltBytes, Constants.DEFAULT_DIGEST_TIMES, Constants.SHA1); String newPwd = DigestUtil.encodeHex(newPwdBytes); optDo.setPassword(newPwd); mgrOperatorDao.updateById(optDo); return Resp.succ(); } private void setPassword(MgrOperatorDo operatorDo, String passwd){ String pwd = LocalConstants.DEFAULT_PASSWD; if (operatorDo.getRid() != null) { //edit }else{ //add if(StringUtil.isNotBlank(passwd)) { pwd = passwd; } byte[] saltBytes = DigestUtil.generateSalt(8); String salt = DigestUtil.encodeHex(saltBytes); byte[] pwdBytes = DigestUtil.digestString(pwd.getBytes(Charset.forName("UTF-8")), saltBytes, Constants.DEFAULT_DIGEST_TIMES, Constants.SHA1); operatorDo.setPassword(DigestUtil.encodeHex(pwdBytes)); operatorDo.setSalt(salt); } } }
UTF-8
Java
4,336
java
OperatorController.java
Java
[ { "context": "tus(1);\n operatorDo.setUserName(params.username);\n }\n \n this.setPassword(ope", "end": 1863, "score": 0.8722459077835083, "start": 1855, "tag": "USERNAME", "value": "username" }, { "context": "\t\tif(StringUtil.isNotBlank(passwd)) {\n \t\t\tpwd = passwd;\n \t\t}\n byte[] saltBytes = DigestUti", "end": 3886, "score": 0.9988319277763367, "start": 3880, "tag": "PASSWORD", "value": "passwd" } ]
null
[]
package com.ald.jsd.mgr.web.controller; import java.nio.charset.Charset; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ald.fanbei.api.common.Constants; import com.ald.fanbei.api.common.util.DigestUtil; import com.ald.fanbei.api.common.util.StringUtil; import com.ald.jsd.mgr.dal.dao.MgrOperatorDao; import com.ald.jsd.mgr.dal.domain.MgrOperatorDo; import com.ald.jsd.mgr.spring.NotNeedLogin; import com.ald.jsd.mgr.web.LocalConstants; import com.ald.jsd.mgr.web.Sessions; import com.ald.jsd.mgr.web.dto.req.ModPwdReq; import com.ald.jsd.mgr.web.dto.req.OperatorEditReq; import com.ald.jsd.mgr.web.dto.resp.Resp; @Controller @ResponseBody @RequestMapping("/api/operator") public class OperatorController extends BaseController { @Resource private MgrOperatorDao mgrOperatorDao; @NotNeedLogin @RequestMapping(value = "/edit.json") public Resp<?> edit(@RequestBody @Valid OperatorEditReq params, HttpServletRequest request) { String operator = "byInvoke"; MgrOperatorDo operatorDo = null; if(params.id != null){ //edit operatorDo = mgrOperatorDao.getById(params.id); if(operatorDo == null) return Resp.fail("用户不存在"); }else{ //add operatorDo = mgrOperatorDao.getByUsername(params.username); if (null != operatorDo) return Resp.fail("用户名已存在"); operatorDo = new MgrOperatorDo(); operatorDo.setCreator(operator); operatorDo.setStatus(1); operatorDo.setUserName(params.username); } this.setPassword(operatorDo, params.passwd); operatorDo.setModifier(operator); operatorDo.setName(params.realName); operatorDo.setEmail(params.email); operatorDo.setMobile(params.phone); operatorDo.setPhone(params.phone); if (params.id != null) {//edit mgrOperatorDao.updateById(operatorDo); logger.info("do update operator success with operatorDo="+operatorDo); }else{ //add mgrOperatorDao.saveRecord(operatorDo); logger.info("do add operator success with operatorDo="+operatorDo); } return Resp.succ(); } /** * 修改密码 * @return */ @RequestMapping(value = "/modPwd.json") public Resp<?> modPwd(@RequestBody @Valid ModPwdReq params, HttpServletRequest request){ Long uid = Sessions.getUid(request); MgrOperatorDo optDo = mgrOperatorDao.getById(uid); byte[] saltBytes = DigestUtil.decodeHex(optDo.getSalt()); byte[] oriPwdBytes = DigestUtil.digestString(params.oriPasswd.getBytes(LocalConstants.UTF_8), saltBytes, Constants.DEFAULT_DIGEST_TIMES, Constants.SHA1); String oriPwd = DigestUtil.encodeHex(oriPwdBytes); String dbPwd = optDo.getPassword(); if (!StringUtils.equals(oriPwd, dbPwd)) { return Resp.fail("原密码错误!"); } byte[] newPwdBytes = DigestUtil.digestString(params.newPasswd.getBytes(LocalConstants.UTF_8), saltBytes, Constants.DEFAULT_DIGEST_TIMES, Constants.SHA1); String newPwd = DigestUtil.encodeHex(newPwdBytes); optDo.setPassword(newPwd); mgrOperatorDao.updateById(optDo); return Resp.succ(); } private void setPassword(MgrOperatorDo operatorDo, String passwd){ String pwd = LocalConstants.DEFAULT_PASSWD; if (operatorDo.getRid() != null) { //edit }else{ //add if(StringUtil.isNotBlank(passwd)) { pwd = <PASSWORD>; } byte[] saltBytes = DigestUtil.generateSalt(8); String salt = DigestUtil.encodeHex(saltBytes); byte[] pwdBytes = DigestUtil.digestString(pwd.getBytes(Charset.forName("UTF-8")), saltBytes, Constants.DEFAULT_DIGEST_TIMES, Constants.SHA1); operatorDo.setPassword(DigestUtil.encodeHex(pwdBytes)); operatorDo.setSalt(salt); } } }
4,340
0.681183
0.67932
113
37
29.988493
161
false
false
0
0
0
0
0
0
1.097345
false
false
8
30f9c17ea647439526cdb897c3e443922d85ff62
32,976,758,919,474
03e92eca1c566dc5621d70f6b9e700f7ea4fa04e
/Befunge/StackTopRevert.java
17d82a88c7527b4c8ea2264b2ebbc367f43b31cf
[]
no_license
ankutalev/16208_kutalev
https://github.com/ankutalev/16208_kutalev
15610a5075bb9dd50c37998a06ce8ee5996e081e
e36ecdc14960175074bb0a6a62c31bddb77db1bf
refs/heads/master
2021-09-16T07:19:36.850000
2018-06-18T12:35:01
2018-06-18T12:35:01
103,538,818
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class StackTopRevert implements Command { @Override public void execute(BefungeEnvironment context) { context.stackRevert(); } }
UTF-8
Java
156
java
StackTopRevert.java
Java
[]
null
[]
public class StackTopRevert implements Command { @Override public void execute(BefungeEnvironment context) { context.stackRevert(); } }
156
0.705128
0.705128
6
25
20.240225
53
false
false
0
0
0
0
0
0
0.166667
false
false
8
d38265eca1bcd073e6f1e74aabc4fbc00d79cd1b
6,940,667,154,180
0907c886f81331111e4e116ff0c274f47be71805
/sources/androidx/constraintlayout/widget/ConstraintLayout.java
0dbc64eeb261a7134b56883741bce64c50a164c5
[ "MIT" ]
permissive
Minionguyjpro/Ghostly-Skills
https://github.com/Minionguyjpro/Ghostly-Skills
18756dcdf351032c9af31ec08fdbd02db8f3f991
d1a1fb2498aec461da09deb3ef8d98083542baaf
refs/heads/Android-OS
2022-07-27T19:58:16.442000
2022-04-15T07:49:53
2022-04-15T07:49:53
415,272,874
2
0
MIT
false
2021-12-21T10:23:50
2021-10-09T10:12:36
2021-12-21T10:21:50
2021-12-21T10:23:49
269,863
1
0
0
Java
false
false
package androidx.constraintlayout.widget; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; import android.util.SparseIntArray; import android.view.View; import android.view.ViewGroup; import androidx.constraintlayout.solver.Metrics; import androidx.constraintlayout.solver.widgets.ConstraintAnchor; import androidx.constraintlayout.solver.widgets.ConstraintWidget; import androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer; import androidx.constraintlayout.solver.widgets.Guideline; import java.util.ArrayList; import java.util.HashMap; public class ConstraintLayout extends ViewGroup { SparseArray<View> mChildrenByIds = new SparseArray<>(); private ArrayList<ConstraintHelper> mConstraintHelpers = new ArrayList<>(4); private ConstraintSet mConstraintSet = null; private int mConstraintSetId = -1; private HashMap<String, Integer> mDesignIds = new HashMap<>(); private boolean mDirtyHierarchy = true; private int mLastMeasureHeight = -1; int mLastMeasureHeightMode = 0; int mLastMeasureHeightSize = -1; private int mLastMeasureWidth = -1; int mLastMeasureWidthMode = 0; int mLastMeasureWidthSize = -1; ConstraintWidgetContainer mLayoutWidget = new ConstraintWidgetContainer(); private int mMaxHeight = Integer.MAX_VALUE; private int mMaxWidth = Integer.MAX_VALUE; private Metrics mMetrics; private int mMinHeight = 0; private int mMinWidth = 0; private int mOptimizationLevel = 7; private final ArrayList<ConstraintWidget> mVariableDimensionsWidgets = new ArrayList<>(100); public boolean shouldDelayChildPressedState() { return false; } public void setDesignInformation(int i, Object obj, Object obj2) { if (i == 0 && (obj instanceof String) && (obj2 instanceof Integer)) { if (this.mDesignIds == null) { this.mDesignIds = new HashMap<>(); } String str = (String) obj; int indexOf = str.indexOf("/"); if (indexOf != -1) { str = str.substring(indexOf + 1); } this.mDesignIds.put(str, Integer.valueOf(((Integer) obj2).intValue())); } } public Object getDesignInformation(int i, Object obj) { if (i != 0 || !(obj instanceof String)) { return null; } String str = (String) obj; HashMap<String, Integer> hashMap = this.mDesignIds; if (hashMap == null || !hashMap.containsKey(str)) { return null; } return this.mDesignIds.get(str); } public ConstraintLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); init(attributeSet); } public void setId(int i) { this.mChildrenByIds.remove(getId()); super.setId(i); this.mChildrenByIds.put(getId(), this); } private void init(AttributeSet attributeSet) { this.mLayoutWidget.setCompanionWidget(this); this.mChildrenByIds.put(getId(), this); this.mConstraintSet = null; if (attributeSet != null) { TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, R.styleable.ConstraintLayout_Layout); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i = 0; i < indexCount; i++) { int index = obtainStyledAttributes.getIndex(i); if (index == R.styleable.ConstraintLayout_Layout_android_minWidth) { this.mMinWidth = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMinWidth); } else if (index == R.styleable.ConstraintLayout_Layout_android_minHeight) { this.mMinHeight = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMinHeight); } else if (index == R.styleable.ConstraintLayout_Layout_android_maxWidth) { this.mMaxWidth = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMaxWidth); } else if (index == R.styleable.ConstraintLayout_Layout_android_maxHeight) { this.mMaxHeight = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMaxHeight); } else if (index == R.styleable.ConstraintLayout_Layout_layout_optimizationLevel) { this.mOptimizationLevel = obtainStyledAttributes.getInt(index, this.mOptimizationLevel); } else if (index == R.styleable.ConstraintLayout_Layout_constraintSet) { int resourceId = obtainStyledAttributes.getResourceId(index, 0); try { ConstraintSet constraintSet = new ConstraintSet(); this.mConstraintSet = constraintSet; constraintSet.load(getContext(), resourceId); } catch (Resources.NotFoundException unused) { this.mConstraintSet = null; } this.mConstraintSetId = resourceId; } } obtainStyledAttributes.recycle(); } this.mLayoutWidget.setOptimizationLevel(this.mOptimizationLevel); } public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { super.addView(view, i, layoutParams); if (Build.VERSION.SDK_INT < 14) { onViewAdded(view); } } public void removeView(View view) { super.removeView(view); if (Build.VERSION.SDK_INT < 14) { onViewRemoved(view); } } public void onViewAdded(View view) { if (Build.VERSION.SDK_INT >= 14) { super.onViewAdded(view); } ConstraintWidget viewWidget = getViewWidget(view); if ((view instanceof Guideline) && !(viewWidget instanceof Guideline)) { LayoutParams layoutParams = (LayoutParams) view.getLayoutParams(); layoutParams.widget = new Guideline(); layoutParams.isGuideline = true; ((Guideline) layoutParams.widget).setOrientation(layoutParams.orientation); } if (view instanceof ConstraintHelper) { ConstraintHelper constraintHelper = (ConstraintHelper) view; constraintHelper.validateParams(); ((LayoutParams) view.getLayoutParams()).isHelper = true; if (!this.mConstraintHelpers.contains(constraintHelper)) { this.mConstraintHelpers.add(constraintHelper); } } this.mChildrenByIds.put(view.getId(), view); this.mDirtyHierarchy = true; } public void onViewRemoved(View view) { if (Build.VERSION.SDK_INT >= 14) { super.onViewRemoved(view); } this.mChildrenByIds.remove(view.getId()); ConstraintWidget viewWidget = getViewWidget(view); this.mLayoutWidget.remove(viewWidget); this.mConstraintHelpers.remove(view); this.mVariableDimensionsWidgets.remove(viewWidget); this.mDirtyHierarchy = true; } public void setMinWidth(int i) { if (i != this.mMinWidth) { this.mMinWidth = i; requestLayout(); } } public void setMinHeight(int i) { if (i != this.mMinHeight) { this.mMinHeight = i; requestLayout(); } } public int getMinWidth() { return this.mMinWidth; } public int getMinHeight() { return this.mMinHeight; } public void setMaxWidth(int i) { if (i != this.mMaxWidth) { this.mMaxWidth = i; requestLayout(); } } public void setMaxHeight(int i) { if (i != this.mMaxHeight) { this.mMaxHeight = i; requestLayout(); } } public int getMaxWidth() { return this.mMaxWidth; } public int getMaxHeight() { return this.mMaxHeight; } private void updateHierarchy() { int childCount = getChildCount(); boolean z = false; int i = 0; while (true) { if (i >= childCount) { break; } else if (getChildAt(i).isLayoutRequested()) { z = true; break; } else { i++; } } if (z) { this.mVariableDimensionsWidgets.clear(); setChildrenConstraints(); } } private void setChildrenConstraints() { int i; int i2; float f; int i3; float f2; ConstraintWidget targetWidget; ConstraintWidget targetWidget2; ConstraintWidget targetWidget3; ConstraintWidget targetWidget4; boolean isInEditMode = isInEditMode(); int childCount = getChildCount(); boolean z = false; if (isInEditMode) { for (int i4 = 0; i4 < childCount; i4++) { View childAt = getChildAt(i4); try { String resourceName = getResources().getResourceName(childAt.getId()); setDesignInformation(0, resourceName, Integer.valueOf(childAt.getId())); int indexOf = resourceName.indexOf(47); if (indexOf != -1) { resourceName = resourceName.substring(indexOf + 1); } getTargetWidget(childAt.getId()).setDebugName(resourceName); } catch (Resources.NotFoundException unused) { } } } for (int i5 = 0; i5 < childCount; i5++) { ConstraintWidget viewWidget = getViewWidget(getChildAt(i5)); if (viewWidget != null) { viewWidget.reset(); } } if (this.mConstraintSetId != -1) { for (int i6 = 0; i6 < childCount; i6++) { View childAt2 = getChildAt(i6); if (childAt2.getId() == this.mConstraintSetId && (childAt2 instanceof Constraints)) { this.mConstraintSet = ((Constraints) childAt2).getConstraintSet(); } } } ConstraintSet constraintSet = this.mConstraintSet; if (constraintSet != null) { constraintSet.applyToInternal(this); } this.mLayoutWidget.removeAllChildren(); int size = this.mConstraintHelpers.size(); if (size > 0) { for (int i7 = 0; i7 < size; i7++) { this.mConstraintHelpers.get(i7).updatePreLayout(this); } } for (int i8 = 0; i8 < childCount; i8++) { View childAt3 = getChildAt(i8); if (childAt3 instanceof Placeholder) { ((Placeholder) childAt3).updatePreLayout(this); } } for (int i9 = 0; i9 < childCount; i9++) { View childAt4 = getChildAt(i9); ConstraintWidget viewWidget2 = getViewWidget(childAt4); if (viewWidget2 != null) { LayoutParams layoutParams = (LayoutParams) childAt4.getLayoutParams(); layoutParams.validate(); if (layoutParams.helped) { layoutParams.helped = z; } else if (isInEditMode) { try { String resourceName2 = getResources().getResourceName(childAt4.getId()); setDesignInformation(z ? 1 : 0, resourceName2, Integer.valueOf(childAt4.getId())); getTargetWidget(childAt4.getId()).setDebugName(resourceName2.substring(resourceName2.indexOf("id/") + 3)); } catch (Resources.NotFoundException unused2) { } } viewWidget2.setVisibility(childAt4.getVisibility()); if (layoutParams.isInPlaceholder) { viewWidget2.setVisibility(8); } viewWidget2.setCompanionWidget(childAt4); this.mLayoutWidget.add(viewWidget2); if (!layoutParams.verticalDimensionFixed || !layoutParams.horizontalDimensionFixed) { this.mVariableDimensionsWidgets.add(viewWidget2); } if (layoutParams.isGuideline) { Guideline guideline = (Guideline) viewWidget2; int i10 = layoutParams.resolvedGuideBegin; int i11 = layoutParams.resolvedGuideEnd; float f3 = layoutParams.resolvedGuidePercent; if (Build.VERSION.SDK_INT < 17) { i10 = layoutParams.guideBegin; i11 = layoutParams.guideEnd; f3 = layoutParams.guidePercent; } if (f3 != -1.0f) { guideline.setGuidePercent(f3); } else if (i10 != -1) { guideline.setGuideBegin(i10); } else if (i11 != -1) { guideline.setGuideEnd(i11); } } else if (layoutParams.leftToLeft != -1 || layoutParams.leftToRight != -1 || layoutParams.rightToLeft != -1 || layoutParams.rightToRight != -1 || layoutParams.startToStart != -1 || layoutParams.startToEnd != -1 || layoutParams.endToStart != -1 || layoutParams.endToEnd != -1 || layoutParams.topToTop != -1 || layoutParams.topToBottom != -1 || layoutParams.bottomToTop != -1 || layoutParams.bottomToBottom != -1 || layoutParams.baselineToBaseline != -1 || layoutParams.editorAbsoluteX != -1 || layoutParams.editorAbsoluteY != -1 || layoutParams.circleConstraint != -1 || layoutParams.width == -1 || layoutParams.height == -1) { int i12 = layoutParams.resolvedLeftToLeft; int i13 = layoutParams.resolvedLeftToRight; int i14 = layoutParams.resolvedRightToLeft; int i15 = layoutParams.resolvedRightToRight; int i16 = layoutParams.resolveGoneLeftMargin; int i17 = layoutParams.resolveGoneRightMargin; float f4 = layoutParams.resolvedHorizontalBias; if (Build.VERSION.SDK_INT < 17) { int i18 = layoutParams.leftToLeft; int i19 = layoutParams.leftToRight; int i20 = layoutParams.rightToLeft; i15 = layoutParams.rightToRight; int i21 = layoutParams.goneLeftMargin; int i22 = layoutParams.goneRightMargin; float f5 = layoutParams.horizontalBias; if (i18 == -1 && i19 == -1) { if (layoutParams.startToStart != -1) { i18 = layoutParams.startToStart; } else if (layoutParams.startToEnd != -1) { i19 = layoutParams.startToEnd; } } int i23 = i19; i12 = i18; int i24 = i23; if (i20 == -1 && i15 == -1) { if (layoutParams.endToStart != -1) { i20 = layoutParams.endToStart; } else if (layoutParams.endToEnd != -1) { i15 = layoutParams.endToEnd; } } i2 = i21; i = i22; f = f5; i13 = i24; i3 = i20; } else { i3 = i14; i = i17; i2 = i16; f = f4; } int i25 = i15; if (layoutParams.circleConstraint != -1) { ConstraintWidget targetWidget5 = getTargetWidget(layoutParams.circleConstraint); if (targetWidget5 != null) { viewWidget2.connectCircularConstraint(targetWidget5, layoutParams.circleAngle, layoutParams.circleRadius); } } else { if (i12 != -1) { ConstraintWidget targetWidget6 = getTargetWidget(i12); if (targetWidget6 != null) { f2 = f; viewWidget2.immediateConnect(ConstraintAnchor.Type.LEFT, targetWidget6, ConstraintAnchor.Type.LEFT, layoutParams.leftMargin, i2); } else { f2 = f; } } else { f2 = f; if (!(i13 == -1 || (targetWidget4 = getTargetWidget(i13)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.LEFT, targetWidget4, ConstraintAnchor.Type.RIGHT, layoutParams.leftMargin, i2); } } if (i3 != -1) { ConstraintWidget targetWidget7 = getTargetWidget(i3); if (targetWidget7 != null) { viewWidget2.immediateConnect(ConstraintAnchor.Type.RIGHT, targetWidget7, ConstraintAnchor.Type.LEFT, layoutParams.rightMargin, i); } } else if (!(i25 == -1 || (targetWidget3 = getTargetWidget(i25)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.RIGHT, targetWidget3, ConstraintAnchor.Type.RIGHT, layoutParams.rightMargin, i); } if (layoutParams.topToTop != -1) { ConstraintWidget targetWidget8 = getTargetWidget(layoutParams.topToTop); if (targetWidget8 != null) { viewWidget2.immediateConnect(ConstraintAnchor.Type.TOP, targetWidget8, ConstraintAnchor.Type.TOP, layoutParams.topMargin, layoutParams.goneTopMargin); } } else if (!(layoutParams.topToBottom == -1 || (targetWidget2 = getTargetWidget(layoutParams.topToBottom)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.TOP, targetWidget2, ConstraintAnchor.Type.BOTTOM, layoutParams.topMargin, layoutParams.goneTopMargin); } if (layoutParams.bottomToTop != -1) { ConstraintWidget targetWidget9 = getTargetWidget(layoutParams.bottomToTop); if (targetWidget9 != null) { viewWidget2.immediateConnect(ConstraintAnchor.Type.BOTTOM, targetWidget9, ConstraintAnchor.Type.TOP, layoutParams.bottomMargin, layoutParams.goneBottomMargin); } } else if (!(layoutParams.bottomToBottom == -1 || (targetWidget = getTargetWidget(layoutParams.bottomToBottom)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.BOTTOM, targetWidget, ConstraintAnchor.Type.BOTTOM, layoutParams.bottomMargin, layoutParams.goneBottomMargin); } if (layoutParams.baselineToBaseline != -1) { View view = this.mChildrenByIds.get(layoutParams.baselineToBaseline); ConstraintWidget targetWidget10 = getTargetWidget(layoutParams.baselineToBaseline); if (!(targetWidget10 == null || view == null || !(view.getLayoutParams() instanceof LayoutParams))) { layoutParams.needsBaseline = true; ((LayoutParams) view.getLayoutParams()).needsBaseline = true; viewWidget2.getAnchor(ConstraintAnchor.Type.BASELINE).connect(targetWidget10.getAnchor(ConstraintAnchor.Type.BASELINE), 0, -1, ConstraintAnchor.Strength.STRONG, 0, true); viewWidget2.getAnchor(ConstraintAnchor.Type.TOP).reset(); viewWidget2.getAnchor(ConstraintAnchor.Type.BOTTOM).reset(); } } float f6 = f2; if (f6 >= 0.0f && f6 != 0.5f) { viewWidget2.setHorizontalBiasPercent(f6); } if (layoutParams.verticalBias >= 0.0f && layoutParams.verticalBias != 0.5f) { viewWidget2.setVerticalBiasPercent(layoutParams.verticalBias); } } if (isInEditMode && !(layoutParams.editorAbsoluteX == -1 && layoutParams.editorAbsoluteY == -1)) { viewWidget2.setOrigin(layoutParams.editorAbsoluteX, layoutParams.editorAbsoluteY); } if (layoutParams.horizontalDimensionFixed) { viewWidget2.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED); viewWidget2.setWidth(layoutParams.width); } else if (layoutParams.width == -1) { viewWidget2.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_PARENT); viewWidget2.getAnchor(ConstraintAnchor.Type.LEFT).mMargin = layoutParams.leftMargin; viewWidget2.getAnchor(ConstraintAnchor.Type.RIGHT).mMargin = layoutParams.rightMargin; } else { viewWidget2.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT); viewWidget2.setWidth(0); } if (layoutParams.verticalDimensionFixed) { z = false; viewWidget2.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED); viewWidget2.setHeight(layoutParams.height); } else if (layoutParams.height == -1) { viewWidget2.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_PARENT); viewWidget2.getAnchor(ConstraintAnchor.Type.TOP).mMargin = layoutParams.topMargin; viewWidget2.getAnchor(ConstraintAnchor.Type.BOTTOM).mMargin = layoutParams.bottomMargin; z = false; } else { viewWidget2.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT); z = false; viewWidget2.setHeight(0); } if (layoutParams.dimensionRatio != null) { viewWidget2.setDimensionRatio(layoutParams.dimensionRatio); } viewWidget2.setHorizontalWeight(layoutParams.horizontalWeight); viewWidget2.setVerticalWeight(layoutParams.verticalWeight); viewWidget2.setHorizontalChainStyle(layoutParams.horizontalChainStyle); viewWidget2.setVerticalChainStyle(layoutParams.verticalChainStyle); viewWidget2.setHorizontalMatchStyle(layoutParams.matchConstraintDefaultWidth, layoutParams.matchConstraintMinWidth, layoutParams.matchConstraintMaxWidth, layoutParams.matchConstraintPercentWidth); viewWidget2.setVerticalMatchStyle(layoutParams.matchConstraintDefaultHeight, layoutParams.matchConstraintMinHeight, layoutParams.matchConstraintMaxHeight, layoutParams.matchConstraintPercentHeight); } } } } private final ConstraintWidget getTargetWidget(int i) { if (i == 0) { return this.mLayoutWidget; } View view = this.mChildrenByIds.get(i); if (view == null && (view = findViewById(i)) != null && view != this && view.getParent() == this) { onViewAdded(view); } if (view == this) { return this.mLayoutWidget; } if (view == null) { return null; } return ((LayoutParams) view.getLayoutParams()).widget; } public final ConstraintWidget getViewWidget(View view) { if (view == this) { return this.mLayoutWidget; } if (view == null) { return null; } return ((LayoutParams) view.getLayoutParams()).widget; } private void internalMeasureChildren(int i, int i2) { boolean z; boolean z2; int baseline; int i3; int i4; int i5 = i; int i6 = i2; int paddingTop = getPaddingTop() + getPaddingBottom(); int paddingLeft = getPaddingLeft() + getPaddingRight(); int childCount = getChildCount(); for (int i7 = 0; i7 < childCount; i7++) { View childAt = getChildAt(i7); if (childAt.getVisibility() != 8) { LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams(); ConstraintWidget constraintWidget = layoutParams.widget; if (!layoutParams.isGuideline && !layoutParams.isHelper) { constraintWidget.setVisibility(childAt.getVisibility()); int i8 = layoutParams.width; int i9 = layoutParams.height; if (layoutParams.horizontalDimensionFixed || layoutParams.verticalDimensionFixed || (!layoutParams.horizontalDimensionFixed && layoutParams.matchConstraintDefaultWidth == 1) || layoutParams.width == -1 || (!layoutParams.verticalDimensionFixed && (layoutParams.matchConstraintDefaultHeight == 1 || layoutParams.height == -1))) { if (i8 == 0) { i3 = getChildMeasureSpec(i5, paddingLeft, -2); z2 = true; } else if (i8 == -1) { i3 = getChildMeasureSpec(i5, paddingLeft, -1); z2 = false; } else { z2 = i8 == -2; i3 = getChildMeasureSpec(i5, paddingLeft, i8); } if (i9 == 0) { i4 = getChildMeasureSpec(i6, paddingTop, -2); z = true; } else if (i9 == -1) { i4 = getChildMeasureSpec(i6, paddingTop, -1); z = false; } else { z = i9 == -2; i4 = getChildMeasureSpec(i6, paddingTop, i9); } childAt.measure(i3, i4); Metrics metrics = this.mMetrics; if (metrics != null) { metrics.measures++; } constraintWidget.setWidthWrapContent(i8 == -2); constraintWidget.setHeightWrapContent(i9 == -2); i8 = childAt.getMeasuredWidth(); i9 = childAt.getMeasuredHeight(); } else { z2 = false; z = false; } constraintWidget.setWidth(i8); constraintWidget.setHeight(i9); if (z2) { constraintWidget.setWrapWidth(i8); } if (z) { constraintWidget.setWrapHeight(i9); } if (layoutParams.needsBaseline && (baseline = childAt.getBaseline()) != -1) { constraintWidget.setBaselineDistance(baseline); } } } } } private void updatePostMeasures() { int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View childAt = getChildAt(i); if (childAt instanceof Placeholder) { ((Placeholder) childAt).updatePostMeasure(this); } } int size = this.mConstraintHelpers.size(); if (size > 0) { for (int i2 = 0; i2 < size; i2++) { this.mConstraintHelpers.get(i2).updatePostMeasure(this); } } } /* JADX WARNING: Removed duplicated region for block: B:108:0x0209 */ /* JADX WARNING: Removed duplicated region for block: B:118:0x0242 */ /* JADX WARNING: Removed duplicated region for block: B:128:0x0266 */ /* JADX WARNING: Removed duplicated region for block: B:129:0x026f */ /* JADX WARNING: Removed duplicated region for block: B:132:0x0274 */ /* JADX WARNING: Removed duplicated region for block: B:133:0x0276 */ /* JADX WARNING: Removed duplicated region for block: B:136:0x027c */ /* JADX WARNING: Removed duplicated region for block: B:137:0x027e */ /* JADX WARNING: Removed duplicated region for block: B:140:0x0292 */ /* JADX WARNING: Removed duplicated region for block: B:142:0x0297 */ /* JADX WARNING: Removed duplicated region for block: B:144:0x029c */ /* JADX WARNING: Removed duplicated region for block: B:145:0x02a4 */ /* JADX WARNING: Removed duplicated region for block: B:147:0x02ad */ /* JADX WARNING: Removed duplicated region for block: B:148:0x02b5 */ /* JADX WARNING: Removed duplicated region for block: B:151:0x02c2 */ /* JADX WARNING: Removed duplicated region for block: B:154:0x02cd */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void internalMeasureDimensions(int r24, int r25) { /* r23 = this; r0 = r23 r1 = r24 r2 = r25 int r3 = r23.getPaddingTop() int r4 = r23.getPaddingBottom() int r3 = r3 + r4 int r4 = r23.getPaddingLeft() int r5 = r23.getPaddingRight() int r4 = r4 + r5 int r5 = r23.getChildCount() r7 = 0 L_0x001d: r8 = 1 r10 = 8 r12 = -2 if (r7 >= r5) goto L_0x00dc android.view.View r14 = r0.getChildAt(r7) int r15 = r14.getVisibility() if (r15 != r10) goto L_0x0030 goto L_0x00d4 L_0x0030: android.view.ViewGroup$LayoutParams r10 = r14.getLayoutParams() androidx.constraintlayout.widget.ConstraintLayout$LayoutParams r10 = (androidx.constraintlayout.widget.ConstraintLayout.LayoutParams) r10 androidx.constraintlayout.solver.widgets.ConstraintWidget r15 = r10.widget boolean r6 = r10.isGuideline if (r6 != 0) goto L_0x00d4 boolean r6 = r10.isHelper if (r6 == 0) goto L_0x0042 goto L_0x00d4 L_0x0042: int r6 = r14.getVisibility() r15.setVisibility(r6) int r6 = r10.width int r13 = r10.height if (r6 == 0) goto L_0x00c4 if (r13 != 0) goto L_0x0053 goto L_0x00c4 L_0x0053: if (r6 != r12) goto L_0x0058 r16 = 1 goto L_0x005a L_0x0058: r16 = 0 L_0x005a: int r11 = getChildMeasureSpec(r1, r4, r6) if (r13 != r12) goto L_0x0063 r17 = 1 goto L_0x0065 L_0x0063: r17 = 0 L_0x0065: int r12 = getChildMeasureSpec(r2, r3, r13) r14.measure(r11, r12) androidx.constraintlayout.solver.Metrics r11 = r0.mMetrics r12 = r3 if (r11 == 0) goto L_0x0076 long r2 = r11.measures long r2 = r2 + r8 r11.measures = r2 L_0x0076: r2 = -2 if (r6 != r2) goto L_0x007b r3 = 1 goto L_0x007c L_0x007b: r3 = 0 L_0x007c: r15.setWidthWrapContent(r3) if (r13 != r2) goto L_0x0083 r13 = 1 goto L_0x0084 L_0x0083: r13 = 0 L_0x0084: r15.setHeightWrapContent(r13) int r2 = r14.getMeasuredWidth() int r3 = r14.getMeasuredHeight() r15.setWidth(r2) r15.setHeight(r3) if (r16 == 0) goto L_0x009a r15.setWrapWidth(r2) L_0x009a: if (r17 == 0) goto L_0x009f r15.setWrapHeight(r3) L_0x009f: boolean r6 = r10.needsBaseline if (r6 == 0) goto L_0x00ad int r6 = r14.getBaseline() r8 = -1 if (r6 == r8) goto L_0x00ad r15.setBaselineDistance(r6) L_0x00ad: boolean r6 = r10.horizontalDimensionFixed if (r6 == 0) goto L_0x00d5 boolean r6 = r10.verticalDimensionFixed if (r6 == 0) goto L_0x00d5 androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r15.getResolutionWidth() r6.resolve(r2) androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r15.getResolutionHeight() r2.resolve(r3) goto L_0x00d5 L_0x00c4: r12 = r3 androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r15.getResolutionWidth() r2.invalidate() androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r15.getResolutionHeight() r2.invalidate() goto L_0x00d5 L_0x00d4: r12 = r3 L_0x00d5: int r7 = r7 + 1 r2 = r25 r3 = r12 goto L_0x001d L_0x00dc: r12 = r3 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r2 = r0.mLayoutWidget r2.solveGraph() r2 = 0 L_0x00e3: if (r2 >= r5) goto L_0x02e6 android.view.View r3 = r0.getChildAt(r2) int r6 = r3.getVisibility() if (r6 != r10) goto L_0x00f1 goto L_0x02cf L_0x00f1: android.view.ViewGroup$LayoutParams r6 = r3.getLayoutParams() androidx.constraintlayout.widget.ConstraintLayout$LayoutParams r6 = (androidx.constraintlayout.widget.ConstraintLayout.LayoutParams) r6 androidx.constraintlayout.solver.widgets.ConstraintWidget r7 = r6.widget boolean r11 = r6.isGuideline if (r11 != 0) goto L_0x02cf boolean r11 = r6.isHelper if (r11 == 0) goto L_0x0103 goto L_0x02cf L_0x0103: int r11 = r3.getVisibility() r7.setVisibility(r11) int r11 = r6.width int r13 = r6.height if (r11 == 0) goto L_0x0114 if (r13 == 0) goto L_0x0114 goto L_0x02cf L_0x0114: androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r14 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.LEFT androidx.constraintlayout.solver.widgets.ConstraintAnchor r14 = r7.getAnchor(r14) androidx.constraintlayout.solver.widgets.ResolutionAnchor r14 = r14.getResolutionNode() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r15 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.RIGHT androidx.constraintlayout.solver.widgets.ConstraintAnchor r15 = r7.getAnchor(r15) androidx.constraintlayout.solver.widgets.ResolutionAnchor r15 = r15.getResolutionNode() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r10 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.LEFT androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r7.getAnchor(r10) androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r10.getTarget() if (r10 == 0) goto L_0x0142 androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r10 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.RIGHT androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r7.getAnchor(r10) androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r10.getTarget() if (r10 == 0) goto L_0x0142 r10 = 1 goto L_0x0143 L_0x0142: r10 = 0 L_0x0143: androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r8 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.TOP androidx.constraintlayout.solver.widgets.ConstraintAnchor r8 = r7.getAnchor(r8) androidx.constraintlayout.solver.widgets.ResolutionAnchor r8 = r8.getResolutionNode() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r9 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.BOTTOM androidx.constraintlayout.solver.widgets.ConstraintAnchor r9 = r7.getAnchor(r9) androidx.constraintlayout.solver.widgets.ResolutionAnchor r9 = r9.getResolutionNode() r17 = r5 androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r5 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.TOP androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r7.getAnchor(r5) androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r5.getTarget() if (r5 == 0) goto L_0x0173 androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r5 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.BOTTOM androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r7.getAnchor(r5) androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r5.getTarget() if (r5 == 0) goto L_0x0173 r5 = 1 goto L_0x0174 L_0x0173: r5 = 0 L_0x0174: if (r11 != 0) goto L_0x0187 if (r13 != 0) goto L_0x0187 if (r10 == 0) goto L_0x0187 if (r5 == 0) goto L_0x0187 r5 = r25 r6 = r0 r20 = r2 r2 = -1 r8 = -2 r18 = 1 goto L_0x02da L_0x0187: r20 = r2 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r2 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r2 = r2.getHorizontalDimensionBehaviour() r21 = r6 androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r2 == r6) goto L_0x0197 r2 = 1 goto L_0x0198 L_0x0197: r2 = 0 L_0x0198: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r6 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = r6.getVerticalDimensionBehaviour() androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r0 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r6 == r0) goto L_0x01a4 r0 = 1 goto L_0x01a5 L_0x01a4: r0 = 0 L_0x01a5: if (r2 != 0) goto L_0x01ae androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r7.getResolutionWidth() r6.invalidate() L_0x01ae: if (r0 != 0) goto L_0x01b7 androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r7.getResolutionHeight() r6.invalidate() L_0x01b7: if (r11 != 0) goto L_0x01ee if (r2 == 0) goto L_0x01e5 boolean r6 = r7.isSpreadWidth() if (r6 == 0) goto L_0x01e5 if (r10 == 0) goto L_0x01e5 boolean r6 = r14.isResolved() if (r6 == 0) goto L_0x01e5 boolean r6 = r15.isResolved() if (r6 == 0) goto L_0x01e5 float r6 = r15.getResolvedValue() float r10 = r14.getResolvedValue() float r6 = r6 - r10 int r11 = (int) r6 androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r7.getResolutionWidth() r6.resolve(r11) int r6 = getChildMeasureSpec(r1, r4, r11) goto L_0x01f7 L_0x01e5: r6 = -2 int r2 = getChildMeasureSpec(r1, r4, r6) r6 = r2 r2 = 0 r10 = 1 goto L_0x0207 L_0x01ee: r6 = -2 r10 = -1 if (r11 != r10) goto L_0x01f9 int r14 = getChildMeasureSpec(r1, r4, r10) r6 = r14 L_0x01f7: r10 = 0 goto L_0x0207 L_0x01f9: if (r11 != r6) goto L_0x01fd r6 = 1 goto L_0x01fe L_0x01fd: r6 = 0 L_0x01fe: int r10 = getChildMeasureSpec(r1, r4, r11) r22 = r10 r10 = r6 r6 = r22 L_0x0207: if (r13 != 0) goto L_0x0242 if (r0 == 0) goto L_0x0237 boolean r14 = r7.isSpreadHeight() if (r14 == 0) goto L_0x0237 if (r5 == 0) goto L_0x0237 boolean r5 = r8.isResolved() if (r5 == 0) goto L_0x0237 boolean r5 = r9.isResolved() if (r5 == 0) goto L_0x0237 float r5 = r9.getResolvedValue() float r8 = r8.getResolvedValue() float r5 = r5 - r8 int r13 = (int) r5 androidx.constraintlayout.solver.widgets.ResolutionDimension r5 = r7.getResolutionHeight() r5.resolve(r13) r5 = r25 int r8 = getChildMeasureSpec(r5, r12, r13) goto L_0x024d L_0x0237: r5 = r25 r8 = -2 int r0 = getChildMeasureSpec(r5, r12, r8) r8 = r0 r0 = 0 r9 = 1 goto L_0x025d L_0x0242: r5 = r25 r8 = -2 r9 = -1 if (r13 != r9) goto L_0x024f int r14 = getChildMeasureSpec(r5, r12, r9) r8 = r14 L_0x024d: r9 = 0 goto L_0x025d L_0x024f: if (r13 != r8) goto L_0x0253 r8 = 1 goto L_0x0254 L_0x0253: r8 = 0 L_0x0254: int r9 = getChildMeasureSpec(r5, r12, r13) r22 = r9 r9 = r8 r8 = r22 L_0x025d: r3.measure(r6, r8) r6 = r23 androidx.constraintlayout.solver.Metrics r8 = r6.mMetrics if (r8 == 0) goto L_0x026f long r14 = r8.measures r18 = 1 long r14 = r14 + r18 r8.measures = r14 goto L_0x0271 L_0x026f: r18 = 1 L_0x0271: r8 = -2 if (r11 != r8) goto L_0x0276 r11 = 1 goto L_0x0277 L_0x0276: r11 = 0 L_0x0277: r7.setWidthWrapContent(r11) if (r13 != r8) goto L_0x027e r11 = 1 goto L_0x027f L_0x027e: r11 = 0 L_0x027f: r7.setHeightWrapContent(r11) int r11 = r3.getMeasuredWidth() int r13 = r3.getMeasuredHeight() r7.setWidth(r11) r7.setHeight(r13) if (r10 == 0) goto L_0x0295 r7.setWrapWidth(r11) L_0x0295: if (r9 == 0) goto L_0x029a r7.setWrapHeight(r13) L_0x029a: if (r2 == 0) goto L_0x02a4 androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r7.getResolutionWidth() r2.resolve(r11) goto L_0x02ab L_0x02a4: androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r7.getResolutionWidth() r2.remove() L_0x02ab: if (r0 == 0) goto L_0x02b5 androidx.constraintlayout.solver.widgets.ResolutionDimension r0 = r7.getResolutionHeight() r0.resolve(r13) goto L_0x02bc L_0x02b5: androidx.constraintlayout.solver.widgets.ResolutionDimension r0 = r7.getResolutionHeight() r0.remove() L_0x02bc: r0 = r21 boolean r0 = r0.needsBaseline if (r0 == 0) goto L_0x02cd int r0 = r3.getBaseline() r2 = -1 if (r0 == r2) goto L_0x02da r7.setBaselineDistance(r0) goto L_0x02da L_0x02cd: r2 = -1 goto L_0x02da L_0x02cf: r6 = r0 r20 = r2 r17 = r5 r18 = r8 r2 = -1 r8 = -2 r5 = r25 L_0x02da: int r0 = r20 + 1 r2 = r0 r0 = r6 r5 = r17 r8 = r18 r10 = 8 goto L_0x00e3 L_0x02e6: r6 = r0 return */ throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.widget.ConstraintLayout.internalMeasureDimensions(int, int):void"); } /* access modifiers changed from: protected */ /* JADX WARNING: Removed duplicated region for block: B:173:0x037a */ /* JADX WARNING: Removed duplicated region for block: B:176:0x0390 */ /* JADX WARNING: Removed duplicated region for block: B:183:0x03c9 */ /* JADX WARNING: Removed duplicated region for block: B:62:0x013a */ /* JADX WARNING: Removed duplicated region for block: B:65:0x0151 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void onMeasure(int r24, int r25) { /* r23 = this; r0 = r23 r1 = r24 r2 = r25 java.lang.System.currentTimeMillis() int r3 = android.view.View.MeasureSpec.getMode(r24) int r4 = android.view.View.MeasureSpec.getSize(r24) int r5 = android.view.View.MeasureSpec.getMode(r25) int r6 = android.view.View.MeasureSpec.getSize(r25) int r7 = r23.getPaddingLeft() int r8 = r23.getPaddingTop() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget r9.setX(r7) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget r9.setY(r8) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r10 = r0.mMaxWidth r9.setMaxWidth(r10) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r10 = r0.mMaxHeight r9.setMaxHeight(r10) int r9 = android.os.Build.VERSION.SDK_INT r10 = 0 r11 = 1 r12 = 17 if (r9 < r12) goto L_0x004f androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r12 = r23.getLayoutDirection() if (r12 != r11) goto L_0x004b r12 = 1 goto L_0x004c L_0x004b: r12 = 0 L_0x004c: r9.setRtl(r12) L_0x004f: r23.setSelfDimensionBehaviour(r24, r25) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r9 = r9.getWidth() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget int r12 = r12.getHeight() boolean r13 = r0.mDirtyHierarchy if (r13 == 0) goto L_0x0069 r0.mDirtyHierarchy = r10 r23.updateHierarchy() r13 = 1 goto L_0x006a L_0x0069: r13 = 0 L_0x006a: int r14 = r0.mOptimizationLevel r15 = 8 r14 = r14 & r15 if (r14 != r15) goto L_0x0073 r14 = 1 goto L_0x0074 L_0x0073: r14 = 0 L_0x0074: if (r14 == 0) goto L_0x0084 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r15 = r0.mLayoutWidget r15.preOptimize() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r15 = r0.mLayoutWidget r15.optimizeForDimensions(r9, r12) r23.internalMeasureDimensions(r24, r25) goto L_0x0087 L_0x0084: r23.internalMeasureChildren(r24, r25) L_0x0087: r23.updatePostMeasures() int r15 = r23.getChildCount() if (r15 <= 0) goto L_0x0097 if (r13 == 0) goto L_0x0097 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.Analyzer.determineGroups(r13) L_0x0097: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget boolean r13 = r13.mGroupsWrapOptimized if (r13 == 0) goto L_0x00d7 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget boolean r13 = r13.mHorizontalWrapOptimized r15 = -2147483648(0xffffffff80000000, float:-0.0) if (r13 == 0) goto L_0x00bb if (r3 != r15) goto L_0x00bb androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.mWrapFixedWidth if (r13 >= r4) goto L_0x00b4 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r11 = r13.mWrapFixedWidth r13.setWidth(r11) L_0x00b4: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.FIXED r11.setHorizontalDimensionBehaviour(r13) L_0x00bb: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget boolean r11 = r11.mVerticalWrapOptimized if (r11 == 0) goto L_0x00d7 if (r5 != r15) goto L_0x00d7 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget int r11 = r11.mWrapFixedHeight if (r11 >= r6) goto L_0x00d0 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget int r13 = r11.mWrapFixedHeight r11.setHeight(r13) L_0x00d0: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.FIXED r11.setVerticalDimensionBehaviour(r13) L_0x00d7: int r11 = r0.mOptimizationLevel r13 = 32 r11 = r11 & r13 r15 = 1073741824(0x40000000, float:2.0) if (r11 != r13) goto L_0x0133 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget int r11 = r11.getWidth() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.getHeight() int r10 = r0.mLastMeasureWidth if (r10 == r11) goto L_0x00fa if (r3 != r15) goto L_0x00fa androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r10 = 0 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r10, r11) L_0x00fa: int r3 = r0.mLastMeasureHeight if (r3 == r13) goto L_0x0108 if (r5 != r15) goto L_0x0108 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r5 = 1 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r5, r13) L_0x0108: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.mHorizontalWrapOptimized if (r3 == 0) goto L_0x011d androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget int r3 = r3.mWrapFixedWidth if (r3 <= r4) goto L_0x011d androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r10 = 0 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r10, r4) goto L_0x011e L_0x011d: r10 = 0 L_0x011e: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.mVerticalWrapOptimized if (r3 == 0) goto L_0x0133 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget int r3 = r3.mWrapFixedHeight if (r3 <= r6) goto L_0x0133 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r4 = 1 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r4, r6) goto L_0x0134 L_0x0133: r4 = 1 L_0x0134: int r3 = r23.getChildCount() if (r3 <= 0) goto L_0x013f java.lang.String r3 = "First pass" r0.solveLinearSystem(r3) L_0x013f: java.util.ArrayList<androidx.constraintlayout.solver.widgets.ConstraintWidget> r3 = r0.mVariableDimensionsWidgets int r3 = r3.size() int r5 = r23.getPaddingBottom() int r8 = r8 + r5 int r5 = r23.getPaddingRight() int r7 = r7 + r5 if (r3 <= 0) goto L_0x037a androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r6 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = r6.getHorizontalDimensionBehaviour() androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r11 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r6 != r11) goto L_0x015d r6 = 1 goto L_0x015e L_0x015d: r6 = 0 L_0x015e: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r11 = r11.getVerticalDimensionBehaviour() androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r11 != r13) goto L_0x016a r11 = 1 goto L_0x016b L_0x016a: r11 = 0 L_0x016b: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.getWidth() int r4 = r0.mMinWidth int r4 = java.lang.Math.max(r13, r4) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.getHeight() int r10 = r0.mMinHeight int r10 = java.lang.Math.max(r13, r10) r5 = r10 r10 = 0 r13 = 0 r16 = 0 L_0x0188: r17 = 1 if (r10 >= r3) goto L_0x02d2 java.util.ArrayList<androidx.constraintlayout.solver.widgets.ConstraintWidget> r15 = r0.mVariableDimensionsWidgets java.lang.Object r15 = r15.get(r10) androidx.constraintlayout.solver.widgets.ConstraintWidget r15 = (androidx.constraintlayout.solver.widgets.ConstraintWidget) r15 java.lang.Object r19 = r15.getCompanionWidget() r20 = r3 r3 = r19 android.view.View r3 = (android.view.View) r3 if (r3 != 0) goto L_0x01a6 r19 = r9 r21 = r12 goto L_0x02ba L_0x01a6: android.view.ViewGroup$LayoutParams r19 = r3.getLayoutParams() r21 = r12 r12 = r19 androidx.constraintlayout.widget.ConstraintLayout$LayoutParams r12 = (androidx.constraintlayout.widget.ConstraintLayout.LayoutParams) r12 r19 = r9 boolean r9 = r12.isHelper if (r9 != 0) goto L_0x02ba boolean r9 = r12.isGuideline if (r9 == 0) goto L_0x01bc goto L_0x02ba L_0x01bc: int r9 = r3.getVisibility() r22 = r13 r13 = 8 if (r9 != r13) goto L_0x01c8 L_0x01c6: goto L_0x02bc L_0x01c8: if (r14 == 0) goto L_0x01df androidx.constraintlayout.solver.widgets.ResolutionDimension r9 = r15.getResolutionWidth() boolean r9 = r9.isResolved() if (r9 == 0) goto L_0x01df androidx.constraintlayout.solver.widgets.ResolutionDimension r9 = r15.getResolutionHeight() boolean r9 = r9.isResolved() if (r9 == 0) goto L_0x01df goto L_0x01c6 L_0x01df: int r9 = r12.width r13 = -2 if (r9 != r13) goto L_0x01ef boolean r9 = r12.horizontalDimensionFixed if (r9 == 0) goto L_0x01ef int r9 = r12.width int r9 = getChildMeasureSpec(r1, r7, r9) goto L_0x01f9 L_0x01ef: int r9 = r15.getWidth() r13 = 1073741824(0x40000000, float:2.0) int r9 = android.view.View.MeasureSpec.makeMeasureSpec(r9, r13) L_0x01f9: int r13 = r12.height r1 = -2 if (r13 != r1) goto L_0x0209 boolean r1 = r12.verticalDimensionFixed if (r1 == 0) goto L_0x0209 int r1 = r12.height int r1 = getChildMeasureSpec(r2, r8, r1) goto L_0x0213 L_0x0209: int r1 = r15.getHeight() r13 = 1073741824(0x40000000, float:2.0) int r1 = android.view.View.MeasureSpec.makeMeasureSpec(r1, r13) L_0x0213: r3.measure(r9, r1) androidx.constraintlayout.solver.Metrics r1 = r0.mMetrics r13 = r8 if (r1 == 0) goto L_0x0221 long r8 = r1.additionalMeasures long r8 = r8 + r17 r1.additionalMeasures = r8 L_0x0221: int r1 = r3.getMeasuredWidth() int r8 = r3.getMeasuredHeight() int r9 = r15.getWidth() if (r1 == r9) goto L_0x0258 r15.setWidth(r1) if (r14 == 0) goto L_0x023b androidx.constraintlayout.solver.widgets.ResolutionDimension r9 = r15.getResolutionWidth() r9.resolve(r1) L_0x023b: if (r6 == 0) goto L_0x0256 int r1 = r15.getRight() if (r1 <= r4) goto L_0x0256 int r1 = r15.getRight() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r9 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.RIGHT androidx.constraintlayout.solver.widgets.ConstraintAnchor r9 = r15.getAnchor(r9) int r9 = r9.getMargin() int r1 = r1 + r9 int r4 = java.lang.Math.max(r4, r1) L_0x0256: r22 = 1 L_0x0258: int r1 = r15.getHeight() if (r8 == r1) goto L_0x0289 r15.setHeight(r8) if (r14 == 0) goto L_0x026a androidx.constraintlayout.solver.widgets.ResolutionDimension r1 = r15.getResolutionHeight() r1.resolve(r8) L_0x026a: if (r11 == 0) goto L_0x0286 int r1 = r15.getBottom() if (r1 <= r5) goto L_0x0286 int r1 = r15.getBottom() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r8 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.BOTTOM androidx.constraintlayout.solver.widgets.ConstraintAnchor r8 = r15.getAnchor(r8) int r8 = r8.getMargin() int r1 = r1 + r8 int r1 = java.lang.Math.max(r5, r1) r5 = r1 L_0x0286: r1 = r5 r5 = 1 goto L_0x028c L_0x0289: r1 = r5 r5 = r22 L_0x028c: boolean r8 = r12.needsBaseline if (r8 == 0) goto L_0x02a1 int r8 = r3.getBaseline() r9 = -1 if (r8 == r9) goto L_0x02a1 int r9 = r15.getBaselineDistance() if (r8 == r9) goto L_0x02a1 r15.setBaselineDistance(r8) r5 = 1 L_0x02a1: int r8 = android.os.Build.VERSION.SDK_INT r9 = 11 if (r8 < r9) goto L_0x02b4 int r3 = r3.getMeasuredState() r8 = r16 int r3 = combineMeasuredStates(r8, r3) r16 = r3 goto L_0x02b6 L_0x02b4: r8 = r16 L_0x02b6: r22 = r5 r5 = r1 goto L_0x02c1 L_0x02ba: r22 = r13 L_0x02bc: r13 = r8 r8 = r16 r16 = r8 L_0x02c1: int r10 = r10 + 1 r1 = r24 r8 = r13 r9 = r19 r3 = r20 r12 = r21 r13 = r22 r15 = 1073741824(0x40000000, float:2.0) goto L_0x0188 L_0x02d2: r20 = r3 r19 = r9 r21 = r12 r22 = r13 r13 = r8 r8 = r16 if (r22 == 0) goto L_0x0320 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r3 = r19 r1.setWidth(r3) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r3 = r21 r1.setHeight(r3) if (r14 == 0) goto L_0x02f4 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r1.solveGraph() L_0x02f4: java.lang.String r1 = "2nd pass" r0.solveLinearSystem(r1) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget int r1 = r1.getWidth() if (r1 >= r4) goto L_0x0308 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r1.setWidth(r4) r10 = 1 goto L_0x0309 L_0x0308: r10 = 0 L_0x0309: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget int r1 = r1.getHeight() if (r1 >= r5) goto L_0x0318 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r1.setHeight(r5) r11 = 1 goto L_0x0319 L_0x0318: r11 = r10 L_0x0319: if (r11 == 0) goto L_0x0320 java.lang.String r1 = "3rd pass" r0.solveLinearSystem(r1) L_0x0320: r1 = r20 r10 = 0 L_0x0323: if (r10 >= r1) goto L_0x0378 java.util.ArrayList<androidx.constraintlayout.solver.widgets.ConstraintWidget> r3 = r0.mVariableDimensionsWidgets java.lang.Object r3 = r3.get(r10) androidx.constraintlayout.solver.widgets.ConstraintWidget r3 = (androidx.constraintlayout.solver.widgets.ConstraintWidget) r3 java.lang.Object r4 = r3.getCompanionWidget() android.view.View r4 = (android.view.View) r4 if (r4 != 0) goto L_0x033a L_0x0335: r6 = 8 L_0x0337: r9 = 1073741824(0x40000000, float:2.0) goto L_0x0375 L_0x033a: int r5 = r4.getMeasuredWidth() int r6 = r3.getWidth() if (r5 != r6) goto L_0x034e int r5 = r4.getMeasuredHeight() int r6 = r3.getHeight() if (r5 == r6) goto L_0x0335 L_0x034e: int r5 = r3.getVisibility() r6 = 8 if (r5 == r6) goto L_0x0337 int r5 = r3.getWidth() r9 = 1073741824(0x40000000, float:2.0) int r5 = android.view.View.MeasureSpec.makeMeasureSpec(r5, r9) int r3 = r3.getHeight() int r3 = android.view.View.MeasureSpec.makeMeasureSpec(r3, r9) r4.measure(r5, r3) androidx.constraintlayout.solver.Metrics r3 = r0.mMetrics if (r3 == 0) goto L_0x0375 long r4 = r3.additionalMeasures long r4 = r4 + r17 r3.additionalMeasures = r4 L_0x0375: int r10 = r10 + 1 goto L_0x0323 L_0x0378: r10 = r8 goto L_0x037c L_0x037a: r13 = r8 r10 = 0 L_0x037c: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget int r1 = r1.getWidth() int r1 = r1 + r7 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget int r3 = r3.getHeight() int r3 = r3 + r13 int r4 = android.os.Build.VERSION.SDK_INT r5 = 11 if (r4 < r5) goto L_0x03c9 r4 = r24 int r1 = resolveSizeAndState(r1, r4, r10) int r4 = r10 << 16 int r2 = resolveSizeAndState(r3, r2, r4) r3 = 16777215(0xffffff, float:2.3509886E-38) r1 = r1 & r3 r2 = r2 & r3 int r3 = r0.mMaxWidth int r1 = java.lang.Math.min(r3, r1) int r3 = r0.mMaxHeight int r2 = java.lang.Math.min(r3, r2) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.isWidthMeasuredTooSmall() r4 = 16777216(0x1000000, float:2.3509887E-38) if (r3 == 0) goto L_0x03b8 r1 = r1 | r4 L_0x03b8: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.isHeightMeasuredTooSmall() if (r3 == 0) goto L_0x03c1 r2 = r2 | r4 L_0x03c1: r0.setMeasuredDimension(r1, r2) r0.mLastMeasureWidth = r1 r0.mLastMeasureHeight = r2 goto L_0x03d0 L_0x03c9: r0.setMeasuredDimension(r1, r3) r0.mLastMeasureWidth = r1 r0.mLastMeasureHeight = r3 L_0x03d0: return */ throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.widget.ConstraintLayout.onMeasure(int, int):void"); } private void setSelfDimensionBehaviour(int i, int i2) { int mode = View.MeasureSpec.getMode(i); int size = View.MeasureSpec.getSize(i); int mode2 = View.MeasureSpec.getMode(i2); int size2 = View.MeasureSpec.getSize(i2); int paddingTop = getPaddingTop() + getPaddingBottom(); int paddingLeft = getPaddingLeft() + getPaddingRight(); ConstraintWidget.DimensionBehaviour dimensionBehaviour = ConstraintWidget.DimensionBehaviour.FIXED; ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.FIXED; getLayoutParams(); if (mode != Integer.MIN_VALUE) { if (mode == 0) { dimensionBehaviour = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } else if (mode == 1073741824) { size = Math.min(this.mMaxWidth, size) - paddingLeft; } size = 0; } else { dimensionBehaviour = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } if (mode2 != Integer.MIN_VALUE) { if (mode2 == 0) { dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } else if (mode2 == 1073741824) { size2 = Math.min(this.mMaxHeight, size2) - paddingTop; } size2 = 0; } else { dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } this.mLayoutWidget.setMinWidth(0); this.mLayoutWidget.setMinHeight(0); this.mLayoutWidget.setHorizontalDimensionBehaviour(dimensionBehaviour); this.mLayoutWidget.setWidth(size); this.mLayoutWidget.setVerticalDimensionBehaviour(dimensionBehaviour2); this.mLayoutWidget.setHeight(size2); this.mLayoutWidget.setMinWidth((this.mMinWidth - getPaddingLeft()) - getPaddingRight()); this.mLayoutWidget.setMinHeight((this.mMinHeight - getPaddingTop()) - getPaddingBottom()); } /* access modifiers changed from: protected */ public void solveLinearSystem(String str) { this.mLayoutWidget.layout(); Metrics metrics = this.mMetrics; if (metrics != null) { metrics.resolutions++; } } /* access modifiers changed from: protected */ public void onLayout(boolean z, int i, int i2, int i3, int i4) { View content; int childCount = getChildCount(); boolean isInEditMode = isInEditMode(); for (int i5 = 0; i5 < childCount; i5++) { View childAt = getChildAt(i5); LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams(); ConstraintWidget constraintWidget = layoutParams.widget; if ((childAt.getVisibility() != 8 || layoutParams.isGuideline || layoutParams.isHelper || isInEditMode) && !layoutParams.isInPlaceholder) { int drawX = constraintWidget.getDrawX(); int drawY = constraintWidget.getDrawY(); int width = constraintWidget.getWidth() + drawX; int height = constraintWidget.getHeight() + drawY; childAt.layout(drawX, drawY, width, height); if ((childAt instanceof Placeholder) && (content = ((Placeholder) childAt).getContent()) != null) { content.setVisibility(0); content.layout(drawX, drawY, width, height); } } } int size = this.mConstraintHelpers.size(); if (size > 0) { for (int i6 = 0; i6 < size; i6++) { this.mConstraintHelpers.get(i6).updatePostLayout(this); } } } public void setOptimizationLevel(int i) { this.mLayoutWidget.setOptimizationLevel(i); } public int getOptimizationLevel() { return this.mLayoutWidget.getOptimizationLevel(); } public LayoutParams generateLayoutParams(AttributeSet attributeSet) { return new LayoutParams(getContext(), attributeSet); } /* access modifiers changed from: protected */ public LayoutParams generateDefaultLayoutParams() { return new LayoutParams(-2, -2); } /* access modifiers changed from: protected */ public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) { return new LayoutParams(layoutParams); } /* access modifiers changed from: protected */ public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) { return layoutParams instanceof LayoutParams; } public void setConstraintSet(ConstraintSet constraintSet) { this.mConstraintSet = constraintSet; } public View getViewById(int i) { return this.mChildrenByIds.get(i); } public void dispatchDraw(Canvas canvas) { Object tag; super.dispatchDraw(canvas); if (isInEditMode()) { int childCount = getChildCount(); float width = (float) getWidth(); float height = (float) getHeight(); for (int i = 0; i < childCount; i++) { View childAt = getChildAt(i); if (!(childAt.getVisibility() == 8 || (tag = childAt.getTag()) == null || !(tag instanceof String))) { String[] split = ((String) tag).split(","); if (split.length == 4) { int parseInt = Integer.parseInt(split[0]); int parseInt2 = Integer.parseInt(split[1]); int parseInt3 = Integer.parseInt(split[2]); int i2 = (int) ((((float) parseInt) / 1080.0f) * width); int i3 = (int) ((((float) parseInt2) / 1920.0f) * height); Paint paint = new Paint(); paint.setColor(-65536); float f = (float) i2; float f2 = (float) (i2 + ((int) ((((float) parseInt3) / 1080.0f) * width))); Canvas canvas2 = canvas; float f3 = (float) i3; float f4 = f; float f5 = f; float f6 = f3; Paint paint2 = paint; float f7 = f2; Paint paint3 = paint2; canvas2.drawLine(f4, f6, f7, f3, paint3); float parseInt4 = (float) (i3 + ((int) ((((float) Integer.parseInt(split[3])) / 1920.0f) * height))); float f8 = f2; float f9 = parseInt4; canvas2.drawLine(f8, f6, f7, f9, paint3); float f10 = parseInt4; float f11 = f5; canvas2.drawLine(f8, f10, f11, f9, paint3); float f12 = f5; canvas2.drawLine(f12, f10, f11, f3, paint3); Paint paint4 = paint2; paint4.setColor(-16711936); Paint paint5 = paint4; float f13 = f2; Paint paint6 = paint5; canvas2.drawLine(f12, f3, f13, parseInt4, paint6); canvas2.drawLine(f12, parseInt4, f13, f3, paint6); } } } } } public static class LayoutParams extends ViewGroup.MarginLayoutParams { public int baselineToBaseline = -1; public int bottomToBottom = -1; public int bottomToTop = -1; public float circleAngle = 0.0f; public int circleConstraint = -1; public int circleRadius = 0; public boolean constrainedHeight = false; public boolean constrainedWidth = false; public String dimensionRatio = null; int dimensionRatioSide = 1; float dimensionRatioValue = 0.0f; public int editorAbsoluteX = -1; public int editorAbsoluteY = -1; public int endToEnd = -1; public int endToStart = -1; public int goneBottomMargin = -1; public int goneEndMargin = -1; public int goneLeftMargin = -1; public int goneRightMargin = -1; public int goneStartMargin = -1; public int goneTopMargin = -1; public int guideBegin = -1; public int guideEnd = -1; public float guidePercent = -1.0f; public boolean helped = false; public float horizontalBias = 0.5f; public int horizontalChainStyle = 0; boolean horizontalDimensionFixed = true; public float horizontalWeight = -1.0f; boolean isGuideline = false; boolean isHelper = false; boolean isInPlaceholder = false; public int leftToLeft = -1; public int leftToRight = -1; public int matchConstraintDefaultHeight = 0; public int matchConstraintDefaultWidth = 0; public int matchConstraintMaxHeight = 0; public int matchConstraintMaxWidth = 0; public int matchConstraintMinHeight = 0; public int matchConstraintMinWidth = 0; public float matchConstraintPercentHeight = 1.0f; public float matchConstraintPercentWidth = 1.0f; boolean needsBaseline = false; public int orientation = -1; int resolveGoneLeftMargin = -1; int resolveGoneRightMargin = -1; int resolvedGuideBegin; int resolvedGuideEnd; float resolvedGuidePercent; float resolvedHorizontalBias = 0.5f; int resolvedLeftToLeft = -1; int resolvedLeftToRight = -1; int resolvedRightToLeft = -1; int resolvedRightToRight = -1; public int rightToLeft = -1; public int rightToRight = -1; public int startToEnd = -1; public int startToStart = -1; public int topToBottom = -1; public int topToTop = -1; public float verticalBias = 0.5f; public int verticalChainStyle = 0; boolean verticalDimensionFixed = true; public float verticalWeight = -1.0f; ConstraintWidget widget = new ConstraintWidget(); private static class Table { public static final SparseIntArray map; static { SparseIntArray sparseIntArray = new SparseIntArray(); map = sparseIntArray; sparseIntArray.append(R.styleable.ConstraintLayout_Layout_layout_constraintLeft_toLeftOf, 8); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintLeft_toRightOf, 9); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintRight_toLeftOf, 10); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintRight_toRightOf, 11); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintTop_toTopOf, 12); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintTop_toBottomOf, 13); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBottom_toTopOf, 14); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBottom_toBottomOf, 15); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBaseline_toBaselineOf, 16); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintCircle, 2); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintCircleRadius, 3); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintCircleAngle, 4); map.append(R.styleable.ConstraintLayout_Layout_layout_editor_absoluteX, 49); map.append(R.styleable.ConstraintLayout_Layout_layout_editor_absoluteY, 50); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintGuide_begin, 5); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintGuide_end, 6); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintGuide_percent, 7); map.append(R.styleable.ConstraintLayout_Layout_android_orientation, 1); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintStart_toEndOf, 17); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintStart_toStartOf, 18); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintEnd_toStartOf, 19); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintEnd_toEndOf, 20); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginLeft, 21); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginTop, 22); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginRight, 23); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginBottom, 24); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginStart, 25); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginEnd, 26); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHorizontal_bias, 29); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintVertical_bias, 30); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintDimensionRatio, 44); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHorizontal_weight, 45); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintVertical_weight, 46); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHorizontal_chainStyle, 47); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintVertical_chainStyle, 48); map.append(R.styleable.ConstraintLayout_Layout_layout_constrainedWidth, 27); map.append(R.styleable.ConstraintLayout_Layout_layout_constrainedHeight, 28); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_default, 31); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_default, 32); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_min, 33); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_max, 34); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_percent, 35); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_min, 36); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_max, 37); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_percent, 38); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintLeft_creator, 39); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintTop_creator, 40); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintRight_creator, 41); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBottom_creator, 42); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBaseline_creator, 43); } } public LayoutParams(Context context, AttributeSet attributeSet) { super(context, attributeSet); int i; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ConstraintLayout_Layout); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i2 = 0; i2 < indexCount; i2++) { int index = obtainStyledAttributes.getIndex(i2); int i3 = Table.map.get(index); switch (i3) { case 1: this.orientation = obtainStyledAttributes.getInt(index, this.orientation); break; case 2: int resourceId = obtainStyledAttributes.getResourceId(index, this.circleConstraint); this.circleConstraint = resourceId; if (resourceId != -1) { break; } else { this.circleConstraint = obtainStyledAttributes.getInt(index, -1); break; } case 3: this.circleRadius = obtainStyledAttributes.getDimensionPixelSize(index, this.circleRadius); break; case 4: float f = obtainStyledAttributes.getFloat(index, this.circleAngle) % 360.0f; this.circleAngle = f; if (f >= 0.0f) { break; } else { this.circleAngle = (360.0f - f) % 360.0f; break; } case 5: this.guideBegin = obtainStyledAttributes.getDimensionPixelOffset(index, this.guideBegin); break; case 6: this.guideEnd = obtainStyledAttributes.getDimensionPixelOffset(index, this.guideEnd); break; case 7: this.guidePercent = obtainStyledAttributes.getFloat(index, this.guidePercent); break; case 8: int resourceId2 = obtainStyledAttributes.getResourceId(index, this.leftToLeft); this.leftToLeft = resourceId2; if (resourceId2 != -1) { break; } else { this.leftToLeft = obtainStyledAttributes.getInt(index, -1); break; } case 9: int resourceId3 = obtainStyledAttributes.getResourceId(index, this.leftToRight); this.leftToRight = resourceId3; if (resourceId3 != -1) { break; } else { this.leftToRight = obtainStyledAttributes.getInt(index, -1); break; } case 10: int resourceId4 = obtainStyledAttributes.getResourceId(index, this.rightToLeft); this.rightToLeft = resourceId4; if (resourceId4 != -1) { break; } else { this.rightToLeft = obtainStyledAttributes.getInt(index, -1); break; } case 11: int resourceId5 = obtainStyledAttributes.getResourceId(index, this.rightToRight); this.rightToRight = resourceId5; if (resourceId5 != -1) { break; } else { this.rightToRight = obtainStyledAttributes.getInt(index, -1); break; } case 12: int resourceId6 = obtainStyledAttributes.getResourceId(index, this.topToTop); this.topToTop = resourceId6; if (resourceId6 != -1) { break; } else { this.topToTop = obtainStyledAttributes.getInt(index, -1); break; } case 13: int resourceId7 = obtainStyledAttributes.getResourceId(index, this.topToBottom); this.topToBottom = resourceId7; if (resourceId7 != -1) { break; } else { this.topToBottom = obtainStyledAttributes.getInt(index, -1); break; } case 14: int resourceId8 = obtainStyledAttributes.getResourceId(index, this.bottomToTop); this.bottomToTop = resourceId8; if (resourceId8 != -1) { break; } else { this.bottomToTop = obtainStyledAttributes.getInt(index, -1); break; } case 15: int resourceId9 = obtainStyledAttributes.getResourceId(index, this.bottomToBottom); this.bottomToBottom = resourceId9; if (resourceId9 != -1) { break; } else { this.bottomToBottom = obtainStyledAttributes.getInt(index, -1); break; } case 16: int resourceId10 = obtainStyledAttributes.getResourceId(index, this.baselineToBaseline); this.baselineToBaseline = resourceId10; if (resourceId10 != -1) { break; } else { this.baselineToBaseline = obtainStyledAttributes.getInt(index, -1); break; } case 17: int resourceId11 = obtainStyledAttributes.getResourceId(index, this.startToEnd); this.startToEnd = resourceId11; if (resourceId11 != -1) { break; } else { this.startToEnd = obtainStyledAttributes.getInt(index, -1); break; } case 18: int resourceId12 = obtainStyledAttributes.getResourceId(index, this.startToStart); this.startToStart = resourceId12; if (resourceId12 != -1) { break; } else { this.startToStart = obtainStyledAttributes.getInt(index, -1); break; } case 19: int resourceId13 = obtainStyledAttributes.getResourceId(index, this.endToStart); this.endToStart = resourceId13; if (resourceId13 != -1) { break; } else { this.endToStart = obtainStyledAttributes.getInt(index, -1); break; } case 20: int resourceId14 = obtainStyledAttributes.getResourceId(index, this.endToEnd); this.endToEnd = resourceId14; if (resourceId14 != -1) { break; } else { this.endToEnd = obtainStyledAttributes.getInt(index, -1); break; } case 21: this.goneLeftMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneLeftMargin); break; case 22: this.goneTopMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneTopMargin); break; case 23: this.goneRightMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneRightMargin); break; case 24: this.goneBottomMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneBottomMargin); break; case 25: this.goneStartMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneStartMargin); break; case 26: this.goneEndMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneEndMargin); break; case 27: this.constrainedWidth = obtainStyledAttributes.getBoolean(index, this.constrainedWidth); break; case 28: this.constrainedHeight = obtainStyledAttributes.getBoolean(index, this.constrainedHeight); break; case 29: this.horizontalBias = obtainStyledAttributes.getFloat(index, this.horizontalBias); break; case 30: this.verticalBias = obtainStyledAttributes.getFloat(index, this.verticalBias); break; case 31: int i4 = obtainStyledAttributes.getInt(index, 0); this.matchConstraintDefaultWidth = i4; if (i4 != 1) { break; } else { Log.e("ConstraintLayout", "layout_constraintWidth_default=\"wrap\" is deprecated.\nUse layout_width=\"WRAP_CONTENT\" and layout_constrainedWidth=\"true\" instead."); break; } case 32: int i5 = obtainStyledAttributes.getInt(index, 0); this.matchConstraintDefaultHeight = i5; if (i5 != 1) { break; } else { Log.e("ConstraintLayout", "layout_constraintHeight_default=\"wrap\" is deprecated.\nUse layout_height=\"WRAP_CONTENT\" and layout_constrainedHeight=\"true\" instead."); break; } case 33: try { this.matchConstraintMinWidth = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMinWidth); break; } catch (Exception unused) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMinWidth) != -2) { break; } else { this.matchConstraintMinWidth = -2; break; } } case 34: try { this.matchConstraintMaxWidth = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMaxWidth); break; } catch (Exception unused2) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMaxWidth) != -2) { break; } else { this.matchConstraintMaxWidth = -2; break; } } case 35: this.matchConstraintPercentWidth = Math.max(0.0f, obtainStyledAttributes.getFloat(index, this.matchConstraintPercentWidth)); break; case 36: try { this.matchConstraintMinHeight = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMinHeight); break; } catch (Exception unused3) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMinHeight) != -2) { break; } else { this.matchConstraintMinHeight = -2; break; } } case 37: try { this.matchConstraintMaxHeight = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMaxHeight); break; } catch (Exception unused4) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMaxHeight) != -2) { break; } else { this.matchConstraintMaxHeight = -2; break; } } case 38: this.matchConstraintPercentHeight = Math.max(0.0f, obtainStyledAttributes.getFloat(index, this.matchConstraintPercentHeight)); break; default: switch (i3) { case 44: String string = obtainStyledAttributes.getString(index); this.dimensionRatio = string; this.dimensionRatioValue = Float.NaN; this.dimensionRatioSide = -1; if (string == null) { break; } else { int length = string.length(); int indexOf = this.dimensionRatio.indexOf(44); if (indexOf <= 0 || indexOf >= length - 1) { i = 0; } else { String substring = this.dimensionRatio.substring(0, indexOf); if (substring.equalsIgnoreCase("W")) { this.dimensionRatioSide = 0; } else if (substring.equalsIgnoreCase("H")) { this.dimensionRatioSide = 1; } i = indexOf + 1; } int indexOf2 = this.dimensionRatio.indexOf(58); if (indexOf2 >= 0 && indexOf2 < length - 1) { String substring2 = this.dimensionRatio.substring(i, indexOf2); String substring3 = this.dimensionRatio.substring(indexOf2 + 1); if (substring2.length() > 0 && substring3.length() > 0) { try { float parseFloat = Float.parseFloat(substring2); float parseFloat2 = Float.parseFloat(substring3); if (parseFloat > 0.0f && parseFloat2 > 0.0f) { if (this.dimensionRatioSide != 1) { this.dimensionRatioValue = Math.abs(parseFloat / parseFloat2); break; } else { this.dimensionRatioValue = Math.abs(parseFloat2 / parseFloat); break; } } } catch (NumberFormatException unused5) { break; } } } else { String substring4 = this.dimensionRatio.substring(i); if (substring4.length() <= 0) { break; } else { this.dimensionRatioValue = Float.parseFloat(substring4); break; } } } break; case 45: this.horizontalWeight = obtainStyledAttributes.getFloat(index, this.horizontalWeight); break; case 46: this.verticalWeight = obtainStyledAttributes.getFloat(index, this.verticalWeight); break; case 47: this.horizontalChainStyle = obtainStyledAttributes.getInt(index, 0); break; case 48: this.verticalChainStyle = obtainStyledAttributes.getInt(index, 0); break; case 49: this.editorAbsoluteX = obtainStyledAttributes.getDimensionPixelOffset(index, this.editorAbsoluteX); break; case 50: this.editorAbsoluteY = obtainStyledAttributes.getDimensionPixelOffset(index, this.editorAbsoluteY); break; } } } obtainStyledAttributes.recycle(); validate(); } public void validate() { this.isGuideline = false; this.horizontalDimensionFixed = true; this.verticalDimensionFixed = true; if (this.width == -2 && this.constrainedWidth) { this.horizontalDimensionFixed = false; this.matchConstraintDefaultWidth = 1; } if (this.height == -2 && this.constrainedHeight) { this.verticalDimensionFixed = false; this.matchConstraintDefaultHeight = 1; } if (this.width == 0 || this.width == -1) { this.horizontalDimensionFixed = false; if (this.width == 0 && this.matchConstraintDefaultWidth == 1) { this.width = -2; this.constrainedWidth = true; } } if (this.height == 0 || this.height == -1) { this.verticalDimensionFixed = false; if (this.height == 0 && this.matchConstraintDefaultHeight == 1) { this.height = -2; this.constrainedHeight = true; } } if (this.guidePercent != -1.0f || this.guideBegin != -1 || this.guideEnd != -1) { this.isGuideline = true; this.horizontalDimensionFixed = true; this.verticalDimensionFixed = true; if (!(this.widget instanceof Guideline)) { this.widget = new Guideline(); } ((Guideline) this.widget).setOrientation(this.orientation); } } public LayoutParams(int i, int i2) { super(i, i2); } public LayoutParams(ViewGroup.LayoutParams layoutParams) { super(layoutParams); } /* JADX WARNING: Removed duplicated region for block: B:14:0x004c */ /* JADX WARNING: Removed duplicated region for block: B:17:0x0053 */ /* JADX WARNING: Removed duplicated region for block: B:20:0x005a */ /* JADX WARNING: Removed duplicated region for block: B:23:0x0060 */ /* JADX WARNING: Removed duplicated region for block: B:26:0x0066 */ /* JADX WARNING: Removed duplicated region for block: B:33:0x007c */ /* JADX WARNING: Removed duplicated region for block: B:34:0x0084 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void resolveLayoutDirection(int r7) { /* r6 = this; int r0 = r6.leftMargin int r1 = r6.rightMargin super.resolveLayoutDirection(r7) r7 = -1 r6.resolvedRightToLeft = r7 r6.resolvedRightToRight = r7 r6.resolvedLeftToLeft = r7 r6.resolvedLeftToRight = r7 r6.resolveGoneLeftMargin = r7 r6.resolveGoneRightMargin = r7 int r2 = r6.goneLeftMargin r6.resolveGoneLeftMargin = r2 int r2 = r6.goneRightMargin r6.resolveGoneRightMargin = r2 float r2 = r6.horizontalBias r6.resolvedHorizontalBias = r2 int r2 = r6.guideBegin r6.resolvedGuideBegin = r2 int r2 = r6.guideEnd r6.resolvedGuideEnd = r2 float r2 = r6.guidePercent r6.resolvedGuidePercent = r2 int r2 = r6.getLayoutDirection() r3 = 0 r4 = 1 if (r4 != r2) goto L_0x0036 r2 = 1 goto L_0x0037 L_0x0036: r2 = 0 L_0x0037: if (r2 == 0) goto L_0x009a int r2 = r6.startToEnd if (r2 == r7) goto L_0x0041 r6.resolvedRightToLeft = r2 L_0x003f: r3 = 1 goto L_0x0048 L_0x0041: int r2 = r6.startToStart if (r2 == r7) goto L_0x0048 r6.resolvedRightToRight = r2 goto L_0x003f L_0x0048: int r2 = r6.endToStart if (r2 == r7) goto L_0x004f r6.resolvedLeftToRight = r2 r3 = 1 L_0x004f: int r2 = r6.endToEnd if (r2 == r7) goto L_0x0056 r6.resolvedLeftToLeft = r2 r3 = 1 L_0x0056: int r2 = r6.goneStartMargin if (r2 == r7) goto L_0x005c r6.resolveGoneRightMargin = r2 L_0x005c: int r2 = r6.goneEndMargin if (r2 == r7) goto L_0x0062 r6.resolveGoneLeftMargin = r2 L_0x0062: r2 = 1065353216(0x3f800000, float:1.0) if (r3 == 0) goto L_0x006c float r3 = r6.horizontalBias float r3 = r2 - r3 r6.resolvedHorizontalBias = r3 L_0x006c: boolean r3 = r6.isGuideline if (r3 == 0) goto L_0x00be int r3 = r6.orientation if (r3 != r4) goto L_0x00be float r3 = r6.guidePercent r4 = -1082130432(0xffffffffbf800000, float:-1.0) int r5 = (r3 > r4 ? 1 : (r3 == r4 ? 0 : -1)) if (r5 == 0) goto L_0x0084 float r2 = r2 - r3 r6.resolvedGuidePercent = r2 r6.resolvedGuideBegin = r7 r6.resolvedGuideEnd = r7 goto L_0x00be L_0x0084: int r2 = r6.guideBegin if (r2 == r7) goto L_0x008f r6.resolvedGuideEnd = r2 r6.resolvedGuideBegin = r7 r6.resolvedGuidePercent = r4 goto L_0x00be L_0x008f: int r2 = r6.guideEnd if (r2 == r7) goto L_0x00be r6.resolvedGuideBegin = r2 r6.resolvedGuideEnd = r7 r6.resolvedGuidePercent = r4 goto L_0x00be L_0x009a: int r2 = r6.startToEnd if (r2 == r7) goto L_0x00a0 r6.resolvedLeftToRight = r2 L_0x00a0: int r2 = r6.startToStart if (r2 == r7) goto L_0x00a6 r6.resolvedLeftToLeft = r2 L_0x00a6: int r2 = r6.endToStart if (r2 == r7) goto L_0x00ac r6.resolvedRightToLeft = r2 L_0x00ac: int r2 = r6.endToEnd if (r2 == r7) goto L_0x00b2 r6.resolvedRightToRight = r2 L_0x00b2: int r2 = r6.goneStartMargin if (r2 == r7) goto L_0x00b8 r6.resolveGoneLeftMargin = r2 L_0x00b8: int r2 = r6.goneEndMargin if (r2 == r7) goto L_0x00be r6.resolveGoneRightMargin = r2 L_0x00be: int r2 = r6.endToStart if (r2 != r7) goto L_0x0108 int r2 = r6.endToEnd if (r2 != r7) goto L_0x0108 int r2 = r6.startToStart if (r2 != r7) goto L_0x0108 int r2 = r6.startToEnd if (r2 != r7) goto L_0x0108 int r2 = r6.rightToLeft if (r2 == r7) goto L_0x00dd r6.resolvedRightToLeft = r2 int r2 = r6.rightMargin if (r2 > 0) goto L_0x00eb if (r1 <= 0) goto L_0x00eb r6.rightMargin = r1 goto L_0x00eb L_0x00dd: int r2 = r6.rightToRight if (r2 == r7) goto L_0x00eb r6.resolvedRightToRight = r2 int r2 = r6.rightMargin if (r2 > 0) goto L_0x00eb if (r1 <= 0) goto L_0x00eb r6.rightMargin = r1 L_0x00eb: int r1 = r6.leftToLeft if (r1 == r7) goto L_0x00fa r6.resolvedLeftToLeft = r1 int r7 = r6.leftMargin if (r7 > 0) goto L_0x0108 if (r0 <= 0) goto L_0x0108 r6.leftMargin = r0 goto L_0x0108 L_0x00fa: int r1 = r6.leftToRight if (r1 == r7) goto L_0x0108 r6.resolvedLeftToRight = r1 int r7 = r6.leftMargin if (r7 > 0) goto L_0x0108 if (r0 <= 0) goto L_0x0108 r6.leftMargin = r0 L_0x0108: return */ throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.resolveLayoutDirection(int):void"); } } public void requestLayout() { super.requestLayout(); this.mDirtyHierarchy = true; this.mLastMeasureWidth = -1; this.mLastMeasureHeight = -1; this.mLastMeasureWidthSize = -1; this.mLastMeasureHeightSize = -1; this.mLastMeasureWidthMode = 0; this.mLastMeasureHeightMode = 0; } }
UTF-8
Java
112,432
java
ConstraintLayout.java
Java
[]
null
[]
package androidx.constraintlayout.widget; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; import android.util.SparseIntArray; import android.view.View; import android.view.ViewGroup; import androidx.constraintlayout.solver.Metrics; import androidx.constraintlayout.solver.widgets.ConstraintAnchor; import androidx.constraintlayout.solver.widgets.ConstraintWidget; import androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer; import androidx.constraintlayout.solver.widgets.Guideline; import java.util.ArrayList; import java.util.HashMap; public class ConstraintLayout extends ViewGroup { SparseArray<View> mChildrenByIds = new SparseArray<>(); private ArrayList<ConstraintHelper> mConstraintHelpers = new ArrayList<>(4); private ConstraintSet mConstraintSet = null; private int mConstraintSetId = -1; private HashMap<String, Integer> mDesignIds = new HashMap<>(); private boolean mDirtyHierarchy = true; private int mLastMeasureHeight = -1; int mLastMeasureHeightMode = 0; int mLastMeasureHeightSize = -1; private int mLastMeasureWidth = -1; int mLastMeasureWidthMode = 0; int mLastMeasureWidthSize = -1; ConstraintWidgetContainer mLayoutWidget = new ConstraintWidgetContainer(); private int mMaxHeight = Integer.MAX_VALUE; private int mMaxWidth = Integer.MAX_VALUE; private Metrics mMetrics; private int mMinHeight = 0; private int mMinWidth = 0; private int mOptimizationLevel = 7; private final ArrayList<ConstraintWidget> mVariableDimensionsWidgets = new ArrayList<>(100); public boolean shouldDelayChildPressedState() { return false; } public void setDesignInformation(int i, Object obj, Object obj2) { if (i == 0 && (obj instanceof String) && (obj2 instanceof Integer)) { if (this.mDesignIds == null) { this.mDesignIds = new HashMap<>(); } String str = (String) obj; int indexOf = str.indexOf("/"); if (indexOf != -1) { str = str.substring(indexOf + 1); } this.mDesignIds.put(str, Integer.valueOf(((Integer) obj2).intValue())); } } public Object getDesignInformation(int i, Object obj) { if (i != 0 || !(obj instanceof String)) { return null; } String str = (String) obj; HashMap<String, Integer> hashMap = this.mDesignIds; if (hashMap == null || !hashMap.containsKey(str)) { return null; } return this.mDesignIds.get(str); } public ConstraintLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); init(attributeSet); } public void setId(int i) { this.mChildrenByIds.remove(getId()); super.setId(i); this.mChildrenByIds.put(getId(), this); } private void init(AttributeSet attributeSet) { this.mLayoutWidget.setCompanionWidget(this); this.mChildrenByIds.put(getId(), this); this.mConstraintSet = null; if (attributeSet != null) { TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, R.styleable.ConstraintLayout_Layout); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i = 0; i < indexCount; i++) { int index = obtainStyledAttributes.getIndex(i); if (index == R.styleable.ConstraintLayout_Layout_android_minWidth) { this.mMinWidth = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMinWidth); } else if (index == R.styleable.ConstraintLayout_Layout_android_minHeight) { this.mMinHeight = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMinHeight); } else if (index == R.styleable.ConstraintLayout_Layout_android_maxWidth) { this.mMaxWidth = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMaxWidth); } else if (index == R.styleable.ConstraintLayout_Layout_android_maxHeight) { this.mMaxHeight = obtainStyledAttributes.getDimensionPixelOffset(index, this.mMaxHeight); } else if (index == R.styleable.ConstraintLayout_Layout_layout_optimizationLevel) { this.mOptimizationLevel = obtainStyledAttributes.getInt(index, this.mOptimizationLevel); } else if (index == R.styleable.ConstraintLayout_Layout_constraintSet) { int resourceId = obtainStyledAttributes.getResourceId(index, 0); try { ConstraintSet constraintSet = new ConstraintSet(); this.mConstraintSet = constraintSet; constraintSet.load(getContext(), resourceId); } catch (Resources.NotFoundException unused) { this.mConstraintSet = null; } this.mConstraintSetId = resourceId; } } obtainStyledAttributes.recycle(); } this.mLayoutWidget.setOptimizationLevel(this.mOptimizationLevel); } public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { super.addView(view, i, layoutParams); if (Build.VERSION.SDK_INT < 14) { onViewAdded(view); } } public void removeView(View view) { super.removeView(view); if (Build.VERSION.SDK_INT < 14) { onViewRemoved(view); } } public void onViewAdded(View view) { if (Build.VERSION.SDK_INT >= 14) { super.onViewAdded(view); } ConstraintWidget viewWidget = getViewWidget(view); if ((view instanceof Guideline) && !(viewWidget instanceof Guideline)) { LayoutParams layoutParams = (LayoutParams) view.getLayoutParams(); layoutParams.widget = new Guideline(); layoutParams.isGuideline = true; ((Guideline) layoutParams.widget).setOrientation(layoutParams.orientation); } if (view instanceof ConstraintHelper) { ConstraintHelper constraintHelper = (ConstraintHelper) view; constraintHelper.validateParams(); ((LayoutParams) view.getLayoutParams()).isHelper = true; if (!this.mConstraintHelpers.contains(constraintHelper)) { this.mConstraintHelpers.add(constraintHelper); } } this.mChildrenByIds.put(view.getId(), view); this.mDirtyHierarchy = true; } public void onViewRemoved(View view) { if (Build.VERSION.SDK_INT >= 14) { super.onViewRemoved(view); } this.mChildrenByIds.remove(view.getId()); ConstraintWidget viewWidget = getViewWidget(view); this.mLayoutWidget.remove(viewWidget); this.mConstraintHelpers.remove(view); this.mVariableDimensionsWidgets.remove(viewWidget); this.mDirtyHierarchy = true; } public void setMinWidth(int i) { if (i != this.mMinWidth) { this.mMinWidth = i; requestLayout(); } } public void setMinHeight(int i) { if (i != this.mMinHeight) { this.mMinHeight = i; requestLayout(); } } public int getMinWidth() { return this.mMinWidth; } public int getMinHeight() { return this.mMinHeight; } public void setMaxWidth(int i) { if (i != this.mMaxWidth) { this.mMaxWidth = i; requestLayout(); } } public void setMaxHeight(int i) { if (i != this.mMaxHeight) { this.mMaxHeight = i; requestLayout(); } } public int getMaxWidth() { return this.mMaxWidth; } public int getMaxHeight() { return this.mMaxHeight; } private void updateHierarchy() { int childCount = getChildCount(); boolean z = false; int i = 0; while (true) { if (i >= childCount) { break; } else if (getChildAt(i).isLayoutRequested()) { z = true; break; } else { i++; } } if (z) { this.mVariableDimensionsWidgets.clear(); setChildrenConstraints(); } } private void setChildrenConstraints() { int i; int i2; float f; int i3; float f2; ConstraintWidget targetWidget; ConstraintWidget targetWidget2; ConstraintWidget targetWidget3; ConstraintWidget targetWidget4; boolean isInEditMode = isInEditMode(); int childCount = getChildCount(); boolean z = false; if (isInEditMode) { for (int i4 = 0; i4 < childCount; i4++) { View childAt = getChildAt(i4); try { String resourceName = getResources().getResourceName(childAt.getId()); setDesignInformation(0, resourceName, Integer.valueOf(childAt.getId())); int indexOf = resourceName.indexOf(47); if (indexOf != -1) { resourceName = resourceName.substring(indexOf + 1); } getTargetWidget(childAt.getId()).setDebugName(resourceName); } catch (Resources.NotFoundException unused) { } } } for (int i5 = 0; i5 < childCount; i5++) { ConstraintWidget viewWidget = getViewWidget(getChildAt(i5)); if (viewWidget != null) { viewWidget.reset(); } } if (this.mConstraintSetId != -1) { for (int i6 = 0; i6 < childCount; i6++) { View childAt2 = getChildAt(i6); if (childAt2.getId() == this.mConstraintSetId && (childAt2 instanceof Constraints)) { this.mConstraintSet = ((Constraints) childAt2).getConstraintSet(); } } } ConstraintSet constraintSet = this.mConstraintSet; if (constraintSet != null) { constraintSet.applyToInternal(this); } this.mLayoutWidget.removeAllChildren(); int size = this.mConstraintHelpers.size(); if (size > 0) { for (int i7 = 0; i7 < size; i7++) { this.mConstraintHelpers.get(i7).updatePreLayout(this); } } for (int i8 = 0; i8 < childCount; i8++) { View childAt3 = getChildAt(i8); if (childAt3 instanceof Placeholder) { ((Placeholder) childAt3).updatePreLayout(this); } } for (int i9 = 0; i9 < childCount; i9++) { View childAt4 = getChildAt(i9); ConstraintWidget viewWidget2 = getViewWidget(childAt4); if (viewWidget2 != null) { LayoutParams layoutParams = (LayoutParams) childAt4.getLayoutParams(); layoutParams.validate(); if (layoutParams.helped) { layoutParams.helped = z; } else if (isInEditMode) { try { String resourceName2 = getResources().getResourceName(childAt4.getId()); setDesignInformation(z ? 1 : 0, resourceName2, Integer.valueOf(childAt4.getId())); getTargetWidget(childAt4.getId()).setDebugName(resourceName2.substring(resourceName2.indexOf("id/") + 3)); } catch (Resources.NotFoundException unused2) { } } viewWidget2.setVisibility(childAt4.getVisibility()); if (layoutParams.isInPlaceholder) { viewWidget2.setVisibility(8); } viewWidget2.setCompanionWidget(childAt4); this.mLayoutWidget.add(viewWidget2); if (!layoutParams.verticalDimensionFixed || !layoutParams.horizontalDimensionFixed) { this.mVariableDimensionsWidgets.add(viewWidget2); } if (layoutParams.isGuideline) { Guideline guideline = (Guideline) viewWidget2; int i10 = layoutParams.resolvedGuideBegin; int i11 = layoutParams.resolvedGuideEnd; float f3 = layoutParams.resolvedGuidePercent; if (Build.VERSION.SDK_INT < 17) { i10 = layoutParams.guideBegin; i11 = layoutParams.guideEnd; f3 = layoutParams.guidePercent; } if (f3 != -1.0f) { guideline.setGuidePercent(f3); } else if (i10 != -1) { guideline.setGuideBegin(i10); } else if (i11 != -1) { guideline.setGuideEnd(i11); } } else if (layoutParams.leftToLeft != -1 || layoutParams.leftToRight != -1 || layoutParams.rightToLeft != -1 || layoutParams.rightToRight != -1 || layoutParams.startToStart != -1 || layoutParams.startToEnd != -1 || layoutParams.endToStart != -1 || layoutParams.endToEnd != -1 || layoutParams.topToTop != -1 || layoutParams.topToBottom != -1 || layoutParams.bottomToTop != -1 || layoutParams.bottomToBottom != -1 || layoutParams.baselineToBaseline != -1 || layoutParams.editorAbsoluteX != -1 || layoutParams.editorAbsoluteY != -1 || layoutParams.circleConstraint != -1 || layoutParams.width == -1 || layoutParams.height == -1) { int i12 = layoutParams.resolvedLeftToLeft; int i13 = layoutParams.resolvedLeftToRight; int i14 = layoutParams.resolvedRightToLeft; int i15 = layoutParams.resolvedRightToRight; int i16 = layoutParams.resolveGoneLeftMargin; int i17 = layoutParams.resolveGoneRightMargin; float f4 = layoutParams.resolvedHorizontalBias; if (Build.VERSION.SDK_INT < 17) { int i18 = layoutParams.leftToLeft; int i19 = layoutParams.leftToRight; int i20 = layoutParams.rightToLeft; i15 = layoutParams.rightToRight; int i21 = layoutParams.goneLeftMargin; int i22 = layoutParams.goneRightMargin; float f5 = layoutParams.horizontalBias; if (i18 == -1 && i19 == -1) { if (layoutParams.startToStart != -1) { i18 = layoutParams.startToStart; } else if (layoutParams.startToEnd != -1) { i19 = layoutParams.startToEnd; } } int i23 = i19; i12 = i18; int i24 = i23; if (i20 == -1 && i15 == -1) { if (layoutParams.endToStart != -1) { i20 = layoutParams.endToStart; } else if (layoutParams.endToEnd != -1) { i15 = layoutParams.endToEnd; } } i2 = i21; i = i22; f = f5; i13 = i24; i3 = i20; } else { i3 = i14; i = i17; i2 = i16; f = f4; } int i25 = i15; if (layoutParams.circleConstraint != -1) { ConstraintWidget targetWidget5 = getTargetWidget(layoutParams.circleConstraint); if (targetWidget5 != null) { viewWidget2.connectCircularConstraint(targetWidget5, layoutParams.circleAngle, layoutParams.circleRadius); } } else { if (i12 != -1) { ConstraintWidget targetWidget6 = getTargetWidget(i12); if (targetWidget6 != null) { f2 = f; viewWidget2.immediateConnect(ConstraintAnchor.Type.LEFT, targetWidget6, ConstraintAnchor.Type.LEFT, layoutParams.leftMargin, i2); } else { f2 = f; } } else { f2 = f; if (!(i13 == -1 || (targetWidget4 = getTargetWidget(i13)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.LEFT, targetWidget4, ConstraintAnchor.Type.RIGHT, layoutParams.leftMargin, i2); } } if (i3 != -1) { ConstraintWidget targetWidget7 = getTargetWidget(i3); if (targetWidget7 != null) { viewWidget2.immediateConnect(ConstraintAnchor.Type.RIGHT, targetWidget7, ConstraintAnchor.Type.LEFT, layoutParams.rightMargin, i); } } else if (!(i25 == -1 || (targetWidget3 = getTargetWidget(i25)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.RIGHT, targetWidget3, ConstraintAnchor.Type.RIGHT, layoutParams.rightMargin, i); } if (layoutParams.topToTop != -1) { ConstraintWidget targetWidget8 = getTargetWidget(layoutParams.topToTop); if (targetWidget8 != null) { viewWidget2.immediateConnect(ConstraintAnchor.Type.TOP, targetWidget8, ConstraintAnchor.Type.TOP, layoutParams.topMargin, layoutParams.goneTopMargin); } } else if (!(layoutParams.topToBottom == -1 || (targetWidget2 = getTargetWidget(layoutParams.topToBottom)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.TOP, targetWidget2, ConstraintAnchor.Type.BOTTOM, layoutParams.topMargin, layoutParams.goneTopMargin); } if (layoutParams.bottomToTop != -1) { ConstraintWidget targetWidget9 = getTargetWidget(layoutParams.bottomToTop); if (targetWidget9 != null) { viewWidget2.immediateConnect(ConstraintAnchor.Type.BOTTOM, targetWidget9, ConstraintAnchor.Type.TOP, layoutParams.bottomMargin, layoutParams.goneBottomMargin); } } else if (!(layoutParams.bottomToBottom == -1 || (targetWidget = getTargetWidget(layoutParams.bottomToBottom)) == null)) { viewWidget2.immediateConnect(ConstraintAnchor.Type.BOTTOM, targetWidget, ConstraintAnchor.Type.BOTTOM, layoutParams.bottomMargin, layoutParams.goneBottomMargin); } if (layoutParams.baselineToBaseline != -1) { View view = this.mChildrenByIds.get(layoutParams.baselineToBaseline); ConstraintWidget targetWidget10 = getTargetWidget(layoutParams.baselineToBaseline); if (!(targetWidget10 == null || view == null || !(view.getLayoutParams() instanceof LayoutParams))) { layoutParams.needsBaseline = true; ((LayoutParams) view.getLayoutParams()).needsBaseline = true; viewWidget2.getAnchor(ConstraintAnchor.Type.BASELINE).connect(targetWidget10.getAnchor(ConstraintAnchor.Type.BASELINE), 0, -1, ConstraintAnchor.Strength.STRONG, 0, true); viewWidget2.getAnchor(ConstraintAnchor.Type.TOP).reset(); viewWidget2.getAnchor(ConstraintAnchor.Type.BOTTOM).reset(); } } float f6 = f2; if (f6 >= 0.0f && f6 != 0.5f) { viewWidget2.setHorizontalBiasPercent(f6); } if (layoutParams.verticalBias >= 0.0f && layoutParams.verticalBias != 0.5f) { viewWidget2.setVerticalBiasPercent(layoutParams.verticalBias); } } if (isInEditMode && !(layoutParams.editorAbsoluteX == -1 && layoutParams.editorAbsoluteY == -1)) { viewWidget2.setOrigin(layoutParams.editorAbsoluteX, layoutParams.editorAbsoluteY); } if (layoutParams.horizontalDimensionFixed) { viewWidget2.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED); viewWidget2.setWidth(layoutParams.width); } else if (layoutParams.width == -1) { viewWidget2.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_PARENT); viewWidget2.getAnchor(ConstraintAnchor.Type.LEFT).mMargin = layoutParams.leftMargin; viewWidget2.getAnchor(ConstraintAnchor.Type.RIGHT).mMargin = layoutParams.rightMargin; } else { viewWidget2.setHorizontalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT); viewWidget2.setWidth(0); } if (layoutParams.verticalDimensionFixed) { z = false; viewWidget2.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.FIXED); viewWidget2.setHeight(layoutParams.height); } else if (layoutParams.height == -1) { viewWidget2.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_PARENT); viewWidget2.getAnchor(ConstraintAnchor.Type.TOP).mMargin = layoutParams.topMargin; viewWidget2.getAnchor(ConstraintAnchor.Type.BOTTOM).mMargin = layoutParams.bottomMargin; z = false; } else { viewWidget2.setVerticalDimensionBehaviour(ConstraintWidget.DimensionBehaviour.MATCH_CONSTRAINT); z = false; viewWidget2.setHeight(0); } if (layoutParams.dimensionRatio != null) { viewWidget2.setDimensionRatio(layoutParams.dimensionRatio); } viewWidget2.setHorizontalWeight(layoutParams.horizontalWeight); viewWidget2.setVerticalWeight(layoutParams.verticalWeight); viewWidget2.setHorizontalChainStyle(layoutParams.horizontalChainStyle); viewWidget2.setVerticalChainStyle(layoutParams.verticalChainStyle); viewWidget2.setHorizontalMatchStyle(layoutParams.matchConstraintDefaultWidth, layoutParams.matchConstraintMinWidth, layoutParams.matchConstraintMaxWidth, layoutParams.matchConstraintPercentWidth); viewWidget2.setVerticalMatchStyle(layoutParams.matchConstraintDefaultHeight, layoutParams.matchConstraintMinHeight, layoutParams.matchConstraintMaxHeight, layoutParams.matchConstraintPercentHeight); } } } } private final ConstraintWidget getTargetWidget(int i) { if (i == 0) { return this.mLayoutWidget; } View view = this.mChildrenByIds.get(i); if (view == null && (view = findViewById(i)) != null && view != this && view.getParent() == this) { onViewAdded(view); } if (view == this) { return this.mLayoutWidget; } if (view == null) { return null; } return ((LayoutParams) view.getLayoutParams()).widget; } public final ConstraintWidget getViewWidget(View view) { if (view == this) { return this.mLayoutWidget; } if (view == null) { return null; } return ((LayoutParams) view.getLayoutParams()).widget; } private void internalMeasureChildren(int i, int i2) { boolean z; boolean z2; int baseline; int i3; int i4; int i5 = i; int i6 = i2; int paddingTop = getPaddingTop() + getPaddingBottom(); int paddingLeft = getPaddingLeft() + getPaddingRight(); int childCount = getChildCount(); for (int i7 = 0; i7 < childCount; i7++) { View childAt = getChildAt(i7); if (childAt.getVisibility() != 8) { LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams(); ConstraintWidget constraintWidget = layoutParams.widget; if (!layoutParams.isGuideline && !layoutParams.isHelper) { constraintWidget.setVisibility(childAt.getVisibility()); int i8 = layoutParams.width; int i9 = layoutParams.height; if (layoutParams.horizontalDimensionFixed || layoutParams.verticalDimensionFixed || (!layoutParams.horizontalDimensionFixed && layoutParams.matchConstraintDefaultWidth == 1) || layoutParams.width == -1 || (!layoutParams.verticalDimensionFixed && (layoutParams.matchConstraintDefaultHeight == 1 || layoutParams.height == -1))) { if (i8 == 0) { i3 = getChildMeasureSpec(i5, paddingLeft, -2); z2 = true; } else if (i8 == -1) { i3 = getChildMeasureSpec(i5, paddingLeft, -1); z2 = false; } else { z2 = i8 == -2; i3 = getChildMeasureSpec(i5, paddingLeft, i8); } if (i9 == 0) { i4 = getChildMeasureSpec(i6, paddingTop, -2); z = true; } else if (i9 == -1) { i4 = getChildMeasureSpec(i6, paddingTop, -1); z = false; } else { z = i9 == -2; i4 = getChildMeasureSpec(i6, paddingTop, i9); } childAt.measure(i3, i4); Metrics metrics = this.mMetrics; if (metrics != null) { metrics.measures++; } constraintWidget.setWidthWrapContent(i8 == -2); constraintWidget.setHeightWrapContent(i9 == -2); i8 = childAt.getMeasuredWidth(); i9 = childAt.getMeasuredHeight(); } else { z2 = false; z = false; } constraintWidget.setWidth(i8); constraintWidget.setHeight(i9); if (z2) { constraintWidget.setWrapWidth(i8); } if (z) { constraintWidget.setWrapHeight(i9); } if (layoutParams.needsBaseline && (baseline = childAt.getBaseline()) != -1) { constraintWidget.setBaselineDistance(baseline); } } } } } private void updatePostMeasures() { int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View childAt = getChildAt(i); if (childAt instanceof Placeholder) { ((Placeholder) childAt).updatePostMeasure(this); } } int size = this.mConstraintHelpers.size(); if (size > 0) { for (int i2 = 0; i2 < size; i2++) { this.mConstraintHelpers.get(i2).updatePostMeasure(this); } } } /* JADX WARNING: Removed duplicated region for block: B:108:0x0209 */ /* JADX WARNING: Removed duplicated region for block: B:118:0x0242 */ /* JADX WARNING: Removed duplicated region for block: B:128:0x0266 */ /* JADX WARNING: Removed duplicated region for block: B:129:0x026f */ /* JADX WARNING: Removed duplicated region for block: B:132:0x0274 */ /* JADX WARNING: Removed duplicated region for block: B:133:0x0276 */ /* JADX WARNING: Removed duplicated region for block: B:136:0x027c */ /* JADX WARNING: Removed duplicated region for block: B:137:0x027e */ /* JADX WARNING: Removed duplicated region for block: B:140:0x0292 */ /* JADX WARNING: Removed duplicated region for block: B:142:0x0297 */ /* JADX WARNING: Removed duplicated region for block: B:144:0x029c */ /* JADX WARNING: Removed duplicated region for block: B:145:0x02a4 */ /* JADX WARNING: Removed duplicated region for block: B:147:0x02ad */ /* JADX WARNING: Removed duplicated region for block: B:148:0x02b5 */ /* JADX WARNING: Removed duplicated region for block: B:151:0x02c2 */ /* JADX WARNING: Removed duplicated region for block: B:154:0x02cd */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void internalMeasureDimensions(int r24, int r25) { /* r23 = this; r0 = r23 r1 = r24 r2 = r25 int r3 = r23.getPaddingTop() int r4 = r23.getPaddingBottom() int r3 = r3 + r4 int r4 = r23.getPaddingLeft() int r5 = r23.getPaddingRight() int r4 = r4 + r5 int r5 = r23.getChildCount() r7 = 0 L_0x001d: r8 = 1 r10 = 8 r12 = -2 if (r7 >= r5) goto L_0x00dc android.view.View r14 = r0.getChildAt(r7) int r15 = r14.getVisibility() if (r15 != r10) goto L_0x0030 goto L_0x00d4 L_0x0030: android.view.ViewGroup$LayoutParams r10 = r14.getLayoutParams() androidx.constraintlayout.widget.ConstraintLayout$LayoutParams r10 = (androidx.constraintlayout.widget.ConstraintLayout.LayoutParams) r10 androidx.constraintlayout.solver.widgets.ConstraintWidget r15 = r10.widget boolean r6 = r10.isGuideline if (r6 != 0) goto L_0x00d4 boolean r6 = r10.isHelper if (r6 == 0) goto L_0x0042 goto L_0x00d4 L_0x0042: int r6 = r14.getVisibility() r15.setVisibility(r6) int r6 = r10.width int r13 = r10.height if (r6 == 0) goto L_0x00c4 if (r13 != 0) goto L_0x0053 goto L_0x00c4 L_0x0053: if (r6 != r12) goto L_0x0058 r16 = 1 goto L_0x005a L_0x0058: r16 = 0 L_0x005a: int r11 = getChildMeasureSpec(r1, r4, r6) if (r13 != r12) goto L_0x0063 r17 = 1 goto L_0x0065 L_0x0063: r17 = 0 L_0x0065: int r12 = getChildMeasureSpec(r2, r3, r13) r14.measure(r11, r12) androidx.constraintlayout.solver.Metrics r11 = r0.mMetrics r12 = r3 if (r11 == 0) goto L_0x0076 long r2 = r11.measures long r2 = r2 + r8 r11.measures = r2 L_0x0076: r2 = -2 if (r6 != r2) goto L_0x007b r3 = 1 goto L_0x007c L_0x007b: r3 = 0 L_0x007c: r15.setWidthWrapContent(r3) if (r13 != r2) goto L_0x0083 r13 = 1 goto L_0x0084 L_0x0083: r13 = 0 L_0x0084: r15.setHeightWrapContent(r13) int r2 = r14.getMeasuredWidth() int r3 = r14.getMeasuredHeight() r15.setWidth(r2) r15.setHeight(r3) if (r16 == 0) goto L_0x009a r15.setWrapWidth(r2) L_0x009a: if (r17 == 0) goto L_0x009f r15.setWrapHeight(r3) L_0x009f: boolean r6 = r10.needsBaseline if (r6 == 0) goto L_0x00ad int r6 = r14.getBaseline() r8 = -1 if (r6 == r8) goto L_0x00ad r15.setBaselineDistance(r6) L_0x00ad: boolean r6 = r10.horizontalDimensionFixed if (r6 == 0) goto L_0x00d5 boolean r6 = r10.verticalDimensionFixed if (r6 == 0) goto L_0x00d5 androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r15.getResolutionWidth() r6.resolve(r2) androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r15.getResolutionHeight() r2.resolve(r3) goto L_0x00d5 L_0x00c4: r12 = r3 androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r15.getResolutionWidth() r2.invalidate() androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r15.getResolutionHeight() r2.invalidate() goto L_0x00d5 L_0x00d4: r12 = r3 L_0x00d5: int r7 = r7 + 1 r2 = r25 r3 = r12 goto L_0x001d L_0x00dc: r12 = r3 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r2 = r0.mLayoutWidget r2.solveGraph() r2 = 0 L_0x00e3: if (r2 >= r5) goto L_0x02e6 android.view.View r3 = r0.getChildAt(r2) int r6 = r3.getVisibility() if (r6 != r10) goto L_0x00f1 goto L_0x02cf L_0x00f1: android.view.ViewGroup$LayoutParams r6 = r3.getLayoutParams() androidx.constraintlayout.widget.ConstraintLayout$LayoutParams r6 = (androidx.constraintlayout.widget.ConstraintLayout.LayoutParams) r6 androidx.constraintlayout.solver.widgets.ConstraintWidget r7 = r6.widget boolean r11 = r6.isGuideline if (r11 != 0) goto L_0x02cf boolean r11 = r6.isHelper if (r11 == 0) goto L_0x0103 goto L_0x02cf L_0x0103: int r11 = r3.getVisibility() r7.setVisibility(r11) int r11 = r6.width int r13 = r6.height if (r11 == 0) goto L_0x0114 if (r13 == 0) goto L_0x0114 goto L_0x02cf L_0x0114: androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r14 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.LEFT androidx.constraintlayout.solver.widgets.ConstraintAnchor r14 = r7.getAnchor(r14) androidx.constraintlayout.solver.widgets.ResolutionAnchor r14 = r14.getResolutionNode() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r15 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.RIGHT androidx.constraintlayout.solver.widgets.ConstraintAnchor r15 = r7.getAnchor(r15) androidx.constraintlayout.solver.widgets.ResolutionAnchor r15 = r15.getResolutionNode() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r10 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.LEFT androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r7.getAnchor(r10) androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r10.getTarget() if (r10 == 0) goto L_0x0142 androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r10 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.RIGHT androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r7.getAnchor(r10) androidx.constraintlayout.solver.widgets.ConstraintAnchor r10 = r10.getTarget() if (r10 == 0) goto L_0x0142 r10 = 1 goto L_0x0143 L_0x0142: r10 = 0 L_0x0143: androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r8 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.TOP androidx.constraintlayout.solver.widgets.ConstraintAnchor r8 = r7.getAnchor(r8) androidx.constraintlayout.solver.widgets.ResolutionAnchor r8 = r8.getResolutionNode() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r9 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.BOTTOM androidx.constraintlayout.solver.widgets.ConstraintAnchor r9 = r7.getAnchor(r9) androidx.constraintlayout.solver.widgets.ResolutionAnchor r9 = r9.getResolutionNode() r17 = r5 androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r5 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.TOP androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r7.getAnchor(r5) androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r5.getTarget() if (r5 == 0) goto L_0x0173 androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r5 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.BOTTOM androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r7.getAnchor(r5) androidx.constraintlayout.solver.widgets.ConstraintAnchor r5 = r5.getTarget() if (r5 == 0) goto L_0x0173 r5 = 1 goto L_0x0174 L_0x0173: r5 = 0 L_0x0174: if (r11 != 0) goto L_0x0187 if (r13 != 0) goto L_0x0187 if (r10 == 0) goto L_0x0187 if (r5 == 0) goto L_0x0187 r5 = r25 r6 = r0 r20 = r2 r2 = -1 r8 = -2 r18 = 1 goto L_0x02da L_0x0187: r20 = r2 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r2 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r2 = r2.getHorizontalDimensionBehaviour() r21 = r6 androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r2 == r6) goto L_0x0197 r2 = 1 goto L_0x0198 L_0x0197: r2 = 0 L_0x0198: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r6 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = r6.getVerticalDimensionBehaviour() androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r0 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r6 == r0) goto L_0x01a4 r0 = 1 goto L_0x01a5 L_0x01a4: r0 = 0 L_0x01a5: if (r2 != 0) goto L_0x01ae androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r7.getResolutionWidth() r6.invalidate() L_0x01ae: if (r0 != 0) goto L_0x01b7 androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r7.getResolutionHeight() r6.invalidate() L_0x01b7: if (r11 != 0) goto L_0x01ee if (r2 == 0) goto L_0x01e5 boolean r6 = r7.isSpreadWidth() if (r6 == 0) goto L_0x01e5 if (r10 == 0) goto L_0x01e5 boolean r6 = r14.isResolved() if (r6 == 0) goto L_0x01e5 boolean r6 = r15.isResolved() if (r6 == 0) goto L_0x01e5 float r6 = r15.getResolvedValue() float r10 = r14.getResolvedValue() float r6 = r6 - r10 int r11 = (int) r6 androidx.constraintlayout.solver.widgets.ResolutionDimension r6 = r7.getResolutionWidth() r6.resolve(r11) int r6 = getChildMeasureSpec(r1, r4, r11) goto L_0x01f7 L_0x01e5: r6 = -2 int r2 = getChildMeasureSpec(r1, r4, r6) r6 = r2 r2 = 0 r10 = 1 goto L_0x0207 L_0x01ee: r6 = -2 r10 = -1 if (r11 != r10) goto L_0x01f9 int r14 = getChildMeasureSpec(r1, r4, r10) r6 = r14 L_0x01f7: r10 = 0 goto L_0x0207 L_0x01f9: if (r11 != r6) goto L_0x01fd r6 = 1 goto L_0x01fe L_0x01fd: r6 = 0 L_0x01fe: int r10 = getChildMeasureSpec(r1, r4, r11) r22 = r10 r10 = r6 r6 = r22 L_0x0207: if (r13 != 0) goto L_0x0242 if (r0 == 0) goto L_0x0237 boolean r14 = r7.isSpreadHeight() if (r14 == 0) goto L_0x0237 if (r5 == 0) goto L_0x0237 boolean r5 = r8.isResolved() if (r5 == 0) goto L_0x0237 boolean r5 = r9.isResolved() if (r5 == 0) goto L_0x0237 float r5 = r9.getResolvedValue() float r8 = r8.getResolvedValue() float r5 = r5 - r8 int r13 = (int) r5 androidx.constraintlayout.solver.widgets.ResolutionDimension r5 = r7.getResolutionHeight() r5.resolve(r13) r5 = r25 int r8 = getChildMeasureSpec(r5, r12, r13) goto L_0x024d L_0x0237: r5 = r25 r8 = -2 int r0 = getChildMeasureSpec(r5, r12, r8) r8 = r0 r0 = 0 r9 = 1 goto L_0x025d L_0x0242: r5 = r25 r8 = -2 r9 = -1 if (r13 != r9) goto L_0x024f int r14 = getChildMeasureSpec(r5, r12, r9) r8 = r14 L_0x024d: r9 = 0 goto L_0x025d L_0x024f: if (r13 != r8) goto L_0x0253 r8 = 1 goto L_0x0254 L_0x0253: r8 = 0 L_0x0254: int r9 = getChildMeasureSpec(r5, r12, r13) r22 = r9 r9 = r8 r8 = r22 L_0x025d: r3.measure(r6, r8) r6 = r23 androidx.constraintlayout.solver.Metrics r8 = r6.mMetrics if (r8 == 0) goto L_0x026f long r14 = r8.measures r18 = 1 long r14 = r14 + r18 r8.measures = r14 goto L_0x0271 L_0x026f: r18 = 1 L_0x0271: r8 = -2 if (r11 != r8) goto L_0x0276 r11 = 1 goto L_0x0277 L_0x0276: r11 = 0 L_0x0277: r7.setWidthWrapContent(r11) if (r13 != r8) goto L_0x027e r11 = 1 goto L_0x027f L_0x027e: r11 = 0 L_0x027f: r7.setHeightWrapContent(r11) int r11 = r3.getMeasuredWidth() int r13 = r3.getMeasuredHeight() r7.setWidth(r11) r7.setHeight(r13) if (r10 == 0) goto L_0x0295 r7.setWrapWidth(r11) L_0x0295: if (r9 == 0) goto L_0x029a r7.setWrapHeight(r13) L_0x029a: if (r2 == 0) goto L_0x02a4 androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r7.getResolutionWidth() r2.resolve(r11) goto L_0x02ab L_0x02a4: androidx.constraintlayout.solver.widgets.ResolutionDimension r2 = r7.getResolutionWidth() r2.remove() L_0x02ab: if (r0 == 0) goto L_0x02b5 androidx.constraintlayout.solver.widgets.ResolutionDimension r0 = r7.getResolutionHeight() r0.resolve(r13) goto L_0x02bc L_0x02b5: androidx.constraintlayout.solver.widgets.ResolutionDimension r0 = r7.getResolutionHeight() r0.remove() L_0x02bc: r0 = r21 boolean r0 = r0.needsBaseline if (r0 == 0) goto L_0x02cd int r0 = r3.getBaseline() r2 = -1 if (r0 == r2) goto L_0x02da r7.setBaselineDistance(r0) goto L_0x02da L_0x02cd: r2 = -1 goto L_0x02da L_0x02cf: r6 = r0 r20 = r2 r17 = r5 r18 = r8 r2 = -1 r8 = -2 r5 = r25 L_0x02da: int r0 = r20 + 1 r2 = r0 r0 = r6 r5 = r17 r8 = r18 r10 = 8 goto L_0x00e3 L_0x02e6: r6 = r0 return */ throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.widget.ConstraintLayout.internalMeasureDimensions(int, int):void"); } /* access modifiers changed from: protected */ /* JADX WARNING: Removed duplicated region for block: B:173:0x037a */ /* JADX WARNING: Removed duplicated region for block: B:176:0x0390 */ /* JADX WARNING: Removed duplicated region for block: B:183:0x03c9 */ /* JADX WARNING: Removed duplicated region for block: B:62:0x013a */ /* JADX WARNING: Removed duplicated region for block: B:65:0x0151 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void onMeasure(int r24, int r25) { /* r23 = this; r0 = r23 r1 = r24 r2 = r25 java.lang.System.currentTimeMillis() int r3 = android.view.View.MeasureSpec.getMode(r24) int r4 = android.view.View.MeasureSpec.getSize(r24) int r5 = android.view.View.MeasureSpec.getMode(r25) int r6 = android.view.View.MeasureSpec.getSize(r25) int r7 = r23.getPaddingLeft() int r8 = r23.getPaddingTop() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget r9.setX(r7) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget r9.setY(r8) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r10 = r0.mMaxWidth r9.setMaxWidth(r10) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r10 = r0.mMaxHeight r9.setMaxHeight(r10) int r9 = android.os.Build.VERSION.SDK_INT r10 = 0 r11 = 1 r12 = 17 if (r9 < r12) goto L_0x004f androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r12 = r23.getLayoutDirection() if (r12 != r11) goto L_0x004b r12 = 1 goto L_0x004c L_0x004b: r12 = 0 L_0x004c: r9.setRtl(r12) L_0x004f: r23.setSelfDimensionBehaviour(r24, r25) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r9 = r0.mLayoutWidget int r9 = r9.getWidth() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r12 = r0.mLayoutWidget int r12 = r12.getHeight() boolean r13 = r0.mDirtyHierarchy if (r13 == 0) goto L_0x0069 r0.mDirtyHierarchy = r10 r23.updateHierarchy() r13 = 1 goto L_0x006a L_0x0069: r13 = 0 L_0x006a: int r14 = r0.mOptimizationLevel r15 = 8 r14 = r14 & r15 if (r14 != r15) goto L_0x0073 r14 = 1 goto L_0x0074 L_0x0073: r14 = 0 L_0x0074: if (r14 == 0) goto L_0x0084 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r15 = r0.mLayoutWidget r15.preOptimize() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r15 = r0.mLayoutWidget r15.optimizeForDimensions(r9, r12) r23.internalMeasureDimensions(r24, r25) goto L_0x0087 L_0x0084: r23.internalMeasureChildren(r24, r25) L_0x0087: r23.updatePostMeasures() int r15 = r23.getChildCount() if (r15 <= 0) goto L_0x0097 if (r13 == 0) goto L_0x0097 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.Analyzer.determineGroups(r13) L_0x0097: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget boolean r13 = r13.mGroupsWrapOptimized if (r13 == 0) goto L_0x00d7 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget boolean r13 = r13.mHorizontalWrapOptimized r15 = -2147483648(0xffffffff80000000, float:-0.0) if (r13 == 0) goto L_0x00bb if (r3 != r15) goto L_0x00bb androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.mWrapFixedWidth if (r13 >= r4) goto L_0x00b4 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r11 = r13.mWrapFixedWidth r13.setWidth(r11) L_0x00b4: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.FIXED r11.setHorizontalDimensionBehaviour(r13) L_0x00bb: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget boolean r11 = r11.mVerticalWrapOptimized if (r11 == 0) goto L_0x00d7 if (r5 != r15) goto L_0x00d7 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget int r11 = r11.mWrapFixedHeight if (r11 >= r6) goto L_0x00d0 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget int r13 = r11.mWrapFixedHeight r11.setHeight(r13) L_0x00d0: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.FIXED r11.setVerticalDimensionBehaviour(r13) L_0x00d7: int r11 = r0.mOptimizationLevel r13 = 32 r11 = r11 & r13 r15 = 1073741824(0x40000000, float:2.0) if (r11 != r13) goto L_0x0133 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget int r11 = r11.getWidth() androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.getHeight() int r10 = r0.mLastMeasureWidth if (r10 == r11) goto L_0x00fa if (r3 != r15) goto L_0x00fa androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r10 = 0 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r10, r11) L_0x00fa: int r3 = r0.mLastMeasureHeight if (r3 == r13) goto L_0x0108 if (r5 != r15) goto L_0x0108 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r5 = 1 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r5, r13) L_0x0108: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.mHorizontalWrapOptimized if (r3 == 0) goto L_0x011d androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget int r3 = r3.mWrapFixedWidth if (r3 <= r4) goto L_0x011d androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r10 = 0 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r10, r4) goto L_0x011e L_0x011d: r10 = 0 L_0x011e: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.mVerticalWrapOptimized if (r3 == 0) goto L_0x0133 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget int r3 = r3.mWrapFixedHeight if (r3 <= r6) goto L_0x0133 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget java.util.List<androidx.constraintlayout.solver.widgets.ConstraintWidgetGroup> r3 = r3.mWidgetGroups r4 = 1 androidx.constraintlayout.solver.widgets.Analyzer.setPosition(r3, r4, r6) goto L_0x0134 L_0x0133: r4 = 1 L_0x0134: int r3 = r23.getChildCount() if (r3 <= 0) goto L_0x013f java.lang.String r3 = "First pass" r0.solveLinearSystem(r3) L_0x013f: java.util.ArrayList<androidx.constraintlayout.solver.widgets.ConstraintWidget> r3 = r0.mVariableDimensionsWidgets int r3 = r3.size() int r5 = r23.getPaddingBottom() int r8 = r8 + r5 int r5 = r23.getPaddingRight() int r7 = r7 + r5 if (r3 <= 0) goto L_0x037a androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r6 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r6 = r6.getHorizontalDimensionBehaviour() androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r11 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r6 != r11) goto L_0x015d r6 = 1 goto L_0x015e L_0x015d: r6 = 0 L_0x015e: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r11 = r0.mLayoutWidget androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r11 = r11.getVerticalDimensionBehaviour() androidx.constraintlayout.solver.widgets.ConstraintWidget$DimensionBehaviour r13 = androidx.constraintlayout.solver.widgets.ConstraintWidget.DimensionBehaviour.WRAP_CONTENT if (r11 != r13) goto L_0x016a r11 = 1 goto L_0x016b L_0x016a: r11 = 0 L_0x016b: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.getWidth() int r4 = r0.mMinWidth int r4 = java.lang.Math.max(r13, r4) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r13 = r0.mLayoutWidget int r13 = r13.getHeight() int r10 = r0.mMinHeight int r10 = java.lang.Math.max(r13, r10) r5 = r10 r10 = 0 r13 = 0 r16 = 0 L_0x0188: r17 = 1 if (r10 >= r3) goto L_0x02d2 java.util.ArrayList<androidx.constraintlayout.solver.widgets.ConstraintWidget> r15 = r0.mVariableDimensionsWidgets java.lang.Object r15 = r15.get(r10) androidx.constraintlayout.solver.widgets.ConstraintWidget r15 = (androidx.constraintlayout.solver.widgets.ConstraintWidget) r15 java.lang.Object r19 = r15.getCompanionWidget() r20 = r3 r3 = r19 android.view.View r3 = (android.view.View) r3 if (r3 != 0) goto L_0x01a6 r19 = r9 r21 = r12 goto L_0x02ba L_0x01a6: android.view.ViewGroup$LayoutParams r19 = r3.getLayoutParams() r21 = r12 r12 = r19 androidx.constraintlayout.widget.ConstraintLayout$LayoutParams r12 = (androidx.constraintlayout.widget.ConstraintLayout.LayoutParams) r12 r19 = r9 boolean r9 = r12.isHelper if (r9 != 0) goto L_0x02ba boolean r9 = r12.isGuideline if (r9 == 0) goto L_0x01bc goto L_0x02ba L_0x01bc: int r9 = r3.getVisibility() r22 = r13 r13 = 8 if (r9 != r13) goto L_0x01c8 L_0x01c6: goto L_0x02bc L_0x01c8: if (r14 == 0) goto L_0x01df androidx.constraintlayout.solver.widgets.ResolutionDimension r9 = r15.getResolutionWidth() boolean r9 = r9.isResolved() if (r9 == 0) goto L_0x01df androidx.constraintlayout.solver.widgets.ResolutionDimension r9 = r15.getResolutionHeight() boolean r9 = r9.isResolved() if (r9 == 0) goto L_0x01df goto L_0x01c6 L_0x01df: int r9 = r12.width r13 = -2 if (r9 != r13) goto L_0x01ef boolean r9 = r12.horizontalDimensionFixed if (r9 == 0) goto L_0x01ef int r9 = r12.width int r9 = getChildMeasureSpec(r1, r7, r9) goto L_0x01f9 L_0x01ef: int r9 = r15.getWidth() r13 = 1073741824(0x40000000, float:2.0) int r9 = android.view.View.MeasureSpec.makeMeasureSpec(r9, r13) L_0x01f9: int r13 = r12.height r1 = -2 if (r13 != r1) goto L_0x0209 boolean r1 = r12.verticalDimensionFixed if (r1 == 0) goto L_0x0209 int r1 = r12.height int r1 = getChildMeasureSpec(r2, r8, r1) goto L_0x0213 L_0x0209: int r1 = r15.getHeight() r13 = 1073741824(0x40000000, float:2.0) int r1 = android.view.View.MeasureSpec.makeMeasureSpec(r1, r13) L_0x0213: r3.measure(r9, r1) androidx.constraintlayout.solver.Metrics r1 = r0.mMetrics r13 = r8 if (r1 == 0) goto L_0x0221 long r8 = r1.additionalMeasures long r8 = r8 + r17 r1.additionalMeasures = r8 L_0x0221: int r1 = r3.getMeasuredWidth() int r8 = r3.getMeasuredHeight() int r9 = r15.getWidth() if (r1 == r9) goto L_0x0258 r15.setWidth(r1) if (r14 == 0) goto L_0x023b androidx.constraintlayout.solver.widgets.ResolutionDimension r9 = r15.getResolutionWidth() r9.resolve(r1) L_0x023b: if (r6 == 0) goto L_0x0256 int r1 = r15.getRight() if (r1 <= r4) goto L_0x0256 int r1 = r15.getRight() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r9 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.RIGHT androidx.constraintlayout.solver.widgets.ConstraintAnchor r9 = r15.getAnchor(r9) int r9 = r9.getMargin() int r1 = r1 + r9 int r4 = java.lang.Math.max(r4, r1) L_0x0256: r22 = 1 L_0x0258: int r1 = r15.getHeight() if (r8 == r1) goto L_0x0289 r15.setHeight(r8) if (r14 == 0) goto L_0x026a androidx.constraintlayout.solver.widgets.ResolutionDimension r1 = r15.getResolutionHeight() r1.resolve(r8) L_0x026a: if (r11 == 0) goto L_0x0286 int r1 = r15.getBottom() if (r1 <= r5) goto L_0x0286 int r1 = r15.getBottom() androidx.constraintlayout.solver.widgets.ConstraintAnchor$Type r8 = androidx.constraintlayout.solver.widgets.ConstraintAnchor.Type.BOTTOM androidx.constraintlayout.solver.widgets.ConstraintAnchor r8 = r15.getAnchor(r8) int r8 = r8.getMargin() int r1 = r1 + r8 int r1 = java.lang.Math.max(r5, r1) r5 = r1 L_0x0286: r1 = r5 r5 = 1 goto L_0x028c L_0x0289: r1 = r5 r5 = r22 L_0x028c: boolean r8 = r12.needsBaseline if (r8 == 0) goto L_0x02a1 int r8 = r3.getBaseline() r9 = -1 if (r8 == r9) goto L_0x02a1 int r9 = r15.getBaselineDistance() if (r8 == r9) goto L_0x02a1 r15.setBaselineDistance(r8) r5 = 1 L_0x02a1: int r8 = android.os.Build.VERSION.SDK_INT r9 = 11 if (r8 < r9) goto L_0x02b4 int r3 = r3.getMeasuredState() r8 = r16 int r3 = combineMeasuredStates(r8, r3) r16 = r3 goto L_0x02b6 L_0x02b4: r8 = r16 L_0x02b6: r22 = r5 r5 = r1 goto L_0x02c1 L_0x02ba: r22 = r13 L_0x02bc: r13 = r8 r8 = r16 r16 = r8 L_0x02c1: int r10 = r10 + 1 r1 = r24 r8 = r13 r9 = r19 r3 = r20 r12 = r21 r13 = r22 r15 = 1073741824(0x40000000, float:2.0) goto L_0x0188 L_0x02d2: r20 = r3 r19 = r9 r21 = r12 r22 = r13 r13 = r8 r8 = r16 if (r22 == 0) goto L_0x0320 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r3 = r19 r1.setWidth(r3) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r3 = r21 r1.setHeight(r3) if (r14 == 0) goto L_0x02f4 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r1.solveGraph() L_0x02f4: java.lang.String r1 = "2nd pass" r0.solveLinearSystem(r1) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget int r1 = r1.getWidth() if (r1 >= r4) goto L_0x0308 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r1.setWidth(r4) r10 = 1 goto L_0x0309 L_0x0308: r10 = 0 L_0x0309: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget int r1 = r1.getHeight() if (r1 >= r5) goto L_0x0318 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget r1.setHeight(r5) r11 = 1 goto L_0x0319 L_0x0318: r11 = r10 L_0x0319: if (r11 == 0) goto L_0x0320 java.lang.String r1 = "3rd pass" r0.solveLinearSystem(r1) L_0x0320: r1 = r20 r10 = 0 L_0x0323: if (r10 >= r1) goto L_0x0378 java.util.ArrayList<androidx.constraintlayout.solver.widgets.ConstraintWidget> r3 = r0.mVariableDimensionsWidgets java.lang.Object r3 = r3.get(r10) androidx.constraintlayout.solver.widgets.ConstraintWidget r3 = (androidx.constraintlayout.solver.widgets.ConstraintWidget) r3 java.lang.Object r4 = r3.getCompanionWidget() android.view.View r4 = (android.view.View) r4 if (r4 != 0) goto L_0x033a L_0x0335: r6 = 8 L_0x0337: r9 = 1073741824(0x40000000, float:2.0) goto L_0x0375 L_0x033a: int r5 = r4.getMeasuredWidth() int r6 = r3.getWidth() if (r5 != r6) goto L_0x034e int r5 = r4.getMeasuredHeight() int r6 = r3.getHeight() if (r5 == r6) goto L_0x0335 L_0x034e: int r5 = r3.getVisibility() r6 = 8 if (r5 == r6) goto L_0x0337 int r5 = r3.getWidth() r9 = 1073741824(0x40000000, float:2.0) int r5 = android.view.View.MeasureSpec.makeMeasureSpec(r5, r9) int r3 = r3.getHeight() int r3 = android.view.View.MeasureSpec.makeMeasureSpec(r3, r9) r4.measure(r5, r3) androidx.constraintlayout.solver.Metrics r3 = r0.mMetrics if (r3 == 0) goto L_0x0375 long r4 = r3.additionalMeasures long r4 = r4 + r17 r3.additionalMeasures = r4 L_0x0375: int r10 = r10 + 1 goto L_0x0323 L_0x0378: r10 = r8 goto L_0x037c L_0x037a: r13 = r8 r10 = 0 L_0x037c: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r1 = r0.mLayoutWidget int r1 = r1.getWidth() int r1 = r1 + r7 androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget int r3 = r3.getHeight() int r3 = r3 + r13 int r4 = android.os.Build.VERSION.SDK_INT r5 = 11 if (r4 < r5) goto L_0x03c9 r4 = r24 int r1 = resolveSizeAndState(r1, r4, r10) int r4 = r10 << 16 int r2 = resolveSizeAndState(r3, r2, r4) r3 = 16777215(0xffffff, float:2.3509886E-38) r1 = r1 & r3 r2 = r2 & r3 int r3 = r0.mMaxWidth int r1 = java.lang.Math.min(r3, r1) int r3 = r0.mMaxHeight int r2 = java.lang.Math.min(r3, r2) androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.isWidthMeasuredTooSmall() r4 = 16777216(0x1000000, float:2.3509887E-38) if (r3 == 0) goto L_0x03b8 r1 = r1 | r4 L_0x03b8: androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer r3 = r0.mLayoutWidget boolean r3 = r3.isHeightMeasuredTooSmall() if (r3 == 0) goto L_0x03c1 r2 = r2 | r4 L_0x03c1: r0.setMeasuredDimension(r1, r2) r0.mLastMeasureWidth = r1 r0.mLastMeasureHeight = r2 goto L_0x03d0 L_0x03c9: r0.setMeasuredDimension(r1, r3) r0.mLastMeasureWidth = r1 r0.mLastMeasureHeight = r3 L_0x03d0: return */ throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.widget.ConstraintLayout.onMeasure(int, int):void"); } private void setSelfDimensionBehaviour(int i, int i2) { int mode = View.MeasureSpec.getMode(i); int size = View.MeasureSpec.getSize(i); int mode2 = View.MeasureSpec.getMode(i2); int size2 = View.MeasureSpec.getSize(i2); int paddingTop = getPaddingTop() + getPaddingBottom(); int paddingLeft = getPaddingLeft() + getPaddingRight(); ConstraintWidget.DimensionBehaviour dimensionBehaviour = ConstraintWidget.DimensionBehaviour.FIXED; ConstraintWidget.DimensionBehaviour dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.FIXED; getLayoutParams(); if (mode != Integer.MIN_VALUE) { if (mode == 0) { dimensionBehaviour = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } else if (mode == 1073741824) { size = Math.min(this.mMaxWidth, size) - paddingLeft; } size = 0; } else { dimensionBehaviour = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } if (mode2 != Integer.MIN_VALUE) { if (mode2 == 0) { dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } else if (mode2 == 1073741824) { size2 = Math.min(this.mMaxHeight, size2) - paddingTop; } size2 = 0; } else { dimensionBehaviour2 = ConstraintWidget.DimensionBehaviour.WRAP_CONTENT; } this.mLayoutWidget.setMinWidth(0); this.mLayoutWidget.setMinHeight(0); this.mLayoutWidget.setHorizontalDimensionBehaviour(dimensionBehaviour); this.mLayoutWidget.setWidth(size); this.mLayoutWidget.setVerticalDimensionBehaviour(dimensionBehaviour2); this.mLayoutWidget.setHeight(size2); this.mLayoutWidget.setMinWidth((this.mMinWidth - getPaddingLeft()) - getPaddingRight()); this.mLayoutWidget.setMinHeight((this.mMinHeight - getPaddingTop()) - getPaddingBottom()); } /* access modifiers changed from: protected */ public void solveLinearSystem(String str) { this.mLayoutWidget.layout(); Metrics metrics = this.mMetrics; if (metrics != null) { metrics.resolutions++; } } /* access modifiers changed from: protected */ public void onLayout(boolean z, int i, int i2, int i3, int i4) { View content; int childCount = getChildCount(); boolean isInEditMode = isInEditMode(); for (int i5 = 0; i5 < childCount; i5++) { View childAt = getChildAt(i5); LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams(); ConstraintWidget constraintWidget = layoutParams.widget; if ((childAt.getVisibility() != 8 || layoutParams.isGuideline || layoutParams.isHelper || isInEditMode) && !layoutParams.isInPlaceholder) { int drawX = constraintWidget.getDrawX(); int drawY = constraintWidget.getDrawY(); int width = constraintWidget.getWidth() + drawX; int height = constraintWidget.getHeight() + drawY; childAt.layout(drawX, drawY, width, height); if ((childAt instanceof Placeholder) && (content = ((Placeholder) childAt).getContent()) != null) { content.setVisibility(0); content.layout(drawX, drawY, width, height); } } } int size = this.mConstraintHelpers.size(); if (size > 0) { for (int i6 = 0; i6 < size; i6++) { this.mConstraintHelpers.get(i6).updatePostLayout(this); } } } public void setOptimizationLevel(int i) { this.mLayoutWidget.setOptimizationLevel(i); } public int getOptimizationLevel() { return this.mLayoutWidget.getOptimizationLevel(); } public LayoutParams generateLayoutParams(AttributeSet attributeSet) { return new LayoutParams(getContext(), attributeSet); } /* access modifiers changed from: protected */ public LayoutParams generateDefaultLayoutParams() { return new LayoutParams(-2, -2); } /* access modifiers changed from: protected */ public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) { return new LayoutParams(layoutParams); } /* access modifiers changed from: protected */ public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) { return layoutParams instanceof LayoutParams; } public void setConstraintSet(ConstraintSet constraintSet) { this.mConstraintSet = constraintSet; } public View getViewById(int i) { return this.mChildrenByIds.get(i); } public void dispatchDraw(Canvas canvas) { Object tag; super.dispatchDraw(canvas); if (isInEditMode()) { int childCount = getChildCount(); float width = (float) getWidth(); float height = (float) getHeight(); for (int i = 0; i < childCount; i++) { View childAt = getChildAt(i); if (!(childAt.getVisibility() == 8 || (tag = childAt.getTag()) == null || !(tag instanceof String))) { String[] split = ((String) tag).split(","); if (split.length == 4) { int parseInt = Integer.parseInt(split[0]); int parseInt2 = Integer.parseInt(split[1]); int parseInt3 = Integer.parseInt(split[2]); int i2 = (int) ((((float) parseInt) / 1080.0f) * width); int i3 = (int) ((((float) parseInt2) / 1920.0f) * height); Paint paint = new Paint(); paint.setColor(-65536); float f = (float) i2; float f2 = (float) (i2 + ((int) ((((float) parseInt3) / 1080.0f) * width))); Canvas canvas2 = canvas; float f3 = (float) i3; float f4 = f; float f5 = f; float f6 = f3; Paint paint2 = paint; float f7 = f2; Paint paint3 = paint2; canvas2.drawLine(f4, f6, f7, f3, paint3); float parseInt4 = (float) (i3 + ((int) ((((float) Integer.parseInt(split[3])) / 1920.0f) * height))); float f8 = f2; float f9 = parseInt4; canvas2.drawLine(f8, f6, f7, f9, paint3); float f10 = parseInt4; float f11 = f5; canvas2.drawLine(f8, f10, f11, f9, paint3); float f12 = f5; canvas2.drawLine(f12, f10, f11, f3, paint3); Paint paint4 = paint2; paint4.setColor(-16711936); Paint paint5 = paint4; float f13 = f2; Paint paint6 = paint5; canvas2.drawLine(f12, f3, f13, parseInt4, paint6); canvas2.drawLine(f12, parseInt4, f13, f3, paint6); } } } } } public static class LayoutParams extends ViewGroup.MarginLayoutParams { public int baselineToBaseline = -1; public int bottomToBottom = -1; public int bottomToTop = -1; public float circleAngle = 0.0f; public int circleConstraint = -1; public int circleRadius = 0; public boolean constrainedHeight = false; public boolean constrainedWidth = false; public String dimensionRatio = null; int dimensionRatioSide = 1; float dimensionRatioValue = 0.0f; public int editorAbsoluteX = -1; public int editorAbsoluteY = -1; public int endToEnd = -1; public int endToStart = -1; public int goneBottomMargin = -1; public int goneEndMargin = -1; public int goneLeftMargin = -1; public int goneRightMargin = -1; public int goneStartMargin = -1; public int goneTopMargin = -1; public int guideBegin = -1; public int guideEnd = -1; public float guidePercent = -1.0f; public boolean helped = false; public float horizontalBias = 0.5f; public int horizontalChainStyle = 0; boolean horizontalDimensionFixed = true; public float horizontalWeight = -1.0f; boolean isGuideline = false; boolean isHelper = false; boolean isInPlaceholder = false; public int leftToLeft = -1; public int leftToRight = -1; public int matchConstraintDefaultHeight = 0; public int matchConstraintDefaultWidth = 0; public int matchConstraintMaxHeight = 0; public int matchConstraintMaxWidth = 0; public int matchConstraintMinHeight = 0; public int matchConstraintMinWidth = 0; public float matchConstraintPercentHeight = 1.0f; public float matchConstraintPercentWidth = 1.0f; boolean needsBaseline = false; public int orientation = -1; int resolveGoneLeftMargin = -1; int resolveGoneRightMargin = -1; int resolvedGuideBegin; int resolvedGuideEnd; float resolvedGuidePercent; float resolvedHorizontalBias = 0.5f; int resolvedLeftToLeft = -1; int resolvedLeftToRight = -1; int resolvedRightToLeft = -1; int resolvedRightToRight = -1; public int rightToLeft = -1; public int rightToRight = -1; public int startToEnd = -1; public int startToStart = -1; public int topToBottom = -1; public int topToTop = -1; public float verticalBias = 0.5f; public int verticalChainStyle = 0; boolean verticalDimensionFixed = true; public float verticalWeight = -1.0f; ConstraintWidget widget = new ConstraintWidget(); private static class Table { public static final SparseIntArray map; static { SparseIntArray sparseIntArray = new SparseIntArray(); map = sparseIntArray; sparseIntArray.append(R.styleable.ConstraintLayout_Layout_layout_constraintLeft_toLeftOf, 8); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintLeft_toRightOf, 9); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintRight_toLeftOf, 10); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintRight_toRightOf, 11); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintTop_toTopOf, 12); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintTop_toBottomOf, 13); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBottom_toTopOf, 14); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBottom_toBottomOf, 15); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBaseline_toBaselineOf, 16); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintCircle, 2); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintCircleRadius, 3); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintCircleAngle, 4); map.append(R.styleable.ConstraintLayout_Layout_layout_editor_absoluteX, 49); map.append(R.styleable.ConstraintLayout_Layout_layout_editor_absoluteY, 50); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintGuide_begin, 5); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintGuide_end, 6); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintGuide_percent, 7); map.append(R.styleable.ConstraintLayout_Layout_android_orientation, 1); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintStart_toEndOf, 17); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintStart_toStartOf, 18); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintEnd_toStartOf, 19); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintEnd_toEndOf, 20); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginLeft, 21); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginTop, 22); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginRight, 23); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginBottom, 24); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginStart, 25); map.append(R.styleable.ConstraintLayout_Layout_layout_goneMarginEnd, 26); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHorizontal_bias, 29); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintVertical_bias, 30); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintDimensionRatio, 44); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHorizontal_weight, 45); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintVertical_weight, 46); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHorizontal_chainStyle, 47); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintVertical_chainStyle, 48); map.append(R.styleable.ConstraintLayout_Layout_layout_constrainedWidth, 27); map.append(R.styleable.ConstraintLayout_Layout_layout_constrainedHeight, 28); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_default, 31); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_default, 32); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_min, 33); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_max, 34); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintWidth_percent, 35); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_min, 36); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_max, 37); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintHeight_percent, 38); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintLeft_creator, 39); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintTop_creator, 40); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintRight_creator, 41); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBottom_creator, 42); map.append(R.styleable.ConstraintLayout_Layout_layout_constraintBaseline_creator, 43); } } public LayoutParams(Context context, AttributeSet attributeSet) { super(context, attributeSet); int i; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ConstraintLayout_Layout); int indexCount = obtainStyledAttributes.getIndexCount(); for (int i2 = 0; i2 < indexCount; i2++) { int index = obtainStyledAttributes.getIndex(i2); int i3 = Table.map.get(index); switch (i3) { case 1: this.orientation = obtainStyledAttributes.getInt(index, this.orientation); break; case 2: int resourceId = obtainStyledAttributes.getResourceId(index, this.circleConstraint); this.circleConstraint = resourceId; if (resourceId != -1) { break; } else { this.circleConstraint = obtainStyledAttributes.getInt(index, -1); break; } case 3: this.circleRadius = obtainStyledAttributes.getDimensionPixelSize(index, this.circleRadius); break; case 4: float f = obtainStyledAttributes.getFloat(index, this.circleAngle) % 360.0f; this.circleAngle = f; if (f >= 0.0f) { break; } else { this.circleAngle = (360.0f - f) % 360.0f; break; } case 5: this.guideBegin = obtainStyledAttributes.getDimensionPixelOffset(index, this.guideBegin); break; case 6: this.guideEnd = obtainStyledAttributes.getDimensionPixelOffset(index, this.guideEnd); break; case 7: this.guidePercent = obtainStyledAttributes.getFloat(index, this.guidePercent); break; case 8: int resourceId2 = obtainStyledAttributes.getResourceId(index, this.leftToLeft); this.leftToLeft = resourceId2; if (resourceId2 != -1) { break; } else { this.leftToLeft = obtainStyledAttributes.getInt(index, -1); break; } case 9: int resourceId3 = obtainStyledAttributes.getResourceId(index, this.leftToRight); this.leftToRight = resourceId3; if (resourceId3 != -1) { break; } else { this.leftToRight = obtainStyledAttributes.getInt(index, -1); break; } case 10: int resourceId4 = obtainStyledAttributes.getResourceId(index, this.rightToLeft); this.rightToLeft = resourceId4; if (resourceId4 != -1) { break; } else { this.rightToLeft = obtainStyledAttributes.getInt(index, -1); break; } case 11: int resourceId5 = obtainStyledAttributes.getResourceId(index, this.rightToRight); this.rightToRight = resourceId5; if (resourceId5 != -1) { break; } else { this.rightToRight = obtainStyledAttributes.getInt(index, -1); break; } case 12: int resourceId6 = obtainStyledAttributes.getResourceId(index, this.topToTop); this.topToTop = resourceId6; if (resourceId6 != -1) { break; } else { this.topToTop = obtainStyledAttributes.getInt(index, -1); break; } case 13: int resourceId7 = obtainStyledAttributes.getResourceId(index, this.topToBottom); this.topToBottom = resourceId7; if (resourceId7 != -1) { break; } else { this.topToBottom = obtainStyledAttributes.getInt(index, -1); break; } case 14: int resourceId8 = obtainStyledAttributes.getResourceId(index, this.bottomToTop); this.bottomToTop = resourceId8; if (resourceId8 != -1) { break; } else { this.bottomToTop = obtainStyledAttributes.getInt(index, -1); break; } case 15: int resourceId9 = obtainStyledAttributes.getResourceId(index, this.bottomToBottom); this.bottomToBottom = resourceId9; if (resourceId9 != -1) { break; } else { this.bottomToBottom = obtainStyledAttributes.getInt(index, -1); break; } case 16: int resourceId10 = obtainStyledAttributes.getResourceId(index, this.baselineToBaseline); this.baselineToBaseline = resourceId10; if (resourceId10 != -1) { break; } else { this.baselineToBaseline = obtainStyledAttributes.getInt(index, -1); break; } case 17: int resourceId11 = obtainStyledAttributes.getResourceId(index, this.startToEnd); this.startToEnd = resourceId11; if (resourceId11 != -1) { break; } else { this.startToEnd = obtainStyledAttributes.getInt(index, -1); break; } case 18: int resourceId12 = obtainStyledAttributes.getResourceId(index, this.startToStart); this.startToStart = resourceId12; if (resourceId12 != -1) { break; } else { this.startToStart = obtainStyledAttributes.getInt(index, -1); break; } case 19: int resourceId13 = obtainStyledAttributes.getResourceId(index, this.endToStart); this.endToStart = resourceId13; if (resourceId13 != -1) { break; } else { this.endToStart = obtainStyledAttributes.getInt(index, -1); break; } case 20: int resourceId14 = obtainStyledAttributes.getResourceId(index, this.endToEnd); this.endToEnd = resourceId14; if (resourceId14 != -1) { break; } else { this.endToEnd = obtainStyledAttributes.getInt(index, -1); break; } case 21: this.goneLeftMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneLeftMargin); break; case 22: this.goneTopMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneTopMargin); break; case 23: this.goneRightMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneRightMargin); break; case 24: this.goneBottomMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneBottomMargin); break; case 25: this.goneStartMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneStartMargin); break; case 26: this.goneEndMargin = obtainStyledAttributes.getDimensionPixelSize(index, this.goneEndMargin); break; case 27: this.constrainedWidth = obtainStyledAttributes.getBoolean(index, this.constrainedWidth); break; case 28: this.constrainedHeight = obtainStyledAttributes.getBoolean(index, this.constrainedHeight); break; case 29: this.horizontalBias = obtainStyledAttributes.getFloat(index, this.horizontalBias); break; case 30: this.verticalBias = obtainStyledAttributes.getFloat(index, this.verticalBias); break; case 31: int i4 = obtainStyledAttributes.getInt(index, 0); this.matchConstraintDefaultWidth = i4; if (i4 != 1) { break; } else { Log.e("ConstraintLayout", "layout_constraintWidth_default=\"wrap\" is deprecated.\nUse layout_width=\"WRAP_CONTENT\" and layout_constrainedWidth=\"true\" instead."); break; } case 32: int i5 = obtainStyledAttributes.getInt(index, 0); this.matchConstraintDefaultHeight = i5; if (i5 != 1) { break; } else { Log.e("ConstraintLayout", "layout_constraintHeight_default=\"wrap\" is deprecated.\nUse layout_height=\"WRAP_CONTENT\" and layout_constrainedHeight=\"true\" instead."); break; } case 33: try { this.matchConstraintMinWidth = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMinWidth); break; } catch (Exception unused) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMinWidth) != -2) { break; } else { this.matchConstraintMinWidth = -2; break; } } case 34: try { this.matchConstraintMaxWidth = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMaxWidth); break; } catch (Exception unused2) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMaxWidth) != -2) { break; } else { this.matchConstraintMaxWidth = -2; break; } } case 35: this.matchConstraintPercentWidth = Math.max(0.0f, obtainStyledAttributes.getFloat(index, this.matchConstraintPercentWidth)); break; case 36: try { this.matchConstraintMinHeight = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMinHeight); break; } catch (Exception unused3) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMinHeight) != -2) { break; } else { this.matchConstraintMinHeight = -2; break; } } case 37: try { this.matchConstraintMaxHeight = obtainStyledAttributes.getDimensionPixelSize(index, this.matchConstraintMaxHeight); break; } catch (Exception unused4) { if (obtainStyledAttributes.getInt(index, this.matchConstraintMaxHeight) != -2) { break; } else { this.matchConstraintMaxHeight = -2; break; } } case 38: this.matchConstraintPercentHeight = Math.max(0.0f, obtainStyledAttributes.getFloat(index, this.matchConstraintPercentHeight)); break; default: switch (i3) { case 44: String string = obtainStyledAttributes.getString(index); this.dimensionRatio = string; this.dimensionRatioValue = Float.NaN; this.dimensionRatioSide = -1; if (string == null) { break; } else { int length = string.length(); int indexOf = this.dimensionRatio.indexOf(44); if (indexOf <= 0 || indexOf >= length - 1) { i = 0; } else { String substring = this.dimensionRatio.substring(0, indexOf); if (substring.equalsIgnoreCase("W")) { this.dimensionRatioSide = 0; } else if (substring.equalsIgnoreCase("H")) { this.dimensionRatioSide = 1; } i = indexOf + 1; } int indexOf2 = this.dimensionRatio.indexOf(58); if (indexOf2 >= 0 && indexOf2 < length - 1) { String substring2 = this.dimensionRatio.substring(i, indexOf2); String substring3 = this.dimensionRatio.substring(indexOf2 + 1); if (substring2.length() > 0 && substring3.length() > 0) { try { float parseFloat = Float.parseFloat(substring2); float parseFloat2 = Float.parseFloat(substring3); if (parseFloat > 0.0f && parseFloat2 > 0.0f) { if (this.dimensionRatioSide != 1) { this.dimensionRatioValue = Math.abs(parseFloat / parseFloat2); break; } else { this.dimensionRatioValue = Math.abs(parseFloat2 / parseFloat); break; } } } catch (NumberFormatException unused5) { break; } } } else { String substring4 = this.dimensionRatio.substring(i); if (substring4.length() <= 0) { break; } else { this.dimensionRatioValue = Float.parseFloat(substring4); break; } } } break; case 45: this.horizontalWeight = obtainStyledAttributes.getFloat(index, this.horizontalWeight); break; case 46: this.verticalWeight = obtainStyledAttributes.getFloat(index, this.verticalWeight); break; case 47: this.horizontalChainStyle = obtainStyledAttributes.getInt(index, 0); break; case 48: this.verticalChainStyle = obtainStyledAttributes.getInt(index, 0); break; case 49: this.editorAbsoluteX = obtainStyledAttributes.getDimensionPixelOffset(index, this.editorAbsoluteX); break; case 50: this.editorAbsoluteY = obtainStyledAttributes.getDimensionPixelOffset(index, this.editorAbsoluteY); break; } } } obtainStyledAttributes.recycle(); validate(); } public void validate() { this.isGuideline = false; this.horizontalDimensionFixed = true; this.verticalDimensionFixed = true; if (this.width == -2 && this.constrainedWidth) { this.horizontalDimensionFixed = false; this.matchConstraintDefaultWidth = 1; } if (this.height == -2 && this.constrainedHeight) { this.verticalDimensionFixed = false; this.matchConstraintDefaultHeight = 1; } if (this.width == 0 || this.width == -1) { this.horizontalDimensionFixed = false; if (this.width == 0 && this.matchConstraintDefaultWidth == 1) { this.width = -2; this.constrainedWidth = true; } } if (this.height == 0 || this.height == -1) { this.verticalDimensionFixed = false; if (this.height == 0 && this.matchConstraintDefaultHeight == 1) { this.height = -2; this.constrainedHeight = true; } } if (this.guidePercent != -1.0f || this.guideBegin != -1 || this.guideEnd != -1) { this.isGuideline = true; this.horizontalDimensionFixed = true; this.verticalDimensionFixed = true; if (!(this.widget instanceof Guideline)) { this.widget = new Guideline(); } ((Guideline) this.widget).setOrientation(this.orientation); } } public LayoutParams(int i, int i2) { super(i, i2); } public LayoutParams(ViewGroup.LayoutParams layoutParams) { super(layoutParams); } /* JADX WARNING: Removed duplicated region for block: B:14:0x004c */ /* JADX WARNING: Removed duplicated region for block: B:17:0x0053 */ /* JADX WARNING: Removed duplicated region for block: B:20:0x005a */ /* JADX WARNING: Removed duplicated region for block: B:23:0x0060 */ /* JADX WARNING: Removed duplicated region for block: B:26:0x0066 */ /* JADX WARNING: Removed duplicated region for block: B:33:0x007c */ /* JADX WARNING: Removed duplicated region for block: B:34:0x0084 */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void resolveLayoutDirection(int r7) { /* r6 = this; int r0 = r6.leftMargin int r1 = r6.rightMargin super.resolveLayoutDirection(r7) r7 = -1 r6.resolvedRightToLeft = r7 r6.resolvedRightToRight = r7 r6.resolvedLeftToLeft = r7 r6.resolvedLeftToRight = r7 r6.resolveGoneLeftMargin = r7 r6.resolveGoneRightMargin = r7 int r2 = r6.goneLeftMargin r6.resolveGoneLeftMargin = r2 int r2 = r6.goneRightMargin r6.resolveGoneRightMargin = r2 float r2 = r6.horizontalBias r6.resolvedHorizontalBias = r2 int r2 = r6.guideBegin r6.resolvedGuideBegin = r2 int r2 = r6.guideEnd r6.resolvedGuideEnd = r2 float r2 = r6.guidePercent r6.resolvedGuidePercent = r2 int r2 = r6.getLayoutDirection() r3 = 0 r4 = 1 if (r4 != r2) goto L_0x0036 r2 = 1 goto L_0x0037 L_0x0036: r2 = 0 L_0x0037: if (r2 == 0) goto L_0x009a int r2 = r6.startToEnd if (r2 == r7) goto L_0x0041 r6.resolvedRightToLeft = r2 L_0x003f: r3 = 1 goto L_0x0048 L_0x0041: int r2 = r6.startToStart if (r2 == r7) goto L_0x0048 r6.resolvedRightToRight = r2 goto L_0x003f L_0x0048: int r2 = r6.endToStart if (r2 == r7) goto L_0x004f r6.resolvedLeftToRight = r2 r3 = 1 L_0x004f: int r2 = r6.endToEnd if (r2 == r7) goto L_0x0056 r6.resolvedLeftToLeft = r2 r3 = 1 L_0x0056: int r2 = r6.goneStartMargin if (r2 == r7) goto L_0x005c r6.resolveGoneRightMargin = r2 L_0x005c: int r2 = r6.goneEndMargin if (r2 == r7) goto L_0x0062 r6.resolveGoneLeftMargin = r2 L_0x0062: r2 = 1065353216(0x3f800000, float:1.0) if (r3 == 0) goto L_0x006c float r3 = r6.horizontalBias float r3 = r2 - r3 r6.resolvedHorizontalBias = r3 L_0x006c: boolean r3 = r6.isGuideline if (r3 == 0) goto L_0x00be int r3 = r6.orientation if (r3 != r4) goto L_0x00be float r3 = r6.guidePercent r4 = -1082130432(0xffffffffbf800000, float:-1.0) int r5 = (r3 > r4 ? 1 : (r3 == r4 ? 0 : -1)) if (r5 == 0) goto L_0x0084 float r2 = r2 - r3 r6.resolvedGuidePercent = r2 r6.resolvedGuideBegin = r7 r6.resolvedGuideEnd = r7 goto L_0x00be L_0x0084: int r2 = r6.guideBegin if (r2 == r7) goto L_0x008f r6.resolvedGuideEnd = r2 r6.resolvedGuideBegin = r7 r6.resolvedGuidePercent = r4 goto L_0x00be L_0x008f: int r2 = r6.guideEnd if (r2 == r7) goto L_0x00be r6.resolvedGuideBegin = r2 r6.resolvedGuideEnd = r7 r6.resolvedGuidePercent = r4 goto L_0x00be L_0x009a: int r2 = r6.startToEnd if (r2 == r7) goto L_0x00a0 r6.resolvedLeftToRight = r2 L_0x00a0: int r2 = r6.startToStart if (r2 == r7) goto L_0x00a6 r6.resolvedLeftToLeft = r2 L_0x00a6: int r2 = r6.endToStart if (r2 == r7) goto L_0x00ac r6.resolvedRightToLeft = r2 L_0x00ac: int r2 = r6.endToEnd if (r2 == r7) goto L_0x00b2 r6.resolvedRightToRight = r2 L_0x00b2: int r2 = r6.goneStartMargin if (r2 == r7) goto L_0x00b8 r6.resolveGoneLeftMargin = r2 L_0x00b8: int r2 = r6.goneEndMargin if (r2 == r7) goto L_0x00be r6.resolveGoneRightMargin = r2 L_0x00be: int r2 = r6.endToStart if (r2 != r7) goto L_0x0108 int r2 = r6.endToEnd if (r2 != r7) goto L_0x0108 int r2 = r6.startToStart if (r2 != r7) goto L_0x0108 int r2 = r6.startToEnd if (r2 != r7) goto L_0x0108 int r2 = r6.rightToLeft if (r2 == r7) goto L_0x00dd r6.resolvedRightToLeft = r2 int r2 = r6.rightMargin if (r2 > 0) goto L_0x00eb if (r1 <= 0) goto L_0x00eb r6.rightMargin = r1 goto L_0x00eb L_0x00dd: int r2 = r6.rightToRight if (r2 == r7) goto L_0x00eb r6.resolvedRightToRight = r2 int r2 = r6.rightMargin if (r2 > 0) goto L_0x00eb if (r1 <= 0) goto L_0x00eb r6.rightMargin = r1 L_0x00eb: int r1 = r6.leftToLeft if (r1 == r7) goto L_0x00fa r6.resolvedLeftToLeft = r1 int r7 = r6.leftMargin if (r7 > 0) goto L_0x0108 if (r0 <= 0) goto L_0x0108 r6.leftMargin = r0 goto L_0x0108 L_0x00fa: int r1 = r6.leftToRight if (r1 == r7) goto L_0x0108 r6.resolvedLeftToRight = r1 int r7 = r6.leftMargin if (r7 > 0) goto L_0x0108 if (r0 <= 0) goto L_0x0108 r6.leftMargin = r0 L_0x0108: return */ throw new UnsupportedOperationException("Method not decompiled: androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.resolveLayoutDirection(int):void"); } } public void requestLayout() { super.requestLayout(); this.mDirtyHierarchy = true; this.mLastMeasureWidth = -1; this.mLastMeasureHeight = -1; this.mLastMeasureWidthSize = -1; this.mLastMeasureHeightSize = -1; this.mLastMeasureWidthMode = 0; this.mLastMeasureHeightMode = 0; } }
112,432
0.531895
0.484515
2,400
45.846668
34.586906
643
false
false
0
0
0
0
0
0
0.490417
false
false
8
04cebec6294d5c0b4cbf7ebc6909dd9da96e0ecd
20,143,396,642,054
65d38753992642653b07233b4d20bc6489d76475
/app/src/main/java/com/stockboo/network/StockBooRequestQueue.java
c35214a6a870ffc73c8793ef8291eb7556fa2276
[]
no_license
prasadsn/StockBoo
https://github.com/prasadsn/StockBoo
d56573a37412b9c397751c2673196061ee2bbe1e
b2d16a0ef6f8f4db4a41ca73a0322e0e2c967e44
refs/heads/master
2021-01-18T21:24:58.108000
2016-05-24T12:52:23
2016-05-24T12:52:23
42,467,772
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stockboo.network; import android.content.Context; import android.graphics.Bitmap; import android.util.LruCache; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.Volley; /** * Created by prasad on 16-05-2015. */ public class StockBooRequestQueue { private RequestQueue mRequestQueue; private ImageLoader mImageLoader; private static StockBooRequestQueue instance; private StockBooRequestQueue (Context context) { mRequestQueue = Volley.newRequestQueue(context); mImageLoader = new ImageLoader(this.mRequestQueue, new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> mCache = new LruCache<String, Bitmap>(10); public void putBitmap(String url, Bitmap bitmap) { mCache.put(url, bitmap); } public Bitmap getBitmap(String url) { return mCache.get(url); } }); } public static StockBooRequestQueue getInstance(Context context){ if(instance == null) instance = new StockBooRequestQueue(context); return instance; } public ImageLoader getImageLoader(){ return mImageLoader; } public RequestQueue getRequestQueue(){ return mRequestQueue; } public void cancelRequests(){ if (mRequestQueue != null) { mRequestQueue.cancelAll(new RequestQueue.RequestFilter() { @Override public boolean apply(Request<?> request) { return true; } }); } } }
UTF-8
Java
1,695
java
StockBooRequestQueue.java
Java
[ { "context": ".android.volley.toolbox.Volley;\n\n/**\n * Created by prasad on 16-05-2015.\n */\npublic class StockBooRequestQu", "end": 315, "score": 0.9970232844352722, "start": 309, "tag": "USERNAME", "value": "prasad" } ]
null
[]
package com.stockboo.network; import android.content.Context; import android.graphics.Bitmap; import android.util.LruCache; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.Volley; /** * Created by prasad on 16-05-2015. */ public class StockBooRequestQueue { private RequestQueue mRequestQueue; private ImageLoader mImageLoader; private static StockBooRequestQueue instance; private StockBooRequestQueue (Context context) { mRequestQueue = Volley.newRequestQueue(context); mImageLoader = new ImageLoader(this.mRequestQueue, new ImageLoader.ImageCache() { private final LruCache<String, Bitmap> mCache = new LruCache<String, Bitmap>(10); public void putBitmap(String url, Bitmap bitmap) { mCache.put(url, bitmap); } public Bitmap getBitmap(String url) { return mCache.get(url); } }); } public static StockBooRequestQueue getInstance(Context context){ if(instance == null) instance = new StockBooRequestQueue(context); return instance; } public ImageLoader getImageLoader(){ return mImageLoader; } public RequestQueue getRequestQueue(){ return mRequestQueue; } public void cancelRequests(){ if (mRequestQueue != null) { mRequestQueue.cancelAll(new RequestQueue.RequestFilter() { @Override public boolean apply(Request<?> request) { return true; } }); } } }
1,695
0.640708
0.634808
60
27.25
23.366375
93
false
false
0
0
0
0
0
0
0.45
false
false
8
356dea8daadeeaec58ec8efe546390b865ea13f1
15,513,421,889,877
da55081894d0204ea68dbf029f6f6e9b6305fee9
/src/game/Game.java
d9f9bb034d1fe7a96b231557cddf125b3a86f580
[]
no_license
marcinszcz/java-game-rts
https://github.com/marcinszcz/java-game-rts
f1adf356b3243418dd895398bc460785b5345bc1
e6f9a5c92800626ae9141cacc5a34c46be0dd34d
refs/heads/master
2021-01-19T06:38:48.737000
2016-06-02T19:08:10
2016-06-02T19:08:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package game; /** * Created by marcin on 07.05.16. */ import game.objects.*; import graphic.*; import gui.*; import network.*; import io.InputAction; import io.InputManager; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.geom.AffineTransform; import java.util.Iterator; import java.util.LinkedList; public class Game extends Kernel { public game.Map map; public MainMenu mainMenu; public GameMenu gameMenu; public NetworkMenu networkMenu; public NetworkClientMenu networkClientMenu; public NetworkServerMenu networkServerMenu; public NetworkJoinMenu networkJoinMenu; public OptionsMenu optionsMenu; public Resources resources; public Player player; public Player opponent; public Player player1; public Player player2; public Client client; public Server server; public boolean isServer; private String nick; private LinkedList<Sprite> booms; private static final long BOOM_TIME = 1100; public InputManager inputManager; private InputAction pauseAction; private InputAction shiftLeftAction; private InputAction shiftRightAction; private InputAction shiftUpAction; private InputAction shiftDownAction; private InputAction leftButtonAction; private InputAction rightButtonAction; private boolean isStarting; private boolean isReady; private boolean isRunning; private boolean isPause; public long time = 0; public boolean canExit; public boolean canBegin = false; private boolean sendDead; public static void main(String[] args) { new Game().run(); } public void init() { super.init(); // sprawdz czy komponenty Swing nie odrysują się samodzielnie. NullRepaintManager.install(); resources = new Resources(screen.getWindow().getGraphicsConfiguration()); gameMenu = new GameMenu(this); mainMenu = new MainMenu(this); networkMenu = new NetworkMenu(this); networkClientMenu = new NetworkClientMenu(this); networkServerMenu = new NetworkServerMenu(this); networkJoinMenu = new NetworkJoinMenu(this); optionsMenu = new OptionsMenu(this); booms = new LinkedList<Sprite>(); inputManager = new InputManager(screen.getWindow()); createInputActions(); player1 = new Player(this); player2 = new Player(this); client = null; server = null; isServer = false; isStarting = false; isRunning = false; isPause = false; screen.show(); mainMenu.show(); } public boolean isRunning() { return isRunning; } public boolean isPause() { return isPause; } // tworzy obiekty inputAction i przypisuje je klawiszy public void createInputActions() { pauseAction = new InputAction("pause", InputAction.DETECT_INITAL_PRESS_ONLY); inputManager.mapToKey(pauseAction, KeyEvent.VK_ESCAPE); shiftLeftAction = new InputAction("shiftleft"); inputManager.mapToKey(shiftLeftAction, KeyEvent.VK_LEFT); shiftRightAction = new InputAction("shiftright"); inputManager.mapToKey(shiftRightAction, KeyEvent.VK_RIGHT); shiftUpAction = new InputAction("shiftup"); inputManager.mapToKey(shiftUpAction, KeyEvent.VK_UP); shiftDownAction = new InputAction("shiftdown"); inputManager.mapToKey(shiftDownAction, KeyEvent.VK_DOWN); leftButtonAction = new InputAction("leftbutton"); inputManager.mapToMouse(leftButtonAction, InputManager.MOUSE_BUTTON_1); rightButtonAction = new InputAction("rightbutton", InputAction.DETECT_INITAL_PRESS_ONLY); inputManager.mapToMouse(rightButtonAction, InputManager.MOUSE_BUTTON_3); } // sprawdza stan obiektow z up public void checkInputs(long elapsedTime) { if (pauseAction.isPressed()) { pause(); inputManager.resetAllInputActions(); } if (!isPause()) { if (shiftLeftAction.isPressed()) { map.shiftLeft(elapsedTime, screen.getWidth()); } if (shiftRightAction.isPressed()) { map.shiftRight(elapsedTime, screen.getWidth()); } if (shiftUpAction.isPressed()) { map.shiftUp(elapsedTime, screen.getHeight()); } if (shiftDownAction.isPressed()) { map.shiftDown(elapsedTime, screen.getHeight()); } if (screen.isFullScreen()) if (!shiftLeftAction.isPressed() && !shiftRightAction.isPressed() && !shiftUpAction.isPressed() && !shiftDownAction.isPressed()) { Insets insets = screen.getWindow().getInsets(); if (inputManager.getMouseX() <= insets.left + 10 && inputManager.getMouseX() >= 0) { map.shiftLeft(elapsedTime, screen.getWidth()); } if (inputManager.getMouseX() >= screen.getWidth() - insets.right - 11 && inputManager.getMouseX() < screen.getWidth()) { map.shiftRight(elapsedTime, screen.getWidth()); } if (inputManager.getMouseY() <= insets.top + 10 && inputManager.getMouseY() >= 0) { map.shiftUp(elapsedTime, screen.getHeight()); } if (inputManager.getMouseY() >= screen.getHeight() - insets.bottom - 11 && inputManager.getMouseY() < screen.getHeight()) { map.shiftDown(elapsedTime, screen.getHeight()); } } if (leftButtonAction.isPressed()) { if (!player.isSelectionVisable()) { player.startSelection(); player.setSelectionBegin(inputManager.getMouseX() - map.getOffsetX(screen.getWidth()), inputManager .getMouseY() - map.getOffsetY(screen.getHeight())); } player.setSelectionEnd(inputManager.getMouseX() - map.getOffsetX(screen.getWidth()), inputManager .getMouseY() - map.getOffsetY(screen.getHeight())); } else if (player.isSelectionVisable()) { player.setSelectionEnd(inputManager.getMouseX() - map.getOffsetX(screen.getWidth()), inputManager .getMouseY() - map.getOffsetY(screen.getHeight())); player.stopSelection(); } if (rightButtonAction.isPressed()) { if (!player.getSelectedUnits().isEmpty()) { Iterator i = player.getSelectedUnits().iterator(); while (i.hasNext()) { Unit unit = (Unit) i.next(); int x = Map.pixelsToTiles(inputManager.getMouseX() - map.getOffsetX(screen.getWidth())); int y = Map.pixelsToTiles(inputManager.getMouseY() - map.getOffsetY(screen.getHeight())); if (map.isFree(x, y)) { unit.goTo(x, y); } else { Unit u = getUnit(x, y); if (u != null) { if (!u.isPlayerUnit()) { unit.beginAttack(u); } else { unit.goTo(x, y); } } } } } } } } // konczenie gry public void stop() { isRunning = false; } public Unit getUnit(int x, int y) { for (int j = 0; j < 2; j++) { Iterator i; if (j == 0) { i = player.getUnits(); } else { i = opponent.getUnits(); } while (i.hasNext()) { Unit unit = (Unit) i.next(); if (unit.getX() == x && unit.getY() == y) { return unit; } } } return null; } public void setPlayer(int i, String nick) { this.nick = nick; if (i == 1) { player = player1; opponent = player2; player.setPlayerNo(1); opponent.setPlayerNo(2); } else { player = player2; opponent = player1; player.setPlayerNo(2); opponent.setPlayerNo(1); } } public void ready() { GameEvent ge = new GameEvent(GameEvent.C_READY); ge.setPlayerId(nick); client.sendMessage(ge); } public void start() { new Thread() { public void run() { sendDead = false; isStarting = true; map = resources.loadMap("test", screen.getWidth(), screen .getHeight()); player.setUnits(resources.loadUnits("test", player, true)); opponent.setUnits(resources.loadUnits("test", opponent, false)); map.setFree(player.getUnits()); map.setFree(opponent.getUnits()); ready(); } }.start(); } public void pause() { isPause = !isPause; if (isPause) { gameMenu.show(); } else { gameMenu.hide(); } } public void update(long elapsedTime) { if (isRunning()) { checkInputs(elapsedTime); checkMessages(); Iterator<Unit> i; if (!player.isAlive() && !sendDead) { GameEvent ge = new GameEvent(GameEvent.C_PLAYER_DEAD, Integer .toString(player.getPlayerNo())); client.sendMessage(ge); sendDead = true; } i = player.getUnits(); while (i.hasNext()) { Unit unit = i.next(); unit.update(elapsedTime, map); } i = opponent.getUnits(); while (i.hasNext()) { Unit unit = i.next(); unit.update(elapsedTime, map); } Iterator<Sprite> i2; i2 = booms.iterator(); while (i2.hasNext()) { Sprite sprite = i2.next(); if (sprite.getAnimationTime() >= BOOM_TIME) { i2.remove(); } else { sprite.update(elapsedTime); } } time += elapsedTime; if (isPause()) { if (gameMenu.isVisible()) { gameMenu.update(elapsedTime); } else if (optionsMenu.isVisible()) { optionsMenu.update(elapsedTime); } } } else { if (mainMenu.isVisible()) { mainMenu.update(elapsedTime); } else if (networkMenu.isVisible()) { networkMenu.update(elapsedTime); } else if (networkClientMenu.isVisible()) { networkClientMenu.update(elapsedTime); } else if (networkServerMenu.isVisible()) { networkServerMenu.update(elapsedTime); } else if (networkJoinMenu.isVisible()) { networkJoinMenu.update(elapsedTime); } else if (optionsMenu.isVisible()) { optionsMenu.update(elapsedTime); } else if (isStarting) { checkMessages(); if (isReady) { isStarting = false; time = 0; isPause = false; isRunning = true; } } } } public void checkMessages() { // odbieramy komunikaty i obsługujemy je if (!client.isAlive()) { // niedobrze w sumie to problem return; } GameEvent ge; while ((ge = client.receiveMessage()) != null) { switch (ge.getType()) { case GameEvent.SB_ALL_READY: isReady = true; break; case GameEvent.SB_MOVE: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); int idx2 = x.indexOf('|', idx1 + 1); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1, idx2); String c = x.substring(idx2 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); int goingTo = Integer.parseInt(c); Unit unit; if (playerNo == 1) { unit = player1.getUnit(unitNo); } else { unit = player2.getUnit(unitNo); } if (unit != null) { unit.goTo(goingTo); } } catch (NumberFormatException ex) { } break; } case GameEvent.S_MOVE_FAIL: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); Unit unit; if (playerNo == 1) { unit = player1.getUnit(unitNo); } else { unit = player2.getUnit(unitNo); } if (unit != null) { unit.failGoTo(); } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_ATTACK: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); int idx2 = x.indexOf('|', idx1 + 1); int idx3 = x.indexOf('|', idx2 + 1); int idx4 = x.indexOf('|', idx3 + 1); int idx5 = x.indexOf('|', idx4 + 1); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1, idx2); String c = x.substring(idx2 + 1, idx3); String d = x.substring(idx3 + 1, idx4); String e = x.substring(idx4 + 1, idx5); String f = x.substring(idx5 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); int firePower = Integer.parseInt(c); int X = Integer.parseInt(d); int Y = Integer.parseInt(e); int attackingUnitNo = Integer.parseInt(f); Player p, o; if (playerNo == 1) { p = player1; o = player2; } else { p = player2; o = player1; } Unit unit = p.getUnit(unitNo); Unit attackingUnit = o.getUnit(attackingUnitNo); if (unit != null && attackingUnit != null) { if (unit.isPlayerUnit()) { unit.attack(X, Y, firePower, attackingUnitNo); } attackingUnit.rotateTo(X, Y); } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_HIT: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); int idx2 = x.indexOf('|', idx1 + 1); int idx3 = x.indexOf('|', idx2 + 1); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1, idx2); String c = x.substring(idx2 + 1, idx3); String d = x.substring(idx3 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); int firePower = Integer.parseInt(c); int attackingUnitNo = Integer.parseInt(d); Unit unit; Unit attackingUnit; if (playerNo == 1) { unit = player1.getUnit(unitNo); attackingUnit = player2.getUnit(attackingUnitNo); } else { unit = player2.getUnit(unitNo); attackingUnit = player1.getUnit(attackingUnitNo); } if (unit != null && attackingUnit != null) { unit.hit(firePower); Animation boom = (Animation) resources .getBoomAnimation().clone(); boom.start(); Sprite sprite = new Sprite(boom); sprite.setX(unit.getX()); sprite.setY(unit.getY()); int p = Map.TILE_SIZE >> 1; if (attackingUnit.getX() > unit.getX()) { sprite.setDisplacementX(p); } else if (attackingUnit.getX() < unit.getX()) { sprite.setDisplacementX(-p); } if (attackingUnit.getY() > unit.getY()) { sprite.setDisplacementY(p); } else if (attackingUnit.getY() < unit.getY()) { sprite.setDisplacementY(-p); } booms.add(sprite); } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_DEAD: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); boolean updateSelected = false; Iterator i; if (playerNo == 1) { i = player1.getUnits(); } else { i = player2.getUnits(); } while (i.hasNext()) { Unit unit = (Unit) i.next(); if (unit.getNo() == unitNo) { if (unit.isSelected()) { updateSelected = true; } unit.relaseLand(map); i.remove(); } } if (updateSelected) { i = player.getSelectedUnits().iterator(); Unit unit = (Unit) i.next(); if (unit.getNo() == unitNo) { i.remove(); } } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_GAME_OVER: { isRunning = false; networkJoinMenu.showGameOver(ge.getMessage()); break; } default: System.out.println("Nieznany komunikat: #" + ge.getType() + "\n"); break; } } } public void draw(Graphics2D g) { if (isRunning()) { /* * g.setBackground(Color.BLACK); g.setColor(Color.BLACK); * g.fillRect(0,0,game.screen.getWidth(), game.screen.getHeight()); */ map.drawMap(g, screen.getWidth(), screen.getHeight(), this); // /ble int p = Map.TILE_SIZE >> 1; int q = p >> 1; int r = q >> 1; int s = p / 5; // rysowanie obiektów for (int j = 0; j < 2; j++) { Iterator i; if (j == 0) { i = player.getUnits(); } else { i = opponent.getUnits(); } while (i.hasNext()) { Unit unit = (Unit) i.next(); int x = Map.tilesToPixels(unit.getX()) + Math.round(unit.getDisplacementX()) + map.getOffsetX(screen.getWidth()); int y = Map.tilesToPixels(unit.getY()) + Math.round(unit.getDisplacementY()) + map.getOffsetY(screen.getHeight()); // zakomentowane obracanie, bo wygląda nienaturalnie AffineTransform transform = new AffineTransform(); transform.translate(x + p + 1, y + p + 1); // transform.rotate(unit.getRotate() * Math.PI / 4); transform.translate(/* 1 */-p,/* 1 */-p); g.drawImage(unit.getImage(), transform, null); if (unit.isSelected()) { g.setColor(new Color(120, 136, 152)); g.setStroke(new BasicStroke(1.25F)); g.drawOval(x/* +1 */, y/* +1 */, Map.TILE_SIZE, Map.TILE_SIZE); } if (!unit.isPlayerUnit()) { g.setColor(new Color(200, 77, 50)); g.setBackground(new Color(200, 77, 50)); } else { g.setColor(new Color(47, 160, 40)); g.setBackground(new Color(47, 160, 40)); } { g.setStroke(new BasicStroke(0.0F)); g.fillRect(x + r, y + s, Math.round((p + q) * unit.getLifeProportion()), s); g.setColor(new Color(75, 75, 75)); g.setStroke(new BasicStroke(1.0F)); g.drawRect(x + r, y + s, p + q, s); } } } Iterator<Sprite> i = booms.iterator(); while (i.hasNext()) { Sprite sprite = i.next(); int x = Map.tilesToPixels(sprite.getX()) + Math.round(sprite.getDisplacementX()) + map.getOffsetX(screen.getWidth()); int y = Map.tilesToPixels(sprite.getY()) + Math.round(sprite.getDisplacementY()) + map.getOffsetY(screen.getHeight()); g.drawImage(sprite.getImage(), x, y, null); } // rysowanie mg�y wojny map.drawFoog(g, screen.getWidth(), screen.getHeight()); // rysowanie zaznaczenia if (player.isSelectionVisable()) { g.setColor(new Color(120, 136, 152)); g.setStroke(new BasicStroke(1.2F)); g.drawRect(player.getSelectionBeginX() + map.getOffsetX(screen.getWidth()), player .getSelectionBeginY() + map.getOffsetY(screen.getHeight()), player .getSelectionEndX() - player.getSelectionBeginX(), player .getSelectionEndY() - player.getSelectionBeginY()); } g.setColor(Color.WHITE); long time = this.time / 1000; long m = time % 60; long h = time / 60; String timeStr = (h < 10) ? "0" + h + ":" : h + ":"; timeStr += (m < 10) ? "0" + m : Long.toString(m); g.drawString("Czas: " + timeStr, 25, 35); /* * DisplayMode displayMode = game.screen.getCurrentDisplayMode(); * g.drawString("Rozdzielczo��: " + displayMode.getWidth() + "x" + * displayMode.getHeight() + "x" + displayMode.getBitDepth(),25,50); */ if (isPause()) { if (gameMenu.isVisible()) { gameMenu.draw(g); } else if (optionsMenu.isVisible()) { optionsMenu.draw(g); } } } else { if (mainMenu.isVisible()) { mainMenu.draw(g); } else if (networkMenu.isVisible()) { networkMenu.draw(g); } else if (networkClientMenu.isVisible()) { networkClientMenu.draw(g); } else if (networkServerMenu.isVisible()) { networkServerMenu.draw(g); } else if (networkJoinMenu.isVisible()) { networkJoinMenu.draw(g); } else if (optionsMenu.isVisible()) { optionsMenu.draw(g); } else if (isStarting) { g.setBackground(Color.BLACK); g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.WHITE); g.drawString("Ładowanie...", 20, getHeight() - 20); } try { Thread.sleep(50); } catch (InterruptedException ex) { ex.printStackTrace(); } } } }
UTF-8
Java
27,039
java
Game.java
Java
[ { "context": "package game;\n\n/**\n * Created by marcin on 07.05.16.\n */\n\nimport game.objects.*;\nimport g", "end": 39, "score": 0.9901192784309387, "start": 33, "tag": "NAME", "value": "marcin" } ]
null
[]
package game; /** * Created by marcin on 07.05.16. */ import game.objects.*; import graphic.*; import gui.*; import network.*; import io.InputAction; import io.InputManager; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.geom.AffineTransform; import java.util.Iterator; import java.util.LinkedList; public class Game extends Kernel { public game.Map map; public MainMenu mainMenu; public GameMenu gameMenu; public NetworkMenu networkMenu; public NetworkClientMenu networkClientMenu; public NetworkServerMenu networkServerMenu; public NetworkJoinMenu networkJoinMenu; public OptionsMenu optionsMenu; public Resources resources; public Player player; public Player opponent; public Player player1; public Player player2; public Client client; public Server server; public boolean isServer; private String nick; private LinkedList<Sprite> booms; private static final long BOOM_TIME = 1100; public InputManager inputManager; private InputAction pauseAction; private InputAction shiftLeftAction; private InputAction shiftRightAction; private InputAction shiftUpAction; private InputAction shiftDownAction; private InputAction leftButtonAction; private InputAction rightButtonAction; private boolean isStarting; private boolean isReady; private boolean isRunning; private boolean isPause; public long time = 0; public boolean canExit; public boolean canBegin = false; private boolean sendDead; public static void main(String[] args) { new Game().run(); } public void init() { super.init(); // sprawdz czy komponenty Swing nie odrysują się samodzielnie. NullRepaintManager.install(); resources = new Resources(screen.getWindow().getGraphicsConfiguration()); gameMenu = new GameMenu(this); mainMenu = new MainMenu(this); networkMenu = new NetworkMenu(this); networkClientMenu = new NetworkClientMenu(this); networkServerMenu = new NetworkServerMenu(this); networkJoinMenu = new NetworkJoinMenu(this); optionsMenu = new OptionsMenu(this); booms = new LinkedList<Sprite>(); inputManager = new InputManager(screen.getWindow()); createInputActions(); player1 = new Player(this); player2 = new Player(this); client = null; server = null; isServer = false; isStarting = false; isRunning = false; isPause = false; screen.show(); mainMenu.show(); } public boolean isRunning() { return isRunning; } public boolean isPause() { return isPause; } // tworzy obiekty inputAction i przypisuje je klawiszy public void createInputActions() { pauseAction = new InputAction("pause", InputAction.DETECT_INITAL_PRESS_ONLY); inputManager.mapToKey(pauseAction, KeyEvent.VK_ESCAPE); shiftLeftAction = new InputAction("shiftleft"); inputManager.mapToKey(shiftLeftAction, KeyEvent.VK_LEFT); shiftRightAction = new InputAction("shiftright"); inputManager.mapToKey(shiftRightAction, KeyEvent.VK_RIGHT); shiftUpAction = new InputAction("shiftup"); inputManager.mapToKey(shiftUpAction, KeyEvent.VK_UP); shiftDownAction = new InputAction("shiftdown"); inputManager.mapToKey(shiftDownAction, KeyEvent.VK_DOWN); leftButtonAction = new InputAction("leftbutton"); inputManager.mapToMouse(leftButtonAction, InputManager.MOUSE_BUTTON_1); rightButtonAction = new InputAction("rightbutton", InputAction.DETECT_INITAL_PRESS_ONLY); inputManager.mapToMouse(rightButtonAction, InputManager.MOUSE_BUTTON_3); } // sprawdza stan obiektow z up public void checkInputs(long elapsedTime) { if (pauseAction.isPressed()) { pause(); inputManager.resetAllInputActions(); } if (!isPause()) { if (shiftLeftAction.isPressed()) { map.shiftLeft(elapsedTime, screen.getWidth()); } if (shiftRightAction.isPressed()) { map.shiftRight(elapsedTime, screen.getWidth()); } if (shiftUpAction.isPressed()) { map.shiftUp(elapsedTime, screen.getHeight()); } if (shiftDownAction.isPressed()) { map.shiftDown(elapsedTime, screen.getHeight()); } if (screen.isFullScreen()) if (!shiftLeftAction.isPressed() && !shiftRightAction.isPressed() && !shiftUpAction.isPressed() && !shiftDownAction.isPressed()) { Insets insets = screen.getWindow().getInsets(); if (inputManager.getMouseX() <= insets.left + 10 && inputManager.getMouseX() >= 0) { map.shiftLeft(elapsedTime, screen.getWidth()); } if (inputManager.getMouseX() >= screen.getWidth() - insets.right - 11 && inputManager.getMouseX() < screen.getWidth()) { map.shiftRight(elapsedTime, screen.getWidth()); } if (inputManager.getMouseY() <= insets.top + 10 && inputManager.getMouseY() >= 0) { map.shiftUp(elapsedTime, screen.getHeight()); } if (inputManager.getMouseY() >= screen.getHeight() - insets.bottom - 11 && inputManager.getMouseY() < screen.getHeight()) { map.shiftDown(elapsedTime, screen.getHeight()); } } if (leftButtonAction.isPressed()) { if (!player.isSelectionVisable()) { player.startSelection(); player.setSelectionBegin(inputManager.getMouseX() - map.getOffsetX(screen.getWidth()), inputManager .getMouseY() - map.getOffsetY(screen.getHeight())); } player.setSelectionEnd(inputManager.getMouseX() - map.getOffsetX(screen.getWidth()), inputManager .getMouseY() - map.getOffsetY(screen.getHeight())); } else if (player.isSelectionVisable()) { player.setSelectionEnd(inputManager.getMouseX() - map.getOffsetX(screen.getWidth()), inputManager .getMouseY() - map.getOffsetY(screen.getHeight())); player.stopSelection(); } if (rightButtonAction.isPressed()) { if (!player.getSelectedUnits().isEmpty()) { Iterator i = player.getSelectedUnits().iterator(); while (i.hasNext()) { Unit unit = (Unit) i.next(); int x = Map.pixelsToTiles(inputManager.getMouseX() - map.getOffsetX(screen.getWidth())); int y = Map.pixelsToTiles(inputManager.getMouseY() - map.getOffsetY(screen.getHeight())); if (map.isFree(x, y)) { unit.goTo(x, y); } else { Unit u = getUnit(x, y); if (u != null) { if (!u.isPlayerUnit()) { unit.beginAttack(u); } else { unit.goTo(x, y); } } } } } } } } // konczenie gry public void stop() { isRunning = false; } public Unit getUnit(int x, int y) { for (int j = 0; j < 2; j++) { Iterator i; if (j == 0) { i = player.getUnits(); } else { i = opponent.getUnits(); } while (i.hasNext()) { Unit unit = (Unit) i.next(); if (unit.getX() == x && unit.getY() == y) { return unit; } } } return null; } public void setPlayer(int i, String nick) { this.nick = nick; if (i == 1) { player = player1; opponent = player2; player.setPlayerNo(1); opponent.setPlayerNo(2); } else { player = player2; opponent = player1; player.setPlayerNo(2); opponent.setPlayerNo(1); } } public void ready() { GameEvent ge = new GameEvent(GameEvent.C_READY); ge.setPlayerId(nick); client.sendMessage(ge); } public void start() { new Thread() { public void run() { sendDead = false; isStarting = true; map = resources.loadMap("test", screen.getWidth(), screen .getHeight()); player.setUnits(resources.loadUnits("test", player, true)); opponent.setUnits(resources.loadUnits("test", opponent, false)); map.setFree(player.getUnits()); map.setFree(opponent.getUnits()); ready(); } }.start(); } public void pause() { isPause = !isPause; if (isPause) { gameMenu.show(); } else { gameMenu.hide(); } } public void update(long elapsedTime) { if (isRunning()) { checkInputs(elapsedTime); checkMessages(); Iterator<Unit> i; if (!player.isAlive() && !sendDead) { GameEvent ge = new GameEvent(GameEvent.C_PLAYER_DEAD, Integer .toString(player.getPlayerNo())); client.sendMessage(ge); sendDead = true; } i = player.getUnits(); while (i.hasNext()) { Unit unit = i.next(); unit.update(elapsedTime, map); } i = opponent.getUnits(); while (i.hasNext()) { Unit unit = i.next(); unit.update(elapsedTime, map); } Iterator<Sprite> i2; i2 = booms.iterator(); while (i2.hasNext()) { Sprite sprite = i2.next(); if (sprite.getAnimationTime() >= BOOM_TIME) { i2.remove(); } else { sprite.update(elapsedTime); } } time += elapsedTime; if (isPause()) { if (gameMenu.isVisible()) { gameMenu.update(elapsedTime); } else if (optionsMenu.isVisible()) { optionsMenu.update(elapsedTime); } } } else { if (mainMenu.isVisible()) { mainMenu.update(elapsedTime); } else if (networkMenu.isVisible()) { networkMenu.update(elapsedTime); } else if (networkClientMenu.isVisible()) { networkClientMenu.update(elapsedTime); } else if (networkServerMenu.isVisible()) { networkServerMenu.update(elapsedTime); } else if (networkJoinMenu.isVisible()) { networkJoinMenu.update(elapsedTime); } else if (optionsMenu.isVisible()) { optionsMenu.update(elapsedTime); } else if (isStarting) { checkMessages(); if (isReady) { isStarting = false; time = 0; isPause = false; isRunning = true; } } } } public void checkMessages() { // odbieramy komunikaty i obsługujemy je if (!client.isAlive()) { // niedobrze w sumie to problem return; } GameEvent ge; while ((ge = client.receiveMessage()) != null) { switch (ge.getType()) { case GameEvent.SB_ALL_READY: isReady = true; break; case GameEvent.SB_MOVE: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); int idx2 = x.indexOf('|', idx1 + 1); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1, idx2); String c = x.substring(idx2 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); int goingTo = Integer.parseInt(c); Unit unit; if (playerNo == 1) { unit = player1.getUnit(unitNo); } else { unit = player2.getUnit(unitNo); } if (unit != null) { unit.goTo(goingTo); } } catch (NumberFormatException ex) { } break; } case GameEvent.S_MOVE_FAIL: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); Unit unit; if (playerNo == 1) { unit = player1.getUnit(unitNo); } else { unit = player2.getUnit(unitNo); } if (unit != null) { unit.failGoTo(); } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_ATTACK: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); int idx2 = x.indexOf('|', idx1 + 1); int idx3 = x.indexOf('|', idx2 + 1); int idx4 = x.indexOf('|', idx3 + 1); int idx5 = x.indexOf('|', idx4 + 1); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1, idx2); String c = x.substring(idx2 + 1, idx3); String d = x.substring(idx3 + 1, idx4); String e = x.substring(idx4 + 1, idx5); String f = x.substring(idx5 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); int firePower = Integer.parseInt(c); int X = Integer.parseInt(d); int Y = Integer.parseInt(e); int attackingUnitNo = Integer.parseInt(f); Player p, o; if (playerNo == 1) { p = player1; o = player2; } else { p = player2; o = player1; } Unit unit = p.getUnit(unitNo); Unit attackingUnit = o.getUnit(attackingUnitNo); if (unit != null && attackingUnit != null) { if (unit.isPlayerUnit()) { unit.attack(X, Y, firePower, attackingUnitNo); } attackingUnit.rotateTo(X, Y); } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_HIT: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); int idx2 = x.indexOf('|', idx1 + 1); int idx3 = x.indexOf('|', idx2 + 1); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1, idx2); String c = x.substring(idx2 + 1, idx3); String d = x.substring(idx3 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); int firePower = Integer.parseInt(c); int attackingUnitNo = Integer.parseInt(d); Unit unit; Unit attackingUnit; if (playerNo == 1) { unit = player1.getUnit(unitNo); attackingUnit = player2.getUnit(attackingUnitNo); } else { unit = player2.getUnit(unitNo); attackingUnit = player1.getUnit(attackingUnitNo); } if (unit != null && attackingUnit != null) { unit.hit(firePower); Animation boom = (Animation) resources .getBoomAnimation().clone(); boom.start(); Sprite sprite = new Sprite(boom); sprite.setX(unit.getX()); sprite.setY(unit.getY()); int p = Map.TILE_SIZE >> 1; if (attackingUnit.getX() > unit.getX()) { sprite.setDisplacementX(p); } else if (attackingUnit.getX() < unit.getX()) { sprite.setDisplacementX(-p); } if (attackingUnit.getY() > unit.getY()) { sprite.setDisplacementY(p); } else if (attackingUnit.getY() < unit.getY()) { sprite.setDisplacementY(-p); } booms.add(sprite); } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_DEAD: { String x = ge.getMessage(); int idx1 = x.indexOf('|'); String a = x.substring(0, idx1); String b = x.substring(idx1 + 1); try { int playerNo = Integer.parseInt(a); int unitNo = Integer.parseInt(b); boolean updateSelected = false; Iterator i; if (playerNo == 1) { i = player1.getUnits(); } else { i = player2.getUnits(); } while (i.hasNext()) { Unit unit = (Unit) i.next(); if (unit.getNo() == unitNo) { if (unit.isSelected()) { updateSelected = true; } unit.relaseLand(map); i.remove(); } } if (updateSelected) { i = player.getSelectedUnits().iterator(); Unit unit = (Unit) i.next(); if (unit.getNo() == unitNo) { i.remove(); } } } catch (NumberFormatException ex) { } break; } case GameEvent.SB_GAME_OVER: { isRunning = false; networkJoinMenu.showGameOver(ge.getMessage()); break; } default: System.out.println("Nieznany komunikat: #" + ge.getType() + "\n"); break; } } } public void draw(Graphics2D g) { if (isRunning()) { /* * g.setBackground(Color.BLACK); g.setColor(Color.BLACK); * g.fillRect(0,0,game.screen.getWidth(), game.screen.getHeight()); */ map.drawMap(g, screen.getWidth(), screen.getHeight(), this); // /ble int p = Map.TILE_SIZE >> 1; int q = p >> 1; int r = q >> 1; int s = p / 5; // rysowanie obiektów for (int j = 0; j < 2; j++) { Iterator i; if (j == 0) { i = player.getUnits(); } else { i = opponent.getUnits(); } while (i.hasNext()) { Unit unit = (Unit) i.next(); int x = Map.tilesToPixels(unit.getX()) + Math.round(unit.getDisplacementX()) + map.getOffsetX(screen.getWidth()); int y = Map.tilesToPixels(unit.getY()) + Math.round(unit.getDisplacementY()) + map.getOffsetY(screen.getHeight()); // zakomentowane obracanie, bo wygląda nienaturalnie AffineTransform transform = new AffineTransform(); transform.translate(x + p + 1, y + p + 1); // transform.rotate(unit.getRotate() * Math.PI / 4); transform.translate(/* 1 */-p,/* 1 */-p); g.drawImage(unit.getImage(), transform, null); if (unit.isSelected()) { g.setColor(new Color(120, 136, 152)); g.setStroke(new BasicStroke(1.25F)); g.drawOval(x/* +1 */, y/* +1 */, Map.TILE_SIZE, Map.TILE_SIZE); } if (!unit.isPlayerUnit()) { g.setColor(new Color(200, 77, 50)); g.setBackground(new Color(200, 77, 50)); } else { g.setColor(new Color(47, 160, 40)); g.setBackground(new Color(47, 160, 40)); } { g.setStroke(new BasicStroke(0.0F)); g.fillRect(x + r, y + s, Math.round((p + q) * unit.getLifeProportion()), s); g.setColor(new Color(75, 75, 75)); g.setStroke(new BasicStroke(1.0F)); g.drawRect(x + r, y + s, p + q, s); } } } Iterator<Sprite> i = booms.iterator(); while (i.hasNext()) { Sprite sprite = i.next(); int x = Map.tilesToPixels(sprite.getX()) + Math.round(sprite.getDisplacementX()) + map.getOffsetX(screen.getWidth()); int y = Map.tilesToPixels(sprite.getY()) + Math.round(sprite.getDisplacementY()) + map.getOffsetY(screen.getHeight()); g.drawImage(sprite.getImage(), x, y, null); } // rysowanie mg�y wojny map.drawFoog(g, screen.getWidth(), screen.getHeight()); // rysowanie zaznaczenia if (player.isSelectionVisable()) { g.setColor(new Color(120, 136, 152)); g.setStroke(new BasicStroke(1.2F)); g.drawRect(player.getSelectionBeginX() + map.getOffsetX(screen.getWidth()), player .getSelectionBeginY() + map.getOffsetY(screen.getHeight()), player .getSelectionEndX() - player.getSelectionBeginX(), player .getSelectionEndY() - player.getSelectionBeginY()); } g.setColor(Color.WHITE); long time = this.time / 1000; long m = time % 60; long h = time / 60; String timeStr = (h < 10) ? "0" + h + ":" : h + ":"; timeStr += (m < 10) ? "0" + m : Long.toString(m); g.drawString("Czas: " + timeStr, 25, 35); /* * DisplayMode displayMode = game.screen.getCurrentDisplayMode(); * g.drawString("Rozdzielczo��: " + displayMode.getWidth() + "x" + * displayMode.getHeight() + "x" + displayMode.getBitDepth(),25,50); */ if (isPause()) { if (gameMenu.isVisible()) { gameMenu.draw(g); } else if (optionsMenu.isVisible()) { optionsMenu.draw(g); } } } else { if (mainMenu.isVisible()) { mainMenu.draw(g); } else if (networkMenu.isVisible()) { networkMenu.draw(g); } else if (networkClientMenu.isVisible()) { networkClientMenu.draw(g); } else if (networkServerMenu.isVisible()) { networkServerMenu.draw(g); } else if (networkJoinMenu.isVisible()) { networkJoinMenu.draw(g); } else if (optionsMenu.isVisible()) { optionsMenu.draw(g); } else if (isStarting) { g.setBackground(Color.BLACK); g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.WHITE); g.drawString("Ładowanie...", 20, getHeight() - 20); } try { Thread.sleep(50); } catch (InterruptedException ex) { ex.printStackTrace(); } } } }
27,039
0.438228
0.429348
726
36.227272
21.606661
81
false
false
0
0
0
0
0
0
0.690083
false
false
8
5cbbc5109435509440597f8f7869dfc3b17bd036
2,482,491,098,860
1c345d9e3cf604b0eeffce1a4c54221d9f7166ed
/src/main/java/com/lss233/phoenix/world/Location.java
004b57c68ab139af0f7b58c6d1766e7aa4689ddb
[ "MIT" ]
permissive
ThePhoenixMC/PhoenixAPI
https://github.com/ThePhoenixMC/PhoenixAPI
e578793f344ae7a96cddef3a257a2e9191b60a00
c83ef373493f51c604f721ad7236548a8732a2e8
refs/heads/master
2021-05-05T19:35:25.769000
2019-07-25T04:59:05
2019-07-25T04:59:05
117,790,019
16
3
MIT
false
2021-03-31T20:49:40
2018-01-17T05:42:21
2020-11-01T07:41:10
2021-03-31T20:49:40
255
14
1
1
Java
false
false
package com.lss233.phoenix.world; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.lss233.phoenix.config.json.deserializer.LocationDeserializer; import com.lss233.phoenix.config.json.serializer.LocationSerializer; import com.lss233.phoenix.math.Vector; import java.util.Objects; /** * A Minecraft location. */ @JsonDeserialize(using = LocationDeserializer.class) @JsonSerialize(using = LocationSerializer.class) public class Location { private World world; private double x, y, z; private float yaw, pitch; public Location(World world, double x, double y, double z) { this.world = world; this.x = x; this.y = y; this.z = z; this.yaw = 0; this.pitch = 0; } public Location(World world, double x, double y, double z, float yaw, float pitch) { this.world = world; this.x = x; this.y = y; this.z = z; this.yaw = yaw; this.pitch = pitch; } public World getWorld() { return world; } public void setWorld(World world) { this.world = world; } public double getX() { return x; } public void setX(double x) { this.x = x; } public double getY() { return y; } public void setY(double y) { this.y = y; } public double getZ() { return z; } public void setZ(double z) { this.z = z; } public int getBlockX() { return (int) Math.round(x); } public int getBlockY() { return (int) Math.round(y); } public int getBlockZ() { return (int) Math.round(z); } public float getYaw() { return yaw; } public void setYaw(float yaw) { this.yaw = yaw; } public float getPitch() { return pitch; } public void setPitch(float pitch) { this.pitch = pitch; } public Vector getVector(){ return new Vector(x,y,z); } @Override public int hashCode() { // https://stackoverflow.com/questions/113511/best-implementation-for-hashcode-method int hash = 15; hash = 37 * hash + (int) Double.doubleToLongBits(this.getX()); hash = 37 * hash + (int) Double.doubleToLongBits(this.getY()); hash = 37 * hash + (int) Double.doubleToLongBits(this.getZ()); hash = 37 * hash + Float.floatToIntBits(this.getYaw()); hash = 37 * hash + Float.floatToIntBits(this.getPitch()); return hash; } @Override public boolean equals(Object obj) { if (obj instanceof Location) { Location other = (Location) obj; return Objects.equals(this, other); } return false; } }
UTF-8
Java
2,829
java
Location.java
Java
[]
null
[]
package com.lss233.phoenix.world; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.lss233.phoenix.config.json.deserializer.LocationDeserializer; import com.lss233.phoenix.config.json.serializer.LocationSerializer; import com.lss233.phoenix.math.Vector; import java.util.Objects; /** * A Minecraft location. */ @JsonDeserialize(using = LocationDeserializer.class) @JsonSerialize(using = LocationSerializer.class) public class Location { private World world; private double x, y, z; private float yaw, pitch; public Location(World world, double x, double y, double z) { this.world = world; this.x = x; this.y = y; this.z = z; this.yaw = 0; this.pitch = 0; } public Location(World world, double x, double y, double z, float yaw, float pitch) { this.world = world; this.x = x; this.y = y; this.z = z; this.yaw = yaw; this.pitch = pitch; } public World getWorld() { return world; } public void setWorld(World world) { this.world = world; } public double getX() { return x; } public void setX(double x) { this.x = x; } public double getY() { return y; } public void setY(double y) { this.y = y; } public double getZ() { return z; } public void setZ(double z) { this.z = z; } public int getBlockX() { return (int) Math.round(x); } public int getBlockY() { return (int) Math.round(y); } public int getBlockZ() { return (int) Math.round(z); } public float getYaw() { return yaw; } public void setYaw(float yaw) { this.yaw = yaw; } public float getPitch() { return pitch; } public void setPitch(float pitch) { this.pitch = pitch; } public Vector getVector(){ return new Vector(x,y,z); } @Override public int hashCode() { // https://stackoverflow.com/questions/113511/best-implementation-for-hashcode-method int hash = 15; hash = 37 * hash + (int) Double.doubleToLongBits(this.getX()); hash = 37 * hash + (int) Double.doubleToLongBits(this.getY()); hash = 37 * hash + (int) Double.doubleToLongBits(this.getZ()); hash = 37 * hash + Float.floatToIntBits(this.getYaw()); hash = 37 * hash + Float.floatToIntBits(this.getPitch()); return hash; } @Override public boolean equals(Object obj) { if (obj instanceof Location) { Location other = (Location) obj; return Objects.equals(this, other); } return false; } }
2,829
0.586426
0.575115
123
22
20.991287
93
false
false
0
0
0
0
0
0
0.504065
false
false
8
43c0bf58bc7fec851476def7efb11afb0ce4831f
2,482,491,098,382
7449336a59c099e1614f861ca5bac55fbdfc2d02
/NetworkProgram/WebShop/WebShopLogic/src/webshop/logic/model/ItemType.java
8375473d91ff7e53143ddc200c1de5c13368fd8d
[]
no_license
swrh/kthprojects
https://github.com/swrh/kthprojects
5664cd6d4cf21f8499e7184ff03b732d10ecfcd3
888f5d25d4b220db565f184523218115b768f94b
refs/heads/master
2016-08-04T18:18:50.782000
2010-06-04T19:08:09
2010-06-04T19:08:09
40,554,943
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package webshop.logic.model; /** * This class holds some static gnome type * * @author A.K.M. Ashrafuzzaman */ public class ItemType { public static final String BATTLE_GNOME = "Battle gnome"; public static final String SCIFI_GNOME = "SciFi gnome"; public static final String GENERAL_GNOME = "General gnome"; public static String[] getItemType() { return new String[] { BATTLE_GNOME, SCIFI_GNOME, GENERAL_GNOME }; } }
UTF-8
Java
451
java
ItemType.java
Java
[ { "context": "s class holds some static gnome type\n *\n * @author A.K.M. Ashrafuzzaman\n */\npublic class ItemType {\n public static fin", "end": 111, "score": 0.9996694326400757, "start": 91, "tag": "NAME", "value": "A.K.M. Ashrafuzzaman" } ]
null
[]
package webshop.logic.model; /** * This class holds some static gnome type * * @author <NAME> */ public class ItemType { public static final String BATTLE_GNOME = "Battle gnome"; public static final String SCIFI_GNOME = "SciFi gnome"; public static final String GENERAL_GNOME = "General gnome"; public static String[] getItemType() { return new String[] { BATTLE_GNOME, SCIFI_GNOME, GENERAL_GNOME }; } }
437
0.687361
0.687361
16
27.25
25.579533
73
false
false
0
0
0
0
0
0
0.4375
false
false
8
14e46e0bec33b42ca41afb7f2fff4860d77b65db
21,500,606,290,862
f1b5297bb89853d244f5e41c2f7deb1a183816f7
/src/main/java/ua/controller/Main.java
86e2952cbf810c7307454a07378ea6083bc24351
[]
no_license
PashaKonietin/AvtoElitProject
https://github.com/PashaKonietin/AvtoElitProject
10542d201d835effeb99ca1b343991e1aa896bad
9dff2baf351ed08e4f47917a983c00ff91b92f97
refs/heads/master
2016-09-19T02:33:26.423000
2016-08-17T10:30:55
2016-08-17T10:30:55
65,898,824
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.controller; import java.util.List; import java.util.Scanner; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import ua.entity.AvtoElit; import ua.entity.CarCondition; import ua.entity.Category; import ua.entity.City; import ua.entity.Color; import ua.entity.EngineType; import ua.entity.Transmission; import ua.repository.ColorRepository; import ua.service.CarConditionService; import ua.service.ColorService; import ua.service.implementation.AvtoElitServiceImpl; import ua.service.implementation.CarConditionServiceImpl; import ua.service.implementation.ColorServiceImpl; public class Main { static final ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/applicationContext.xml"); static final ColorRepository reposetory = context.getBean(ColorRepository.class); static final CarConditionServiceImpl CARCONDITION_SERVICE = context.getBean(CarConditionServiceImpl.class); static final AvtoElitServiceImpl AVTOELIT_SERVICE = context.getBean(AvtoElitServiceImpl.class); static final Scanner SC = new Scanner(System.in); public static void main(String[] args) { // List<Color> colors = reposetory.findAll(); // for (Color color : colors) { // System.out.println(color.getName()); // } boolean isRun = true; while(isRun){ System.out.println("Натисніть 1 щоб додати стан авто"); System.out.println("Натисніть 2 щоб видатили стан авто по id"); System.out.println("Натисніть 3 щоб знайти стан авто по id"); System.out.println("Натисніть 4 щоб покащати всі стани авто"); System.out.println("Натисніть 5 щоб додати авто"); System.out.println("Натисніть 6 щоб вийти"); switch(SC.nextInt()){ case 1: { addCarCondition(); break; } case 2: { deleteCarCondition(); break; } case 3: { findAllCarConditions(); break; } case 4: { System.out.println(findAllCarConditions()); break; } case 5: { addCar(); break; } case 6: { isRun = false; break; } } } context.close(); } public static void addCar(){ System.out.println("Введіть колір авто: "); String color = SC.next(); System.out.println("Введіть категорію: "); String category = SC.next(); System.out.println("ВВедіть місто: "); String city = SC.next(); System.out.println("Введіт стан авто"); String carCondition = SC.next(); System.out.println("Введіть тип двигуна"); String engineType = SC.next(); System.out.println("Введіть тип трансміссії"); String transmission = SC.next(); System.out.println("Введіть ціну"); int price = SC.nextInt(); System.out.println("Введіть рік випуску"); int year = SC.nextInt(); System.out.println("Введіть пробіг авто"); int carRun = SC.nextInt(); AVTOELIT_SERVICE.save(city, carCondition, color, category, transmission, engineType, price, year, carRun); } public static void addCarCondition(){ System.out.println("Введіть назву стану авто яке ви хочете додати: "); String name = SC.next(); CARCONDITION_SERVICE.save(name); } public static void deleteCarCondition(){ System.out.println("Введіть id стану авто яке ви хочете видалити: "); int id = SC.nextInt(); CARCONDITION_SERVICE.deleteById(id); } public static void findOneCarCondition(){ System.out.println("Введіть id стану авто яке ви хочете знайти"); int id = SC.nextInt(); CARCONDITION_SERVICE.findById(id); } public static List<CarCondition> findAllCarConditions(){ return CARCONDITION_SERVICE.findAll(); } }
WINDOWS-1251
Java
4,009
java
Main.java
Java
[]
null
[]
package ua.controller; import java.util.List; import java.util.Scanner; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import ua.entity.AvtoElit; import ua.entity.CarCondition; import ua.entity.Category; import ua.entity.City; import ua.entity.Color; import ua.entity.EngineType; import ua.entity.Transmission; import ua.repository.ColorRepository; import ua.service.CarConditionService; import ua.service.ColorService; import ua.service.implementation.AvtoElitServiceImpl; import ua.service.implementation.CarConditionServiceImpl; import ua.service.implementation.ColorServiceImpl; public class Main { static final ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/applicationContext.xml"); static final ColorRepository reposetory = context.getBean(ColorRepository.class); static final CarConditionServiceImpl CARCONDITION_SERVICE = context.getBean(CarConditionServiceImpl.class); static final AvtoElitServiceImpl AVTOELIT_SERVICE = context.getBean(AvtoElitServiceImpl.class); static final Scanner SC = new Scanner(System.in); public static void main(String[] args) { // List<Color> colors = reposetory.findAll(); // for (Color color : colors) { // System.out.println(color.getName()); // } boolean isRun = true; while(isRun){ System.out.println("Натисніть 1 щоб додати стан авто"); System.out.println("Натисніть 2 щоб видатили стан авто по id"); System.out.println("Натисніть 3 щоб знайти стан авто по id"); System.out.println("Натисніть 4 щоб покащати всі стани авто"); System.out.println("Натисніть 5 щоб додати авто"); System.out.println("Натисніть 6 щоб вийти"); switch(SC.nextInt()){ case 1: { addCarCondition(); break; } case 2: { deleteCarCondition(); break; } case 3: { findAllCarConditions(); break; } case 4: { System.out.println(findAllCarConditions()); break; } case 5: { addCar(); break; } case 6: { isRun = false; break; } } } context.close(); } public static void addCar(){ System.out.println("Введіть колір авто: "); String color = SC.next(); System.out.println("Введіть категорію: "); String category = SC.next(); System.out.println("ВВедіть місто: "); String city = SC.next(); System.out.println("Введіт стан авто"); String carCondition = SC.next(); System.out.println("Введіть тип двигуна"); String engineType = SC.next(); System.out.println("Введіть тип трансміссії"); String transmission = SC.next(); System.out.println("Введіть ціну"); int price = SC.nextInt(); System.out.println("Введіть рік випуску"); int year = SC.nextInt(); System.out.println("Введіть пробіг авто"); int carRun = SC.nextInt(); AVTOELIT_SERVICE.save(city, carCondition, color, category, transmission, engineType, price, year, carRun); } public static void addCarCondition(){ System.out.println("Введіть назву стану авто яке ви хочете додати: "); String name = SC.next(); CARCONDITION_SERVICE.save(name); } public static void deleteCarCondition(){ System.out.println("Введіть id стану авто яке ви хочете видалити: "); int id = SC.nextInt(); CARCONDITION_SERVICE.deleteById(id); } public static void findOneCarCondition(){ System.out.println("Введіть id стану авто яке ви хочете знайти"); int id = SC.nextInt(); CARCONDITION_SERVICE.findById(id); } public static List<CarCondition> findAllCarConditions(){ return CARCONDITION_SERVICE.findAll(); } }
4,009
0.725256
0.72193
124
28.088709
25.418119
127
false
false
0
0
0
0
0
0
2.41129
false
false
8
302789578b39452be159aebbde9f71d51440f5d7
7,610,682,086,675
f2d9528e6da7280e03e327e0761a3027d628c75d
/gringotts-core/src/main/java/com/vxianjin/gringotts/web/util/SendSmsUtil.java
304e9c5c85c3dc1485eb5137dd40c364cd4f18fc
[]
no_license
moutainhigh/xianjindai
https://github.com/moutainhigh/xianjindai
550220965be99fb418d6dc844ca0c4ba708ed32e
7be4310b95f53f414664255f568772ce9b1647b7
refs/heads/master
2021-10-11T15:46:51.300000
2019-01-28T05:48:54
2019-01-28T05:48:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vxianjin.gringotts.web.util; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.vxianjin.gringotts.constant.Constant; import com.vxianjin.gringotts.constant.SmsConfigConstant; import com.vxianjin.gringotts.util.HttpUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; /** * 发送短信 * * @author gaoyuhai * 2016-6-17 下午03:50:44 */ public class SendSmsUtil { private static final Logger loger = LoggerFactory.getLogger(SendSmsUtil.class); private static String apiUrl = SmsConfigConstant.getConstant("apiurl"); private static String account = SmsConfigConstant.getConstant("account"); private static String pswd = SmsConfigConstant.getConstant("pswd"); public static boolean sendSmsCL(String telephone, String sms){ loger.info("sendSms:" + telephone + " sms=" + sms); try{ String msg = Constant.SMS_VERIFY_CONTENT.replace("#cont#", sms); //做URLEncoder - UTF-8编码 String sm = URLEncoder.encode(msg, "utf8"); //将参数进行封装 Map<String, Object> paramMap = new HashMap<>(); paramMap.put("un", account); paramMap.put("pw", pswd); //单一内容时群发 将手机号用;隔开 paramMap.put("da", telephone); paramMap.put("sm", sm); String result = HttpUtil.sendPost(apiUrl,paramMap); JSONObject jsonObject = JSON.parseObject(result); return jsonObject!=null && jsonObject.getBoolean("success"); }catch (Exception e){ loger.error("sendSmsCL error:{} ",e); return false; } } /** * 创蓝 自定义短信内容 * * @param telephone 手机号 * @param content 内容 * @return boolean b */ public static boolean sendSmsDiyCL(String telephone, String content) { loger.info("sendSms:" + telephone + " sms=" + content); try{ String sm = URLEncoder.encode(content, "utf8"); //将参数进行封装 Map<String, Object> paramMap = new HashMap<>(); paramMap.put("un", account); paramMap.put("pw", pswd); //单一内容时群发 将手机号用;隔开 paramMap.put("da", telephone); paramMap.put("sm", sm); String result = HttpUtil.sendPost(apiUrl,paramMap); JSONObject jsonObject = JSON.parseObject(result); return jsonObject!=null && jsonObject.getBoolean("success"); }catch (Exception e){ loger.error("send sms error:{}",e); return false; } } public static boolean sendSmsVoiceCode(String telephone, String content) { // Map<String, String> map = new HashMap<String, String>(); // map.put("account", sms_voice_account); // map.put("pswd", sms_voice_pswd); // map.put("mobile", telephone); // map.put("msg", content); // map.put("needstatus", "true"); // // IZz253ApiService service = CloseableOkHttp.obtainRemoteService( // api, IZz253ApiService.class // ); // try { // Response<ResponseBody> response = service.msgHttpBatchSendSM(map).execute(); // if (response.isSuccessful()) { // ResponseBody body = response.body(); // String string = null; // if (body != null) { // string = body.string(); // // String[] split = string.split("\n"); // String[] array = split[0].split(","); // if (array.length >= 2) { // if ("0".equals(array[1])) { // return true; // } // } // } // } // } catch (IOException e) { // return false; // } return false; } // static class SmsSendRequest { // /** // * 用户账号,必填 // */ // private String account; // /** // * 用户密码,必填 // */ // private String password; // /** // * 短信内容。长度不能超过536个字符,必填 // */ // private String msg; // /** // * 机号码。多个手机号码使用英文逗号分隔,必填 // */ // private String phone; // // public SmsSendRequest(String account, String password, String msg, String phone) { // super(); // this.account = account; // this.password = password; // this.msg = msg; // this.phone = phone; // } // // // public String getAccount() { // return account; // } // // public void setAccount(String account) { // this.account = account; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // } }
UTF-8
Java
5,559
java
SendSmsUtil.java
Java
[ { "context": ";\nimport java.util.Map;\n\n/**\n * 发送短信\n *\n * @author gaoyuhai\n * 2016-6-17 下午03:50:44\n */\npublic class SendSmsU", "end": 435, "score": 0.999466598033905, "start": 427, "tag": "USERNAME", "value": "gaoyuhai" }, { "context": "s.account = account;\n// this.password = password;\n// this.msg = msg;\n// this", "end": 4508, "score": 0.9992524981498718, "start": 4500, "tag": "PASSWORD", "value": "password" }, { "context": "d(String password) {\n// this.password = password;\n// }\n//\n// public String getMsg() ", "end": 4957, "score": 0.9961172342300415, "start": 4949, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.vxianjin.gringotts.web.util; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.vxianjin.gringotts.constant.Constant; import com.vxianjin.gringotts.constant.SmsConfigConstant; import com.vxianjin.gringotts.util.HttpUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; /** * 发送短信 * * @author gaoyuhai * 2016-6-17 下午03:50:44 */ public class SendSmsUtil { private static final Logger loger = LoggerFactory.getLogger(SendSmsUtil.class); private static String apiUrl = SmsConfigConstant.getConstant("apiurl"); private static String account = SmsConfigConstant.getConstant("account"); private static String pswd = SmsConfigConstant.getConstant("pswd"); public static boolean sendSmsCL(String telephone, String sms){ loger.info("sendSms:" + telephone + " sms=" + sms); try{ String msg = Constant.SMS_VERIFY_CONTENT.replace("#cont#", sms); //做URLEncoder - UTF-8编码 String sm = URLEncoder.encode(msg, "utf8"); //将参数进行封装 Map<String, Object> paramMap = new HashMap<>(); paramMap.put("un", account); paramMap.put("pw", pswd); //单一内容时群发 将手机号用;隔开 paramMap.put("da", telephone); paramMap.put("sm", sm); String result = HttpUtil.sendPost(apiUrl,paramMap); JSONObject jsonObject = JSON.parseObject(result); return jsonObject!=null && jsonObject.getBoolean("success"); }catch (Exception e){ loger.error("sendSmsCL error:{} ",e); return false; } } /** * 创蓝 自定义短信内容 * * @param telephone 手机号 * @param content 内容 * @return boolean b */ public static boolean sendSmsDiyCL(String telephone, String content) { loger.info("sendSms:" + telephone + " sms=" + content); try{ String sm = URLEncoder.encode(content, "utf8"); //将参数进行封装 Map<String, Object> paramMap = new HashMap<>(); paramMap.put("un", account); paramMap.put("pw", pswd); //单一内容时群发 将手机号用;隔开 paramMap.put("da", telephone); paramMap.put("sm", sm); String result = HttpUtil.sendPost(apiUrl,paramMap); JSONObject jsonObject = JSON.parseObject(result); return jsonObject!=null && jsonObject.getBoolean("success"); }catch (Exception e){ loger.error("send sms error:{}",e); return false; } } public static boolean sendSmsVoiceCode(String telephone, String content) { // Map<String, String> map = new HashMap<String, String>(); // map.put("account", sms_voice_account); // map.put("pswd", sms_voice_pswd); // map.put("mobile", telephone); // map.put("msg", content); // map.put("needstatus", "true"); // // IZz253ApiService service = CloseableOkHttp.obtainRemoteService( // api, IZz253ApiService.class // ); // try { // Response<ResponseBody> response = service.msgHttpBatchSendSM(map).execute(); // if (response.isSuccessful()) { // ResponseBody body = response.body(); // String string = null; // if (body != null) { // string = body.string(); // // String[] split = string.split("\n"); // String[] array = split[0].split(","); // if (array.length >= 2) { // if ("0".equals(array[1])) { // return true; // } // } // } // } // } catch (IOException e) { // return false; // } return false; } // static class SmsSendRequest { // /** // * 用户账号,必填 // */ // private String account; // /** // * 用户密码,必填 // */ // private String password; // /** // * 短信内容。长度不能超过536个字符,必填 // */ // private String msg; // /** // * 机号码。多个手机号码使用英文逗号分隔,必填 // */ // private String phone; // // public SmsSendRequest(String account, String password, String msg, String phone) { // super(); // this.account = account; // this.password = <PASSWORD>; // this.msg = msg; // this.phone = phone; // } // // // public String getAccount() { // return account; // } // // public void setAccount(String account) { // this.account = account; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = <PASSWORD>; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // } }
5,563
0.522817
0.516995
178
28.91573
22.463671
92
false
false
0
0
0
0
0
0
0.601124
false
false
8
79a105cb4e50c815fe6caba377fa3891a9f7c0e1
7,610,682,087,976
ee9b158ce867f5b18f53a3e89b5fd2bf030bf961
/StudentDaoSpring/src/main/java/com/onlinecrime/controller/AdminLoginController.java
d59df6f86f162e3f1f82155fcabfa2e64b981823
[]
no_license
SaravanaKumar65/onlinecrime
https://github.com/SaravanaKumar65/onlinecrime
a9b813badcc5bc2ab6b8fc33b964838aaa8c3ce4
e4a2d1c7b8f68bb88139eb98433e07a228d88a7d
refs/heads/master
2023-08-30T08:34:12.752000
2021-11-19T06:50:36
2021-11-19T06:50:36
429,693,946
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.onlinecrime.controller; import java.util.Objects; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import com.onlinecrime.Service.AdminLoginService; import com.onlinecrime.bean.AdminLogin; @Controller public class AdminLoginController { @Autowired private AdminLoginService adminloginservice; @GetMapping("/admin") public String loginLauncher(Model model) { AdminLogin loginbean= new AdminLogin(); model.addAttribute("loginData",loginbean); return "adminLoginForm"; } @PostMapping("/admin") public ModelAndView doLogin(@Valid @ModelAttribute("loginData") AdminLogin loginbean,BindingResult br) { if(br.hasErrors()) { return new ModelAndView("adminLoginForm"); } AdminLogin savedloginbean=adminloginservice.authenticateAdmin(loginbean.getUsername(), loginbean.getPassword()); if(Objects.nonNull(savedloginbean)) { return new ModelAndView("Admin_Dashboard","adminData",savedloginbean); } else { return new ModelAndView("adminLoginForm"); } //return new ModelAndView("loginPoliceData","flag","Invalid Username or password!!.."); } @GetMapping("/adminlogout") public String doLogout(HttpServletRequest req, HttpServletResponse res) { return "redirect:/login"; } }
UTF-8
Java
1,771
java
AdminLoginController.java
Java
[]
null
[]
package com.onlinecrime.controller; import java.util.Objects; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import com.onlinecrime.Service.AdminLoginService; import com.onlinecrime.bean.AdminLogin; @Controller public class AdminLoginController { @Autowired private AdminLoginService adminloginservice; @GetMapping("/admin") public String loginLauncher(Model model) { AdminLogin loginbean= new AdminLogin(); model.addAttribute("loginData",loginbean); return "adminLoginForm"; } @PostMapping("/admin") public ModelAndView doLogin(@Valid @ModelAttribute("loginData") AdminLogin loginbean,BindingResult br) { if(br.hasErrors()) { return new ModelAndView("adminLoginForm"); } AdminLogin savedloginbean=adminloginservice.authenticateAdmin(loginbean.getUsername(), loginbean.getPassword()); if(Objects.nonNull(savedloginbean)) { return new ModelAndView("Admin_Dashboard","adminData",savedloginbean); } else { return new ModelAndView("adminLoginForm"); } //return new ModelAndView("loginPoliceData","flag","Invalid Username or password!!.."); } @GetMapping("/adminlogout") public String doLogout(HttpServletRequest req, HttpServletResponse res) { return "redirect:/login"; } }
1,771
0.784867
0.784867
64
26.671875
28.053551
114
false
false
0
0
0
0
0
0
1.515625
false
false
8
eb5a7cf3a83be5273cfe31f083cfe0bc7b95c44b
19,988,777,828,035
915a6b422b262902c8efa2c840ee886d5b3b5e0a
/investor-reporting/internal/src/main/java/com/lendingclub/qa/investor_reporting/internal/db/dao/oracle/LCActorDAO.java
c0c41d713d656059a4d957a00cffdd8da9e758df
[]
no_license
dmitry-minchuk/InvestorReporting
https://github.com/dmitry-minchuk/InvestorReporting
6fe6a87b15fd045b5de64524dad904e4c3e51894
c143892d4d4ca4cc4722ae8b5a26b3a518798c54
refs/heads/master
2017-03-02T04:58:07.764000
2017-01-26T13:11:31
2017-01-26T13:11:31
80,522,519
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lendingclub.qa.investor_reporting.internal.db.dao.oracle; import java.util.HashMap; import java.util.Map; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import com.lendingclub.qa.investor_reporting.internal.db.domain.oracle.LCActor; import com.lendingclub.qa.investor_reporting.internal.gui.domain.advisor.ActorType; public class LCActorDAO { protected static final String NAMESPACE = "mappers"; protected SqlSessionFactory sf; public LCActorDAO(SqlSessionFactory sf) { super(); this.sf = sf; } public LCActor getLCActorByType(ActorType type) { final SqlSession session = sf.openSession(); try { final String query = NAMESPACE + ".getLCActorByType"; Map<String, Object> args = new HashMap<String, Object>(); args.put("type", type.getTypeId()); return session.selectOne(query, args); } finally { session.close(); } } public LCActor getLCActorById(String investorId) { final SqlSession session = sf.openSession(); try { final String query = NAMESPACE + ".getLCActorById"; Map<String, Object> args = new HashMap<String, Object>(); args.put("investorId", investorId); return session.selectOne(query, args); } finally { session.close(); } } public LCActor getLCActorByTypeWithDate(ActorType type) { final SqlSession session = sf.openSession(); try { final String query = NAMESPACE + ".getLCActorByTypeWithDate"; Map<String, Object> args = new HashMap<String, Object>(); args.put("type", type.getTypeId()); return session.selectOne(query, args); } finally { session.close(); } } }
UTF-8
Java
1,646
java
LCActorDAO.java
Java
[]
null
[]
package com.lendingclub.qa.investor_reporting.internal.db.dao.oracle; import java.util.HashMap; import java.util.Map; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import com.lendingclub.qa.investor_reporting.internal.db.domain.oracle.LCActor; import com.lendingclub.qa.investor_reporting.internal.gui.domain.advisor.ActorType; public class LCActorDAO { protected static final String NAMESPACE = "mappers"; protected SqlSessionFactory sf; public LCActorDAO(SqlSessionFactory sf) { super(); this.sf = sf; } public LCActor getLCActorByType(ActorType type) { final SqlSession session = sf.openSession(); try { final String query = NAMESPACE + ".getLCActorByType"; Map<String, Object> args = new HashMap<String, Object>(); args.put("type", type.getTypeId()); return session.selectOne(query, args); } finally { session.close(); } } public LCActor getLCActorById(String investorId) { final SqlSession session = sf.openSession(); try { final String query = NAMESPACE + ".getLCActorById"; Map<String, Object> args = new HashMap<String, Object>(); args.put("investorId", investorId); return session.selectOne(query, args); } finally { session.close(); } } public LCActor getLCActorByTypeWithDate(ActorType type) { final SqlSession session = sf.openSession(); try { final String query = NAMESPACE + ".getLCActorByTypeWithDate"; Map<String, Object> args = new HashMap<String, Object>(); args.put("type", type.getTypeId()); return session.selectOne(query, args); } finally { session.close(); } } }
1,646
0.719927
0.719927
68
23.205883
24.043808
83
false
false
0
0
0
0
0
0
2.073529
false
false
8
609c270b6294df2415f8c46a4c4cadbbad3b5f35
824,633,769,513
0904eab4dbc1a901d8c7aa94ecc70fc354cee576
/src/main/java/org/trescal/cwms/core/jobs/jobitem/controller/CollectInstrumentsController.java
e72c30302e6db1808a8dcccc705315ec21d784b7
[]
no_license
ukcastlerock/zxghft
https://github.com/ukcastlerock/zxghft
ff8d4fd824b212a61dfa99c318b18efef8aec9f4
1249b6105aa69a92cc5c8bff5be2bf8b0bcf7a6d
refs/heads/master
2016-08-03T14:18:15.136000
2015-06-08T12:41:57
2015-06-08T12:41:57
37,062,754
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.trescal.cwms.core.jobs.jobitem.controller; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.view.RedirectView; import org.trescal.cwms.core.company.entity.contact.Contact; import org.trescal.cwms.core.jobs.jobitem.entity.collectedinstrument.db.CollectedInstrumentService; import org.trescal.cwms.core.jobs.jobitem.form.CollectInstrumentsForm; import org.trescal.cwms.core.jobs.jobitem.form.CollectInstrumentsValidator; import org.trescal.cwms.core.system.Constants; @Controller public class CollectInstrumentsController { @Autowired CollectedInstrumentService ciServ; @Autowired private CollectInstrumentsValidator validator; @InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(validator); } @ModelAttribute("form") protected CollectInstrumentsForm formBackingObject() throws Exception { return new CollectInstrumentsForm(); } @RequestMapping(value="/collectinstruments.htm", method=RequestMethod.POST) protected RedirectView onSubmit(HttpServletRequest request, @Valid @ModelAttribute("form") CollectInstrumentsForm form, BindingResult result) throws Exception { this.ciServ.collectInstruments(form.getPlantIds(), (Contact) request.getSession().getAttribute(Constants.CURRENT_CONTACT)); return new RedirectView("viewcollectedinstruments.htm"); } @RequestMapping(value="/collectinstruments.htm", method=RequestMethod.POST) protected String referenceData() { return "trescal/core/jobs/jobitem/collectinstruments"; } }
UTF-8
Java
2,040
java
CollectInstrumentsController.java
Java
[]
null
[]
package org.trescal.cwms.core.jobs.jobitem.controller; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.view.RedirectView; import org.trescal.cwms.core.company.entity.contact.Contact; import org.trescal.cwms.core.jobs.jobitem.entity.collectedinstrument.db.CollectedInstrumentService; import org.trescal.cwms.core.jobs.jobitem.form.CollectInstrumentsForm; import org.trescal.cwms.core.jobs.jobitem.form.CollectInstrumentsValidator; import org.trescal.cwms.core.system.Constants; @Controller public class CollectInstrumentsController { @Autowired CollectedInstrumentService ciServ; @Autowired private CollectInstrumentsValidator validator; @InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(validator); } @ModelAttribute("form") protected CollectInstrumentsForm formBackingObject() throws Exception { return new CollectInstrumentsForm(); } @RequestMapping(value="/collectinstruments.htm", method=RequestMethod.POST) protected RedirectView onSubmit(HttpServletRequest request, @Valid @ModelAttribute("form") CollectInstrumentsForm form, BindingResult result) throws Exception { this.ciServ.collectInstruments(form.getPlantIds(), (Contact) request.getSession().getAttribute(Constants.CURRENT_CONTACT)); return new RedirectView("viewcollectedinstruments.htm"); } @RequestMapping(value="/collectinstruments.htm", method=RequestMethod.POST) protected String referenceData() { return "trescal/core/jobs/jobitem/collectinstruments"; } }
2,040
0.829412
0.829412
51
39.019608
34.530743
159
false
false
0
0
0
0
0
0
1.117647
false
false
8
0aab6058cfc82a6e0785c5ac2594492ef382e41e
8,787,503,122,259
c8ea35869d509f5bf4300b0cfd930fed97cc11da
/ehan-admin/src/main/java/cc/ehan/admin/modules/authentication/service/AdminAuthenticationService.java
e8a9fa457764a9a62728760217435223e3cf8427
[]
no_license
zhangzhiyong-ay/ehan
https://github.com/zhangzhiyong-ay/ehan
0f12d4843944c7bb9cbcf896fa38e2e74e1af582
88edb304652389c88ad50015eea4312625cd6cd0
refs/heads/main
2023-02-07T08:34:25.514000
2020-12-28T13:00:50
2020-12-28T13:00:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cc.ehan.admin.modules.authentication.service; import cc.ehan.admin.modules.authentication.domain.ao.LoginAccountAO; import cc.ehan.admin.security.LoginUser; import cc.ehan.admin.security.SecurityManager; import cc.ehan.common.exception.AuthenticateException; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.Collections; @Service @Slf4j public class AdminAuthenticationService { @Autowired private SecurityManager securityManager; public String loginByAccount(LoginAccountAO loginAccountAO) { Object principal = loginAccountAO.getAccountName(); Object credentials = loginAccountAO.getAccountPassword(); Collection authorities = Collections.emptyList(); Authentication authentication = new UsernamePasswordAuthenticationToken(principal, credentials, authorities); String token = null; try { token = securityManager.loginVerify(authentication); } catch (AuthenticationException e) { throw new AuthenticateException(); } if (log.isDebugEnabled()) { log.debug("账号 {} 登录成功,token为:{}", principal, token); } return token; } /** * 根据token获取对应的会话用户信息 * * @return */ public LoginUser getOwnerLoginUser() { LoginUser loginUser = securityManager.getLoginUser(); return loginUser; } }
UTF-8
Java
1,770
java
AdminAuthenticationService.java
Java
[]
null
[]
package cc.ehan.admin.modules.authentication.service; import cc.ehan.admin.modules.authentication.domain.ao.LoginAccountAO; import cc.ehan.admin.security.LoginUser; import cc.ehan.admin.security.SecurityManager; import cc.ehan.common.exception.AuthenticateException; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.Collections; @Service @Slf4j public class AdminAuthenticationService { @Autowired private SecurityManager securityManager; public String loginByAccount(LoginAccountAO loginAccountAO) { Object principal = loginAccountAO.getAccountName(); Object credentials = loginAccountAO.getAccountPassword(); Collection authorities = Collections.emptyList(); Authentication authentication = new UsernamePasswordAuthenticationToken(principal, credentials, authorities); String token = null; try { token = securityManager.loginVerify(authentication); } catch (AuthenticationException e) { throw new AuthenticateException(); } if (log.isDebugEnabled()) { log.debug("账号 {} 登录成功,token为:{}", principal, token); } return token; } /** * 根据token获取对应的会话用户信息 * * @return */ public LoginUser getOwnerLoginUser() { LoginUser loginUser = securityManager.getLoginUser(); return loginUser; } }
1,770
0.736385
0.734647
50
33.52
27.069717
117
false
false
0
0
0
0
0
0
0.58
false
false
8
8cbd3bb5fff699b67b1fb4a59078e6e8e170b157
3,444,563,794,842
1e9d5cd1230c05b4c7232b614ec9c9e2801ba487
/src/main/java/stoneforge/javadoc/DomPage.java
8bcc82eb238c51d8b06c93b31d2b357f00da718d
[]
no_license
Teletha/stoneforge
https://github.com/Teletha/stoneforge
06f75ed3e550ca6a1a80c8348e4f2db9268fb9ec
7628cae68d4cb60120cc162125cca4adee6be92b
refs/heads/master
2021-08-03T11:49:15.844000
2021-07-27T02:29:22
2021-07-27T02:29:22
236,001,106
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2019 Nameless Production Committee * * Licensed under the MIT License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://opensource.org/licenses/mit-license.php */ package stoneforge.javadoc; import kiss.XML; import stylist.StyleDSL; public class DomPage extends Page<XML> { /** * @param model */ public DomPage(JavadocModel model, XML xml) { super(model, xml); } /** * {@inheritDoc} */ @Override protected void declareContents() { $("section", Styles.Section, Styles.JavadocComment, () -> { $(xml(contents)); }); } /** * {@inheritDoc} */ @Override protected void declareSubNavigation() { } interface styles extends StyleDSL, StyleConstants { } }
UTF-8
Java
893
java
DomPage.java
Java
[]
null
[]
/* * Copyright (C) 2019 Nameless Production Committee * * Licensed under the MIT License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://opensource.org/licenses/mit-license.php */ package stoneforge.javadoc; import kiss.XML; import stylist.StyleDSL; public class DomPage extends Page<XML> { /** * @param model */ public DomPage(JavadocModel model, XML xml) { super(model, xml); } /** * {@inheritDoc} */ @Override protected void declareContents() { $("section", Styles.Section, Styles.JavadocComment, () -> { $(xml(contents)); }); } /** * {@inheritDoc} */ @Override protected void declareSubNavigation() { } interface styles extends StyleDSL, StyleConstants { } }
893
0.603583
0.599104
43
19.767443
20.367367
67
false
false
0
0
0
0
0
0
0.302326
false
false
8
8b2ed0a002487bb429c5f7a2a5e136ead002ac23
20,048,907,350,840
5d42c7d9b209cc7e56492e0e5ba111d2d24de090
/app/src/main/java/com/qican/ygj/ui/userinfo/MyInfoActivity.java
e4caf0cadc39ea62bfc9f8b502c1d2bb4d7684fb
[]
no_license
qiurenbieyuan/Yuguanjia
https://github.com/qiurenbieyuan/Yuguanjia
3342f0a4ea3f35f999da2c2f5a161c3e918f7a1d
4abd1f9939487fb7bffa3d0e14f799adbe9ecffb
refs/heads/master
2021-01-11T08:27:59.747000
2016-12-03T09:41:44
2016-12-03T09:41:44
72,262,478
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @Function:关于 * @Author:残阳催雪 * @Time:2016-8-9 * @Email:qiurenbieyuan@gmail.com */ package com.qican.ygj.ui.userinfo; import android.app.Dialog; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import com.jph.takephoto.app.TakePhoto; import com.jph.takephoto.app.TakePhotoActivity; import com.jph.takephoto.compress.CompressConfig; import com.jph.takephoto.model.CropOptions; import com.jph.takephoto.model.TResult; import com.qican.ygj.R; import com.qican.ygj.listener.OnDialogListener; import com.qican.ygj.listener.OnSexDialogListener; import com.qican.ygj.ui.intro.IntroActivity; import com.qican.ygj.utils.CommonTools; import com.qican.ygj.utils.ConstantValue; import com.qican.ygj.utils.YGJDatas; import com.zhy.http.okhttp.OkHttpUtils; import com.zhy.http.okhttp.callback.StringCallback; import net.sf.json.JSONObject; import java.io.File; import okhttp3.Call; public class MyInfoActivity extends TakePhotoActivity implements View.OnClickListener, OnSexDialogListener, OnDialogListener { private static final String TAG = "MyInfoActivity"; private CommonTools myTool; private LinearLayout llBack; private RelativeLayout rlNickName, rlSignature, rlUserId, rlTwodcode, rlSex, rlChooseHeadImg; private TextView tvNickName, tvSignature, tvSex; private TwodcodeDialog mTwodcodeDialog; private SexChooseDialog mSexDialog; private PicChooseDialog mHeadDialog; private ImageView ivHeadImg; private TakePhoto takePhoto; private ProgressBar pbUploadHead; CompressConfig compressConfig = new CompressConfig.Builder().setMaxSize(200 * 1024).setMaxPixel(800).create(); CropOptions cropOptions = new CropOptions.Builder().setAspectX(1).setAspectY(1).setWithOwnCrop(true).create(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_myinfo); initView(); initEvent(); } @Override protected void onResume() { super.onResume(); initData(); } private void initData() { tvNickName.setText(myTool.getNickName()); tvSignature.setText(myTool.getSignature()); tvSex.setText(myTool.getUserSex()); if (!"".equals(myTool.getUserHeadURL())) { myTool.showImage(myTool.getUserHeadURL(), ivHeadImg, R.drawable.defaultheadpic); } } private void initEvent() { llBack.setOnClickListener(this); rlNickName.setOnClickListener(this); rlSignature.setOnClickListener(this); rlUserId.setOnClickListener(this); rlTwodcode.setOnClickListener(this); rlSex.setOnClickListener(this); mSexDialog.setOnSexDialogListener(this); mHeadDialog.setOnDialogListener(this); rlChooseHeadImg.setOnClickListener(this); ivHeadImg.setOnClickListener(this); } private void initView() { llBack = (LinearLayout) findViewById(R.id.ll_back); rlNickName = (RelativeLayout) findViewById(R.id.rl_nickname); rlSignature = (RelativeLayout) findViewById(R.id.rl_autograph); rlUserId = (RelativeLayout) findViewById(R.id.rl_userid); rlTwodcode = (RelativeLayout) findViewById(R.id.rl_twodcode); rlSex = (RelativeLayout) findViewById(R.id.rl_sex); rlChooseHeadImg = (RelativeLayout) findViewById(R.id.rl_choose_headpic); tvNickName = (TextView) findViewById(R.id.tv_nickname); tvSignature = (TextView) findViewById(R.id.tv_signature); tvSex = (TextView) findViewById(R.id.tv_sex); ivHeadImg = (ImageView) findViewById(R.id.iv_headimg); pbUploadHead = (ProgressBar) findViewById(R.id.pb_uploadhead); mTwodcodeDialog = new TwodcodeDialog(this, R.style.Translucent_NoTitle); mSexDialog = new SexChooseDialog(this, R.style.Translucent_NoTitle); mHeadDialog = new PicChooseDialog(this, R.style.Translucent_NoTitle); takePhoto = getTakePhoto(); myTool = new CommonTools(this); } /** * 点击事件 * * @param v:所点击的View */ @Override public void onClick(View v) { switch (v.getId()) { case R.id.ll_back: finish(); break; case R.id.rl_choose_headpic: mHeadDialog.show(); break; case R.id.rl_nickname: myTool.startActivity(NickNameActivity.class); break; case R.id.rl_autograph: myTool.startActivity(SignatureActivity.class); break; case R.id.rl_twodcode: mTwodcodeDialog.show(); break; case R.id.rl_sex: mSexDialog.show(); break; case R.id.iv_headimg: myTool.startActivity(HeadInfoActivity.class); break; case R.id.rl_userid: myTool.startActivityForResult("notFirstIn", IntroActivity.class, 0); break; } } /** * 性别更新 */ @Override public void sexChangedSuccess() { tvSex.setText(myTool.getUserSex()); } @Override public void takeSuccess(final TResult result) { super.takeSuccess(result); //上传头像至服务器 File userHeadImgFile = new File(result.getImage().getPath()); pbUploadHead.setVisibility(View.VISIBLE); String url = ConstantValue.SERVICE_ADDRESS + "userHeadImage"; //上传池塘头像 OkHttpUtils .post() .url(url) .addParams("userId", myTool.getUserId()) .addFile("mFile", myTool.getUserId() + "_头像.png", userHeadImgFile) .build() .execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { pbUploadHead.setVisibility(View.GONE); myTool.showInfo("上传失败,请稍后再试!"); } @Override public void onResponse(String response, int id) { pbUploadHead.setVisibility(View.GONE); Log.i(TAG, "onResponse: " + response); switch (response) { case "success": Bitmap bitmap = BitmapFactory.decodeFile(result.getImage().getPath()); ivHeadImg.setImageBitmap(bitmap); myTool.showInfo("上传成功!"); // 上传成功后,更新用户信息到本地 YGJDatas.updateInfoFromService(MyInfoActivity.this); break; case "error": myTool.showInfo("上传失败,请稍后再试!"); break; case "overSize": myTool.showInfo("上传失败,图像超过最大限制了!"); break; } } }); Log.i(TAG, "takeSuccess: " + result.getImage().getPath()); } @Override public void takeFail(TResult result, String msg) { super.takeFail(result, msg); myTool.showInfo("选择失败:" + msg); } @Override public void takeCancel() { super.takeCancel(); myTool.showInfo("取消选择"); } @Override public void dialogResult(Dialog dialog, String msg) { switch (msg) { case PicChooseDialog.FORM_CAMERA: takePhoto.onEnableCompress(compressConfig, false); takePhoto.onPickFromCaptureWithCrop(myTool.getUserHeadFileUri(), cropOptions); break; case PicChooseDialog.FROM_FILE: takePhoto.onEnableCompress(compressConfig, false); takePhoto.onPickFromDocumentsWithCrop(myTool.getUserHeadFileUri(), cropOptions); break; } } }
UTF-8
Java
8,517
java
MyInfoActivity.java
Java
[ { "context": "/**\n * @Function:关于\n * @Author:残阳催雪\n * @Time:2016-8-9\n * @Email:qiurenbieyuan@gmail.c", "end": 35, "score": 0.9998346567153931, "start": 31, "tag": "NAME", "value": "残阳催雪" }, { "context": "on:关于\n * @Author:残阳催雪\n * @Time:2016-8-9\n * @Email:qiurenbieyuan@gmail.com\n */\npackage com.qican.ygj.ui.userinfo;\n\nimport an", "end": 87, "score": 0.9999322891235352, "start": 64, "tag": "EMAIL", "value": "qiurenbieyuan@gmail.com" } ]
null
[]
/** * @Function:关于 * @Author:残阳催雪 * @Time:2016-8-9 * @Email:<EMAIL> */ package com.qican.ygj.ui.userinfo; import android.app.Dialog; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import com.jph.takephoto.app.TakePhoto; import com.jph.takephoto.app.TakePhotoActivity; import com.jph.takephoto.compress.CompressConfig; import com.jph.takephoto.model.CropOptions; import com.jph.takephoto.model.TResult; import com.qican.ygj.R; import com.qican.ygj.listener.OnDialogListener; import com.qican.ygj.listener.OnSexDialogListener; import com.qican.ygj.ui.intro.IntroActivity; import com.qican.ygj.utils.CommonTools; import com.qican.ygj.utils.ConstantValue; import com.qican.ygj.utils.YGJDatas; import com.zhy.http.okhttp.OkHttpUtils; import com.zhy.http.okhttp.callback.StringCallback; import net.sf.json.JSONObject; import java.io.File; import okhttp3.Call; public class MyInfoActivity extends TakePhotoActivity implements View.OnClickListener, OnSexDialogListener, OnDialogListener { private static final String TAG = "MyInfoActivity"; private CommonTools myTool; private LinearLayout llBack; private RelativeLayout rlNickName, rlSignature, rlUserId, rlTwodcode, rlSex, rlChooseHeadImg; private TextView tvNickName, tvSignature, tvSex; private TwodcodeDialog mTwodcodeDialog; private SexChooseDialog mSexDialog; private PicChooseDialog mHeadDialog; private ImageView ivHeadImg; private TakePhoto takePhoto; private ProgressBar pbUploadHead; CompressConfig compressConfig = new CompressConfig.Builder().setMaxSize(200 * 1024).setMaxPixel(800).create(); CropOptions cropOptions = new CropOptions.Builder().setAspectX(1).setAspectY(1).setWithOwnCrop(true).create(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_myinfo); initView(); initEvent(); } @Override protected void onResume() { super.onResume(); initData(); } private void initData() { tvNickName.setText(myTool.getNickName()); tvSignature.setText(myTool.getSignature()); tvSex.setText(myTool.getUserSex()); if (!"".equals(myTool.getUserHeadURL())) { myTool.showImage(myTool.getUserHeadURL(), ivHeadImg, R.drawable.defaultheadpic); } } private void initEvent() { llBack.setOnClickListener(this); rlNickName.setOnClickListener(this); rlSignature.setOnClickListener(this); rlUserId.setOnClickListener(this); rlTwodcode.setOnClickListener(this); rlSex.setOnClickListener(this); mSexDialog.setOnSexDialogListener(this); mHeadDialog.setOnDialogListener(this); rlChooseHeadImg.setOnClickListener(this); ivHeadImg.setOnClickListener(this); } private void initView() { llBack = (LinearLayout) findViewById(R.id.ll_back); rlNickName = (RelativeLayout) findViewById(R.id.rl_nickname); rlSignature = (RelativeLayout) findViewById(R.id.rl_autograph); rlUserId = (RelativeLayout) findViewById(R.id.rl_userid); rlTwodcode = (RelativeLayout) findViewById(R.id.rl_twodcode); rlSex = (RelativeLayout) findViewById(R.id.rl_sex); rlChooseHeadImg = (RelativeLayout) findViewById(R.id.rl_choose_headpic); tvNickName = (TextView) findViewById(R.id.tv_nickname); tvSignature = (TextView) findViewById(R.id.tv_signature); tvSex = (TextView) findViewById(R.id.tv_sex); ivHeadImg = (ImageView) findViewById(R.id.iv_headimg); pbUploadHead = (ProgressBar) findViewById(R.id.pb_uploadhead); mTwodcodeDialog = new TwodcodeDialog(this, R.style.Translucent_NoTitle); mSexDialog = new SexChooseDialog(this, R.style.Translucent_NoTitle); mHeadDialog = new PicChooseDialog(this, R.style.Translucent_NoTitle); takePhoto = getTakePhoto(); myTool = new CommonTools(this); } /** * 点击事件 * * @param v:所点击的View */ @Override public void onClick(View v) { switch (v.getId()) { case R.id.ll_back: finish(); break; case R.id.rl_choose_headpic: mHeadDialog.show(); break; case R.id.rl_nickname: myTool.startActivity(NickNameActivity.class); break; case R.id.rl_autograph: myTool.startActivity(SignatureActivity.class); break; case R.id.rl_twodcode: mTwodcodeDialog.show(); break; case R.id.rl_sex: mSexDialog.show(); break; case R.id.iv_headimg: myTool.startActivity(HeadInfoActivity.class); break; case R.id.rl_userid: myTool.startActivityForResult("notFirstIn", IntroActivity.class, 0); break; } } /** * 性别更新 */ @Override public void sexChangedSuccess() { tvSex.setText(myTool.getUserSex()); } @Override public void takeSuccess(final TResult result) { super.takeSuccess(result); //上传头像至服务器 File userHeadImgFile = new File(result.getImage().getPath()); pbUploadHead.setVisibility(View.VISIBLE); String url = ConstantValue.SERVICE_ADDRESS + "userHeadImage"; //上传池塘头像 OkHttpUtils .post() .url(url) .addParams("userId", myTool.getUserId()) .addFile("mFile", myTool.getUserId() + "_头像.png", userHeadImgFile) .build() .execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { pbUploadHead.setVisibility(View.GONE); myTool.showInfo("上传失败,请稍后再试!"); } @Override public void onResponse(String response, int id) { pbUploadHead.setVisibility(View.GONE); Log.i(TAG, "onResponse: " + response); switch (response) { case "success": Bitmap bitmap = BitmapFactory.decodeFile(result.getImage().getPath()); ivHeadImg.setImageBitmap(bitmap); myTool.showInfo("上传成功!"); // 上传成功后,更新用户信息到本地 YGJDatas.updateInfoFromService(MyInfoActivity.this); break; case "error": myTool.showInfo("上传失败,请稍后再试!"); break; case "overSize": myTool.showInfo("上传失败,图像超过最大限制了!"); break; } } }); Log.i(TAG, "takeSuccess: " + result.getImage().getPath()); } @Override public void takeFail(TResult result, String msg) { super.takeFail(result, msg); myTool.showInfo("选择失败:" + msg); } @Override public void takeCancel() { super.takeCancel(); myTool.showInfo("取消选择"); } @Override public void dialogResult(Dialog dialog, String msg) { switch (msg) { case PicChooseDialog.FORM_CAMERA: takePhoto.onEnableCompress(compressConfig, false); takePhoto.onPickFromCaptureWithCrop(myTool.getUserHeadFileUri(), cropOptions); break; case PicChooseDialog.FROM_FILE: takePhoto.onEnableCompress(compressConfig, false); takePhoto.onPickFromDocumentsWithCrop(myTool.getUserHeadFileUri(), cropOptions); break; } } }
8,501
0.606425
0.604019
234
34.517094
25.309572
126
false
false
0
0
0
0
0
0
0.666667
false
false
8
4ed0dfbb90b690b894461010eaa4de95b4c9b629
12,644,383,772,776
dba78beec1870a1be8b879399fa6e2fc96b7a911
/privateadhocpeering/src/main/java/edu/kit/privateadhocpeering/DiscoveryBeacon.java
2140019cd214ab7b9462b2e770d6000ee2f91913
[ "MIT" ]
permissive
colebaileygit/ppacp
https://github.com/colebaileygit/ppacp
082b25c49e883ffa0041bd26ec852bd538fdb993
f51198caea3dbf46e2ca1b8cfe0743ede96592fa
refs/heads/master
2021-01-11T05:53:12.955000
2016-09-30T07:07:43
2016-09-30T07:07:43
69,641,265
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.kit.privateadhocpeering; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothManager; import android.bluetooth.le.AdvertiseCallback; import android.bluetooth.le.AdvertiseData; import android.bluetooth.le.AdvertiseSettings; import android.bluetooth.le.BluetoothLeAdvertiser; import android.content.Context; import android.graphics.Color; import android.os.ParcelUuid; import android.util.Log; import android.util.Pair; import java.nio.charset.Charset; import java.util.List; import java.util.Map; import java.util.UUID; public class DiscoveryBeacon { final BluetoothAdapter bluetoothAdapter; static final ParcelUuid SERVICE_UUID = ParcelUuid.fromString("0000FEAA-0000-1000-8000-00805F9B34FB"); AdvertiseCallback callback; private Context context; private AuthenticationGATT server; private AdvertisementSet set; DiscoveryBeacon(Context context, AdvertisementSet set) { this.context = context; BluetoothManager bluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE); bluetoothAdapter = bluetoothManager.getAdapter(); this.set = set; } void broadcast(AdvertiseCallback callback) { this.callback = callback; byte[] advData = set.advertisementKey.getAdvertisingData(); byte[] bytes = new byte[advData.length + 1]; bytes[0] = (byte)0x30; // eID frame type System.arraycopy(advData, 0, bytes, 1, advData.length); AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_POWER) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .setConnectable(true) .setTimeout(0) .build(); AdvertiseData.Builder builder = new AdvertiseData.Builder() .setIncludeDeviceName( false ) .setIncludeTxPowerLevel( false ) .addServiceUuid( SERVICE_UUID ) .addServiceData( SERVICE_UUID, bytes ); AdvertiseData data = builder.build(); bluetoothAdapter.setName("nil"); if (bluetoothAdapter.getBluetoothLeAdvertiser() == null) return; // Bluetooth disabled or not supported bluetoothAdapter.getBluetoothLeAdvertiser().stopAdvertising(callback); bluetoothAdapter.getBluetoothLeAdvertiser().startAdvertising(settings, data, callback); server = new AuthenticationGATT(context, set); server.openServer(); } void cancel() { if (callback != null) { BluetoothLeAdvertiser advertiser = bluetoothAdapter.getBluetoothLeAdvertiser(); if (advertiser != null) advertiser.stopAdvertising(callback); server.closeServer(); } else { Log.e("BEACON", "Could not cancel because callback null."); } } void writeMessage(String peerIdentifier) { if (server != null) { server.sendData(peerIdentifier); } else { // trying to write message to peer with no connection PeerDatabase.getInstance().getPeer(peerIdentifier).lost(); } } }
UTF-8
Java
3,279
java
DiscoveryBeacon.java
Java
[]
null
[]
package edu.kit.privateadhocpeering; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothManager; import android.bluetooth.le.AdvertiseCallback; import android.bluetooth.le.AdvertiseData; import android.bluetooth.le.AdvertiseSettings; import android.bluetooth.le.BluetoothLeAdvertiser; import android.content.Context; import android.graphics.Color; import android.os.ParcelUuid; import android.util.Log; import android.util.Pair; import java.nio.charset.Charset; import java.util.List; import java.util.Map; import java.util.UUID; public class DiscoveryBeacon { final BluetoothAdapter bluetoothAdapter; static final ParcelUuid SERVICE_UUID = ParcelUuid.fromString("0000FEAA-0000-1000-8000-00805F9B34FB"); AdvertiseCallback callback; private Context context; private AuthenticationGATT server; private AdvertisementSet set; DiscoveryBeacon(Context context, AdvertisementSet set) { this.context = context; BluetoothManager bluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE); bluetoothAdapter = bluetoothManager.getAdapter(); this.set = set; } void broadcast(AdvertiseCallback callback) { this.callback = callback; byte[] advData = set.advertisementKey.getAdvertisingData(); byte[] bytes = new byte[advData.length + 1]; bytes[0] = (byte)0x30; // eID frame type System.arraycopy(advData, 0, bytes, 1, advData.length); AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_POWER) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .setConnectable(true) .setTimeout(0) .build(); AdvertiseData.Builder builder = new AdvertiseData.Builder() .setIncludeDeviceName( false ) .setIncludeTxPowerLevel( false ) .addServiceUuid( SERVICE_UUID ) .addServiceData( SERVICE_UUID, bytes ); AdvertiseData data = builder.build(); bluetoothAdapter.setName("nil"); if (bluetoothAdapter.getBluetoothLeAdvertiser() == null) return; // Bluetooth disabled or not supported bluetoothAdapter.getBluetoothLeAdvertiser().stopAdvertising(callback); bluetoothAdapter.getBluetoothLeAdvertiser().startAdvertising(settings, data, callback); server = new AuthenticationGATT(context, set); server.openServer(); } void cancel() { if (callback != null) { BluetoothLeAdvertiser advertiser = bluetoothAdapter.getBluetoothLeAdvertiser(); if (advertiser != null) advertiser.stopAdvertising(callback); server.closeServer(); } else { Log.e("BEACON", "Could not cancel because callback null."); } } void writeMessage(String peerIdentifier) { if (server != null) { server.sendData(peerIdentifier); } else { // trying to write message to peer with no connection PeerDatabase.getInstance().getPeer(peerIdentifier).lost(); } } }
3,279
0.669716
0.659957
92
34.641304
27.784332
118
false
false
0
0
0
0
0
0
0.608696
false
false
8
8f7914f24aa6c1bf73928d08ad40182617ee7a1e
12,644,383,773,969
cf24565484848dc8f554de135b5189bff9ba6405
/app/src/main/java/com/example/f433/Activities/Game/GameActivity.java
a86c1c22a3671997c3333b996f17e93a89f5ae8f
[]
no_license
messengerW/433
https://github.com/messengerW/433
c26fd0a9785e5301e3e909735482367c29f97a70
d79e386cb302f9869c4a5be525aa3b3ed3bf6330
refs/heads/master
2021-07-06T18:01:11.561000
2020-08-14T15:19:32
2020-08-14T15:19:32
158,185,865
4
4
null
false
2019-04-25T09:25:26
2018-11-19T08:20:08
2019-04-23T08:40:00
2019-04-20T15:42:44
7,214
3
2
2
Java
false
false
package com.example.f433.Activities.Game; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.example.f433.Activities.MainActivity; import com.example.f433.R; import com.github.mikephil.charting.animation.Easing; import com.github.mikephil.charting.charts.LineChart; import com.github.mikephil.charting.charts.PieChart; import com.github.mikephil.charting.charts.RadarChart; import com.github.mikephil.charting.components.AxisBase; import com.github.mikephil.charting.components.Legend; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.YAxis; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.LineData; import com.github.mikephil.charting.data.LineDataSet; import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; import com.github.mikephil.charting.data.PieEntry; import com.github.mikephil.charting.data.RadarData; import com.github.mikephil.charting.data.RadarDataSet; import com.github.mikephil.charting.data.RadarEntry; import com.github.mikephil.charting.formatter.AxisValueFormatter; import com.github.mikephil.charting.formatter.PercentFormatter; import com.github.mikephil.charting.formatter.ValueFormatter; import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; import com.github.mikephil.charting.interfaces.datasets.IRadarDataSet; import com.github.mikephil.charting.utils.ViewPortHandler; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; public class GameActivity extends AppCompatActivity { private PieChart pie_chart; private RadarChart radar_chart; private LineChart line_chart; private TextView score_bar_text; private GameActivity_ScoreBar score_bar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); initView(); } private void initView() { /* * 返回按钮 */ ImageView imageView = (ImageView) findViewById(R.id.back); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(GameActivity.this, MainActivity.class); startActivity(intent); } }); /* * 积分情况对照图 */ // 主队积分 final GameActivity_ScoreBoardView myView = (GameActivity_ScoreBoardView) findViewById(R.id.custom_view); myView.setColor(Color.rgb(0, 204, 0)); myView.setScore(34); myView.setWinDrawLose(10, 4, 5); // 客队积分 final GameActivity_ScoreBoardView myView2 = (GameActivity_ScoreBoardView) findViewById(R.id.custom_view2); myView2.setColor(Color.rgb(102, 204, 255)); myView2.setScore(31); myView2.setWinDrawLose(8, 7, 4); // 主客队联赛中排名 final GameActivity_RankBar bar = (GameActivity_RankBar) findViewById(R.id.rank_bar); bar.setRanks(1, 1); bar.setRanks(6, 10); bar.setColor(Color.rgb(0, 204, 0), Color.rgb(104, 204, 255)); // 点击动画 myView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { myView.setColor(Color.rgb(0, 204, 0)); myView.setScore(34); myView.setWinDrawLose(10, 4, 5); myView2.setColor(Color.rgb(102, 204, 255)); myView2.setScore(31); myView2.setWinDrawLose(8, 7, 4); bar.setRanks(6, 10); bar.setColor(Color.rgb(0, 204, 0), Color.rgb(104, 204, 255)); } }); /* * 饼图绘制 */ //模拟数据 HashMap dataMap = new HashMap(); dataMap.put("主胜", "40"); dataMap.put("客胜", "50"); dataMap.put("平局", "10"); pie_chart = (PieChart) findViewById(R.id.pie_chart); setPieChart(pie_chart, dataMap, "Predict", true); /* * 雷达图绘制 */ radar_chart = (RadarChart) findViewById(R.id.radar_chart); setRadarChart(radar_chart); /* * 折线图绘制 */ line_chart = (LineChart) findViewById(R.id.line_chart); setLineChart(line_chart); /* * 对比条文本 */ score_bar_text = (TextView) findViewById(R.id.score_bar_text); score_bar_text.setText("射正数"); score_bar_text.setTextColor(Color.WHITE); /* * 对比条绘制 */ score_bar = (GameActivity_ScoreBar) findViewById(R.id.score_bar); score_bar.setScores(5, 8); //设置数据 score_bar.setBarColor(Color.rgb(0, 204, 0), Color.rgb(187, 255, 250)); } //设置饼图属性 public void setPieChart(PieChart pieChart, Map<String, Float> pieValues, String title, boolean showLegend) { pieChart.setUsePercentValues(true);//设置使用百分比(后续有详细介绍) //pieChart.setExtraOffsets(5, 5, 5, 5); //设置边距 pieChart.setHoleRadius(55);//将饼图中心的孔的半径设置为最大半径的百分比 pieChart.setDragDecelerationFrictionCoef(0.95f);//设置摩擦系数(值越小摩擦系数越大) pieChart.setCenterText(title);//设置环中的文字 pieChart.setRotationEnabled(true);//是否可以旋转 pieChart.setHighlightPerTapEnabled(true);//点击是否放大 pieChart.setCenterTextSize(18f);//设置环中文字的大小 pieChart.setCenterTextColor(Color.WHITE);//设置环中文字的颜色 pieChart.setDrawCenterText(true);//设置绘制环中文字 pieChart.setRotationAngle(120f);//设置旋转角度 pieChart.setTransparentCircleRadius(63);//设置半透明圆环的半径,看着就有一种立体的感觉 //这个方法为true就是环形图,为false就是饼图 pieChart.setDrawHoleEnabled(true); //设置环形中间空白颜色 pieChart.setHoleColor(Color.argb(85, 255, 255, 255)); //设置半透明圆环的颜色 pieChart.setTransparentCircleColor(Color.WHITE); //设置半透明圆环的透明度 pieChart.setTransparentCircleAlpha(130); //设置图标背景 //pieChart.setBackgroundColor(Color.rgb(0,0,0)); //设置默认右下角的描述 pieChart.setDescription(null); /*图例设置----此处不需要 Legend legend = pieChart.getLegend(); if (showLegend) { legend.setEnabled(true);//是否显示图例 legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);//图例相对于图表横向的位置 legend.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);//图例相对于图表纵向的位置 legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);//图例显示的方向 legend.setDrawInside(false); legend.setDirection(Legend.LegendDirection.LEFT_TO_RIGHT); } else { legend.setEnabled(false); }*/ //设置饼图数据 setPieChartData(pieChart, pieValues); pieChart.animateX(1500, Easing.EasingOption.EaseInOutQuad);//数据显示动画 } //设置饼图数据 private void setPieChartData(PieChart pieChart, Map<String, Float> pieValues) { ArrayList<PieEntry> pie_entries = new ArrayList<PieEntry>(); //设置饼图各区块的颜色 final int[] PIE_COLORS = { Color.rgb(169, 255, 169), Color.rgb(255, 229, 172), Color.rgb(187, 255, 255) }; Set set = pieValues.entrySet(); Iterator it = set.iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); pie_entries.add(new PieEntry(Float.valueOf(entry.getValue().toString()), entry.getKey().toString())); } PieDataSet dataSet = new PieDataSet(pie_entries, ""); dataSet.setSliceSpace(3f);//设置饼块之间的间隔 dataSet.setSelectionShift(5f);//设置饼块选中时偏离饼图中心的距离 dataSet.setColors(PIE_COLORS);//设置饼块的颜色 //设置数据显示方式有见图 //dataSet.setValueLinePart1OffsetPercentage(80f);//数据连接线距图形片内部边界的距离,为百分数 //dataSet.setValueLinePart1Length(0.3f); //dataSet.setValueLinePart2Length(0.4f); //dataSet.setValueLineColor(Color.YELLOW);//设置连接线的颜色 dataSet.setXValuePosition(PieDataSet.ValuePosition.INSIDE_SLICE); dataSet.setYValuePosition(PieDataSet.ValuePosition.INSIDE_SLICE); PieData pieData = new PieData(dataSet); pieData.setValueFormatter(new PercentFormatter()); pieData.setValueTextSize(13f); pieData.setValueTextColor(Color.rgb(238, 90, 255)); pieChart.setData(pieData); pieChart.setEntryLabelColor(Color.rgb(238, 90, 255)); pieChart.highlightValues(null); pieChart.invalidate(); } //设置雷达图属性 public void setRadarChart(RadarChart chart) { //设置描述 chart.setDescription(null); //网格设置 chart.setWebLineWidth(1f); chart.setWebColor(Color.LTGRAY); chart.setWebLineWidthInner(1f); chart.setWebColorInner(Color.LTGRAY); chart.setWebAlpha(100); //动画设置 chart.animateXY(1400, 1400, Easing.EasingOption.EaseInOutQuad, Easing.EasingOption.EaseInOutQuad); //x轴--外围文字设置 XAxis xAxis = chart.getXAxis(); xAxis.setTextSize(12f); //xAxis.setYOffset(10f); //xAxis.setXOffset(10f); xAxis.setValueFormatter(new AxisValueFormatter() { private final String[] mActivities = new String[]{"进攻", "技巧", "体能", "防守", "对抗", "速度"}; @Override public String getFormattedValue(float value, AxisBase axisBase) { return mActivities[(int) value % mActivities.length]; } @Override public int getDecimalDigits() { return 0; } }); xAxis.setTextColor(Color.WHITE); //y轴--内部标签设置 YAxis yAxis = chart.getYAxis(); yAxis.setLabelCount(5, false); yAxis.setTextSize(10f); yAxis.setTextColor(Color.WHITE); yAxis.setStartAtZero(true); // Y坐标值是否从0开始 yAxis.setDrawLabels(false); // 是否显示y值在图表上 //图例设置 Legend l = chart.getLegend(); l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP); l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER); l.setOrientation(Legend.LegendOrientation.HORIZONTAL); l.setDrawInside(false); l.setXEntrySpace(10f); // 图例X间距 l.setYEntrySpace(5f); // 图例Y间距 l.setTextSize(14f); l.setTextColor(Color.WHITE); setRadarChartData(chart); } //设置雷达图数据 private void setRadarChartData(RadarChart chart) { ArrayList<RadarEntry> entries1 = new ArrayList<>(); ArrayList<RadarEntry> entries2 = new ArrayList<>(); // NOTE: The order of the entries when being added to the entries array determines their position around the center of // the chart. //主队数据 entries1.add(new RadarEntry(80)); entries1.add(new RadarEntry(90)); entries1.add(new RadarEntry(60)); entries1.add(new RadarEntry(70)); entries1.add(new RadarEntry(50)); entries1.add(new RadarEntry(50)); //客队数据 entries2.add(new RadarEntry(90)); entries2.add(new RadarEntry(70)); entries2.add(new RadarEntry(50)); entries2.add(new RadarEntry(60)); entries2.add(new RadarEntry(80)); entries2.add(new RadarEntry(80)); //主队图案绘制 RadarDataSet set1 = new RadarDataSet(entries1, "主队"); set1.setColor(Color.rgb(187, 255, 250)); set1.setFillColor(Color.rgb(187, 255, 250)); set1.setDrawFilled(true); set1.setFillAlpha(180); set1.setLineWidth(2f); set1.setDrawHighlightCircleEnabled(true); set1.setDrawHighlightIndicators(false); //客队图案绘制 RadarDataSet set2 = new RadarDataSet(entries2, "客队"); set2.setColor(Color.rgb(255, 155, 205)); set2.setFillColor(Color.rgb(255, 155, 205)); set2.setDrawFilled(true); set2.setFillAlpha(120); set2.setLineWidth(2f); set2.setDrawHighlightCircleEnabled(true); set2.setDrawHighlightIndicators(false); //图案应用 ArrayList<IRadarDataSet> sets = new ArrayList<>(); sets.add(set1); sets.add(set2); //雷达图数据集 RadarData data = new RadarData(sets); //不显示数据 data.setDrawValues(false); data.setValueFormatter(new ValueFormatter() { @Override public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return String.valueOf((int) value); } }); data.setValueTextSize(10f); data.setValueTextColor(Color.WHITE); chart.setData(data); chart.invalidate(); } //设置折线图属性 public void setLineChart(LineChart chart) { //设置描述 chart.setDescription(null); //设置图例开关 chart.getLegend().setEnabled(true); //设置显示范围 chart.setVisibleXRangeMaximum(3); chart.setVisibleYRangeMinimum(10f, YAxis.AxisDependency.LEFT); //设置透明度 chart.setAlpha(1.0f); //设置背景色 //chart.setBackgroundColor(Color.WHITE); //设置边框 //chart.setBorderColor(Color.rgb(0, 0, 0)); //chart.setGridBackgroundColor(R.color.colorPrimary); //设置触摸(关闭影响下面3个属性) chart.setTouchEnabled(true); //设置是否可以拖拽 chart.setDragEnabled(true); //设置是否可以缩放 chart.setScaleEnabled(true); //设置是否能扩大扩小 chart.setPinchZoom(true); //设置XY轴进入动画 chart.animateXY(800, 800); //设置最小的缩放 chart.setScaleMinima(1f, 1f); //设置图例属性 Legend l = chart.getLegend(); l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP); l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER); l.setOrientation(Legend.LegendOrientation.HORIZONTAL); l.setDrawInside(false); l.setXEntrySpace(10f); // 图例X间距 l.setYEntrySpace(5f); // 图例Y间距 l.setTextSize(14f); l.setTextColor(Color.WHITE); //获取X轴 XAxis xl = chart.getXAxis(); //设置x轴参数 xl.setValueFormatter(new AxisValueFormatter() { private final String[] mAxis = new String[]{"0-15", "16-30", "31-45", "46-60", "61-75", "76-90+"}; @Override public String getFormattedValue(float value, AxisBase axisBase) { return mAxis[(int) value % mAxis.length]; } @Override public int getDecimalDigits() { return 0; } }); //启用X轴 xl.setEnabled(true); //设置X轴避免图表或屏幕的边缘的第一个和最后一个轴中的标签条目被裁剪 xl.setAvoidFirstLastClipping(true); //设置X轴底部显示 xl.setPosition(XAxis.XAxisPosition.BOTTOM); //设置竖网格 xl.setDrawGridLines(true); //设置X轴文字大小 xl.setTextSize(12f); //设置X轴文字颜色 xl.setTextColor(Color.WHITE); //设置X轴单位间隔 xl.setGranularity(1f); //获取Y轴(左) YAxis yl = chart.getAxisLeft(); //此表不需要Y轴 yl.setEnabled(false); //设置Y轴文字在外部显示 yl.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); //设置横网格 yl.setDrawGridLines(true); //Y轴字体 yl.setTextSize(12f); //Y轴字体颜色 yl.setTextColor(Color.WHITE); //设置Y轴最大值 yl.setAxisMaxValue(100f); //设置Y轴起始值 yl.setAxisMinValue(0f); //获取Y轴(右) YAxis ylR = chart.getAxisRight(); //禁用右侧Y轴 ylR.setEnabled(false); setLineChartData(chart); } //设置折线图数据 private void setLineChartData(LineChart chart) { //主队数据 ArrayList<Entry> list_home = new ArrayList<>(); list_home.add(new Entry(0, 70)); list_home.add(new Entry(1, 40)); list_home.add(new Entry(2, 55)); list_home.add(new Entry(3, 12)); list_home.add(new Entry(4, 65)); list_home.add(new Entry(5, 75)); LineDataSet lHome = new LineDataSet(list_home, "主队"); lHome.setAxisDependency(YAxis.AxisDependency.LEFT); //设置包括的范围区域填充颜色 lHome.setDrawFilled(false); //设置线的宽度 lHome.setLineWidth(2f); //设置曲线的颜色 lHome.setColor(Color.rgb(140, 210, 118)); //设置曲率,0.05f-1f 1为折线 lHome.setCubicIntensity(1f); //设置有圆点 lHome.setDrawCircles(true); //设置小圆点的大小 lHome.setCircleRadius(4f); //设置圆圈颜色 lHome.setCircleColor(Color.rgb(140, 210, 118)); //填充圆圈内颜色 //lHome.setCircleColorHole(Color.rgb(140, 210, 118)); //客队数据 ArrayList<Entry> list_away = new ArrayList<>(); list_away.add(new Entry(0, 40)); list_away.add(new Entry(1, 70)); list_away.add(new Entry(2, 65)); list_away.add(new Entry(3, 80)); list_away.add(new Entry(4, 75)); list_away.add(new Entry(5, 85)); LineDataSet lAway = new LineDataSet(list_away, "客队"); lAway.setAxisDependency(YAxis.AxisDependency.LEFT); //设置包括的范围区域填充颜色 lAway.setDrawFilled(false); //设置线的宽度 lAway.setLineWidth(2f); //设置曲线的颜色 lAway.setColor(Color.rgb(159, 143, 186)); //设置曲率,0.05f-1f 1为折线 lAway.setCubicIntensity(1f); //设置有圆点 lAway.setDrawCircles(true); //设置小圆点的大小 lAway.setCircleRadius(4f); //设置圆圈颜色 lAway.setCircleColor(Color.rgb(159, 143, 186)); //填充圆圈内颜色 //lAway.setCircleColorHole(Color.rgb(159, 143, 186)); //添加数据进入数据集合 List<ILineDataSet> lineDataSetArrayList = new ArrayList<>(); lineDataSetArrayList.add(lHome); lineDataSetArrayList.add(lAway); LineData lineData = new LineData(lineDataSetArrayList); //设置显示数值 lineData.setDrawValues(true); //设置数值格式 lineData.setValueFormatter(new ValueFormatter() { @Override public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return value + "%"; } }); lineData.setValueTextColor(Color.WHITE); lineData.setValueTextSize(10f); chart.setData(lineData); //刷新图表 chart.invalidate();//List<Model> newData = new ArrayList<>(); } }
UTF-8
Java
20,328
java
GameActivity.java
Java
[]
null
[]
package com.example.f433.Activities.Game; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.example.f433.Activities.MainActivity; import com.example.f433.R; import com.github.mikephil.charting.animation.Easing; import com.github.mikephil.charting.charts.LineChart; import com.github.mikephil.charting.charts.PieChart; import com.github.mikephil.charting.charts.RadarChart; import com.github.mikephil.charting.components.AxisBase; import com.github.mikephil.charting.components.Legend; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.YAxis; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.LineData; import com.github.mikephil.charting.data.LineDataSet; import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; import com.github.mikephil.charting.data.PieEntry; import com.github.mikephil.charting.data.RadarData; import com.github.mikephil.charting.data.RadarDataSet; import com.github.mikephil.charting.data.RadarEntry; import com.github.mikephil.charting.formatter.AxisValueFormatter; import com.github.mikephil.charting.formatter.PercentFormatter; import com.github.mikephil.charting.formatter.ValueFormatter; import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; import com.github.mikephil.charting.interfaces.datasets.IRadarDataSet; import com.github.mikephil.charting.utils.ViewPortHandler; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; public class GameActivity extends AppCompatActivity { private PieChart pie_chart; private RadarChart radar_chart; private LineChart line_chart; private TextView score_bar_text; private GameActivity_ScoreBar score_bar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); initView(); } private void initView() { /* * 返回按钮 */ ImageView imageView = (ImageView) findViewById(R.id.back); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(GameActivity.this, MainActivity.class); startActivity(intent); } }); /* * 积分情况对照图 */ // 主队积分 final GameActivity_ScoreBoardView myView = (GameActivity_ScoreBoardView) findViewById(R.id.custom_view); myView.setColor(Color.rgb(0, 204, 0)); myView.setScore(34); myView.setWinDrawLose(10, 4, 5); // 客队积分 final GameActivity_ScoreBoardView myView2 = (GameActivity_ScoreBoardView) findViewById(R.id.custom_view2); myView2.setColor(Color.rgb(102, 204, 255)); myView2.setScore(31); myView2.setWinDrawLose(8, 7, 4); // 主客队联赛中排名 final GameActivity_RankBar bar = (GameActivity_RankBar) findViewById(R.id.rank_bar); bar.setRanks(1, 1); bar.setRanks(6, 10); bar.setColor(Color.rgb(0, 204, 0), Color.rgb(104, 204, 255)); // 点击动画 myView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { myView.setColor(Color.rgb(0, 204, 0)); myView.setScore(34); myView.setWinDrawLose(10, 4, 5); myView2.setColor(Color.rgb(102, 204, 255)); myView2.setScore(31); myView2.setWinDrawLose(8, 7, 4); bar.setRanks(6, 10); bar.setColor(Color.rgb(0, 204, 0), Color.rgb(104, 204, 255)); } }); /* * 饼图绘制 */ //模拟数据 HashMap dataMap = new HashMap(); dataMap.put("主胜", "40"); dataMap.put("客胜", "50"); dataMap.put("平局", "10"); pie_chart = (PieChart) findViewById(R.id.pie_chart); setPieChart(pie_chart, dataMap, "Predict", true); /* * 雷达图绘制 */ radar_chart = (RadarChart) findViewById(R.id.radar_chart); setRadarChart(radar_chart); /* * 折线图绘制 */ line_chart = (LineChart) findViewById(R.id.line_chart); setLineChart(line_chart); /* * 对比条文本 */ score_bar_text = (TextView) findViewById(R.id.score_bar_text); score_bar_text.setText("射正数"); score_bar_text.setTextColor(Color.WHITE); /* * 对比条绘制 */ score_bar = (GameActivity_ScoreBar) findViewById(R.id.score_bar); score_bar.setScores(5, 8); //设置数据 score_bar.setBarColor(Color.rgb(0, 204, 0), Color.rgb(187, 255, 250)); } //设置饼图属性 public void setPieChart(PieChart pieChart, Map<String, Float> pieValues, String title, boolean showLegend) { pieChart.setUsePercentValues(true);//设置使用百分比(后续有详细介绍) //pieChart.setExtraOffsets(5, 5, 5, 5); //设置边距 pieChart.setHoleRadius(55);//将饼图中心的孔的半径设置为最大半径的百分比 pieChart.setDragDecelerationFrictionCoef(0.95f);//设置摩擦系数(值越小摩擦系数越大) pieChart.setCenterText(title);//设置环中的文字 pieChart.setRotationEnabled(true);//是否可以旋转 pieChart.setHighlightPerTapEnabled(true);//点击是否放大 pieChart.setCenterTextSize(18f);//设置环中文字的大小 pieChart.setCenterTextColor(Color.WHITE);//设置环中文字的颜色 pieChart.setDrawCenterText(true);//设置绘制环中文字 pieChart.setRotationAngle(120f);//设置旋转角度 pieChart.setTransparentCircleRadius(63);//设置半透明圆环的半径,看着就有一种立体的感觉 //这个方法为true就是环形图,为false就是饼图 pieChart.setDrawHoleEnabled(true); //设置环形中间空白颜色 pieChart.setHoleColor(Color.argb(85, 255, 255, 255)); //设置半透明圆环的颜色 pieChart.setTransparentCircleColor(Color.WHITE); //设置半透明圆环的透明度 pieChart.setTransparentCircleAlpha(130); //设置图标背景 //pieChart.setBackgroundColor(Color.rgb(0,0,0)); //设置默认右下角的描述 pieChart.setDescription(null); /*图例设置----此处不需要 Legend legend = pieChart.getLegend(); if (showLegend) { legend.setEnabled(true);//是否显示图例 legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);//图例相对于图表横向的位置 legend.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);//图例相对于图表纵向的位置 legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);//图例显示的方向 legend.setDrawInside(false); legend.setDirection(Legend.LegendDirection.LEFT_TO_RIGHT); } else { legend.setEnabled(false); }*/ //设置饼图数据 setPieChartData(pieChart, pieValues); pieChart.animateX(1500, Easing.EasingOption.EaseInOutQuad);//数据显示动画 } //设置饼图数据 private void setPieChartData(PieChart pieChart, Map<String, Float> pieValues) { ArrayList<PieEntry> pie_entries = new ArrayList<PieEntry>(); //设置饼图各区块的颜色 final int[] PIE_COLORS = { Color.rgb(169, 255, 169), Color.rgb(255, 229, 172), Color.rgb(187, 255, 255) }; Set set = pieValues.entrySet(); Iterator it = set.iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); pie_entries.add(new PieEntry(Float.valueOf(entry.getValue().toString()), entry.getKey().toString())); } PieDataSet dataSet = new PieDataSet(pie_entries, ""); dataSet.setSliceSpace(3f);//设置饼块之间的间隔 dataSet.setSelectionShift(5f);//设置饼块选中时偏离饼图中心的距离 dataSet.setColors(PIE_COLORS);//设置饼块的颜色 //设置数据显示方式有见图 //dataSet.setValueLinePart1OffsetPercentage(80f);//数据连接线距图形片内部边界的距离,为百分数 //dataSet.setValueLinePart1Length(0.3f); //dataSet.setValueLinePart2Length(0.4f); //dataSet.setValueLineColor(Color.YELLOW);//设置连接线的颜色 dataSet.setXValuePosition(PieDataSet.ValuePosition.INSIDE_SLICE); dataSet.setYValuePosition(PieDataSet.ValuePosition.INSIDE_SLICE); PieData pieData = new PieData(dataSet); pieData.setValueFormatter(new PercentFormatter()); pieData.setValueTextSize(13f); pieData.setValueTextColor(Color.rgb(238, 90, 255)); pieChart.setData(pieData); pieChart.setEntryLabelColor(Color.rgb(238, 90, 255)); pieChart.highlightValues(null); pieChart.invalidate(); } //设置雷达图属性 public void setRadarChart(RadarChart chart) { //设置描述 chart.setDescription(null); //网格设置 chart.setWebLineWidth(1f); chart.setWebColor(Color.LTGRAY); chart.setWebLineWidthInner(1f); chart.setWebColorInner(Color.LTGRAY); chart.setWebAlpha(100); //动画设置 chart.animateXY(1400, 1400, Easing.EasingOption.EaseInOutQuad, Easing.EasingOption.EaseInOutQuad); //x轴--外围文字设置 XAxis xAxis = chart.getXAxis(); xAxis.setTextSize(12f); //xAxis.setYOffset(10f); //xAxis.setXOffset(10f); xAxis.setValueFormatter(new AxisValueFormatter() { private final String[] mActivities = new String[]{"进攻", "技巧", "体能", "防守", "对抗", "速度"}; @Override public String getFormattedValue(float value, AxisBase axisBase) { return mActivities[(int) value % mActivities.length]; } @Override public int getDecimalDigits() { return 0; } }); xAxis.setTextColor(Color.WHITE); //y轴--内部标签设置 YAxis yAxis = chart.getYAxis(); yAxis.setLabelCount(5, false); yAxis.setTextSize(10f); yAxis.setTextColor(Color.WHITE); yAxis.setStartAtZero(true); // Y坐标值是否从0开始 yAxis.setDrawLabels(false); // 是否显示y值在图表上 //图例设置 Legend l = chart.getLegend(); l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP); l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER); l.setOrientation(Legend.LegendOrientation.HORIZONTAL); l.setDrawInside(false); l.setXEntrySpace(10f); // 图例X间距 l.setYEntrySpace(5f); // 图例Y间距 l.setTextSize(14f); l.setTextColor(Color.WHITE); setRadarChartData(chart); } //设置雷达图数据 private void setRadarChartData(RadarChart chart) { ArrayList<RadarEntry> entries1 = new ArrayList<>(); ArrayList<RadarEntry> entries2 = new ArrayList<>(); // NOTE: The order of the entries when being added to the entries array determines their position around the center of // the chart. //主队数据 entries1.add(new RadarEntry(80)); entries1.add(new RadarEntry(90)); entries1.add(new RadarEntry(60)); entries1.add(new RadarEntry(70)); entries1.add(new RadarEntry(50)); entries1.add(new RadarEntry(50)); //客队数据 entries2.add(new RadarEntry(90)); entries2.add(new RadarEntry(70)); entries2.add(new RadarEntry(50)); entries2.add(new RadarEntry(60)); entries2.add(new RadarEntry(80)); entries2.add(new RadarEntry(80)); //主队图案绘制 RadarDataSet set1 = new RadarDataSet(entries1, "主队"); set1.setColor(Color.rgb(187, 255, 250)); set1.setFillColor(Color.rgb(187, 255, 250)); set1.setDrawFilled(true); set1.setFillAlpha(180); set1.setLineWidth(2f); set1.setDrawHighlightCircleEnabled(true); set1.setDrawHighlightIndicators(false); //客队图案绘制 RadarDataSet set2 = new RadarDataSet(entries2, "客队"); set2.setColor(Color.rgb(255, 155, 205)); set2.setFillColor(Color.rgb(255, 155, 205)); set2.setDrawFilled(true); set2.setFillAlpha(120); set2.setLineWidth(2f); set2.setDrawHighlightCircleEnabled(true); set2.setDrawHighlightIndicators(false); //图案应用 ArrayList<IRadarDataSet> sets = new ArrayList<>(); sets.add(set1); sets.add(set2); //雷达图数据集 RadarData data = new RadarData(sets); //不显示数据 data.setDrawValues(false); data.setValueFormatter(new ValueFormatter() { @Override public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return String.valueOf((int) value); } }); data.setValueTextSize(10f); data.setValueTextColor(Color.WHITE); chart.setData(data); chart.invalidate(); } //设置折线图属性 public void setLineChart(LineChart chart) { //设置描述 chart.setDescription(null); //设置图例开关 chart.getLegend().setEnabled(true); //设置显示范围 chart.setVisibleXRangeMaximum(3); chart.setVisibleYRangeMinimum(10f, YAxis.AxisDependency.LEFT); //设置透明度 chart.setAlpha(1.0f); //设置背景色 //chart.setBackgroundColor(Color.WHITE); //设置边框 //chart.setBorderColor(Color.rgb(0, 0, 0)); //chart.setGridBackgroundColor(R.color.colorPrimary); //设置触摸(关闭影响下面3个属性) chart.setTouchEnabled(true); //设置是否可以拖拽 chart.setDragEnabled(true); //设置是否可以缩放 chart.setScaleEnabled(true); //设置是否能扩大扩小 chart.setPinchZoom(true); //设置XY轴进入动画 chart.animateXY(800, 800); //设置最小的缩放 chart.setScaleMinima(1f, 1f); //设置图例属性 Legend l = chart.getLegend(); l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP); l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER); l.setOrientation(Legend.LegendOrientation.HORIZONTAL); l.setDrawInside(false); l.setXEntrySpace(10f); // 图例X间距 l.setYEntrySpace(5f); // 图例Y间距 l.setTextSize(14f); l.setTextColor(Color.WHITE); //获取X轴 XAxis xl = chart.getXAxis(); //设置x轴参数 xl.setValueFormatter(new AxisValueFormatter() { private final String[] mAxis = new String[]{"0-15", "16-30", "31-45", "46-60", "61-75", "76-90+"}; @Override public String getFormattedValue(float value, AxisBase axisBase) { return mAxis[(int) value % mAxis.length]; } @Override public int getDecimalDigits() { return 0; } }); //启用X轴 xl.setEnabled(true); //设置X轴避免图表或屏幕的边缘的第一个和最后一个轴中的标签条目被裁剪 xl.setAvoidFirstLastClipping(true); //设置X轴底部显示 xl.setPosition(XAxis.XAxisPosition.BOTTOM); //设置竖网格 xl.setDrawGridLines(true); //设置X轴文字大小 xl.setTextSize(12f); //设置X轴文字颜色 xl.setTextColor(Color.WHITE); //设置X轴单位间隔 xl.setGranularity(1f); //获取Y轴(左) YAxis yl = chart.getAxisLeft(); //此表不需要Y轴 yl.setEnabled(false); //设置Y轴文字在外部显示 yl.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART); //设置横网格 yl.setDrawGridLines(true); //Y轴字体 yl.setTextSize(12f); //Y轴字体颜色 yl.setTextColor(Color.WHITE); //设置Y轴最大值 yl.setAxisMaxValue(100f); //设置Y轴起始值 yl.setAxisMinValue(0f); //获取Y轴(右) YAxis ylR = chart.getAxisRight(); //禁用右侧Y轴 ylR.setEnabled(false); setLineChartData(chart); } //设置折线图数据 private void setLineChartData(LineChart chart) { //主队数据 ArrayList<Entry> list_home = new ArrayList<>(); list_home.add(new Entry(0, 70)); list_home.add(new Entry(1, 40)); list_home.add(new Entry(2, 55)); list_home.add(new Entry(3, 12)); list_home.add(new Entry(4, 65)); list_home.add(new Entry(5, 75)); LineDataSet lHome = new LineDataSet(list_home, "主队"); lHome.setAxisDependency(YAxis.AxisDependency.LEFT); //设置包括的范围区域填充颜色 lHome.setDrawFilled(false); //设置线的宽度 lHome.setLineWidth(2f); //设置曲线的颜色 lHome.setColor(Color.rgb(140, 210, 118)); //设置曲率,0.05f-1f 1为折线 lHome.setCubicIntensity(1f); //设置有圆点 lHome.setDrawCircles(true); //设置小圆点的大小 lHome.setCircleRadius(4f); //设置圆圈颜色 lHome.setCircleColor(Color.rgb(140, 210, 118)); //填充圆圈内颜色 //lHome.setCircleColorHole(Color.rgb(140, 210, 118)); //客队数据 ArrayList<Entry> list_away = new ArrayList<>(); list_away.add(new Entry(0, 40)); list_away.add(new Entry(1, 70)); list_away.add(new Entry(2, 65)); list_away.add(new Entry(3, 80)); list_away.add(new Entry(4, 75)); list_away.add(new Entry(5, 85)); LineDataSet lAway = new LineDataSet(list_away, "客队"); lAway.setAxisDependency(YAxis.AxisDependency.LEFT); //设置包括的范围区域填充颜色 lAway.setDrawFilled(false); //设置线的宽度 lAway.setLineWidth(2f); //设置曲线的颜色 lAway.setColor(Color.rgb(159, 143, 186)); //设置曲率,0.05f-1f 1为折线 lAway.setCubicIntensity(1f); //设置有圆点 lAway.setDrawCircles(true); //设置小圆点的大小 lAway.setCircleRadius(4f); //设置圆圈颜色 lAway.setCircleColor(Color.rgb(159, 143, 186)); //填充圆圈内颜色 //lAway.setCircleColorHole(Color.rgb(159, 143, 186)); //添加数据进入数据集合 List<ILineDataSet> lineDataSetArrayList = new ArrayList<>(); lineDataSetArrayList.add(lHome); lineDataSetArrayList.add(lAway); LineData lineData = new LineData(lineDataSetArrayList); //设置显示数值 lineData.setDrawValues(true); //设置数值格式 lineData.setValueFormatter(new ValueFormatter() { @Override public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return value + "%"; } }); lineData.setValueTextColor(Color.WHITE); lineData.setValueTextSize(10f); chart.setData(lineData); //刷新图表 chart.invalidate();//List<Model> newData = new ArrayList<>(); } }
20,328
0.622034
0.594139
548
32.691605
23.938671
126
false
false
0
0
0
0
0
0
0.808394
false
false
8
49aba9dac110697fe30db6d36a3d4020028429b1
22,299,470,220,331
033d835696d0903a7c208da6e326af6789384434
/src/SHEJIMOSHI/适配器/Tagretable.java
4a278c23574ba00056349ea8aba656cc4021ab83
[]
no_license
1993ycs/ycsdemo
https://github.com/1993ycs/ycsdemo
d2da2a5843d386d53d198c192b788d3ae35b0b80
51fe0c760766dd2c29f2b972592f194641de251b
refs/heads/master
2021-09-06T13:48:10.971000
2018-02-07T05:03:25
2018-02-07T05:03:25
105,890,229
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package SHEJIMOSHI.适配器; public interface Tagretable { public void med1(); public void med2(); }
UTF-8
Java
111
java
Tagretable.java
Java
[]
null
[]
package SHEJIMOSHI.适配器; public interface Tagretable { public void med1(); public void med2(); }
111
0.695238
0.67619
6
16.5
11.514483
29
false
false
0
0
0
0
0
0
0.5
false
false
8
a6151e611d19ad1758a7dab5b53897cde604a2cf
21,689,584,858,139
9b3bc5fc89c753a6357d07bd10040f17664777d0
/SmartQuestionBank/src/main/java/com/enablue/pojo/VariablePool.java
84c555fa0ab72c2ca4e24240662d45bfb2f06b11
[]
no_license
skyboxer/BeeEdu
https://github.com/skyboxer/BeeEdu
91db254996f2eca08296af06a8aa424f3fa2b580
cc95aa7c3da7a98c2e79c0640ce02ae76cef1f3c
refs/heads/master
2023-01-13T02:41:17.774000
2020-05-27T09:57:51
2020-05-27T09:57:51
215,715,549
1
0
null
false
2023-01-11T19:57:32
2019-10-17T06:07:31
2020-05-27T09:58:38
2023-01-11T19:57:32
149,298
1
0
80
HTML
false
false
package com.enablue.pojo; import org.springframework.stereotype.Component; import java.util.Date; /** * @author cnxjk * 变量类 */ public class VariablePool { private Integer variableId; private Integer templateId; private String variableContent; private Date gmtCreate; private Date gmtModified; public VariablePool() { } public VariablePool(Integer variableId, Integer templateId, String variableContent, Date gmtCreate, Date gmtModified) { this.variableId = variableId; this.templateId = templateId; this.variableContent = variableContent; this.gmtCreate = gmtCreate; this.gmtModified = gmtModified; } public Integer getVariableId() { return variableId; } public void setVariableId(Integer variableId) { this.variableId = variableId; } public Integer getTemplateId() { return templateId; } public void setTemplateId(Integer templateId) { this.templateId = templateId; } public String getVariableContent() { return variableContent; } public void setVariableContent(String variableContent) { this.variableContent = variableContent; } public Date getGmtCreate() { return gmtCreate; } public void setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; } public Date getGmtModified() { return gmtModified; } public void setGmtModified(Date gmtModified) { this.gmtModified = gmtModified; } }
UTF-8
Java
1,551
java
VariablePool.java
Java
[ { "context": "Component;\n\nimport java.util.Date;\n\n/**\n * @author cnxjk\n * 变量类\n */\npublic class VariablePool {\n\n priva", "end": 121, "score": 0.9996299743652344, "start": 116, "tag": "USERNAME", "value": "cnxjk" } ]
null
[]
package com.enablue.pojo; import org.springframework.stereotype.Component; import java.util.Date; /** * @author cnxjk * 变量类 */ public class VariablePool { private Integer variableId; private Integer templateId; private String variableContent; private Date gmtCreate; private Date gmtModified; public VariablePool() { } public VariablePool(Integer variableId, Integer templateId, String variableContent, Date gmtCreate, Date gmtModified) { this.variableId = variableId; this.templateId = templateId; this.variableContent = variableContent; this.gmtCreate = gmtCreate; this.gmtModified = gmtModified; } public Integer getVariableId() { return variableId; } public void setVariableId(Integer variableId) { this.variableId = variableId; } public Integer getTemplateId() { return templateId; } public void setTemplateId(Integer templateId) { this.templateId = templateId; } public String getVariableContent() { return variableContent; } public void setVariableContent(String variableContent) { this.variableContent = variableContent; } public Date getGmtCreate() { return gmtCreate; } public void setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; } public Date getGmtModified() { return gmtModified; } public void setGmtModified(Date gmtModified) { this.gmtModified = gmtModified; } }
1,551
0.667961
0.667961
70
21.071428
21.742205
123
false
false
0
0
0
0
0
0
0.385714
false
false
8
243a22b1b1fcd9be47396547a48778a1612b540f
21,689,584,855,752
43c3975cea28675598f05cb2f2acf89e6a02e4b5
/src/main/java/br/edu/facthus/poo/PesquisaController.java
c3aec9ff79275321897ff4b55d813b217cfe3658
[]
no_license
jhonatasLuiz/projeto-poo
https://github.com/jhonatasLuiz/projeto-poo
01b182e1abf69f97aac3c1f38180858f7f0233a0
057e5a4363c577801212473a4d1f570d7e02f860
refs/heads/master
2023-05-13T08:07:23.323000
2021-05-26T23:28:08
2021-05-26T23:28:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.edu.facthus.poo; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.TextField; public class PesquisaController { @FXML private TextField txtNumero; @FXML private Label lblSaida; @FXML private void pesquisa() { // EX06: completar... Integer n1 = Integer.parseInt(txtNumero.getText()); lblSaida.setText(String.format("Pesquisando produto com código..." )); } @FXML private void entrada() { // EX07: completar... Integer n1 = Integer.parseInt(txtNumero.getText()); lblSaida.setText(String.format("Pesquisando entrada de...itens" )); } @FXML private void saida() { // EX08: completar... Integer n1 = Integer.parseInt(txtNumero.getText()); lblSaida.setText(String.format("Pesquisando saída de...itens" )); } }
UTF-8
Java
821
java
PesquisaController.java
Java
[]
null
[]
package br.edu.facthus.poo; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.TextField; public class PesquisaController { @FXML private TextField txtNumero; @FXML private Label lblSaida; @FXML private void pesquisa() { // EX06: completar... Integer n1 = Integer.parseInt(txtNumero.getText()); lblSaida.setText(String.format("Pesquisando produto com código..." )); } @FXML private void entrada() { // EX07: completar... Integer n1 = Integer.parseInt(txtNumero.getText()); lblSaida.setText(String.format("Pesquisando entrada de...itens" )); } @FXML private void saida() { // EX08: completar... Integer n1 = Integer.parseInt(txtNumero.getText()); lblSaida.setText(String.format("Pesquisando saída de...itens" )); } }
821
0.691087
0.680098
42
18.5
20.1521
68
false
false
0
0
0
0
0
0
1.595238
false
false
8
348b6ba8875f5f39475180e6427c554e7d21d3e5
21,586,505,639,981
5acd2a8f6eff81a740c6dea60b501784e03d9e65
/src/main/java/org/page/WorkWithUsPage.java
d470d9c234c25a59e7829640650c827dbe67b128
[]
no_license
JohnTSalmon/TestForce
https://github.com/JohnTSalmon/TestForce
5273b91eef8904a87ea7276048b359341de82aa4
62f704207c0915364be440a60eb034adaa5a4918
refs/heads/master
2021-06-11T11:23:07.036000
2019-11-28T17:32:14
2019-11-28T17:32:14
177,579,437
0
0
null
false
2021-06-04T01:51:29
2019-03-25T12:10:58
2019-11-28T17:33:25
2021-06-04T01:51:28
92,676
0
0
3
Java
false
false
package org.page; import org.testforce.utils.Locator; import org.openqa.selenium.By; public class WorkWithUsPage extends Locator { public final By PAGE_TITLE = className("merchant-faq-block--intro"); public final String TITLE_TEXT = "BRINGING CONSUMERS TO YOUR BUSINESS"; }
UTF-8
Java
287
java
WorkWithUsPage.java
Java
[]
null
[]
package org.page; import org.testforce.utils.Locator; import org.openqa.selenium.By; public class WorkWithUsPage extends Locator { public final By PAGE_TITLE = className("merchant-faq-block--intro"); public final String TITLE_TEXT = "BRINGING CONSUMERS TO YOUR BUSINESS"; }
287
0.756098
0.756098
11
25.09091
27.658484
75
false
false
0
0
0
0
0
0
0.454545
false
false
8
0d59f3349916613e8966430e9014fd69c2619902
21,586,505,639,214
53db0ea59aa2b1533551f74ea8e61edef53e2f0d
/Lab-3-State/src/domain/Beschadigd.java
84ecfe06224dfd7de42d02ce9a6e1aef1fe179ad
[]
no_license
RedaBoussabat/OO-Opdrachten
https://github.com/RedaBoussabat/OO-Opdrachten
17bac3bf1ceae946ef0e8df4d4cea50f6d7a5c58
465e5146f623e21f0f7469241a1137ffbcfa2528
refs/heads/master
2020-07-28T05:28:21.221000
2019-11-13T14:40:09
2019-11-13T14:40:09
209,323,302
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package domain; public class Beschadigd extends ProductState { private Product product; public Beschadigd(Product product) { super(product); this.product = product; } @Override public void herstel(){ product.setState(product.getUitleenbaar()); } @Override public void verwijder() { product.setState(product.getVerwijderd()); } }
UTF-8
Java
402
java
Beschadigd.java
Java
[]
null
[]
package domain; public class Beschadigd extends ProductState { private Product product; public Beschadigd(Product product) { super(product); this.product = product; } @Override public void herstel(){ product.setState(product.getUitleenbaar()); } @Override public void verwijder() { product.setState(product.getVerwijderd()); } }
402
0.639304
0.639304
21
18.142857
17.367966
51
false
false
0
0
0
0
0
0
0.285714
false
false
8
b682d0453bd17dfb13ef8e162669fd26fb5aef5a
15,212,774,185,111
b8f531f2f49c142ce293388053bf341a0b66f615
/atsd-jdbc/src/main/java/com/axibase/tsd/driver/jdbc/enums/MetadataFormat.java
89f16a929246ab18c303e5a9b8de8dd241e7028f
[ "Apache-2.0" ]
permissive
axibase/atsd-jdbc
https://github.com/axibase/atsd-jdbc
d97b0ce20827611e08d2660f3c3329f05b91676e
29336f61a98fcc597aef06650f64a36bf00e6108
refs/heads/master
2022-11-30T00:29:43.981000
2021-10-30T14:56:09
2021-10-30T14:56:09
49,562,317
10
7
Apache-2.0
false
2022-11-15T23:51:14
2016-01-13T09:06:00
2021-10-30T14:56:12
2022-11-15T23:51:09
18,873
6
4
4
Java
false
false
package com.axibase.tsd.driver.jdbc.enums; public enum MetadataFormat { NONE, HEADER, EMBED, COMMENTS }
UTF-8
Java
121
java
MetadataFormat.java
Java
[]
null
[]
package com.axibase.tsd.driver.jdbc.enums; public enum MetadataFormat { NONE, HEADER, EMBED, COMMENTS }
121
0.677686
0.677686
8
14.125
13.22344
42
false
false
0
0
0
0
0
0
0.5
false
false
8
3183e2bdc92e32e31e4e6eb1015933a17286eba7
10,582,799,456,428
d2bc4c72b7d7fe10c5848c29399c6c9c303cfd2d
/jargon-data-utils/src/test/java/org/irods/jargon/datautils/filearchive/LocalFileGzipCompressorTest.java
355e589af26c6abba877f45b6c1c697d3e538235
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
DICE-UNC/jargon
https://github.com/DICE-UNC/jargon
0fac970241ac541b0e7e963f26e6329e566a45ed
8d949c4ad3fe5bfb8415b2251c6955036225c960
refs/heads/master
2023-08-31T04:11:26.193000
2023-07-18T15:57:52
2023-08-08T20:40:10
17,224,370
26
31
NOASSERTION
false
2023-08-08T20:40:12
2014-02-26T20:31:20
2023-05-10T11:19:27
2023-08-08T20:40:10
13,425
29
29
96
Java
false
false
package org.irods.jargon.datautils.filearchive; import java.io.File; import java.util.Properties; import org.irods.jargon.core.connection.SettableJargonProperties; import org.irods.jargon.core.connection.SettableJargonPropertiesMBean; import org.irods.jargon.core.pub.IRODSFileSystem; import org.irods.jargon.testutils.TestingPropertiesHelper; import org.irods.jargon.testutils.filemanip.FileGenerator; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; public class LocalFileGzipCompressorTest { private static Properties testingProperties = new Properties(); private static org.irods.jargon.testutils.filemanip.ScratchFileUtils scratchFileUtils = null; public static final String IRODS_TEST_SUBDIR_PATH = "LocalFileGzipCompressorTest"; private static org.irods.jargon.testutils.IRODSTestSetupUtilities irodsTestSetupUtilities = null; private static IRODSFileSystem irodsFileSystem = null; @BeforeClass public static void setUpBeforeClass() throws Exception { irodsFileSystem = IRODSFileSystem.instance(); SettableJargonPropertiesMBean settableJargonProperties = new SettableJargonProperties( irodsFileSystem.getJargonProperties()); settableJargonProperties.setInternalCacheBufferSize(-1); settableJargonProperties.setInternalOutputStreamBufferSize(65535); irodsFileSystem.getIrodsSession().setJargonProperties(settableJargonProperties); org.irods.jargon.testutils.TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper(); testingProperties = testingPropertiesLoader.getTestProperties(); scratchFileUtils = new org.irods.jargon.testutils.filemanip.ScratchFileUtils(testingProperties); scratchFileUtils.clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH); irodsTestSetupUtilities = new org.irods.jargon.testutils.IRODSTestSetupUtilities(); irodsTestSetupUtilities.clearIrodsScratchDirectory(); irodsTestSetupUtilities.initializeIrodsScratchDirectory(); irodsTestSetupUtilities.initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH); } @Test public void testUnzipAGzipFile() throws Exception { String rootCollection = "testUnzipAGzipFile"; String targetTarFile = "testUnzipAGzipFile.tar"; String localCollectionAbsolutePath = scratchFileUtils .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + '/' + rootCollection); String tarParentCollection = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); File tarFile = new File(tarParentCollection, targetTarFile); FileGenerator.generateManyFilesAndCollectionsInParentCollectionByAbsolutePath(localCollectionAbsolutePath, rootCollection, 2, 3, 2, "testFile", ".txt", 3, 2, 1, 200); LocalTarFileArchiver archiver = new LocalTarFileArchiver(localCollectionAbsolutePath, tarFile.getAbsolutePath()); File tarredFile = archiver.createArchive(); LocalFileGzipCompressor localFileGzipCompressor = new LocalFileGzipCompressor(); File zippedFile = localFileGzipCompressor.compress(tarredFile.getAbsolutePath()); tarredFile.delete(); File unzippedFile = localFileGzipCompressor.uncompress(zippedFile.getAbsolutePath()); Assert.assertNotNull("no file", unzippedFile); Assert.assertTrue("unzippedFile does not exist", unzippedFile.exists()); Assert.assertEquals("name should have .tar", targetTarFile, unzippedFile.getName()); } @Test public void testTarAndGzip() throws Exception { String rootCollection = "testTarAndGzip"; String targetTarFile = "testTarAndGzip.tar"; String localCollectionAbsolutePath = scratchFileUtils .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + '/' + rootCollection); String tarParentCollection = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); File tarFile = new File(tarParentCollection, targetTarFile); FileGenerator.generateManyFilesAndCollectionsInParentCollectionByAbsolutePath(localCollectionAbsolutePath, rootCollection, 2, 3, 2, "testFile", ".txt", 3, 2, 1, 200); LocalTarFileArchiver archiver = new LocalTarFileArchiver(localCollectionAbsolutePath, tarFile.getAbsolutePath()); File tarredFile = archiver.createArchive(); LocalFileGzipCompressor localFileGzipCompressor = new LocalFileGzipCompressor(); File zippedFile = localFileGzipCompressor.compress(tarredFile.getAbsolutePath()); Assert.assertNotNull("no file", zippedFile); Assert.assertTrue("compressed file does not exist", zippedFile.exists()); Assert.assertEquals("name should have .gzip appended", targetTarFile + ".gzip", zippedFile.getName()); } }
UTF-8
Java
4,563
java
LocalFileGzipCompressorTest.java
Java
[]
null
[]
package org.irods.jargon.datautils.filearchive; import java.io.File; import java.util.Properties; import org.irods.jargon.core.connection.SettableJargonProperties; import org.irods.jargon.core.connection.SettableJargonPropertiesMBean; import org.irods.jargon.core.pub.IRODSFileSystem; import org.irods.jargon.testutils.TestingPropertiesHelper; import org.irods.jargon.testutils.filemanip.FileGenerator; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; public class LocalFileGzipCompressorTest { private static Properties testingProperties = new Properties(); private static org.irods.jargon.testutils.filemanip.ScratchFileUtils scratchFileUtils = null; public static final String IRODS_TEST_SUBDIR_PATH = "LocalFileGzipCompressorTest"; private static org.irods.jargon.testutils.IRODSTestSetupUtilities irodsTestSetupUtilities = null; private static IRODSFileSystem irodsFileSystem = null; @BeforeClass public static void setUpBeforeClass() throws Exception { irodsFileSystem = IRODSFileSystem.instance(); SettableJargonPropertiesMBean settableJargonProperties = new SettableJargonProperties( irodsFileSystem.getJargonProperties()); settableJargonProperties.setInternalCacheBufferSize(-1); settableJargonProperties.setInternalOutputStreamBufferSize(65535); irodsFileSystem.getIrodsSession().setJargonProperties(settableJargonProperties); org.irods.jargon.testutils.TestingPropertiesHelper testingPropertiesLoader = new TestingPropertiesHelper(); testingProperties = testingPropertiesLoader.getTestProperties(); scratchFileUtils = new org.irods.jargon.testutils.filemanip.ScratchFileUtils(testingProperties); scratchFileUtils.clearAndReinitializeScratchDirectory(IRODS_TEST_SUBDIR_PATH); irodsTestSetupUtilities = new org.irods.jargon.testutils.IRODSTestSetupUtilities(); irodsTestSetupUtilities.clearIrodsScratchDirectory(); irodsTestSetupUtilities.initializeIrodsScratchDirectory(); irodsTestSetupUtilities.initializeDirectoryForTest(IRODS_TEST_SUBDIR_PATH); } @Test public void testUnzipAGzipFile() throws Exception { String rootCollection = "testUnzipAGzipFile"; String targetTarFile = "testUnzipAGzipFile.tar"; String localCollectionAbsolutePath = scratchFileUtils .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + '/' + rootCollection); String tarParentCollection = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); File tarFile = new File(tarParentCollection, targetTarFile); FileGenerator.generateManyFilesAndCollectionsInParentCollectionByAbsolutePath(localCollectionAbsolutePath, rootCollection, 2, 3, 2, "testFile", ".txt", 3, 2, 1, 200); LocalTarFileArchiver archiver = new LocalTarFileArchiver(localCollectionAbsolutePath, tarFile.getAbsolutePath()); File tarredFile = archiver.createArchive(); LocalFileGzipCompressor localFileGzipCompressor = new LocalFileGzipCompressor(); File zippedFile = localFileGzipCompressor.compress(tarredFile.getAbsolutePath()); tarredFile.delete(); File unzippedFile = localFileGzipCompressor.uncompress(zippedFile.getAbsolutePath()); Assert.assertNotNull("no file", unzippedFile); Assert.assertTrue("unzippedFile does not exist", unzippedFile.exists()); Assert.assertEquals("name should have .tar", targetTarFile, unzippedFile.getName()); } @Test public void testTarAndGzip() throws Exception { String rootCollection = "testTarAndGzip"; String targetTarFile = "testTarAndGzip.tar"; String localCollectionAbsolutePath = scratchFileUtils .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + '/' + rootCollection); String tarParentCollection = scratchFileUtils.createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH); File tarFile = new File(tarParentCollection, targetTarFile); FileGenerator.generateManyFilesAndCollectionsInParentCollectionByAbsolutePath(localCollectionAbsolutePath, rootCollection, 2, 3, 2, "testFile", ".txt", 3, 2, 1, 200); LocalTarFileArchiver archiver = new LocalTarFileArchiver(localCollectionAbsolutePath, tarFile.getAbsolutePath()); File tarredFile = archiver.createArchive(); LocalFileGzipCompressor localFileGzipCompressor = new LocalFileGzipCompressor(); File zippedFile = localFileGzipCompressor.compress(tarredFile.getAbsolutePath()); Assert.assertNotNull("no file", zippedFile); Assert.assertTrue("compressed file does not exist", zippedFile.exists()); Assert.assertEquals("name should have .gzip appended", targetTarFile + ".gzip", zippedFile.getName()); } }
4,563
0.819417
0.814157
104
42.875
36.090614
109
false
false
0
0
0
0
0
0
2.048077
false
false
8
5898c5b5513855b797b8d131b6e0f3b6bfbf84b1
29,274,497,110,182
f4be343a6d4cd0313a959e99c3c98d3961901ddb
/src/main/java/com/jamesdpeters/cpu/DMATransfer.java
30d6530ddfcbd54e5ff8cf4fe7d8ba01872271a5
[]
no_license
JamesPeters98/JavaGameboyEmulator
https://github.com/JamesPeters98/JavaGameboyEmulator
5713e1498dcfa79409905446b231489da64fa972
7d4c7a8c699dd0d0f358dbf40ddbf6f3369071e2
refs/heads/master
2022-11-23T07:08:02.757000
2020-06-23T14:46:10
2020-06-23T14:46:10
268,276,781
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jamesdpeters.cpu; import com.jamesdpeters.Utils; import com.jamesdpeters.memory.MemoryBus; public class DMATransfer { private static int startAddress; private static int offset; private static final int TRANSFER_TIME = 160; //Machine cycles. private static int currentTime; /** * @param address value of the FF46 register. */ public static void start(int address){ MemoryBus.isDMATransferActive = true; startAddress = (address & 0xFF) * 0x100; offset = 0; } public static void tick(int delta){ if(MemoryBus.isDMATransferActive) { transfer(delta); currentTime += delta; if (currentTime >= TRANSFER_TIME * 4) { currentTime = 0; MemoryBus.isDMATransferActive = false; } } } private static void transfer(int delta){ int cycles = delta/4; int start = startAddress+offset; for(int i=0; i<cycles; i++){ int dest = offset+i; if(dest >= 160) break; int address = start+i; int mem = MemoryBus.getByteDuringDMA(address); MemoryBus.writeByteDuringDMA(MemoryBus.Bank.OAM.getStartAddress()+dest,mem); // System.out.println("OAM DMA Transfer: From: "+ Utils.intToString(address)+" = "+Utils.intToString(mem)+" To: "+Utils.intToString(MemoryBus.Bank.OAM.getStartAddress()+dest)); } offset += cycles; } }
UTF-8
Java
1,493
java
DMATransfer.java
Java
[]
null
[]
package com.jamesdpeters.cpu; import com.jamesdpeters.Utils; import com.jamesdpeters.memory.MemoryBus; public class DMATransfer { private static int startAddress; private static int offset; private static final int TRANSFER_TIME = 160; //Machine cycles. private static int currentTime; /** * @param address value of the FF46 register. */ public static void start(int address){ MemoryBus.isDMATransferActive = true; startAddress = (address & 0xFF) * 0x100; offset = 0; } public static void tick(int delta){ if(MemoryBus.isDMATransferActive) { transfer(delta); currentTime += delta; if (currentTime >= TRANSFER_TIME * 4) { currentTime = 0; MemoryBus.isDMATransferActive = false; } } } private static void transfer(int delta){ int cycles = delta/4; int start = startAddress+offset; for(int i=0; i<cycles; i++){ int dest = offset+i; if(dest >= 160) break; int address = start+i; int mem = MemoryBus.getByteDuringDMA(address); MemoryBus.writeByteDuringDMA(MemoryBus.Bank.OAM.getStartAddress()+dest,mem); // System.out.println("OAM DMA Transfer: From: "+ Utils.intToString(address)+" = "+Utils.intToString(mem)+" To: "+Utils.intToString(MemoryBus.Bank.OAM.getStartAddress()+dest)); } offset += cycles; } }
1,493
0.604823
0.592766
48
30.104166
30.741692
187
false
false
0
0
0
0
0
0
0.541667
false
false
8
f18993febfdabe245b9a8db187abae7451b77f44
23,974,507,487,066
faaa71ce096795466c884bb2c2b571d7d72f3924
/src/ExampleClass.java
52d19daec9e10b79b9407a9b9299608c258b20cf
[]
no_license
Angiz/JavaTesterTraining
https://github.com/Angiz/JavaTesterTraining
0f057e636ad2fb436d8f0cba985b24b31ca2b336
a1afab5f7825fca5b6fc47499161b33929ccb8f7
refs/heads/master
2023-03-11T21:50:37.980000
2021-02-22T17:39:39
2021-02-22T17:39:39
343,782,538
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class ExampleClass { //mała rozgrzewka :) public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Podaj liczbę 1: "); int liczba1 = scanner.nextInt(); System.out.println("Podaj liczbę 2: "); int liczba2 = scanner.nextInt(); int wynikDodawania = liczba1 + liczba2; int wynikOdejmowania = liczba1 - liczba2; int wynikMnozenia = liczba1 * liczba2; int wynikDzielenia = liczba1 / liczba2; int wynikModulo = liczba1%liczba2; System.out.println("Wynik dodawania: " + wynikDodawania); System.out.println("Wynik odejmowania: " + wynikOdejmowania); System.out.println("Wynik mnożenia: " + wynikMnozenia); System.out.println("Wynik dzielenia: " + wynikDzielenia); System.out.println("Wynik modulo: " + wynikModulo); } }
UTF-8
Java
930
java
ExampleClass.java
Java
[]
null
[]
import java.util.Scanner; public class ExampleClass { //mała rozgrzewka :) public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Podaj liczbę 1: "); int liczba1 = scanner.nextInt(); System.out.println("Podaj liczbę 2: "); int liczba2 = scanner.nextInt(); int wynikDodawania = liczba1 + liczba2; int wynikOdejmowania = liczba1 - liczba2; int wynikMnozenia = liczba1 * liczba2; int wynikDzielenia = liczba1 / liczba2; int wynikModulo = liczba1%liczba2; System.out.println("Wynik dodawania: " + wynikDodawania); System.out.println("Wynik odejmowania: " + wynikOdejmowania); System.out.println("Wynik mnożenia: " + wynikMnozenia); System.out.println("Wynik dzielenia: " + wynikDzielenia); System.out.println("Wynik modulo: " + wynikModulo); } }
930
0.640389
0.62527
25
36.040001
22.626497
69
false
false
0
0
0
0
0
0
0.64
false
false
8
64abcc7b9d93b0c32324dc7e4b01d614d7ef933a
13,099,650,258,086
21cf9815da21241ba605d527b4121ae92b482d92
/.metadata/.plugins/org.eclipse.core.resources/.history/9c/2072803b5e8100141a3dc68ed2533243
8805415cec62a7b520194592c12f3067d4ca1ba4
[]
no_license
claireedgcumbe/thesis
https://github.com/claireedgcumbe/thesis
27113e611752a437d152550dda9e0943823267cd
cca654f5cab85672b6455b57e1f04e175ee8b2b0
refs/heads/master
2020-04-06T05:41:39.037000
2014-12-13T00:20:24
2014-12-13T00:20:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/************************************************************************* "FreePastry" Peer-to-Peer Application Development Substrate Copyright 2002, Rice University. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Rice University (RICE) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. This software is provided by RICE and the contributors on an "as is" basis, without any representations or warranties of any kind, express or implied including, but not limited to, representations or warranties of non-infringement, merchantability or fitness for a particular purpose. In no event shall RICE or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. ********************************************************************************/ package rice.pastry.testing; import rice.pastry.direct.TestRecord; /** * PingAddress A performance test suite for pastry. * * @version $Id: PingTestRecord.java 2805 2005-11-17 16:22:24Z jeffh $ * @author Rongmei Zhang */ public class PingTestRecord extends TestRecord { private int nIndex; private int nHops[]; private double fProb[]; private double fHops; private double fDistance = 0; /** * Constructor for PingTestRecord. * * @param n DESCRIBE THE PARAMETER * @param k DESCRIBE THE PARAMETER * @param baseBitLength DESCRIBE THE PARAMETER */ public PingTestRecord(int n, int k, int baseBitLength) { super(n, k); nIndex = (int) Math.ceil(Math.log(n) / Math.log(Math.pow(2, baseBitLength))); nIndex *= 3; nHops = new int[nIndex * 2]; fProb = new double[nIndex * 2]; } /** * Gets the AveHops attribute of the PingTestRecord object * * @return The AveHops value */ public double getAveHops() { return fHops; } /** * Gets the AveDistance attribute of the PingTestRecord object * * @return The AveDistance value */ public double getAveDistance() { return fDistance; } /** * Gets the Probability attribute of the PingTestRecord object * * @return The Probability value */ public double[] getProbability() { return fProb; } /** * DESCRIBE THE METHOD */ public void doneTest() { int i; //calculate averages ... long sum = 0; for (i = 0; i < nIndex; i++) { sum += nHops[i] * i; } fHops = ((double) sum) / nTests; fDistance = fDistance / nTests; for (i = 0; i < nIndex; i++) { fProb[i] = i * nHops[i] / ((double) sum); } } /** * Adds a feature to the Hops attribute of the PingTestRecord object * * @param index The feature to be added to the Hops attribute */ public void addHops(int index) { nHops[index]++; } /** * Adds a feature to the Distance attribute of the PingTestRecord object * * @param rDistance The feature to be added to the Distance attribute */ public void addDistance(double rDistance) { fDistance += rDistance; } }
UTF-8
Java
3,909
2072803b5e8100141a3dc68ed2533243
Java
[ { "context": "PingTestRecord.java 2805 2005-11-17 16:22:24Z jeffh $\n * @author Rongmei Zhang\n */\n\npublic class Ping", "end": 1934, "score": 0.6502714157104492, "start": 1933, "tag": "USERNAME", "value": "h" }, { "context": ".java 2805 2005-11-17 16:22:24Z jeffh $\n * @author Rongmei Zhang\n */\n\npublic class PingTestRecord extends TestReco", "end": 1961, "score": 0.9998529553413391, "start": 1948, "tag": "NAME", "value": "Rongmei Zhang" } ]
null
[]
/************************************************************************* "FreePastry" Peer-to-Peer Application Development Substrate Copyright 2002, Rice University. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Rice University (RICE) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. This software is provided by RICE and the contributors on an "as is" basis, without any representations or warranties of any kind, express or implied including, but not limited to, representations or warranties of non-infringement, merchantability or fitness for a particular purpose. In no event shall RICE or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. ********************************************************************************/ package rice.pastry.testing; import rice.pastry.direct.TestRecord; /** * PingAddress A performance test suite for pastry. * * @version $Id: PingTestRecord.java 2805 2005-11-17 16:22:24Z jeffh $ * @author <NAME> */ public class PingTestRecord extends TestRecord { private int nIndex; private int nHops[]; private double fProb[]; private double fHops; private double fDistance = 0; /** * Constructor for PingTestRecord. * * @param n DESCRIBE THE PARAMETER * @param k DESCRIBE THE PARAMETER * @param baseBitLength DESCRIBE THE PARAMETER */ public PingTestRecord(int n, int k, int baseBitLength) { super(n, k); nIndex = (int) Math.ceil(Math.log(n) / Math.log(Math.pow(2, baseBitLength))); nIndex *= 3; nHops = new int[nIndex * 2]; fProb = new double[nIndex * 2]; } /** * Gets the AveHops attribute of the PingTestRecord object * * @return The AveHops value */ public double getAveHops() { return fHops; } /** * Gets the AveDistance attribute of the PingTestRecord object * * @return The AveDistance value */ public double getAveDistance() { return fDistance; } /** * Gets the Probability attribute of the PingTestRecord object * * @return The Probability value */ public double[] getProbability() { return fProb; } /** * DESCRIBE THE METHOD */ public void doneTest() { int i; //calculate averages ... long sum = 0; for (i = 0; i < nIndex; i++) { sum += nHops[i] * i; } fHops = ((double) sum) / nTests; fDistance = fDistance / nTests; for (i = 0; i < nIndex; i++) { fProb[i] = i * nHops[i] / ((double) sum); } } /** * Adds a feature to the Hops attribute of the PingTestRecord object * * @param index The feature to be added to the Hops attribute */ public void addHops(int index) { nHops[index]++; } /** * Adds a feature to the Distance attribute of the PingTestRecord object * * @param rDistance The feature to be added to the Distance attribute */ public void addDistance(double rDistance) { fDistance += rDistance; } }
3,902
0.678946
0.671271
136
27.735294
26.550793
81
false
false
0
0
0
0
0
0
0.411765
false
false
8
6754d95b25603bf774f850508bc0c3e80bb060ab
20,263,655,755,641
fbe62f160de4ab8da8e3209853eff9d1bc1fff9e
/src/android/ImagePickerGridItem.java
bf7e162dff3e3c04d225cafd3ba64ad0dd962ca7
[]
no_license
efluvi/fumi-plugin-imagepicker
https://github.com/efluvi/fumi-plugin-imagepicker
92742bdcbb6959496ba4ea33a6bab7783ae3ecce
9b9be7c0658e3e01fe9933e066b1ec4766f89e8a
refs/heads/master
2022-12-01T00:08:04.672000
2020-08-03T13:01:01
2020-08-03T13:01:01
281,345,754
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fumi.imagePicker; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import androidx.constraintlayout.widget.ConstraintLayout; import java.lang.reflect.Array; import java.util.ArrayList; public class ImagePickerGridItem extends ConstraintLayout { private ImageView imageView; private TextView selector; public ImagePickerGridItem(Context context) { super(context); View view = LayoutInflater.from(context).inflate(getResources().getIdentifier("grid_item", "layout", context.getPackageName()), this); imageView = findViewById(getResources().getIdentifier("imageView", "id", context.getPackageName())); selector = findViewById(getResources().getIdentifier("selector", "id", context.getPackageName())); } public void setScaleType(ImageView.ScaleType type){ this.imageView.setScaleType(type); } public ImageView getImageView() { return this.imageView; } public View getSelector() { return this.selector; } public void setData(int position, int selected){ // if (position == selected ) // imageView.setAlpha(0.4f); // else // imageView.setAlpha(1.0f); } public void setMultiSelect(int position, ArrayList<Integer> selected){ if (selected.contains(position)) { this.selector.setSelected(true); this.selector.setText(String.valueOf(selected.indexOf(new Integer(position))+1)); } else { this.selector.setSelected(false); this.selector.setText(""); } } }
UTF-8
Java
1,701
java
ImagePickerGridItem.java
Java
[]
null
[]
package com.fumi.imagePicker; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import androidx.constraintlayout.widget.ConstraintLayout; import java.lang.reflect.Array; import java.util.ArrayList; public class ImagePickerGridItem extends ConstraintLayout { private ImageView imageView; private TextView selector; public ImagePickerGridItem(Context context) { super(context); View view = LayoutInflater.from(context).inflate(getResources().getIdentifier("grid_item", "layout", context.getPackageName()), this); imageView = findViewById(getResources().getIdentifier("imageView", "id", context.getPackageName())); selector = findViewById(getResources().getIdentifier("selector", "id", context.getPackageName())); } public void setScaleType(ImageView.ScaleType type){ this.imageView.setScaleType(type); } public ImageView getImageView() { return this.imageView; } public View getSelector() { return this.selector; } public void setData(int position, int selected){ // if (position == selected ) // imageView.setAlpha(0.4f); // else // imageView.setAlpha(1.0f); } public void setMultiSelect(int position, ArrayList<Integer> selected){ if (selected.contains(position)) { this.selector.setSelected(true); this.selector.setText(String.valueOf(selected.indexOf(new Integer(position))+1)); } else { this.selector.setSelected(false); this.selector.setText(""); } } }
1,701
0.680776
0.677837
58
28.327587
30.318077
142
false
false
0
0
0
0
0
0
0.568965
false
false
8
527b76a51affd0b20bc8b1e8d9d0d0bae5e8fe11
4,045,859,250,104
5b002c96412aaab93fafab6fadb7f5dda9d4313b
/src/test/java/com/task/rest/model/api/response/CrudAccountResponseTest.java
3b467126f9637c3977ea4e5a1b380892241ee338
[ "MIT" ]
permissive
kotoale/revolut-test-task
https://github.com/kotoale/revolut-test-task
82d8065b222490284de7ec52e6275d531d2e0b0a
a6ffb9ac48f2db30d34c7ad780493c1b045be1fb
refs/heads/master
2021-08-27T16:47:19.453000
2021-08-22T21:35:36
2021-08-22T21:35:36
147,918,657
0
0
null
false
2021-08-22T21:14:55
2018-09-08T09:10:44
2021-08-22T21:14:36
2021-08-22T21:14:54
65
0
0
1
Java
false
false
package com.task.rest.model.api.response; import com.fasterxml.jackson.databind.ObjectMapper; import com.task.rest.model.dbo.Account; import io.dropwizard.jackson.Jackson; import org.junit.Test; import java.math.BigDecimal; import static io.dropwizard.testing.FixtureHelpers.fixture; import static org.assertj.core.api.Assertions.assertThat; /** * @author Alexander Kotov (kotov.alex.22@gmail.com) */ public class CrudAccountResponseTest { private static final ObjectMapper MAPPER = Jackson.newObjectMapper(); @Test public void testSerializationToJSON() throws Exception { Account account = new Account(1L, new BigDecimal("100.00100000")); CrudAccountResponse response = new CrudAccountResponse(account, OperationStatus.UPDATED); final String expected = MAPPER.writeValueAsString( MAPPER.readValue(fixture("fixtures/response/crud-account-response.json"), CrudAccountResponse.class)); assertThat(MAPPER.writeValueAsString(response)).isEqualTo(expected); } }
UTF-8
Java
1,031
java
CrudAccountResponseTest.java
Java
[ { "context": "tj.core.api.Assertions.assertThat;\n\n/**\n * @author Alexander Kotov (kotov.alex.22@gmail.com)\n */\npublic class CrudAc", "end": 376, "score": 0.9998447299003601, "start": 361, "tag": "NAME", "value": "Alexander Kotov" }, { "context": "ions.assertThat;\n\n/**\n * @author Alexander Kotov (kotov.alex.22@gmail.com)\n */\npublic class CrudAccountResponseTest {\n\n ", "end": 401, "score": 0.9999327063560486, "start": 378, "tag": "EMAIL", "value": "kotov.alex.22@gmail.com" } ]
null
[]
package com.task.rest.model.api.response; import com.fasterxml.jackson.databind.ObjectMapper; import com.task.rest.model.dbo.Account; import io.dropwizard.jackson.Jackson; import org.junit.Test; import java.math.BigDecimal; import static io.dropwizard.testing.FixtureHelpers.fixture; import static org.assertj.core.api.Assertions.assertThat; /** * @author <NAME> (<EMAIL>) */ public class CrudAccountResponseTest { private static final ObjectMapper MAPPER = Jackson.newObjectMapper(); @Test public void testSerializationToJSON() throws Exception { Account account = new Account(1L, new BigDecimal("100.00100000")); CrudAccountResponse response = new CrudAccountResponse(account, OperationStatus.UPDATED); final String expected = MAPPER.writeValueAsString( MAPPER.readValue(fixture("fixtures/response/crud-account-response.json"), CrudAccountResponse.class)); assertThat(MAPPER.writeValueAsString(response)).isEqualTo(expected); } }
1,006
0.760427
0.746848
31
32.290321
33.116795
118
false
false
0
0
0
0
0
0
0.516129
false
false
8
8a5cd9b30eaa0791524382cc8b499029ac977fcc
32,882,269,687,525
041558e99b220e95ec44c6f2b5506d719e459d17
/Assignment3/Ass3.java
cc976e78f2d5088fa791ce23211efb971d2486bb
[]
no_license
Abanoub-Asaad/OOP
https://github.com/Abanoub-Asaad/OOP
ab301aaac8f0adaf7a68fd9882a56738aa06434c
397edc23bce26083eb302ba876a4d61c9c59e41c
refs/heads/master
2022-07-24T05:14:44.615000
2020-05-21T13:09:09
2020-05-21T13:09:09
248,875,968
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package assignments_package; import java.awt.Color; import java.util.ArrayList; import javax.swing.ButtonGroup; import javax.swing.JOptionPane; /** * * @author Abano */ class NewJFrame extends javax.swing.JFrame { ButtonGroup button_group = new ButtonGroup(); /** * Creates new form NewJFrame */ public NewJFrame() { initComponents(); button_group.add(jRadioButton1); button_group.add(jRadioButton2); jRadioButton1.setSelected(true); jTextField4.setEditable(false); jTextField4.setBackground(Color.gray); setLayout(null); setDefaultCloseOperation(NewJFrame.EXIT_ON_CLOSE);//to close the window. setLocationRelativeTo(null);//set the window location on the screen. setVisible(true);//to visible the window } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jLabel4 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText(" CD Information"); jLabel2.setText("CD Name"); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jLabel3.setText("Quantity"); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jRadioButton1.setText("Movie"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton1ActionPerformed(evt); } }); jRadioButton2.setText("Series"); jRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton2ActionPerformed(evt); } }); jLabel4.setText("Movie Duration"); jLabel5.setText("Number of Epispdes"); jButton1.setText("Add New CD"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Rent the CD"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("Retrieve CD Info"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton4.setText("Increase CD Quantity"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(56, 56, 56) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel3) .addGap(48, 48, 48) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel2) .addGap(43, 43, 43) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(188, 188, 188) .addComponent(jLabel1) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField3)) .addComponent(jRadioButton1))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(71, 71, 71) .addComponent(jLabel4))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 67, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jRadioButton2) .addGap(150, 150, 150)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField4, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(24, 24, 24)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel5) .addGap(69, 69, 69))))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(17, 17, 17) .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton1) .addComponent(jRadioButton2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton3)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton4)) .addContainerGap(20, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed jTextField3.setEditable(false); jTextField4.setEditable(true); jTextField3.setBackground(Color.gray); jTextField4.setBackground(Color.WHITE); }//GEN-LAST:event_jRadioButton2ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed String cd_name = jTextField1.getText().toString(); boolean flag = false; for (CD cd_obj : Assignment.CDs) { if (cd_name.equals(cd_obj.getName())) { flag = true; if (cd_obj.getQuanitity() > 0) { cd_obj.setQuanitity(cd_obj.getQuanitity() - 1); JOptionPane.showMessageDialog(Assignment.frame, "Rented"); } else { JOptionPane.showMessageDialog(Assignment.frame, "This CD isn't exist in the stock"); } break; } } if (!flag) { if (jTextField1.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(this, "The CD isn't exist", "Input Error", JOptionPane.ERROR_MESSAGE); } } }//GEN-LAST:event_jButton2ActionPerformed private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed jTextField3.setEditable(true); jTextField4.setEditable(false); jTextField4.setBackground(Color.gray); jTextField3.setBackground(Color.WHITE); }//GEN-LAST:event_jRadioButton1ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String cd_name = jTextField1.getText().toString(); if (jRadioButton1.isSelected()) { if (jTextField1.getText().trim().isEmpty() || jTextField2.getText().trim().isEmpty() || jTextField3.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { try { int cd_quantity = Integer.parseInt(jTextField2.getText()); float movie_duration = Float.parseFloat(jTextField3.getText()); CD obj = new Movie(cd_name, cd_quantity, movie_duration); Assignment.CDs.add(obj); JOptionPane.showMessageDialog(Assignment.frame, "The Movie is added successfully"); jTextField1.setText(null); jTextField2.setText(null); jTextField3.setText(null); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(this, "You must enter quantity and movie duration as numbers", "Input Error", JOptionPane.ERROR_MESSAGE); } } } else { if (jTextField1.getText().trim().isEmpty() || jTextField2.getText().trim().isEmpty() || jTextField4.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { try { int cd_quantity = Integer.parseInt(jTextField2.getText()); int series_numOfEpisodes = Integer.parseInt(jTextField4.getText()); CD obj = new Series(cd_name, cd_quantity, series_numOfEpisodes); Assignment.CDs.add(obj); JOptionPane.showMessageDialog(Assignment.frame, "The Series is added successfully"); jTextField1.setText(null); jTextField2.setText(null); jTextField4.setText(null); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(this, "You must enter quantity as numbers", "Input Error", JOptionPane.ERROR_MESSAGE); } } } }//GEN-LAST:event_jButton1ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed String cd_name = jTextField1.getText().toString(); boolean flag = false; for (CD cd_obj : Assignment.CDs) { if (cd_name.equals(cd_obj.getName())) { flag = true; JOptionPane.showMessageDialog(Assignment.frame, "CD Name : " + cd_name + "\n" + "CD Quantity : " + cd_obj.getQuanitity()); } } if (!flag) { if (jTextField1.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(this, "The CD isn't exist", "Input Error", JOptionPane.ERROR_MESSAGE); } } }//GEN-LAST:event_jButton3ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed String cd_name = jTextField1.getText().toString(); boolean flag = false; for (CD cd_obj : Assignment.CDs) { if (cd_name.equals(cd_obj.getName())) { flag = true; if (jTextField2.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { try { int cd_quantity = Integer.parseInt(jTextField2.getText()); cd_obj.setQuanitity(cd_obj.getQuanitity() + cd_quantity); JOptionPane.showMessageDialog(Assignment.frame, "The Quantity is increased"); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(this, "You must enter quantity as numbers", "Input Error", JOptionPane.ERROR_MESSAGE); } } break; } } if (!flag) { if (jTextField1.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(this, "The CD isn't exist", "Input Error", JOptionPane.ERROR_MESSAGE); } } }//GEN-LAST:event_jButton4ActionPerformed private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration//GEN-END:variables } class Assignment { public static NewJFrame frame; public static ArrayList<CD> CDs; public static void main(String[] args) { frame = new NewJFrame(); CDs = new ArrayList<CD>(); } } class CD { private final String Name; private int quanitity; public CD(String Name, int quanitity) { this.Name = Name; this.quanitity = quanitity; } public final void increaseTheCDQuantity(int additionalQuantity) { } public String getName() { return Name; } public void setQuanitity(int quanitity) { this.quanitity = quanitity; } public int getQuanitity() { return quanitity; } } class Movie extends CD { private float duration; public Movie(String Name, int quantity, float duration) { super(Name, quantity); } public float getDuration() { return duration; } } class Series extends CD { private int numberOfEpisodes; public Series(String Name, int quanitity, int numberOfEpisodes) { super(Name, quanitity); this.numberOfEpisodes = numberOfEpisodes; } public int getNumberOfEpisodes() { return numberOfEpisodes; } }
UTF-8
Java
22,423
java
Ass3.java
Java
[ { "context": "import javax.swing.JOptionPane;\n\n/**\n *\n * @author Abano\n */\nclass NewJFrame extends javax.swing.JFrame {\n", "end": 169, "score": 0.9973070621490479, "start": 164, "tag": "NAME", "value": "Abano" } ]
null
[]
package assignments_package; import java.awt.Color; import java.util.ArrayList; import javax.swing.ButtonGroup; import javax.swing.JOptionPane; /** * * @author Abano */ class NewJFrame extends javax.swing.JFrame { ButtonGroup button_group = new ButtonGroup(); /** * Creates new form NewJFrame */ public NewJFrame() { initComponents(); button_group.add(jRadioButton1); button_group.add(jRadioButton2); jRadioButton1.setSelected(true); jTextField4.setEditable(false); jTextField4.setBackground(Color.gray); setLayout(null); setDefaultCloseOperation(NewJFrame.EXIT_ON_CLOSE);//to close the window. setLocationRelativeTo(null);//set the window location on the screen. setVisible(true);//to visible the window } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jLabel4 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText(" CD Information"); jLabel2.setText("CD Name"); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jLabel3.setText("Quantity"); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jRadioButton1.setText("Movie"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton1ActionPerformed(evt); } }); jRadioButton2.setText("Series"); jRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton2ActionPerformed(evt); } }); jLabel4.setText("Movie Duration"); jLabel5.setText("Number of Epispdes"); jButton1.setText("Add New CD"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Rent the CD"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("Retrieve CD Info"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton4.setText("Increase CD Quantity"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(56, 56, 56) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel3) .addGap(48, 48, 48) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel2) .addGap(43, 43, 43) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(188, 188, 188) .addComponent(jLabel1) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField3)) .addComponent(jRadioButton1))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(71, 71, 71) .addComponent(jLabel4))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 67, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jRadioButton2) .addGap(150, 150, 150)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField4, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(24, 24, 24)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel5) .addGap(69, 69, 69))))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(17, 17, 17) .addComponent(jLabel1) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton1) .addComponent(jRadioButton2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton3)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton4)) .addContainerGap(20, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed jTextField3.setEditable(false); jTextField4.setEditable(true); jTextField3.setBackground(Color.gray); jTextField4.setBackground(Color.WHITE); }//GEN-LAST:event_jRadioButton2ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed String cd_name = jTextField1.getText().toString(); boolean flag = false; for (CD cd_obj : Assignment.CDs) { if (cd_name.equals(cd_obj.getName())) { flag = true; if (cd_obj.getQuanitity() > 0) { cd_obj.setQuanitity(cd_obj.getQuanitity() - 1); JOptionPane.showMessageDialog(Assignment.frame, "Rented"); } else { JOptionPane.showMessageDialog(Assignment.frame, "This CD isn't exist in the stock"); } break; } } if (!flag) { if (jTextField1.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(this, "The CD isn't exist", "Input Error", JOptionPane.ERROR_MESSAGE); } } }//GEN-LAST:event_jButton2ActionPerformed private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed jTextField3.setEditable(true); jTextField4.setEditable(false); jTextField4.setBackground(Color.gray); jTextField3.setBackground(Color.WHITE); }//GEN-LAST:event_jRadioButton1ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String cd_name = jTextField1.getText().toString(); if (jRadioButton1.isSelected()) { if (jTextField1.getText().trim().isEmpty() || jTextField2.getText().trim().isEmpty() || jTextField3.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { try { int cd_quantity = Integer.parseInt(jTextField2.getText()); float movie_duration = Float.parseFloat(jTextField3.getText()); CD obj = new Movie(cd_name, cd_quantity, movie_duration); Assignment.CDs.add(obj); JOptionPane.showMessageDialog(Assignment.frame, "The Movie is added successfully"); jTextField1.setText(null); jTextField2.setText(null); jTextField3.setText(null); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(this, "You must enter quantity and movie duration as numbers", "Input Error", JOptionPane.ERROR_MESSAGE); } } } else { if (jTextField1.getText().trim().isEmpty() || jTextField2.getText().trim().isEmpty() || jTextField4.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { try { int cd_quantity = Integer.parseInt(jTextField2.getText()); int series_numOfEpisodes = Integer.parseInt(jTextField4.getText()); CD obj = new Series(cd_name, cd_quantity, series_numOfEpisodes); Assignment.CDs.add(obj); JOptionPane.showMessageDialog(Assignment.frame, "The Series is added successfully"); jTextField1.setText(null); jTextField2.setText(null); jTextField4.setText(null); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(this, "You must enter quantity as numbers", "Input Error", JOptionPane.ERROR_MESSAGE); } } } }//GEN-LAST:event_jButton1ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed String cd_name = jTextField1.getText().toString(); boolean flag = false; for (CD cd_obj : Assignment.CDs) { if (cd_name.equals(cd_obj.getName())) { flag = true; JOptionPane.showMessageDialog(Assignment.frame, "CD Name : " + cd_name + "\n" + "CD Quantity : " + cd_obj.getQuanitity()); } } if (!flag) { if (jTextField1.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(this, "The CD isn't exist", "Input Error", JOptionPane.ERROR_MESSAGE); } } }//GEN-LAST:event_jButton3ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed String cd_name = jTextField1.getText().toString(); boolean flag = false; for (CD cd_obj : Assignment.CDs) { if (cd_name.equals(cd_obj.getName())) { flag = true; if (jTextField2.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { try { int cd_quantity = Integer.parseInt(jTextField2.getText()); cd_obj.setQuanitity(cd_obj.getQuanitity() + cd_quantity); JOptionPane.showMessageDialog(Assignment.frame, "The Quantity is increased"); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(this, "You must enter quantity as numbers", "Input Error", JOptionPane.ERROR_MESSAGE); } } break; } } if (!flag) { if (jTextField1.getText().trim().isEmpty()) { JOptionPane.showMessageDialog(this, "Please, Enter all the info", "Input Error", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(this, "The CD isn't exist", "Input Error", JOptionPane.ERROR_MESSAGE); } } }//GEN-LAST:event_jButton4ActionPerformed private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration//GEN-END:variables } class Assignment { public static NewJFrame frame; public static ArrayList<CD> CDs; public static void main(String[] args) { frame = new NewJFrame(); CDs = new ArrayList<CD>(); } } class CD { private final String Name; private int quanitity; public CD(String Name, int quanitity) { this.Name = Name; this.quanitity = quanitity; } public final void increaseTheCDQuantity(int additionalQuantity) { } public String getName() { return Name; } public void setQuanitity(int quanitity) { this.quanitity = quanitity; } public int getQuanitity() { return quanitity; } } class Movie extends CD { private float duration; public Movie(String Name, int quantity, float duration) { super(Name, quantity); } public float getDuration() { return duration; } } class Series extends CD { private int numberOfEpisodes; public Series(String Name, int quanitity, int numberOfEpisodes) { super(Name, quanitity); this.numberOfEpisodes = numberOfEpisodes; } public int getNumberOfEpisodes() { return numberOfEpisodes; } }
22,423
0.623467
0.609909
507
43.226826
38.756229
192
false
false
0
0
0
0
0
0
0.635108
false
false
8
bd291a14e954f86187f5e00db6cc3c3b1ab36637
22,926,535,429,473
8756df4d2ed79ca3770356ed0a6f46d9d9c2f64e
/src/test/java/edu/odu/cs/cs350/LErrorTest.java
1a591a7feb9b5f9e522d88a57c58e8e93e3cefcf
[]
no_license
zhPaint/CS-Classifier
https://github.com/zhPaint/CS-Classifier
014ead915fefdb6f418a1faf557573070369ff78
ef36e90487b3d56ee73e94e1fdbc2eb1f1f2342c
refs/heads/master
2020-03-18T10:49:30.924000
2018-05-24T00:44:59
2018-05-24T00:44:59
134,619,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.odu.cs.cs350; /** * */ import static org.junit.Assert.*; import java.nio.file.Path; import java.nio.file.Paths; import org.junit.Test; import edu.odu.cs.cs350.LError; /** * @author RC * */ public class LErrorTest { // Echos that arguments have been properly read in @Test public void testReadArguments(){ // simulate arguments being passed in String[] args = new String[3]; String[] emptyArgs = new String[0]; // test function LError.readArguments(args); LError.readArguments(emptyArgs); } // Convert list of string arguments to paths @Test public void testStringToPath(){ // initialize strings/paths for comparison String[] args = new String[2]; args[0] = "src/main/"; args[1] = "src/"; Path[] pth; // test function pth = LError.stringToPath(args); // assert results assertTrue(pth.length == 2); assertTrue(pth[1] instanceof Path); assertTrue(pth[1].toString() == args[1]); } // Echo and return working directory @Test public void testGetCurrentDir(){ // initialize comparison String workDir = System.getProperty("user.dir"); // test function String test = LError.getCurrentDir(); // assert results assertTrue(test == workDir); } }
UTF-8
Java
1,243
java
LErrorTest.java
Java
[ { "context": "\nimport edu.odu.cs.cs350.LError;\n\n\n\n/**\n * @author RC\n *\n */\npublic class LErrorTest {\n\n\t// Echos that ", "end": 207, "score": 0.972568690776825, "start": 205, "tag": "USERNAME", "value": "RC" } ]
null
[]
package edu.odu.cs.cs350; /** * */ import static org.junit.Assert.*; import java.nio.file.Path; import java.nio.file.Paths; import org.junit.Test; import edu.odu.cs.cs350.LError; /** * @author RC * */ public class LErrorTest { // Echos that arguments have been properly read in @Test public void testReadArguments(){ // simulate arguments being passed in String[] args = new String[3]; String[] emptyArgs = new String[0]; // test function LError.readArguments(args); LError.readArguments(emptyArgs); } // Convert list of string arguments to paths @Test public void testStringToPath(){ // initialize strings/paths for comparison String[] args = new String[2]; args[0] = "src/main/"; args[1] = "src/"; Path[] pth; // test function pth = LError.stringToPath(args); // assert results assertTrue(pth.length == 2); assertTrue(pth[1] instanceof Path); assertTrue(pth[1].toString() == args[1]); } // Echo and return working directory @Test public void testGetCurrentDir(){ // initialize comparison String workDir = System.getProperty("user.dir"); // test function String test = LError.getCurrentDir(); // assert results assertTrue(test == workDir); } }
1,243
0.670957
0.65889
64
18.421875
15.903817
51
false
false
0
0
0
0
0
0
1.296875
false
false
8
02b86f325f65b98752518527e3f5fc297ff21621
25,709,674,295,250
9776511cb2a02a6e1d9d678fa353f5a7212a5a97
/Week_04/122.MaxProfit.java
855a5edc434dcae28151f50fc672435d4b0d1edb
[]
no_license
ameryzhu/algorithm024
https://github.com/ameryzhu/algorithm024
b8a497f49f610c9c9f54edc1e334d7950e7d9898
b71b292bd3d56ac2f2e98fc53ff91a86eff1b273
refs/heads/main
2023-04-05T05:17:05.637000
2021-04-19T02:49:49
2021-04-19T02:49:49
334,369,447
1
1
null
true
2021-01-30T08:55:37
2021-01-30T08:55:36
2021-01-29T11:27:51
2021-01-05T06:46:00
4
0
0
0
null
false
false
class Solution { public int maxProfit(int[] prices) { if(prices==null||prices.length<=1){ return 0; } int profits = 0; for(int i = 0;i < prices.length-1;i++){ int delta = prices[i+1]-prices[i]; if(delta>0){ profits+=delta; } } return profits; } }
UTF-8
Java
367
java
122.MaxProfit.java
Java
[]
null
[]
class Solution { public int maxProfit(int[] prices) { if(prices==null||prices.length<=1){ return 0; } int profits = 0; for(int i = 0;i < prices.length-1;i++){ int delta = prices[i+1]-prices[i]; if(delta>0){ profits+=delta; } } return profits; } }
367
0.441417
0.422343
15
23.466667
14.628131
47
false
false
0
0
0
0
0
0
0.6
false
false
8
9654b04c5f20059b721e0cce000b34a45e27eeed
25,709,674,298,038
901f9e073131747ed44e49296682fba90ed8486d
/app/src/main/java/com/example/xkwei/gankio/models/Article.java
7d117ca01410a67e381c7935f5371cb92d9812f2
[ "Apache-2.0" ]
permissive
ShiKaiWi/GankIO
https://github.com/ShiKaiWi/GankIO
3bed55a3389515770a7f6f14ebc4b14f840e2bf7
aca7aa0e0241a2291e548431ff349ac127ead796
refs/heads/master
2021-04-29T09:23:30.512000
2017-02-06T01:57:35
2017-02-06T04:53:41
77,661,200
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.xkwei.gankio.models; import java.util.ArrayList; import java.util.Date; import java.util.List; import io.realm.RealmObject; import io.realm.annotations.Ignore; import io.realm.annotations.PrimaryKey; /** * Created by xkwei on 30/12/2016. */ public class Article extends RealmObject{ @PrimaryKey private String mId; private String mDescription; private String mImageUrl; private String mUrl; @Ignore private String mCreateDate; @Ignore private String mPublishDate; private Date mDate; private String mAuthor; private String mType; @Ignore private String mTitle; private String mTags; private boolean mIsLiked; public boolean isLiked() { return mIsLiked; } public void setLiked(boolean liked) { mIsLiked = liked; } public Article(){} public String getTitle() { return mTitle; } public void setTitle(){ String[] temp = mUrl.split("/"); mTitle = temp[temp.length-1]; } public void setTitle(String title) { mTitle = title; } public Date getDate() { return mDate; } public void setDate(Date date) { mDate = date; } public String getTags() { return mTags; } public void addTag(String tag){ if(null!= mTags) mTags += tag; else mTags = tag; } public Article(String id) { mId = id; } public String getId() { return mId; } public String getDescription() { return mDescription; } public void setDescription(String description) { mDescription = description; } public String getImageUrl() { return mImageUrl; } public void setImageUrl(String imageUrl) { mImageUrl = imageUrl; } public String getUrl() { return mUrl; } public void setUrl(String url) { mUrl = url; } public String getCreateDate() { return mCreateDate; } public void setCreateDate(String createDate) { mCreateDate = createDate; } public String getPublishDate() { return mPublishDate; } public void setPublishDate(String publishDate) { mPublishDate = publishDate; } public String getAuthor() { return mAuthor; } public void setAuthor(String author) { mAuthor = author; } public String getType() { return mType; } public void setType(String type) { mType = type; } }
UTF-8
Java
2,574
java
Article.java
Java
[ { "context": "o.realm.annotations.PrimaryKey;\n\n/**\n * Created by xkwei on 30/12/2016.\n */\n\npublic class Article extends ", "end": 246, "score": 0.9996268153190613, "start": 241, "tag": "USERNAME", "value": "xkwei" } ]
null
[]
package com.example.xkwei.gankio.models; import java.util.ArrayList; import java.util.Date; import java.util.List; import io.realm.RealmObject; import io.realm.annotations.Ignore; import io.realm.annotations.PrimaryKey; /** * Created by xkwei on 30/12/2016. */ public class Article extends RealmObject{ @PrimaryKey private String mId; private String mDescription; private String mImageUrl; private String mUrl; @Ignore private String mCreateDate; @Ignore private String mPublishDate; private Date mDate; private String mAuthor; private String mType; @Ignore private String mTitle; private String mTags; private boolean mIsLiked; public boolean isLiked() { return mIsLiked; } public void setLiked(boolean liked) { mIsLiked = liked; } public Article(){} public String getTitle() { return mTitle; } public void setTitle(){ String[] temp = mUrl.split("/"); mTitle = temp[temp.length-1]; } public void setTitle(String title) { mTitle = title; } public Date getDate() { return mDate; } public void setDate(Date date) { mDate = date; } public String getTags() { return mTags; } public void addTag(String tag){ if(null!= mTags) mTags += tag; else mTags = tag; } public Article(String id) { mId = id; } public String getId() { return mId; } public String getDescription() { return mDescription; } public void setDescription(String description) { mDescription = description; } public String getImageUrl() { return mImageUrl; } public void setImageUrl(String imageUrl) { mImageUrl = imageUrl; } public String getUrl() { return mUrl; } public void setUrl(String url) { mUrl = url; } public String getCreateDate() { return mCreateDate; } public void setCreateDate(String createDate) { mCreateDate = createDate; } public String getPublishDate() { return mPublishDate; } public void setPublishDate(String publishDate) { mPublishDate = publishDate; } public String getAuthor() { return mAuthor; } public void setAuthor(String author) { mAuthor = author; } public String getType() { return mType; } public void setType(String type) { mType = type; } }
2,574
0.599456
0.59596
137
17.788321
14.747724
52
false
false
0
0
0
0
0
0
0.335766
false
false
8
db389c24dc411832d6097d450c49eab0e2ee0cf5
7,533,372,692,184
1683e64eab6d0dd4b778e88b65cc28d793e0aff5
/Video/src/Serie.java
fc1af60f804cf6efcca8d348d051e87c3acc6740
[]
no_license
ingridmm/Video
https://github.com/ingridmm/Video
b532150fba55c31bd23ca45d9fb529e0ecce5d23
07a8e86fdc3d1945c49bd4929776b8f3dc632f41
refs/heads/master
2020-03-18T05:24:37.340000
2018-05-22T00:56:20
2018-05-22T00:56:20
134,341,082
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Serie extends Video { protected int episodios; public int getEpisodios(){ return episodios; } public void setEpisodios(int episodios){ this.episodios = episodios; } }
UTF-8
Java
225
java
Serie.java
Java
[]
null
[]
public class Serie extends Video { protected int episodios; public int getEpisodios(){ return episodios; } public void setEpisodios(int episodios){ this.episodios = episodios; } }
225
0.626667
0.626667
12
16.583334
15.483639
44
false
false
0
0
0
0
0
0
0.583333
false
false
8
b2815a8302f7e3a715c7913be11f0b84abf7aa4a
10,634,339,056,256
cef16962be110eee5aac76c633aaac10c5057859
/src/cn/mailchat/view/OverflowMenuPopo.java
94633b21a1bfe8fc1fbd334b41e8f549c261116f
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
wengz/JumpSpirit
https://github.com/wengz/JumpSpirit
12bf6eb312b97fc97b91eafcf82944c7aef42fc5
c30ec52cd030bb63971ef669f86ce5f3296c20f6
refs/heads/master
2020-02-22T14:31:35.571000
2016-07-18T08:28:48
2016-07-18T08:28:48
63,583,949
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.mailchat.view; import android.annotation.SuppressLint; import android.content.Context; import android.support.v7.internal.widget.ListPopupWindow; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.TextView; import cn.mailchat.R; public class OverflowMenuPopo { private Context mContext; private MenuAdapter mMenuAdapter; private ListPopupWindow mMenuWindow; private String[] menuArray ; private OverflowMenuPopoListener mOverflowMenuPopoListener; public OverflowMenuPopo(Context mContext, String[] menuArray, OverflowMenuPopoListener mOverflowMenuPopoListener) { this.mContext = mContext; this.menuArray = menuArray; this.mOverflowMenuPopoListener = mOverflowMenuPopoListener; } public void showMoreOptionMenu(View view) { mMenuWindow = new ListPopupWindow(mContext); if (mMenuAdapter == null) { mMenuAdapter = new MenuAdapter(); } mMenuWindow.setModal(true); mMenuWindow.setContentWidth(mContext.getResources() .getDimensionPixelSize( R.dimen.popo_main_chatting_menu_dialog_width)); mMenuWindow.setAdapter(mMenuAdapter); mMenuWindow.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mOverflowMenuPopoListener.onMenuItemClick(position); if (mMenuWindow != null) { mMenuWindow.dismiss(); mMenuWindow = null; } } }); mMenuWindow.setAnchorView(view); mMenuWindow.show(); } class MenuAdapter extends BaseAdapter { @Override public int getCount() { return menuArray.length; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @SuppressLint("InflateParams") @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = LayoutInflater.from(parent.getContext()).inflate( R.layout.item_overflow_menu, null); TextView name = (TextView) convertView.findViewById(R.id.tv_name); name.setText(menuArray[position]); return convertView; } } public interface OverflowMenuPopoListener { void onMenuItemClick(int position); } }
UTF-8
Java
2,367
java
OverflowMenuPopo.java
Java
[]
null
[]
package cn.mailchat.view; import android.annotation.SuppressLint; import android.content.Context; import android.support.v7.internal.widget.ListPopupWindow; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.TextView; import cn.mailchat.R; public class OverflowMenuPopo { private Context mContext; private MenuAdapter mMenuAdapter; private ListPopupWindow mMenuWindow; private String[] menuArray ; private OverflowMenuPopoListener mOverflowMenuPopoListener; public OverflowMenuPopo(Context mContext, String[] menuArray, OverflowMenuPopoListener mOverflowMenuPopoListener) { this.mContext = mContext; this.menuArray = menuArray; this.mOverflowMenuPopoListener = mOverflowMenuPopoListener; } public void showMoreOptionMenu(View view) { mMenuWindow = new ListPopupWindow(mContext); if (mMenuAdapter == null) { mMenuAdapter = new MenuAdapter(); } mMenuWindow.setModal(true); mMenuWindow.setContentWidth(mContext.getResources() .getDimensionPixelSize( R.dimen.popo_main_chatting_menu_dialog_width)); mMenuWindow.setAdapter(mMenuAdapter); mMenuWindow.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mOverflowMenuPopoListener.onMenuItemClick(position); if (mMenuWindow != null) { mMenuWindow.dismiss(); mMenuWindow = null; } } }); mMenuWindow.setAnchorView(view); mMenuWindow.show(); } class MenuAdapter extends BaseAdapter { @Override public int getCount() { return menuArray.length; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } @SuppressLint("InflateParams") @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = LayoutInflater.from(parent.getContext()).inflate( R.layout.item_overflow_menu, null); TextView name = (TextView) convertView.findViewById(R.id.tv_name); name.setText(menuArray[position]); return convertView; } } public interface OverflowMenuPopoListener { void onMenuItemClick(int position); } }
2,367
0.762569
0.761724
86
26.523256
20.444893
73
false
false
0
0
0
0
0
0
2.232558
false
false
8
eaac02160ac1fe9b0e6539859bfe53d3ffb45edf
30,107,720,780,954
0ae92071e24aa95b52f0e8167175d2f7650c3299
/huayitonglib/src/main/java/com/palmap/huayitonglib/utils/MapStyleManager2.java
078a4aad8feff7882c9b836e0c5dfb45fef07bdc
[]
no_license
wuxianghua/HospitalModule
https://github.com/wuxianghua/HospitalModule
af792b70f386051d13018b4030e0a4877313f10b
92f307f20bd0c2b073c2747ecade7c5418206862
refs/heads/master
2021-09-01T10:19:23.393000
2017-12-26T12:25:28
2017-12-26T12:25:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.palmap.huayitonglib.utils; import android.text.TextUtils; import android.util.Log; import com.google.gson.JsonPrimitive; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.Iterator; import java.util.regex.Pattern; /** * Created by wtm on 2017/8/21. * <p> * 尝试用分别加载 2Dheight 和 3dHeight 的方式来加载2D和3D地图 */ public class MapStyleManager2 { private String styleJson = null; private JSONObject styleJsonObj = null; public MapStyleManager2(String styleJson) { this.styleJson = styleJson; try { this.styleJsonObj = new JSONObject(this.styleJson); } catch (JSONException e) { throw new RuntimeException(e); } } public void attachStyle(FeatureCollection featureCollection, String layerName) { if (featureCollection == null || this.styleJsonObj == null) { return; } try { JSONObject layerStyle = styleJsonObj.getJSONObject("default") .getJSONObject("Area"); Log.d("mapbox", "layerStyle: " + layerStyle.toString()); JSONObject defaultFace = layerStyle.getJSONObject("renderer") .getJSONObject("default").getJSONObject("face"); JSONObject defaultOutline = layerStyle.getJSONObject("renderer") .getJSONObject("default").getJSONObject("outline"); final double defaultHeight = defaultFace.getDouble("height"); // TODO 2D 和 3D 高度 final double default2DHeight = defaultFace.getDouble("2DHeight"); final double default3DHeight = defaultFace.getDouble("3DHeight"); // 线的高度 final double defaultLineHeight = defaultFace.getDouble("lineHeight"); final String defaultColor = defaultFace.getString("color").replace("0x", "#"); final String defaultOutlineColor = defaultOutline.getString("color"); final double defaultOpacity = defaultFace.getDouble("opacity"); JSONObject configStyle = layerStyle.getJSONObject("renderer") .getJSONObject("styles"); // 匹配样式的匹配字段(优先级) JSONArray matchKeys = layerStyle.getJSONObject("renderer").getJSONArray("keys"); for (Feature feature : featureCollection.getFeatures()) { feature.addProperty("height", new JsonPrimitive(defaultHeight)); feature.addProperty("2DHeight", new JsonPrimitive(default2DHeight)); feature.addProperty("3DHeight", new JsonPrimitive(default3DHeight)); feature.addProperty("lineHeight", new JsonPrimitive(defaultLineHeight)); feature.addProperty("color", new JsonPrimitive(defaultColor)); feature.addProperty("opacity", new JsonPrimitive(defaultOpacity)); feature.addProperty("outLineColor", new JsonPrimitive(defaultOutlineColor)); String category = feature.getStringProperty("category"); Iterator<String> keys = configStyle.keys(); while (keys.hasNext()) { String key = keys.next(); // 遍历匹配 if (matchKeys != null && matchKeys.length() > 0) { for (int k = 0; k < matchKeys.length(); k++) { String feaKey = (String) matchKeys.get(k); if (feature.hasProperty(feaKey)) { String value = feature.getStringProperty(feaKey); if (Pattern.matches(key, value)) { matchFratureProperty(key, configStyle, feature); } } } } // if (Pattern.matches(key, category)) { // matchFratureProperty(key,configStyle,feature); // } // if (feature.hasProperty("address")){ // String address = feature.getStringProperty("address"); // if (Pattern.matches(key, address)){ // matchFratureProperty(key,configStyle,feature); // } // } } attachStyleByColorId(feature); } } catch (Exception e) { e.printStackTrace(); } } private void attachStyleByColorId(Feature feature) { if (feature.hasProperty("colorId")) { int colorId = feature.getNumberProperty("colorId").intValue(); Log.d(TAG, "attach: colorId " + colorId); switch (colorId) { case CANTING: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_CANTING)); break; case LOUDONG: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LOUDONG)); break; case LUOJIFENQU: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LUOJIFENQU)); break; case ZHENSHIJIYILIAOXIANGUAN: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle .COLOR_ZHENSHIJIYILIAOXIANGUAN)); feature.addProperty(NAME_CLICKABLE, new JsonPrimitive(true)); break; case YISHENGBANGONGSHIJIBANGONGRENYUANXIANGGUAN: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle .COLOR_YISHENGBANGONGSHIJIBANGONGRENYUANXIANGGUAN)); break; case GUAHAOSHOUFEI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_GUAHAOSHOUFEI)); feature.addProperty(NAME_CLICKABLE, new JsonPrimitive(true)); break; case LUMINGPOI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LUMINGPOI)); feature.addProperty(NAME_BORDER_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LUMINGPOI)); break; case TINGCHEWEI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_TINGCHEWEI)); break; case SHINEISHESHI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_SHINEISHESHI)); break; default: break; } } } // 填充属性 public void matchFratureProperty(String key, JSONObject configStyle, Feature feature) { try { JSONObject temp = configStyle.getJSONObject(key); JSONObject tempFace = temp.optJSONObject("face"); JSONObject tempOutline = temp.optJSONObject("outline"); if (tempFace != null) { // 设置高度 double tempHeight = tempFace.optDouble("height", 0); if (tempHeight != 0) { feature.addProperty("height", new JsonPrimitive(tempHeight)); } // 设置2D和3D高度 double temp2DHeight = tempFace.optDouble("2DHeight", 0); double temp3DHeight = tempFace.optDouble("3DHeight", 0); if (temp2DHeight != 0) { feature.addProperty("2DHeight", new JsonPrimitive(temp2DHeight)); } if (temp3DHeight != 0) { feature.addProperty("3DHeight", new JsonPrimitive(temp3DHeight)); } // 设置线的高度 double tempLineHeight = tempFace.optDouble("lineHeight", 0); if (tempLineHeight != 0) { feature.addProperty("lineHeight", new JsonPrimitive(tempLineHeight)); } String tempFaceColor = tempFace.optString("color"); if (!TextUtils.isEmpty(tempFaceColor)) { feature.addProperty("color", new JsonPrimitive( tempFaceColor.replace("0x", "#") )); } String tempOpacity = tempFace.optString("opacity"); if (!TextUtils.isEmpty(tempOpacity)) { feature.addProperty("opacity", new JsonPrimitive(tempOpacity)); } } if (tempOutline != null) { String tempOutLineColor = tempOutline.optString("color"); if (!TextUtils.isEmpty(tempOutLineColor)) { feature.addProperty("outLineColor", new JsonPrimitive(tempOutLineColor.replace("0x", "#"))); } } } catch (Exception e) { e.printStackTrace(); } } public static final String TAG = MapStyleManager2.class.getSimpleName(); public static final String NAME_COLOR = "color"; public static final String NAME_BORDER_COLOR = "huaxi_border_color"; public static final String NAME_CLICKABLE = "clickable"; public static final int CANTING = 1;//餐厅 public static final int LOUDONG = 2;//楼栋 public static final int LUOJIFENQU = 3;//逻辑分区 public static final int ZHENSHIJIYILIAOXIANGUAN = 4;//诊室及医疗相关 public static final int YISHENGBANGONGSHIJIBANGONGRENYUANXIANGGUAN = 5;//医生办公室及办公人员相关 public static final int GUAHAOSHOUFEI = 6;//挂号收费 public static final int LUMINGPOI = 7;//路名poi public static final int TINGCHEWEI = 9;//停车位 public static final int SHINEISHESHI = 10;//室内设施 }
UTF-8
Java
10,033
java
MapStyleManager2.java
Java
[ { "context": "import java.util.regex.Pattern;\n\n/**\n * Created by wtm on 2017/8/21.\n * <p>\n * 尝试用分别加载 2Dheight 和 3dHeig", "end": 418, "score": 0.999591588973999, "start": 415, "tag": "USERNAME", "value": "wtm" } ]
null
[]
package com.palmap.huayitonglib.utils; import android.text.TextUtils; import android.util.Log; import com.google.gson.JsonPrimitive; import com.mapbox.services.commons.geojson.Feature; import com.mapbox.services.commons.geojson.FeatureCollection; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.Iterator; import java.util.regex.Pattern; /** * Created by wtm on 2017/8/21. * <p> * 尝试用分别加载 2Dheight 和 3dHeight 的方式来加载2D和3D地图 */ public class MapStyleManager2 { private String styleJson = null; private JSONObject styleJsonObj = null; public MapStyleManager2(String styleJson) { this.styleJson = styleJson; try { this.styleJsonObj = new JSONObject(this.styleJson); } catch (JSONException e) { throw new RuntimeException(e); } } public void attachStyle(FeatureCollection featureCollection, String layerName) { if (featureCollection == null || this.styleJsonObj == null) { return; } try { JSONObject layerStyle = styleJsonObj.getJSONObject("default") .getJSONObject("Area"); Log.d("mapbox", "layerStyle: " + layerStyle.toString()); JSONObject defaultFace = layerStyle.getJSONObject("renderer") .getJSONObject("default").getJSONObject("face"); JSONObject defaultOutline = layerStyle.getJSONObject("renderer") .getJSONObject("default").getJSONObject("outline"); final double defaultHeight = defaultFace.getDouble("height"); // TODO 2D 和 3D 高度 final double default2DHeight = defaultFace.getDouble("2DHeight"); final double default3DHeight = defaultFace.getDouble("3DHeight"); // 线的高度 final double defaultLineHeight = defaultFace.getDouble("lineHeight"); final String defaultColor = defaultFace.getString("color").replace("0x", "#"); final String defaultOutlineColor = defaultOutline.getString("color"); final double defaultOpacity = defaultFace.getDouble("opacity"); JSONObject configStyle = layerStyle.getJSONObject("renderer") .getJSONObject("styles"); // 匹配样式的匹配字段(优先级) JSONArray matchKeys = layerStyle.getJSONObject("renderer").getJSONArray("keys"); for (Feature feature : featureCollection.getFeatures()) { feature.addProperty("height", new JsonPrimitive(defaultHeight)); feature.addProperty("2DHeight", new JsonPrimitive(default2DHeight)); feature.addProperty("3DHeight", new JsonPrimitive(default3DHeight)); feature.addProperty("lineHeight", new JsonPrimitive(defaultLineHeight)); feature.addProperty("color", new JsonPrimitive(defaultColor)); feature.addProperty("opacity", new JsonPrimitive(defaultOpacity)); feature.addProperty("outLineColor", new JsonPrimitive(defaultOutlineColor)); String category = feature.getStringProperty("category"); Iterator<String> keys = configStyle.keys(); while (keys.hasNext()) { String key = keys.next(); // 遍历匹配 if (matchKeys != null && matchKeys.length() > 0) { for (int k = 0; k < matchKeys.length(); k++) { String feaKey = (String) matchKeys.get(k); if (feature.hasProperty(feaKey)) { String value = feature.getStringProperty(feaKey); if (Pattern.matches(key, value)) { matchFratureProperty(key, configStyle, feature); } } } } // if (Pattern.matches(key, category)) { // matchFratureProperty(key,configStyle,feature); // } // if (feature.hasProperty("address")){ // String address = feature.getStringProperty("address"); // if (Pattern.matches(key, address)){ // matchFratureProperty(key,configStyle,feature); // } // } } attachStyleByColorId(feature); } } catch (Exception e) { e.printStackTrace(); } } private void attachStyleByColorId(Feature feature) { if (feature.hasProperty("colorId")) { int colorId = feature.getNumberProperty("colorId").intValue(); Log.d(TAG, "attach: colorId " + colorId); switch (colorId) { case CANTING: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_CANTING)); break; case LOUDONG: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LOUDONG)); break; case LUOJIFENQU: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LUOJIFENQU)); break; case ZHENSHIJIYILIAOXIANGUAN: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle .COLOR_ZHENSHIJIYILIAOXIANGUAN)); feature.addProperty(NAME_CLICKABLE, new JsonPrimitive(true)); break; case YISHENGBANGONGSHIJIBANGONGRENYUANXIANGGUAN: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle .COLOR_YISHENGBANGONGSHIJIBANGONGRENYUANXIANGGUAN)); break; case GUAHAOSHOUFEI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_GUAHAOSHOUFEI)); feature.addProperty(NAME_CLICKABLE, new JsonPrimitive(true)); break; case LUMINGPOI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LUMINGPOI)); feature.addProperty(NAME_BORDER_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_LUMINGPOI)); break; case TINGCHEWEI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_TINGCHEWEI)); break; case SHINEISHESHI: feature.addProperty(NAME_COLOR, new JsonPrimitive(HuaxiMapStyle.COLOR_SHINEISHESHI)); break; default: break; } } } // 填充属性 public void matchFratureProperty(String key, JSONObject configStyle, Feature feature) { try { JSONObject temp = configStyle.getJSONObject(key); JSONObject tempFace = temp.optJSONObject("face"); JSONObject tempOutline = temp.optJSONObject("outline"); if (tempFace != null) { // 设置高度 double tempHeight = tempFace.optDouble("height", 0); if (tempHeight != 0) { feature.addProperty("height", new JsonPrimitive(tempHeight)); } // 设置2D和3D高度 double temp2DHeight = tempFace.optDouble("2DHeight", 0); double temp3DHeight = tempFace.optDouble("3DHeight", 0); if (temp2DHeight != 0) { feature.addProperty("2DHeight", new JsonPrimitive(temp2DHeight)); } if (temp3DHeight != 0) { feature.addProperty("3DHeight", new JsonPrimitive(temp3DHeight)); } // 设置线的高度 double tempLineHeight = tempFace.optDouble("lineHeight", 0); if (tempLineHeight != 0) { feature.addProperty("lineHeight", new JsonPrimitive(tempLineHeight)); } String tempFaceColor = tempFace.optString("color"); if (!TextUtils.isEmpty(tempFaceColor)) { feature.addProperty("color", new JsonPrimitive( tempFaceColor.replace("0x", "#") )); } String tempOpacity = tempFace.optString("opacity"); if (!TextUtils.isEmpty(tempOpacity)) { feature.addProperty("opacity", new JsonPrimitive(tempOpacity)); } } if (tempOutline != null) { String tempOutLineColor = tempOutline.optString("color"); if (!TextUtils.isEmpty(tempOutLineColor)) { feature.addProperty("outLineColor", new JsonPrimitive(tempOutLineColor.replace("0x", "#"))); } } } catch (Exception e) { e.printStackTrace(); } } public static final String TAG = MapStyleManager2.class.getSimpleName(); public static final String NAME_COLOR = "color"; public static final String NAME_BORDER_COLOR = "huaxi_border_color"; public static final String NAME_CLICKABLE = "clickable"; public static final int CANTING = 1;//餐厅 public static final int LOUDONG = 2;//楼栋 public static final int LUOJIFENQU = 3;//逻辑分区 public static final int ZHENSHIJIYILIAOXIANGUAN = 4;//诊室及医疗相关 public static final int YISHENGBANGONGSHIJIBANGONGRENYUANXIANGGUAN = 5;//医生办公室及办公人员相关 public static final int GUAHAOSHOUFEI = 6;//挂号收费 public static final int LUMINGPOI = 7;//路名poi public static final int TINGCHEWEI = 9;//停车位 public static final int SHINEISHESHI = 10;//室内设施 }
10,033
0.567389
0.561387
219
43.894978
30.209812
112
false
false
0
0
0
0
0
0
0.703196
false
false
8
69974be50ee9391be4a77f545ea4722e5e72010d
25,383,256,773,105
6ed20c7c37191aa9ba5d8f42ce0d7d3c0e5b37c3
/test/m2i/atelierjava/test/StructuresDeControle.java
d09c0241e62dd54caf7de21dc36a70d32d2ebadd
[]
no_license
quicotte-formation/atelier_java
https://github.com/quicotte-formation/atelier_java
a888b10c1abf9543a6261782bd97939b9929c19e
044552ede5fa7b3579f8fc88adaf7640e814d4fe
refs/heads/master
2021-07-25T20:28:42.290000
2017-11-07T06:37:07
2017-11-07T06:37:07
109,027,335
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package m2i.atelierjava.test; import java.util.ArrayList; import java.util.Scanner; import org.junit.Test; /** * * @author Administrateur */ public class StructuresDeControle { @Test public void testDoWhile(){ int n=5; int resultat=n; do{ resultat = resultat * (n-1); n--; }while(n>1); System.out.println( resultat ); } // @Test public void testWhile(){ boolean termine = false; while(termine==false){ String choix = new Scanner( System.in ).nextLine();// Saisie clavier switch( choix ){ case "A": this.listerFilms(); break; case "B": this.ajouterFilm(); break; case "Q": termine = true; break; default: System.out.println("Commande invalide!"); break; } } } // @Test public void testFor(){ for(int i=10;i<20;i++){ int carre = i * i; System.out.println( String.format("%d²=%d", i, carre) ); } } // @Test public void testForEach() { ArrayList<String> etats = new ArrayList<>(); etats.add( "madagascar" ); etats.add( "singapour" ); etats.add( "jamaïque" ); etats.add( "la barbade" ); for (String etat : etats) { System.out.println( etat ); } } private void listerFilms() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private void ajouterFilm() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
UTF-8
Java
2,305
java
StructuresDeControle.java
Java
[ { "context": "er;\r\nimport org.junit.Test;\r\n\r\n/**\r\n *\r\n * @author Administrateur\r\n */\r\npublic class StructuresDeControle {\r\n\r\n ", "end": 339, "score": 0.9965222477912903, "start": 325, "tag": "NAME", "value": "Administrateur" }, { "context": "new ArrayList<>();\r\n \r\n etats.add( \"madagascar\" );\r\n etats.add( \"singapour\" );\r\n e", "end": 1705, "score": 0.9981984496116638, "start": 1695, "tag": "NAME", "value": "madagascar" }, { "context": " etats.add( \"madagascar\" );\r\n etats.add( \"singapour\" );\r\n etats.add( \"jamaïque\" );\r\n et", "end": 1740, "score": 0.8102582097053528, "start": 1731, "tag": "NAME", "value": "singapour" }, { "context": "tats.add( \"singapour\" );\r\n etats.add( \"jamaïque\" );\r\n etats.add( \"la barbade\" );\r\n ", "end": 1774, "score": 0.6990850567817688, "start": 1770, "tag": "NAME", "value": "ïque" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package m2i.atelierjava.test; import java.util.ArrayList; import java.util.Scanner; import org.junit.Test; /** * * @author Administrateur */ public class StructuresDeControle { @Test public void testDoWhile(){ int n=5; int resultat=n; do{ resultat = resultat * (n-1); n--; }while(n>1); System.out.println( resultat ); } // @Test public void testWhile(){ boolean termine = false; while(termine==false){ String choix = new Scanner( System.in ).nextLine();// Saisie clavier switch( choix ){ case "A": this.listerFilms(); break; case "B": this.ajouterFilm(); break; case "Q": termine = true; break; default: System.out.println("Commande invalide!"); break; } } } // @Test public void testFor(){ for(int i=10;i<20;i++){ int carre = i * i; System.out.println( String.format("%d²=%d", i, carre) ); } } // @Test public void testForEach() { ArrayList<String> etats = new ArrayList<>(); etats.add( "madagascar" ); etats.add( "singapour" ); etats.add( "jamaïque" ); etats.add( "la barbade" ); for (String etat : etats) { System.out.println( etat ); } } private void listerFilms() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } private void ajouterFilm() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
2,305
0.475901
0.471993
89
23.876404
24.189709
135
false
false
0
0
0
0
0
0
0.460674
false
false
8
93b0cf108ca6541421ddc31db2942a6e8a679648
17,841,294,198,290
270c3daafbd6ed31656ad57a73628a8e63216850
/JBCoolUtils/src/atlas/cool/payload/plugin/ClobParser.java
b7fba8ed63ecf8962ce1123fd8a5730412ae68c0
[]
no_license
andreaformica/JBCoolHub
https://github.com/andreaformica/JBCoolHub
4664c6d1e3f7ce2ec4cd779a0f79f4a582b9c32e
2328c9d4767a3130a59fd579fa89a71d8246c6f1
refs/heads/master
2021-01-01T17:21:44.583000
2015-06-18T08:00:43
2015-06-18T08:00:43
28,960,330
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package atlas.cool.payload.plugin; import java.util.Map; /** * @author formica * */ public interface ClobParser { /** * Utility method to provide a formatted output from a payload column which is structured * as a CLOB in COOL. * * @param payloadColumn * @return */ Object parseClob(String payloadColumn, String content); /** * @param payloadColumn * @return */ Map<String, Object> header(String payloadColumn); }
UTF-8
Java
462
java
ClobParser.java
Java
[ { "context": "d.plugin;\n\nimport java.util.Map;\n\n\n\n/**\n * @author formica\n *\n */\npublic interface ClobParser {\n\n\t/**\n\t * Ut", "end": 95, "score": 0.9890037775039673, "start": 88, "tag": "USERNAME", "value": "formica" } ]
null
[]
/** * */ package atlas.cool.payload.plugin; import java.util.Map; /** * @author formica * */ public interface ClobParser { /** * Utility method to provide a formatted output from a payload column which is structured * as a CLOB in COOL. * * @param payloadColumn * @return */ Object parseClob(String payloadColumn, String content); /** * @param payloadColumn * @return */ Map<String, Object> header(String payloadColumn); }
462
0.660173
0.660173
30
14.4
20.559832
91
false
false
0
0
0
0
0
0
0.666667
false
false
8
63d1755b0dbc0b8c6bdd7ee214085ccaad3148f2
28,982,439,382,233
61d7f4438b98855d4681e5bf824332387895bd12
/Week_05/starter/starter-config/src/main/java/com/tn/starter/config/AutoConfiguration.java
1b60c0d974484f22437bf7994ad37b5104cbb1ab
[]
no_license
en-o/JAVA-000
https://github.com/en-o/JAVA-000
9cee9d5337153929ce8365ace811b5ed99e1ef5b
1b667d859e6f2b384eb0b818b6a67688421a61e5
refs/heads/main
2023-02-27T06:04:19.493000
2021-02-03T13:16:28
2021-02-03T13:16:28
303,123,580
0
0
null
true
2020-10-11T13:10:46
2020-10-11T13:10:45
2020-10-11T12:21:43
2020-10-09T10:25:30
2
0
0
0
null
false
false
package com.tn.starter.config; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; /** * @author tn * @version 1 * @ClassName AutoConfigrution * @description * @date 2020/11/17 20:47 */ @Configuration @Import({KlassConfiguration.class, SchoolConfiguration.class}) public class AutoConfiguration { }
UTF-8
Java
370
java
AutoConfiguration.java
Java
[ { "context": "amework.context.annotation.Import;\n\n/**\n * @author tn\n * @version 1\n * @ClassName AutoConfigrution\n * @", "end": 165, "score": 0.9985432624816895, "start": 163, "tag": "USERNAME", "value": "tn" } ]
null
[]
package com.tn.starter.config; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; /** * @author tn * @version 1 * @ClassName AutoConfigrution * @description * @date 2020/11/17 20:47 */ @Configuration @Import({KlassConfiguration.class, SchoolConfiguration.class}) public class AutoConfiguration { }
370
0.778378
0.743243
16
22.125
20.383434
62
false
false
0
0
0
0
0
0
0.25
false
false
8
f00e38e9dd7ecaf8fc6500c08e328f7f6ea041cf
31,464,930,462,303
ebed44e7d211da90f9f92f5016fbb1fe008bcb2c
/readingScoresFromWebsite.java
1a48ae4fb8bc1dcfc210696712d5e46c0a148a2d
[]
no_license
okeohane/Java-HW-9
https://github.com/okeohane/Java-HW-9
9fadb0356008d6d53fd83b8292ee0c138fb755d5
91ac620c8c0da6c88ba88419cd85b6456ba26a4d
refs/heads/master
2020-05-27T02:48:03.639000
2019-05-24T16:49:11
2019-05-24T16:49:11
188,456,563
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package javaapplication3; import java.util.Scanner; import java.net.URL; public class JavaApplication3 { public static void main(String[] args) { int count = 0; double total = 0; try { URL website = new URL("https://turing.manhattan.edu/~ankur.agrawal/misc/scores.txt"); Scanner input = new Scanner(website.openStream()); while(input.hasNext()) { count++; total += input.nextDouble(); } System.out.println("Total = " + total); System.out.println("Average = " + total/count); } catch (java.net.MalformedURLException ex) { System.out.println("Invalid URL"); } catch(java.io.IOException ex) { System.out.println("IO Errors"); } } }
UTF-8
Java
916
java
readingScoresFromWebsite.java
Java
[ { "context": " website = new URL(\"https://turing.manhattan.edu/~ankur.agrawal/misc/scores.txt\");\n Scanner ", "end": 305, "score": 0.8908335566520691, "start": 302, "tag": "USERNAME", "value": "ank" }, { "context": "bsite = new URL(\"https://turing.manhattan.edu/~ankur.agrawal/misc/scores.txt\");\n Scanner in", "end": 307, "score": 0.5609525442123413, "start": 305, "tag": "NAME", "value": "ur" }, { "context": "ite = new URL(\"https://turing.manhattan.edu/~ankur.agrawal/misc/scores.txt\");\n Scanner input", "end": 310, "score": 0.7984145879745483, "start": 308, "tag": "USERNAME", "value": "ag" }, { "context": " = new URL(\"https://turing.manhattan.edu/~ankur.agrawal/misc/scores.txt\");\n Scanner input = ne", "end": 315, "score": 0.754681408405304, "start": 310, "tag": "NAME", "value": "rawal" } ]
null
[]
package javaapplication3; import java.util.Scanner; import java.net.URL; public class JavaApplication3 { public static void main(String[] args) { int count = 0; double total = 0; try { URL website = new URL("https://turing.manhattan.edu/~ankur.agrawal/misc/scores.txt"); Scanner input = new Scanner(website.openStream()); while(input.hasNext()) { count++; total += input.nextDouble(); } System.out.println("Total = " + total); System.out.println("Average = " + total/count); } catch (java.net.MalformedURLException ex) { System.out.println("Invalid URL"); } catch(java.io.IOException ex) { System.out.println("IO Errors"); } } }
916
0.495633
0.491266
36
24.444445
21.236034
97
false
false
0
0
0
0
0
0
0.361111
false
false
0
ce0d6d0719a0fe24917060f9b2dfe4f2c91802d8
6,605,659,701,254
20faf0364473d4a1376656e990788ce13bb5f3e3
/src/com/company/daysofcode/strings/Operators.java
a72cfd1021d321b8cc88c376f556fafe94e7fd5d
[]
no_license
Anushka-shukla/100DaysOfCode
https://github.com/Anushka-shukla/100DaysOfCode
e60003f5bb27a97c18e027daf375dbfd42b2a39e
4b9cdcc07fed3524c4bd963396c39eb6095b9b5c
refs/heads/main
2023-08-13T21:49:49.776000
2021-09-26T18:15:57
2021-09-26T18:15:57
393,102,170
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company.daysofcode.strings; import java.util.ArrayList; public class Operators { public static void main(String[] args) { System.out.println('a' + 'b' );// operator is converting the alphabet into character value -> Adding ASCII values System.out.println("a" + "b"); // concatenation System.out.println('a'+ 3); System.out.println((char)('a'+ 3)); // type casting System.out.println("a" +1); // this is same as "a"+"1" after a few steps //integer will be converted to integer that will call toString() System.out.println("Anu" + new ArrayList<>()); // concatenated with empty array list System.out.println("Anushka" + new Integer(56)); // System.out.println( new Integer(56) + new ArrayList<>()); gives error -> 2 complex types String ans = new Integer(56) + " " + new ArrayList<>(); System.out.println(ans); } }
UTF-8
Java
932
java
Operators.java
Java
[ { "context": " will call toString()\n System.out.println(\"Anu\" + new ArrayList<>()); // concatenated with empty", "end": 607, "score": 0.9825080037117004, "start": 604, "tag": "NAME", "value": "Anu" }, { "context": "with empty array list\n System.out.println(\"Anushka\" + new Integer(56));\n // System.out.println", "end": 704, "score": 0.993388831615448, "start": 697, "tag": "NAME", "value": "Anushka" } ]
null
[]
package com.company.daysofcode.strings; import java.util.ArrayList; public class Operators { public static void main(String[] args) { System.out.println('a' + 'b' );// operator is converting the alphabet into character value -> Adding ASCII values System.out.println("a" + "b"); // concatenation System.out.println('a'+ 3); System.out.println((char)('a'+ 3)); // type casting System.out.println("a" +1); // this is same as "a"+"1" after a few steps //integer will be converted to integer that will call toString() System.out.println("Anu" + new ArrayList<>()); // concatenated with empty array list System.out.println("Anushka" + new Integer(56)); // System.out.println( new Integer(56) + new ArrayList<>()); gives error -> 2 complex types String ans = new Integer(56) + " " + new ArrayList<>(); System.out.println(ans); } }
932
0.623391
0.611588
22
41.363636
33.59457
121
false
false
0
0
0
0
0
0
0.545455
false
false
0
e438fcf26de464ff107a2bde820db2bd89e24fe1
33,715,493,306,908
f0487728aec297d3f49456bf6f4232702f12fa00
/asciily-foundation-springboot/src/main/java/com/asciily/foundation/config/motan/client/MotanClientConfiguration.java
62f6d4c34a6d1c64a2ee45acf7d507c9aadec078
[ "Apache-2.0" ]
permissive
swxiao/asciily-foundation
https://github.com/swxiao/asciily-foundation
c3aca0a80637fc2992e6d954d41d0c4c343559b5
881ca50cd47f254fbae3037d24e841f9aab1279f
refs/heads/master
2022-06-24T10:43:00.961000
2019-08-01T06:03:23
2019-08-01T06:03:23
155,304,417
0
0
Apache-2.0
false
2022-06-21T00:53:11
2018-10-30T01:17:22
2019-08-01T06:03:30
2022-06-21T00:53:08
136
0
0
1
Java
false
false
/** * Copyright [2015-2017] * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may * obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.asciily.foundation.config.motan.client; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import com.asciily.foundation.config.motan.BaseMotanConfiguration; import com.weibo.api.motan.config.springsupport.BasicRefererConfigBean; /** * * @author xiaosw<xiaosw@msn.cn> * @since 2017年1月17日 */ @Import(BaseMotanConfiguration.class) @Configurable public class MotanClientConfiguration extends BaseMotanConfiguration { @Bean public BasicRefererConfigBean basicRefererConfig() { BasicRefererConfigBean basicRefererConfig = new BasicRefererConfigBean(); basicRefererConfig.setRegistry(registryConfig()); basicRefererConfig.setProtocol(protocolConfig()); basicRefererConfig.setGroup(group); basicRefererConfig.setModule(module); basicRefererConfig.setApplication(application); basicRefererConfig.setCheck(false); basicRefererConfig.setAccessLog(true); basicRefererConfig.setRetries(2); basicRefererConfig.setThrowException(true); return basicRefererConfig; } }
UTF-8
Java
1,708
java
MotanClientConfiguration.java
Java
[ { "context": "upport.BasicRefererConfigBean;\n\n/**\n * \n * @author xiaosw<xiaosw@msn.cn>\n * @since 2017年1月17日\n */\n@Import(B", "end": 972, "score": 0.9996413588523865, "start": 966, "tag": "USERNAME", "value": "xiaosw" }, { "context": "asicRefererConfigBean;\n\n/**\n * \n * @author xiaosw<xiaosw@msn.cn>\n * @since 2017年1月17日\n */\n@Import(BaseMotanConfig", "end": 986, "score": 0.9999288320541382, "start": 973, "tag": "EMAIL", "value": "xiaosw@msn.cn" } ]
null
[]
/** * Copyright [2015-2017] * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may * obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.asciily.foundation.config.motan.client; import org.springframework.beans.factory.annotation.Configurable; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import com.asciily.foundation.config.motan.BaseMotanConfiguration; import com.weibo.api.motan.config.springsupport.BasicRefererConfigBean; /** * * @author xiaosw<<EMAIL>> * @since 2017年1月17日 */ @Import(BaseMotanConfiguration.class) @Configurable public class MotanClientConfiguration extends BaseMotanConfiguration { @Bean public BasicRefererConfigBean basicRefererConfig() { BasicRefererConfigBean basicRefererConfig = new BasicRefererConfigBean(); basicRefererConfig.setRegistry(registryConfig()); basicRefererConfig.setProtocol(protocolConfig()); basicRefererConfig.setGroup(group); basicRefererConfig.setModule(module); basicRefererConfig.setApplication(application); basicRefererConfig.setCheck(false); basicRefererConfig.setAccessLog(true); basicRefererConfig.setRetries(2); basicRefererConfig.setThrowException(true); return basicRefererConfig; } }
1,702
0.799647
0.787897
46
36
35.565617
139
false
false
0
0
0
0
0
0
1.021739
false
false
0
1cdcd1686b729ef6485e7c807ebd438de28e8a56
25,211,458,071,760
24e1ada83b54a2db124b7b0cdd1c2fa66cf2f279
/CS19A/Array/matSum.java
3a5383a31c45dfe90ff17bcf68b4e071fa5b08b7
[]
no_license
Shankar4919/DataStructureAndAlgorithm_Java
https://github.com/Shankar4919/DataStructureAndAlgorithm_Java
169bb8b0e4c00884623e3cba057a175eeb91ac76
545fac64c319643479787ce9020124bfebec6b50
refs/heads/master
2023-03-16T14:32:42.021000
2021-03-02T04:10:48
2021-03-02T04:10:48
332,373,397
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Array; public class matSum { public static void main(String[] args) { int matA[][]= {{1,2},{3,4}}; int matB[][]= {{5,6},{7,8}}; int row=matA.length; int column=matA[0].length; int matSum[][]=new int[row][column]; //calculating sum for(int i=0; i<row;i++) { for(int j=0; j<column; j++) { matSum[i][j]=matA[i][j]+matB[i][j]; } System.out.println("Value after sum: "); } //Displaying using for each loop for (int rows[]:matSum) { for (int col:rows) { System.out.print(col+" "); } System.out.println(); } } }
UTF-8
Java
580
java
matSum.java
Java
[]
null
[]
package Array; public class matSum { public static void main(String[] args) { int matA[][]= {{1,2},{3,4}}; int matB[][]= {{5,6},{7,8}}; int row=matA.length; int column=matA[0].length; int matSum[][]=new int[row][column]; //calculating sum for(int i=0; i<row;i++) { for(int j=0; j<column; j++) { matSum[i][j]=matA[i][j]+matB[i][j]; } System.out.println("Value after sum: "); } //Displaying using for each loop for (int rows[]:matSum) { for (int col:rows) { System.out.print(col+" "); } System.out.println(); } } }
580
0.553448
0.534483
32
17.125
14.679386
43
false
false
0
0
0
0
0
0
2.46875
false
false
0