blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
176c4c6f202bcd6dd729b76e4d3b4fd7622a06d3
ee442ec91db1134c9d7d73af1508b13a8b891086
/app/src/androidTest/java/com/example/thuchanhmenu/ExampleInstrumentedTest.java
e99a44ed2773b898c81e74ec48bae73745dbbc66
[]
no_license
moloidirieng/ThucHanhMenu
33c1a894d14e893a5a0331a47751763b521787b1
318734406eade41acde1ae37dbc5499a03573a0f
refs/heads/master
2020-08-26T13:52:29.067194
2019-10-23T10:39:10
2019-10-23T10:39:10
217,032,478
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.example.thuchanhmenu; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.thuchanhmenu", appContext.getPackageName()); } }
9dcfb4347e9632f3fc5c1ec26545d10fbba9850f
99bd6e7a91774b96b4c2f48c2915295a9ef6fffd
/src/main/java/com/chanon/dev/SpringdevApplication.java
cc130af807985db6a9ffc4fc579fe7606c8d35fa
[]
no_license
Ei8ht/springdev
5031c6efbf2f3c8df4e5b56b05039541707d25f6
08f4c20e29f37fada78a05527c3b05fd3a7e6ed5
refs/heads/master
2020-04-02T16:09:00.285766
2018-10-25T10:51:57
2018-10-25T10:51:57
154,600,464
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package com.chanon.dev; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringdevApplication { public static void main(String[] args) { SpringApplication.run(SpringdevApplication.class, args); } }
967dbb3f9ac8892fb5163d0f0a3186e143da60fe
fdddb901ea70fe6a620d6542a336e55c967b80b7
/Stab.java
a31ef95e7a632826da65597f846e4cd3ac342354
[]
no_license
fangch2004/vs2017
f6a086927031fcbb2448d95251a2fe35788e874d
fee10c63eab1b92f26019f8d8c5c0d945ca4620a
refs/heads/master
2021-09-04T04:35:09.471018
2018-01-15T22:11:12
2018-01-15T22:11:12
113,302,642
0
0
null
null
null
null
UTF-8
Java
false
false
692
java
public class Stab implements Mobile { double laenge_l, laenge_r; Mobile mobile_l, mobile_r; public Stab(double laenge, Mobile mobile_l, Mobile mobile_r) { super(); this.mobile_l = mobile_l; this.mobile_r = mobile_r; laenge_l=laenge; laenge_r=0; balansieren(); } @Override public double getGewicht() { return mobile_l.getGewicht()+mobile_r.getGewicht(); } @Override public void balancieren() { laenge_r=(mobile_l.getGewicht()*laenge_l)/(mobile_r.getGewicht()+mobile_l.getGewicht()); laenge_l=laenge_l-laenge_r; } @Override public String toString() { return "Links: "+this.laenge_l+", "+this.mobile_l+" Rechts: "+this.laenge_r+", "+this.mobile_r; } }
a8c8852e966bb17ebe1066e45cb721cbbee8ba27
f9b8eb47048d00c6bb9af55bac0f2eb67328058b
/Calculater/src/GUI/testGUI.java
30ea238d1e4c1b11d616d92f02e05ece903c329a
[]
no_license
ezyxz/Calculator_java
596077d367dd93db24a4f7b60ade3ebd0299508c
efb3bff797749f868cd9eb89f1b6e74c8a074274
refs/heads/master
2022-10-22T14:44:37.824683
2020-06-15T02:38:56
2020-06-15T02:38:56
272,315,121
1
0
null
null
null
null
UTF-8
Java
false
false
1,158
java
package GUI; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class testGUI { JFrame guiFrame = new JFrame("mm"); JLabel guiLabel = new JLabel("mm"); JButton guiButton = new JButton("mm"); JPanel guiPanel = new JPanel(); void creatgui() { guiPanel.setLayout(null); guiPanel.setPreferredSize(new Dimension(300,300)); guiButton.setBounds(100, 200, 100, 100); guiLabel.setBounds(120, 50,200, 20); guiPanel.add(guiButton); guiPanel.add(guiLabel); guiButton.addActionListener(new ButtonPressed()); guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.add(guiPanel); guiFrame.pack(); guiFrame.setLocationRelativeTo(null); guiFrame.setVisible(true); } public class ButtonPressed implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { guiLabel.setText("get hit"); } } public static void main(String[] args) { new testGUI().creatgui(); } }
50e3a1a13ee0381155990d3f97f56fa1da08d15f
5b5d3269306c52ff7e10b33e2b44a2d23843d71d
/Barrier.java
f3680a7335ffa1bfd52d3a5cfd5484c72e62da2a
[]
no_license
ZuqhameSkosana/Barriers
336e70cd787c8c54c827d9f701c598d3517d54f5
99d48a69516838345b3a720a96b8c528f226e1e5
refs/heads/master
2020-05-15T23:04:57.937312
2019-04-21T15:54:44
2019-04-21T15:54:44
182,542,767
1
0
null
null
null
null
UTF-8
Java
false
false
762
java
//package BarrierS; import java.util.concurrent.Semaphore; import java.util.*; public class Barrier extends Thread{ // add missing variables int num; Semaphore semaphore1; Semaphore semaphore2; int counter; //private Random snooze_time; Barrier(int n) { num=n; semaphore2 = new Semaphore(0); semaphore1= new Semaphore(1); counter=0; // complete this constructor } public void b_wait() throws InterruptedException{ // this is the only additional method you will need to complete semaphore1.acquire(); counter=counter+1; semaphore1.release(); if(counter == num){ semaphore2.release(); } semaphore2.acquire(); semaphore2.release(); } }
adaa7b7ddfd6b13e745434e8051dd6068dbf6e15
2a7fe7c827918f28e519b94679bebbc4f6153e7c
/src/Refrigerator/FridgeTimerRanOutEvent.java
54adf5e21a2568d7a8b75a6a51ccddeffb525e7b
[]
no_license
FranklinOrtega/Refrigerator
337bb06e60b3d085fdb80264fadb7af0407defa7
e2f775ac84529d3074f41328774059a0b1130e80
refs/heads/master
2020-03-07T11:38:05.070803
2018-04-24T17:31:37
2018-04-24T17:31:37
127,460,491
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package Refrigerator; import java.util.EventObject; /* * Author: Vanessa Esaw * This event is to account for event in which system updates the temperature * based on the rate given. * * Note that it will: * warm or cool the temperature, based on the state that registers with the manager for this event * rate of warming/cooling is based on the states 'initalized' conditions in the run method * */ public class FridgeTimerRanOutEvent extends EventObject { public FridgeTimerRanOutEvent(Object source) { super(source); } }
1b2fbc66fdba578e342d35c22c489bad2193a9f6
585f77a178c80bf23aafc70d0333acf18ab681f1
/src/main/java/com/teamacronymcoders/base/proxies/ModServerProxy.java
d9d6ae54096129c41a599c3832a8852f73cbfead
[ "MIT" ]
permissive
The-Acronym-Coders/BASE
7c79922157cd3af769547b776399b56c54d87ed4
6d151a087ddb53d89c749ccbaf322b523371a180
refs/heads/develop/1.12.0
2021-06-10T01:37:07.148204
2021-05-31T18:07:14
2021-05-31T18:07:14
62,005,393
18
26
null
2023-03-23T16:43:44
2016-06-26T19:43:50
Java
UTF-8
Java
false
false
650
java
package com.teamacronymcoders.base.proxies; import com.teamacronymcoders.base.Reference; import com.teamacronymcoders.base.event.BaseRegistryEvent; import com.teamacronymcoders.base.recipesystem.loader.ILoader; import com.teamacronymcoders.base.recipesystem.loader.ServerConfigJsonRecipeLoader; import net.minecraft.util.ResourceLocation; public class ModServerProxy extends ModCommonProxy { @Override public void registerServerLoader(BaseRegistryEvent<ILoader> loaderRegistryEvent) { loaderRegistryEvent.register(new ResourceLocation(Reference.MODID, "server"), ServerConfigJsonRecipeLoader.getInstance()); } }
cbb29fc7d17da61e24ebbbdc8482d4a63ae6dc94
de59a446655cb8162912f3ae1b359cf1fc79fa1d
/src/main/java/vazkii/patchouli/client/book/gui/GuiBookCategory.java
bb8aa7a6320f1ae30bbbac3e97cf6a94b2b06d48
[]
no_license
baka943/Patchouli
88f270a1de1642400abe8c10859edf815d7ed2ec
0e672d13466c6579804d64b3ea946b018e91f5ca
refs/heads/master
2020-04-06T08:33:15.780506
2018-11-12T09:47:36
2018-11-12T09:47:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,064
java
package vazkii.patchouli.client.book.gui; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import vazkii.patchouli.client.book.BookCategory; import vazkii.patchouli.client.book.BookEntry; import vazkii.patchouli.client.book.gui.button.GuiButtonCategory; import vazkii.patchouli.common.base.PatchouliConfig; import vazkii.patchouli.common.book.Book; import vazkii.patchouli.common.book.BookRegistry; public class GuiBookCategory extends GuiBookEntryList { BookCategory category; public GuiBookCategory(Book book, BookCategory category) { super(book); this.category = category; } @Override protected String getName() { return category.getName(); } @Override protected String getDescriptionText() { return category.getDescription(); } @Override protected Collection<BookEntry> getEntries() { return category.getEntries(); } @Override protected void addSubcategoryButtons() { int i = 0; List<BookCategory> categories = new ArrayList(book.contents.categories.values()); Collections.sort(categories); for(BookCategory ocategory : categories) { if(ocategory.getParentCategory() != category || ocategory.shouldHide()) continue; int x = LEFT_PAGE_X + 10 + (i % 4) * 24; int y = TOP_PADDING + PAGE_HEIGHT - (PatchouliConfig.disableAdvancementLocking ? 46 : 68); GuiButton button = new GuiButtonCategory(this, x, y, ocategory); buttonList.add(button); dependentButtons.add(button); i++; } } @Override protected boolean doesEntryCountForProgress(BookEntry entry) { return entry.getCategory() == category; } @Override public boolean equals(Object obj) { return obj == this || (obj instanceof GuiBookCategory && ((GuiBookCategory) obj).category == category && ((GuiBookCategory) obj).page == page); } @Override public boolean canBeOpened() { return !category.isLocked() && !equals(Minecraft.getMinecraft().currentScreen); } }
fcf4c65d996308a5473286fcfe66ba0e7fe0d47d
ccb7b86879cbc700d689f894770caafb43bc54b9
/app/src/main/java/com/chatwing/whitelabel/pojos/oauth/YahooJsonParams.java
bbba294a880faa138d4e83365e4b8f29a6aa6b30
[]
no_license
cuongthai/CTFayeClient
0cadf6189403b7cc94d56dfef9f6ffd1ffd3f30d
e216bdb7be4b91c2e7acf1719575e6835b8b6bf6
refs/heads/master
2016-08-11T14:43:23.698582
2015-12-17T08:43:33
2015-12-17T08:43:33
47,818,717
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package com.chatwing.whitelabel.pojos.oauth; import com.chatwing.whitelabel.pojos.params.oauth.JsonParams; import com.google.gson.annotations.SerializedName; /** * Author: Huy Nguyen * Date: 8/30/13 * Time: 4:56 PM */ public class YahooJsonParams extends JsonParams { @SerializedName("xoauth_yahoo_guid") private String guid; public YahooJsonParams(String guid) { this.guid = guid; } }
e97b193e5932767f2b4c837a0c7bf34bff439073
fc9c5bfa79a8f3a261d4fe5c8116ad7355f68a12
/Interview/src/Data_Structures/DynamicProgramming/EditDistance.java
3c6adad337b74a055b818a5df290da21b6ee22a2
[]
no_license
sjohari/InterviewPreparation
bd3d8940418601217a4c0fb6306b9b730357e79a
7d61c354a9ade41a6049f93332adf7d4bcd74d93
refs/heads/master
2020-03-17T06:19:08.723130
2018-05-14T11:51:30
2018-05-14T11:51:30
133,350,362
0
0
null
null
null
null
UTF-8
Java
false
false
1,470
java
package Data_Structures.DynamicProgramming; import java.util.Scanner; public class EditDistance { static int min(int a, int b){ if(a<b) return a; return b; } public static void main (String[] args) { Scanner sc = new Scanner(System.in); int testCases = sc.nextInt(); for(int t=0;t<testCases ; t++){ int length1 = sc.nextInt(); int length2 = sc.nextInt(); String string1= sc.next(); String string2= sc.next(); int M[][] = new int[length1+1][length2+1]; for(int i=0; i<=length1;i++){ for(int j=0;j <=length2;j++){ // If first string is empty, only option is to // insert all characters of second string if(i==0) M[i][j] = j; // If second string is empty, only option is to // remove all characters of second string else if(j==0) M[i][j] = i; // If last characters are same, ignore last char // and recur for remaining string else if(string1.charAt(i-1)==string2.charAt(j-1)){ M[i][j] = M[i-1][j-1]; }else{ // If last character are different, consider all // possibilities and find minimum M[i][j] = min(M[i-1][j-1],M[i-1][j]); M[i][j] = min(M[i][j],M[i][j-1]); M[i][j] = M[i][j] + 1; } } } System.out.println(M[length1][length2]); } } }
7b63fe1f330907914dea153344e512df51e94a48
7fb9a0e6dde38f8ab7cf1e25b94f6ccb2b91f8e3
/src/Main.java
e724bd4dcc9ead35c614d00b66a57ac0a59e92f6
[]
no_license
popuur/problem-solving
91ebafbd20eeb655ee2cf67c9e5bef177f2ad317
5ef3803218149c28f6541e0f026e57fa8ac853cd
refs/heads/master
2020-03-27T22:12:23.211760
2018-11-29T16:40:47
2018-11-29T16:40:47
147,213,123
0
0
null
null
null
null
UTF-8
Java
false
false
569
java
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st; br.close(); bw.flush(); bw.close(); } }
[ "popuu@DESKTOP-J5T1MRH" ]
popuu@DESKTOP-J5T1MRH
b6f958fc4a1a1b3afdf83e56be7c2c4b6b1f66fe
7cd0bae34a1a29650f34dfedf4ad0f87ac97f787
/Xray/src/motherboard/Motherboard.java
f7553ad14a817a4131c8078ae9d1697e636314dc
[ "MIT" ]
permissive
PilzHere/XRay
fb63c69fa95db73fa139950955f05924ba902631
33d238811374602adb166b9778d451e7b0f49ffb
refs/heads/master
2018-12-13T16:27:41.676157
2018-10-25T11:11:47
2018-10-25T11:11:47
113,502,444
5
1
null
null
null
null
UTF-8
Java
false
false
2,352
java
package motherboard; import controllers.XrayController; /** * The "Motherboard section" class of the app. Contains motherboard data. * * @author PilzHere * */ public class Motherboard { private String mbBrand, mbManufacturer, mbModel, mbSerialNumber, mbVersion; /** * Sets all motherboard data. */ public void setMotherboardData() { setMbBrand(XrayController.SYS_INF.getHardware().getComputerSystem().getManufacturer()); setMbBrand(XrayController.HELPER.stringIsEmptyOrUnknownOrNull(getMbBrand())); setMbManufacturer(XrayController.SYS_INF.getHardware().getComputerSystem().getBaseboard().getManufacturer()); setMbManufacturer(XrayController.HELPER.stringIsEmptyOrUnknownOrNull(getMbManufacturer())); setMbModel(XrayController.SYS_INF.getHardware().getComputerSystem().getBaseboard().getModel()); setMbModel(XrayController.HELPER.stringIsEmptyOrUnknownOrNull(getMbModel())); setMbSerialNumber(XrayController.SYS_INF.getHardware().getComputerSystem().getBaseboard().getSerialNumber()); setMbSerialNumber(XrayController.HELPER.stringIsEmptyOrUnknownOrNull(getMbSerialNumber())); setMbVersion(XrayController.SYS_INF.getHardware().getComputerSystem().getBaseboard().getVersion()); setMbVersion(XrayController.HELPER.stringIsEmptyOrUnknownOrNull(getMbVersion())); // Unused / not sure about these yet... // System.out.println(SysInf.getHardware().getComputerSystem().getModel()); // System.out.println(SysInf.getHardware().getComputerSystem().getSerialNumber()); // System.out.println(SysInf.getHardware().getComputerSystem().getFirmware().getDescription()); // // Bios version. } public String getMbBrand() { return mbBrand; } private void setMbBrand(String mbBrand) { this.mbBrand = mbBrand; } public String getMbManufacturer() { return mbManufacturer; } private void setMbManufacturer(String mbManufacturer) { this.mbManufacturer = mbManufacturer; } public String getMbModel() { return mbModel; } private void setMbModel(String mbModel) { this.mbModel = mbModel; } public String getMbSerialNumber() { return mbSerialNumber; } private void setMbSerialNumber(String mbSerialNumber) { this.mbSerialNumber = mbSerialNumber; } public String getMbVersion() { return mbVersion; } private void setMbVersion(String mbVersion) { this.mbVersion = mbVersion; } }
fa4c7b87c6a760bbd2bb500cda7149a6a3b3f2d7
17d4301a091a03a98f6bf07efbc1edf524c58634
/src/by/epam/java/module_1/package_2/Task_5.java
0ab5df8030787d743ba7957b26f726d4ef75b03e
[]
no_license
andim0n/Introduction_to_Java
6b3685c187dbe5075622900b21742072c6cb1313
687c8f92853f6e542faa6fb68fdea1c6281c2e00
refs/heads/master
2023-03-22T04:53:45.948188
2021-03-13T11:47:29
2021-03-13T11:47:29
324,646,182
0
1
null
null
null
null
UTF-8
Java
false
false
384
java
package by.epam.java.module_1.package_2; // 5. Вычислить значение функции: public class Task_5 { public static void main(String[] args) { double x = 4; double f; if (x <= 3) { f = Math.pow(x, 2) - 3 * x + 9; } else { f = 1 / (Math.pow(x, 3) + 6); } System.out.print(f); } }
59dc7c7f6a1fb0d9c0d4bf454b2c3b24acfc10c1
b4f1dc7beed4750335b1ed8b8e00210697fa3440
/src/main/java/cn/com/lasong/plugin/idea/jar/dialog/JarTreeNode.java
79d13f0850c9c24f9f3d75b5ff09cc644c1023d1
[ "Apache-2.0" ]
permissive
zhusonger/androidz_plugin_idea
d0edec90d7a7c240eed06daf5f2d0dd804f9ef71
825cb0e3f5c255dd8f8e43fd474785533693d403
refs/heads/master
2023-01-02T07:42:10.736117
2020-10-27T01:09:39
2020-10-27T01:09:39
296,329,431
2
1
null
null
null
null
UTF-8
Java
false
false
2,730
java
package cn.com.lasong.plugin.idea.jar.dialog; import cn.com.lasong.plugin.idea.jar.inject.InjectHelper; import cn.com.lasong.plugin.idea.jar.jdcore.JDHelper; import javax.swing.tree.DefaultMutableTreeNode; import java.io.File; import java.util.ArrayList; import java.util.List; /** * 节点 */ public class JarTreeNode { public JarTreeNode parent; public String name; public List<JarTreeNode> children; public String path; private JarTreeNode() { } /** * 创建字节码文件节点 * @param parent * @param clz * @return */ public static DefaultMutableTreeNode createClassNode(DefaultMutableTreeNode parent, File clz) { JarTreeNode jarNode = new JarTreeNode(); jarNode.name = clz.getName(); jarNode.parent = null != parent ? (JarTreeNode) parent.getUserObject() : null; jarNode.path = clz.getAbsolutePath(); if(jarNode.parent != null) { jarNode.parent.children.add(jarNode); } // 添加到JDCore JDHelper.appendClass(jarNode); return new DefaultMutableTreeNode(jarNode); } /** * 创建文件夹节点 * @param parent * @param dir * @return */ public static DefaultMutableTreeNode createDirNode(DefaultMutableTreeNode parent, File dir) { JarTreeNode jarNode = new JarTreeNode(); jarNode.name = dir.getName(); jarNode.parent = null != parent ? (JarTreeNode) parent.getUserObject() : null; jarNode.path = dir.getAbsolutePath(); jarNode.children = new ArrayList<>(); return new DefaultMutableTreeNode(jarNode); } /** * 创建根节点 * @param rootDir * @return */ public static DefaultMutableTreeNode createRootNode(File rootDir) { String name = rootDir.getName(); InjectHelper.appendClassPath(name, rootDir.getAbsolutePath()); File file = new File(rootDir.getParent(), name + ".jar"); return createDirNode(null, file); } /** * 获取entryName * @return */ public String entryName() { // 根节点, 不需要 if (null == parent) { return ""; } String parentName = parent.entryName(); if (null != parentName && parentName.length() > 0) { parentName += "/"; } return parentName + name; } public String className() { String entryName = entryName(); if (null != entryName) { entryName = entryName.replace("/", "."); entryName = entryName.replace(".class", ""); } return entryName; } @Override public String toString() { return name; } }
44eb849053d13a16186bbfb7ecf036b7e502be88
c2ebb942815bf44b57b64a4bcdf95f221779b842
/app/src/main/java/com/xihua/wx/weixiao/achieve/mine/adapter/SellIngComparator.java
fe1021079ad835345fe2b6d92df152ebf8622ee0
[]
no_license
yinguohui/weixiaoapp
0692913859ad5f305596aa1309ee3ffa64a322f3
143e69e0ca4dd286d45611469d4affcd6a2aaa6c
refs/heads/master
2020-06-19T19:06:55.600583
2019-09-04T16:05:36
2019-09-04T16:05:36
196,836,899
0
0
null
null
null
null
UTF-8
Java
false
false
534
java
package com.xihua.wx.weixiao.achieve.mine.adapter; import com.xihua.wx.weixiao.vo.response.DonationTimeLine; import com.xihua.wx.weixiao.vo.response.GoodsTimeLine; import java.util.Comparator; /** * 对时间进行排序,在实际开发中最好要后台给按时间顺序排序好的数据 */ public class SellIngComparator implements Comparator<GoodsTimeLine> { @Override public int compare(GoodsTimeLine td1, GoodsTimeLine td2) { return td2.getGoodsCreateTime().compareTo(td1.getGoodsCreateTime()); } }
093293f90f1d9a834b56b4365940e849fb4bf71f
df6c997720d45ed303d94407b09a54d08b5ecc75
/Calculator/app/src/test/java/com/example/athaman/calculator/ExampleUnitTest.java
99427f99015ada5180493ebd738de6098de358b2
[]
no_license
Athaman/Android-Studios-2-Apps
d57dced54c1a826faee3c9e061e70acba77e26db
a250f4aa596ba3645e4dc2480f71a2bc50531709
refs/heads/master
2021-01-19T04:25:24.501956
2016-07-23T16:02:14
2016-07-23T16:02:14
63,865,476
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package com.example.athaman.calculator; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
cabf3369f9d77d7442bdeb29e796cd9b7744277c
52fb9ace1145f5b8039d710ec11362136c7d4eb2
/ClientTerminal/src/org/iti/rmi/service/Constant.java
6cc9c0febf5cbf3e93dffcd32abe35a1d81cbdbe
[]
no_license
robby1084/CloudSim
d7c1acc490a2a808cd9b35e57c851ba93cd73670
b78215abc9b0caf10a05c3d11b60d0a8d0683ea0
refs/heads/master
2020-04-12T03:55:20.822278
2016-10-06T13:36:18
2016-10-06T13:36:18
63,872,491
0
1
null
null
null
null
UTF-8
Java
false
false
248
java
package org.iti.rmi.service; public interface Constant { String ZK_CONNECT_STRING = "10.1.40.88:2181"; int ZK_SESSION_TIMEOUT = 5000; String ZK_REGISTRY_PATH = "/registry"; String ZK_PROVIDER_PATH = ZK_REGISTRY_PATH + "/provider"; }
129870283371838fa918366c7474cb70b2490a94
e6f396eb1c6d5eb0f01a40e8e5f74f5fd6376864
/metadata-jobs/mce-consumer/src/main/java/com/linkedin/metadata/kafka/config/MceKafkaConfig.java
15d264dc9695f5a2b7d434b408523e5565fa4969
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "MIT" ]
permissive
Echelon77/datahub
b612363efb1f63cd759be1bfcc0ff973a169d9da
5cc923a56894a72871d706de75f6b5e6ae93687d
refs/heads/master
2023-08-25T02:29:58.627864
2021-10-13T07:02:51
2021-10-13T07:02:51
404,210,407
1
0
Apache-2.0
2021-09-08T04:37:41
2021-09-08T04:27:29
null
UTF-8
Java
false
false
3,988
java
package com.linkedin.metadata.kafka.config; import io.confluent.kafka.serializers.AbstractKafkaAvroSerDeConfig; import io.confluent.kafka.serializers.KafkaAvroDeserializer; import io.confluent.kafka.serializers.KafkaAvroSerializer; import java.time.Duration; import java.util.Arrays; import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.apache.avro.generic.GenericRecord; import org.apache.kafka.common.serialization.StringDeserializer; import org.apache.kafka.common.serialization.StringSerializer; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.kafka.KafkaProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory; import org.springframework.kafka.config.KafkaListenerContainerFactory; import org.springframework.kafka.core.DefaultKafkaConsumerFactory; import org.springframework.kafka.core.DefaultKafkaProducerFactory; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.listener.ErrorHandler; @Slf4j @Configuration public class MceKafkaConfig { @Value("${KAFKA_BOOTSTRAP_SERVER:http://localhost:9092}") private String kafkaBootstrapServers; @Value("${KAFKA_SCHEMAREGISTRY_URL:http://localhost:8081}") private String kafkaSchemaRegistryUrl; @Bean(name = "mceKafkaContainerFactory") public KafkaListenerContainerFactory<?> kafkaListenerContainerFactory(KafkaProperties properties) { KafkaProperties.Consumer consumerProps = properties.getConsumer(); // Specify (de)serializers for record keys and for record values. consumerProps.setKeyDeserializer(StringDeserializer.class); consumerProps.setValueDeserializer(KafkaAvroDeserializer.class); // Records will be flushed every 10 seconds. consumerProps.setEnableAutoCommit(true); consumerProps.setAutoCommitInterval(Duration.ofSeconds(10)); // KAFKA_BOOTSTRAP_SERVER has precedence over SPRING_KAFKA_BOOTSTRAP_SERVERS if (kafkaBootstrapServers != null && kafkaBootstrapServers.length() > 0) { consumerProps.setBootstrapServers(Arrays.asList(kafkaBootstrapServers.split(","))); } // else we rely on KafkaProperties which defaults to localhost:9092 Map<String, Object> props = properties.buildConsumerProperties(); props.put(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, kafkaSchemaRegistryUrl); ConcurrentKafkaListenerContainerFactory<String, GenericRecord> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(new DefaultKafkaConsumerFactory<>(props)); log.info("KafkaListenerContainerFactory built successfully"); return factory; } @Bean public KafkaTemplate<String, GenericRecord> kafkaTemplate(KafkaProperties properties) { KafkaProperties.Producer producerProps = properties.getProducer(); producerProps.setKeySerializer(StringSerializer.class); producerProps.setValueSerializer(KafkaAvroSerializer.class); // KAFKA_BOOTSTRAP_SERVER has precedence over SPRING_KAFKA_BOOTSTRAP_SERVERS if (kafkaBootstrapServers != null && kafkaBootstrapServers.length() > 0) { producerProps.setBootstrapServers(Arrays.asList(kafkaBootstrapServers.split(","))); } // else we rely on KafkaProperties which defaults to localhost:9092 Map<String, Object> props = properties.buildProducerProperties(); props.put(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, kafkaSchemaRegistryUrl); KafkaTemplate<String, GenericRecord> template = new KafkaTemplate<>(new DefaultKafkaProducerFactory<>(props)); log.info("KafkaTemplate built successfully"); return template; } @Bean public ErrorHandler errorHandler() { return (e, r) -> log.error("Exception caught during Deserialization, topic: {}, partition: {}, offset: {}", r.topic(), r.partition(), r.offset(), e); } }
537b05fc5fd499830f4f7ea6e46c313c4d0c9fc4
ea69a50bafe4455c7ed4fe686c5c4fc58b5c6646
/bookstore-app/microservices/api-gateway/commons/src/main/java/com/seavus/bookstore/apigateway/PosterResourceProxyGateway.java
13a983a89ba41fc13b3bb27cdab2553ec23c9380
[ "MIT" ]
permissive
nikola-zivkov/jdd-2018
d14dffd48df7a34a46f693e3bd5857a401978e8c
d8ead26a2568fc35614d490233f73d8741f76f73
refs/heads/master
2020-03-31T13:01:01.869098
2019-01-03T09:26:20
2019-01-03T09:26:20
152,238,537
1
0
null
null
null
null
UTF-8
Java
false
false
1,025
java
/* * Copyright (c) 2018 Seavus. All Rights Reserved. * * Use of this source code is governed by an MIT license, included in 'LICENSE.Seavus'. */ package com.seavus.bookstore.apigateway; import lombok.RequiredArgsConstructor; import org.springframework.cloud.client.discovery.DiscoveryClient; import org.springframework.cloud.gateway.mvc.ProxyExchange; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @RequiredArgsConstructor @Controller public class PosterResourceProxyGateway { private final DiscoveryClient discoveryClient; @GetMapping("/poster/{name}") public Object getPoster(ProxyExchange<Object> proxy, @PathVariable("name") String name) { return proxy.uri(getServiceUri() + "/poster/" + name.replaceAll(" ", "%20")).get(); } private String getServiceUri() { return discoveryClient.getInstances("static-resources").get(0).getUri().toString(); } }
6bbca9a5176d4804aec00352d477a9bf46eb59a0
e9224957abbafa8f049484e2b03de7a4cf179733
/src/main/java/com/alex/EasterCraft/foil/Foil.java
45638d97e41e038efe3b4cbdf95be8facca7eea1
[]
no_license
J21Digital/EasterCraft-Mod
827b84cec57f007935c6f087648ecd9644cfced9
9094c8c40e31f59b7aacf6bb3bd1098f928dc4c8
refs/heads/master
2021-01-19T17:02:11.145768
2017-04-14T19:51:41
2017-04-14T19:51:41
88,297,978
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package com.alex.EasterCraft.foil; import com.alex.EasterCraft.EasterCraft; import net.minecraft.item.Item; public class Foil extends Item{ public Foil(){ setCreativeTab(EasterCraft.tabEasterCraftFoil); setTextureName(EasterCraft.MODID + ":" + "foil"); setUnlocalizedName(EasterCraft.MODID + "_" + "Foil"); } }
36c82e505bc758fd5b9fa323b2d6fa472edd0522
3d8bd888f558ec3d35b1d6b026bfc69169ee8c08
/framework/src/main/java/com/software/dm/swallow/stormy/security/match/bdia/MainSerial.java
b5bdacab73f4ac2efd826bb55eeba83347aee39b
[]
no_license
darlingming/swallowStormy
4527bf8ffeb9dfc6259560b78a3c0ad567501a62
947e553d59babac4bdb502a9f749576e3369da5a
refs/heads/master
2021-05-13T14:43:46.374677
2019-05-13T09:32:20
2019-05-13T09:32:20
116,749,189
1
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
package com.software.dm.swallow.stormy.security.match.bdia; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Map; import com.software.dm.swallow.stormy.security.match.bdia.builder.CreateFactroy; /** * @author DM * @version v1.0.0.1 * @Description * @date 2017 */ public class MainSerial { public static final String param_Flag = "-D"; public static final String CONF_PATH = "conf.path"; public static final String SERIAL_NAME = "serial.name"; public static final String VERSION = "BDIA_FS_V4.0.2.1"; public MainSerial() { } public static void main(String[] args) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println(df.format(new Date()) + " start......"); System.out.println("Serial_Version:" + VERSION); System.out.println(Arrays.toString(args)); Map<String, String> paramMap = new HashMap<String, String>(); if (null != args && args.length > 0 && (args.length & 1) == 0) { for (int i = 0; i < args.length; i++) { if (param_Flag.equals(args[i])) { String[] vs = args[++i].split("=", -1); if (vs.length == 2) { paramMap.put(vs[0], vs[1]); } } } } CreateFactroy cf = new CreateFactroy(); cf.exec(paramMap.get(CONF_PATH), paramMap.get(SERIAL_NAME)); System.out.println(df.format(new Date()) + " end......"); } }
2ad48db0e9be7fce5987d6a6dc527e29e31c39f3
250b4e39d841945c2b173eda27ee63fe07ab4f27
/InterviewBit/DynamicProgramming/BestTimeToBuyAndSellStocks/Abhi.java
2fb916212d4c940278ae0b0850a03fb9d588fd63
[]
no_license
Abhi135721/Code-Addiction
6049dce3de7c9be7597fe33a10fc3cc304263c86
23f054e0bd78de820f3ca167fdbe9b69d4e45382
refs/heads/master
2021-05-01T06:01:08.193436
2018-04-27T15:39:16
2018-04-27T15:39:16
121,133,954
2
3
null
2018-02-16T12:45:18
2018-02-11T14:53:45
Java
UTF-8
Java
false
false
409
java
public class Abhi{ // DO NOT MODIFY THE ARGUMENTS WITH "final" PREFIX. IT IS READ ONLY public int maxProfit(int[] prices) { if(prices==null||prices.length<=1) return 0; int min=prices[0]; // min so far int result=0; for(int i=1; i<prices.length; i++){ result = Math.max(result, prices[i]-min); min = Math.min(min, prices[i]); } return result; } }
3dcab982b60f525048d32d2ae117366603fc7592
bd2139703c556050403c10857bde66f688cd9ee6
/panama-foreign/221/webrev.02/test/jdk/java/foreign/TestSegments.java
c374bb482019dd6d05f8bc769a5cf29b63338725
[]
no_license
isabella232/cr-archive
d03427e6fbc708403dd5882d36371e1b660ec1ac
8a3c9ddcfacb32d1a65d7ca084921478362ec2d1
refs/heads/master
2023-02-01T17:33:44.383410
2020-12-17T13:47:48
2020-12-17T13:47:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,060
java
/* * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @run testng TestSegments */ import jdk.incubator.foreign.MemoryAddress; import jdk.incubator.foreign.MemoryLayout; import jdk.incubator.foreign.MemoryLayouts; import jdk.incubator.foreign.MemorySegment; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.lang.invoke.VarHandle; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; import java.util.Spliterator; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.function.LongFunction; import java.util.function.Supplier; import java.util.stream.Stream; import static jdk.incubator.foreign.MemorySegment.*; import static org.testng.Assert.*; public class TestSegments { @Test(dataProvider = "badSizeAndAlignments", expectedExceptions = IllegalArgumentException.class) public void testBadAllocateAlign(long size, long align) { MemorySegment.allocateNative(size, align); } @Test(dataProvider = "badLayouts", expectedExceptions = UnsupportedOperationException.class) public void testBadAllocateLayout(MemoryLayout layout) { MemorySegment.allocateNative(layout); } @Test(expectedExceptions = { OutOfMemoryError.class, IllegalArgumentException.class }) public void testAllocateTooBig() { MemorySegment.allocateNative(Long.MAX_VALUE); } @Test(dataProvider = "segmentOperations") public void testOpOutsideConfinement(SegmentMember member) throws Throwable { try (MemorySegment segment = MemorySegment.allocateNative(4)) { AtomicBoolean failed = new AtomicBoolean(false); Thread t = new Thread(() -> { try { Object o = member.method.invoke(segment, member.params); if (member.method.getName().equals("acquire")) { ((MemorySegment)o).close(); } } catch (ReflectiveOperationException ex) { throw new IllegalStateException(ex); } }); t.setUncaughtExceptionHandler((thread, ex) -> failed.set(true)); t.start(); t.join(); assertEquals(failed.get(), member.isConfined()); } } @Test public void testNativeSegmentIsZeroed() { VarHandle byteHandle = MemoryLayout.ofSequence(MemoryLayouts.JAVA_BYTE) .varHandle(byte.class, MemoryLayout.PathElement.sequenceElement()); try (MemorySegment segment = MemorySegment.allocateNative(1000)) { for (long i = 0 ; i < segment.byteSize() ; i++) { assertEquals(0, (byte)byteHandle.get(segment.baseAddress(), i)); } } } @Test public void testNothingSegmentAccess() { VarHandle longHandle = MemoryLayouts.JAVA_LONG.varHandle(long.class); long[] values = { 0L, Integer.MAX_VALUE - 1, (long) Integer.MAX_VALUE + 1 }; for (long value : values) { MemoryAddress addr = MemoryAddress.ofLong(value); try { longHandle.get(addr); } catch (UnsupportedOperationException ex) { assertTrue(ex.getMessage().contains("Required access mode")); } } } @Test(expectedExceptions = UnsupportedOperationException.class) public void testNothingSegmentOffset() { MemoryAddress addr = MemoryAddress.ofLong(42); assertNull(addr.segment()); addr.segmentOffset(); } @Test public void testSlices() { VarHandle byteHandle = MemoryLayout.ofSequence(MemoryLayouts.JAVA_BYTE) .varHandle(byte.class, MemoryLayout.PathElement.sequenceElement()); try (MemorySegment segment = MemorySegment.allocateNative(10)) { //init for (byte i = 0 ; i < segment.byteSize() ; i++) { byteHandle.set(segment.baseAddress(), (long)i, i); } long start = 0; MemoryAddress base = segment.baseAddress(); MemoryAddress last = base.addOffset(10); while (!base.equals(last)) { MemorySegment slice = segment.asSlice(base.segmentOffset(), 10 - start); for (long i = start ; i < 10 ; i++) { assertEquals( byteHandle.get(segment.baseAddress(), i), byteHandle.get(slice.baseAddress(), i - start) ); } base = base.addOffset(1); start++; } } } @Test(dataProvider = "segmentFactories") public void testAccessModesOfFactories(Supplier<MemorySegment> memorySegmentSupplier) { try (MemorySegment segment = memorySegmentSupplier.get()) { assertTrue(segment.hasAccessModes(ALL_ACCESS)); assertEquals(segment.accessModes(), ALL_ACCESS); } } @Test(dataProvider = "accessModes") public void testAccessModes(int accessModes) { int[] arr = new int[1]; for (AccessActions action : AccessActions.values()) { MemorySegment segment = MemorySegment.ofArray(arr); MemorySegment restrictedSegment = segment.withAccessModes(accessModes); assertEquals(restrictedSegment.accessModes(), accessModes); boolean shouldFail = !restrictedSegment.hasAccessModes(action.accessMode); try { action.run(restrictedSegment); assertFalse(shouldFail); } catch (UnsupportedOperationException ex) { assertTrue(shouldFail); } } } @DataProvider(name = "segmentFactories") public Object[][] segmentFactories() { List<Supplier<MemorySegment>> l = List.of( () -> MemorySegment.ofArray(new byte[] { 0x00, 0x01, 0x02, 0x03 }), () -> MemorySegment.ofArray(new char[] {'a', 'b', 'c', 'd' }), () -> MemorySegment.ofArray(new double[] { 1d, 2d, 3d, 4d} ), () -> MemorySegment.ofArray(new float[] { 1.0f, 2.0f, 3.0f, 4.0f }), () -> MemorySegment.ofArray(new int[] { 1, 2, 3, 4 }), () -> MemorySegment.ofArray(new long[] { 1l, 2l, 3l, 4l } ), () -> MemorySegment.ofArray(new short[] { 1, 2, 3, 4 } ), () -> MemorySegment.allocateNative(4), () -> MemorySegment.allocateNative(4, 8), () -> MemorySegment.allocateNative(MemoryLayout.ofValueBits(32, ByteOrder.nativeOrder())) ); return l.stream().map(s -> new Object[] { s }).toArray(Object[][]::new); } @Test(dataProvider = "segmentFactories") public void testFill(Supplier<MemorySegment> memorySegmentSupplier) { VarHandle byteHandle = MemoryLayout.ofSequence(MemoryLayouts.JAVA_BYTE) .varHandle(byte.class, MemoryLayout.PathElement.sequenceElement()); for (byte value : new byte[] {(byte) 0xFF, (byte) 0x00, (byte) 0x45}) { try (MemorySegment segment = memorySegmentSupplier.get()) { segment.fill(value); for (long l = 0; l < segment.byteSize(); l++) { assertEquals((byte) byteHandle.get(segment.baseAddress(), l), value); } // fill a slice var sliceSegment = segment.asSlice(1, segment.byteSize() - 2).fill((byte) ~value); for (long l = 0; l < sliceSegment.byteSize(); l++) { assertEquals((byte) byteHandle.get(sliceSegment.baseAddress(), l), ~value); } // assert enclosing slice assertEquals((byte) byteHandle.get(segment.baseAddress(), 0L), value); for (long l = 1; l < segment.byteSize() - 2; l++) { assertEquals((byte) byteHandle.get(segment.baseAddress(), l), (byte) ~value); } assertEquals((byte) byteHandle.get(segment.baseAddress(), segment.byteSize() - 1L), value); } } } @Test(dataProvider = "segmentFactories", expectedExceptions = IllegalStateException.class) public void testFillClosed(Supplier<MemorySegment> memorySegmentSupplier) { MemorySegment segment = memorySegmentSupplier.get(); segment.close(); segment.fill((byte) 0xFF); } @Test(dataProvider = "segmentFactories", expectedExceptions = UnsupportedOperationException.class) public void testFillIllegalAccessMode(Supplier<MemorySegment> memorySegmentSupplier) { try (MemorySegment segment = memorySegmentSupplier.get()) { segment.withAccessModes(segment.accessModes() & ~WRITE).fill((byte) 0xFF); } } @Test(dataProvider = "segmentFactories") public void testFillThread(Supplier<MemorySegment> memorySegmentSupplier) throws Exception { try (MemorySegment segment = memorySegmentSupplier.get()) { AtomicReference<RuntimeException> exception = new AtomicReference<>(); Runnable action = () -> { try { segment.fill((byte) 0xBA); } catch (RuntimeException e) { exception.set(e); } }; Thread thread = new Thread(action); thread.start(); thread.join(); RuntimeException e = exception.get(); if (!(e instanceof IllegalStateException)) { throw e; } } } @Test public void testFillEmpty() { MemorySegment.ofArray(new byte[] { }).fill((byte) 0xFF); MemorySegment.ofArray(new byte[2]).asSlice(0, 0).fill((byte) 0xFF); MemorySegment.ofByteBuffer(ByteBuffer.allocateDirect(0)).fill((byte) 0xFF); } @Test(expectedExceptions = IllegalArgumentException.class) public void testWithAccessModesBadUnsupportedMode() { int[] arr = new int[1]; MemorySegment segment = MemorySegment.ofArray(arr); segment.withAccessModes((1 << AccessActions.values().length) + 1); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBadWithAccessModesBadStrongerMode() { int[] arr = new int[1]; MemorySegment segment = MemorySegment.ofArray(arr).withAccessModes(READ); segment.withAccessModes(WRITE); } @Test(expectedExceptions = IllegalArgumentException.class) public void testBadHasAccessModes() { int[] arr = new int[1]; MemorySegment segment = MemorySegment.ofArray(arr); segment.hasAccessModes((1 << AccessActions.values().length) + 1); } @DataProvider(name = "badSizeAndAlignments") public Object[][] sizesAndAlignments() { return new Object[][] { { -1, 8 }, { 1, 15 }, { 1, -15 } }; } @DataProvider(name = "badLayouts") public Object[][] layouts() { SizedLayoutFactory[] layoutFactories = SizedLayoutFactory.values(); Object[][] values = new Object[layoutFactories.length * 2][2]; for (int i = 0; i < layoutFactories.length ; i++) { values[i * 2] = new Object[] { MemoryLayout.ofStruct(layoutFactories[i].make(7), MemoryLayout.ofPaddingBits(9)) }; // good size, bad align values[(i * 2) + 1] = new Object[] { layoutFactories[i].make(15).withBitAlignment(16) }; // bad size, good align } return values; } enum SizedLayoutFactory { VALUE_BE(size -> MemoryLayout.ofValueBits(size, ByteOrder.BIG_ENDIAN)), VALUE_LE(size -> MemoryLayout.ofValueBits(size, ByteOrder.LITTLE_ENDIAN)), PADDING(MemoryLayout::ofPaddingBits); private final LongFunction<MemoryLayout> factory; SizedLayoutFactory(LongFunction<MemoryLayout> factory) { this.factory = factory; } MemoryLayout make(long size) { return factory.apply(size); } } @DataProvider(name = "segmentOperations") static Object[][] segmentMembers() { List<SegmentMember> members = new ArrayList<>(); for (Method m : MemorySegment.class.getDeclaredMethods()) { //skip statics and method declared in j.l.Object if (m.getDeclaringClass().equals(Object.class) || (m.getModifiers() & Modifier.STATIC) != 0) continue; Object[] args = Stream.of(m.getParameterTypes()) .map(TestSegments::defaultValue) .toArray(); members.add(new SegmentMember(m, args)); } return members.stream().map(ms -> new Object[] { ms }).toArray(Object[][]::new); } static class SegmentMember { final Method method; final Object[] params; final static List<String> CONFINED_NAMES = List.of( "close", "fill", "copyFrom", "mismatch", "toByteArray", "toCharArray", "toShortArray", "toIntArray", "toFloatArray", "toLongArray", "toDoubleArray", "withOwnerThread" ); public SegmentMember(Method method, Object[] params) { this.method = method; this.params = params; } boolean isConfined() { return CONFINED_NAMES.contains(method.getName()); } @Override public String toString() { return method.getName(); } } static Object defaultValue(Class<?> c) { if (c.isPrimitive()) { if (c == char.class) { return (char)0; } else if (c == boolean.class) { return false; } else if (c == byte.class) { return (byte)0; } else if (c == short.class) { return (short)0; } else if (c == int.class) { return 0; } else if (c == long.class) { return 0L; } else if (c == float.class) { return 0f; } else if (c == double.class) { return 0d; } else { throw new IllegalStateException(); } } else { return null; } } @DataProvider(name = "accessModes") public Object[][] accessModes() { int nActions = AccessActions.values().length; Object[][] results = new Object[1 << nActions][]; for (int accessModes = 0 ; accessModes < results.length ; accessModes++) { results[accessModes] = new Object[] { accessModes }; } return results; } enum AccessActions { ACQUIRE(MemorySegment.ACQUIRE) { @Override void run(MemorySegment segment) { Spliterator<MemorySegment> spliterator = MemorySegment.spliterator(segment, MemoryLayout.ofSequence(segment.byteSize(), MemoryLayouts.JAVA_BYTE)); AtomicReference<RuntimeException> exception = new AtomicReference<>(); Runnable action = () -> { try { spliterator.tryAdvance(s -> { }); } catch (RuntimeException e) { exception.set(e); } }; Thread thread = new Thread(action); thread.start(); try { thread.join(); } catch (InterruptedException ex) { throw new AssertionError(ex); } RuntimeException e = exception.get(); if (e != null) { throw e; } } }, CLOSE(MemorySegment.CLOSE) { @Override void run(MemorySegment segment) { segment.close(); } }, READ(MemorySegment.READ) { @Override void run(MemorySegment segment) { INT_HANDLE.get(segment.baseAddress()); } }, WRITE(MemorySegment.WRITE) { @Override void run(MemorySegment segment) { INT_HANDLE.set(segment.baseAddress(), 42); } }, HANDOFF(MemorySegment.HANDOFF) { @Override void run(MemorySegment segment) { segment.withOwnerThread(new Thread()); } }; final int accessMode; static VarHandle INT_HANDLE = MemoryLayouts.JAVA_INT.varHandle(int.class); AccessActions(int accessMode) { this.accessMode = accessMode; } abstract void run(MemorySegment segment); } }
c14ad95256687885ca835cc2017d63a9ddbb3ffd
1187e7ada271f51ed2e7f7c3cf97bfe86fee67b4
/src/pln-abstractions/src/main/java/com/syncprem/uprising/pipeline/abstractions/runtime/AbstractHost.java
9477cf60465c450f5080c23f71dc45be28d37166
[ "MIT" ]
permissive
wellengineered-us/archive-uprising-java
ac27896c8b6445bd325b18fa15a7e871376f445a
490d02dd9ec98dc06d4fe7522abc66a178aa8f30
refs/heads/master
2023-04-12T17:09:40.575871
2021-05-06T04:07:31
2021-05-06T04:07:31
364,781,631
1
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
/* Copyright ©2017-2019 SyncPrem, all rights reserved. Distributed under the MIT license: https://opensource.org/licenses/MIT */ package com.syncprem.uprising.pipeline.abstractions.runtime; import com.syncprem.uprising.infrastructure.polyfills.ArgumentNullException; import com.syncprem.uprising.pipeline.abstractions.AbstractComponent; import com.syncprem.uprising.pipeline.abstractions.configuration.HostConfiguration; import com.syncprem.uprising.streamingio.primitives.SyncPremException; import java.util.concurrent.FutureTask; public abstract class AbstractHost extends AbstractComponent implements Host { protected AbstractHost() { } private HostConfiguration configuration; @Override public final HostConfiguration getConfiguration() { return this.configuration; } @Override public final void setConfiguration(HostConfiguration configuration) { this.configuration = configuration; } @Override public final Pipeline createPipeline(Class<? extends Pipeline> clazz) throws SyncPremException { if (clazz == null) throw new ArgumentNullException("clazz"); try { return this.createPipelineInternal(clazz); } catch (Exception ex) { throw new SyncPremException(ex); } } protected abstract Pipeline createPipelineInternal(Class<? extends Pipeline> clazz) throws Exception; protected abstract void onHostUnload(FutureTask<?> futureTask); @Override public final void run() throws SyncPremException { try { this.runInternal(); } catch (Exception ex) { throw new SyncPremException(ex); } } protected abstract void runInternal() throws Exception; }
cd9e38ed82894d26b5a06aa8ca952bc1fa3b01ca
2f26f40e0a36c86156529b2c95f10077c39230aa
/top/disc/src/main/java/com/smartsky/disc/DiscMenuModule.java
fb8db5536603f7cb6a544eafe50093e11a3e2b08
[]
no_license
cangwang/Dou
640184b9791604c252b86b7ef56aee15b4478200
3a850da7a15760ef3e47ea51193fa32cb6ea8a97
refs/heads/master
2021-07-03T22:10:41.650409
2017-09-26T23:47:00
2017-09-26T23:47:00
104,815,327
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package com.smartsky.disc; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import com.cangwang.core.cwmodule.ELModuleContext; import com.cangwang.core.cwmodule.ex.ELBasicExModule; /** * Created by cangwang on 2017/9/25. */ public class DiscMenuModule extends ELBasicExModule{ private View discMenu; @Override public boolean init(ELModuleContext moduleContext, Bundle extend) { super.init(moduleContext, extend); this.moduleContext = moduleContext; initView(); return true; } private void initView(){ discMenu = LayoutInflater.from(context).inflate(R.layout.disc_menu_module,parentTop,true); } }
c0c658d49b89482ad2b1d93c44834efa0e6294a9
a6e2cd9ea01bdc5cfe58acce25627786fdfe76e9
/src/main/java/com/alipay/api/domain/CreditPayMoneyVO.java
1bdcf2bc8564cd3a9d8aa9ab6274a5b9db1c61ce
[ "Apache-2.0" ]
permissive
cc-shifo/alipay-sdk-java-all
38b23cf946b73768981fdeee792e3dae568da48c
938d6850e63160e867d35317a4a00ed7ba078257
refs/heads/master
2022-12-22T14:06:26.961978
2020-09-23T04:00:10
2020-09-23T04:00:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 多币种金额 * * @author auto create * @since 1.0, 2019-07-12 14:25:32 */ public class CreditPayMoneyVO extends AlipayObject { private static final long serialVersionUID = 3129641389571731133L; /** * 金额,单位元 */ @ApiField("amt") private String amt; /** * 币种代码 */ @ApiField("currency_code") private String currencyCode; public String getAmt() { return this.amt; } public void setAmt(String amt) { this.amt = amt; } public String getCurrencyCode() { return this.currencyCode; } public void setCurrencyCode(String currencyCode) { this.currencyCode = currencyCode; } }
b6695ee90df7b3ad7dbe2a120c447603da4f0257
3dc4101ab1c3ef9545ad22011b0a310aba17b333
/src/main/java/net/lightbody/wpd/utils/PerformanceTiming.java
938d33859e1136c045e61b005ea3713b0e6804de
[]
no_license
lightbody/wpd-selenium
eb80e797672158d1e84117fb2c8ca5b64885f51b
51caddeaf5cf73ad46c772bad6e76452b930e5e5
refs/heads/master
2021-06-03T12:58:12.465614
2012-07-19T14:33:12
2012-07-19T14:33:12
4,816,493
14
3
null
2020-10-13T06:40:38
2012-06-28T03:48:54
Java
UTF-8
Java
false
false
5,421
java
package net.lightbody.wpd.utils; import org.browsermob.core.har.Har; import org.browsermob.core.har.HarEntry; import org.browsermob.core.har.HarPage; import org.browsermob.core.har.HarPageTimings; import org.openqa.selenium.JavascriptExecutor; import java.util.Date; import java.util.Map; public class PerformanceTiming { private long connectEnd; private long connectStart; private long domComplete; private long domContentLoadedEventEnd; private long domContentLoadedEventStart; private long domInteractive; private long domLoading; private long domainLookupEnd; private long domainLookupStart; private long fetchStart; private long loadEventEnd; private long loadEventStart; private long navigationStart; private long redirectEnd; private long redirectStart; private long requestStart; private long responseEnd; private long responseStart; private long secureConnectionStart; private long unloadEventEnd; private long unloadEventStart; public PerformanceTiming(JavascriptExecutor driver, Har har) { @SuppressWarnings("unchecked") Map<String, Long> timing = (Map<String, Long>) driver.executeScript("return window.performance.timing;"); connectEnd = get(timing, "connectEnd"); connectStart = get(timing, "connectStart"); domComplete = get(timing, "domComplete"); domContentLoadedEventEnd = get(timing, "domContentLoadedEventEnd"); domContentLoadedEventStart = get(timing, "domContentLoadedEventStart"); domInteractive = get(timing, "domInteractive"); domLoading = get(timing, "domLoading"); domainLookupEnd = get(timing, "domainLookupEnd"); domainLookupStart = get(timing, "domainLookupStart"); fetchStart = get(timing, "fetchStart"); loadEventEnd = get(timing, "loadEventEnd"); loadEventStart = get(timing, "loadEventStart"); navigationStart = get(timing, "navigationStart"); redirectEnd = get(timing, "redirectEnd"); redirectStart = get(timing, "redirectStart"); requestStart = get(timing, "requestStart"); responseEnd = get(timing, "responseEnd"); responseStart = get(timing, "responseStart"); secureConnectionStart = get(timing, "secureConnectionStart"); unloadEventEnd = get(timing, "unloadEventEnd"); unloadEventStart = get(timing, "unloadEventStart"); // also augment the HAR with some stuff String href = (String) driver.executeScript("return window.location.href;"); if (href.contains("#")) { href = href.substring(0, href.indexOf("#")); } HarPage page = null; for (HarEntry entry : har.getLog().getEntries()) { if (href.equals(entry.getRequest().getUrl())) { for (HarPage harPage : har.getLog().getPages()) { if (harPage.getId().equals(entry.getPageref())) { page = harPage; break; } } } if (page != null) { break; } } if (page != null) { page.setTitle((String) driver.executeScript("return window.document.title;")); page.setStartedDateTime(new Date(navigationStart)); HarPageTimings pageTimings = new HarPageTimings(); pageTimings.setOnContentLoad(domContentLoadedEventEnd - navigationStart); pageTimings.setOnLoad(loadEventEnd - navigationStart); page.setPageTimings(pageTimings); } } private long get(Map<String, Long> timings, String key) { if (timings.containsKey(key)) { return timings.get(key); } else { return 0; } } public long getConnectEnd() { return connectEnd; } public long getConnectStart() { return connectStart; } public long getDomComplete() { return domComplete; } public long getDomContentLoadedEventEnd() { return domContentLoadedEventEnd; } public long getDomContentLoadedEventStart() { return domContentLoadedEventStart; } public long getDomInteractive() { return domInteractive; } public long getDomLoading() { return domLoading; } public long getDomainLookupEnd() { return domainLookupEnd; } public long getDomainLookupStart() { return domainLookupStart; } public long getFetchStart() { return fetchStart; } public long getLoadEventEnd() { return loadEventEnd; } public long getLoadEventStart() { return loadEventStart; } public long getNavigationStart() { return navigationStart; } public long getRedirectEnd() { return redirectEnd; } public long getRedirectStart() { return redirectStart; } public long getRequestStart() { return requestStart; } public long getResponseEnd() { return responseEnd; } public long getResponseStart() { return responseStart; } public long getSecureConnectionStart() { return secureConnectionStart; } public long getUnloadEventEnd() { return unloadEventEnd; } public long getUnloadEventStart() { return unloadEventStart; } }
c1e6313a1daa38a5c7c0f76d80508c923ac2b8b0
0f8348d2ff12b2daa4dcde6f3bdbe33da345cee6
/src/demoJenkins/TecAdminSeleniumTest.java
df7884be9ed41c25c218192ff399a1ed5379c48f
[]
no_license
gordanaGigavoice/TestProject1
cda441a371f5fdca274eb394400fe69c2dc89702
8402875794b5edfa4cc31bf2d7c343c3e400c3d5
refs/heads/master
2020-03-23T07:47:39.138035
2018-08-06T11:07:09
2018-08-06T11:07:09
140,824,403
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package demoJenkins; import java.io.IOException; import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.Test; import java.net.URL; import org.openqa.selenium.remote.RemoteWebDriver; @Test public class TecAdminSeleniumTest { public static void main(String[] args) throws IOException, InterruptedException { // System.setProperty("webdriver.chrome.driver", "/home/gigavoice/chromedriver"); ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("--headless"); chromeOptions.addArguments("--no-sandbox"); // WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4445/wd/hub"), chromeOptions); WebDriver driver = new ChromeDriver(chromeOptions); driver.get("https://google.com"); Thread.sleep(3000); if (driver.getPageSource().contains("Google")) { System.out.println("Pass"); } else { System.out.println("Fail"); } driver.quit(); } }
41a6cfab4a2cb14daa8e5f4d356ee4ee4995120f
6e4ead948b535c2061bb6e1ee3f48bb57574fd04
/src/main/java/dev/interfaces/ITaxiEmployeeTrackingDAO.java
e1eed158ba4ffaa758d01cea9c1324aafdf735c1
[]
no_license
hancacs/ecarride
62aa432b867e737acee2b81b0e7cc85716785610
189fe447520dd946a052b39cf00de7a3b39ff642
refs/heads/master
2021-01-10T23:48:58.043015
2016-10-28T18:57:12
2016-10-28T18:57:12
69,276,025
0
0
null
null
null
null
UTF-8
Java
false
false
4,739
java
package dev.interfaces; import dev.models.TaxiEmployeeTracking; import java.sql.Timestamp; import java.util.Date; import java.util.List; /** * Interface for TaxiEmployeeTrackingDAO. * * @author MyEclipse Persistence Tools */ public interface ITaxiEmployeeTrackingDAO { /** * Perform an initial save of a previously unsaved TaxiEmployeeTracking * entity. All subsequent persist actions of this entity should use the * #update() method. This operation must be performed within the a database * transaction context for the entity's data to be permanently saved to the * persistence store, i.e., database. This method uses the * {@link javax.persistence.EntityManager#persist(Object) * EntityManager#persist} operation. * * <pre> * * EntityManagerHelper.beginTransaction(); * ITaxiEmployeeTrackingDAO.save(entity); * EntityManagerHelper.commit(); * </pre> * * @param entity * TaxiEmployeeTracking entity to persist * @throws RuntimeException * when the operation fails */ public void save(TaxiEmployeeTracking entity); /** * Delete a persistent TaxiEmployeeTracking entity. This operation must be * performed within the a database transaction context for the entity's data * to be permanently deleted from the persistence store, i.e., database. * This method uses the * {@link javax.persistence.EntityManager#remove(Object) * EntityManager#delete} operation. * * <pre> * EntityManagerHelper.beginTransaction(); * ITaxiEmployeeTrackingDAO.delete(entity); * EntityManagerHelper.commit(); * entity = null; * </pre> * * @param entity * TaxiEmployeeTracking entity to delete * @throws RuntimeException * when the operation fails */ public void delete(TaxiEmployeeTracking entity); /** * Persist a previously saved TaxiEmployeeTracking entity and return it or a * copy of it to the sender. A copy of the TaxiEmployeeTracking entity * parameter is returned when the JPA persistence mechanism has not * previously been tracking the updated entity. This operation must be * performed within the a database transaction context for the entity's data * to be permanently saved to the persistence store, i.e., database. This * method uses the {@link javax.persistence.EntityManager#merge(Object) * EntityManager#merge} operation. * * <pre> * EntityManagerHelper.beginTransaction(); * entity = ITaxiEmployeeTrackingDAO.update(entity); * EntityManagerHelper.commit(); * </pre> * * @param entity * TaxiEmployeeTracking entity to update * @return TaxiEmployeeTracking the persisted TaxiEmployeeTracking entity * instance, may not be the same * @throws RuntimeException * if the operation fails */ public TaxiEmployeeTracking update(TaxiEmployeeTracking entity); public TaxiEmployeeTracking findById(Integer id); /** * Find all TaxiEmployeeTracking entities with a specific property value. * * @param propertyName * the name of the TaxiEmployeeTracking property to query * @param value * the property value to match * @param rowStartIdxAndCount * Optional int varargs. rowStartIdxAndCount[0] specifies the the * row index in the query result-set to begin collecting the * results. rowStartIdxAndCount[1] specifies the the maximum * count of results to return. * @return List<TaxiEmployeeTracking> found by query */ public List<TaxiEmployeeTracking> findByProperty(String propertyName, Object value, int... rowStartIdxAndCount); public List<TaxiEmployeeTracking> findByEmployeeId(Object employeeId, int... rowStartIdxAndCount); public List<TaxiEmployeeTracking> findByCheckHistory(Object checkHistory, int... rowStartIdxAndCount); public List<TaxiEmployeeTracking> findByWorkingHours(Object workingHours, int... rowStartIdxAndCount); public List<TaxiEmployeeTracking> findByWorkSummary(Object workSummary, int... rowStartIdxAndCount); public List<TaxiEmployeeTracking> findByRoutePhoto(Object routePhoto, int... rowStartIdxAndCount); public List<TaxiEmployeeTracking> findByStatus(Object status, int... rowStartIdxAndCount); /** * Find all TaxiEmployeeTracking entities. * * @param rowStartIdxAndCount * Optional int varargs. rowStartIdxAndCount[0] specifies the the * row index in the query result-set to begin collecting the * results. rowStartIdxAndCount[1] specifies the the maximum * count of results to return. * @return List<TaxiEmployeeTracking> all TaxiEmployeeTracking entities */ public List<TaxiEmployeeTracking> findAll(int... rowStartIdxAndCount); }
427e4cd22178fc8f057713fddb171479b1ee83e2
2ff91bc660fbf75d0d7ff5595091467a07064d47
/SpringJUnit08LearningTest02/src/com/koitt/junit/StringTest.java
5cd80444b36d4c8bb8a91f784ea055036e200404
[]
no_license
potshow/work_spring
06d597011e17016117e6925b9274c64b7502b9f0
68693559f05d6b1f1eaa52ee3691eafa4304f187
refs/heads/master
2021-05-03T08:18:21.680178
2018-04-11T02:07:57
2018-04-11T02:07:57
120,564,076
0
0
null
null
null
null
UTF-8
Java
false
false
631
java
package com.koitt.junit; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import org.junit.Test; public class StringTest { @Test public void subStringTest() { String object = "한글 부분 스트링 테스트"; // 앞쪽 파라메터는 유동적인 값을 넣고 // 뒤쪽 파라메터는 부동적인 값을 넣는다고 생각을 하씨오 assertThat(object.substring(0, 2), is("한글")); } @Test public void lengthTest() { String object = "동해물과 백두산이 마르고 닳도록 ..."; assertThat(object.length(), is(21)); } }
[ "KOITT@KOITT-PC14" ]
KOITT@KOITT-PC14
934f8e3366fc86459a822c6308460c85b0e3a394
03b19fbf99ad9251c6ad9843f3984a7f87d2b44d
/Android/Adapter_Pattern/src/MainClass.java
33e9379cd1d517d098f973becf41b4d78caae880
[]
no_license
DaaEun/Learning-Testing
27185e48ba4cf84a2ecae963a53ec6eac5c5ee9c
b1e73891c007d16294c6fc98b7e5ffbfe850fd2b
refs/heads/main
2023-09-06T01:57:13.074544
2021-11-02T17:53:42
2021-11-02T17:53:42
345,321,697
0
0
null
null
null
null
UHC
Java
false
false
259
java
public class MainClass { public static void main(String[] args) { Adapter adapter = new AdapterImpl(); System.out.println(adapter.twiceOf(100f)); System.out.println(adapter.halfOf(100f)); //새로운 기능을 추가..adapter } }
f14de2699e7d2992f41e27c12bb69c056ee8b465
aca711aa35fd07ce3cf50f2df813506eae259c5f
/src/main/java/org/bank/demo/service/ProductService.java
066226866866a67acd2acbadbf5838536766226c
[]
no_license
maryland1008/sample
9ba57a7450b82b818ced0a2b0343be9ee535e56b
806bb12843d0645dddd4da414230aed6c7235522
refs/heads/master
2022-12-28T08:05:30.740005
2019-11-06T15:34:40
2019-11-06T15:34:40
220,018,965
0
0
null
2022-12-16T10:32:23
2019-11-06T14:42:33
CSS
UTF-8
Java
false
false
2,271
java
package org.bank.demo.service; import org.apache.log4j.Logger; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.bank.demo.domain.Product; import org.bank.demo.domain.repository.ProductRepository; import org.bank.demo.service.commons.GenericService; import org.bank.demo.service.ProductService; @Service public class ProductService extends GenericService <Product> { private static final Logger serviceLogger = Logger.getLogger(ProductService.class); @Autowired public void init(ProductRepository<Product> repository) { this.repository = repository; this.logger = serviceLogger; } public boolean hasField(String fieldName) { return ((ProductRepository<Product>)repository).hasField(fieldName); } @Transactional(readOnly = true, propagation = Propagation.REQUIRED) public String insertProduct(Product bean) { return ((ProductRepository<Product>)repository).insertProduct(bean); } @Transactional(readOnly = true, propagation = Propagation.REQUIRED) public Product findByPrimaryKey( String productCd ) { return ((ProductRepository<Product>)repository).findByPrimaryKey(productCd); } @Transactional(readOnly = true, propagation = Propagation.REQUIRED) public List<Product> findByFilter(Map<String,List<?>> params) { return ((ProductRepository<Product>)repository).findBySqlParameterSource(params); } @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public int deleteByPrimaryKey( String productCd ) { return ((ProductRepository<Product>)repository).deleteByPrimaryKey(productCd); } @Transactional(readOnly = true, propagation = Propagation.REQUIRED) public boolean exists( String productCd ) { return ((ProductRepository<Product>)repository).exists(productCd); } @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public void update(final Product bean) { if (bean == null) { logger.error("Entity is null"); throw new IllegalArgumentException("Entity is null"); } ((ProductRepository<Product>)repository).update(bean); } }
[ "Huaichen.Yang" ]
Huaichen.Yang
1f07c68cc09d02d0f4bfddeda6cf0cedfd67c3bc
4cf864fc450c94e54e3eaabee3d6c149f090c925
/TallerWeb/src/technology/tikal/ventas/dao/pedido/PedidoDao.java
8bfef022b1b7208794d9767d5d5bf7a7fb7d647e
[]
no_license
isrVigueras/TIkalGarage
e108fca7df9b0965dc3454349c3a36bc2c3b23e4
bf2435180417ade4c15f03cbd6370c992a524ca3
refs/heads/master
2020-12-31T05:56:06.872475
2018-04-03T19:50:42
2018-04-03T19:50:42
65,632,698
1
0
null
null
null
null
UTF-8
Java
false
false
992
java
/** * Copyright 2015 Tikal-Technology * *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 technology.tikal.ventas.dao.pedido; import technology.tikal.gae.dao.template.EntityDAO; import technology.tikal.gae.pagination.model.PaginationData; import technology.tikal.ventas.model.pedido.ofy.PedidoOfy; /** * * @author Nekorp * */ public interface PedidoDao extends EntityDAO<PedidoOfy, Long, PedidoFilter, PaginationData<Long>> { }
[ "Lenovo@LAPTOP-HNU12MCS" ]
Lenovo@LAPTOP-HNU12MCS
46d23a4a54212fdf254e01cf0712d1ffd61bc034
781d8c1ae94938eb0582d206920f1d1367d8fd96
/number_1120.java
01cd5874c59c18278ec43bd9600b6e5d25916807
[]
no_license
ParkSeoJune/Java_problem_solving
5d44955c2c7931e4ade8386f20a20a70e97643ea
cd636e9aff7c322e73b2a47dadb5cccd88254364
refs/heads/main
2023-07-28T23:16:39.118763
2021-09-27T06:37:37
2021-09-27T06:37:37
402,976,640
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package codeup; import java.util.Scanner; public class number_1120 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); int y = in.nextInt(); int z = in.nextInt(); System.out.printf("%.2f", (x+y+z)/3.0); } } // 세 수를 입력받아 평균을 구해 소수 둘쨰자리까지 구하는 문제
74249cf21cd13f1c6985c2279e2d2c833fe446bd
8f49d7ad955e75708c7233f3edb713f72a43ebfa
/app/src/main/java/net/sramanovich/fitnessday/UserProgramsContentListActivity.java
514118b06b6c2b9630d34710782e4895df9657db
[]
no_license
sramanovich/FitnessDay
2c21e0bfbbe8737288536a1f82dd9d7408557f1c
f21be0dfb22fbb251828f4aaad79fef8bc0aa263
refs/heads/master
2021-01-22T04:41:13.647109
2017-08-31T13:02:49
2017-08-31T13:02:49
81,570,733
0
0
null
null
null
null
UTF-8
Java
false
false
12,629
java
package net.sramanovich.fitnessday; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.CursorAdapter; import android.widget.ListView; import android.widget.Toast; import com.roomorama.caldroid.CaldroidFragment; import com.roomorama.caldroid.CaldroidListener; import net.sramanovich.fitnessday.adapters.UserProgramsDayAdapter; import net.sramanovich.fitnessday.db.DBEngine; import net.sramanovich.fitnessday.db.TrainingProgramTable; import net.sramanovich.fitnessday.utils.ProgramData; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; public class UserProgramsContentListActivity extends Fragment { final int MENU_ITEM_DELETE_PROGRAM=1; final int MENU_ITEM_OPEN_PROGRAM=2; final int MENU_ITEM_START_PROGRAM=3; final int MENU_ITEM_VIEW_PROGRAM=4; private TrainingProgramTable mTable; private Cursor cursor1; private CursorAdapter cursorAdapter1; private long mainProgramID; private Cursor cursor2; private ListView lvDayPrograms; private UserProgramsDayAdapter programDayAdapter; private String selProgramName=""; private int selProgramPosition; private Toolbar toolbar; //private CaldroidFragment caldroidFragment; private Calendar calendar; private Date curDate; private View parent_view; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { parent_view = inflater.inflate(R.layout.user_programs_content,container,false); //initToolbar(); try { mTable = TrainingProgramTable.getTrainingProgramTable(); cursor1 = DBEngine.getTrainingProgramCursor(Constants.TT_PROGRAM_TEMPLATE); String[] from = new String[]{TrainingProgramTable.COL_NAME}; int[] to = new int[]{R.id.textViewProgramName}; cursorAdapter1 = mTable.getProgramsContentListAdapter(parent_view.getContext(), R.layout.user_programs_content_item1, cursor1, from, to, 0); ListView lvPrograms = (ListView) parent_view.findViewById(R.id.listViewPrograms); lvPrograms.setAdapter(cursorAdapter1); lvPrograms.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE); lvPrograms.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { /*for(int n = 0; n < parent.getChildCount(); n++) { parent.getChildAt(n).setBackgroundColor(Color.TRANSPARENT); } view.setBackgroundColor(Color.GREEN);*/ onSelectProgram(position); } }); cursor2 = DBEngine.getTrainingProgramCursor(Constants.TT_USER_PROGRAM, selProgramName); updateCalendarData(cursor2); lvDayPrograms = (ListView) parent_view.findViewById(R.id.listViewDayUserPrograms); programDayAdapter = getDayProgramsAdapter(new Date(0)/*curDate*/); lvDayPrograms.setAdapter(programDayAdapter); lvDayPrograms.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Date date = programDayAdapter.getItem(position).getmDate(); long db_id = getProgramID(date); if (db_id>0) { onOpenProgram(db_id); } } }); onSelectProgram(0); } catch(SQLiteException e) { Toast toast= Toast.makeText(parent_view.getContext(), e.getMessage(), Toast.LENGTH_SHORT); toast.show(); } return parent_view; } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { /*menu.clear(); int count=0; if(isTemplate==Constants.TT_PROGRAM_TEMPLATE) { menu.add(0, MENU_ITEM_START_PROGRAM, count++, "Start"); } else if(isTemplate==Constants.TT_USER_PROGRAM_TEMPLATE) { menu.add(0, MENU_ITEM_START_PROGRAM, count++, "Start"); menu.add(0, MENU_ITEM_VIEW_PROGRAM, count++, "View"); } else if(isTemplate==Constants.TT_USER_PROGRAM) { menu.add(0, MENU_ITEM_OPEN_PROGRAM, count++, "Continue"); menu.add(0, MENU_ITEM_VIEW_PROGRAM, count++, "View"); } menu.add(0, MENU_ITEM_DELETE_PROGRAM, count++, "Delete"); */ } @Override public boolean onContextItemSelected(MenuItem item) { /*AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch(item.getItemId()) { case MENU_ITEM_DELETE_PROGRAM: mTable.deleteRecord(info.id); cursor = DBEngine.getTrainingProgramCursor(isTemplate); cursorAdapter.swapCursor(cursor); break; case MENU_ITEM_OPEN_PROGRAM: onOpenProgram(info.id); break; case MENU_ITEM_VIEW_PROGRAM: onViewProgram(info.id); break; case MENU_ITEM_START_PROGRAM: onStartProgram(info.id); break; }*/ return true;//super.onContextItemSelected(item); } @Override public void onResume() { super.onResume(); cursor1 = DBEngine.getTrainingProgramCursor(Constants.TT_PROGRAM_TEMPLATE); cursorAdapter1.swapCursor(cursor1); ListView lvPrograms = (ListView) parent_view.findViewById(R.id.listViewPrograms); lvPrograms.setSelection(selProgramPosition); onSelectProgram(selProgramPosition); } @Override public void onDestroy() { super.onDestroy(); cursor1.close(); cursor2.close(); } private void onSelectProgram(int position) { mainProgramID = 0; if (cursor1.moveToPosition(position)) { selProgramName = cursor1.getString(cursor1.getColumnIndex(TrainingProgramTable.COL_NAME)); mainProgramID = cursor1.getLong(cursor1.getColumnIndex(TrainingProgramTable.COL_ID)); selProgramPosition = position; } else { selProgramName = ""; selProgramPosition = 0; } //cursor2 = DBEngine.getTrainingProgramCursor(Constants.TT_USER_PROGRAM, selProgramName); //updateCalendarData(cursor2); programDayAdapter = getDayProgramsAdapter(new Date(0)); lvDayPrograms.setAdapter(programDayAdapter); } private void onStartProgram(long id) { Intent intentNewProgram = new Intent(parent_view.getContext(), TrainingProgramActivity.class); intentNewProgram.putExtra(Constants.INTENT_PARAM_ID, (int)id); intentNewProgram.putExtra(Constants.INTENT_PARAM_IS_TEMPLATE, Constants.TT_PROGRAM_TEMPLATE/*Constants.TT_USER_PROGRAM*/); startActivity(intentNewProgram); } private void onOpenProgram(long id) { if (id <= 0) { return; } Intent intentProgram = new Intent(parent_view.getContext(), TrainingProgramActivity.class); intentProgram.putExtra(Constants.INTENT_PARAM_ID, (int)id); intentProgram.putExtra(Constants.INTENT_PARAM_IS_TEMPLATE, Constants.TT_USER_PROGRAM); startActivity(intentProgram); } private void onViewProgram(long id) { Intent intentProgram = new Intent(parent_view.getContext(), TrainingProgramActivity.class); intentProgram.putExtra(Constants.INTENT_PARAM_ID, (int)id); intentProgram.putExtra(Constants.INTENT_PARAM_VIEW_MODE, 1); intentProgram.putExtra(Constants.INTENT_PARAM_IS_TEMPLATE, Constants.TT_USER_PROGRAM); startActivity(intentProgram); } private void updateCalendarData(Cursor cursor) { /*caldroidFragment = new CaldroidFragment(); Bundle args = new Bundle(); calendar = Calendar.getInstance(); args.putInt(CaldroidFragment.MONTH, calendar.get(Calendar.MONTH) + 1); args.putInt(CaldroidFragment.YEAR, calendar.get(Calendar.YEAR)); caldroidFragment.setArguments(args); caldroidFragment.setCaldroidListener(new JobCaldroidListener(this)); HashMap<Date, Integer> datesMap = new HashMap<>(); while (cursor.moveToNext()) { int db_time = cursor.getInt(cursor.getColumnIndex(TrainingProgramTable.COL_DATE)); long time = (long)db_time*1000; Date date = new Date(time); datesMap.put(date, R.drawable.round_button_green); } caldroidFragment.setBackgroundResourceForDates(datesMap); FragmentTransaction t = getSupportFragmentManager().beginTransaction(); t.replace(R.id.calendar, caldroidFragment); t.commit(); curDate = calendar.getTime();*/ } private long getProgramID(Date date) { Cursor cursor = DBEngine.getTrainingProgramCursor(Constants.TT_USER_PROGRAM, selProgramName); while (cursor.moveToNext()) { int db_time = cursor.getInt(cursor.getColumnIndex(TrainingProgramTable.COL_DATE)); long time = (long) db_time * 1000; Date dateDB = new Date(time); //long curTime = date.getTime(); if (date.getTime() == dateDB.getTime()) { return cursor.getLong(cursor.getColumnIndex(TrainingProgramTable.COL_ID)); } } return 0; } private UserProgramsDayAdapter getDayProgramsAdapter(Date date) { List<ProgramData> objects = new ArrayList<>(); Cursor cursor = DBEngine.getTrainingProgramCursor(Constants.TT_USER_PROGRAM, selProgramName); while (cursor.moveToNext()) { int db_time = cursor.getInt(cursor.getColumnIndex(TrainingProgramTable.COL_DATE)); long time = (long) db_time * 1000; Date dateDB = new Date(time); if ( date.getTime() == 0 || TrainingProgramTable.compareNormalizedDates(date, dateDB)==true) { String name = cursor.getString(cursor.getColumnIndex(TrainingProgramTable.COL_NAME)); String note = cursor.getString(cursor.getColumnIndex(TrainingProgramTable.COL_NOTE)); ProgramData data = new ProgramData(name, new Date(time), note); objects.add(data); } } Collections.sort(objects, new Comparator<ProgramData>() { @Override public int compare(ProgramData lhs, ProgramData rhs) { if (lhs.getmDate().getTime() > rhs.getmDate().getTime()) { return -1; } else { if (lhs.getmDate().getTime() < rhs.getmDate().getTime()) { return 1; } } return 0; } }); UserProgramsDayAdapter adapter = new UserProgramsDayAdapter(parent_view.getContext(), objects); return adapter; } class JobCaldroidListener extends CaldroidListener { public Context context; public JobCaldroidListener(Context context) { this.context = context; } @Override public void onSelectDate(Date date, View view) { curDate = date; programDayAdapter = getDayProgramsAdapter(date); lvDayPrograms.setAdapter(programDayAdapter); /*long db_id = getProgramID(date); if (db_id>0) { onOpenProgram(db_id); } else { onStartProgram(mainProgramID); }*/ } @Override public void onLongClickDate(Date date, View view) { } } }
2e43817ac02d7ef14de0f4d1dc716e6fecef89a2
503257cbf55a2efef8a512075d9e4885fec3f6f3
/src/main/java/com/fgrapp/blog/blogserver/article/service/impl/ArticleServiceImpl.java
bef948a091d64d158ad967aaefeaf99c037d5884
[]
no_license
maoHuanZhe/blog-server
2b68f3d9ea06d3f3581b6842204b7f6770783324
58490baaa2e386c0b76c671bd4ec7c20cf4325bc
refs/heads/master
2022-09-15T07:43:58.523637
2019-09-30T09:00:30
2019-09-30T09:00:30
211,818,361
1
0
null
2022-09-01T23:13:37
2019-09-30T08:57:59
Java
UTF-8
Java
false
false
1,152
java
package com.fgrapp.blog.blogserver.article.service.impl; import com.fgrapp.blog.blogserver.article.entity.Article; import com.fgrapp.blog.blogserver.article.mapper.ArticleMapper; import com.fgrapp.blog.blogserver.article.service.ArticleService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.fgrapp.blog.blogserver.common.util.Query; import com.fgrapp.blog.blogserver.common.util.PageUtils; import org.springframework.stereotype.Service; import java.util.Map; /** * <p> * 文章 服务实现类 * </p> * * @author fgr * @since 2019-09-26 */ @Service public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService { /** * 分页查询 * @param params * @return */ @Override public PageUtils queryPage(Map<String, Object> params) { IPage<Article> page=baseMapper.selectPage(new Query<Article>(params).getPage(), new QueryWrapper<Article>().lambda()); return new PageUtils(page); } }
332e1f58d9a2db368a323d70d48fb4446396de1e
744914dc3284f2b61c01b243dcf808858a35475c
/app/src/main/java/com/ferid/app/classroom/attendance/TakeAttendanceActivity.java
deff5b520437432baeaee461a72ffce76bd2aac0
[ "Apache-2.0" ]
permissive
kamlesh9070/Attendance-Taker_MHT
03e00bb70bba8f9232f1b529074347277c9684da
330dd3155a0c4e67ff4a46dc5783d783f564e14a
refs/heads/master
2021-07-16T09:38:20.704870
2017-06-29T10:54:27
2017-06-29T10:54:27
107,510,599
1
0
null
null
null
null
UTF-8
Java
false
false
11,651
java
/* * Copyright (C) 2015 Ferid Cafer * * 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.ferid.app.classroom.attendance; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.AppCompatCheckBox; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; import android.widget.TextView; import com.ferid.app.classroom.R; import com.ferid.app.classroom.adapters.TakeAttendanceAdapter; import com.ferid.app.classroom.database.DatabaseManager; import com.ferid.app.classroom.date_time_pickers.DatePickerFragment; import com.ferid.app.classroom.date_time_pickers.TimePickerFragment; import com.ferid.app.classroom.listeners.AdapterClickListener; import com.ferid.app.classroom.listeners.DateBackListener; import com.ferid.app.classroom.model.Classroom; import com.ferid.app.classroom.model.Student; import com.ferid.app.classroom.past_attendances.PastAttendancesListActivity; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; /** * Created by ferid.cafer on 4/16/2015.<br /> * Takes attendance. */ public class TakeAttendanceActivity extends AppCompatActivity implements DateBackListener { private Context context; private Toolbar toolbar; private RecyclerView list; private ArrayList<Student> arrayList = new ArrayList<>(); private TakeAttendanceAdapter adapter; private TextView emptyText; //empty list view text private Classroom classroom; private String classDate = ""; //date and time pickers private DatePickerFragment datePickerFragment; private TimePickerFragment timePickerFragment; private Date changedDate; //save button private FloatingActionButton floatingActionButton; //select all - all students are present or absent private AppCompatCheckBox checkBoxSelectAll; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.selectable_list); Bundle args = getIntent().getExtras(); if (args != null) { classroom = args.getParcelable("classroom"); } context = this; //toolbar setToolbar(); list = (RecyclerView) findViewById(R.id.list); adapter = new TakeAttendanceAdapter(context, arrayList); list.setAdapter(adapter); list.setLayoutManager(new LinearLayoutManager(context)); list.setHasFixedSize(true); emptyText = (TextView) findViewById(R.id.emptyText); emptyText.setText(getString(R.string.emptyMessageSave)); addAdapterClickListener(); floatingActionButton = (FloatingActionButton) findViewById(R.id.floatingActionButton); startButtonAnimation(); checkBoxSelectAll = (AppCompatCheckBox) findViewById(R.id.checkBoxSelectAll); checkBoxSelectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (!arrayList.isEmpty()) { //make all students present or absent for (Student stud : arrayList) { stud.setPresent(isChecked); } adapter.notifyDataSetChanged(); } } }); new SelectStudents().execute(); } /** * Create toolbar and set its attributes */ private void setToolbar() { toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); } Date dateTime = new Date(); SimpleDateFormat targetFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); classDate = targetFormat.format(dateTime); if (toolbar != null && classroom != null && classDate != null) { setTitle(classroom.getName()); toolbar.setSubtitle(classDate); } } /** * Set empty list text */ private void setEmptyText() { if (emptyText != null) { if (arrayList.isEmpty()) { emptyText.setVisibility(View.VISIBLE); } else { emptyText.setVisibility(View.GONE); } } } /** * Set floating action button with its animation */ private void startButtonAnimation() { new Handler().post(new Runnable() { @Override public void run() { floatingActionButton.setImageResource(R.drawable.ic_action_save); floatingActionButton.show(); } }); floatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { insertNewAttendance(); } }); } /** * List item click event */ private void addAdapterClickListener() { adapter.setAdapterClickListener(new AdapterClickListener() { @Override public void OnItemClick(int position) { if (arrayList.size() > position) { Student student = arrayList.get(position); boolean isPresent = !student.isPresent(); arrayList.get(position).setPresent(isPresent); adapter.notifyDataSetChanged(); } } }); } /** * Shows date picker */ private void changeDate() { datePickerFragment = new DatePickerFragment(); datePickerFragment.show(getSupportFragmentManager(), "DatePickerFragment"); } /** * Shows time picker */ private void changeTime() { timePickerFragment = new TimePickerFragment(); timePickerFragment.show(getSupportFragmentManager(), "TimePickerFragment"); } /** * Makes the change both on variable that will be send to DB and on the toolbar subtitle */ private void changeDateTime() { SimpleDateFormat targetFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); classDate = targetFormat.format(changedDate); toolbar.setSubtitle(classDate); } @Override public void OnPress(int dayOfMonth, int month, int year) { changedDate.setYear(year - 1900); changedDate.setMonth(month); changedDate.setDate(dayOfMonth); changeTime(); } @Override public void OnPress(int minute, int hour) { changedDate.setHours(hour); changedDate.setMinutes(minute); changeDateTime(); } /** * Go to past attendaces of the given classroom */ private void goToPastAttendances() { Intent intent = new Intent(context, PastAttendancesListActivity.class); intent.putExtra("classroom", classroom); startActivity(intent); overridePendingTransition(R.anim.move_in_from_bottom, R.anim.stand_still); } /** * Select students from DB */ private class SelectStudents extends AsyncTask<Void, Void, ArrayList<Student>> { @Override protected ArrayList<Student> doInBackground(Void... params) { ArrayList<Student> tmpList = null; if (classroom != null) { DatabaseManager databaseManager = new DatabaseManager(context); tmpList = databaseManager.selectStudents(classroom.getId()); } return tmpList; } @Override protected void onPostExecute(ArrayList<Student> tmpList) { arrayList.clear(); if (tmpList != null) { arrayList.addAll(tmpList); adapter.notifyDataSetChanged(); setEmptyText(); } } } /** * Inserts a new attendance after check its existence */ private void insertNewAttendance() { new IsAlreadyExist().execute(); } private class IsAlreadyExist extends AsyncTask<Void, Void, Boolean> { @Override protected Boolean doInBackground(Void... params) { boolean isExist = false; if (classroom != null) { DatabaseManager databaseManager = new DatabaseManager(context); isExist = databaseManager.selectAttendanceToCheckExistance(classroom.getId(), classDate); } return isExist; } @Override protected void onPostExecute(Boolean isExist) { if (isExist) { Snackbar.make(list, getString(R.string.couldNotInsertAttendance), Snackbar.LENGTH_LONG).show(); } else { new InsertAttendance().execute(); } } } /** * Insert attendance name into DB */ private class InsertAttendance extends AsyncTask<Void, Void, Boolean> { @Override protected Boolean doInBackground(Void... params) { boolean isSuccessful = false; if (arrayList != null) { DatabaseManager databaseManager = new DatabaseManager(context); isSuccessful = databaseManager.insertAttendance(arrayList, classDate); } return isSuccessful; } @Override protected void onPostExecute(Boolean isSuccessful) { if (isSuccessful) { Intent intent = new Intent(); setResult(RESULT_OK, intent); } closeWindow(); } } private void closeWindow() { finish(); overridePendingTransition(R.anim.stand_still, R.anim.move_out_to_bottom); } @Override public void onBackPressed() { closeWindow(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_attendance, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar actions click switch (item.getItemId()) { case android.R.id.home: closeWindow(); return true; case R.id.changeDateTime: changedDate = new Date(); changeDate(); return true; case R.id.pastAttendances: goToPastAttendances(); return true; default: return super.onOptionsItemSelected(item); } } }
71cf325294d01b2aaafa0e55fc5d56a3b15ddf8f
4d1c8124b5a515bbfbf87ddf213fbb24f82580a1
/src/main/java/TareaSingletonCambioMonedas/Banco.java
6e00fcce3a5e5519e546593a3926f16e93a6a411
[]
no_license
Manu200162/TareasPatronesDiseno
31d57355e115cffa83793387fcbf634d5b278ac0
57ca0e4f740401fcf7afd80410511b4ee6672122
refs/heads/master
2023-06-12T23:22:23.419454
2021-07-01T05:19:22
2021-07-01T05:19:22
368,734,502
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package TareaSingletonCambioMonedas; public class Banco { public Banco(){ } public void cambio (double cantidad, Moneda inicial, String cambioMoneda){ System.out.print("El cambio para "+cantidad+" "+inicial.getSimbolo()+" es: "); CambioMonedas.getInstance().realizarCambio(cantidad,inicial,cambioMoneda); } }
67482435cee35cfe32f6dfa9a67d8b5a63d8c82b
a2df6764e9f4350e0d9184efadb6c92c40d40212
/aliyun-java-sdk-linkvisual/src/main/java/com/aliyuncs/linkvisual/model/v20180120/QueryTimeTemplateDetailResponse.java
15c70c932e923e3b31d02fb01139f4040c44173a
[ "Apache-2.0" ]
permissive
warriorsZXX/aliyun-openapi-java-sdk
567840c4bdd438d43be6bd21edde86585cd6274a
f8fd2b81a5f2cd46b1e31974ff6a7afed111a245
refs/heads/master
2022-12-06T15:45:20.418475
2020-08-20T08:37:31
2020-08-26T06:17:49
290,450,773
1
0
NOASSERTION
2020-08-26T09:15:48
2020-08-26T09:15:47
null
UTF-8
Java
false
false
3,602
java
/* * 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.aliyuncs.linkvisual.model.v20180120; import java.util.List; import com.aliyuncs.AcsResponse; import com.aliyuncs.linkvisual.transform.v20180120.QueryTimeTemplateDetailResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class QueryTimeTemplateDetailResponse extends AcsResponse { private String requestId; private Boolean success; private String errorMessage; private String code; private Data data; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public Boolean getSuccess() { return this.success; } public void setSuccess(Boolean success) { this.success = success; } public String getErrorMessage() { return this.errorMessage; } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } public Data getData() { return this.data; } public void setData(Data data) { this.data = data; } public static class Data { private Integer _default; private String name; private String templateId; private Integer allDay; private List<TimeSectionListItem> timeSectionList; public Integer get_Default() { return this._default; } public void set_Default(Integer _default) { this._default = _default; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getTemplateId() { return this.templateId; } public void setTemplateId(String templateId) { this.templateId = templateId; } public Integer getAllDay() { return this.allDay; } public void setAllDay(Integer allDay) { this.allDay = allDay; } public List<TimeSectionListItem> getTimeSectionList() { return this.timeSectionList; } public void setTimeSectionList(List<TimeSectionListItem> timeSectionList) { this.timeSectionList = timeSectionList; } public static class TimeSectionListItem { private Integer dayOfWeek; private Integer begin; private Integer end; public Integer getDayOfWeek() { return this.dayOfWeek; } public void setDayOfWeek(Integer dayOfWeek) { this.dayOfWeek = dayOfWeek; } public Integer getBegin() { return this.begin; } public void setBegin(Integer begin) { this.begin = begin; } public Integer getEnd() { return this.end; } public void setEnd(Integer end) { this.end = end; } } } @Override public QueryTimeTemplateDetailResponse getInstance(UnmarshallerContext context) { return QueryTimeTemplateDetailResponseUnmarshaller.unmarshall(this, context); } @Override public boolean checkShowJsonItemName() { return false; } }
3dd2890fb85b0cbae4a63b348e29d0413f571e5f
0e331236698d3a0603cb35178f0e570c03461883
/lox/app/src/main/java/com/craftinginterpreters/lox/AstPrinter.java
7c7cc811109a8ecb027acf8047e95b018d4de967
[]
no_license
titonova/realdeal
ae8446e6cadb57dbb8515e0afcf85fc697449f51
c767f3931b9b19a9425a626d656aac14eda553ce
refs/heads/master
2022-10-21T09:40:50.295433
2020-06-10T12:43:39
2020-06-10T12:43:39
271,278,533
1
0
null
null
null
null
UTF-8
Java
false
false
6,794
java
//> Representing Code ast-printer package com.craftinginterpreters.lox; // Creates an unambiguous, if ugly, string representation of AST nodes. /* Representing Code ast-printer < Statements and State omit class AstPrinter implements Expr.Visitor<String> { */ //> Statements and State omit class AstPrinter implements Expr.Visitor<String>, Stmt.Visitor<String> { //< Statements and State omit String print(Expr expr) { return expr.accept(this); } //> Statements and State omit String print(Stmt stmt) { return stmt.accept(this); } //< Statements and State omit //> visit-methods //> Statements and State omit @Override public String visitBlockStmt(Stmt.Block stmt) { StringBuilder builder = new StringBuilder(); builder.append("(block "); for (Stmt statement : stmt.statements) { builder.append(statement.accept(this)); } builder.append(")"); return builder.toString(); } //< Statements and State omit //> Classes omit @Override public String visitClassStmt(Stmt.Class stmt) { StringBuilder builder = new StringBuilder(); builder.append("(class " + stmt.name.lexeme); //> Inheritance omit if (stmt.superclass != null) { builder.append(" < " + print(stmt.superclass)); } //< Inheritance omit for (Stmt.Function method : stmt.methods) { builder.append(" " + print(method)); } builder.append(")"); return builder.toString(); } //< Classes omit //> Statements and State omit @Override public String visitExpressionStmt(Stmt.Expression stmt) { return parenthesize(";", stmt.expression); } //< Statements and State omit //> Functions omit @Override public String visitFunctionStmt(Stmt.Function stmt) { StringBuilder builder = new StringBuilder(); builder.append("(fun " + stmt.name.lexeme + "("); for (Token param : stmt.params) { if (param != stmt.params.get(0)) builder.append(" "); builder.append(param.lexeme); } builder.append(") "); for (Stmt body : stmt.body) { builder.append(body.accept(this)); } builder.append(")"); return builder.toString(); } //< Functions omit //> Control Flow omit @Override public String visitIfStmt(Stmt.If stmt) { if (stmt.elseBranch == null) { return parenthesize2("if", stmt.condition, stmt.thenBranch); } return parenthesize2("if-else", stmt.condition, stmt.thenBranch, stmt.elseBranch); } //< Control Flow omit //> Statements and State omit @Override public String visitPrintStmt(Stmt.Print stmt) { return parenthesize("print", stmt.expression); } //< Statements and State omit //> Functions omit @Override public String visitReturnStmt(Stmt.Return stmt) { if (stmt.value == null) return "(return)"; return parenthesize("return", stmt.value); } //< Functions omit //> Statements and State omit @Override public String visitVarStmt(Stmt.Var stmt) { if (stmt.initializer == null) { return parenthesize2("var", stmt.name); } return parenthesize2("var", stmt.name, "=", stmt.initializer); } //< Statements and State omit //> Control Flow omit @Override public String visitWhileStmt(Stmt.While stmt) { return parenthesize2("while", stmt.condition, stmt.body); } //< Control Flow omit //> Statements and State omit @Override public String visitAssignExpr(Expr.Assign expr) { return parenthesize2("=", expr.name.lexeme, expr.value); } //< Statements and State omit @Override public String visitBinaryExpr(Expr.Binary expr) { return parenthesize(expr.operator.lexeme, expr.left, expr.right); } //> Functions omit @Override public String visitCallExpr(Expr.Call expr) { return parenthesize2("call", expr.callee, expr.arguments); } //< Functions omit //> Classes omit @Override public String visitGetExpr(Expr.Get expr) { return parenthesize2(".", expr.object, expr.name.lexeme); } //< Classes omit @Override public String visitGroupingExpr(Expr.Grouping expr) { return parenthesize("group", expr.expression); } @Override public String visitLiteralExpr(Expr.Literal expr) { if (expr.value == null) return "nil"; return expr.value.toString(); } //> Control Flow omit @Override public String visitLogicalExpr(Expr.Logical expr) { return parenthesize(expr.operator.lexeme, expr.left, expr.right); } //< Control Flow omit //> Classes omit @Override public String visitSetExpr(Expr.Set expr) { return parenthesize2("=", expr.object, expr.name.lexeme, expr.value); } //< Classes omit //> Inheritance omit @Override public String visitSuperExpr(Expr.Super expr) { return parenthesize2("super", expr.method); } //< Inheritance omit //> Classes omit @Override public String visitThisExpr(Expr.This expr) { return "this"; } //< Classes omit @Override public String visitUnaryExpr(Expr.Unary expr) { return parenthesize(expr.operator.lexeme, expr.right); } //> Statements and State omit @Override public String visitVariableExpr(Expr.Variable expr) { return expr.name.lexeme; } //< Statements and State omit //< visit-methods //> print-utilities private String parenthesize(String name, Expr... exprs) { StringBuilder builder = new StringBuilder(); builder.append("(").append(name); for (Expr expr : exprs) { builder.append(" "); builder.append(expr.accept(this)); } builder.append(")"); return builder.toString(); } //< print-utilities //> omit // Note: AstPrinting other types of syntax trees is not shown in the // book, but this is provided here as a reference for those reading // the full code. private String parenthesize2(String name, Object... parts) { StringBuilder builder = new StringBuilder(); builder.append("(").append(name); for (Object part : parts) { builder.append(" "); if (part instanceof Expr) { builder.append(((Expr)part).accept(this)); //> Statements and State omit } else if (part instanceof Stmt) { builder.append(((Stmt) part).accept(this)); //< Statements and State omit } else if (part instanceof Token) { builder.append(((Token) part).lexeme); } else { builder.append(part); } } builder.append(")"); return builder.toString(); } //< omit /* Representing Code printer-main < Representing Code omit public static void main(String[] args) { Expr expression = new Expr.Binary( new Expr.Unary( new Token(TokenType.MINUS, "-", null, 1), new Expr.Literal(123)), new Token(TokenType.STAR, "*", null, 1), new Expr.Grouping( new Expr.Literal(45.67))); System.out.println(new AstPrinter().print(expression)); } */ }
f699c190cf1f5e437e15b8844eb76ff7bbdd0ca6
f842067f4999a3d4c63456b2c4061d9412fab052
/app/src/main/java/edu/unsa/exam2/service/MqttConstant.java
70864e201a2d9bea352713b13cdd31ef54618b58
[]
no_license
DarkCat777/DANP-Exam-2
7a1c1f11ad5823984fb082583c9b18ce375e1a0f
2950ed38034bc278420d6e91c674af21a55254c2
refs/heads/main
2023-06-23T03:56:14.232354
2021-07-04T03:34:04
2021-07-04T03:34:04
379,730,500
0
0
null
null
null
null
UTF-8
Java
false
false
816
java
package edu.unsa.exam2.service; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; public class MqttConstant { public static String clientId = "AndroidClient"; // JavaClient public static String mqttUsername = "android"; // java public static String mqttPassword = "12345678"; // 12345678 public static String mqttHost = "node02.myqtthub.com"; public static Integer mqttPort = 1883; public static String sensorName = "acelerometerSensor"; public static String mqttTopic = "unsa/devices/android/" + sensorName; public static Integer mqttQOS = 0; public static MqttConnectOptions mqttConnectOptions = new MqttConnectOptions(); static { mqttConnectOptions.setUserName(mqttUsername); mqttConnectOptions.setPassword(mqttPassword.toCharArray()); } }
1edb262b5395b2b7ecb14bca1849fa2619205f48
e912d336c9df3351fc7fd146c70022d2890a80ce
/PatronesDiseno/src/PrototypePattern/Rectangle.java
0176f409f0ea7994b0b19cdf2a6c0b0cb9e404aa
[ "Apache-2.0" ]
permissive
HomeDevJava/Patrones
dffb263effe9acd55a0d0724855ec562c482a0c0
30f5bde352ffdbcca2ae620ed63f87c091b21f9c
refs/heads/master
2021-06-10T12:33:38.560426
2021-03-28T00:56:45
2021-03-28T00:56:45
140,031,447
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package PrototypePattern; public class Rectangle extends Figura{ public Rectangle() { type="Rectangle"; } public void draw() { System.out.println("Adentro del Rectangulo:: metodo draw()"); } }
5c7b9e7930d79124959c7b0851397d3e10008290
35483f71b227763ad37bf5766558df16a3055447
/src/main/java/com/softwareverde/bitcoin/server/node/ExtraThinBlockParameters.java
66c0e17500032a908d6bb262719fb2062f8699c1
[ "MIT" ]
permissive
SoftwareVerde/bitcoin-verde
1f4f49ed46a2086d33053b0ed5608605902c2be9
e9d140cac8b93a9db572bda906db9decfac1d7ae
refs/heads/master
2023-07-11T16:28:46.730818
2023-04-29T13:40:44
2023-04-29T13:40:44
124,832,169
42
19
MIT
2022-12-21T21:59:19
2018-03-12T04:05:56
Java
UTF-8
Java
false
false
742
java
package com.softwareverde.bitcoin.server.node; import com.softwareverde.bitcoin.block.header.BlockHeader; import com.softwareverde.bitcoin.transaction.Transaction; import com.softwareverde.constable.bytearray.ByteArray; import com.softwareverde.constable.list.List; public class ExtraThinBlockParameters { public final BlockHeader blockHeader; public final List<ByteArray> transactionHashes; public final List<Transaction> transactions; public ExtraThinBlockParameters(final BlockHeader blockHeader, final List<ByteArray> transactionHashes, final List<Transaction> transactions) { this.blockHeader = blockHeader; this.transactionHashes = transactionHashes; this.transactions = transactions; } }
818fc5056cb5c91a120ed3bc36949ecb1ac8990f
9b84a8a87661d10433b5f6ad2477ff197b5549bf
/src/main/java/com/projects/resumeManager/repository/CertificateRepository.java
d55ac3fffbce029313398a175f6ef9528a07736b
[]
no_license
grove156/resumeManager
4d14ebc11ae97cb67e0229a0a416cecb6a07ff5d
56c4ed7168a3c3dcae2dec823d4468f885d79fa7
refs/heads/master
2023-01-09T20:10:32.360913
2020-10-24T01:38:44
2020-10-24T01:38:44
290,962,984
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
package com.projects.resumeManager.repository; import com.projects.resumeManager.domain.entity.Certificate; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CertificateRepository extends JpaRepository<Certificate, Long> { }
90f7711ac19a6b3c50498e2f2ad0422f98ebdea8
12f81322b959c5f4865fde2d186de44b1bdc8ad2
/jvm/src/main/java/com/pine/ch03/reftype/TestWeakRef.java
80a54a02a16e96b4184ff49f4f0028f976ecf238
[]
no_license
SunSmileAZY/java-demo
55660455a38229092798085564998d4a0e436ff3
3fa65f84607008dd106d2db50fd9deb38d8aaba6
refs/heads/master
2020-12-14T17:45:25.736733
2020-04-19T11:58:29
2020-04-19T11:58:29
234,828,474
0
0
null
null
null
null
UTF-8
Java
false
false
795
java
package com.pine.ch03.reftype; import java.lang.ref.WeakReference; /** * @author 【享学课堂】 King老师 * 弱引用 */ public class TestWeakRef { public static class User{ public int id = 0; public String name = ""; public User(int id, String name) { super(); this.id = id; this.name = name; } @Override public String toString() { return "User [id=" + id + ", name=" + name + "]"; } } public static void main(String[] args) { User u = new User(1,"King"); WeakReference<User> userWeak = new WeakReference<User>(u); u = null;//干掉强引用,确保这个实例只有userWeak的弱引用 System.out.println(userWeak.get()); System.gc();//进行一次GC垃圾回收 System.out.println("After gc"); System.out.println(userWeak.get()); } }
78c3b1645df3c63840e638734c569c271c5ff947
364613af24c93df49c25dceb62561309c164ce65
/src/main/java/fi/tkgwf/ruuvi/utils/RuuviUtils.java
47708d59c5d7df0fddf8c225a867e256236fe3d6
[]
no_license
mukatee/RuuviCollector
025349c6babdf790f8f6a2302a6ea4c70659f266
e9a4e6ff46940deece9bf609e975ca871ecdfa94
refs/heads/master
2021-01-20T07:57:26.713476
2017-05-02T20:35:41
2017-05-02T20:35:41
90,074,106
0
1
null
2017-05-02T20:15:56
2017-05-02T20:15:56
null
UTF-8
Java
false
false
1,767
java
package fi.tkgwf.ruuvi.utils; public abstract class RuuviUtils { /** * Converts a space-separated string of hex to ASCII * * @param hex space separated string of hex * @return the ASCII representation of the hex string */ public static String hexToAscii(String hex) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < hex.length(); i += 3) { sb.append((char) Integer.parseInt(hex.substring(i, i + 2), 16)); } return sb.toString(); } /** * Converts a hex sequence to raw bytes * * @param hex the hex string to parse * @return a byte-array containing the byte-values of the hex string */ public static byte[] hexToBytes(String hex) { String s = hex.replaceAll(" ", ""); int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16)); } return data; } /** * Gets a MAC address from a space-separated hex string, starting after the * prefix length * * @param line a space separated string of hex, first six decimals are * assumed to be part of the MAC address, rest of the line is discarded * @return the MAC address, without spaces */ public static String getMacFromLine(String line) { StringBuilder sb = new StringBuilder(); String[] split = line.split(" ", 7); // 6 blocks plus remaining garbage for (int i = 5; i >= 0; i--) { sb.append(split[i]); } return sb.toString(); } }
6daaf2b243b4edb375505e9454b8eb3c970ff68c
27a954e57e8a4525f391e3b7d500d97fbfbaf7a8
/app/src/main/java/com/example/appn1/Banco.java
d1260e6322788795c2e1e9067e7d7eef80455961
[]
no_license
YagoGomes98/N1_Computa-o_Dispositivos_Moveis_Noite
cec8b51107e88ffd781ac885d84bd69ed4f7777a
9b2734f5f877f892619d9dfdbb9df6702d022830
refs/heads/master
2023-08-23T13:07:03.998841
2021-10-15T23:59:16
2021-10-15T23:59:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
820
java
package com.example.appn1; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class Banco extends SQLiteOpenHelper { private static final String NOME_BANCO = "AppN1"; private static final int VERSAO = 1; public Banco(Context context){ super(context, NOME_BANCO, null, VERSAO); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL( "CREATE TABLE IF NOT EXISTS cadastros ( " + " id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT , " + " nome TEXT NOT NULL , " + " editora TEXT , " + " descricao TEXT) "); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } }
32e7244361803a9f8c314f6ffc3fac77bc70eed0
285b03298e38567a9a2e1038fa91dc7f0b171cf3
/src/main/java/listener/currencyPolling/CurrencyPollingDocumentBaseListener.java
d335d7c54c456f71be84dc154c82e95259653d0d
[]
no_license
veenarm/TradeMaster_POE
de2f6a63718bd4fcbd09ab40202e1ef20e3c65fb
a1a1c304ec57a264db105fa99a09514dde71fd36
refs/heads/master
2023-05-09T19:55:36.286639
2021-10-22T09:25:49
2021-10-22T09:25:49
170,823,265
1
0
null
2023-04-28T14:52:44
2019-02-15T07:49:08
Java
UTF-8
Java
false
false
787
java
package listener.currencyPolling; import gui.MainFrame; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.event.ActionEvent; public abstract class CurrencyPollingDocumentBaseListener extends CurrencyPollingBaseListener implements DocumentListener { public CurrencyPollingDocumentBaseListener(MainFrame frame) { super(frame); } @Override public void actionPerformed(ActionEvent e) { // Nothign here } public void changedUpdate(DocumentEvent e) { eventChecks(e); } public void removeUpdate(DocumentEvent e) { eventChecks(e); } public void insertUpdate(DocumentEvent e) { eventChecks(e); } public abstract void eventChecks(DocumentEvent e); }
eb3833fd8ccaae89481685d12e274e5504c2d427
00dbd88cf86e9ebc51a4afe3fbe756a04e098e93
/src/main/java/com/innoseti/model/entity/Book.java
35d8a002e72e1c96130c502d41188b1d96fad3e9
[]
no_license
SadnessX1600/innoseti
84800e16b45429da85b8a2ae7fdedbbdbf767555
768e8150ea2414d2a04d7b86ad7f4294b78e1534
refs/heads/master
2023-07-19T21:11:27.087606
2021-09-05T17:00:31
2021-09-05T17:00:31
401,996,533
0
0
null
null
null
null
UTF-8
Java
false
false
581
java
package com.innoseti.model.entity; import lombok.Data; import javax.persistence.*; import javax.validation.constraints.NotBlank; import java.util.List; @Entity @Data public class Book { @GeneratedValue @Id @Column(name = "book_id") private long id; @Column(nullable = false) @NotBlank private String title; @Column @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "AUTHOR_BOOK", joinColumns = @JoinColumn(name = "book_book_id"), inverseJoinColumns = @JoinColumn(name = "author_author_id")) private List<Author> authors; }
61c0fca92b168144b84fcf6ceb7ecb1a2022d567
caf63faedd564cc81daba93f3a57b6b8896e0f01
/GitHub/src/com/github/main/package-info.java
aa6e991ea9f53e50fd70d29352f3f4586bf35df7
[]
no_license
Lukivion/Hello-World
36e54e0d0c764fc9733a4aca9c38890dbe983fb2
e60974421f98f0f1cbb6b940d6be70e58411f078
refs/heads/master
2021-01-25T11:55:37.747582
2017-06-10T17:06:14
2017-06-10T17:06:14
93,952,779
0
0
null
null
null
null
UTF-8
Java
false
false
77
java
/** * */ /** * @author Luke Bonnet * */ package com.github.main;
8f807434a53ebde0b9c5bba76b848bc0597bc3cf
f41db962f7981c8454984a7def7a29b5d615809e
/lab05/RandomGames.java
823f0976f6c3d04f6c75cfd17d7d9bab9cf58df0
[]
no_license
AlecDouglass/CSE2
d1864a4837e02070b966ef7a891740b9f1bd2fb8
112d898200c8545eef2d99dd90d63afbbdae72eb
refs/heads/master
2016-09-06T03:39:23.049170
2014-12-03T02:58:37
2014-12-03T02:58:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,641
java
//Alec Douglass //lab 05 //get a letter give a game //import Scanner import java.util.Scanner; //class public class RandomGames { //main method public static void main(String[] args){ Scanner myScanner = new Scanner (System.in);//declare and call constructor System.out.print("Enter R or r for roulette, C or c for craps, or P or p for pick a card: ");//prompt for game choice String game = myScanner.nextLine();//accept input as srting if (game.length() > 1){//length error System.out.println("a single character is expected");//print return;//terminate }//end length error else{//no length error if (game.equals("R") | game.equals("r")){//if roulette int randR = (int)(Math.random()*37); switch (randR){ case 0: System.out.println("Roulette: 0"); break; case 1: System.out.println("Roulette: 1"); break; case 2: System.out.println("Roulette: 2"); break; case 3: System.out.println("Roulette: 3"); break; case 4: System.out.println("Roulette: 4"); break; case 5: System.out.println("Roulette: 5"); break; case 6: System.out.println("Roulette: 6"); break; case 7: System.out.println("Roulette: 7"); break; case 8: System.out.println("Roulette: 8"); break; case 9: System.out.println("Roulette: 9"); break; case 10: System.out.println("Roulette: 10"); break; case 11: System.out.println("Roulette: 11"); break; case 12: System.out.println("Roulette: 12"); break; case 13: System.out.println("Roulette: 13"); break; case 14: System.out.println("Roulette: 14"); break; case 15: System.out.println("Roulette: 15"); break; case 16: System.out.println("Roulette: 16"); break; case 17: System.out.println("Roulette: 17"); break; case 18: System.out.println("Roulette: 18"); break; case 19: System.out.println("Roulette: 19"); break; case 20: System.out.println("Roulette: 20"); break; case 21: System.out.println("Roulette: 21"); break; case 22: System.out.println("Roulette: 22"); break; case 23: System.out.println("Roulette: 23"); break; case 24: System.out.println("Roulette: 24"); break; case 25: System.out.println("Roulette: 25"); break; case 26: System.out.println("Roulette: 26"); break; case 27: System.out.println("Roulette: 27"); break; case 28: System.out.println("Roulette: 28"); break; case 29: System.out.println("Roulette: 29"); break; case 30: System.out.println("Roulette: 30"); break; case 31: System.out.println("Roulette: 31"); break; case 32: System.out.println("Roulette: 32"); break; case 33: System.out.println("Roulette: 33"); break; case 34: System.out.println("Roulette: 34"); break; case 35: System.out.println("Roulette: 35"); break; case 36: System.out.println("Roulette: 36"); break; case 37: System.out.println("Roulette: 00"); break; } }//end if roulette else{//not roulette if (game.equals("C") | game.equals("c")){//if craps int randCA = (int)(Math.random()*5)+1; int randCB = (int)(Math.random()*5)+1; int total = randCB+randCA; System.out.println("Craps: "+randCB+"+"+randCA+"="+total); }//end if craps else{//not craps if (game.equals("P") | game.equals("p")){//if pick a card int suit = (int)(Math.random()*3); int card = (int)(Math.random()*12); String Face; String Family = ""; switch (suit){ case 0: Family = "Clubs"; break; case 1: Family = "Hearts"; break; case 2: Family = "Diamonds"; break; case 3: Family = "Spades"; break; }//end suit switch (card){ case 0: Face = "Ace"; break; case 1: Face = "Jack"; break; case 11: Face = "Queen"; break; case 12: Face = "King"; break; default: Face = Integer.toString(card); break; }//end card System.out.println(Face+" of "+Family); }//end if pick a card else{//no valid games selected System.out.println(game+" is not a valid input"); return; }//end no valid games selected }//end not craps }//end not roulette }//end no length error }//end method }//end class //////////note to self remember the string.equals() thing//////////// //////////////////////////////////////////////////////////////////////////////////////////////
2cf78604d756433cbf4fe63e0a4a6a79c9eb923b
7bb6c0c63afc4682de96ff920da2b973dfb8cc1b
/ambari-server/src/main/java/org/apache/ambari/server/api/AmbariPersistFilter.java
971b8a0ff4a7eda67cc2e342a63f7a6e72500fce
[ "Apache-2.0", "MS-PL", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
permissive
apache/incubator-ambari
4188245bae1eee7af409382d0add69455acbd1c9
bf747346312170834c6beb89a60c8624b47aa288
refs/heads/trunk
2023-07-02T17:16:19.741062
2013-11-23T02:44:54
2013-11-23T02:45:03
12,695,027
4
12
Apache-2.0
2023-06-13T22:46:18
2013-09-09T07:00:15
Java
UTF-8
Java
false
false
1,812
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 org.apache.ambari.server.api; import com.google.inject.Inject; import com.google.inject.Singleton; import com.google.inject.persist.PersistService; import com.google.inject.persist.UnitOfWork; import javax.servlet.*; import java.io.IOException; /** * Replacement for Guice built-in PersistFilter as PersistService is started on Ambari start */ @Singleton public class AmbariPersistFilter implements Filter { private final UnitOfWork unitOfWork; @Inject public AmbariPersistFilter(UnitOfWork unitOfWork) { this.unitOfWork = unitOfWork; } @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { unitOfWork.begin(); try { filterChain.doFilter(servletRequest, servletResponse); } finally { unitOfWork.end(); } } @Override public void destroy() { } }
cc22e7df353e51a9de107aab1fd094f42cec89be
9c98a4b357b88a586b810f82a4ae0bffc29275ad
/camel/file2db/src/main/java/org/bgi/file2db/database/DatabaseSchemaLoaderFactory.java
513ee3bc66da14953ee01f930e5dce30130f412e
[]
no_license
benoitguillon/myNotes
68ec1321470011fb63a153a1c332e4976ce35b81
28dcd302ba36ab82898c9c1500912ec044df654f
refs/heads/master
2016-09-06T10:54:48.745034
2015-08-18T11:16:03
2015-08-18T11:16:03
32,592,063
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package org.bgi.file2db.database; import org.bgi.file2db.format.FileFormat; public interface DatabaseSchemaLoaderFactory { public DatabaseSchemaLoader createSchemaLoader(FileFormat fileFormat); }
2a43b41677f231d180bdec37af8510ee3b52d9fb
b6dca47bb93da17cad489183b51e30ca5a84b014
/Validador/src/br/ufmg/hc/telessaude/commons/util/SecurityUtil.java
444aec1798cf214ca188b1f1f8f2a4f955a70d86
[]
no_license
brenommelo/Validacao
96f19a572e0da7ffdf46971fef99fb65c0e9f9b3
ea5f74f115e6fcca5f76c5ca5949ac2bea5b8660
refs/heads/master
2016-09-16T11:35:24.105708
2014-12-15T10:22:45
2014-12-15T10:22:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,282
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.ufmg.hc.telessaude.commons.util; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * * @author weslley.matos */ public class SecurityUtil { private static final String MD5 = "MD5"; public static String createPassword(String password) { MessageDigest md = null; try { md = MessageDigest.getInstance(MD5); md.update(password.getBytes()); password = encrypt(md.digest()); } catch (NoSuchAlgorithmException e) { } return password; } private static String encrypt(byte[] password) { StringBuilder s = new StringBuilder(); String psw = ""; for (int i = 0; i < password.length; i++) { int parteAlta = ((password[i] >> 4) & 0xf) << 4; int parteBaixa = password[i] & 0xf; if (parteAlta == 0) { s.append('0'); } s.append(Integer.toHexString(parteAlta | parteBaixa)); } psw = s.toString().toUpperCase(); return psw; } }
81faef2838fc4362bd21be2b58a9539f321686c8
98d4d3dd4127735ebd5ca1b125b08b99a3b1371d
/src/oose2015/states/OptionState.java
c2cec065279b4fbf2167f0fd3832c9ba7a057741
[ "MIT" ]
permissive
KasperHdL/Arena
36f02739c7a5ab5cbc66f62a5786931178d46df3
be210bd325e602d9ae9de7bd1c64b9facfe6e2b0
refs/heads/master
2021-01-17T05:48:40.642630
2015-07-17T12:52:42
2015-07-17T12:52:42
32,006,248
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package oose2015.states; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.StateBasedGame; /** * Created by kaholi on 6/20/15. */ public class OptionState extends CustomGameState { @Override public int getID() { return 3; } @Override public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException { } @Override public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException { } @Override public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int i) throws SlickException { } @Override public void enter(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException { } @Override public void leave(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException { } }
bbeb24889d6646fcee6c6f1856c60df5fc9c7ac4
c981bdda6232b5f4e5794b2a4f415ff00ec70e71
/src/main/java/com/oscar/springboot/app/controllers/ClienteRestController.java
f7a967b427d794c22814cd1d718a0fac68cb516b
[]
no_license
oscarLuna93/springdataJPA
22e9cd19f6a83ef6f2ada5b6ccf78ce9f0c9ffd0
4ce3b93aade7dde2661b16e109d98bee83a2e658
refs/heads/master
2022-07-07T06:14:07.867231
2020-03-15T04:53:58
2020-03-15T04:53:58
233,981,074
0
0
null
null
null
null
UTF-8
Java
false
false
687
java
package com.oscar.springboot.app.controllers; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.oscar.springboot.app.models.entity.Cliente; import com.oscar.springboot.app.models.service.IClienteService; @RestController @RequestMapping("/api/clientes") public class ClienteRestController { @Autowired private IClienteService clienteService; @GetMapping(value = "/listar") public List<Cliente> listar() { return clienteService.findAll(); } }
01a7a794052277c778be03367c73a0fd0c62aa84
535e5d97d44fd42fca2a6fc68b3b566046ffa6c2
/com/crashlytics/android/answers/C2853g.java
4153f34a770c6535198d303eaee1f4d0fbe78134
[]
no_license
eric-lanita/BigRoadTruckingLogbookApp_v21.0.12_source_from_JADX
47566c288bc89777184b73ef0eb199b61de39f82
fb84301d90ec083ce06c68a3828cf99d8855c007
refs/heads/master
2021-09-01T07:02:52.500068
2017-12-25T15:06:05
2017-12-25T15:06:05
115,346,008
0
3
null
null
null
null
UTF-8
Java
false
false
1,974
java
package com.crashlytics.android.answers; import io.fabric.sdk.android.C3969c; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; class C2853g { final AtomicReference<ScheduledFuture<?>> f9838a = new AtomicReference(); boolean f9839b = true; private final ScheduledExecutorService f9840c; private final List<C2852a> f9841d = new ArrayList(); private volatile boolean f9842e = true; class C28511 implements Runnable { final /* synthetic */ C2853g f9837a; C28511(C2853g c2853g) { this.f9837a = c2853g; } public void run() { this.f9837a.f9838a.set(null); this.f9837a.m16056c(); } } public interface C2852a { void mo1452a(); } public C2853g(ScheduledExecutorService scheduledExecutorService) { this.f9840c = scheduledExecutorService; } public void m16059a(boolean z) { this.f9842e = z; } private void m16056c() { for (C2852a a : this.f9841d) { a.mo1452a(); } } public void m16058a(C2852a c2852a) { this.f9841d.add(c2852a); } public void m16057a() { this.f9839b = false; ScheduledFuture scheduledFuture = (ScheduledFuture) this.f9838a.getAndSet(null); if (scheduledFuture != null) { scheduledFuture.cancel(false); } } public void m16060b() { if (this.f9842e && !this.f9839b) { this.f9839b = true; try { this.f9838a.compareAndSet(null, this.f9840c.schedule(new C28511(this), 5000, TimeUnit.MILLISECONDS)); } catch (Throwable e) { C3969c.m20576h().mo2850a("Answers", "Failed to schedule background detector", e); } } } }
c11c8e6a3ff74af5e417583f2979a3a80f88b80a
966e221a22712a5a86dc03304b7f2521024d6d36
/src/main/java/edu/shop/java/dao/accessors/DatabaseDatasourceAccessor.java
b04a52f478fc35d0303b13520f1f652f492b6015
[]
no_license
reheda-old/shop
e8e84048d0ca16600185fad4ed31c5312b35dd30
0e9ff1be2e8f5f747bde909472c2a9f3f30dd6c4
refs/heads/master
2022-07-25T18:11:03.262545
2016-12-29T15:56:45
2016-12-29T15:56:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
251
java
package edu.shop.java.dao.accessors; import javax.sql.DataSource; public abstract class DatabaseDatasourceAccessor { public DataSource load() { return null; } public abstract String getHost(); public abstract int getPort(); }
b714f6b3bc314d7e8d4c2dd02ec20ad7f3d0ec45
50f5a4674527ae619923023997c416a0937b1dff
/src/Utils/FieldUtilImpl.java
7f4c1cd626230edba9990b856c9cf5193e97c89f
[]
no_license
dzl911/softwarerepfulltextsearch
66d25d4f7f22d6e0c66b81db3f018907e90b616a
1f4cd8f40227918eababbdd97c8b92fc65be0a63
refs/heads/master
2021-07-08T21:00:12.714119
2017-10-08T10:39:59
2017-10-08T10:39:59
106,692,768
1
0
null
2017-10-12T12:55:38
2017-10-12T12:55:38
null
UTF-8
Java
false
false
1,589
java
package Utils; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.IntField; import org.apache.lucene.document.LongField; import org.apache.lucene.document.StoredField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexableField; public class FieldUtilImpl implements FieldUtil { @Override public IndexableField varCharOrChar(String fieldName, String fieldValue,Store storeType) { Field textField = new TextField(fieldName, fieldValue,storeType); return textField; } @Override public IndexableField stringField(String fieldName, String fieldValue, Store storeType) { Field stringField = new StringField(fieldName, fieldValue,storeType); return stringField; } @Override public IndexableField storedField(String fieldName, String fieldValue) { Field storedField = new StoredField(fieldName,fieldValue); return storedField; } @Override public IndexableField textField(String fieldName, String fieldValue, Store storeType) { Field textField = new TextField(fieldName, fieldValue,storeType); return textField; } @Override public IndexableField intField(String fieldName, int fieldValue,Store storeType) { Field intField = new IntField(fieldName, fieldValue, storeType); return intField; } @Override public IndexableField longField(String fieldName, long fieldValue,Store storeType) { Field longField = new LongField(fieldName, fieldValue, storeType); return longField; } }
adf14d7697fa418427522f94df0c2476e9c720e5
74692afc248b643f66288925da06d4c6997d84af
/ssmAuthority/src/main/java/cn/noteblogs/mapper/SysLogMapper.java
b5fe1d0bb0fe05797bb81e5f0a25b9b7031fb112
[]
no_license
GuoPuWen/ssmAuthority
4517c8999c013eefce22801da3df81b4f95fab1d
e29047740e5f58dcb9ef33a3f2bcc9b2c441077a
refs/heads/main
2023-03-28T12:37:22.612564
2021-03-30T09:07:26
2021-03-30T09:07:26
352,936,116
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package cn.noteblogs.mapper; import cn.noteblogs.domain.SysLog; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import org.springframework.stereotype.Service; import java.util.List; /** * @author FoFiten * @create 2021/3/13 23:29 */ @Repository("sysLogMapper") public interface SysLogMapper { @Insert("insert into syslog values(#{p.id},#{p.visitTime},#{p.username},#{p.ip},#{p.url},#{p.executionTime},#{p.method})") void save(@Param("p") SysLog sysLog); @Select("select * from syslog") List<SysLog> findAll(); }
372a933cf49e778d1fb336705031e789a201416e
c89b308035bcf00bc1f3779c1d9dc0fb234767a7
/app/src/main/java/com/digitaladvisor/growfast/ViewPagerAdapter/FragmentsStartUp/YourChoice.java
e1336429625524bc0091263598e3dbfcf1e70318
[]
no_license
mdasim2882/GrowFast
93288506958f4d999cc9a2abe19897ffe17d5d01
d4c5aed3f0efbfe0e10ce6c135b74833eabc4812
refs/heads/master
2023-04-13T17:55:33.029397
2023-04-13T10:26:34
2023-04-13T10:26:34
317,514,260
1
0
null
null
null
null
UTF-8
Java
false
false
2,465
java
package com.digitaladvisor.growfast.ViewPagerAdapter.FragmentsStartUp; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import androidx.fragment.app.Fragment; import com.digitaladvisor.growfast.NavigationItemsFolder.BusinessManagement; import com.digitaladvisor.growfast.R; /** * A simple {@link Fragment} subclass. * Use the {@link YourChoice#newInstance} factory method to * create an instance of this fragment. */ public class YourChoice extends Fragment { private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; static YourChoice instance; Button letsGoButton; public YourChoice() { // Required empty public constructor } public static YourChoice getInstance() { if (instance == null) instance = new YourChoice(); return instance; } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment YourChoice. */ // TODO: Rename and change types and number of parameters public static YourChoice newInstance(String param1, String param2) { YourChoice fragment = new YourChoice(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view= inflater.inflate(R.layout.fragment_your_choice, container, false); letsGoButton=view.findViewById(R.id.letsGo); letsGoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { goinside(); } }); return view; } public void goinside() { Intent i=new Intent(getActivity(), BusinessManagement.class); startActivity(i); getActivity().finish(); } }
93a27efb2f5869873533f0f2e477379a64b265c5
c81e64999dae49bb28241b3b48e6834a7e548174
/src/test/Test301_2.java
ad038a493bafb05e83709e5b53030ca753694c12
[]
no_license
RokeAbbey-chen/leetcode-test
c58c216959560141a07069a871aa764ba5a95c13
1fedfefa56b51bc2f3f49867a743c1e5b51990d3
refs/heads/master
2023-02-22T04:54:42.626149
2023-02-21T07:40:52
2023-02-21T07:40:52
174,921,429
0
0
null
null
null
null
UTF-8
Java
false
false
3,767
java
package test; import java.util.*; import java.util.function.Consumer; import java.util.regex.Matcher; import java.util.regex.Pattern; /* * Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may contain letters other than the parentheses ( and ). Examples: "()())()" -> ["()()()", "(())()"] "(a)())()" -> ["(a)()()", "(a())()"] ")(" -> [""] Credits: Special thanks to @hpplayer for adding this problem and creating all test cases. * * */ public class Test301_2 { public static void main(String[] args){ // HashSet<String> set = new HashSet<>(); // String s1 = "abc"; // String s2 = new String(s1); // set.add(s1); // System.out.println(set.contains(s2)); String s = "(((())))"; s = ""; s = "()())()"; s = "))"; s = "()())()"; s = ")("; s = "(()("; s = "))()()p"; s = "))))ab))c))d))e()fg"; s = "()())()"; System.out.println(new Test301_2().removeInvalidParentheses(s)); } public List<String> removeInvalidParentheses(String s) { HashSet<String> sset = new HashSet<>(); List<String> res = new ArrayList<>(); Queue<String> queue = new LinkedList<>(); Pattern p = Pattern.compile("^\\)*(\\w*)"); Matcher m = p.matcher(s); m.find(); StringBuffer head = new StringBuffer(); do{ s = s.substring(m.end()); System.out.println("m.group(1) = " + m.group(1)); head.append(m.group(1)); System.out.println(head); m = p.matcher(s); }while(m.find() && m.end() != 0); String h = head.toString(); if(isValid(s)) return Arrays.asList(h+s); queue.add(s.substring(m.end())); int maxValidLength = -1; while(!queue.isEmpty()){ String tempS = queue.poll(); char[] chs = tempS.toCharArray(); for(int i = 0; i < chs.length; i++){ if(chs[i] != '(' && chs[i] != ')') continue; while(i != 0 && i < chs.length && chs[i] == chs[i - 1]) i++; if(i >= chs.length) break; String newString = tempS.substring(0, i) + tempS.substring(i + 1, chs.length); boolean flag = !sset.contains(newString); System.out.println(i + ", newString : " + newString + ", flag = " + flag + ", valid = " + isValid(newString) + ", maxLength = " + maxValidLength + ", str.len = " + newString.length()); if(flag && isValid(newString)) { if(maxValidLength == -1) maxValidLength = newString.length(); if(newString.length() == maxValidLength){ res.add(h + newString); sset.add(newString); } } else if(flag && maxValidLength <= newString.length()){ sset.add(newString); queue.add(newString); // System.out.println(sset); } } } // res.forEach(st->System.out.println(st.hashCode())); if(res.isEmpty()) res.add(h); return res; } private static boolean isValid(String s){ char[] chs = s.toCharArray(); int n = 0; for (char ch : chs) { if(ch == '(') n ++; else if(ch == ')' && n -- <= 0) return false; } return n == 0; } }
7958cfd1c6e574741c95fac277ee61774c2a1335
11e22338d5e9530ac162383df532c88dc100f33e
/Lab2/app/src/main/java/com/example/shruthinarayan/lab2/databases/MortgageInformation.java
ff168a09f1d3606313e4821991a70d8f27c16bd6
[]
no_license
shruthinarayan/CMPE-277-Lab-2-MortgageCalculator
bf02ef2c5bd6b5ca1ba75c9853a080b9c57167bc
87b7dc3dbdaf3db8c812569472446e955a523dc7
refs/heads/master
2020-03-07T19:56:43.941611
2018-04-02T00:35:04
2018-04-02T00:35:04
127,684,219
0
0
null
null
null
null
UTF-8
Java
false
false
2,144
java
package com.example.shruthinarayan.lab2.databases; /** * Created by shruthinarayan on 3/27/18. */ public final class MortgageInformation { private MortgageInformation() {} /* Inner class that defines the table contents */ private static final String _ID = "NO"; public static final String TABLE_NAME = "HOMEINFO"; public static final String COLUMN1_NAME_TITLE = "TYPE"; public static final String COLUMN2_NAME_TITLE = "ADDRESS"; public static final String COLUMN3_NAME_TITLE = "CITY"; public static final String COLUMN4_NAME_TITLE = "STATE"; public static final String COLUMN5_NAME_TITLE = "ZIP"; public static final String COLUMN6_NAME_TITLE = "PRICE"; public static final String COLUMN7_NAME_TITLE = "DOWNPAYMENT"; public static final String COLUMN8_NAME_TITLE = "RATE"; public static final String COLUMN9_NAME_TITLE = "TERM"; public static final String COLUMN10_NAME_TITLE = "MONTHLY"; public static final String SQL_CREATE_ENTRIES = "CREATE TABLE IF NOT EXISTS " + MortgageInformation.TABLE_NAME + " (" + com.example.shruthinarayan.lab2.databases.MortgageInformation._ID + " INTEGER PRIMARY KEY," + MortgageInformation.COLUMN1_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN2_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN3_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN4_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN5_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN6_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN7_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN8_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN9_NAME_TITLE + " TEXT," + MortgageInformation.COLUMN10_NAME_TITLE + " TEXT)"; public static final String SQL_DELETE_ENTRIES = "DELETE FROM " + MortgageInformation.TABLE_NAME + ";\n" + "DELETE FROM sqlite_sequence where name=" + MortgageInformation.TABLE_NAME; }
dae938c16226cc51985ce509b43e1fdd297217fc
ad00ef492f4b913187de2bb03afd1b713c419d04
/src/Syntax/Or.java
78ee6b52605518e0439f866590a71f4ac38ac51f
[]
no_license
qkmaxware/LanguageExperiment
3e9c6c4741f6f009c0b564488af4da28a07e05a7
55bf25d12eec924ea2a95b4cb80e9fe2f7fb2d4f
refs/heads/master
2021-01-22T22:44:08.638834
2017-07-02T00:03:53
2017-07-02T00:03:53
92,788,374
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
/* * 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 Syntax; import Values.Numeric; import lang.LiveException; import lang.Scope; /** * * @author Colin Halseth */ public class Or implements AST{ private AST[] c = new AST[2]; @Override public AST getChild(int i) { return c[i]; } @Override public void setChild(int i, AST child) { c[i] = child; } @Override public Object Run(Scope parent) { Object left = c[0].Run(parent); Object right = c[1].Run(parent); if(left instanceof Numeric && right instanceof Numeric){ //left != 0 AND right != 0 boolean b = !((Numeric)left).Equals(Numeric.Zero) || !((Numeric)right).Equals(Numeric.Zero); return (b ? Numeric.One : Numeric.Zero); }else{ throw new LiveException("Failed to perform boolean or on non-numeric values: "+left.toString()+" , "+right.toString()); } } }
[ "Colin [email protected]" ]
91c76c34ec6ec3e8852c599b433b4bfc05342bc0
510d50789a62a8a9821cf0bf3f89bc6821e0ce56
/sc/sc-shop/sc-shop-web/src/main/java/com/vivo/shop/controller/FreightTemplateController.java
434e8e8fa41f9628dbf1e762a892843b8ec4cc23
[]
no_license
az2359066401/approxy
105d85cde539669063c5f9feda17a695b033daab
a0cd3107b472b1dcf1402156da9b5fa1f8bb3e00
refs/heads/master
2023-01-01T05:42:38.088179
2019-06-08T09:04:52
2019-06-08T09:04:52
190,866,032
1
0
null
2022-12-16T09:44:18
2019-06-08T08:52:06
JavaScript
UTF-8
Java
false
false
2,521
java
package com.vivo.shop.controller; import java.util.List; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.alibaba.dubbo.config.annotation.Reference; import com.vivo.pojo.TbFreightTemplate; import com.vivo.shop.service.FreightTemplateService; import entity.PageResult; import entity.Result; /** * controller * @author Administrator * */ @RestController @RequestMapping("/freightTemplate") public class FreightTemplateController { @Reference private FreightTemplateService freightTemplateService; /** * 返回全部列表 * @return */ @RequestMapping("/findAll") public List<TbFreightTemplate> findAll(){ return freightTemplateService.findAll(); } /** * 返回全部列表 * @return */ @RequestMapping("/findPage") public PageResult findPage(int page,int rows){ return freightTemplateService.findPage(page, rows); } /** * 增加 * @param freightTemplate * @return */ @RequestMapping("/add") public Result add(@RequestBody TbFreightTemplate freightTemplate){ try { freightTemplateService.add(freightTemplate); return new Result(true, "增加成功"); } catch (Exception e) { e.printStackTrace(); return new Result(false, "增加失败"); } } /** * 修改 * @param freightTemplate * @return */ @RequestMapping("/update") public Result update(@RequestBody TbFreightTemplate freightTemplate){ try { freightTemplateService.update(freightTemplate); return new Result(true, "修改成功"); } catch (Exception e) { e.printStackTrace(); return new Result(false, "修改失败"); } } /** * 获取实体 * @param id * @return */ @RequestMapping("/findOne") public TbFreightTemplate findOne(Long id){ return freightTemplateService.findOne(id); } /** * 批量删除 * @param ids * @return */ @RequestMapping("/delete") public Result delete(Long [] ids){ try { freightTemplateService.delete(ids); return new Result(true, "删除成功"); } catch (Exception e) { e.printStackTrace(); return new Result(false, "删除失败"); } } /** * 查询+分页 * @param brand * @param page * @param rows * @return */ @RequestMapping("/search") public PageResult search(@RequestBody TbFreightTemplate freightTemplate, int page, int rows ){ return freightTemplateService.findPage(freightTemplate, page, rows); } }
099e0dce5fcc01b8c8094fe3f22cf0f70df94a0c
e1f8f3eeaf10ed5692e75a87a76e8fa6d1bae29e
/1GDAW/Programacion/Tema 3/Ejercicio4/src/ejercicio4/Ejercicio4.java
4143aa0f20c4721892f09e0a3ae5e4051e8cbd5a
[ "MIT" ]
permissive
Barraguesh/GDAW
e428bdda49e83096bf6a6d089b7ed95ce53a5065
64ce784973c747c9d7bd23d83206193ae1d98bbc
refs/heads/master
2020-03-28T13:48:55.486837
2019-04-27T22:49:36
2019-04-27T22:49:36
148,431,515
0
2
null
null
null
null
UTF-8
Java
false
false
831
java
/* * 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 ejercicio4; import javax.swing.JOptionPane; /** * * @author danie */ public class Ejercicio4 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String D = JOptionPane.showInputDialog(null, "Introduce la diagonal mayor del rombo"); String d = JOptionPane.showInputDialog(null, "Introduce la diagonal menor"); double D1 = Double.parseDouble(D); double d1 = Double.parseDouble(d); double resultado = D1 * d1 / 2; System.out.println("El área del rombo es: " + resultado); } }
b11040f943b024bec6ce71de75c3f7446eb396b1
82813ccc3cd72151e5e13a555cc06a8192183cde
/rxjava-core/src/main/java/rx/operators/OperatorObserveOnBounded.java
97c53ae431f21b026546313d264e13d4c411abfc
[ "Apache-2.0" ]
permissive
fmorales/RxJava
fab1b60ee44f04240d063132661f9e06c5863afa
aa7cb7f0e0181cff3926391bae8fa4df2bf4c978
refs/heads/master
2021-01-12T20:40:06.525666
2014-02-19T04:28:22
2014-02-19T04:28:22
16,973,512
1
0
null
null
null
null
UTF-8
Java
false
false
10,893
java
/** * Copyright 2014 Netflix, Inc. * * 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 rx.operators; import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicLong; import rx.Observable.Operator; import rx.Scheduler; import rx.Scheduler.Inner; import rx.Subscriber; import rx.functions.Action0; import rx.functions.Action1; import rx.schedulers.ImmediateScheduler; import rx.schedulers.TestScheduler; import rx.schedulers.TrampolineScheduler; import rx.subscriptions.Subscriptions; /** * Delivers events on the specified Scheduler. * <p> * This provides backpressure by blocking the incoming onNext when there is already one in the queue. * <p> * This means that at any given time the max number of "onNext" in flight is 3: * -> 1 being delivered on the Scheduler * -> 1 in the queue waiting for the Scheduler * -> 1 blocking on the queue waiting to deliver it * * I have chosen to allow 1 in the queue rather than using an Exchanger style process so that the Scheduler * can loop and have something to do each time around to optimize for avoiding rescheduling when it * can instead just loop. I'm avoiding having the Scheduler thread ever block as it could be an event-loop * thus if the queue is empty it exits and next time something is added it will reschedule. * * <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/observeOn.png"> */ public class OperatorObserveOnBounded<T> implements Operator<T, T> { private final Scheduler scheduler; private final int bufferSize; /** * * @param scheduler * @param bufferSize * that will be rounded up to the next power of 2 */ public OperatorObserveOnBounded(Scheduler scheduler, int bufferSize) { this.scheduler = scheduler; this.bufferSize = roundToNextPowerOfTwoIfNecessary(bufferSize); } public OperatorObserveOnBounded(Scheduler scheduler) { this(scheduler, 1); } private static int roundToNextPowerOfTwoIfNecessary(int num) { if ((num & -num) == num) { return num; } else { int result = 1; while (num != 0) { num >>= 1; result <<= 1; } return result; } } @Override public Subscriber<? super T> call(Subscriber<? super T> child) { if (scheduler instanceof ImmediateScheduler) { // avoid overhead, execute directly return child; } else if (scheduler instanceof TrampolineScheduler) { // avoid overhead, execute directly return child; } else if (scheduler instanceof TestScheduler) { // this one will deadlock as it is single-threaded and won't run the scheduled // work until it manually advances, which it won't be able to do as it will block return child; } else { return new ObserveOnSubscriber(child); } } private static Object NULL_SENTINEL = new Object(); private static Object COMPLETE_SENTINEL = new Object(); private static class ErrorSentinel { final Throwable e; ErrorSentinel(Throwable e) { this.e = e; } } /** Observe through individual queue per observer. */ private class ObserveOnSubscriber extends Subscriber<T> { final Subscriber<? super T> observer; private volatile Scheduler.Inner recursiveScheduler; private final InterruptibleBlockingQueue<Object> queue = new InterruptibleBlockingQueue<Object>(bufferSize); final AtomicLong counter = new AtomicLong(0); public ObserveOnSubscriber(Subscriber<? super T> observer) { super(observer); this.observer = observer; } @Override public void onNext(final T t) { try { // we want to block for natural back-pressure // so that the producer waits for each value to be consumed if (t == null) { queue.addBlocking(NULL_SENTINEL); } else { queue.addBlocking(t); } schedule(); } catch (InterruptedException e) { if (!isUnsubscribed()) { onError(e); } } } @Override public void onCompleted() { try { // we want to block for natural back-pressure // so that the producer waits for each value to be consumed queue.addBlocking(COMPLETE_SENTINEL); schedule(); } catch (InterruptedException e) { onError(e); } } @Override public void onError(final Throwable e) { try { // we want to block for natural back-pressure // so that the producer waits for each value to be consumed queue.addBlocking(new ErrorSentinel(e)); schedule(); } catch (InterruptedException e2) { // call directly if we can't schedule observer.onError(e2); } } protected void schedule() { if (counter.getAndIncrement() == 0) { if (recursiveScheduler == null) { // first time through, register a Subscription // that can interrupt this thread add(Subscriptions.create(new Action0() { @Override public void call() { // we have to interrupt the parent thread because // it can be blocked on queue.put queue.interrupt(); } })); add(scheduler.schedule(new Action1<Inner>() { @Override public void call(Inner inner) { recursiveScheduler = inner; pollQueue(); } })); } else { recursiveScheduler.schedule(new Action1<Inner>() { @Override public void call(Inner inner) { pollQueue(); } }); } } } @SuppressWarnings("unchecked") private void pollQueue() { do { Object v = queue.poll(); if (v != null) { if (v == NULL_SENTINEL) { observer.onNext(null); } else if (v == COMPLETE_SENTINEL) { observer.onCompleted(); } else if (v instanceof ErrorSentinel) { observer.onError(((ErrorSentinel) v).e); } else { observer.onNext((T) v); } } } while (counter.decrementAndGet() > 0); } } /** * Single-producer-single-consumer queue (only thread-safe for 1 producer thread with 1 consumer thread). * * This supports an interrupt() being called externally rather than needing to interrupt the thread. This allows * unsubscribe behavior when this queue is being used. * * @param <E> */ private static class InterruptibleBlockingQueue<E> { private final Semaphore semaphore; private volatile boolean interrupted = false; private final E[] buffer; private AtomicLong tail = new AtomicLong(); private AtomicLong head = new AtomicLong(); private final int capacity; private final int mask; @SuppressWarnings("unchecked") public InterruptibleBlockingQueue(final int size) { this.semaphore = new Semaphore(size); this.capacity = size; this.mask = size - 1; buffer = (E[]) new Object[size]; } /** * Used to unsubscribe and interrupt the producer if blocked in put() */ public void interrupt() { interrupted = true; semaphore.release(); } public void addBlocking(final E e) throws InterruptedException { if (interrupted) { throw new InterruptedException("Interrupted by Unsubscribe"); } semaphore.acquire(); if (interrupted) { throw new InterruptedException("Interrupted by Unsubscribe"); } if (e == null) { throw new IllegalArgumentException("Can not put null"); } if (offer(e)) { return; } else { throw new IllegalStateException("Queue is full"); } } private boolean offer(final E e) { final long _t = tail.get(); if (_t - head.get() == capacity) { // queue is full return false; } int index = (int) (_t & mask); buffer[index] = e; // move the tail forward tail.lazySet(_t + 1); return true; } public E poll() { if (interrupted) { return null; } final long _h = head.get(); if (tail.get() == _h) { // nothing available return null; } int index = (int) (_h & mask); // fetch the item E v = buffer[index]; // allow GC to happen buffer[index] = null; // increment and signal we're done head.lazySet(_h + 1); if (v != null) { semaphore.release(); } return v; } public int size() { int size; do { final long currentHead = head.get(); final long currentTail = tail.get(); size = (int) (currentTail - currentHead); } while (size > buffer.length); return size; } } }
94a79a6c64fc4c86457800043b96f06ee844b580
8a338e9625539e27e820f4ea36e147d1aa68735a
/File/src/main/java/ni/edu/uni/archivos/servicios/ActivoFijoService.java
c787b0907812dec2c93b793e56f1682a079257a9
[]
no_license
anderson2002y/p
27350e227d188c54e92a7868f1d580bec07ce408
47a43a172b6ae332a54eac1f0cb16f8297d0d9aa
refs/heads/master
2023-03-25T16:48:26.831498
2021-03-24T23:43:31
2021-03-24T23:43:31
351,254,127
0
0
null
null
null
null
UTF-8
Java
false
false
6,689
java
/* * 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 ni.edu.uni.archivos.servicios; import java.io.IOException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Scanner; import ni.edu.uni.random.implement.ActivoFijoDaoImplement; import ni.edu.uni.random.implement.EmpleadoDaoImplement; import ni.edu.uni.random.main.Application; import ni.edu.uni.random.pojo.ActivoFijo; import ni.edu.uni.random.pojo.Empleado; import ni.edu.uni.random.pojo.TipoActivoFijo; /** * * @author yasser.membreno */ public class ActivoFijoService implements IServiceActivoFijo { private Scanner scan; private ActivoFijoDaoImplement afDao; private EmpleadoDaoImplement eDao; public ActivoFijoService(Scanner scan) throws IOException { this.scan = scan; afDao = new ActivoFijoDaoImplement(); eDao = new EmpleadoDaoImplement(); } @Override public ActivoFijo findById() throws IOException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public ActivoFijo[] findByClasificacion() throws IOException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void create() throws IOException { ActivoFijo activoFijo = null; int id, cantidad,clasificacion; String nombre, descripcion, fechaCompra; double valor; System.out.println("codigo: "); id = scan.nextInt(); scan.nextLine(); System.out.println("Nombre: "); nombre = scan.nextLine(); System.out.println("Descripcion: "); descripcion = scan.nextLine(); System.out.println("Valor del activo: "); valor = scan.nextDouble(); System.out.println("Cantidad: "); cantidad = scan.nextInt(); do{ //Application.subMenuTipoActivoFijo(); clasificacion = scan.nextInt(); }while(clasificacion < 1 || clasificacion > 4); System.out.println("Fecha de compra [dd/mm/yyyy]"); fechaCompra = scan.next(); //Leer Estado del activo fijo activoFijo = new ActivoFijo(nombre, descripcion, cantidad, TipoActivoFijo.values()[clasificacion - 1] , valor, LocalDate.parse(fechaCompra, DateTimeFormatter.ofPattern("dd/M/yyyy")),ActivoFijo.EstadoActivoFijo.ACTIVO,null); afDao.create(activoFijo); } @Override public int update() throws IOException { int id, cantidad,clasificacion; String nombre, descripcion, fechaCompra; double valor; System.out.println("Digite Id del activo a actualizar:"); id = scan.nextInt(); ActivoFijo af = afDao.findById(id); scan.nextLine(); System.out.println("Nombre: "); nombre = scan.nextLine(); System.out.println("Descripcion: "); descripcion = scan.nextLine(); System.out.println("Valor del activo: "); valor = scan.nextDouble(); System.out.println("Cantidad: "); cantidad = scan.nextInt(); do{ //Application.subMenuTipoActivoFijo(); clasificacion = scan.nextInt(); }while(clasificacion < 1 || clasificacion > 4); System.out.println("Fecha de compra [dd/mm/yyyy]"); fechaCompra = scan.next(); af.setNombre(nombre); af.setDescripcion(descripcion); af.setCantidad(cantidad); af.setValor(valor); af.setClasificacion(TipoActivoFijo.values()[clasificacion - 1]); af.setFechaCompra(LocalDate.parse(fechaCompra, DateTimeFormatter.ofPattern("dd/M/yyyy"))); id = afDao.update(af); return id; } @Override public boolean delete() throws IOException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void findAll() throws IOException { System.out.format("%5s %20s %20s %20s %10s %10s %20s \n","Id","Nombre","Descripcion","Clasificacion","Valor","Cantidad","Fecha"); for(ActivoFijo af : afDao.findAll()){ Application.print(af); } } public void asignarActivoFijo() throws IOException{ int id; System.out.println("Digite el Id del activo a asignar"); id = scan.nextInt(); ActivoFijo af = afDao.findById(id); if(af == null){ System.out.format("Activo fijo con Id: %d no disponible\n",id); return; } if(af.getEmpleado() != null){ System.out.format("El activo %s ya esta asignado!\n", af.getNombre()); return; } System.out.println("Digite el Id del empleado"); id = scan.nextInt(); Empleado e = eDao.findById(id); if(e == null){ System.out.format("Empleado con Id %d no existe\n",id); return; } afDao.asignarActivoFijo(af, e); System.out.format("Activo Fijo %s asignado a %s satisfactoriamente\n", af.getNombre(),e.getNombres() + " " + e.getApellidos()); } public void findActivosFijosByEmpleado() throws IOException{ System.out.println("Digite el Id del empleado"); int id = scan.nextInt(); Empleado e = eDao.findById(id); if(e == null){ System.out.format("Empleado con Id %d no existe\n",id); return; } ActivoFijo activosFijos[] = afDao.findByEmpleado(e); if(activosFijos == null){ System.out.format("El empleado %s no tiene activos fijos asignados\n", e.getNombres()); return; } System.out.format("Empleado: %s\n", e.getNombres() + " " + e.getApellidos()); System.out.println("Activos Fijos:"); System.out.println("========================================"); System.out.format("%5s %20s %20s %20s %10s %10s %20s \n","Id","Nombre","Descripcion","Clasificacion","Valor","Cantidad","Fecha"); for(ActivoFijo af : activosFijos){ Application.print(af); } } }
66da7371905d56d4d7cf9010547e4237f48c248a
d937eb9decd55a7a275a35d79b3c43eb97e63006
/src/main/java/com/smarthome/services/service/mqtt/MQTTServiceImpl.java
9754637951c64d457c809275ed20a0502a25acaa
[]
no_license
HickHack/smart-home
3e93c184e9c0f8f1f201278fcb030b797b65251d
7625b8df4fbc685ca7ad6a440da3106f9fe4fd73
refs/heads/master
2021-01-20T08:24:52.949154
2017-04-27T19:12:07
2017-04-27T19:13:49
86,446,382
1
1
null
2017-04-27T19:13:51
2017-03-28T10:23:20
Java
UTF-8
Java
false
false
2,631
java
package com.smarthome.services.service.mqtt; import com.smarthome.services.mediaplayer.MediaPlayerMQTTCallback; import com.smarthome.services.service.Service; import com.smarthome.services.service.ServiceController; import com.smarthome.services.service.ServiceType; import com.smarthome.ui.service.ServiceUI; import org.eclipse.paho.client.mqttv3.MqttException; /** * @author Graham Murray * @descripion MQTT service implementation. See * the implemented interfaces for comments */ public class MQTTServiceImpl implements MQTTService, Service { private ServiceController controller; private MQTTOperations operations; private ServiceUI ui; private String name; private ServiceType serviceType; public MQTTServiceImpl(String name, ServiceType serviceType, MediaPlayerMQTTCallback callback) { this.name = name; this.serviceType = serviceType; ui = new ServiceUI(this); try { callback.setService(this); operations = new MQTTOperations(this, callback); } catch (MqttException ex) { updateUIOutput("Failed to connect to MQTT"); } } @Override public ServiceController getController() { return controller; } @Override public void publish(Object message) { try { operations.publish(message, ServiceType.MQTT_TELEVISION); } catch (MqttException me) { updateUIOutput("Publishing response to " + this.getType().toString()); } } @Override public void subscribe() { try { operations.subscribe(this.getType()); } catch (MqttException ex) { updateUIOutput("Failed to subscribe to " + this.getType()); } } @Override public void run() { start(); } @Override public void stop() { operations.disconnect(); Thread.currentThread().interrupt(); } @Override public void start() { ui.init(); updateUIOutput("Starting " + name); updateUIStatus(); subscribe(); } @Override public void updateUIOutput(String message) { updateUIStatus(); ui.updateOutput(message); } @Override public void updateUIStatus() { ui.updateStatusAttributes(controller.getControllerStatus()); } @Override public void setController(ServiceController controller) { this.controller = controller; } @Override public String getName() { return name; } @Override public ServiceType getType() { return serviceType; } }
d2ce91031407e849a541466d2b96597d541686e3
fd34bc57a54757fd6c29980347eb0a22213f5430
/onscommons/src/main/java/com/google/gwt/dom/client/DOMImplWebkitPatched.java
277d79456e6f9a71321dd30b70fa1e84e1deddf6
[]
no_license
urazovm/marcelatelab
7b64c1c3f6bad786590964e5115d811787bc91a2
b9e264ecb4fe99b8966a8e4babc588b4aec4725f
refs/heads/master
2021-06-01T06:25:35.860311
2016-04-29T12:22:07
2016-04-29T12:22:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
518
java
package com.google.gwt.dom.client; import it.mate.onscommons.client.onsen.OnsenUi; import it.mate.phgcommons.client.utils.PhgUtils; public class DOMImplWebkitPatched extends DOMImplWebkit { public DOMImplWebkitPatched() { super(); PhgUtils.log("----- USING " + DOMImplWebkitPatched.class); } @Override public Element createElement(Document doc, String tag) { Element element = super.createElement(doc, tag); OnsenUi.ensureId(element); return element; } }
c997221846b13c4d02f2393c852f882c93da4b90
5a66d825810b315f3fef0b4ecffc0eff29e2515b
/app/src/main/java/com/example/pascal/Mannitok/Requetes/DeleteEventRequest.java
9b0ecba3c47b81b5bd34611688433dcb442843a9
[]
no_license
MinaDawoud/TestProject
58e1ac85f6b08345d36cd401c1c54b5bac1a2a8e
3fd9c297589d5b29462417b8200a82ae688d51a2
refs/heads/master
2021-01-18T21:54:32.760505
2017-04-10T22:20:14
2017-04-10T22:20:14
87,026,601
0
0
null
null
null
null
UTF-8
Java
false
false
883
java
package com.example.pascal.Mannitok.Requetes; import com.android.volley.Response; import com.android.volley.toolbox.StringRequest; import java.util.HashMap; import java.util.Map; /** * Created by Pascal on 27/04/2016. */ public class DeleteEventRequest extends StringRequest { private static final String API_URL = "http://www-ens.iro.umontreal.ca/~langevip/studyami/api/index.php"; private Map<String, String> params; public DeleteEventRequest(String eventID, Response.Listener<String> listener){ super(Method.POST, API_URL, listener, null); params = new HashMap<>(); params.put("action_post", "delete_event"); params.put("eventID", eventID + ""); } //Volley va appeler cette fonction pour obtenir les paramètres lorsque la méthode est appelée public Map<String, String> getParams() { return params; } }
6c8ab31c174dd07f8e8d714b31050b5aa33a5ad9
798895ff1c312c0a7a4897e4d22ab6c6f7f700b8
/src/main/java/com/minivision/distributelock/annotation/DistributeLock.java
43fafd49a0ed24fe71a9c21d871f92c2770e1339
[]
no_license
winter0245/distribute-lock-spring-boot-starter
10d1bca3bab6e69dc96912518a3d75e698d2400c
712c6bc3c3e56f1c1ca4e26dae7d60fe447abe82
refs/heads/master
2021-10-24T22:33:11.886130
2019-03-29T15:02:16
2019-03-29T15:02:16
178,423,097
1
0
null
null
null
null
UTF-8
Java
false
false
737
java
package com.minivision.distributelock.annotation; import com.minivision.distributelock.core.LockType; import java.lang.annotation.*; /** * 对方法使用分布式锁 * @Auther: zhangdongdong * @Date: 2019/3/15 0015 16:42 * @Description: */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface DistributeLock { /** * 设置锁类型 * @return 锁类型 */ LockType lockType () default LockType.WRITE_LOCK; /** * 设置锁名称 * @return 锁名称 */ String lockName(); /** * \是否包含参数化锁 * @return true-包含,false-不包含 */ boolean hasParamLock() default false; }
66336a3a378345dff75926648593a9636c469061
1bd15f60ad1a974d108fc99ef0599abcff898452
/angel-ps/core/src/main/java/com/tencent/angel/ml/matrix/transport/UpdateClockRequest.java
fb801193c2938ea17d3db5919f22f1abd6518764
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
haitwang-cloud/angel
0b50070bff9a517c40922104c27981d5272a7eb3
cb015db12356ffbfbdde096e4ec112a2cd324ac3
refs/heads/master
2022-11-27T18:19:11.594594
2018-04-11T02:10:02
2018-04-11T02:10:02
129,091,873
0
0
BSD-3-Clause
2022-11-14T15:01:10
2018-04-11T12:41:57
Java
UTF-8
Java
false
false
2,284
java
/* * Tencent is pleased to support the open source community by making Angel available. * * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. * * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * https://opensource.org/licenses/BSD-3-Clause * * 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.tencent.angel.ml.matrix.transport; import com.tencent.angel.PartitionKey; import io.netty.buffer.ByteBuf; /** * The request that Update task clock in matrix partition */ public class UpdateClockRequest extends PartitionRequest { /** * Task index */ private int taskIndex; /** * Create a UpdateClockRequest * @param partKey partition key * @param taskIndex task index * @param clock clock value */ public UpdateClockRequest(PartitionKey partKey, int taskIndex, int clock) { super(clock, partKey); this.taskIndex = taskIndex; } /** * Create a UpdateClockRequest, just for serialize/deserialize */ public UpdateClockRequest() { } @Override public int getEstimizeDataSize() { return bufferLen(); } @Override public TransportMethod getType() { return TransportMethod.UPDATE_CLOCK; } /** * Get task index * @return task index */ public int getTaskIndex() { return taskIndex; } /** * Set task index * @param taskIndex task index */ public void setTaskIndex(int taskIndex) { this.taskIndex = taskIndex; } @Override public void serialize(ByteBuf buf) { super.serialize(buf); buf.writeInt(taskIndex); } @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); taskIndex = buf.readInt(); } @Override public int bufferLen() { return super.bufferLen() + 4; } @Override public String toString() { return "UpdateClockRequest{" + "taskIndex=" + taskIndex + "} " + super.toString(); } }
62e79b6375250d66510ef75191639c1631cad18d
9923343e59f20a300463c56a837a54992cfe0649
/server/businessLogic.java
dfa5b09656b16b71cea301694c292b006c7581b0
[]
no_license
arpitahegde414/calculator
ab9df335a8f0d2e37286a5d4cc74048cfe1c8513
b591a368f75832b2c184b06917b47f70c5112853
refs/heads/master
2020-03-09T19:44:18.158392
2018-04-10T18:58:57
2018-04-10T18:58:57
118,319,306
0
0
null
2018-01-21T08:58:40
2018-01-21T08:58:40
null
UTF-8
Java
false
false
2,582
java
package monolithic; import java.util.Stack; public class businessLogic { public double solve(String input) { char[] tokens = input.toCharArray(); // Stack for numbers Stack<Double> values = new Stack<Double>(); // Stack for Operators Stack<Character> ops = new Stack<Character>(); for (int i = 0; i < tokens.length; i++) { // Current token is a number, push it to stack for numbers if (tokens[i] >= '0' && tokens[i] <= '9') { StringBuffer sbuf = new StringBuffer(); // There may be more than one digits in number while (i < tokens.length && tokens[i] >= '0' && tokens[i] <= '9') sbuf.append(tokens[i++]); values.push(Double.parseDouble(sbuf.toString())); } else if (tokens[i] == '(') { ops.push(tokens[i]); } else if (tokens[i] == ')') { while (ops.peek() != '(') values.push(applyOp(ops.pop(), values.pop(), values.pop())); ops.pop(); } else if (tokens[i] == '+' || tokens[i] == '-' || tokens[i] == '*' || tokens[i] == '/') { // While top of 'ops' has same or greater precedence to current // token, which is an operator. Apply operator on top of 'ops' // to top two elements in values stack while (!ops.empty() && hasPrecedence(tokens[i], ops.peek())) values.push(applyOp(ops.pop(), values.pop(), values.pop())); ops.push(tokens[i]); } } // Entire expression has been parsed at this point, apply remaining ops to remaining values while (!ops.empty()) values.push(applyOp(ops.pop(), values.pop(), values.pop())); // Top of 'values' contains result, return it return values.pop(); } public static boolean hasPrecedence(char op1, char op2) { if (op2 == '(' || op2 == ')') return false; if ((op1 == '*' || op1 == '/') && (op2 == '+' || op2 == '-')) return false; else return true; } public static Double applyOp(char op, Double b, Double a) { calculatorInterface cal=new concreteCalculator(); switch (op) { case '+': return cal.add(a,b); // calling the bussiness class case '-': return cal.sub(a, b); case '*': return cal.mul(a, b); case '/': if (b == 0) throw new UnsupportedOperationException("Cannot divide by zero"); return cal.div(a, b); } return 0.00; } }
f0bacdcdb2a34b29cbd3bac923ba148ef636a3dc
bc6d21a6d216f32e961db5770e97c7ced73ca739
/ZhihuDeabvo/app/src/main/java/com/lcb/pubinfo/zhihudeabvo/widget/Banner/BannerAdapter.java
40de82f7b6d68f8b5e2fb11aa6a9c73b8529c33d
[]
no_license
liuchuanbao/zhihuDemo
2c820b8568f36bd5958a5e4b15bc675ecdab9f98
21b28a30e0ec0eaf18a8b7ab082e6ff09e9d1a84
refs/heads/master
2021-01-20T14:54:08.250735
2017-05-09T01:11:32
2017-05-09T01:11:32
90,687,191
0
0
null
null
null
null
UTF-8
Java
false
false
976
java
package com.lcb.pubinfo.zhihudeabvo.widget.Banner; import android.support.v4.view.PagerAdapter; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import java.util.List; /** * Created by OO on 2017/2/14. */ class BannerAdapter extends PagerAdapter { private final List<ImageView> mList; public BannerAdapter(List<ImageView> list) { mList = list; } @Override public int getCount() { return mList.size(); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public Object instantiateItem(ViewGroup container, int position) { position = position % mList.size(); container.addView(mList.get(position)); return mList.get(position); } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } }
c2e34b6f8fedd13d728302d93cda478c8ea1076d
d75c038c0b35ab66f8fbd116f1f21b2e4e772db8
/app/build/generated/source/buildConfig/debug/com/ecs/ppp/BuildConfig.java
70982594974ce9ee83bc7f17d12cfc96492888f7
[]
no_license
bhavyasci/internship
f4ab518b44ac505224c856ff78ceb317d322cdfe
61f1f36a338ecf2c250a9d1d61e88245c5d6d228
refs/heads/master
2020-03-19T11:26:27.371941
2018-06-07T09:46:57
2018-06-07T09:46:57
136,456,387
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
/** * Automatically generated file. DO NOT MODIFY */ package com.ecs.ppp; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.ecs.ppp"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
a4c5fb3236a7ce7932192ba17b79d621f2dc6c38
8e043cdc075432693592609090228a0a83f72a87
/src/main/java/com/app/soapws/ws/schemas/providers/GetProviderRequest.java
4a19e605666b047b694ef006a4d44d3bc5363503
[ "MIT" ]
permissive
MicK9323/soap-ws
944de8db75c3d5f38b61e31c2ea444fc6951fbda
3aed0be63b9c11219621b3b9537256c7bfcba08d
refs/heads/master
2020-03-27T12:01:41.829346
2018-09-03T01:40:33
2018-09-03T01:40:33
146,521,610
0
0
null
null
null
null
UTF-8
Java
false
false
3,794
java
// // Este archivo ha sido generado por la arquitectura JavaTM para la implantación de la referencia de enlace (JAXB) XML v2.2.7 // Visite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Todas las modificaciones realizadas en este archivo se perderán si se vuelve a compilar el esquema de origen. // Generado el: 2018.08.30 a las 09:36:16 PM COT // package com.app.soapws.ws.schemas.providers; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Clase Java para anonymous complex type. * * <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="option" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="provider_name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="country_id" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "option", "id", "providerName", "countryId" }) @XmlRootElement(name = "getProviderRequest") public class GetProviderRequest { @XmlElement(required = true) protected String option; protected Integer id; @XmlElement(name = "provider_name") protected String providerName; @XmlElement(name = "country_id") protected Integer countryId; /** * Obtiene el valor de la propiedad option. * * @return * possible object is * {@link String } * */ public String getOption() { return option; } /** * Define el valor de la propiedad option. * * @param value * allowed object is * {@link String } * */ public void setOption(String value) { this.option = value; } /** * Obtiene el valor de la propiedad id. * * @return * possible object is * {@link Integer } * */ public Integer getId() { return id; } /** * Define el valor de la propiedad id. * * @param value * allowed object is * {@link Integer } * */ public void setId(Integer value) { this.id = value; } /** * Obtiene el valor de la propiedad providerName. * * @return * possible object is * {@link String } * */ public String getProviderName() { return providerName; } /** * Define el valor de la propiedad providerName. * * @param value * allowed object is * {@link String } * */ public void setProviderName(String value) { this.providerName = value; } /** * Obtiene el valor de la propiedad countryId. * * @return * possible object is * {@link Integer } * */ public Integer getCountryId() { return countryId; } /** * Define el valor de la propiedad countryId. * * @param value * allowed object is * {@link Integer } * */ public void setCountryId(Integer value) { this.countryId = value; } }
456dffdb1499dba4bc78b20ffd57e304df5d5497
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/91ec9283a9225f34958234f63892665eb6559298/before/CompletionActionTest.java
a1448de4f81febd4ae7a409f2c5c39c28abed670
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
5,826
java
/* * Copyright (c) 2007, Your Corporation. All Rights Reserved. */ package org.jetbrains.plugins.groovy.lang.completion; import org.jetbrains.annotations.NonNls; import org.jetbrains.plugins.groovy.testcases.action.ActionTestCase; import org.jetbrains.plugins.groovy.util.TestUtils; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.util.InvalidDataException; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiElement; import com.intellij.codeInsight.completion.*; import com.intellij.codeInsight.completion.actions.CodeCompletionAction; import com.intellij.codeInsight.CodeInsightActionHandler; import com.intellij.codeInsight.CodeInsightUtil; import com.intellij.codeInsight.lookup.LookupItem; import com.intellij.util.IncorrectOperationException; import java.io.IOException; import java.util.*; import junit.framework.Test; /** * @author ilyas */ public class CompletionActionTest extends ActionTestCase { @NonNls private static final String DATA_PATH = "test/org/jetbrains/plugins/groovy/lang/completion/data/"; protected Editor myEditor; protected FileEditorManager fileEditorManager; protected String newDocumentText; protected PsiFile myFile; public CompletionActionTest() { super(System.getProperty("path") != null ? System.getProperty("path") : DATA_PATH ); } protected CodeInsightActionHandler getCompetionHandler() { CodeCompletionAction action = new CodeCompletionAction(); return action.getHandler(); } private String processFile(final PsiFile file) throws IncorrectOperationException, InvalidDataException, IOException { String result = ""; String fileText = file.getText(); int offset = fileText.indexOf(CARET_MARKER); fileText = removeMarker(fileText); myFile = TestUtils.createPseudoPhysicalFile(project, fileText); fileEditorManager = FileEditorManager.getInstance(project); myEditor = fileEditorManager.openTextEditor(new OpenFileDescriptor(project, myFile.getVirtualFile(), 0), false); myEditor.getCaretModel().moveToOffset(offset); final CodeInsightActionHandler handler = getCompetionHandler(); final CompletionContext context = new CompletionContext(project, myEditor, myFile, 0, myOffset); CompletionData data = CompletionUtil.getCompletionDataByElement(myFile.findElementAt(myOffset), context); LookupItem[] items = getAcceptableItems(data); try { performAction(project, new Runnable() { public void run() { handler.invoke(project, myEditor, myFile); } }); offset = myEditor.getCaretModel().getOffset(); /* result = myEditor.getDocument().getText(); result = result.substring(0, offset) + CARET_MARKER + result.substring(offset); */ if (items.length > 0) { Arrays.sort(items); result = ""; for (LookupItem item : items) { result = result + "\n" + item.getLookupString(); } result = result.trim(); } } finally { fileEditorManager.closeFile(myFile.getVirtualFile()); myEditor = null; } return result; } /** * retrurns acceptable variant for this completion * * @param completionData * @return */ protected LookupItem[] getAcceptableItems(CompletionData completionData) { final Set<LookupItem> lookupSet = new LinkedHashSet<LookupItem>(); final PsiElement elem = myFile.findElementAt(myOffset); /** * Create fake file with dummy element */ String newFileText = myFile.getText().substring(0, myOffset + 1) + "IntellijIdeaRulezzz" + myFile.getText().substring(myOffset + 1); try { /** * Hack for IDEA completion */ PsiFile newFile = TestUtils.createPseudoPhysicalFile(project, newFileText); PsiElement insertedElement = newFile.findElementAt(myOffset + 1); final int offset1 = myEditor.getSelectionModel().hasSelection() ? myEditor.getSelectionModel().getSelectionStart() : myEditor.getCaretModel().getOffset(); final int offset2 = myEditor.getSelectionModel().hasSelection() ? myEditor.getSelectionModel().getSelectionEnd() : offset1; final CompletionContext context = new CompletionContext(project, myEditor, myFile, offset1, offset2); context.setPrefix(elem, context.startOffset, completionData); if (lookupSet.size() == 0 || !CodeInsightUtil.isAntFile(myFile)) { final Set<CompletionVariant> keywordVariants = new HashSet<CompletionVariant>(); completionData.addKeywordVariants(keywordVariants, context, insertedElement); CompletionData.completeKeywordsBySet(lookupSet, keywordVariants, context, insertedElement); } ArrayList<LookupItem> lookupItems = new ArrayList<LookupItem>(); final LookupItem[] items = lookupSet.toArray(new LookupItem[lookupSet.size()]); for (LookupItem item : items) { if (CompletionUtil.checkName(item.getLookupString(), context, false)) { lookupItems.add(item); } } return lookupItems.toArray(new LookupItem[0]); } catch (IncorrectOperationException e) { e.printStackTrace(); return new LookupItem[0]; } } public String transform(String testName, String[] data) throws Exception { setSettings(); String fileText = data[0]; final PsiFile psiFile = TestUtils.createPseudoPhysicalFile(project, fileText); String result = processFile(psiFile); System.out.println("------------------------ " + testName + " ------------------------"); System.out.println(result); System.out.println(""); return result; } public static Test suite() { return new CompletionActionTest(); } }
a4a32b013809113b31525c6f4bfd63c006746cb0
4899139a77765db22feb228f0bc87119d3301a94
/tuan8_baitap/src/tuan8_baitap/ManageStudent.java
fbf639a330675dcf559911ecca74c0fd731ebf13
[]
no_license
bl4ck29/JavaStuff
dfc67ade35a2ad54c66e8a2aa1898aa5ecc26f66
cdebaded6baeea6689db53304ebb7dce17b3b397
refs/heads/master
2023-06-05T09:35:01.801611
2021-06-17T06:47:01
2021-06-17T06:47:01
377,731,990
0
0
null
null
null
null
UTF-8
Java
false
false
9,570
java
package tuan8_baitap; import java.awt.EventQueue; import java.io.*; import javax.swing.*; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JButton; import javax.swing.JFileChooser; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JTextField; public class ManageStudent extends JFrame{ private JTable tblList; private JTextField tbxID; private JTextField tbxName; private JTextField tbxDOB; private JTextField tbxContactInfo; private File file = new File("register.ini"); private String[] cols = {"Student ID", "Student name", "Date of birth" ,"Contact info"}; public static void main(String[] args) { ManageStudent app = new ManageStudent(); app.setVisible(true); } public ManageStudent() { setSize(800, 600); setTitle("Student Management"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); setLayout(null); JLabel lblNewLabel = new JLabel("Manage Student"); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 22)); lblNewLabel.setBounds(315, 0, 200, 40); add(lblNewLabel); JLabel lblID = new JLabel("Student ID"); lblID.setBounds(225, 341, 60, 20); add(lblID); JLabel lblName = new JLabel("Student Name"); lblName.setBounds(225, 370, 100, 20); add(lblName); JLabel lblDateOfBirth = new JLabel("Date of birth"); lblDateOfBirth.setBounds(225, 398, 100, 20); add(lblDateOfBirth); JLabel lblContactInfo = new JLabel("Contact info"); lblContactInfo.setBounds(225, 427, 100, 20); add(lblContactInfo); JButton btnLoad = new JButton("Load"); btnLoad.setFont(new Font("Tahoma", Font.PLAIN, 12)); btnLoad.setBounds(610, 55, 100, 30); add(btnLoad); JButton btnBack = new JButton("|<"); btnBack.setBounds(398, 311, 85, 21); add(btnBack); JButton btnNext = new JButton(">|"); btnNext.setBounds(493, 311, 85, 21); add(btnNext); JButton btnSave = new JButton("Save"); btnSave.setBounds(398, 460, 85, 21); add(btnSave); JButton btnCancel = new JButton("Cancel"); btnCancel.setBounds(493, 460, 85, 21); add(btnCancel); tbxID = new JTextField(); tbxID.setBounds(331, 338, 199, 20); add(tbxID); tbxID.setColumns(10); tbxName = new JTextField(); tbxName.setColumns(10); tbxName.setBounds(331, 367, 199, 20); add(tbxName); tbxDOB = new JTextField(); tbxDOB.setColumns(10); tbxDOB.setBounds(331, 395, 199, 20); add(tbxDOB); tbxContactInfo = new JTextField(); tbxContactInfo.setColumns(10); tbxContactInfo.setBounds(331, 424, 199, 20); add(tbxContactInfo); JButton btnAdd = new JButton("Add"); btnAdd.setFont(new Font("Tahoma", Font.PLAIN, 12)); btnAdd.setBounds(610, 120, 100, 30); add(btnAdd); JButton btnEdit = new JButton("Edit"); btnEdit.setFont(new Font("Tahoma", Font.PLAIN, 12)); btnEdit.setBounds(610, 194, 100, 30); add(btnEdit); JButton btnDelete = new JButton("Delete"); btnDelete.setFont(new Font("Tahoma", Font.PLAIN, 12)); btnDelete.setBounds(610, 271, 100, 30); add(btnDelete); JButton btnExit = new JButton("Exit"); btnExit.setFont(new Font("Tahoma", Font.PLAIN, 12)); btnExit.setBounds(610, 486, 100, 30); add(btnExit); tblList = new JTable(LoadStudentList(), cols); tblList.setBounds(10, 53, 568, 248); JScrollPane scroll = new JScrollPane(tblList); scroll.setBounds(10, 50, 550, 200); add(scroll); ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent act) { //Load from file if (act.getSource() == btnLoad){ remove(scroll); tblList = new JTable(LoadStudentList(), cols); JScrollPane scroll = new JScrollPane(tblList); scroll.setBounds(10, 50, 550, 200); add(scroll); } //Add student to file if(act.getSource() == btnAdd) { if(tbxID.getText().isBlank() || tbxName.getText().isBlank() || tbxDOB.getText().isBlank() || tbxContactInfo.getText().isBlank()) { JOptionPane.showMessageDialog(null, "Please do not leave any fields blank"); } else { String data = ""; String[] content = ReadList(); for(String item : content) { data += item + "\n";} String info = tbxID.getText().strip() + "," + tbxName.getText().strip() + "," + tbxDOB.getText().strip() + "," + tbxContactInfo.getText().strip(); data += info; WriteContent(data); JOptionPane.showMessageDialog(null, "Successfully"); } } //Edit student profile if(act.getSource() == btnEdit) { if(tblList.getSelectedRowCount() == 1) { int row_pos = tblList.getSelectedRow(); tbxID.setText(tblList.getModel().getValueAt(row_pos, 0).toString()); tbxName.setText(tblList.getModel().getValueAt(row_pos, 1).toString()); tbxDOB.setText(tblList.getModel().getValueAt(row_pos, 2).toString()); tbxContactInfo.setText(tblList.getModel().getValueAt(row_pos, 3).toString()); } else { JOptionPane.showMessageDialog(null, "Only select one row");} } //Delete student from list if(act.getSource() == btnDelete) { int row_pos = tblList.getSelectedRow(); String[] lst = ReadList(); lst[row_pos] = ""; WriteContent(lst); } //Exit if(act.getSource() == btnExit) { int respone = JOptionPane.showConfirmDialog(null, "Do you want to leave?", "Alert", 1); if(respone == JOptionPane.OK_OPTION){ System.exit(0);} } //Cancel the edition if(act.getSource() == btnCancel) { tbxID.setText(""); tbxName.setText(""); tbxDOB.setText(""); tbxContactInfo.setText(""); } //Button next if(act.getSource() == btnNext) { int row_pos = tblList.getSelectedRow(); if(row_pos < tblList.getRowCount()-1) { row_pos += 1;} tblList.setRowSelectionInterval(row_pos, row_pos); tbxID.setText(tblList.getModel().getValueAt(row_pos, 0).toString()); tbxName.setText(tblList.getModel().getValueAt(row_pos, 1).toString()); tbxDOB.setText(tblList.getModel().getValueAt(row_pos, 2).toString()); tbxContactInfo.setText(tblList.getModel().getValueAt(row_pos, 3).toString()); } //Button back if(act.getSource() == btnBack) { int row_pos = tblList.getSelectedRow(); if(row_pos == -1) { row_pos = tblList.getRowCount();} if(row_pos > 0) { row_pos -= 1;} tblList.setRowSelectionInterval(row_pos, row_pos); tbxID.setText(tblList.getModel().getValueAt(row_pos, 0).toString()); tbxName.setText(tblList.getModel().getValueAt(row_pos, 1).toString()); tbxDOB.setText(tblList.getModel().getValueAt(row_pos, 2).toString()); tbxContactInfo.setText(tblList.getModel().getValueAt(row_pos, 3).toString()); } //Button save if(act.getSource() == btnSave) { int row_pos = tblList.getSelectedRow(); String[] lst = ReadList(); String profile = tbxID.getText() +","+ tbxName.getText() +","+ tbxDOB.getText() +","+ tbxContactInfo.getText(); lst[row_pos] = profile; WriteContent(lst); } } }; btnLoad.addActionListener(action); btnAdd.addActionListener(action); btnEdit.addActionListener(action); btnDelete.addActionListener(action); btnExit.addActionListener(action); btnCancel.addActionListener(action); btnNext.addActionListener(action); btnBack.addActionListener(action); btnSave.addActionListener(action); } //Read list of student from file private String[] ReadList() { try { InputStream inp = new FileInputStream(file); byte[] data = inp.readAllBytes(); String[] content = (new String(data)).split("\n"); inp.close(); return content; }catch(Exception err) {err.getStackTrace();} return null; } //Write the student just addedd to file private void WriteContent(String content) { try { OutputStream out = new FileOutputStream(file); out.write(content.getBytes()); out.close(); }catch(Exception err) {err.getStackTrace();} } //Write the list of students to file private void WriteContent(String[] content) { try { String data = ""; for( String std : content) { if (std != "") { data += std + "\n";} } WriteContent(data); } catch(Exception e) { e.getStackTrace();} } //Form load private String[][] LoadStudentList(){ JFileChooser chooser = new JFileChooser(); int result = chooser.showOpenDialog(null); if(result == JFileChooser.APPROVE_OPTION){ File file = new File(chooser.getSelectedFile().getAbsolutePath()); try{ InputStream inp = new FileInputStream(file); byte[] data = inp.readAllBytes(); inp.close(); String[] listStudents = (new String(data)).split("\n"); String[][] tableData = new String[listStudents.length][cols.length]; for(int row=0; row<listStudents.length; row++){ String[] info = listStudents[row].split(","); for(int col=0; col<info.length; col++){ tableData[row][col] = info[col]; } } return tableData; } catch(IOException err_FileNotFoundException) { err_FileNotFoundException.getStackTrace(); } } return new String[0][0]; } }
0b86a7052f34ebb64701c28dea5e7c545da39f4a
c81808ebac825bb5357acf54f0607bac3ce672d8
/src/main/java/com/xxx/redis/RedisApplication.java
e10a1e44fa28921568cdaa7d71281abdf63f820e
[]
no_license
gdouxxx/springboot-
ce45c8dfc705e42755f9eb8c320d280447f43ffd
abe535ea92a43c18b99ae6f9d9661bca4c4208af
refs/heads/master
2023-02-12T03:47:32.545911
2021-01-12T17:14:13
2021-01-12T17:14:13
329,018,293
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.xxx.redis; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class RedisApplication { public static void main(String[] args) { SpringApplication.run(RedisApplication.class, args); } }
eaaa6d4e8e9f2816e2d5301914a226949a1fa0fc
4c5b3f08fb5b361845f2bb884dd4fa672028440e
/src/com/carconnect/domain/objects/CounterForOfferARide.java
f8b646862689662bf8f76dd5323d7316d4ecc5b7
[]
no_license
harshas01/carshare
8aa2f9b8122fb200d92153224e2aedf95893f454
f8d209b8f61027be4bf93a6b1ad00ccf7385f11b
refs/heads/master
2020-06-10T09:22:25.900462
2016-12-08T21:06:55
2016-12-08T21:06:55
75,974,856
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.carconnect.domain.objects; import java.util.concurrent.atomic.AtomicInteger; public class CounterForOfferARide { private AtomicInteger atomicInteger; private static CounterForOfferARide obj = null; private CounterForOfferARide(int initialValue) { this.atomicInteger = new AtomicInteger(initialValue); } public static CounterForOfferARide getInstance() { if (obj == null) { obj = new CounterForOfferARide(100); } return obj; } public int getCounter() { return atomicInteger.getAndIncrement(); } }
96db4bea806a26a27a6aa336cedc2fcb7d0406df
de947ca01380441a60e10ffdecf776f82e9694e8
/src/test/java/gmibank/stepdefinitions/US18_AdminManageStepDef.java
084496e194ac34bf2c602281c164813c6e6cb212
[]
no_license
ozcankursun/GMIBankProject_002
9b953efb581e8371d1b307382ef3451123b06278
8d6f1bc7dbbf436562f765bdf64d6dda38e44aa0
refs/heads/master
2023-01-22T18:16:53.481303
2020-11-28T14:37:09
2020-11-28T14:37:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,343
java
package gmibank.stepdefinitions; import gmibank.pages.AdminManagementPage; import gmibank.utilities.Driver; import gmibank.utilities.ReusableMethods; import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import org.junit.Assert; import org.openqa.selenium.*; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.*; import java.util.concurrent.TimeUnit; public class US18_AdminManageStepDef { Actions actions = new Actions(Driver.getDriver()); AdminManagementPage adminManagementPage=new AdminManagementPage(); @Given("GO to Login Page {string}") public void goToLoginPage(String arg0) { Driver.getDriver().get(arg0); } @And("user clicks myOperations link") public void userClicksMyOperationsLink() { adminManagementPage.myOperations.click(); } @And("user clicks manageCostomers link") public void userClicksManageCostomersLink() { adminManagementPage.manageCostumer.click(); } @Given("ADMIN can select First Name, Last Name, Middle Initial, Email, Mobile Phone Nummer, Phone Nummer, Address,Date updated") public void adminCanSelectFirstNameLastNameMiddleInitialEmailMobilePhoneNummerPhoneNummerAddressDateUpdated() { for (int i = 1; i < 51; i++) { if (!(i % 10 == 1) && !(i % 10 == 0)) { System.out.println(adminManagementPage.allOptions.get(i).getText()); Assert.assertFalse(adminManagementPage.allOptions.get(i).getText().isEmpty()); } } } @Given("ADMIN should show Edit Button and verify valid") public void adminShouldShowEditButtonAndVerifyValid() { ReusableMethods.waitFor(5); Assert.assertTrue(adminManagementPage.editButtonBox.isDisplayed()); } @Given("ADMIN should write and new the Email address") public void adminShouldWriteAndNewTheEmailAddress() { adminManagementPage.editButtonBox.click(); ReusableMethods.waitFor(1); actions.sendKeys(Keys.PAGE_DOWN).perform(); adminManagementPage.emailBoxing.clear(); adminManagementPage.emailBoxing.sendKeys("[email protected]"); } @And("ADMIN click Save Button") public void adminClickSaveButton() { ReusableMethods.waitFor(1); actions.sendKeys(Keys.PAGE_DOWN).perform(); adminManagementPage.saveButtonBox.click(); } @Then("ADMIN verifies translation not found[gmiBankBackendApp.tPCustomer.updated") public void adminVerifiesTranslationNotFoundGmiBankBackendAppTPCustomerUpdated() { // Assert.assertTrue(us12Page.succesText.isDisplayed()); Assert.assertTrue(true); } @Then("ADMIN verifies translations not found[gmiBankBackendApp.tPCustomer.updated") public void adminVerifiesTranslationsNotFoundGmiBankBackendAppTPCustomerUpdated() { // Assert.assertTrue(us12Page.succesText.isDisplayed()); Assert.assertTrue(true); } @Given("ADMIN should write and new the Phone Nummer") public void adminShouldWriteAndNewThePhoneNummer() { adminManagementPage.editButtonBox.click(); ReusableMethods.waitFor(1); actions.sendKeys(Keys.PAGE_DOWN).perform(); adminManagementPage.mobilePhoneBoxing.clear(); adminManagementPage.mobilePhoneBoxing.sendKeys("555-778-9941"); } @Then("ADMIN verifies translat not found[gmiBankBackendApp.tPCustomer.updated") public void adminVerifiesTranslatNotFoundGmiBankBackendAppTPCustomerUpdated() { // Assert.assertTrue(us12Page.succesText.isDisplayed()); Assert.assertTrue(true); } @Given("ADMIN should write and new the Address") public void adminShouldWriteAndNewTheAddress() { adminManagementPage.editButtonBox.click(); ReusableMethods.waitFor(1); actions.sendKeys(Keys.PAGE_DOWN).perform(); adminManagementPage.addressBox.clear(); adminManagementPage.addressBox.sendKeys("Deutschland 4"); } @And("ADMIN click Save three Button") public void adminClickSaveThreeButton() { ReusableMethods.waitFor(1); actions.sendKeys(Keys.PAGE_DOWN).perform(); adminManagementPage.saveButtonBox.click(); } @Then("user signOut") public void userSignOut() { } }
2dc14eb2447bf1fdca829a99763b6a0bc80357dc
814367d2509d14d355c0517b6b66baad3c31a747
/MainActivity.java
4ad64110bc54687f7f320d639e91aa6cd40e3c98
[]
no_license
sowmyaavr/Gocorona
2168da017bda0ca15a96b092a460ff4252326364
ea29830292c202579c96c7f3c924df9bb7b80687
refs/heads/master
2022-09-04T14:53:37.553065
2020-05-29T07:17:04
2020-05-29T07:17:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,953
java
package com.example.gocorona; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { private Button bt1,bt2,bt3,bt4; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bt1 = (Button) findViewById(R.id.b1); bt2 = (Button) findViewById(R.id.b2); bt3 = (Button) findViewById(R.id.b3); bt4 = (Button) findViewById(R.id.b4); bt1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openActivity2(); } }); bt2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openActivity3(); } }); bt3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openActivity4(); } }); bt4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openActivity5(); } }); } public void openActivity2() { Intent intent = new Intent(this, symptoms.class); startActivity(intent); } public void openActivity3() { Intent intent = new Intent(this, precautions.class); startActivity(intent); } public void openActivity4() { Intent intent = new Intent(this, what.class); startActivity(intent); } public void openActivity5() { Intent intent = new Intent(this, help1.class); startActivity(intent); } }
159cf4feb793ac6d911ffc70c8aa7ab8e696d974
9b57c7aeaf60e219de20b8d0d69a8fb1e0e3606c
/pt2021_30423_chindea_tudor_assignment_3/src/main/java/dao/ClientDAO.java
36f5b9f504e720e140cbb71f4041e57ef05bc6ac
[]
no_license
TudorChindea/Java-projects
704bb7f9a88d03b278ec6b541a743863f55d211c
e6929681575de42d4834045018a4ede17eb1e0c4
refs/heads/main
2023-05-15T06:18:01.852202
2021-06-09T14:59:48
2021-06-09T14:59:48
375,353,841
0
0
null
null
null
null
UTF-8
Java
false
false
183
java
package dao; import model.Client; /** * class that allows us to use the AbstractDAO functions on an object of type Client */ public class ClientDAO extends AbstractDAO<Client>{ }
9a2805850033045374a25e710c6cb0f433eefa3d
1341ebf56cee66f15431236c74e8bb1db02558ac
/chrome/android/java/src/org/chromium/chrome/browser/tab/TabThemeColorHelper.java
1320af803138dd2ffad4ba3ec98ade01f4b98dbb
[ "BSD-3-Clause" ]
permissive
nerdooit/chromium
41584349b52e0b941ec45ebb5ba5695268e5872f
de77d445d3428ef72455c3b0d9be7e050d447135
refs/heads/master
2023-01-11T20:03:40.846099
2020-01-25T12:45:08
2020-01-25T12:45:08
236,195,538
1
0
BSD-3-Clause
2020-01-25T16:25:12
2020-01-25T16:25:11
null
UTF-8
Java
false
false
9,740
java
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.tab; import android.graphics.Color; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import org.chromium.base.UserData; import org.chromium.chrome.browser.previews.Previews; import org.chromium.chrome.browser.ssl.SecurityStateModel; import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.components.security_state.ConnectionSecurityLevel; import org.chromium.content_public.browser.NavigationHandle; import org.chromium.content_public.browser.RenderWidgetHostView; import org.chromium.content_public.browser.WebContents; /** * Manages theme color used for {@link Tab}. Destroyed together with the tab. */ public class TabThemeColorHelper extends EmptyTabObserver implements UserData { private static final Class<TabThemeColorHelper> USER_DATA_KEY = TabThemeColorHelper.class; private final TabImpl mTab; private int mDefaultColor; private int mColor; /** * The default background color used for {@link #mTab} if the associate web content doesn't * specify a background color. */ private int mDefaultBackgroundColor; /** Whether or not the default color is used. */ private boolean mIsDefaultColorUsed; /** * Whether or not the color provided by the web page is used. False if the web page does not * provide a custom theme color. */ private boolean mIsUsingColorFromTabContents; public static void createForTab(Tab tab) { assert get(tab) == null; tab.getUserDataHost().setUserData(USER_DATA_KEY, new TabThemeColorHelper(tab)); } @Nullable public static TabThemeColorHelper get(Tab tab) { return tab.getUserDataHost().getUserData(USER_DATA_KEY); } /** Convenience method that returns theme color of {@link Tab}. */ public static int getColor(Tab tab) { return get(tab).getColor(); } /** Convenience method that returns default theme color of {@link Tab}. */ public static int getDefaultColor(Tab tab) { return get(tab).getDefaultColor(); } /** @return Whether default theme color is used for the specified {@link Tab}. */ public static boolean isDefaultColorUsed(Tab tab) { return get(tab).mIsDefaultColorUsed; } /** @return Whether the color provided by the web page is used for the specified {@link Tab}. */ public static boolean isUsingColorFromTabContents(Tab tab) { return get(tab).mIsUsingColorFromTabContents; } /** @return Whether background color of the specified {@link Tab}. */ public static int getBackgroundColor(Tab tab) { return get(tab).getBackgroundColor(); } private TabThemeColorHelper(Tab tab) { mTab = (TabImpl) tab; mDefaultColor = calculateDefaultColor(); mIsDefaultColorUsed = true; mIsUsingColorFromTabContents = false; mColor = mDefaultColor; updateDefaultBackgroundColor(); tab.addObserver(this); updateThemeColor(false); } private void updateDefaultColor() { mDefaultColor = calculateDefaultColor(); updateIfNeeded(false); } private int calculateDefaultColor() { return ChromeColors.getDefaultThemeColor( mTab.getContext().getResources(), mTab.isIncognito()); } private void updateDefaultBackgroundColor() { mDefaultBackgroundColor = ChromeColors.getPrimaryBackgroundColor(mTab.getContext().getResources(), false); } /** * Updates the theme color based on if the page is native, the theme color changed, etc. * @param didWebContentsThemeColorChange If the theme color of the web contents is known to have * changed. */ private void updateThemeColor(boolean didWebContentsThemeColorChange) { // Start by assuming the current theme color is the one that should be used. This will // either be transparent, the last theme color, or the color restored from TabState. int themeColor = mColor; // Only use the web contents for the theme color if it is known to have changed. This // corresponds to the didChangeThemeColor in WebContentsObserver. if (mTab.getWebContents() != null && didWebContentsThemeColorChange) { themeColor = mTab.getWebContents().getThemeColor(); mIsUsingColorFromTabContents = themeColor != TabState.UNSPECIFIED_THEME_COLOR && ColorUtils.isValidThemeColor(themeColor); if (mIsUsingColorFromTabContents) { mIsDefaultColorUsed = false; } } boolean isThemingAllowed = checkThemingAllowed(); if (!isThemingAllowed) { mIsUsingColorFromTabContents = false; } if (!mIsUsingColorFromTabContents) { themeColor = mDefaultColor; mIsDefaultColorUsed = true; if (mTab.getActivity() != null && isThemingAllowed) { int customThemeColor = mTab.getActivity().getActivityThemeColor(); if (customThemeColor != TabState.UNSPECIFIED_THEME_COLOR) { themeColor = customThemeColor; mIsDefaultColorUsed = false; } } } // Ensure there is no alpha component to the theme color as that is not supported in the // dependent UI. mColor = themeColor | 0xFF000000; } /** * Returns whether theming the activity is allowed (either by the web contents or by the * activity). */ private boolean checkThemingAllowed() { // Do not apply the theme color if there are any security issues on the page. final int securityLevel = SecurityStateModel.getSecurityLevelForWebContents(mTab.getWebContents()); return securityLevel != ConnectionSecurityLevel.DANGEROUS && securityLevel != ConnectionSecurityLevel.SECURE_WITH_POLICY_INSTALLED_CERT && (mTab.getActivity() == null || !mTab.getActivity().isTablet()) && (mTab.getActivity() == null || !mTab.getActivity().getNightModeStateProvider().isInNightMode()) && !mTab.isNativePage() && !mTab.isShowingInterstitialPage() && !mTab.isIncognito() && !Previews.isPreview(mTab); } /** * Determines if the theme color has changed and notifies the listeners if it has. * @param didWebContentsThemeColorChange If the theme color of the web contents is known to have * changed. */ public void updateIfNeeded(boolean didWebContentsThemeColorChange) { int oldThemeColor = mColor; updateThemeColor(didWebContentsThemeColorChange); if (oldThemeColor == mColor) return; mTab.notifyThemeColorChanged(mColor); } /** * @return The default theme color for this tab. */ @VisibleForTesting public int getDefaultColor() { return mDefaultColor; } /** * @return The current theme color based on the value passed from the web contents and the * security state. */ public int getColor() { return mColor; } /** * Returns the background color of the associate web content of {@link #mTab}, or the default * background color if the web content background color is not specified (i.e. transparent). * See native WebContentsAndroid#GetBackgroundColor. * @return The background color of {@link #mTab}. */ public int getBackgroundColor() { if (mTab.isNativePage()) return mTab.getNativePage().getBackgroundColor(); WebContents tabWebContents = mTab.getWebContents(); RenderWidgetHostView rwhv = tabWebContents == null ? null : tabWebContents.getRenderWidgetHostView(); final int backgroundColor = rwhv != null ? rwhv.getBackgroundColor() : Color.TRANSPARENT; return backgroundColor == Color.TRANSPARENT ? mDefaultBackgroundColor : backgroundColor; } // TabObserver @Override public void onInitialized(Tab tab, TabState tabState) { if (tabState == null) return; // Update from TabState. mIsUsingColorFromTabContents = tabState.hasThemeColor(); mIsDefaultColorUsed = !mIsUsingColorFromTabContents; mColor = mIsDefaultColorUsed ? getDefaultColor() : tabState.getThemeColor(); updateIfNeeded(false); } @Override public void onSSLStateUpdated(Tab tab) { updateIfNeeded(false); } @Override public void onUrlUpdated(Tab tab) { updateIfNeeded(false); } @Override public void onDidFailLoad(Tab tab, boolean isMainFrame, int errorCode, String failingUrl) { updateIfNeeded(true); } @Override public void onDidFinishNavigation(Tab tab, NavigationHandle navigation) { if (navigation.errorCode() != 0) updateIfNeeded(true); } @Override public void onDidAttachInterstitialPage(Tab tab) { updateIfNeeded(false); } @Override public void onDidDetachInterstitialPage(Tab tab) { updateIfNeeded(false); } @Override public void onActivityAttachmentChanged(Tab tab, boolean isAttached) { updateDefaultColor(); updateDefaultBackgroundColor(); } @Override public void onDestroyed(Tab tab) { tab.removeObserver(this); } }
c14d99469e02420e85c386e3bc72acae571bf74d
473b76b1043df2f09214f8c335d4359d3a8151e0
/benchmark/bigclonebenchdata_completed/13102388.java
c5a7c5baef83b6f0496f42536a87d607375c33f5
[]
no_license
whatafree/JCoffee
08dc47f79f8369af32e755de01c52d9a8479d44c
fa7194635a5bd48259d325e5b0a190780a53c55f
refs/heads/master
2022-11-16T01:58:04.254688
2020-07-13T20:11:17
2020-07-13T20:11:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,427
java
// import java.io.ArithmeticException; // import java.io.ArithmeticException; import java.io.UncheckedIOException; import java.io.UncheckedIOException; import java.io.UncheckedIOException; import java.io.UncheckedIOException; class c13102388 { public MyHelperClass Log; public void callBatch(final List calls, final BatchCallback callback) { MyHelperClass mRpcUrl = new MyHelperClass(); HttpPost httpPost = new HttpPost(mRpcUrl); JSONObject requestJson = new JSONObject(); JSONArray callsJson = new JSONArray(); try { for (int i = 0; i < (int)(Object)calls.size(); i++) { Call call =(Call)(Object) calls.get(i); JSONObject callJson = new JSONObject(); callJson.put("method",(JSONArray)(Object) call.getMethodName()); if (call.getParams() != null) { JSONObject callParams = (JSONObject)(JSONObject)(Object) call.getParams(); @SuppressWarnings("unchecked") Iterator keysIterator =(Iterator)(Object) callParams.keys(); String key; while ((boolean)(Object)keysIterator.hasNext()) { key =(String)(Object) keysIterator.next(); callJson.put(key,(JSONArray)(Object) callParams.get(key)); } } callsJson.put(i, callJson); } requestJson.put("calls", callsJson); httpPost.setEntity(new StringEntity(requestJson.toString(), "UTF-8")); MyHelperClass TAG = new MyHelperClass(); if ((boolean)(Object)Log.isLoggable(TAG, Log.VERBOSE)) { // MyHelperClass TAG = new MyHelperClass(); Log.v(TAG, "POST request: " + requestJson.toString()); } } catch (UncheckedIOException e) { } catch (ArithmeticException e) { } try { MyHelperClass mHttpClient = new MyHelperClass(); HttpResponse httpResponse =(HttpResponse)(Object) mHttpClient.execute(httpPost); final int responseStatusCode =(int)(Object) httpResponse.getStatusLine().getStatusCode(); if (200 <= responseStatusCode && responseStatusCode < 300) { BufferedReader reader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent(), "UTF-8"), 8 * 1024); StringBuilder sb = new StringBuilder(); String line; while ((line =(String)(Object) reader.readLine()) != null) { sb.append(line).append("\n"); } MyHelperClass TAG = new MyHelperClass(); if ((boolean)(Object)Log.isLoggable(TAG, Log.VERBOSE)) { // MyHelperClass TAG = new MyHelperClass(); Log.v(TAG, "POST response: " + sb.toString()); } JSONTokener tokener = new JSONTokener(sb.toString()); JSONObject responseJson = new JSONObject(tokener); JSONArray resultsJson =(JSONArray)(Object) responseJson.getJSONArray("results"); Object[] resultData = new Object[(int)(Object)calls.size()]; for (int i = 0; i < (int)(Object)calls.size(); i++) { JSONObject result =(JSONObject)(Object) resultsJson.getJSONObject(i); if ((boolean)(Object)result.has("error")) { callback.onError(i, new JsonRpcException((int)(int)(Object) result.getInt("error"), calls.get(i).getMethodName(), result.getString("message"), null)); resultData[i] = null; } else { resultData[i] = result.get("data"); } } callback.onData(resultData); } else { callback.onError(-1, new JsonRpcException(-1, "Received HTTP status code other than HTTP 2xx: " + httpResponse.getStatusLine().getReasonPhrase())); } } catch (UncheckedIOException e) { MyHelperClass Log = new MyHelperClass(); Log.e("JsonRpcJavaClient", e.getMessage()); e.printStackTrace(); } catch (ArithmeticException e) { MyHelperClass Log = new MyHelperClass(); Log.e("JsonRpcJavaClient", "Error parsing server JSON response: " + e.getMessage()); e.printStackTrace(); } } } // Code below this line has been added to remove errors class MyHelperClass { public MyHelperClass VERBOSE; public MyHelperClass e(String o0, String o1){ return null; } public MyHelperClass getReasonPhrase(){ return null; } public MyHelperClass v(MyHelperClass o0, String o1){ return null; } public MyHelperClass getStatusCode(){ return null; } public MyHelperClass isLoggable(MyHelperClass o0, MyHelperClass o1){ return null; } public MyHelperClass getMethodName(){ return null; } public MyHelperClass execute(HttpPost o0){ return null; } public MyHelperClass getContent(){ return null; }} class List { public MyHelperClass get(int o0){ return null; } public MyHelperClass size(){ return null; }} class HttpPost { HttpPost(){} HttpPost(MyHelperClass o0){} public MyHelperClass setEntity(StringEntity o0){ return null; }} class JSONObject { JSONObject(){} JSONObject(JSONTokener o0){} public MyHelperClass getJSONArray(String o0){ return null; } public MyHelperClass getString(String o0){ return null; } public MyHelperClass put(String o0, JSONArray o1){ return null; } public MyHelperClass getInt(String o0){ return null; } public MyHelperClass keys(){ return null; } public MyHelperClass has(String o0){ return null; } public MyHelperClass get(String o0){ return null; }} class JSONArray { public MyHelperClass put(int o0, JSONObject o1){ return null; } public MyHelperClass getJSONObject(int o0){ return null; }} class Iterator { public MyHelperClass next(){ return null; } public MyHelperClass hasNext(){ return null; }} class StringEntity { StringEntity(){} StringEntity(String o0, String o1){}} class JSONException extends Exception{ public JSONException(String errorMessage) { super(errorMessage); } } class UnsupportedEncodingException extends Exception{ public UnsupportedEncodingException(String errorMessage) { super(errorMessage); } } class HttpResponse { public MyHelperClass getStatusLine(){ return null; } public MyHelperClass getEntity(){ return null; }} class BufferedReader { BufferedReader(){} BufferedReader(InputStreamReader o0, int o1){} public MyHelperClass readLine(){ return null; }} class InputStreamReader { InputStreamReader(){} InputStreamReader(MyHelperClass o0, String o1){}} class JSONTokener { JSONTokener(String o0){} JSONTokener(){}} class JsonRpcException extends Exception{ public JsonRpcException(String errorMessage) { super(errorMessage); } JsonRpcException(){} JsonRpcException(int o0, String o1){} JsonRpcException(int o0, MyHelperClass o1, MyHelperClass o2, Object o3){} } class IOException extends Exception{ public IOException(String errorMessage) { super(errorMessage); } } class Call { public MyHelperClass getParams(){ return null; } public MyHelperClass getMethodName(){ return null; }} class BatchCallback { public MyHelperClass onError(int o0, JsonRpcException o1){ return null; } public MyHelperClass onData(Object[] o0){ return null; }}
804f3790dea44a3c31732f29c1af95aa02f78c7a
54791ccd1e347ac8047b837c1957c8b3d888fd22
/app/src/main/java/ng/dat/ar/utils/JsonUtil.java
1b23bd2237e1880b050efbbed4c167491677ea7e
[]
no_license
chinhvuduc3112/mapLai
e0a74ed42f84fd1349fe72c30af4555ee66bde37
f41f5be52c9abed3b8e431361a26c38c74229023
refs/heads/master
2021-01-19T15:19:23.511263
2017-08-21T17:25:34
2017-08-21T17:25:34
100,959,852
0
0
null
null
null
null
UTF-8
Java
false
false
4,811
java
package ng.dat.ar.utils; import android.os.Build; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * Created by dunghn on 15/01/2016. */ public class JsonUtil { public static JSONObject createJSONObject(String jsonString) { try { return new JSONObject(jsonString); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return null; } } public static JSONArray createJSONArray(String jsonString) { try { return new JSONArray(jsonString); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return null; } } public static JSONObject getJSONObject(JSONObject obj, String key) { try { return obj.getJSONObject(key); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return null; } } public static JSONObject getJSONObject(JSONArray array, int index) { try { return array.getJSONObject(index); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return null; } } public static JSONArray getJSONArray(JSONObject obj, String key) { try { return obj.getJSONArray(key); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return null; } } public static String getString(JSONObject obj, String key, String defaultValue) { try { return obj.getString(key); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static String getString(JSONArray array, int index, String defaultValue) { try { return array.getString(index); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static boolean getBoolean(JSONObject obj, String key, boolean defaultValue) { try { return obj.getBoolean(key); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static boolean getBoolean(JSONArray array, int index, boolean defaultValue) { try { return array.getBoolean(index); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static int getInt(JSONObject obj, String key, int defaultValue) { try { return obj.getInt(key); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static int getInt(JSONArray array, int index, int defaultValue) { try { return array.getInt(index); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static long getLong(JSONObject obj, String key, long defaultValue) { try { return obj.getLong(key); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static long getLong(JSONArray array, int index, long defaultValue) { try { return array.getLong(index); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static double getDouble(JSONObject obj, String key, double defaultValue) { try { return obj.getDouble(key); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static double getDouble(JSONArray array, int index, double defaultValue) { try { return array.getDouble(index); } catch (JSONException e) { Log.e("AR_map", e.getMessage()); return defaultValue; } } public static JSONArray removeItem(JSONArray array, int index) { try { if (index < 0) return array; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { JSONArray jsaNew = new JSONArray(); for (int i = 0; i < array.length(); i++) if (i != index) jsaNew.put(array.get(i)); return jsaNew; } else { array.remove(index); return array; } } catch (Exception e) { e.printStackTrace(); return array; } } }
4639d580719b105327aa643a7f5563799ad220e5
2129030d9f38640578a2cfef21c74c9d01a6441a
/src/projeto_sorvil/gui/AlertBox.java
187ac979a53887cd2eee601a7245cabd29769bb5
[]
no_license
rayanealves/sorvil
b1e06206c6209a787769c546f7d5af80418ec6b8
e89df9a46bf028fd16eb5c77da356b0f25872be5
refs/heads/master
2023-01-04T19:59:50.898299
2020-11-02T23:49:20
2020-11-02T23:49:20
294,713,087
3
1
null
2020-10-06T13:48:50
2020-09-11T14:11:05
Java
UTF-8
Java
false
false
1,135
java
/* * 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 projeto_sorvil.gui; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.stage.Modality; import javafx.stage.Stage; /** * * @author usuario */ public class AlertBox { public static void display(String titulo, String mansagem){ Stage janela = new Stage(); janela.initModality(Modality.APPLICATION_MODAL); janela.setTitle(titulo); janela.setMinWidth(250); Label label = new Label(); label.setText(mansagem); Button botaoFechar = new Button("Fechar"); botaoFechar.setOnAction(e -> janela.close()); VBox layout = new VBox(10); layout.getChildren().addAll(label, botaoFechar); layout.setAlignment(Pos.CENTER); Scene scene = new Scene(layout); janela.setScene(scene); janela.showAndWait(); } }
53f24da09ae9bafb47b63884da5fcd4aee52e636
bbdabb808b2aa1890f47aa0fca6d425df0db0470
/LibrarySystem/src/com/jiayu/controller/UsersController.java
25d7a7dcdecbce60579b0ae3fcf527206767ce62
[]
no_license
denouemenj/LibraryManagementSystem
3d06fd17c3dd93032fe2cc3af26afc1d7c3a3480
52c0c16eed135fb64364dc0ed7c32cd4d6b9a48b
refs/heads/main
2023-02-28T22:10:56.177809
2021-01-31T02:54:13
2021-01-31T02:54:13
334,238,615
0
0
null
null
null
null
UTF-8
Java
false
false
3,523
java
package com.jiayu.controller; import java.util.Date; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttributes; import com.jiayu.pojo.Books; import com.jiayu.pojo.Borrows; import com.jiayu.pojo.Reserve; import com.jiayu.pojo.Users; import com.jiayu.service.BooksService; import com.jiayu.vo.Page; @Controller @RequestMapping("/user") public class UsersController { @Autowired private BooksService booksService; @RequestMapping("/index") public String toIndex() { return "/users/index"; } @RequestMapping("/quit") public String quit(HttpSession session) { session.removeAttribute("user"); return "redirect:/index"; } @RequestMapping("/show") public String toShow(Model model, Books book) { System.out.println(book); if (book.getSid() != null) { model.addAttribute("sid", book.getSid()); } if (!"".equals(book.getBname()) || book.getBname().length() > 0) { model.addAttribute("bname", book.getBname()); } Page page = booksService.getAllBooks(book); model.addAttribute("page", page); model.addAttribute("currentPage", book.getCurrentPage()); model.addAttribute("totalPage", page.getTotalPage()); return "/users/show"; } @RequestMapping("/borrow") public String toBorrow(Model model, Integer id) { Books book = booksService.getBook(id); System.out.println(book); model.addAttribute("book", book); return "/users/borrows"; } @RequestMapping("/insert") public String insertBorrow(Borrows borrow, HttpSession session) { Users user = (Users) session.getAttribute("user"); System.out.println("id" + borrow); borrow.setUid(user.getId()); Date date = new Date(); borrow.setStartTime(date); borrow.setStatus(0); booksService.insertBorrow(borrow); // booksService.updateBooks(borrow.getBid()); return "redirect:/user/back"; } @RequestMapping("/back") public String getBorrows(Model model, HttpSession session) { Users user = (Users) session.getAttribute("user"); List<Borrows> borrows = booksService.getBorrows(user.getId()); model.addAttribute("borrows", borrows); return "users/back"; } @RequestMapping("/showBackBook") public String showBackBook(Model model, HttpSession session) { Users user = (Users) session.getAttribute("user"); List<Borrows> backs = booksService.getBacks(user.getId()); model.addAttribute("backs", backs); return "users/showBackBook"; } @RequestMapping("/backBooks") public String backBooks(Integer id) { booksService.updateBacks(id); return "redirect:/user/showBackBook"; } @RequestMapping("/reserve") public String reserveBooks(Reserve reserve, HttpSession session) { Users user = (Users) session.getAttribute("user"); reserve.setUid(user.getId()); Date date = new Date(); System.out.println(date); reserve.setStartTime(date); booksService.insertReserve(reserve); return "redirect:/user/showReserveBook"; } @RequestMapping("/showReserveBook") public String showReserveBook(Model model, HttpSession session) { Users user = (Users) session.getAttribute("user"); List<Reserve> reserveBooks = booksService.getReserveBook(user.getId()); model.addAttribute("reserveBooks", reserveBooks); return "/users/reserveBook"; } }
f22f2afd7f7b8f2e152c785a2a314cc9cbaaab2c
371d8d32425ad503ff89a54f8dd0bebfc6db82ae
/sdk/synapse/azure-analytics-synapse-artifacts/src/main/java/com/azure/analytics/synapse/artifacts/models/DatasetDeflateCompression.java
d865144d107bb706cf193bf27cbcf3ee04612823
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "CC0-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later" ]
permissive
Shashi-rk/azure-sdk-for-java
ec3fa73fc609df2d19b5db3c1282747a70f50fbc
48e7b450384c7ed5f0d9333f41a6438f9762d6e7
refs/heads/main
2023-08-27T22:28:13.817647
2021-11-11T08:43:28
2021-11-11T08:43:28
426,593,853
0
0
MIT
2021-11-10T11:21:13
2021-11-10T11:21:13
null
UTF-8
Java
false
false
1,448
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.analytics.synapse.artifacts.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; /** The Deflate compression method used on a dataset. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("Deflate") @Fluent public final class DatasetDeflateCompression extends DatasetCompression { /* * The Deflate compression level. Type: string (or Expression with * resultType string). */ @JsonProperty(value = "level") private Object level; /** * Get the level property: The Deflate compression level. Type: string (or Expression with resultType string). * * @return the level value. */ public Object getLevel() { return this.level; } /** * Set the level property: The Deflate compression level. Type: string (or Expression with resultType string). * * @param level the level value to set. * @return the DatasetDeflateCompression object itself. */ public DatasetDeflateCompression setLevel(Object level) { this.level = level; return this; } }
5467f812a831455a0e0a9e1b5de656c819a01047
fe8f1863ca1f351de9051cb917e027dd7b9e29a6
/app/src/main/java/com/lzq/wanandroid/view/adapter/FragmentAdapter.java
4ee3ce641b8be69effe8dccb04cb7aac9e084b5d
[]
no_license
qdiankun/WanAndroid-1
11af1266a31a753cbd1ba2e695ddf25cf6058991
c6f3cd72de3dd0b057fe873e446eeac452168c3f
refs/heads/master
2022-11-11T16:41:17.530296
2020-07-04T07:23:52
2020-07-04T07:23:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,846
java
package com.lzq.wanandroid.view.adapter; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentTransaction; import java.util.ArrayList; import java.util.List; public class FragmentAdapter extends FragmentPagerAdapter { private List<Fragment> mList = new ArrayList<>(); private FragmentManager fm; public FragmentAdapter(FragmentManager fm, List<Fragment> mList) { super(fm); this.fm = fm; this.mList = mList; } public FragmentTransaction getTransaction() { return fm.beginTransaction(); } @Override public Fragment getItem(int i) { return mList.get(i); } @Override public int getCount() { return mList.size(); } public void notifyDataSetChanged(List<Fragment> mList) { this.mList = mList; notifyDataSetChanged(); } // @NonNull // @Override // public Object instantiateItem(@NonNull ViewGroup container, int position) { // //ViewPager对于重新传进来的Adapter不会直接重新加载List内容 // //只是根据Tag判断是否存在 // if (position == 3) // updateFragment(container, position); // return super.instantiateItem(container, position); // } //// // private void updateFragment(ViewGroup container, int position) { // String tag = getFragmentTag(container.getId(), position); // Fragment fragment = fm.findFragmentByTag(tag); // if (fragment == null) // return; // FragmentTransaction ft = fm.beginTransaction(); // ft.remove(fragment); // ft.commit(); // ft = null; // fm.executePendingTransactions(); // } // private String getFragmentTag(int id, int position) { // try { // Class<FragmentPagerAdapter> cls = FragmentPagerAdapter.class; // Class<?>[] parameterTypes = {int.class, long.class}; // Method method = cls.getDeclaredMethod("makeFragmentName", // parameterTypes); // method.setAccessible(true); // String tag = (String) method.invoke(this, id, position); // return tag; // } catch (Exception e) { // e.printStackTrace(); // return ""; // } // } // // // //若要更新Fragment必须重写此方法 // @Override // public int getItemPosition(@NonNull Object object) { //// if (mList.contains((View) object)) { //// // 如果当前 item 未被 remove,则返回 item 的真实 position //// return mList.indexOf((View) object); //// } else { //// // 否则返回状态值 POSITION_NONE // return POSITION_NONE; //// }? // } }
cd64e6e4e2e7f773bc4c28e716431a0584a94ef6
73f5d38adf20ba5c6d0c7b9fe349978795870b5f
/chartfx-dataset/src/main/java/de/gsi/dataset/CategoryHistogram.java
65fc589d6c1aa1ecaac231ca3a6f52ec5a6639bc
[ "Apache-2.0" ]
permissive
suhaibmaree/chart-fx
ee6224f2e0f7f5c057c7ab68b61e57a9a00de9cd
c4917f2c336c9f734d79cda95cf7dac8805e50fc
refs/heads/master
2020-12-27T13:58:48.135562
2020-01-30T17:50:59
2020-02-03T08:18:49
237,926,796
2
0
Apache-2.0
2020-02-03T09:18:09
2020-02-03T09:18:08
null
UTF-8
Java
false
false
1,244
java
package de.gsi.dataset; // for library loggers //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; // for application loggers //import de.gsi.cs.co.ap.common.gui.elements.logger.AppLogger; /** * @deprecated Work in Progress, don't use yet * @author Alexander Krimm */ @Deprecated public interface CategoryHistogram extends Histogram { /** * Increment bin with name with by 1. if x is less than the low-edge of the first bin, the Underflow bin is * incremented if x is equal to or greater than the upper edge of last bin, the Overflow bin is incremented * * @param name name to be added * @return corresponding bin number which has its content incremented by w */ default int fill(final String name) { return fill(name, 1.0); } /** * Increment bin with name with a weight w. if x is less than the low-edge of the first bin, the Underflow bin is * incremented if x is equal to or greater than the upper edge of last bin, the Overflow bin is incremented * * @param name name to be added * @param w weight for given name * @return corresponding bin number which has its content incremented by w */ int fill(final String name, double w); }
1b078c44c512efdbf7c2d7f46ed6c851cdf850d4
82a95082c453cb04b6e7ae9386beb650db814f63
/v5/cdebrowser/server/src/main/java/gov/nih/nci/cadsr/dao/model/VdPvsModel.java
d45b6aa19e64663f1f1ba1cbf67401b61b3411a9
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "Ruby" ]
permissive
sgvallala/cadsr-cde-browser
8bd2603751485a673dc2aef9b22fafbd552a8780
db9af757217cdfbc1b91a26c7515491c7cb8e391
refs/heads/master
2020-12-11T07:28:21.701133
2016-04-19T18:01:04
2016-04-19T18:01:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,711
java
package gov.nih.nci.cadsr.dao.model; /* * Copyright 2016 Leidos Biomedical Research, Inc. */ import java.sql.Timestamp; public class VdPvsModel extends BaseModel { private String vpIdseq; private String vdIdseq; private String pvIdseq; private String conteIdseq; private String origin; private String conIdesq; private Timestamp beginDate; private Timestamp endDate; public String getVpIdseq() { return vpIdseq; } public void setVpIdseq( String vpIdseq ) { this.vpIdseq = vpIdseq; } public String getVdIdseq() { return vdIdseq; } public void setVdIdseq( String vdIdseq ) { this.vdIdseq = vdIdseq; } public String getPvIdseq() { return pvIdseq; } public void setPvIdseq( String pvIdseq ) { this.pvIdseq = pvIdseq; } public String getConteIdseq() { return conteIdseq; } public void setConteIdseq( String conteIdseq ) { this.conteIdseq = conteIdseq; } public String getOrigin() { return origin; } public void setOrigin( String origin ) { this.origin = origin; } public String getConIdesq() { return conIdesq; } public void setConIdesq( String conIdesq ) { this.conIdesq = conIdesq; } public Timestamp getBeginDate() { return beginDate; } public void setBeginDate( Timestamp beginDate ) { this.beginDate = beginDate; } public Timestamp getEndDate() { return endDate; } public void setEndDate( Timestamp endDate ) { this.endDate = endDate; } }
016cbfee144bd12392f8af272fc6ae55b72bdaaf
7c5c2803e5026f9be68643ec34783d914f46bbd4
/MCO/ModelComponent.java
8f264b2bdae3451da4b1ebf60b9c313a321bd8b0
[]
no_license
CocoFox/Polytech4A
8363d1ae876e96e6bb4979e2b73e7069cfa091ff
55187e47869243fc7d3a21707526cc3d7785cbaa
refs/heads/master
2021-08-30T14:07:03.463597
2017-12-18T08:25:18
2017-12-18T08:25:18
113,580,477
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package mco.projetinfo4a; /** * ModelDecorator */ public interface ModelComponent{ public abstract String getName(); public abstract String getModel(); public Boolean tryOrder(); public Object order(); @Override public String toString(); }
9a95204930b449c19cb1ec7a028bd9e799edf984
8df30366e02eda0fdfc13171e9aa93e9c4180647
/spring-cloud-samples/finchley/weather/msa-weather-city-server/src/main/java/io/github/futurewl/scs/f/controller/CityController.java
45d562bb9b079b10161c58ea1848235f399566eb
[]
no_license
FutureWL/spring-samples
d9ab92614b5d238d321101c5e2c09e1e2b989d24
718da85c5397e8441f69293b3aaaf47b7e05130a
refs/heads/master
2023-03-06T15:35:45.645062
2020-10-03T02:07:24
2020-10-03T02:07:24
160,497,481
1
0
null
null
null
null
UTF-8
Java
false
false
763
java
package io.github.futurewl.scs.f.controller; import io.github.futurewl.scs.f.service.CityDataService; import io.github.futurewl.scs.f.vo.City; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * 功能描述: * * @author weilai create by 2019-06-09:11:02 * @version 1.0 */ @RestController @RequestMapping("/cities") public class CityController { @Autowired private CityDataService cityDataService; @GetMapping public List<City> listCity() throws Exception { return cityDataService.listCity(); } }
dfa4adcdbc8016d2fd2cc25faa9da4ea246403ba
acd9c8e5fc347de3dbf11aae75f6d725a532e620
/src/main/java/kehao/emulator/EmulatorRune.java
28295695ac1875c2380efad898857e1d99a406da
[]
no_license
v5kehao/kh
3be90a768fadeeff52cb4cf7746f11db6a4d2f4f
f72a775c7b3f8d6d61f04b3edb07b8b8e863468e
refs/heads/master
2020-05-13T15:50:56.030783
2013-12-27T17:08:30
2013-12-27T17:08:30
12,743,556
1
3
null
2013-12-07T00:40:37
2013-09-11T00:05:05
Java
UTF-8
Java
false
false
1,490
java
package kehao.emulator; import kehao.emulator.game.model.basic.Runes; import kehao.emulator.game.model.basic.UserRunes; import kehao.emulator.game.model.response.RuneGetAllRuneResponse; import kehao.emulator.game.model.response.RuneGetUserRunesResponse; import kehao.exception.ServerNotAvailableException; import kehao.exception.WrongCredentialException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class EmulatorRune { @Autowired private EmulatorCore core; @Autowired private UnknownErrorHandler unknownErrorHandler; public Runes getAllRune(String username) throws ServerNotAvailableException, WrongCredentialException { RuneGetAllRuneResponse response = core.gameDoAction(username, "rune.php", "GetAllRune", null, RuneGetAllRuneResponse.class); if(response.badRequest()) { unknownErrorHandler.print(username, response.getMessage()); } return response.getData(); } public UserRunes getUserRunes(String username) throws ServerNotAvailableException, WrongCredentialException { RuneGetUserRunesResponse response = core.gameDoAction(username, "rune.php", "GetUserRunes", null, RuneGetUserRunesResponse.class); if(response.badRequest()) { unknownErrorHandler.print(username, response.getMessage()); } return response.getData(); } }
0e11a9aef71f39de6d139762654b96fd208f300f
ff175712f91a0bd3aeee1e4fe1afc3b549020708
/src/ex_2_2/Publico.java
f8678459453e3d91fcf426ca6983ffabe6e197ef
[]
no_license
guilherme-albuquerque/Eng2020_1a02
0065cf3d49ab9b4009a8887f586a53a45d431811
11f4abda0a5dfecb075a9df79bc4dffe8ca93b63
refs/heads/master
2021-02-26T16:05:36.374625
2020-03-18T19:29:29
2020-03-18T19:29:29
245,539,107
0
1
null
2020-03-18T19:29:30
2020-03-07T00:04:53
Java
UTF-8
Java
false
false
638
java
package ex_2_2; import util.ResourceUtils; import java.io.File; import java.util.Scanner; public class Publico extends Informacao { protected String recuperarInfo(){ String pacote = getClass().getPackage().getName().toString().replace('.','/'); File arquivo = ResourceUtils.getResourceAsFile(pacote + "/publico.txt"); StringBuffer buffer = new StringBuffer(); Scanner scanner = novoScanner(arquivo); while (scanner.hasNextLine()){ buffer.append(scanner.nextLine()); buffer.append("\n"); } scanner.close(); return buffer.toString(); } }
6d9c0432433a571de62cc38e0944a6f555ac4796
c884a2fcbe635de001f929dfa590dae31879fc53
/insurance/src/main/java/com/eis/insurance/andreiPiniuta/Service/impl/ApartmentServiceImpl.java
52fde061b6c5ee8fec26f2156b5994884da537c3
[]
no_license
andreipiniuta/insurance
f9617f5addd39bae69cbc3b05bf0486bab589d48
3c4b3eec93fdb811af1d9ab9735a7b36e288397b
refs/heads/master
2023-04-04T23:33:17.829172
2021-04-12T20:07:51
2021-04-12T20:07:51
357,267,558
0
0
null
null
null
null
UTF-8
Java
false
false
2,333
java
package com.eis.insurance.andreiPiniuta.Service.impl; import com.eis.insurance.andreiPiniuta.Service.ApartmentService; import com.eis.insurance.andreiPiniuta.data.realEstate.Apartment; import org.json.JSONObject; import org.json.JSONTokener; import org.json.JSONWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class ApartmentServiceImpl implements ApartmentService { @Override public void saveApartment(Apartment apartment) throws IOException { Path dest =Files.createFile(Paths.get("D:/insurance/ApartmentJson.json")); FileWriter writer = new FileWriter(String.valueOf(dest)); JSONWriter jsonwriter = new JSONWriter(writer); jsonwriter.object(); jsonwriter.key("residentNumber").value(apartment.getResidentNumber()); jsonwriter.key("realEstateSize").value(apartment.getRealEstateSize()); jsonwriter.key("floorNumber").value(apartment.getFloorNumber()); jsonwriter.key("numberApartOneFloor").value(apartment.getNumberApartOneFloor()); jsonwriter.endObject(); writer.close(); } @Override public Apartment readApartment() throws IOException { Apartment apartment = new Apartment(); if(Files.exists(Paths.get("D:/insurance/ApartmentJson.json"))){ FileReader reader = new FileReader("D:/insurance/ApartmentJson.json"); JSONTokener tokener = new JSONTokener(reader); JSONObject apartmentObject = (JSONObject)tokener.nextValue(); Integer residentNumber = apartmentObject.getInt("residentNumber"); Double realEstateSize = apartmentObject.getDouble("realEstateSize"); Integer floorNumber = apartmentObject.getInt("floorNumber"); Integer numberApartOneFloor = apartmentObject.getInt("numberApartOneFloor"); apartment.setResidentNumber(residentNumber); apartment.setRealEstateSize(realEstateSize); apartment.setFloorNumber(floorNumber); apartment.setNumberApartOneFloor(numberApartOneFloor); reader.close(); }else { System.out.println("NO APARTMENT INFO"); return null; } return apartment; } }
d85fb4d6bb1021de7a0b1b1a91822c303b5bf239
6bee6206d870525b6680df10db7d6ced0dd2200f
/app/src/main/java/com/example/sarthikbabuta/udaicty4app/available.java
91245b1af7f0afa0c212f7864d88bb3263b932b8
[]
no_license
sarthikbabuta/Udacity-Music-App-Project-4
98299c51c79dcf148e7725cfa1bfd283a14b2145
7e255ec00fd6fc22195ee9a8a192ace61ce48e96
refs/heads/master
2020-03-16T22:02:22.679280
2018-05-11T10:11:43
2018-05-11T10:11:43
133,024,166
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.example.sarthikbabuta.udaicty4app; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class available extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_available); } }
091caa43bb3c0439598cd237b07dbe1cb5b9712c
01b27311d4168d4892dcffef1ff00b2f676ef455
/gateway/src/main/java/com/ecb/gateway/web/rest/util/HeaderUtil.java
37ae5c5c9eede5fb120bba43729a52e946acab53
[]
no_license
vkurylovich/ngRevRec
dd4a02f4ef8e201a49e27f1ff048f352d8ab5c2e
0cb92c80064a40da05de0c7e7e8df99a9780c641
refs/heads/master
2020-06-10T09:37:31.491078
2016-12-08T20:57:16
2016-12-08T20:57:21
75,973,213
0
0
null
null
null
null
UTF-8
Java
false
false
1,553
java
package com.ecb.gateway.web.rest.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; /** * Utility class for HTTP headers creation. */ public final class HeaderUtil { private static final Logger log = LoggerFactory.getLogger(HeaderUtil.class); private HeaderUtil() { } public static HttpHeaders createAlert(String message, String param) { HttpHeaders headers = new HttpHeaders(); headers.add("X-gatewayApp-alert", message); headers.add("X-gatewayApp-params", param); return headers; } public static HttpHeaders createEntityCreationAlert(String entityName, String param) { return createAlert("A new " + entityName + " is created with identifier " + param, param); } public static HttpHeaders createEntityUpdateAlert(String entityName, String param) { return createAlert("A " + entityName + " is updated with identifier " + param, param); } public static HttpHeaders createEntityDeletionAlert(String entityName, String param) { return createAlert("A " + entityName + " is deleted with identifier " + param, param); } public static HttpHeaders createFailureAlert(String entityName, String errorKey, String defaultMessage) { log.error("Entity creation failed, {}", defaultMessage); HttpHeaders headers = new HttpHeaders(); headers.add("X-gatewayApp-error", defaultMessage); headers.add("X-gatewayApp-params", entityName); return headers; } }