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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
69d2cdb3fedd4a38d507154bca3711f02b5a3130 | 7945c9f9016e44e9347bce8882cc99830bd455c4 | /src/main/java/beer/repository/BeerRepository.java | 4e20dc620723b797305c95d96c929f75cee48c9c | []
| no_license | Slygreedy/beerapicouchbase | 9ac283b1239556b0b6167d1ad7403c86984c5dcb | ef6c4d249a53946cc41af56802ac0a486aa49ddc | refs/heads/master | 2021-01-20T08:29:47.217409 | 2017-05-03T08:10:03 | 2017-05-03T08:10:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package beer.repository;
import beer.model.Beer;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface BeerRepository extends CrudRepository<Beer, String>{
Beer findOne(String id);
List<Beer> findByBreweryId(String breweryName);
}
| [
"[email protected]"
]
| |
5a5d768c0978e1e444d9db803e395fe6ba74b608 | 2025517dfb8176b9ab04fa0b542c1ec0687a9159 | /retrofit/src/main/java/retrofit2/http/POST.java | e48183e106d9d3f2ff37832ef13a1235c9767150 | []
| no_license | spysoos/MiniRetrofit | 5b2b5c14a0297de94fd1acc6a79f9a5a5f1b9314 | e426d10e3d94187d388db51907d21d72aa2a4496 | refs/heads/master | 2021-11-03T22:53:17.011673 | 2019-04-26T13:26:21 | 2019-04-26T13:26:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package retrofit2.http;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by zhuoxiuwu
* on 2019/4/25
* email [email protected]
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface POST {
String value();
}
| [
"[email protected]"
]
| |
e6fae261073bb0a567e3e3b1cf893684692c5b57 | 7643d6d6f9c0d2a89f813e1cedbbe0cdd2e34a12 | /src/Perfume.java | 13eb8c350f53f5fc4422032c21da553d5bda74e8 | []
| no_license | Cdelim/Mini-Online-Shopping | 37617744343affcc6200e1fe23d5119afd5b5c0b | 7781bba9ea4f45031c2342c1df71f493c6c9c9b8 | refs/heads/master | 2020-05-01T10:36:53.424202 | 2019-03-24T14:21:12 | 2019-03-24T14:21:12 | 177,424,286 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java |
public class Perfume extends Cosmetic{
String lastingDuration;
/**To create an object from the Cosmetic class
* @param type Variable from Items class.
* @param price Variable from Items class.
* @param manufacturer Manufacturer of the Perfume object to be created.
* @param brand Brand of the Perfume object to be created.
* @param isOrganic Indicates whether or not the object is organic.
* @param expirationYear Expiration Year of the Perfume object to be created.
* @param weight Weight of the Perfume object to be created.
* @param lastingDuration Lasting Duration of the Perfume.
*/
public Perfume(String type, String price, String manufacturer, String brand, String isOrganic,
String expirationYear, String weight,String lastingDuration) {
super(type, price, manufacturer, brand, isOrganic, expirationYear, weight);
this.lastingDuration=lastingDuration;
}
public String toString(){
return("Type: " +this.type+
"\nItem ID: "+this.itemID+
"\nPrice: "+Double.parseDouble(this.price)+" $"+
"\nmanufacturer: "+manufacturer+
"\nbrand: "+this.brand+
"\nisOrganic: "+this.isOrganic+
"\nexpirationYear: "+this.expirationYear+
"\nweight: "+this.weight+
"\nlastingDuration: "+this.lastingDuration);
}
}
| [
"[email protected]"
]
| |
e462153599e83b2d3049c9b19cbaf738fd54b5c4 | 83ed1f4070ee69e7ce1fe0877deda7c9016828a2 | /opslabSSHibernate/src/test/java/com/opslab/framework/base/action/SuperActionTest.java | 6b782e327a5afaad4300feb40e586d192f315581 | []
| no_license | BaronND/opslabJava | 78f5c5d5549cab3e0619a6070a10429874098d7c | f3749a3e3cc78b886e5af526625a0dd469f1f9c3 | refs/heads/master | 2021-05-06T10:02:20.800676 | 2017-11-01T14:38:49 | 2017-11-01T14:38:49 | 114,087,392 | 1 | 0 | null | 2017-12-13T07:15:45 | 2017-12-13T07:15:44 | null | UTF-8 | Java | false | false | 7,916 | java | package com.opslab.framework.base.action;
import com.opslab.util.JacksonUtil;
import com.opslab.util.SysUtil;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.ModelAndView;
import java.util.Map;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
/**
* 利用Junit测试SpringMVC的controller
* 业务层方法通过集成并调用actions或url方法即可模拟测试springmvc controller
*/
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations =
{"classpath*:/spring/Spring-beans-for-JUnit.xml",
"classpath*:/spring/applicationContext-mvc.xml"})
public abstract class SuperActionTest {
// 模拟request,response
protected MockHttpServletRequest request;
protected MockHttpServletResponse response;
protected String path;
@Autowired
protected WebApplicationContext wac;
protected MockMvc mockMvc;
// 执行测试方法之前初始化模拟request,response
@Before
public void setUp() {
request = new MockHttpServletRequest();
request.setCharacterEncoding("UTF-8");
response = new MockHttpServletResponse();
this.mockMvc = webAppContextSetup(this.wac).build();
path = wac.getServletContext().getContextPath();
}
/**
* 模拟http请求,并返回请求结果
*
* @param url
* @return
* @throws Exception
*/
public ResultActions httpPost(String url) throws Exception {
MockHttpServletRequestBuilder post = post(path + "/" + url);
return mockMvc.perform(post);
}
/**
* 模拟http请求,直接打印请求结果
*
* @param url
* @throws Exception
*/
public void httpPostPrint(String url) throws Exception {
try {
ResultActions actions = httpPost(url);
actions.andExpect(status().isOk());
actions.andDo(print());
} catch (Exception e) {
System.out.println("请求异常:" + url);
e.printStackTrace();
}
}
/**
* 模拟http请求,并返回请求结果
*
* @param url
* @param params
* @return
* @throws Exception
*/
public ResultActions httpPost(String url, Map<String, String> params) throws Exception {
MockHttpServletRequestBuilder post = post(path + "/" + url);
if (params != null && params.size() > 0) {
for (Map.Entry<String, String> entry : params.entrySet()) {
post.param(entry.getKey(), entry.getValue());
}
}
return mockMvc.perform(post);
}
/**
* 模拟http请求可带参数,直接打印
*
* @param url
* @param params
* @throws Exception
*/
public void httpPostPrint(String url, Map<String, String> params) throws Exception {
try {
ResultActions actions = httpPost(url, params);
actions.andExpect(status().isOk());
actions.andDo(print());
} catch (Exception e) {
System.out.println("请求异常:" + url);
e.printStackTrace();
}
}
/**
* 模拟http请求,并返回请求结果
*
* @param url
* @return
* @throws Exception
*/
public ResultActions httpGet(String url) throws Exception {
MockHttpServletRequestBuilder get = get(url);
return mockMvc.perform(get);
}
/**
* 模拟http请求,直接打印请求结果
*
* @param url
* @throws Exception
*/
public void httpGetPrint(String url) {
try {
ResultActions actions = httpGet(url);
actions.andExpect(status().isOk());
actions.andDo(print());
} catch (Exception e) {
System.out.println("请求异常:" + url);
e.printStackTrace();
}
}
/**
* 模拟http请求,并返回请求结果
*
* @param url
* @param params
* @return
* @throws Exception
*/
public ResultActions httpGet(String url, Map<String, String> params) throws Exception {
MockHttpServletRequestBuilder post = get(path + "/" + url);
if (params != null && params.size() > 0) {
for (Map.Entry<String, String> entry : params.entrySet()) {
post.param(entry.getKey(), entry.getValue());
}
}
return mockMvc.perform(post);
}
/**
* 模拟http请求可带参数,直接打印
*
* @param url
* @param params
* @throws Exception
*/
public void httpGetPrint(String url, Map<String, String> params) throws Exception {
try {
ResultActions actions = httpGet(url, params);
actions.andExpect(status().isOk());
actions.andDo(print());
} catch (Exception e) {
System.out.println("请求异常:" + url);
e.printStackTrace();
}
}
public void info(ResultActions resultActions) {
StringBuffer sbuf = new StringBuffer();
try {
MvcResult mvcResult = resultActions.andReturn();
MockHttpServletResponse response = mvcResult.getResponse();
String contentType = response.getContentType();
sbuf.append("contentType:" + contentType + SysUtil.LINE_SEPARATOR);
if (contentType != null && contentType.indexOf("application/json") != -1) {
String json = response.getContentAsString();
sbuf.append("json:" + json + SysUtil.LINE_SEPARATOR);
} else {
ModelAndView modelAndView = mvcResult.getModelAndView();
if(modelAndView != null) {
sbuf.append("viewName:" + modelAndView.getViewName() + SysUtil.LINE_SEPARATOR);
String modelMap = JacksonUtil.toJSON(modelAndView.getModelMap());
sbuf.append("modelMap:" + modelMap + SysUtil.LINE_SEPARATOR);
}
}
System.out.println(sbuf.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
public void httpInfo(String url) {
try {
info(httpGet(url));
} catch (Exception e) {
e.printStackTrace();
}
}
public void httpInfo(String url, Map<String, String> params) {
try {
info(httpGet(url, params));
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
e6ffb941c347ac249745cd5393ca5cc015f5a098 | 2200824e81b81c802cf7477b1e67ad4b1288ae53 | /app/src/main/java/com/propster/paymentRecords/PaymentRecordsDetailActivity.java | 9e46a1607d443b3fdf62d0bc278f8d7cc76c29bc | []
| no_license | KelvinYapZiYann/Propster | af945946e580f08a522e67c900dd7b240d683ddb | a6c020d00a3cf32e8d097d618640e482e3726702 | refs/heads/main | 2023-06-17T20:43:53.052032 | 2021-07-14T06:01:53 | 2021-07-14T06:01:53 | 358,199,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package com.propster.paymentRecords;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
public class PaymentRecordsDetailActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
| [
"[email protected]"
]
| |
64178b377e0718a8d97db9892e224e4e2aa040cf | 8b4980bfecfd3bb8418abe79442108fad574cc63 | /src/main/java/me/cubert3d/palladium/gui/widget/DisplayWindow.java | 27967faa03d88ead2c5a889e7da28f1e65331be7 | [
"CC0-1.0"
]
| permissive | WaveringAna/Palladium-Cheat-Engine | 22c490b7d2b347c3d13924951d6a848859841a4c | 79cd4c6d6f7c5ace88f69914e01b0a56b36a471c | refs/heads/master | 2023-06-26T01:19:03.584819 | 2021-07-17T05:16:27 | 2021-07-17T05:16:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,300 | java | package me.cubert3d.palladium.gui.widget;
import me.cubert3d.palladium.gui.DrawHelper;
import me.cubert3d.palladium.gui.text.ColorText;
import me.cubert3d.palladium.gui.text.Colors;
import me.cubert3d.palladium.gui.text.provider.TextProvider;
import me.cubert3d.palladium.util.annotation.ClassInfo;
import me.cubert3d.palladium.util.annotation.ClassType;
import net.minecraft.client.util.math.MatrixStack;
import java.util.ArrayList;
import java.util.function.Supplier;
@ClassInfo(
authors = "cubert3d",
date = "4/23/2021",
type = ClassType.WIDGET
)
/*
This is a window that simply displays information, in the form of text.
*/
public final class DisplayWindow extends Window {
private static final Supplier<ArrayList<ColorText>> emptySupplier = ArrayList::new;
private Supplier<ArrayList<ColorText>> textSupplier;
private TextProvider textProvider;
public DisplayWindow(String id, WidgetManager widgetManager) {
super(id, "Window", widgetManager);
this.textSupplier = emptySupplier;
}
public DisplayWindow(String id, String label, TextProvider textProvider, WidgetManager widgetManager) {
super(id, label, widgetManager);
this.textProvider = textProvider;
}
@Override
public final String getLabel() {
return textProvider.getHeader().getString();
}
public void setTextProvider(TextProvider textProvider) {
this.textProvider = textProvider;
}
@Override
public void render(MatrixStack matrices) {
if (!minimized) {
drawMainWindow(matrices);
drawTextInWindow(matrices);
}
else {
drawMinimizedWindow(matrices);
}
drawWindowControls(matrices);
}
private void drawTextInWindow(MatrixStack matrices) {
int counter = 0;
int size = textSupplier.get().size();
boolean isListTooBig = size > getListSpaceAvailable();
for (ColorText text : textProvider.getBody()) {
String string = text.getString();
int x3 = getX() + 2;
int y3 = getY() + DrawHelper.getTextHeight() + 1 + (DrawHelper.getTextHeight() * counter);
/*
Check if there is enough room to keep printing the list.
If the number of available lines is the same or greater than the number
of strings in the text-list, then just print the whole list. But if there
is not enough room, that needs to be determined beforehand so that this can
stop printing the list on the second-to-last line, so as to leave space for
an addition line that says how many lines are not displayed. (...and x more)
*/
if (!isListTooBig || counter < getListSpaceAvailable() - 1) {
DrawHelper.drawText(matrices, string, x3, y3, getWindowWidth(), DrawHelper.getTextHeight(), Colors.WHITE);
}
else if (counter == getListSpaceAvailable() - 1) {
int remainder = size - counter;
String string2 = "...and " + remainder + " more";
DrawHelper.drawText(matrices, string2, x3, y3, getWindowWidth(), DrawHelper.getTextHeight(), Colors.WHITE);
}
counter++;
}
}
}
| [
"[email protected]"
]
| |
3febc5d64e56ce03742ae170f9ec514dc8f0b8fe | b683cfbb43cf475b8db7c1561bd02f416759eee1 | /MDUtilsLib/src/main/java/tw/idv/madmanchen/mdutilslib/utils/ImageUtils.java | 64da3a4abda3fa6ddc807924996f4c6e729b9cc8 | []
| no_license | army650663/MDUtils | 5955e4fd5481eee6918d74aec5bd559687d6d6b9 | 3fa452596db8798a85f49b96dd186b6c3e7b5cf1 | refs/heads/master | 2021-01-20T01:52:13.779472 | 2017-06-13T04:23:14 | 2017-06-13T04:23:14 | 89,336,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,295 | java | package tw.idv.madmanchen.mdutilslib.utils;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import android.widget.ImageView;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Author: chenshaowei.
* Version V1.0
* Date: 2016/11/10
* Description:
* Modification History:
* Date Author version Description
* ---------------------------------------------------------------------
* 2016/11/10 chenshaowei V1.0 Create
* Why & What is modified:
*/
public class ImageUtils {
public static Bitmap resizeBitmapKeepRatio(Bitmap bitmap, int reqWidth, int reqHeight) {
Matrix m = new Matrix();
m.setRectToRect(new RectF(0, 0, bitmap.getWidth(), bitmap.getHeight()), new RectF(0, 0, reqWidth, reqHeight), Matrix.ScaleToFit.CENTER);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
}
@Nullable
@WorkerThread
public static Bitmap getBitmapFromURL(String bitmapUrl) {
try {
URL url = new URL(bitmapUrl);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static void setBitmapFromURL(final ImageView imageView, final String url) {
final Handler handler = new Handler();
new Thread(new Runnable() {
@Override
public void run() {
final Bitmap bitmap = getBitmapFromURL(url);
handler.post(new Runnable() {
@Override
public void run() {
imageView.setImageBitmap(bitmap);
}
});
}
}).start();
}
}
| [
"[email protected]"
]
| |
39531ecd3895f39adbe89832352e268624885d55 | 5f306dd9cdeed6a682f86ec49e4dcf88648eeb76 | /src/itbootcamp/selenium/vezbe/SeleniumZadatak06032020.java | 74883367a8b0447d4c91be30822964172bd99363 | []
| no_license | rajiva366/SeleniumLearning | f33cb7471c192625181eabba049f61191633d002 | 6ca3e3fb97bebaeaf8c2ac815902bdfbf64bea47 | refs/heads/master | 2021-02-19T01:00:32.640182 | 2020-03-06T19:36:04 | 2020-03-06T19:36:04 | 245,260,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package itbootcamp.selenium.vezbe;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class SeleniumZadatak06032020 {
static WebElement pol;
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "src/itbootcamp/selenium/resourses/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.techlistic.com/p/selenium-practice-form.html");
WebElement ime, prezime;
ime= driver.findElement(By.name("firstname"));
ime.click();
ime.sendKeys("Ivana");
prezime= driver.findElement(By.name("lastname"));
prezime.click();
prezime.sendKeys("Rajcic");
pol = driver.findElement(By.id("sex-1"));
pol.click();
WebElement godineIskustva = driver.findElement(By.id("exp-5"));
godineIskustva.click();
WebElement datum = driver.findElement(By.id("datepicker"));
datum.sendKeys("06/03/2020");
WebElement profesija = driver.findElement(By.id("profession-1"));
profesija.click();
WebElement alat = driver.findElement(By.id("tool-2"));
alat.click();
WebElement kontinent = driver.findElement(By.id("continents"));
kontinent.click();
kontinent.sendKeys("Europe");
kontinent.click();
WebElement popuni = driver.findElement(By.id("submit"));
popuni.click();
WebElement link = driver.findElement(By.linkText("Selenium Webdriver Tutorials Series"));
link.click();
}
}
| [
"[email protected]"
]
| |
f4292397515d0c09272543fafa7fdb1745f32b66 | 0aec7d5eb1b28c62a588cc21dae515b929f5b21e | /src/test/java/org/sid/BpayProApplicationTests.java | 841baa5c9bca1129a375cd4ba1b7f4b925d3eef3 | []
| no_license | oumaimalaab/Bpay | d791cf014aa8ac34d140fb36dfececbe94bcab3c | 7321abd6ebe9ecf91d074c0784e8c4021988f929 | refs/heads/master | 2020-05-05T13:53:55.505632 | 2019-04-09T09:57:56 | 2019-04-09T09:57:56 | 180,098,085 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package org.sid;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BpayProApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
]
| |
c530f39289850da964acce655ef24431caf0a528 | d93f8c57dfcf5a38c96727a1c11de3281a3d0567 | /src/main/java/com/twjitm/transaction/utils/JdomUtils.java | dc29b7360ffe1d297bd6de8afdcb1608e0760c19 | []
| no_license | tangyiyong/twjitm-transaction | f4a6a215e48328635b1f0ee1f7d3fa4598b00faf | c151ad99d05707b92080b6067c26e9abd17a7b00 | refs/heads/master | 2020-04-10T11:37:35.105381 | 2018-11-08T14:59:36 | 2018-11-08T14:59:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,920 | java | package com.twjitm.transaction.utils;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import java.io.InputStream;
import java.net.URL;
/**
* @author twjitm - [Created on 2018-08-20 14:17]
* @company https://github.com/twjitm
* @jdk java version "1.8.0_77"
*/
public class JdomUtils {
public static final String ARRAY_SEPARATOR = ";";
public static Element getRootElement(String xmlPath) {
SAXBuilder builder = new SAXBuilder();
Document doc = null;
try {
doc = builder.build(xmlPath);
return doc.getRootElement();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Element getRootElement(URL xmlPath) {
SAXBuilder builder = new SAXBuilder();
Document doc = null;
try {
doc = builder.build(xmlPath);
} catch (Exception e) {
e.printStackTrace();
}
return doc.getRootElement();
}
public static int getIntAttriValue(Element e, String attrName) {
String attributeValue = e.getAttributeValue(attrName);
if (attributeValue == null) {
return -1;
}
return Integer.valueOf(attributeValue);
}
public static short getShortAttriValue(Element e, String attrName) {
String attributeValue = e.getAttributeValue(attrName);
if (attributeValue == null) {
return -1;
}
return Short.valueOf(attributeValue);
}
public static byte getByteAttriValue(Element e, String attrName) {
String attributeValue = e.getAttributeValue(attrName);
if (attributeValue == null) {
return -1;
}
return Byte.valueOf(attributeValue);
}
public static int[] getIntArrayAttriValue(Element e, String attrName) {
String[] temp = e.getAttributeValue(attrName).split(ARRAY_SEPARATOR);
int[] result = new int[temp.length];
for (int i = 0; i < temp.length; i++) {
result[i] = Integer.valueOf(temp[i]);
}
return result;
}
public static short[] getShortArrayAttriValue(Element e, String attrName) {
String[] temp = e.getAttributeValue(attrName).split(ARRAY_SEPARATOR);
short[] result = new short[temp.length];
for (int i = 0; i < temp.length; i++) {
result[i] = Short.valueOf(temp[i]);
}
return result;
}
public static Element getRootElementByStream(String xmlPath) {
try {
InputStream in= Thread.currentThread().getContextClassLoader().getResourceAsStream(xmlPath);
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(in);
return doc.getRootElement();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
]
| |
39a97179fc400b361fd507fbc33886d499cbda4c | 304cc2bac2a15e361aa61f282ae8c7a689df4fdf | /sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesGetSamples.java | f0c2116101a530b137dfda72416e9db3a4f2ee2c | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
]
| permissive | conniey/azure-sdk-for-java | b10ef4f1b78f9aa29a8e019da1a8b1219c19d8ad | fc95454298adcce03630faff78e60ba3fe05253b | refs/heads/main | 2023-08-26T04:25:35.062843 | 2023-08-25T16:03:33 | 2023-08-25T16:03:33 | 169,783,499 | 0 | 1 | MIT | 2023-09-14T05:40:16 | 2019-02-08T18:54:15 | Java | UTF-8 | Java | false | false | 871 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.network.generated;
/** Samples for Routes Get. */
public final class RoutesGetSamples {
/*
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-04-01/examples/RouteTableRouteGet.json
*/
/**
* Sample code: Get route.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getRoute(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.networks()
.manager()
.serviceClient()
.getRoutes()
.getWithResponse("rg1", "testrt", "route1", com.azure.core.util.Context.NONE);
}
}
| [
"[email protected]"
]
| |
433f3d23691a764b2a0959f48f62c396b1112e3a | c1b4377262cb07b745b60cbe29bfe4df40807556 | /7_Java_Class_200417/src/com/workbook/IOExceptionCase3.java | e0c225ec00dd911b9d1f16430f2a281b05930ebf | []
| no_license | Theo-Junior/Bigdataplatform_Java_Class_Note | b65e4ec7d9989d56b447726255b77457c75f1cb8 | 2c73a6659a92d64a429dcc3c625c20e537128487 | refs/heads/master | 2022-06-14T20:16:07.171384 | 2020-05-08T06:36:45 | 2020-05-08T06:36:45 | 254,815,232 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | java | package com.workbook;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.io.BufferedWriter;
import java.io.IOException;
/*
* 상속 및 호출관계가 복잡한 상황에서의 try-catch 구문 실습
* main -> md1 -> md2 로 실행이 된다.
* 이후 오류 발생시에는
* md2 -> md1 -> main 순으로 throw하며 처리한다.
*/
public class IOExceptionCase3 {
public static void main(String[] args) {
// try - catch 선언 및 정
try {
md1();
} catch(IOException e) {
e.printStackTrace();
}
}
// md1() 선언
public static void md1() throws IOException { // IOException 예외 넘긴다고 명시한다.
md2();
}
public static void md2() throws IOException{ // IOException 예외 넘긴다고 명시한다.
Path file = Paths.get("/Users/seongmin/Desktop/BigData_Edu/Java_Eclipse/7_Class_200417/Simple.txt");
BufferedWriter writer = null;
writer = Files.newBufferedWriter(file); // IOException 발생 가능
writer.write('A'); // IOException 발생 가능
writer.write('Z'); // IOException 발생 가능
if(writer != null)
writer.close(); // IOException 발생 가능
}
}
| [
"[email protected]"
]
| |
cd50788086a950146027ab38bea7e334c5e10925 | 28c757f8d0a865f3eb4c938a39da069b0535271b | /Binomio.java | 003836db9588b1d3edc7a6522db030001853c809 | []
| no_license | francnascimento/Random-sort | 8f7aca8fa8f1e9334e7b830d9d75278bca5990b2 | 49c6e1273264cc98f35b9041971247014b3d4353 | refs/heads/master | 2021-07-19T10:21:58.920371 | 2017-10-11T20:04:53 | 2017-10-11T20:04:53 | 108,582,418 | 0 | 0 | null | 2017-10-27T18:45:21 | 2017-10-27T18:45:20 | null | UTF-8 | Java | false | false | 490 | java | class Binomio{
public static void main(String[] args){
int n = 8;
int i = 8;
System.out.println(factorial(n));
int coefficient = factorial(n) / (factorial(i) * factorial(n - i));
System.out.println(coefficient);
}
private static int factorial(int i) {
if(i == 0) return 1;
System.out.println(i);
int product = 1;
for(int j = 1; j<=i; j++){
product *= j;
}
return product;
}
} | [
"[email protected]"
]
| |
fe2d57cd57c854d0c39670e213fecdd3112b7957 | 5568054b8f6c65e4bef58d46543eb12c66e3803d | /BitsandPizzas-CardView-RecyclerView-Adapter-LayoutManager/java/com/example/alex/bitsandpizzas/CaptionedImageAdapter.java | f6708cf7e69ab238ad9e9a208f7917c9231acfaa | []
| no_license | Investik/android | eec9e105488dfc10e9b6806da236f52e3b318293 | a94ebdb39c11022b845828d088d331d4fd54a307 | refs/heads/master | 2016-08-12T20:59:06.637013 | 2016-03-14T13:25:10 | 2016-03-14T13:25:10 | 53,109,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,721 | java | package com.example.alex.bitsandpizzas;
/**
* Created by Alex on 14.03.2016.
*/
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import android.graphics.drawable.Drawable;
public class CaptionedImageAdapter extends RecyclerView.Adapter<CaptionedImageAdapter.ViewHolder>{
private String[] captions;
private int[] imageIds;
private Listener listener;
public static interface Listener {
public void onClick(int position);
}
public CaptionedImageAdapter(String[] captions, int[] imageIds){
this.captions=captions;
this.imageIds=imageIds;
}
//Provide a reference to the views used in the recycler view
public static class ViewHolder extends RecyclerView.ViewHolder{
private CardView cardView;
//Our recycler view needs to display CardViews, so we specify that our ViewHolder contains CardViews. If you want to display another type of data in the recycler view, you define it here.
public ViewHolder(CardView v){
super(v);
cardView=v;
}
}
public void setListener(Listener listener){
this.listener = listener;
}
@Override
public CaptionedImageAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
CardView cv = (CardView) LayoutInflater.from(parent.getContext()).inflate(R.layout.card_captioned_image, parent, false);
return new ViewHolder(cv);
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position){
//Set the values inside the given view
CardView cardView=holder.cardView;
cardView.setPreventCornerOverlap(false);
ImageView imageView = (ImageView) cardView.findViewById(R.id.info_image);
Drawable drawable=cardView.getResources().getDrawable(imageIds[position]);
imageView.setImageDrawable(drawable);
imageView.setContentDescription(captions[position]);
TextView textView = (TextView) cardView.findViewById(R.id.info_text);
textView.setText(captions[position]);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
listener.onClick(position);
}
}
});
}
@Override
public int getItemCount(){
//Return the number of items in the data set
return captions.length;
}
}
| [
"[email protected]"
]
| |
4fc70e56ab0561bb8d726e838f1af4408db9873e | 66d9c692976d78bf5006d69689e4e3d756fd5ac8 | /app/src/main/java/com/rohankadkol/weatherapp10/models/Temp.java | 7bcf3e59c84c54417447d97a2b3c2a6a34614f8b | []
| no_license | rohan-kadkol/Android-Developer-Essentials-10-Weather-App | f781415fb91cdaa31365276de78dee44671bea38 | 0f47f2daa7ec9a220ddb2410ab3b25d31c4ec090 | refs/heads/master | 2022-12-04T05:40:34.624987 | 2020-08-26T22:20:29 | 2020-08-26T22:20:29 | 290,616,907 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package com.rohankadkol.weatherapp10.models;
public class Temp {
private double max;
private double min;
public double getMax() {
return max;
}
public double getMin() {
return min;
}
}
| [
"[email protected]"
]
| |
7d6e2b8b4f776645e2980b89b837ded699af5d35 | ee6b8094019b1774add0f64d09301745bb4fa3a5 | /app/src/main/java/com/boombar/drjoshi/fragment/Mainfile/MyRecyclerViewAdapter.java | b292887ea118168e5d3831f14650f3d4a6a1860f | []
| no_license | AnushkaJoshi/Goonj2k17 | 2fb59c210fe72875e1e695b184452fe3c38ba434 | 4b1e76bd3d0e25d337ce9a662b3f7e0f4accb256 | refs/heads/master | 2020-12-30T14:13:44.715495 | 2017-05-15T09:03:06 | 2017-05-15T09:03:06 | 91,298,951 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,554 | java | package com.boombar.drjoshi.fragment.Mainfile;
/**
* Created by User on 19-02-2017.
*/
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.boombar.drjoshi.fragment.Dramatics.Dramatics;
import com.boombar.drjoshi.fragment.Music.Music;
import com.boombar.drjoshi.fragment.R;
import java.util.ArrayList;
public class MyRecyclerViewAdapter extends RecyclerView
.Adapter<MyRecyclerViewAdapter
.DataObjectHolder> {
private static String LOG_TAG = "MyRecyclerViewAdapter";
private ArrayList<DataObject> mDataset;
private static MyClickListener myClickListener;
private Context context;
public static class DataObjectHolder extends RecyclerView.ViewHolder
implements View
.OnClickListener {
TextView label;
TextView dateTime;
ImageView image;
public DataObjectHolder(View itemView) {
super(itemView);
label = (TextView) itemView.findViewById(R.id.main);
dateTime = (TextView) itemView.findViewById(R.id.dept);
image= (ImageView) itemView.findViewById(R.id.image);
Log.i(LOG_TAG, "Adding Listener");
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
myClickListener.onItemClick(getAdapterPosition(), v);
}
}
public void setOnItemClickListener(MyClickListener myClickListener) {
this.myClickListener = myClickListener;
}
public MyRecyclerViewAdapter(ArrayList<DataObject> myDataset, Context context) {
mDataset = myDataset;
this.context=context;
}
@Override
public DataObjectHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.card_row, parent, false);
DataObjectHolder dataObjectHolder = new DataObjectHolder(view);
return dataObjectHolder;
}
@Override
public void onBindViewHolder(DataObjectHolder holder, final int position) {
holder.label.setText(mDataset.get(position).getmText1());
holder.dateTime.setText(mDataset.get(position).getmText2());
holder.image.setImageResource(mDataset.get(position).getimageid());
holder.image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (position){
case 0: Intent intent = new Intent(context,Dramatics.class);
context.startActivity(intent);
break;
case 1:Intent intent2 = new Intent(context,Music.class);
context.startActivity(intent2);
break;
}
}
});
}
public void addItem(DataObject dataObj, int index) {
mDataset.add(index, dataObj);
notifyItemInserted(index);
}
public void deleteItem(int index) {
mDataset.remove(index);
notifyItemRemoved(index);
}
@Override
public int getItemCount() {
return mDataset.size();
}
public interface MyClickListener {
public void onItemClick(int position, View v);
}
}
| [
"[email protected]"
]
| |
bc7d721ff0fb66df9fab67afdb64fc729d8c2f39 | c89a21edffe48ed388fb65b38ddd37fa7789e344 | /src/fr/demos/metier/Product.java | aa469c59d7c919b28ce045ff0f75365852b7daf5 | []
| no_license | khWam/EcommerceWeb | 164d0d53c0bcc6bf76b7d3fb6c522fab49c5dad9 | 33951688d3e2363b4ec41b9a3fa4922d94993c98 | refs/heads/master | 2021-01-01T03:55:57.068993 | 2016-05-04T10:26:41 | 2016-05-04T10:26:41 | 55,997,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,502 | java | package fr.demos.metier;
import java.sql.Timestamp;
import java.util.Calendar;
public class Product {
private int id;
private String name;
private String description;
private int price;
private Timestamp last_update;
private int quantity;
private Category category;
public int quantityAcheter = 0;
public Product(String name, String description, int price, Timestamp last_update, int quantity,
Category category) {
super();
//this.id = id;
this.name = name;
this.description = description;
this.price = price;
this.last_update = last_update;
this.quantity = quantity;
this.category = category;
}
public Product( String name, String description, int price, Category category, int quantity) {
super();
//this.id = id;
this.name = name;
this.description = description;
this.price = price;
this.category = category;
this.quantity=quantity;
Calendar calendar = Calendar.getInstance();
this.last_update = new Timestamp(calendar.getTime().getTime());
}
public Product( String name, String description, int price, Category category) {
super();
//this.id = id;
this.name = name;
this.description = description;
this.price = price;
this.category = category;
this.quantity=0;
Calendar calendar = Calendar.getInstance();
this.last_update = new Timestamp(calendar.getTime().getTime());
}
public Product(int id, String name, String description, int price, Timestamp last_update, int quantity,
Category category) {
super();
this.id = id;
this.name = name;
this.description = description;
this.price = price;
this.last_update = last_update;
this.quantity = quantity;
this.category = category;
}
public void increment(){
this.quantity++;
}
public void decrement(){
this.quantity--;
}
/**
* Getter of description
*/
public String getDescription() {
return description;
}
/**
* Setter of description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Getter of price
*/
public int getPrice() {
return price;
}
/**
* Setter of price
*/
public void setPrice(int price) {
this.price = price;
}
/**
* Getter of name
*/
public String getName() {
return name;
}
/**
* Setter of name
*/
public void setName(String name) {
this.name = name;
}
/**
* Getter of id
*/
public int getId() {
return id;
}
/**
* Setter of id
*/
public void setId(int id) {
this.id = id;
}
/**
* Getter of last_update
*/
public Timestamp getLast_update() {
return last_update;
}
/**
* Setter of last_update
*/
public void setLast_update(Timestamp last_update) {
this.last_update = last_update;
}
/**
* Getter of quantity
*/
public int getQuantity() {
return quantity;
}
/**
* Setter of quantity
*/
public void setQuantity(int quantity) {
this.quantity = quantity;
}
/**
* Getter of category
*/
public Category getCategory() {
return category;
}
/**
* Setter of category
*/
public void setCategory(Category category) {
this.category = category;
}
public int getQuantityAcheter() {
return quantityAcheter;
}
public void setQuantityAcheter(int quantityAchete) {
this.quantityAcheter = quantityAchete;
}
} | [
"[email protected]"
]
| |
83a363545b635ca99143853aaad1d6bb9bcd4849 | c4ca2f18993daf70653b6b75f72591789f1dd040 | /src/main/java/com/tm30/allgigsproject/model/CountryModel.java | 10863e31a356f0e08693a94cc8907bd6ed24567a | []
| no_license | kayode-ik/ALL-GIGS-PROJECT | 8f97676f1bad445a6bd548eb93f2367314521bd3 | 9855454f22ba3d9d26df6becacb652115bdf8539 | refs/heads/master | 2022-11-29T09:41:00.120717 | 2020-08-04T08:40:47 | 2020-08-04T08:40:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | package com.tm30.allgigsproject.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "COUNTRY")
public class CountryModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int countryId;
@Column(name = "COUNTRY_CD")
private String countryCode;
@Column(name = "COUNTRY_NAME")
private String countryName;
public int getCountryId() {
return countryId;
}
public void setCountryId(int countryId) {
this.countryId = countryId;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getCountryName() {
return countryName;
}
public void setCountryName(String countryName) {
this.countryName = countryName;
}
}
| [
"[email protected]"
]
| |
24a4f1ab2ec27d1ced5c97fd3d1c8cf6809a76b4 | 3a98774b5e6d834354f93cf2e571e300cb84eb50 | /session-beans/src/main/java/com/raidentrance/session/beans/singleton/SingletonStudentBean.java | 15e8bf3c1bcea7b4b6c5a924c9eb267c1f647cf7 | [
"Apache-2.0"
]
| permissive | marcosptf/ejb3.1-certification | fd7f9ab3e6e4deceb4263a543f2cc7895715f891 | 1c8197dd596d2e7006b22839cdca8ac1a876d1f2 | refs/heads/master | 2020-06-03T14:36:47.510494 | 2016-01-19T16:23:47 | 2016-01-19T16:23:47 | 191,607,994 | 1 | 0 | null | 2019-06-12T16:30:13 | 2019-06-12T16:30:13 | null | UTF-8 | Java | false | false | 1,033 | 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 com.raidentrance.session.beans.singleton;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.DependsOn;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;
/**
*
* @author alejandrobautista
*/
@Singleton
@Startup
@DependsOn(value = "ListManagerBean")
public class SingletonStudentBean {
@EJB
private ListManagerBean listManagerBean;
@PostConstruct
public void init() {
System.out.println("Initializing SingletonStudentBean");
}
@PreDestroy
public void destroy() {
System.out.println("Destroying SingletonStudentBean");
}
public void addName(String name) {
listManagerBean.addName(name);
}
public List<String> getNames() {
return listManagerBean.getNames();
}
}
| [
"[email protected]"
]
| |
9bbedb7170f7221d9759b8f19d651e47e8a65052 | 69c2046fe40660c9e0edff121bcf17f4e0eaed0c | /grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/support/DatastorePersistenceContextInterceptor.java | 4716d16e0b6b9446bd59c2fae9d1a4fa03733be4 | []
| no_license | trisberg/inconsequential | f59090b78b7bdeb0142a189168eee837db95c647 | eda971b71d800e8afefc11b4eba733c122883995 | refs/heads/master | 2021-01-15T18:50:24.015788 | 2010-09-08T13:00:59 | 2010-09-08T13:00:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,407 | java | /* Copyright (C) 2010 SpringSource
*
* 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 org.grails.datastore.gorm.support;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.codehaus.groovy.grails.support.PersistenceContextInterceptor;
import org.springframework.datastore.core.Datastore;
import org.springframework.datastore.core.DatastoreUtils;
import org.springframework.datastore.core.Session;
import org.springframework.datastore.transactions.SessionHolder;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import javax.persistence.FlushModeType;
/**
* @since 1.0
*/
public class DatastorePersistenceContextInterceptor implements PersistenceContextInterceptor{
private static final Log LOG = LogFactory.getLog(DatastorePersistenceContextInterceptor.class);
private Datastore datastore;
private boolean participate;
public DatastorePersistenceContextInterceptor(Datastore datastore) {
this.datastore = datastore;
}
public void init() {
if (TransactionSynchronizationManager.hasResource(datastore)) {
// Do not modify the Session: just set the participate flag.
participate = true;
}
else {
LOG.debug("Opening single Datastore session in DatastorePersistenceContextInterceptor");
Session session = getSession();
session.setFlushMode(FlushModeType.AUTO);
TransactionSynchronizationManager.bindResource(datastore, new SessionHolder(session));
}
}
protected Session getSession() {
return DatastoreUtils.getSession(datastore, true);
}
public void destroy() {
if (participate) {
return;
}
// single session mode
if(TransactionSynchronizationManager.getResource(datastore) != null) {
SessionHolder holder = (SessionHolder)TransactionSynchronizationManager.unbindResource(datastore);
LOG.debug("Closing single Datastore session in DatastorePersistenceContextInterceptor");
try {
Session session = holder.getSession();
DatastoreUtils.closeSession(session);
}
catch (RuntimeException ex) {
LOG.error("Unexpected exception on closing Datastore Session", ex);
}
}
}
public void disconnect() {
destroy();
}
public void reconnect() {
init();
}
public void flush() {
getSession().flush();
}
public void clear() {
getSession().clear();
}
public void setReadOnly() {
getSession().setFlushMode(FlushModeType.COMMIT);
}
public void setReadWrite() {
getSession().setFlushMode(FlushModeType.AUTO);
}
public boolean isOpen() {
return getSession().isConnected();
}
}
| [
"[email protected]"
]
| |
08c207bb7de6ec613c2cb53654ad93c6b9124ea0 | 701ef9d0f4d6fcc75be584337756bb468920c35b | /spring-demo-annotations/src/springdemo/MyLoggerConfig.java | ad7f74e3f32a82e8b4ba978aca59ffb1cc611c74 | []
| no_license | KartikSareen18/Java-Spring-Hibernate | 5ad96cfc1515489854bf29acc69e94eeb01ce6b4 | 8ea129ef00de5b8c80fbc8668b2227849231fd87 | refs/heads/master | 2022-04-28T03:02:37.301415 | 2020-04-27T14:59:04 | 2020-04-27T14:59:04 | 254,387,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,293 | java | package springdemo;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class MyLoggerConfig {
private String rootLoggerLevel;
private String printedLoggerLevel;
public void setRootLoggerLevel(String rootLoggerLevel) {
this.rootLoggerLevel = rootLoggerLevel;
}
public void setPrintedLoggerLevel(String printedLoggerLevel) {
this.printedLoggerLevel = printedLoggerLevel;
}
public void initLogger() {
// parse levels
Level rootLevel = Level.parse(rootLoggerLevel);
Level printedLevel = Level.parse(printedLoggerLevel);
// get logger for app context
Logger applicationContextLogger = Logger.getLogger(AnnotationConfigApplicationContext.class.getName());
// get parent logger
Logger loggerParent = applicationContextLogger.getParent();
// set root logging level
loggerParent.setLevel(rootLevel);
// set up console handler
ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(printedLevel);
consoleHandler.setFormatter(new SimpleFormatter());
// add handler to the logger
loggerParent.addHandler(consoleHandler);
}
} | [
"[email protected]"
]
| |
324faee8dc1204f4174967ed7cb4cfd9603e5d92 | ac91fbd18ac39b3f203eeb923ad6f9eac5ff4738 | /src/main/java/me/sirgregg/osubot/util/objects/Event.java | 91640ac61e5ff8ecd4757a0db9b0311f84dc147f | []
| no_license | GreggKr/osu-Self-Bot | 1b6d660138e6d10871d805c02f56a1f7e700f993 | 9eb50d63450ce316c8abea1a745976155e9460cc | refs/heads/master | 2021-01-02T22:36:14.899480 | 2017-09-23T15:09:15 | 2017-09-23T15:09:15 | 99,352,246 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package me.sirgregg.osubot.util.objects;
import com.google.gson.annotations.SerializedName;
public class Event {
private String date;
@SerializedName("display_html")
private String displayHTML;
@SerializedName("beatmap_id")
private String beatmapId;
@SerializedName("beatmapset_id")
private String beatmapsetId;
@SerializedName("epicfactor")
private String epicFactor;
public String getDate() {
return date;
}
public String getDisplayHTML() {
return displayHTML;
}
public String getBeatmapId() {
return beatmapId;
}
public String getBeatmapsetId() {
return beatmapsetId;
}
public String getEpicFactor() {
return epicFactor;
}
}
| [
"[email protected]"
]
| |
8934bf7243b5aa8e03294db68e89144c5082fc65 | 4a439bfa8d7894a1fd1376d83a9f8888013d955d | /src/main/java/github/tiagomac/ws/correios/ValidarPostagemReversa.java | a730cf811a01e2272f487bea3a30921b7fee9b61 | []
| no_license | tiagomac/ws-client-example | 752689755b3b16f03e62d52f4381375c22000b32 | 931da36b82a4fd02111f2e2d02e0186357feb373 | refs/heads/master | 2020-07-04T06:54:14.197567 | 2019-08-13T17:52:35 | 2019-08-13T17:52:35 | 202,194,296 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 5,340 | java |
package github.tiagomac.ws.correios;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java de validarPostagemReversa complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType name="validarPostagemReversa">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="codAdministrativo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="codigoServico" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="cepDestinatario" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="idCartaoPostagem" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="coleta" type="{http://cliente.bean.master.sigep.bsb.correios.com.br/}coletaReversa" minOccurs="0"/>
* <element name="usuario" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="senha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "validarPostagemReversa", propOrder = {
"codAdministrativo",
"codigoServico",
"cepDestinatario",
"idCartaoPostagem",
"coleta",
"usuario",
"senha"
})
public class ValidarPostagemReversa {
protected String codAdministrativo;
protected String codigoServico;
protected String cepDestinatario;
protected String idCartaoPostagem;
protected ColetaReversa coleta;
protected String usuario;
protected String senha;
/**
* Obtém o valor da propriedade codAdministrativo.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodAdministrativo() {
return codAdministrativo;
}
/**
* Define o valor da propriedade codAdministrativo.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodAdministrativo(String value) {
this.codAdministrativo = value;
}
/**
* Obtém o valor da propriedade codigoServico.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodigoServico() {
return codigoServico;
}
/**
* Define o valor da propriedade codigoServico.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodigoServico(String value) {
this.codigoServico = value;
}
/**
* Obtém o valor da propriedade cepDestinatario.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCepDestinatario() {
return cepDestinatario;
}
/**
* Define o valor da propriedade cepDestinatario.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCepDestinatario(String value) {
this.cepDestinatario = value;
}
/**
* Obtém o valor da propriedade idCartaoPostagem.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIdCartaoPostagem() {
return idCartaoPostagem;
}
/**
* Define o valor da propriedade idCartaoPostagem.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIdCartaoPostagem(String value) {
this.idCartaoPostagem = value;
}
/**
* Obtém o valor da propriedade coleta.
*
* @return
* possible object is
* {@link ColetaReversa }
*
*/
public ColetaReversa getColeta() {
return coleta;
}
/**
* Define o valor da propriedade coleta.
*
* @param value
* allowed object is
* {@link ColetaReversa }
*
*/
public void setColeta(ColetaReversa value) {
this.coleta = value;
}
/**
* Obtém o valor da propriedade usuario.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUsuario() {
return usuario;
}
/**
* Define o valor da propriedade usuario.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUsuario(String value) {
this.usuario = value;
}
/**
* Obtém o valor da propriedade senha.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSenha() {
return senha;
}
/**
* Define o valor da propriedade senha.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSenha(String value) {
this.senha = value;
}
}
| [
"[email protected]"
]
| |
d8dff283c43facd383c979e0384fb1b789736002 | c70fc8ac2ada6251a5df3fe06e0d6f9200af2ade | /order-service/src/test/java/com/epam/orderservice/OrderServiceApplicationTests.java | a9062b67b5b6cbd1f5ec1fd46733b07c2a27816e | []
| no_license | AramVanyan/restaurant-service-prod | 1f744ead8601c039019a0dee3ee9239687f5e894 | 3c10dd04e7e82403d002a31c6494f26cc26d3a3b | refs/heads/master | 2023-03-18T02:37:21.124637 | 2021-03-16T06:39:54 | 2021-03-16T06:39:54 | 325,943,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package com.epam.orderservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class OrderServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
38db75b06ed0654ccf16204db841c2ef367942b8 | f9d4e15a7a5008cd81eb19cb62835966938be8a7 | /colombo-brognoli-thesis/ValidationNumReqWrappers/src/it/polimi/validationwrappers/Wrapper332.java | 27c9102257fd75fa2d9b0ef68854f3dd4e6889bb | []
| no_license | nicolobrognoli/colombo-brognoli-thesis | 6e607ef1d802b946ede8e8db124d818493a3cc93 | 912bcfc5e37b9df916929e6f014b1ce2085bac43 | refs/heads/master | 2021-01-01T05:38:43.665817 | 2015-03-15T20:07:28 | 2015-03-15T20:07:28 | 32,281,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,750 | java |
package it.polimi.validationwrappers;import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Wrapper332{
private Map<String,Float> mapReward = new HashMap<String,Float>();
private List<String> rewardNameList = new ArrayList<String>();
private List<String> alternatives = new ArrayList<String>();public Wrapper332(){
rewardNameList.add("time"); mapReward.put("totaltime", 100.0f);mapReward.put("weighttime", 0.7f);mapReward.put("policytime", 0.0f);
alternatives.add("A");
mapReward.put("Atime",0f);
mapReward.put("AtimeMin",0.074095122562416f);
mapReward.put("AtimeMax",0.022520705584829527f);
alternatives.add("B");
mapReward.put("Btime",0f);
mapReward.put("BtimeMin",0.05411172392787694f);
mapReward.put("BtimeMax",0.040026450353465345f);
alternatives.add("C");
mapReward.put("Ctime",0f);
mapReward.put("CtimeMin",0.057316424003454824f);
mapReward.put("CtimeMax",0.03571916910005184f);rewardNameList.add("h"); mapReward.put("totalh", 2000f);mapReward.put("weighth", 0.3f);mapReward.put("policyh", 0.0f);
mapReward.put("Ah",1f);
mapReward.put("AhMin",1668.7997829402896f);
mapReward.put("AhMax",1669.2964311908745f);
mapReward.put("Bh",1f);
mapReward.put("BhMin",1677.0425780050757f);
mapReward.put("BhMax",1669.6852421649821f);
mapReward.put("Ch",1f);
mapReward.put("ChMin",1674.223093601675f);
mapReward.put("ChMax",1675.4183876999023f);
}
public void doActivity(){
String choice = AlternativeUtility.getAlternative(alternatives,rewardNameList,mapReward);ActivityInterface obj = null;if(choice.equals("A")){obj = new A();}if(choice.equals("B")){obj = new B();}if(choice.equals("C")){obj = new C();} obj.doActivity();AlternativeUtility.updateContext(rewardNameList, choice, mapReward);}} | [
"[email protected]"
]
| |
bbfca8792831b9f8f9d4cb307ba7316d20aa4a23 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_4332b742d13766ee7f7c6b2700fc3eb7e5d1fbdc/PreprocessingContext/18_4332b742d13766ee7f7c6b2700fc3eb7e5d1fbdc_PreprocessingContext_s.java | 6ee43a66327298a1033ea763d37b8164cb3f4581 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 17,576 | java |
/*
* Carrot2 project.
*
* Copyright (C) 2002-2010, Dawid Weiss, Stanisław Osiński.
* All rights reserved.
*
* Refer to the full license file "carrot2.LICENSE"
* in the root folder of the repository checkout or at:
* http://www.carrot2.org/carrot2.LICENSE
*/
package org.carrot2.text.preprocessing;
import java.util.List;
import org.carrot2.core.Document;
import org.carrot2.text.analysis.ITokenizer;
import org.carrot2.text.linguistic.ILanguageModel;
import org.carrot2.text.linguistic.IStemmer;
import org.carrot2.text.util.MutableCharArray;
import com.carrotsearch.hppc.BitSet;
import com.carrotsearch.hppc.ObjectOpenHashSet;
import com.carrotsearch.hppc.predicates.ShortPredicate;
/**
* Document preprocessing context provides low-level (usually integer-coded) data
* structures useful for further processing.
*
* <p><img src="doc-files/preprocessing-arrays.png"
* alt="Internals of PreprocessingContext"/></p>
*/
public final class PreprocessingContext
{
/** Predicate for splitting on document separator. */
public static final ShortPredicate ON_DOCUMENT_SEPARATOR =
equalTo(ITokenizer.TF_SEPARATOR_DOCUMENT);
/** Predicate for splitting on field separator. */
public static final ShortPredicate ON_FIELD_SEPARATOR =
equalTo(ITokenizer.TF_SEPARATOR_FIELD);
/** Predicate for splitting on sentence separator. */
public static final ShortPredicate ON_SENTENCE_SEPARATOR = new ShortPredicate()
{
public boolean apply(short tokenType)
{
return (tokenType & ITokenizer.TF_SEPARATOR_SENTENCE) != 0;
}
};
/**
* Return a new {@link ShortPredicate} returning <code>true</code>
* if the argument equals a given value.
*/
public static final ShortPredicate equalTo(final short t)
{
return new ShortPredicate() {
public boolean apply(short value)
{
return value == t;
}
};
}
/** Query used to perform processing, may be <code>null</code> */
public final String query;
/** A list of documents to process. */
public final List<Document> documents;
/** Language model to be used */
public final ILanguageModel language;
/**
* Token interning cache. Token images are interned to save memory and allow reference
* comparisons.
*/
public ObjectOpenHashSet<MutableCharArray> tokenCache = new ObjectOpenHashSet<MutableCharArray>();
/**
* Creates a preprocessing context for the provided <code>documents</code> and with
* the provided <code>languageModel</code>.
*/
public PreprocessingContext(ILanguageModel languageModel, List<Document> documents,
String query)
{
this.query = query;
this.documents = documents;
this.language = languageModel;
}
/**
* Information about all tokens of the input {@link PreprocessingContext#documents}.
* Each element of each of the arrays corresponds to one individual token from the
* input or a synthetic separator inserted between documents, fields and sentences.
* Last element of this array is a special terminator entry.
* <p>
* All arrays in this class have the same length and values across different arrays
* correspond to each other for the same index.
*/
public static class AllTokens
{
/**
* Token image as it appears in the input. On positions where {@link #type} is
* equal to one of {@link ITokenizer#TF_TERMINATOR},
* {@link ITokenizer#TF_SEPARATOR_DOCUMENT} or
* {@link ITokenizer#TF_SEPARATOR_FIELD} , image is <code>null</code>.
* <p>
* This array is produced by {@link Tokenizer}.
*/
public char [][] image;
/**
* Token's {@link ITokenTypeAttribute} bit flags.
* <p>
* This array is produced by {@link Tokenizer}.
*/
public short [] type;
/**
* Document field the token came from. The index points to arrays in
* {@link AllFields}, equal to <code>-1</code> for document and field separators.
* <p>
* This array is produced by {@link Tokenizer}.
*/
public byte [] fieldIndex;
/**
* Index of the document this token came from, points to elements of
* {@link PreprocessingContext#documents}. Equal to <code>-1</code> for document
* separators.
* <p>
* This array is produced by {@link Tokenizer}.
*
* TODO: is this always needed? Seems awfully repetitive, esp. for long docs.
*/
public int [] documentIndex;
/**
* A pointer to {@link AllWords} arrays for this token. Equal to <code>-1</code>
* for document, field and {@link ITokenizer#TT_PUNCTUATION} tokens (including
* sentence separators).
* <p>
* This array is produced by {@link CaseNormalizer}.
*/
public int [] wordIndex;
/**
* The suffix order of tokens. Suffixes starting with a separator come at the end
* of the array.
* <p>
* This array is produced by {@link PhraseExtractor}.
*/
public int [] suffixOrder;
/**
* The Longest Common Prefix for the adjacent suffix-sorted token sequences.
* <p>
* This array is produced by {@link PhraseExtractor}.
*/
public int [] lcp;
}
/**
* Information about all tokens of the input {@link PreprocessingContext#documents}.
*/
public final AllTokens allTokens = new AllTokens();
/**
* Information about all fields processed for the input
* {@link PreprocessingContext#documents}.
*/
public static class AllFields
{
/**
* Name of the document field. Entries of {@link AllTokens#fieldIndex} point to
* this array.
* <p>
* This array is produced by {@link Tokenizer}.
*/
public String [] name;
}
/**
* Information about all fields processed for the input
* {@link PreprocessingContext#documents}.
*/
public final AllFields allFields = new AllFields();
/**
* Information about all unique words found in the input
* {@link PreprocessingContext#documents}. Each entry in each array corresponds to one
* unique word with respect to case, e.g. <em>data</em> and <em>DATA</em> will be
* conflated to one entry in the arrays. Different grammatical forms of one word, e.g.
* e.g <em>computer</em> and <em>computers</em>, will have different entries in the
* arrays (see {@link AllStems} for inflection-conflated versions).
* <p>
* All arrays in this class have the same length and values across different arrays
* correspond to each other for the same index.
*/
public static class AllWords
{
/**
* The most frequently appearing variant of the word with respect to case. E.g. if
* a token <em>MacOS</em> appeared 12 times in the input and <em>macos</em>
* appeared 3 times, the image will be equal to <em>MacOS</em>.
* <p>
* This array is produced by {@link CaseNormalizer}.
*/
public char [][] image;
/**
* Token type of this word copied from {@link AllTokens#type}. Additional
* flags are set for each word by
* {@link CaseNormalizer} and {@link LanguageModelStemmer}.
*
* <p>
* This array is produced by {@link CaseNormalizer}.
* This array is modified by {@link LanguageModelStemmer}.
*
* @see ITokenTypeAttribute
*/
public short [] type;
/**
* Term Frequency of the word, aggregated across all variants with respect to
* case. Frequencies for each variant separately are not available.
* <p>
* This array is produced by {@link CaseNormalizer}.
*/
public int [] tf;
/**
* Term Frequency of the word for each document. The length of this array is equal
* to the number of documents this word appeared in (Document Frequency)
* multiplied by 2. Elements at even indices contain document indices pointing to
* {@link PreprocessingContext#documents}, elements at odd indices contain the
* frequency of the word in the document. For example, an array with 4 values:
* <code>[2, 15, 138, 7]</code> means that the word appeared 15 times in document
* at index 2 and 7 times in document at index 138.
* <p>
* This array is produced by {@link CaseNormalizer}.
*/
public int [][] tfByDocument;
/**
* A pointer to the {@link AllStems} arrays for this word.
* <p>
* This array is produced by {@link LanguageModelStemmer}.
*/
public int [] stemIndex;
/**
* A bit-packed indices of all fields in which this word appears at least once.
* Indexes (positions) of selected bits are pointers to the
* {@link AllFields} arrays. Fast conversion between the bit-packed representation
* and <code>byte[]</code> with index values is done by {@link #toFieldIndexes(byte)}
* <p>
* This array is produced by {@link CaseNormalizer}.
*/
public byte [] fieldIndices;
}
/**
* Information about all unique words found in the input
* {@link PreprocessingContext#documents}.
*/
public final AllWords allWords = new AllWords();
/**
* Information about all unique stems found in the input
* {@link PreprocessingContext#documents}. Each entry in each array corresponds to one
* base form different words can be transformed to by the {@link IStemmer} used while
* processing. E.g. the English <em>mining</em> and <em>mine</em> will be aggregated
* to one entry in the arrays, while they will have separate entries in
* {@link AllWords}.
* <p>
* All arrays in this class have the same length and values across different arrays
* correspond to each other for the same index.
*/
public static class AllStems
{
/**
* Stem image as produced by the {@link IStemmer}, may not correspond to any
* correct word.
* <p>
* This array is produced by {@link LanguageModelStemmer}.
*/
public char [][] image;
/**
* Pointer to the {@link AllWords} arrays, to the most frequent original form of
* the stem. Pointers to the less frequent variants are not available.
* <p>
* This array is produced by {@link LanguageModelStemmer}.
*/
public int [] mostFrequentOriginalWordIndex;
/**
* Term frequency of the stem, i.e. the sum of all {@link AllWords#tf} values
* for which the {@link AllWords#stemIndex} points to this stem.
* <p>
* This array is produced by {@link LanguageModelStemmer}.
*/
public int [] tf;
/**
* Term frequency of the stem for each document. For the encoding of this array,
* see {@link AllWords#tfByDocument}.
* <p>
* This array is produced by {@link LanguageModelStemmer}.
*/
public int [][] tfByDocument;
/**
* A bit-packed indices of all fields in which this word appears at least once.
* Indexes (positions) of selected bits are pointers to the
* {@link AllFields} arrays. Fast conversion between the bit-packed representation
* and <code>byte[]</code> with index values is done by {@link #toFieldIndexes(byte)}
* <p>
* This array is produced by {@link LanguageModelStemmer}
*/
public byte [] fieldIndices;
}
/**
* Information about all unique stems found in the input
* {@link PreprocessingContext#documents}.
*/
public final AllStems allStems = new AllStems();
/**
* Information about all frequently appearing sequences of words found in the input
* {@link PreprocessingContext#documents}. Each entry in each array corresponds to one
* sequence.
* <p>
* All arrays in this class have the same length and values across different arrays
* correspond to each other for the same index.
*/
public static class AllPhrases
{
/**
* Pointers to {@link AllWords} for each word in the phrase sequence.
* <p>
* This array is produced by {@link PhraseExtractor}.
*/
public int [][] wordIndices;
/**
* Term frequency of the word sequence.
* <p>
* This array is produced by {@link PhraseExtractor}.
*/
public int [] tf;
/**
* Term frequency of the word sequence for each document. For the encoding of this
* array, see {@link AllWords#tfByDocument}.
* <p>
* This array is produced by {@link PhraseExtractor}.
*/
public int [][] tfByDocument;
}
/**
* Information about all frequently appearing sequences of words found in the input
* {@link PreprocessingContext#documents}.
*/
public AllPhrases allPhrases = new AllPhrases();
/**
* Information about words and phrases that might be good cluster label candidates.
* Each entry in each array corresponds to one label candidate.
* <p>
* All arrays in this class have the same length and values across different arrays
* correspond to each other for the same index.
*/
public static class AllLabels
{
/**
* Feature index of the label candidate. Features whose values are less than the
* size of {@link AllWords} arrays are single word features and point to entries
* in {@link AllWords}. Features whose values are larger or equal to the size of
* {@link AllWords}, after subtracting the size of {@link AllWords}, point to
* {@link AllPhrases}.
* <p>
* This array is produced by {@link LabelFilterProcessor}.
*/
public int [] featureIndex;
/**
* Indices of documents assigned to the label candidate.
* <p>
* This array is produced by {@link DocumentAssigner}.
*/
public BitSet [] documentIndices;
/**
* The first index in {@link #featureIndex} which
* points to {@link AllPhrases}, or -1 if there are no phrases
* in {@link #featureIndex}.
* <p>
* This value is set by {@link LabelFilterProcessor}.
*
* @see #featureIndex
*/
public int firstPhraseIndex;
}
/**
* Information about words and phrases that might be good cluster label candidates.
*/
public final AllLabels allLabels = new AllLabels();
/**
* Returns <code>true</code> if this context contains any words.
*/
public boolean hasWords()
{
return allWords.image.length > 0;
}
/**
* Returns <code>true</code> if this context contains any label candidates.
*/
public boolean hasLabels()
{
return allLabels.featureIndex != null && allLabels.featureIndex.length > 0;
}
/**
* Static conversion between selected bits and an array of indexes of these bits.
*/
private final static int [][] bitsCache;
static
{
bitsCache = new int [0x100][];
for (int i = 0; i < 0x100; i++)
{
bitsCache[i] = new int [Integer.bitCount(i & 0xFF)];
for (int v = 0, bit = 0, j = i & 0xff; j != 0; j >>>= 1, bit++)
{
if ((j & 0x1) != 0)
bitsCache[i][v++] = bit;
}
}
}
/**
* Convert the selected bits in a byte to an array of indexes.
*/
public int [] toFieldIndexes(byte b)
{
return bitsCache[b & 0xff];
}
/*
* These should really be package-private, shouldn't they? We'd need to move classes under pipeline.
* here for accessibility.
*/
/**
* This method should be invoked after all preprocessing contributors have been executed
* to release temporary data structures.
*/
public void preprocessingFinished()
{
this.tokenCache = null;
}
/**
* Return a unique char buffer representing a given character sequence.
*/
public char [] intern(MutableCharArray chs)
{
if (tokenCache.contains(chs))
{
return tokenCache.lget().getBuffer();
}
else
{
final char [] tokenImage = new char [chs.length()];
System.arraycopy(chs.getBuffer(), chs.getStart(), tokenImage, 0, chs.length());
tokenCache.add(new MutableCharArray(tokenImage));
return tokenImage;
}
}
}
| [
"[email protected]"
]
| |
f90321bd1b7d2c2fd30af5b6306c394277313e62 | ba98a42b5016593f3cf3a0afe9d4a7d11ea0e79e | /app/src/main/java/com/example/notes/NoteEditorActivity.java | 2c684f46d35a06f1c500c2705d395ec73b10ff3f | []
| no_license | raghav-dubey-avid/Notes_App | 3997931d35788602e3095114aab9139c4faf4eef | b1cdad4d350a418ebf690756dac3573775cfb90a | refs/heads/master | 2020-04-21T07:27:21.714360 | 2019-02-06T11:07:28 | 2019-02-06T11:07:28 | 169,393,154 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,958 | java | package com.example.notes;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import java.util.HashSet;
public class NoteEditorActivity extends AppCompatActivity {
int noteId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_note_editor);
EditText editText = (EditText)findViewById(R.id.editText);
Intent intent = getIntent();
noteId = intent.getIntExtra("noteId",-1);
if(noteId != -1){
editText.setText(MainActivity.notes.get(noteId));
}
else{
MainActivity.notes.add("");
noteId = MainActivity.notes.size() -1;
MainActivity.arrayAdapter.notifyDataSetChanged();
}
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
MainActivity.notes.set(noteId,String.valueOf(s));
MainActivity.arrayAdapter.notifyDataSetChanged();
SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences("com.example.notes", Context.MODE_PRIVATE);
HashSet<String> set = new HashSet<String>(MainActivity.notes); //create a string from arraylist
sharedPreferences.edit().putStringSet("notes",set).apply(); //saved in sharedPreference
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
}
| [
"[email protected]"
]
| |
8e6ef16c357254561a045c691ae10a914eea15b3 | 06f3df494f1ec5b029e45231cda9a4c87b8b5c61 | /src/com/expye/compiler2016/AST/Stmt/Exp/StringExp.java | 4c1dc2193f42c85f04f09be724ddbaa1cec081c6 | []
| no_license | yzh119/MasterCompiler | 7fb31cd79c0f5abedb44d73732b1b0b54fa20a8f | 008544bb8e5bb5e2def443299f53584af815ddb8 | refs/heads/master | 2016-09-13T18:30:46.454389 | 2016-05-13T14:26:40 | 2016-05-13T14:26:40 | 58,522,173 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | package com.expye.compiler2016.AST.Stmt.Exp;
import com.expye.compiler2016.AST.Dec.ClassDec;
import com.expye.compiler2016.IR.YIR.Instruction;
import com.expye.compiler2016.IR.YIR.Memory.LoadAdress;
import com.expye.compiler2016.Label.GlobalVarLabel;
import com.expye.compiler2016.Register.Address;
import com.expye.compiler2016.Register.IRRegister;
import com.expye.compiler2016.Utility.StringLiteralIntern;
import java.util.List;
/**
* Created by expye(Zihao Ye) on 2016/3/30.
*/
public class StringExp extends Exp {
public String val;
public Address addr;
public StringExp(String val) {
this.val = val;
this.type = ClassDec.stringClass;
GlobalVarLabel label = StringLiteralIntern.find(val.intern());
this.addr = new Address(label);
this.reg = new IRRegister(addr);
}
@Override
public void emit(List<Instruction> lst) {
lst.add(
new LoadAdress((IRRegister) this.reg, this.addr)
);
}
}
| [
"[email protected]"
]
| |
0b7fc622cc8ba20410693c10a4dbd3ae900757ef | 1402f56fd5483971398d60698874d35ffb3ad15f | /a2q8.java | 0522f6800d15ee4fdbf52676fefab2c9471cc71a | []
| no_license | priti123-patil/Classes-in-Java- | 96fda84257532d0e140416adad50e4f4c7a7801a | be9b84606216cfc8dddfb2c58b0221713f65d735 | refs/heads/master | 2022-12-01T12:29:05.328889 | 2020-07-22T04:48:24 | 2020-07-22T04:48:24 | 281,570,952 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | import java.util.*;
class average{
int avg;
public void calculate(int l,int m,int n){
avg=(l+m+n)/3;
}
public void print()
{
System.out.println("Average="+avg);
}
}
class a2q8{
public static void main(String[] args){
int a;
int b;
int c;
Scanner s = new Scanner(System.in);
average x=new average();
System.out.println("Enter first number");
a = s.nextInt();
System.out.println("Enter second number");
b = s.nextInt();
System.out.println("Enter third number");
c=s.nextInt();
x.calculate(a,b,c);
x.print();
}
} | [
"[email protected]"
]
| |
1e8de364395e080be63501e6ed9a7d5527dea270 | eb916fd9e872e6bd13c39e0d79c5f79866797080 | /cougar-framework/jms-transport/src/main/java/com/betfair/cougar/transport/jms/EventNameDestinationResolver.java | f25cbd12afbe0c3da026774960b77d38a920cb3d | [
"Apache-2.0"
]
| permissive | betfair/cougar | c4cb227024402a19da217150b99f7d73d75d7cce | 08d1fe338fbd0e8572a9c2305bb5796402d5b1f5 | refs/heads/master | 2023-08-26T16:44:20.538347 | 2016-03-21T15:10:27 | 2016-03-21T15:10:27 | 13,865,967 | 21 | 12 | Apache-2.0 | 2022-10-03T22:39:04 | 2013-10-25T16:30:18 | Java | UTF-8 | Java | false | false | 1,488 | java | /*
* Copyright 2014, The Sporting Exchange Limited
*
* 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.betfair.cougar.transport.jms;
import com.betfair.cougar.core.api.events.Event;
import com.betfair.cougar.transport.api.protocol.events.jms.JMSDestinationResolver;
/**
* This simple destination resolver constructs a JMS destination name as a string
* from the destinationBase constructor argument and the event class name
* @see JMSDestinationResolver
*/
public class EventNameDestinationResolver implements JMSDestinationResolver<String> {
private String destinationBase;
public EventNameDestinationResolver(String destinationBase) {
this.destinationBase = destinationBase;
}
@Override
public String resolveDestination(Class<? extends Event> eventClass, Object[] args) {
if (eventClass != null) {
return destinationBase + "." + eventClass.getSimpleName();
}
return destinationBase;
}
}
| [
"[email protected]"
]
| |
3602e868d6ad62b187d8bfdb95c6752466e2f89c | 9b30922e5474f133c42d48bfc7e27da811dc7f78 | /Step6/src/exception/ClientManagerException.java | ced2bfe0c24eec0620d37fe9329edf5315fdcb61 | []
| no_license | ungsu12/rikiryouhyouka | 0f2d23ebb3fd590979cffb4fdd3150c599a9a6a9 | e18a90e13ff65559002126b683f19869dd54009e | refs/heads/master | 2021-01-23T00:39:52.137332 | 2017-05-30T12:30:37 | 2017-05-30T12:30:37 | 92,830,615 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 356 | java | package exception;
/**
* 서버 매니저에서 예외가 발생하여 클라이언트에 보낼 경우 사용하는 예외 클래스
*
*/
public class ClientManagerException extends ManagerException {
/**
* 생성자
*/
public ClientManagerException() {
System.out.println("[ERR] 서버에서 에러를 보냈습니다");
}
}
| [
"[email protected]"
]
| |
98ee5526c961319791d967b88b1cc6da264d3790 | 0ec2057b562e980a31957ee94b91c29ef4ae8b77 | /src/main/java/mk/ukim/finki/tires/enums/CheckoutStatus.java | 8cdc4202d5b86504b9227f52f5f55343c9d0f621 | []
| no_license | BokaK/Tires-Project | f4457a0604be9c1a477f8d5f0b7522447f236488 | bdc07e5072a2a0e2070e56f36c40ea782bbbe4e9 | refs/heads/master | 2021-01-23T14:59:41.246337 | 2017-08-17T15:23:18 | 2017-08-17T15:23:18 | 93,265,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package mk.ukim.finki.tires.enums;
/**
* Created by Simona on 7/9/2017.
*/
public enum CheckoutStatus {
ISSUED,
PAYED,
EXPIRED,
CANCELED
}
| [
"[email protected]"
]
| |
086096b9049d663b2297f0bf14327914e75dd4ff | a746cfdcd33171ad833c2d9327afc86ab19fd68b | /src/java/hao/model/User.java | 452cb6f73668686d093fc187f6a229afd8d5bd17 | []
| no_license | tmhao3110/Manage-Staffs-Website | a1cb2f3c540dc8abb56207cb88ca70282422e354 | f039c896f996a4137de4cfacc85752bc2efb9053 | refs/heads/master | 2023-02-14T16:35:14.968770 | 2021-01-08T04:29:55 | 2021-01-08T04:29:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | 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 hao.model;
import java.io.Serializable;
/**
*
* @author Minh Hao
*/
public class User implements Serializable{
String username, password, fullname, img;
public User() {
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFullname() {
return fullname;
}
public void setFullname(String fullname) {
this.fullname = fullname;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
}
| [
"[email protected]"
]
| |
ed6d5b164673286e8fe71a27e486ce650b206ebe | 20ef3b1d6bdd9956aeed32ce8bea63381c1caa47 | /POO-ECLIPSE/src/clase9_instruccion_switch/Menu.java | 55d965e163dfad8da292ce34731b50216b21ef33 | []
| no_license | profjgonzalez/POO-ECLIPSE | 59c9dda6df33da3f9774f8be94cd92b75fb1a7bb | 12e17632102d78157b5bac16e25a218d043d2458 | refs/heads/master | 2020-07-09T15:20:43.561007 | 2019-09-19T05:46:26 | 2019-09-19T05:46:26 | 204,008,835 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,609 | java | package clase9_instruccion_switch;
import java.util.Scanner;
public class Menu {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
String respuesta = "S";
do {
System.out.println("##########Menu########");
System.out.println("Teclea la operación segun requieras: ");
System.out.println("1. Suma de dos numeros");
System.out.println("2. Resta de dos numeros");
System.out.println("3. Division de dos numeros");
System.out.println("4. Multiplicacion de dos numeros");
int opcion = 0;
System.out.print("Selecciona una opción:");
opcion = entrada.nextInt();
int numero1 = 0;
int numero2 = 0;
double resultado = 0;
System.out.print("\nCaptura el primer numero: ");
numero1 = entrada.nextInt();
System.out.print("\nCaptura el segundo numero: ");
numero2 = entrada.nextInt();
switch(opcion) {
case 1:
resultado = numero1 + numero2;
break;
case 2:
resultado = numero1 - numero2;
break;
case 3:
resultado = numero1 / numero2;
break;
case 4:
resultado = numero1 * numero2;
break;
default:
System.out.println("No se ha definido una opcion para el numero que selecciono");
}
System.out.printf("El resultado es: %.2f%n", resultado);
System.out.println("############################################");
System.out.print("¿Quieres salir? - [S - Si, N - No]\n");
respuesta = entrada.next();
}while(!respuesta.equals("S"));
System.out.println("Termina la aplicación");
}
} | [
"[email protected]"
]
| |
80524f7ba45acc4a36892a19d91851aaba591a7b | eb656a811d139962eaf711d72a301b160d38c731 | /src/main/java/com/yeliz/messenger/resources/ProfileResource.java | 21d244ecf7cbec14d4f3708f5d081b1570164d1e | []
| no_license | yelizp/messenger | ae0ba8fa3c86a48d81db80d9662c74f0d34d557a | 2b5d9c331a887976114e2bdb41c736e189dfb501 | refs/heads/master | 2021-06-28T04:18:36.812575 | 2017-09-20T07:04:00 | 2017-09-20T07:04:00 | 104,092,333 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | package com.yeliz.messenger.resources;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.yeliz.messenger.model.*;
import com.yeliz.messenger.service.ProfileService;
@Path("/profiles")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class ProfileResource {
private ProfileService profileService = new ProfileService();
@GET
public List<Profile> getProfiles() {
return profileService.getAllProfiles();
}
@POST
public Profile addProfile(Profile profile) {
return profileService.addProfile(profile);
}
@GET
@Path("/{profileName}")
public Profile getProfile(@PathParam("profileName") String profileName) {
return profileService.getProfile(profileName);
}
@PUT
@Path("/{profileName}")
public Profile updateProfile(@PathParam("profileName") String profileName, Profile profile) {
profile.setProfileName(profileName);
return profileService.updateProfile(profile);
}
@DELETE
@Path("/{profileName}")
public Profile deleteProfile(@PathParam("profileName") String profileName) {
return profileService.removeMessage(profileName);
}
}
| [
"[email protected]"
]
| |
1b0cb997b8a16328fa9d94caaa6c5eb088339631 | b63d49dd45087307958dbd875baef0b11b7c227c | /oro/oro-svn/tags/oro-2.0.8/src/java/org/apache/oro/util/CacheFIFO2.java | f3cb5a704321515d534070349e2547fac432752f | [
"Apache-2.0",
"Apache-1.1",
"BSD-2-Clause"
]
| permissive | afs/jena-workspace | 5fad7409852a8de64c2f92ce408eb74a56776b3d | 21147336aa7694fa5d75d2ee0d733ddcb06773f2 | refs/heads/main | 2023-03-15T05:45:20.325177 | 2023-03-10T10:25:18 | 2023-03-10T10:25:18 | 38,121,320 | 0 | 0 | Apache-2.0 | 2022-06-20T17:34:12 | 2015-06-26T16:25:27 | Java | UTF-8 | Java | false | false | 5,877 | java | /*
* $Id: CacheFIFO2.java 54436 2003-11-07 20:16:26Z dfs $
*
* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation", "Jakarta-Oro"
* must not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [email protected].
*
* 5. Products derived from this software may not be called "Apache"
* or "Jakarta-Oro", nor may "Apache" or "Jakarta-Oro" appear in their
* name, without prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.oro.util;
import java.util.*;
/**
* This class is a GenericCache subclass implementing a second
* chance FIFO (First In First Out) cache replacement policy. In other
* words, values are added to the cache until the cache becomes full.
* Once the cache is full, when a new value is added to the cache, it
* replaces the first of the current values in the cache to have been
* added, unless that value has been used recently (generally
* between the last cache replacement and now).
* If the value to be replaced has been used, it is given
* a second chance, and the next value in the cache is tested for
* replacement in the same manner. If all the values are given a
* second chance, then the original pattern selected for replacement is
* replaced.
*
* @version @version@
* @since 1.0
* @see GenericCache
*/
public final class CacheFIFO2 extends GenericCache {
private int __current = 0;
private boolean[] __tryAgain;
/**
* Creates a CacheFIFO2 instance with a given cache capacity.
* <p>
* @param capacity The capacity of the cache.
*/
public CacheFIFO2(int capacity) {
super(capacity);
__tryAgain = new boolean[_cache.length];
}
/**
* Same as:
* <blockquote><pre>
* CacheFIFO2(GenericCache.DEFAULT_CAPACITY);
* </pre></blockquote>
*/
public CacheFIFO2(){
this(GenericCache.DEFAULT_CAPACITY);
}
public synchronized Object getElement(Object key) {
Object obj;
obj = _table.get(key);
if(obj != null) {
GenericCacheEntry entry;
entry = (GenericCacheEntry)obj;
__tryAgain[entry._index] = true;
return entry._value;
}
return null;
}
/**
* Adds a value to the cache. If the cache is full, when a new value
* is added to the cache, it replaces the first of the current values
* in the cache to have been added (i.e., FIFO2).
* <p>
* @param key The key referencing the value added to the cache.
* @param value The value to add to the cache.
*/
public final synchronized void addElement(Object key, Object value) {
int index;
Object obj;
obj = _table.get(key);
if(obj != null) {
GenericCacheEntry entry;
// Just replace the value. Technically this upsets the FIFO2 ordering,
// but it's expedient.
entry = (GenericCacheEntry)obj;
entry._value = value;
entry._key = key;
// Set the try again value to compensate.
__tryAgain[entry._index] = true;
return;
}
// If we haven't filled the cache yet, put it at the end.
if(!isFull()) {
index = _numEntries;
++_numEntries;
} else {
// Otherwise, find the next slot that doesn't have a second chance.
index = __current;
while(__tryAgain[index]) {
__tryAgain[index] = false;
if(++index >= __tryAgain.length)
index = 0;
}
__current = index + 1;
if(__current >= _cache.length)
__current = 0;
_table.remove(_cache[index]._key);
}
_cache[index]._value = value;
_cache[index]._key = key;
_table.put(key, _cache[index]);
}
}
| [
"[email protected]"
]
| |
cb76037354a8e962c9a5288176a1a651a7d80124 | 2cf9cbafdfd5df582a9a46dcf85e5162901ef337 | /yatl-kmf/src/test/java/ocl/syntax/repository/SyntaxJTreeVisitor.java | 7a56e1d6d9cd064f1215996c1d8a8e4b54156f6a | [
"Apache-2.0"
]
| permissive | opatrascoiu/jmf | 918303cf7ff6a5428157ea5deedc863386f457fb | be597da51fa5964f07ee74213640894af8fff535 | refs/heads/master | 2022-02-28T08:57:39.220759 | 2019-10-17T08:48:14 | 2019-10-17T08:48:14 | 110,419,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 263 | java | /**
*
* Class SyntaxJTreeVisitor.java
*
* Generated by KMFStudio at 17 February 2004 14:38:45
* Visit http://www.cs.ukc.ac.uk/kmf
*
*/
package ocl.syntax.repository;
import ocl.syntax.*;
public interface SyntaxJTreeVisitor
extends SyntaxVisitor
{
}
| [
"[email protected]"
]
| |
49d4c7190b5f5324074b9e6b34954b626017c0ac | 268719952215d7064d144599990d8013292c7418 | /data/k9mail_src/k9mail/src/main/java/com/fsck/k9/helper/FileHelper.java | 507033519d5a003157d1c833c9d7acdd192dbe2f | [
"MIT"
]
| permissive | bergel/UMLDependencies | 947751fb391add1123d2debd558bf9fe097e0bbf | 898cc15a6450cf79c795b362f5d32dece96e3733 | refs/heads/master | 2020-03-23T10:16:51.529310 | 2019-03-28T13:18:53 | 2019-03-28T13:18:53 | 141,434,823 | 1 | 1 | MIT | 2018-09-09T13:17:06 | 2018-07-18T12:56:15 | Smalltalk | UTF-8 | Java | false | false | 7,130 | java | package com.fsck.k9.helper;
import org.apache.commons.io.IOUtils;
import timber.log.Timber;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Locale;
public class FileHelper {
/**
* Regular expression that represents characters we won't allow in file names.
*
* <p>
* Allowed are:
* <ul>
* <li>word characters (letters, digits, and underscores): {@code \w}</li>
* <li>spaces: {@code " "}</li>
* <li>special characters: {@code !}, {@code #}, {@code $}, {@code %}, {@code &}, {@code '},
* {@code (}, {@code )}, {@code -}, {@code @}, {@code ^}, {@code `}, <code>{</code>,
* <code>}</code>, {@code ~}, {@code .}, {@code ,}</li>
* </ul></p>
*
* @see #sanitizeFilename(String)
*/
private static final String INVALID_CHARACTERS = "[^\\w !#$%&'()\\-@\\^`{}~.,]";
/**
* Invalid characters in a file name are replaced by this character.
*
* @see #sanitizeFilename(String)
*/
private static final String REPLACEMENT_CHARACTER = "_";
/**
* Creates a unique file in the given directory by appending a hyphen
* and a number to the given filename.
*/
public static File createUniqueFile(File directory, String filename) {
File file = new File(directory, filename);
if (!file.exists()) {
return file;
}
// Get the extension of the file, if any.
int index = filename.lastIndexOf('.');
String name;
String extension;
if (index != -1) {
name = filename.substring(0, index);
extension = filename.substring(index);
} else {
name = filename;
extension = "";
}
for (int i = 2; i < Integer.MAX_VALUE; i++) {
file = new File(directory, String.format(Locale.US, "%s-%d%s", name, i, extension));
if (!file.exists()) {
return file;
}
}
return null;
}
public static void touchFile(final File parentDir, final String name) {
final File file = new File(parentDir, name);
try {
if (!file.exists()) {
if (!file.createNewFile()) {
Timber.d("Unable to create file: %s", file.getAbsolutePath());
}
} else {
if (!file.setLastModified(System.currentTimeMillis())) {
Timber.d("Unable to change last modification date: %s", file.getAbsolutePath());
}
}
} catch (Exception e) {
Timber.d(e, "Unable to touch file: %s", file.getAbsolutePath());
}
}
private static void copyFile(File from, File to) throws IOException {
FileInputStream in = new FileInputStream(from);
FileOutputStream out = new FileOutputStream(to);
try {
byte[] buffer = new byte[1024];
int count;
while ((count = in.read(buffer)) > 0) {
out.write(buffer, 0, count);
}
out.close();
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
}
}
public static void renameOrMoveByCopying(File from, File to) throws IOException {
deleteFileIfExists(to);
boolean renameFailed = !from.renameTo(to);
if (renameFailed) {
copyFile(from, to);
boolean deleteFromFailed = !from.delete();
if (deleteFromFailed) {
Timber.e("Unable to delete source file after copying to destination!");
}
}
}
private static void deleteFileIfExists(File to) throws IOException {
boolean fileDoesNotExist = !to.exists();
if (fileDoesNotExist) {
return;
}
boolean deleteOk = to.delete();
if (deleteOk) {
return;
}
throw new IOException("Unable to delete file: " + to.getAbsolutePath());
}
public static boolean move(final File from, final File to) {
if (to.exists()) {
if (!to.delete()) {
Timber.d("Unable to delete file: %s", to.getAbsolutePath());
}
}
if (!to.getParentFile().mkdirs()) {
Timber.d("Unable to make directories: %s", to.getParentFile().getAbsolutePath());
}
try {
copyFile(from, to);
boolean deleteFromFailed = !from.delete();
if (deleteFromFailed) {
Timber.e("Unable to delete source file after copying to destination!");
}
return true;
} catch (Exception e) {
Timber.w(e, "cannot move %s to %s", from.getAbsolutePath(), to.getAbsolutePath());
return false;
}
}
public static void moveRecursive(final File fromDir, final File toDir) {
if (!fromDir.exists()) {
return;
}
if (!fromDir.isDirectory()) {
if (toDir.exists()) {
if (!toDir.delete()) {
Timber.w("cannot delete already existing file/directory %s", toDir.getAbsolutePath());
}
}
if (!fromDir.renameTo(toDir)) {
Timber.w("cannot rename %s to %s - moving instead", fromDir.getAbsolutePath(), toDir.getAbsolutePath());
move(fromDir, toDir);
}
return;
}
if (!toDir.exists() || !toDir.isDirectory()) {
if (toDir.exists()) {
if (!toDir.delete()) {
Timber.d("Unable to delete file: %s", toDir.getAbsolutePath());
}
}
if (!toDir.mkdirs()) {
Timber.w("cannot create directory %s", toDir.getAbsolutePath());
}
}
File[] files = fromDir.listFiles();
for (File file : files) {
if (file.isDirectory()) {
moveRecursive(file, new File(toDir, file.getName()));
if (!file.delete()) {
Timber.d("Unable to delete file: %s", toDir.getAbsolutePath());
}
} else {
File target = new File(toDir, file.getName());
if (!file.renameTo(target)) {
Timber.w("cannot rename %s to %s - moving instead",
file.getAbsolutePath(), target.getAbsolutePath());
move(file, target);
}
}
}
if (!fromDir.delete()) {
Timber.w("cannot delete %s", fromDir.getAbsolutePath());
}
}
/**
* Replace characters we don't allow in file names with a replacement character.
*
* @param filename
* The original file name.
*
* @return The sanitized file name containing only allowed characters.
*/
public static String sanitizeFilename(String filename) {
return filename.replaceAll(INVALID_CHARACTERS, REPLACEMENT_CHARACTER);
}
} | [
"[email protected]"
]
| |
d709f50180a57eac57079c6e019956cb47bdd635 | ef935ce34ee9a168c966c60f72066eb103754768 | /Customer/src/au/com/blogspot/ojitha/client/GreetingServiceAsync.java | 28c16159bf18551335b6f5140c925910d9baa706 | []
| no_license | ojitha/GWTCustomer | 56995588dee6f95040fd1d9a8c884f7fa58a1f7e | 9323c3ebce2452e1c137835135d21d2837c82cf0 | refs/heads/master | 2021-01-10T19:53:56.479040 | 2013-08-07T12:17:37 | 2013-08-07T12:17:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package au.com.blogspot.ojitha.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The async counterpart of <code>GreetingService</code>.
*/
public interface GreetingServiceAsync {
void greetServer(String input, AsyncCallback<String> callback)
throws IllegalArgumentException;
}
| [
"[email protected]"
]
| |
45456ba1e346f9cd10aeb8a0ce051bc789b62f6c | 3bf9cd0b46ba5e0ada693eff0ad39526fc4ae20e | /org/springframework/aop/Pointcut.java | 035c207b82ad4046c4446046b898a7d99abeb62c | []
| no_license | zbtmaker/spring2.0.x-src | c6be55286a74f569aa455171e8fa49858a4a095b | fe2a9cbae6a0ea3e108a0dddaccf6ce63a59dd15 | refs/heads/master | 2021-07-11T13:19:59.102587 | 2019-09-28T16:10:37 | 2019-09-28T16:10:37 | 211,526,299 | 1 | 2 | null | 2020-10-13T16:22:15 | 2019-09-28T16:05:10 | Java | UTF-8 | Java | false | false | 1,477 | java | /*
* Copyright 2002-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop;
/**
* Core Spring pointcut abstraction.
* A pointcut is composed of a ClassFilter and a MethodMatcher. Both these
* basic terms and a Pointcut itself can be combined to build up combinations.
*
* @author Rod Johnson
* @see ClassFilter
* @see MethodMatcher
* @see org.springframework.aop.support.ClassFilters
* @see org.springframework.aop.support.MethodMatchers
* @see org.springframework.aop.support.ComposablePointcut
*/
public interface Pointcut {
/**
* Return the ClassFilter for this pointcut.
*/
ClassFilter getClassFilter();
/**
* Return the MethodMatcher for this pointcut.
*/
MethodMatcher getMethodMatcher();
// could add getFieldMatcher() without breaking most existing code
/**
* Canonical Pointcut instance that always matches.
*/
Pointcut TRUE = TruePointcut.INSTANCE;
}
| [
"[email protected]"
]
| |
dfeb753f7ec545975cdedc4be9163b7b32d7d181 | 43e9e5f89ba388cd84cecf87a4a0be722b0d3bbc | /BioStdCoreModel/src/main/java/uk/ac/ebi/biostd/out/pageml/PageMLFormatter.java | 1b827631e75a854313485209c4a5fe91b435534a | []
| no_license | EBIBioStudies/BioStd-Backend | 994e1b98ee9e681c70f00c965f74d7235ae02150 | 3c36279df4e3d9474994a2c94e0479a28845d457 | refs/heads/master | 2021-10-26T21:30:30.630379 | 2021-09-28T14:30:28 | 2021-09-28T14:30:28 | 109,011,517 | 1 | 0 | null | 2021-09-28T14:43:00 | 2017-10-31T14:58:42 | Java | UTF-8 | Java | false | false | 22,563 | java | /**
* Copyright 2014-2017 Functional Genomics Development Team, European Bioinformatics Institute
*
* 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.
*
* @author Mikhail Gostev <[email protected]>
**/
package uk.ac.ebi.biostd.out.pageml;
import static uk.ac.ebi.biostd.in.pageml.PageMLAttributes.ACCESS;
import static uk.ac.ebi.biostd.in.pageml.PageMLAttributes.ACCNO;
import static uk.ac.ebi.biostd.in.pageml.PageMLAttributes.CLASS;
import static uk.ac.ebi.biostd.in.pageml.PageMLAttributes.ID;
import static uk.ac.ebi.biostd.in.pageml.PageMLAttributes.RELPATH;
import static uk.ac.ebi.biostd.in.pageml.PageMLAttributes.SIZE;
import static uk.ac.ebi.biostd.in.pageml.PageMLAttributes.TYPE;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.ATTRIBUTE;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.ATTRIBUTES;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.FILE;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.FILES;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.HEADER;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.LINK;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.LINKS;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.ROOT;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.SECTION;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.SUBMISSION;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.SUBMISSIONS;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.SUBSECTIONS;
import static uk.ac.ebi.biostd.in.pageml.PageMLElements.TABLE;
import static uk.ac.ebi.biostd.util.StringUtils.xmlEscaped;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import uk.ac.ebi.biostd.authz.AccessTag;
import uk.ac.ebi.biostd.in.PMDoc;
import uk.ac.ebi.biostd.in.pageml.PageMLAttributes;
import uk.ac.ebi.biostd.in.pageml.PageMLElements;
import uk.ac.ebi.biostd.in.pagetab.SubmissionInfo;
import uk.ac.ebi.biostd.model.AbstractAttribute;
import uk.ac.ebi.biostd.model.Annotated;
import uk.ac.ebi.biostd.model.FileRef;
import uk.ac.ebi.biostd.model.Link;
import uk.ac.ebi.biostd.model.Qualifier;
import uk.ac.ebi.biostd.model.Section;
import uk.ac.ebi.biostd.model.Submission;
import uk.ac.ebi.biostd.out.AbstractFormatter;
public class PageMLFormatter implements AbstractFormatter {
public final static String dateFotmat = "yyyy-MM-dd";
protected static final String shiftSym = " ";
protected String initShift = shiftSym + shiftSym;
private Appendable outStream;
private DateFormat dateFmt;
private boolean cutTech = false;
public PageMLFormatter() {
}
public PageMLFormatter(Appendable o, boolean cut) {
outStream = o;
cutTech = cut;
}
@Override
public void format(PMDoc document) throws IOException {
header(document.getHeaders(), outStream);
for (SubmissionInfo s : document.getSubmissions()) {
format(s.getSubmission(), outStream);
}
footer(outStream);
}
@Override
public void header(Map<String, List<String>> hdrs, Appendable out) throws IOException {
out.append("<").append(ROOT.getElementName()).append(">\n");
if (hdrs != null) {
for (Map.Entry<String, List<String>> me : hdrs.entrySet()) {
for (String val : me.getValue()) {
out.append(shiftSym).append("<").append(HEADER.getElementName()).append(">\n");
out.append(shiftSym).append(shiftSym).append("<").append(PageMLElements.NAME.getElementName())
.append(">");
xmlEscaped(me.getKey(), out);
out.append("</").append(PageMLElements.NAME.getElementName()).append(">\n");
out.append(shiftSym).append(shiftSym).append("<").append(PageMLElements.VALUE.getElementName())
.append(">");
xmlEscaped(val, out);
out.append("</").append(PageMLElements.VALUE.getElementName()).append(">\n");
out.append(shiftSym).append("</").append(HEADER.getElementName()).append(">\n");
}
}
}
out.append(shiftSym).append("<").append(SUBMISSIONS.getElementName()).append(">\n");
}
@Override
public void footer(Appendable out) throws IOException {
out.append(shiftSym).append("</").append(SUBMISSIONS.getElementName()).append(">\n");
out.append("</").append(ROOT.getElementName()).append(">\n");
}
@Override
public void separator(Appendable out) throws IOException {
}
@Override
public void comment(String comment, Appendable out) throws IOException {
out.append("<!-- ");
xmlEscaped(comment);
out.append(" -->\n");
}
@Override
public void format(Submission s, Appendable out) throws IOException {
formatSubmission(s, out, initShift);
}
protected void formatSubmission(Submission subm, Appendable out, String shift) throws IOException {
out.append(shift);
out.append('<').append(SUBMISSION.getElementName()).append(' ').append(ACCNO.getAttrName()).append("=\"");
xmlEscaped(subm.getAccNo(), out);
if (!cutTech) {
out.append("\" ").append(ID.getAttrName()).append("=\"").append(String.valueOf(subm.getId()));
}
String str = subm.getEntityClass();
if (str != null && str.length() > 0) {
out.append("\" ").append(CLASS.getAttrName()).append("=\"");
xmlEscaped(str, out);
}
str = subm.getRelPath();
if (str != null && str.length() > 0 && !cutTech) {
out.append("\" ").append(RELPATH.getAttrName()).append("=\"");
xmlEscaped(str, out);
}
if (subm.getOwner() != null || (subm.getAccessTags() != null && subm.getAccessTags().size() > 0)) {
out.append("\" ").append(ACCESS.getAttrName()).append("=\"");
boolean needSep = false;
if (!cutTech && subm.getOwner() != null) {
out.append('~');
String txtId = subm.getOwner().getEmail();
if (txtId == null) {
txtId = subm.getOwner().getLogin();
}
xmlEscaped(txtId, out);
out.append(";#");
out.append(String.valueOf(subm.getOwner().getId()));
needSep = true;
}
if (subm.getAccessTags() != null) {
for (AccessTag at : subm.getAccessTags()) {
if (needSep) {
out.append(';');
} else {
needSep = true;
}
xmlEscaped(at.getName(), out);
}
}
}
if (!cutTech) {
out.append("\" ").append(PageMLAttributes.CTIME.getAttrName()).append("=\"")
.append(String.valueOf(subm.getCTime()));
out.append("\" ").append(PageMLAttributes.MTIME.getAttrName()).append("=\"")
.append(String.valueOf(subm.getMTime()));
if (subm.isRTimeSet()) {
out.append("\" ").append(PageMLAttributes.RTIME.getAttrName()).append("=\"")
.append(String.valueOf(subm.getRTime()));
}
if (subm.getSecretKey() != null) {
out.append("\" ").append(PageMLAttributes.SECKEY.getAttrName()).append("=\"");
xmlEscaped(subm.getSecretKey(), out);
}
}
out.append("\">\n");
String contShift = shift + shiftSym;
Map<String, String> auxAttrMap = new HashMap<>();
if (subm.getTitle() != null) {
auxAttrMap.put(Submission.canonicTitleAttribute, subm.getTitle());
}
if (subm.isRTimeSet()) {
if (dateFmt == null) {
dateFmt = new SimpleDateFormat(dateFotmat);
}
auxAttrMap.put(Submission.canonicReleaseDateAttribute, dateFmt.format(new Date(subm.getRTime() * 1000)));
}
if (subm.getRootPath() != null && !cutTech) {
auxAttrMap.put(Submission.canonicRootPathAttribute, subm.getRootPath());
}
formatAttributes(subm, auxAttrMap, out, contShift);
out.append("\n");
if (subm.getRootSection() != null) {
formatSection(subm.getRootSection(), out, contShift);
}
out.append("\n");
out.append(shift);
out.append("</").append(SUBMISSION.getElementName()).append(">\n");
}
protected void formatSection(Section sec, Appendable out, String shift) throws IOException {
out.append(shift);
out.append('<').append(SECTION.getElementName());
if (!cutTech) {
out.append(' ').append(ID.getAttrName()).append("=\"").append(String.valueOf(sec.getId())).append("\"");
}
out.append(" ").append(TYPE.getAttrName()).append("=\"");
xmlEscaped(sec.getType(), out);
if (sec.getAccNo() != null) {
out.append("\" ").append(ACCNO.getAttrName()).append("=\"");
xmlEscaped(sec.getAccNo(), out);
}
String str = sec.getEntityClass();
if (str != null && str.length() > 0) {
out.append("\" ").append(CLASS.getAttrName()).append("=\"");
xmlEscaped(str, out);
}
if (sec.getAccessTags() != null && sec.getAccessTags().size() > 0) {
out.append("\" ").append(ACCESS.getAttrName()).append("=\"");
boolean first = true;
for (AccessTag at : sec.getAccessTags()) {
if (first) {
first = false;
} else {
out.append(',');
}
xmlEscaped(at.getName(), out);
}
}
out.append("\">\n\n");
String contShift = shift + shiftSym;
formatAttributes(sec, out, contShift);
if (sec.getFileRefs() != null && sec.getFileRefs().size() > 0) {
formatFileRefs(sec, out, contShift);
out.append("\n");
}
if (sec.getLinks() != null && sec.getLinks().size() > 0) {
formatLinks(sec, out, contShift);
out.append("\n");
}
if (sec.getSections() != null && sec.getSections().size() > 0) {
formatSubsections(sec.getSections(), out, contShift);
}
out.append("\n");
out.append(shift);
out.append("</").append(SECTION.getElementName()).append(">\n\n");
}
private void formatSubsections(List<Section> lst, Appendable out, String shift) throws IOException {
String contShift = shift + shiftSym;
out.append(shift);
out.append("<").append(SUBSECTIONS.getElementName()).append(">\n");
int lastTblIdx = -1;
boolean hasTable = false;
for (Section ssec : lst) {
if (ssec.getTableIndex() <= lastTblIdx && hasTable) {
contShift = shift + shiftSym;
out.append(contShift);
out.append("</").append(TABLE.getElementName()).append(">\n");
hasTable = false;
}
if (ssec.getTableIndex() >= 0) {
if (!hasTable) {
out.append(contShift);
out.append("<").append(TABLE.getElementName()).append(">\n");
contShift = contShift + shiftSym;
hasTable = true;
}
}
lastTblIdx = ssec.getTableIndex();
formatSection(ssec, out, contShift);
}
if (hasTable) {
out.append(shift + shiftSym);
out.append("</").append(TABLE.getElementName()).append(">\n");
}
out.append(shift);
out.append("</").append(SUBSECTIONS.getElementName()).append(">\n");
}
private void formatLinks(Section s, Appendable out, String shift) throws IOException {
out.append(shift);
out.append("<").append(LINKS.getElementName()).append(">\n");
String contShift = shift + shiftSym;
int lastTblIdx = -1;
boolean hasTable = false;
for (Link ln : s.getLinks()) {
if (ln.getTableIndex() <= lastTblIdx && hasTable) {
contShift = shift + shiftSym;
out.append(contShift);
out.append("</").append(TABLE.getElementName()).append(">\n");
hasTable = false;
}
if (ln.getTableIndex() >= 0) {
if (!hasTable) {
out.append(contShift);
out.append("<").append(TABLE.getElementName()).append(">\n");
contShift = contShift + shiftSym;
hasTable = true;
}
}
lastTblIdx = ln.getTableIndex();
out.append(contShift);
out.append('<').append(LINK.getElementName());
// out.append('<').append(LINK.getElementName()).append(' ').append(URL.getAttrName()).append("=\"");
// xmlEscaped(ln.getUrl(),out);
String str = ln.getEntityClass();
if (str != null && str.length() > 0) {
out.append(" ").append(CLASS.getAttrName()).append("=\"");
xmlEscaped(str, out);
out.append("\"");
}
if (ln.getAccessTags() != null && ln.getAccessTags().size() > 0) {
out.append(" ").append(ACCESS.getAttrName()).append("=\"");
boolean first = true;
for (AccessTag at : ln.getAccessTags()) {
if (first) {
first = false;
} else {
out.append(';');
}
xmlEscaped(at.getName(), out);
}
out.append("\"");
}
out.append(">\n");
out.append(contShift + shiftSym).append('<').append(PageMLElements.URL.getElementName()).append(">");
xmlEscaped(ln.getUrl(), out);
out.append("</").append(PageMLElements.URL.getElementName()).append(">\n");
formatAttributes(ln, out, contShift + shiftSym);
out.append(contShift);
out.append("</").append(LINK.getElementName()).append(">\n");
}
if (hasTable) {
out.append(shift + shiftSym);
out.append("</").append(TABLE.getElementName()).append(">\n");
}
out.append(shift);
out.append("</").append(LINKS.getElementName()).append(">\n");
}
private void formatFileRefs(Section s, Appendable out, String shift) throws IOException {
out.append(shift);
out.append("<").append(FILES.getElementName()).append(">\n");
String contShift = shift + shiftSym;
int lastTblIdx = -1;
boolean hasTable = false;
for (FileRef fr : s.getFileRefs()) {
if (fr.getTableIndex() <= lastTblIdx && hasTable) {
contShift = shift + shiftSym;
out.append(contShift);
out.append("</").append(TABLE.getElementName()).append(">\n");
hasTable = false;
}
if (fr.getTableIndex() >= 0) {
if (!hasTable) {
out.append(contShift);
out.append("<").append(TABLE.getElementName()).append(">\n");
contShift = contShift + shiftSym;
hasTable = true;
}
}
lastTblIdx = fr.getTableIndex();
out.append(contShift);
out.append('<').append(FILE.getElementName());
out.append(' ').append(SIZE.getAttrName()).append("=\"").append(String.valueOf(fr.getSize()))
.append("\" type=\"");
if (fr.isDirectory()) {
out.append("directory");
} else {
out.append("file");
}
out.append("\"");
String str = fr.getEntityClass();
if (str != null && str.length() > 0) {
out.append(" ").append(CLASS.getAttrName()).append("=\"");
xmlEscaped(str, out);
out.append("\"");
}
if (fr.getAccessTags() != null && fr.getAccessTags().size() > 0) {
out.append(" ").append(ACCESS.getAttrName()).append("=\"");
boolean first = true;
for (AccessTag at : fr.getAccessTags()) {
if (first) {
first = false;
} else {
out.append(';');
}
xmlEscaped(at.getName(), out);
}
out.append("\"");
}
out.append(">\n");
out.append(contShift + shiftSym).append('<').append(PageMLElements.PATH.getElementName()).append(">");
if (fr.getPath() != null) {
xmlEscaped(fr.getPath(), out);
} else {
xmlEscaped(fr.getName(), out);
}
out.append("</").append(PageMLElements.PATH.getElementName()).append(">\n");
formatAttributes(fr, out, contShift + shiftSym);
out.append(contShift);
out.append("</").append(FILE.getElementName()).append(">\n");
}
if (hasTable) {
out.append(shift + shiftSym);
out.append("</").append(TABLE.getElementName()).append(">\n");
}
out.append(shift);
out.append("</").append(FILES.getElementName()).append(">\n");
}
protected void formatAttributes(Annotated ent, Appendable out, String shift) throws IOException {
formatAttributes(ent, null, out, shift);
}
protected void formatAttributes(Annotated ent, Map<String, String> aux, Appendable out, String shift)
throws IOException {
out.append(shift);
out.append("<").append(ATTRIBUTES.getElementName());
String atShift = shift + shiftSym;
List<? extends AbstractAttribute> attrs = ent.getAttributes();
if ((attrs == null || attrs.size() == 0) && (aux == null || aux.size() == 0)) {
out.append("/>\n");
return;
}
out.append(">\n");
if (aux != null) {
for (Map.Entry<String, String> me : aux.entrySet()) {
out.append(atShift);
out.append('<').append(ATTRIBUTE.getElementName()).append(">\n");
String vshift = atShift + shiftSym;
out.append(vshift).append('<').append(PageMLElements.NAME.getElementName()).append('>');
xmlEscaped(me.getKey(), out);
out.append("</").append(PageMLElements.NAME.getElementName()).append(">\n");
out.append(vshift).append('<').append(PageMLElements.VALUE.getElementName()).append('>');
xmlEscaped(me.getValue(), out);
out.append("</").append(PageMLElements.VALUE.getElementName()).append(">\n");
out.append(atShift);
out.append("</").append(ATTRIBUTE.getElementName()).append(">\n");
}
}
for (AbstractAttribute at : attrs) {
out.append(atShift);
out.append('<').append(ATTRIBUTE.getElementName());
if (at.isReference()) {
out.append(" reference=\"true\"");
}
String str = at.getEntityClass();
if (str != null && str.length() > 0) {
out.append(" ").append(CLASS.getAttrName()).append("=\"");
xmlEscaped(str, out);
out.append("\"");
}
out.append(">\n");
String vshift = atShift + shiftSym;
out.append(vshift).append('<').append(PageMLElements.NAME.getElementName()).append('>');
xmlEscaped(at.getName(), out);
out.append("</").append(PageMLElements.NAME.getElementName()).append(">\n");
List<Qualifier> qlist = at.getNameQualifiers();
if (qlist != null && qlist.size() > 0) {
for (Qualifier q : qlist) {
formatQualifier(q, PageMLElements.NMQUALIFIER.getElementName(), out, vshift);
}
}
out.append(vshift).append('<').append(PageMLElements.VALUE.getElementName()).append('>');
xmlEscaped(at.getValue(), out);
out.append("</").append(PageMLElements.VALUE.getElementName()).append(">\n");
qlist = at.getValueQualifiers();
if (qlist != null && qlist.size() > 0) {
for (Qualifier q : qlist) {
formatQualifier(q, PageMLElements.VALQUALIFIER.getElementName(), out, vshift);
}
}
out.append(atShift);
out.append("</").append(ATTRIBUTE.getElementName()).append(">\n");
}
out.append(shift);
out.append("</").append(ATTRIBUTES.getElementName()).append(">\n");
}
private void formatQualifier(Qualifier q, String xmltag, Appendable out, String shift) throws IOException {
out.append(shift).append('<').append(xmltag).append(">\n");
String vshift = shift + shiftSym;
out.append(vshift).append('<').append(PageMLElements.NAME.getElementName()).append('>');
xmlEscaped(q.getName(), out);
out.append("</").append(PageMLElements.NAME.getElementName()).append(">\n");
out.append(vshift).append('<').append(PageMLElements.VALUE.getElementName()).append('>');
xmlEscaped(q.getValue(), out);
out.append("</").append(PageMLElements.VALUE.getElementName()).append(">\n");
out.append(shift).append("</").append(xmltag).append(">\n");
}
}
| [
"[email protected]"
]
| |
d69f15f59e8afb3e6e53090eb59314b0f710bdc3 | 7d03b4a1ff95561bdd1fa91710c386a3f509fb65 | /Test_03/app/src/main/java/Fragment/FragmentNotice.java | a94586ec9fe56432e92e40cb723a0f743ab05950 | []
| no_license | gomgar3910/Engineering_School | 36aa8f4d92395ef26f257f4e4d865a5d10f9b272 | b21344d652eae8b9d5503d356e078e6e58276f8f | refs/heads/master | 2022-11-25T12:01:45.418499 | 2020-07-24T07:59:15 | 2020-07-24T07:59:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import fcmexample.dowellcomputer.test_03.R;
public class FragmentNotice extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_notice, container, false);
}
}
| [
"[email protected]"
]
| |
5f9eac7b26536d7d8098f2343e322c481221e600 | 4585e7ea8e91fe61d60ab121126d74fdd91f3812 | /Tareas/cdtareastw/cdtareastw/29/HTMLTAGS/htmltagP/src/java/adm/servlet1.java | c80943243c4fe1f132e9db67d51b92e332818b6a | []
| no_license | AlejandroReyes1998/TecnoWeb | 5f450b8620aa6961ed0b85436b21c23db5f8c12a | ab842ede41f2dcc576dd0ae33f34603bc64e5caf | refs/heads/master | 2020-09-28T09:15:11.177081 | 2019-12-08T23:09:15 | 2019-12-08T23:09:15 | 226,744,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,299 | 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 adm;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class servlet1 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String text = request.getParameter("text");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>servlet1</title>");
out.println("<meta charset=\"UTF-8\">");
out.println("</head>");
out.println("<body>");
out.println("<p>" + text + "</p>");
out.println("<br/>");
out.println("<a href='index.html'>");
out.println("Regresar al inicio");
out.println("</a>");
out.println("</body>");
out.println("</html>");
}
}
| [
"[email protected]"
]
| |
b6e277bf4da28af3f89136a82e659200a2a4b5dd | 4d5c5c3ae29c2c8f7a85153fd3f40b1ab5906189 | /workspace/boardList/src/main/java/board/dao/NewBoardDAOImpl.java | bd87b5f0020df28344cdf7380ff5d7d163d5f237 | []
| no_license | LeeHyoun/pollytec | 50bb700ff971766faa9d3199a92478e988c4cd11 | 807ef91d0ad2cc5fa5875a335106fd961ba8b9be | refs/heads/master | 2020-04-05T22:58:45.105947 | 2015-04-03T08:54:25 | 2015-04-03T08:54:25 | 33,347,768 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,655 | java | package board.dao;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import board.dto.BoardDTO;
import board.dto.BoardPageDTO;
//DAO구현클래스는 @Repository가 붙는다.
@Repository
public class NewBoardDAOImpl implements NewBoardDAO{
@Autowired
private SqlSession sqlSession;
// BoardMapper.xml - namespace="kr.co.datastreams.mybatis.Board"
private static final String NS = "kr.co.datastreams.mybatis.Board."; //마지막 "." 뒤에는 id가 온다.
@Override
public List<BoardDTO> selectList(int pg) {
int start = pg * 5 - 5 + 1;
int end = pg * 5;
BoardPageDTO boardPageDTO = new BoardPageDTO();
boardPageDTO.setStart(start);
boardPageDTO.setEnd(end);
List<BoardDTO> selectList = sqlSession.selectList(NS + "selectList", boardPageDTO);
return selectList;
}
@Override
public int selectCount() {
int count = sqlSession.selectOne(NS + "selectCount"); //Mapper -> 쿼리 id="selectCount"
return count;
}
@Override
public void writeBoard(BoardDTO boardDTO) {
sqlSession.insert(NS + "writeBoard", boardDTO);
}
@Override
public void updateBoard(BoardDTO boardDTO) {
sqlSession.update(NS + "updateBoard", boardDTO);
}
@Override
public BoardDTO readBoard(int seq) {
BoardDTO bdto = sqlSession.selectOne(NS + "readBoard", seq);
return bdto;
}
@Override
public void deleteBoard(int seq) {
sqlSession.delete(NS + "deleteBoard", seq);
}
public void updateBoardCount(int seq) {
sqlSession.update(NS + "updateBoardCount", seq);
}
}
| [
"[email protected]"
]
| |
66fd1525cc56098cb2240e7a2f6d92702f620bc1 | 7d6e81fa565dc7b719b4a166895641aea3277a0b | /11022017RobolectricSample/app/src/main/java/com/example/aptivist_u002/a11022017robolectricsample/MainActivity.java | 6f1f2f40f05ae2e967b8b9facc3f9e7b376969ba | []
| no_license | Sonredi/android_training | 74ad4ee5744e9536e59b5b9edb4a9ad9a2c75cb4 | 686ef42aa8b1c0b3224d2449d6bd5d765209b70e | refs/heads/master | 2021-08-20T09:53:53.864102 | 2017-11-28T19:33:56 | 2017-11-28T19:33:56 | 109,873,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,046 | java | package com.example.aptivist_u002.a11022017robolectricsample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.example.aptivist_u002.a11022017robolectricsample.data.MathModel;
public class MainActivity extends AppCompatActivity implements MainContract.View {
private Button button;
private TextView textView;
private ProgressBar progressBar;
private MainPresenter mainPresenter;
private MathModel mathModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.a_main_btn);
textView = findViewById(R.id.a_main_txt);
progressBar = findViewById(R.id.a_main_progress);
mathModel = new MathModel();
mainPresenter = new MainPresenter(mathModel);
button.setOnClickListener(v -> textView.setText("One Two Three"));
// button.setOnClickListener(v -> Toast.makeText(this, "new toast", Toast.LENGTH_SHORT).show());
}
@Override
protected void onStart() {
super.onStart();
mainPresenter.init(this);
}
@Override
protected void onStop() {
super.onStop();
mainPresenter.destroy();
}
@Override
protected void onResume() {
super.onResume();
button.setOnClickListener(v -> mainPresenter.doCalculation());
}
@Override
public void showError(String error) {
Toast.makeText(this, error, Toast.LENGTH_SHORT).show();
}
@Override
public void incrementCounter(int counter) {
textView.setText(String.valueOf(counter));
}
@Override
public void showProgress() {
progressBar.setVisibility(View.VISIBLE);
}
@Override
public void hideProgress() {
progressBar.setVisibility(View.INVISIBLE);
}
}
| [
"[email protected]"
]
| |
98421ea471cf8dc55a6ef7580842a8e6a9bd61c7 | 3a3215505c579b958b34f235f82baa9e483e8307 | /UltimateDrugs/me/dexuby/UltimateDrugs/handlers/StructureHandler.java | 3714da17cf10ba94f3e114bec7d25dfd678304e2 | []
| no_license | SPGX/UltimateDrugs | 7b77784f9285a1c4adba3e5e97eb4e8c3a7a1fc9 | 2046f60ea4b586c7175334ffadfd1afde95f19a9 | refs/heads/main | 2023-02-23T13:47:10.166464 | 2021-01-20T10:55:09 | 2021-01-20T10:55:09 | 331,278,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,114 | java | //
// Decompiled by Procyon v0.5.36
//
package me.dexuby.UltimateDrugs.handlers;
import me.dexuby.UltimateDrugs.utils.ItemBuilder;
import org.bukkit.event.block.SpongeAbsorbEvent;
import org.bukkit.event.block.MoistureChangeEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.block.CauldronLevelChangeEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockFertilizeEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import java.util.Iterator;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import me.dexuby.UltimateDrugs.structures.Structure;
import org.bukkit.block.Block;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.EventHandler;
import me.dexuby.UltimateDrugs.structures.StructureType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.entity.Entity;
import me.dexuby.UltimateDrugs.utils.EntityUtils;
import me.dexuby.UltimateDrugs.utils.MaterialUtils;
import java.util.Set;
import org.bukkit.Material;
import me.dexuby.UltimateDrugs.config.SettingsHolder;
import org.bukkit.event.player.PlayerItemHeldEvent;
import java.util.HashMap;
import me.dexuby.UltimateDrugs.structures.StructurePreviewRunnable;
import java.util.UUID;
import java.util.Map;
import me.dexuby.UltimateDrugs.Main;
import org.bukkit.inventory.ItemStack;
import org.bukkit.event.Listener;
public class StructureHandler implements Listener
{
private static final ItemStack TEST_ITEM;
private Main main;
private final Map<UUID, StructurePreviewRunnable> playersInPreview;
public StructureHandler(final Main main) {
this.playersInPreview = new HashMap<UUID, StructurePreviewRunnable>();
this.main = main;
}
@EventHandler
public void onPlayerItemHeld(final PlayerItemHeldEvent playerItemHeldEvent) {
if (!this.main.getServer().getPluginManager().isPluginEnabled("ProtocolLib") || !(boolean)SettingsHolder.STRUCTURE_PREVIEW.getValue()) {
return;
}
final Player player = playerItemHeldEvent.getPlayer();
if (!this.isInPreview(player)) {
final ItemStack item = player.getInventory().getItem(playerItemHeldEvent.getNewSlot());
if (item != null && item.getType() != Material.AIR) {
final StructureType structureTypeByItemStack = this.main.getStructureManager().getStructureTypeByItemStack(item);
if (structureTypeByItemStack != null && !MaterialUtils.isAir(player.getTargetBlock((Set)null, 5).getType())) {
final StructurePreviewRunnable structurePreviewRunnable = new StructurePreviewRunnable(player, EntityUtils.getDirection((Entity)player), structureTypeByItemStack);
structurePreviewRunnable.runTaskTimer((Plugin)this.main, 0L, (long)SettingsHolder.STRUCTURE_PREVIEW_UPDATE_DELAY.getValue());
this.playersInPreview.put(player.getUniqueId(), structurePreviewRunnable);
}
}
}
else {
this.playersInPreview.get(player.getUniqueId()).cancelSafely();
this.playersInPreview.remove(player.getUniqueId());
}
}
private boolean isInPreview(final Player player) {
if (this.playersInPreview.containsKey(player.getUniqueId())) {
if (!this.playersInPreview.get(player.getUniqueId()).isCancelled()) {
return true;
}
this.playersInPreview.remove(player.getUniqueId());
}
return false;
}
@EventHandler
public void onPlayerInteract(final PlayerInteractEvent playerInteractEvent) {
if (playerInteractEvent.getAction() == Action.RIGHT_CLICK_BLOCK) {
final Block clickedBlock = playerInteractEvent.getClickedBlock();
if (clickedBlock == null || !clickedBlock.hasMetadata("ultimatedrugs.structure-block")) {
return;
}
final Structure structureByBlock = this.main.getStructureManager().getStructureByBlock(clickedBlock);
if (structureByBlock != null && structureByBlock.getInventory() != null) {
playerInteractEvent.getPlayer().openInventory(structureByBlock.getInventory());
}
}
}
@EventHandler
public void onInventoryClick(final InventoryClickEvent inventoryClickEvent) {
if (this.main.getStructureManager().getStructureByInventory(inventoryClickEvent.getView().getTopInventory()) != null) {
inventoryClickEvent.setCancelled(true);
}
}
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(final BlockBreakEvent blockBreakEvent) {
final Block block = blockBreakEvent.getBlock();
if (block.hasMetadata("ultimatedrugs.structure-block")) {
final Structure structureByBlock = this.main.getStructureManager().getStructureByBlock(block);
if (structureByBlock != null) {
this.main.getStructureManager().removeStructure(structureByBlock);
}
}
}
@EventHandler
public void onBlockFromTo(final BlockFromToEvent blockFromToEvent) {
if (blockFromToEvent.getToBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockFromToEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockExplode(final BlockExplodeEvent blockExplodeEvent) {
if (blockExplodeEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockExplodeEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockPistonExtend(final BlockPistonExtendEvent blockPistonExtendEvent) {
if (blockPistonExtendEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockPistonExtendEvent.setCancelled(true);
}
final Iterator<Block> iterator = blockPistonExtendEvent.getBlocks().iterator();
while (iterator.hasNext()) {
if (iterator.next().hasMetadata("ultimatedrugs.structure-block")) {
blockPistonExtendEvent.setCancelled(true);
}
}
}
@EventHandler
public void onBlockPistonRetract(final BlockPistonRetractEvent blockPistonRetractEvent) {
if (blockPistonRetractEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockPistonRetractEvent.setCancelled(true);
}
final Iterator<Block> iterator = blockPistonRetractEvent.getBlocks().iterator();
while (iterator.hasNext()) {
if (iterator.next().hasMetadata("ultimatedrugs.structure-block")) {
blockPistonRetractEvent.setCancelled(true);
}
}
}
@EventHandler
public void onStructureGrow(final StructureGrowEvent structureGrowEvent) {
if (structureGrowEvent.getLocation().getBlock().hasMetadata("ultimatedrugs.structure-block")) {
structureGrowEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockBurn(final BlockBurnEvent blockBurnEvent) {
if (blockBurnEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockBurnEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockFade(final BlockFadeEvent blockFadeEvent) {
if (blockFadeEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockFadeEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockFertilize(final BlockFertilizeEvent blockFertilizeEvent) {
if (blockFertilizeEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockFertilizeEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockGrow(final BlockGrowEvent blockGrowEvent) {
if (blockGrowEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockGrowEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockSpread(final BlockSpreadEvent blockSpreadEvent) {
if (blockSpreadEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockSpreadEvent.setCancelled(true);
}
}
@EventHandler
public void onBlockIgnite(final BlockIgniteEvent blockIgniteEvent) {
if (blockIgniteEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
blockIgniteEvent.setCancelled(true);
}
}
@EventHandler
public void onCauldronLevelChange(final CauldronLevelChangeEvent cauldronLevelChangeEvent) {
if (cauldronLevelChangeEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
cauldronLevelChangeEvent.setCancelled(true);
}
}
@EventHandler
public void onLeavesDecay(final LeavesDecayEvent leavesDecayEvent) {
if (leavesDecayEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
leavesDecayEvent.setCancelled(true);
}
}
@EventHandler
public void onMoistureChange(final MoistureChangeEvent moistureChangeEvent) {
if (moistureChangeEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
moistureChangeEvent.setCancelled(true);
}
}
@EventHandler
public void onSpongeAbsorb(final SpongeAbsorbEvent spongeAbsorbEvent) {
if (spongeAbsorbEvent.getBlock().hasMetadata("ultimatedrugs.structure-block")) {
spongeAbsorbEvent.setCancelled(true);
}
}
static {
TEST_ITEM = new ItemBuilder(Material.STICK).build();
}
}
| [
"[email protected]"
]
| |
74cdf4484fe10cb978b9266c5803593663eba9b1 | 8a666f6a7b84f840b94c4a26e23537b87b785089 | /java/Java/BigNumber/Medium/JavaBigDecimal.java | 3c99eebd897473062bc6cc807f946bef1df69eb8 | []
| no_license | KingJoker/HackerRankSolutions | 4dbc8fbf32d834a0ca77b89246c0566ca41cb8d7 | ed51dfb0ed486588b0523b8d8943bad4324d8227 | refs/heads/master | 2022-09-28T11:03:11.261762 | 2020-06-05T05:13:55 | 2020-06-05T05:13:55 | 261,890,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,112 | java | /*
Java's BigDecimal class can handle arbitrary-precision signed decimal numbers. Let's test your knowledge of them!
Given an array, s, of n real number strings, sort them in descending order — but wait, there's more!
Each number must be printed in the exact same format as it was read from stdin, meaning that .1 is printed as .1,
and 0.1 is printed as 0.1.
If two numbers represent numerically equivalent values (e.g., .1==0.1), then they must be listed in the same order as
they were received as input.
Complete the code in the unlocked section of the editor below.
You must rearrange array s's elements according to the instructions above.
*Input Format
The first line consists of a single integer, n, denoting the number of integer strings.
Each line i of the n subsequent lines contains a real number denoting the value of s[i].
*Constraints
1<=n<=200
Each s[i] has at most 300 digits.
*Output Format
Locked stub code in the editor will print the contents of array s to stdout.
You are only responsible for reordering the array's elements.
*Sample Input
9
-100
50
0
56.6
90
0.12
.12
02.34
000.000
*Sample Output
90
56.6
50
02.34
0.12
.12
0
000.000
-100
*/
package BigNumber.Medium;
import java.math.BigDecimal;
import java.util.Scanner;
public class JavaBigDecimal {
public static void main(String []args){
//Input
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
String []s=new String[n+2];
for(int i=0;i<n;i++){
s[i]=sc.next();
}
sc.close();
for(int i = 0; i < n; i++){
BigDecimal max = new BigDecimal(s[i]);
int index = i;
for(int j = i+1; j < n; j++){
BigDecimal current = new BigDecimal(s[j]);
if(current.compareTo(max) > 0){
max = current;
index = j;
}
}
String temp = s[i];
s[i] = s[index];
s[index] = temp;
}
//Output
for(int i=0;i<n;i++)
{
System.out.println(s[i]);
}
}
}
| [
"[email protected]"
]
| |
a6042ca35ce8feef3ff8b411fae6c8b6dea43123 | 3181ff46f4d0c3e46c3d8ea1b1e2df4a51e25eb3 | /src/main/java/com/phrase/client/model/AccountDetails1.java | bfeb4993e780610a30bb8aa0918a839a4df1cfb8 | [
"MIT"
]
| permissive | chtpl/phrase-java | 1a1fb986e7b73ef5ca9a32cca662ee96cfcf1ba2 | 2bc6722ac6e05971f467121e93d55080637f1f92 | refs/heads/master | 2023-03-06T00:35:19.046986 | 2021-01-22T08:09:21 | 2021-01-22T08:09:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,247 | java | /*
* Phrase API Reference
*
* The version of the OpenAPI document: 2.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.phrase.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* AccountDetails1
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2021-01-22T08:09:17.702Z[Etc/UTC]")
public class AccountDetails1 {
public static final String SERIALIZED_NAME_SLUG = "slug";
@SerializedName(SERIALIZED_NAME_SLUG)
private String slug;
public AccountDetails1 slug(String slug) {
this.slug = slug;
return this;
}
/**
* Get slug
* @return slug
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getSlug() {
return slug;
}
public void setSlug(String slug) {
this.slug = slug;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AccountDetails1 accountDetails1 = (AccountDetails1) o;
return Objects.equals(this.slug, accountDetails1.slug);
}
@Override
public int hashCode() {
return Objects.hash(slug);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AccountDetails1 {\n");
sb.append(" slug: ").append(toIndentedString(slug)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
]
| |
c5d660f5d95ddfe33ed24afe958216c5ef6dc1a0 | 1cf068d4794b90d6ab14dc6b0eed9ed0e7de6dc0 | /units/src/main/java/net/consensys/cava/units/bigints/UInt64ValueDomain.java | f3f9d222a356574ddddbd2b9a03ecb35787fde8c | [
"Apache-2.0"
]
| permissive | Happy0/cava | 76aa1cb70aab8f6ee81cf9195228e4db0b9be86f | c01f2e5745d8f2a1296027f9bda98ad9ac2aed3d | refs/heads/master | 2020-04-29T16:29:06.180823 | 2019-03-05T17:33:31 | 2019-03-05T17:33:31 | 176,262,157 | 0 | 0 | Apache-2.0 | 2019-03-18T10:46:57 | 2019-03-18T10:46:56 | null | UTF-8 | Java | false | false | 1,838 | java | /*
* Copyright 2018 ConsenSys AG.
*
* 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 net.consensys.cava.units.bigints;
import java.util.function.Function;
import com.google.common.collect.DiscreteDomain;
/**
* A {@link DiscreteDomain} over a {@link UInt64Value}.
*/
public final class UInt64ValueDomain<T extends UInt64Value<T>> extends DiscreteDomain<T> {
private final T minValue;
private final T maxValue;
/**
* @param ctor The constructor for the {@link UInt64Value} type.
*/
public UInt64ValueDomain(Function<UInt64, T> ctor) {
this.minValue = ctor.apply(UInt64.MIN_VALUE);
this.maxValue = ctor.apply(UInt64.MAX_VALUE);
}
@Override
public T next(T value) {
return value.add(1);
}
@Override
public T previous(T value) {
return value.subtract(1);
}
@Override
public long distance(T start, T end) {
boolean negativeDistance = start.compareTo(end) < 0;
T distance = negativeDistance ? end.subtract(start) : start.subtract(end);
if (!distance.fitsLong()) {
return negativeDistance ? Long.MIN_VALUE : Long.MAX_VALUE;
}
long distanceLong = distance.toLong();
return negativeDistance ? -distanceLong : distanceLong;
}
@Override
public T minValue() {
return minValue;
}
@Override
public T maxValue() {
return maxValue;
}
}
| [
"[email protected]"
]
| |
6565cb8dcdc43467d1b9f2e711b1d30ff1a7f91e | f9c1142c86fef10b17de1c35ccce4794ee6959c8 | /lan_bm/laolan-utils-model-code/src/main/java/com/lan/_3编码/_3FormCorrectsUtils.java | 9cc14579d3372a6dfd046e2443fc74382bdd75fc | []
| no_license | laolandaye/lan | 3a23273565f4603da8fa9212bcdf9e95f5370a04 | a08c0b6a6fb8d157b2ba0559d36afc3c1a94e64d | refs/heads/master | 2022-12-16T16:08:26.184752 | 2021-04-08T08:27:26 | 2021-04-08T08:27:26 | 205,613,861 | 0 | 0 | null | 2022-12-16T11:39:20 | 2019-09-01T01:16:05 | JavaScript | UTF-8 | Java | false | false | 378 | java | package com.lan._3编码;
/**
* 由于表单后台纠正
*/
public class _3FormCorrectsUtils {
// 判断需求是否有,为否,就清空其他字段
// Patent Financing Labor Policy
public static String getIfDemand(String strIf, String strDemand) {
if("0".equals(strIf)) {
strDemand = "";
}
return strDemand;
}
}
| [
"[email protected]"
]
| |
7258024fef3d915b5278137d8893e873c5e5351e | c96347596034671a097cbb39a586643d9b967e9c | /designpattern/src/creational/abstractfactory/GraphicDesignPatterns/factory/Factory.java | 6d63794d7431af5131e413e4269cce207e400015 | []
| no_license | jackliaoontheway/designpattern | 3274e9476f7c5c08670ce446ea63fed3c9e32b70 | e73f7f602435b1a071b76eb46e324a0c895cef0d | refs/heads/master | 2020-06-15T23:44:57.165145 | 2019-11-28T23:48:06 | 2019-11-28T23:48:06 | 195,424,035 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package creational.abstractfactory.GraphicDesignPatterns.factory;
public abstract class Factory {
public static Factory getFactory(String factoryClassName) {
Factory factory = null;
try {
factory = (Factory) Class.forName(factoryClassName).newInstance();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return factory;
}
protected abstract Link createLink();
protected abstract Tray createTray();
protected abstract Page createPage();
}
| [
"[email protected]"
]
| |
f1f552e80b385f1c6ada0a22cd53d23b5ef4bdac | 41b328d17462456b7a8095723a2081dac0e10536 | /Task 1/1/Task1.java | 58e572ce088ec0507e89f6985c5fcc1cf12f42ce | []
| no_license | IllIdanIllI/Homework | 7c96311e338903289cbd854a3c614f30955de665 | b5640808417efdaa4a27f33ba8860ffc6ff8a8cc | refs/heads/master | 2020-04-22T15:28:11.960570 | 2019-03-17T14:44:29 | 2019-03-17T14:44:29 | 170,477,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,870 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class Task1 {
public static void main(String[] args) {
Task1 main = new Task1();
main.userInput();
}
private int enterNumber() {
int number = 0;
String input;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
input = br.readLine();
while(!isValidInput(input)) {
System.out.println("!!!Please, enter correct number from 0 to 9!!!");
input = br.readLine();
}
number = Integer.parseInt(input);
} catch (IOException e) {
e.printStackTrace();
}
return number;
}
private static boolean isValidInput(String input) {
Pattern pattern = Pattern.compile("[0-9]+");
Matcher matcher = pattern.matcher(input);
return matcher.matches();
}
private void userInput() {
System.out.println("Enter the first number: ");
int numberOne = enterNumber();
System.out.println("Enter the second number: ");
int numberTwo = enterNumber();
System.out.println("Enter the third number: ");
int numberThree = enterNumber();
comparison(numberOne, numberTwo, numberThree);
}
private void comparison(int numberOne, int numberTwo, int numberThree) {
if (numberOne == numberTwo && numberThree == numberTwo) {
System.out.println("All numbers are the same");
} else if (numberOne != numberTwo && numberThree != numberTwo && numberOne != numberThree) {
System.out.println("All numbers arent the same");
} else {
System.out.println("Some numbers are the same");
}
}
}
| [
"[email protected]"
]
| |
35a393be7eecb6fce146f5ac5582873ec3ef8e62 | 59a5915bd235b628924e3997443d9ff3d977c2b7 | /src/by/it/kovalyova/lesson03/TaskB1.java | d0485e201a8ac0cdbdf1f60ce0ed067c0a65fb6f | []
| no_license | kovalyovaolga/cs2018-09-17 | 56550dc67fe0da34b8d2b12e2cdf16a4c0be2c4d | 805a559f3419be3f15db6ab0fad38e6d77501867 | refs/heads/master | 2020-03-29T01:48:43.988238 | 2018-09-28T09:20:36 | 2018-09-28T09:20:36 | 149,407,435 | 0 | 0 | null | 2018-09-19T07:07:39 | 2018-09-19T07:07:39 | null | UTF-8 | Java | false | false | 1,734 | java | package by.it.kovalyova.lesson03;
/*
Lesson 03. Task B1. Литералы.
Присвойте литерал 111 трём целочисленным переменным
и 111.111 двум с плавающей запятой,
но при этом исправьте типы данных и литералы так, чтобы числа имели типы
double d - присваивание в десятичном формате,
byte b - присваивание в двоичном формате
long o - присваивание в восьмеричном формате
int h - присваивание в шестнадцатиричном формате
float f - присваивание в десятичном формате
Литералы в коде должны быть записаны как 111 (целые) и 111.111 (с запятой)
с правильными символами типа данных и систем счисления.
Вывод в консоль, написанный в коде, не меняйте. Если не будет ошибок
должно получиться на выходе:
575.2220000610351
111.111 7 73 273 111.111
Для ручной проверки запустите программу Ctrl+Shift+F10
Для автоматической проверки откройте и запустите класс Testing
*/
strictfp class TaskB1 {
public static void main(String[] args) {
double d = 111.111;
byte b = 0b111;
long o = 0111;
int h = 0x111;
double f = 111.111;
System.out.println(d + b + o + h + f);
System.out.println(d + " " + b + " " + o + " " + h + " " + f);
}
}
| [
"[email protected]"
]
| |
b12806453e7657449947baf5b6982799614adaae | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-iotsitewise/src/main/java/com/amazonaws/services/iotsitewise/model/PropertyType.java | fd4bf345724e277f899738021bcc892a893c538f | [
"Apache-2.0"
]
| permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 13,706 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.iotsitewise.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Contains a property type, which can be one of <code>attribute</code>, <code>measurement</code>, <code>metric</code>,
* or <code>transform</code>.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/iotsitewise-2019-12-02/PropertyType" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PropertyType implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* Specifies an asset attribute property. An attribute generally contains static information, such as the serial
* number of an <a href="https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications">IIoT</a> wind
* turbine.
* </p>
*/
private Attribute attribute;
/**
* <p>
* Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as
* timestamped temperature values or timestamped power values.
* </p>
*/
private Measurement measurement;
/**
* <p>
* Specifies an asset transform property. A transform contains a mathematical expression that maps a property's data
* points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
* </p>
*/
private Transform transform;
/**
* <p>
* Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate functions to
* process all input data points over a time interval and output a single data point, such as to calculate the
* average hourly temperature.
* </p>
*/
private Metric metric;
/**
* <p>
* Specifies an asset attribute property. An attribute generally contains static information, such as the serial
* number of an <a href="https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications">IIoT</a> wind
* turbine.
* </p>
*
* @param attribute
* Specifies an asset attribute property. An attribute generally contains static information, such as the
* serial number of an <a
* href="https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications">IIoT</a> wind turbine.
*/
public void setAttribute(Attribute attribute) {
this.attribute = attribute;
}
/**
* <p>
* Specifies an asset attribute property. An attribute generally contains static information, such as the serial
* number of an <a href="https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications">IIoT</a> wind
* turbine.
* </p>
*
* @return Specifies an asset attribute property. An attribute generally contains static information, such as the
* serial number of an <a
* href="https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications">IIoT</a> wind turbine.
*/
public Attribute getAttribute() {
return this.attribute;
}
/**
* <p>
* Specifies an asset attribute property. An attribute generally contains static information, such as the serial
* number of an <a href="https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications">IIoT</a> wind
* turbine.
* </p>
*
* @param attribute
* Specifies an asset attribute property. An attribute generally contains static information, such as the
* serial number of an <a
* href="https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications">IIoT</a> wind turbine.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PropertyType withAttribute(Attribute attribute) {
setAttribute(attribute);
return this;
}
/**
* <p>
* Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as
* timestamped temperature values or timestamped power values.
* </p>
*
* @param measurement
* Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such
* as timestamped temperature values or timestamped power values.
*/
public void setMeasurement(Measurement measurement) {
this.measurement = measurement;
}
/**
* <p>
* Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as
* timestamped temperature values or timestamped power values.
* </p>
*
* @return Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such
* as timestamped temperature values or timestamped power values.
*/
public Measurement getMeasurement() {
return this.measurement;
}
/**
* <p>
* Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as
* timestamped temperature values or timestamped power values.
* </p>
*
* @param measurement
* Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such
* as timestamped temperature values or timestamped power values.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PropertyType withMeasurement(Measurement measurement) {
setMeasurement(measurement);
return this;
}
/**
* <p>
* Specifies an asset transform property. A transform contains a mathematical expression that maps a property's data
* points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
* </p>
*
* @param transform
* Specifies an asset transform property. A transform contains a mathematical expression that maps a
* property's data points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
*/
public void setTransform(Transform transform) {
this.transform = transform;
}
/**
* <p>
* Specifies an asset transform property. A transform contains a mathematical expression that maps a property's data
* points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
* </p>
*
* @return Specifies an asset transform property. A transform contains a mathematical expression that maps a
* property's data points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
*/
public Transform getTransform() {
return this.transform;
}
/**
* <p>
* Specifies an asset transform property. A transform contains a mathematical expression that maps a property's data
* points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
* </p>
*
* @param transform
* Specifies an asset transform property. A transform contains a mathematical expression that maps a
* property's data points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PropertyType withTransform(Transform transform) {
setTransform(transform);
return this;
}
/**
* <p>
* Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate functions to
* process all input data points over a time interval and output a single data point, such as to calculate the
* average hourly temperature.
* </p>
*
* @param metric
* Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate
* functions to process all input data points over a time interval and output a single data point, such as to
* calculate the average hourly temperature.
*/
public void setMetric(Metric metric) {
this.metric = metric;
}
/**
* <p>
* Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate functions to
* process all input data points over a time interval and output a single data point, such as to calculate the
* average hourly temperature.
* </p>
*
* @return Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate
* functions to process all input data points over a time interval and output a single data point, such as
* to calculate the average hourly temperature.
*/
public Metric getMetric() {
return this.metric;
}
/**
* <p>
* Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate functions to
* process all input data points over a time interval and output a single data point, such as to calculate the
* average hourly temperature.
* </p>
*
* @param metric
* Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate
* functions to process all input data points over a time interval and output a single data point, such as to
* calculate the average hourly temperature.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PropertyType withMetric(Metric metric) {
setMetric(metric);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAttribute() != null)
sb.append("Attribute: ").append(getAttribute()).append(",");
if (getMeasurement() != null)
sb.append("Measurement: ").append(getMeasurement()).append(",");
if (getTransform() != null)
sb.append("Transform: ").append(getTransform()).append(",");
if (getMetric() != null)
sb.append("Metric: ").append(getMetric());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PropertyType == false)
return false;
PropertyType other = (PropertyType) obj;
if (other.getAttribute() == null ^ this.getAttribute() == null)
return false;
if (other.getAttribute() != null && other.getAttribute().equals(this.getAttribute()) == false)
return false;
if (other.getMeasurement() == null ^ this.getMeasurement() == null)
return false;
if (other.getMeasurement() != null && other.getMeasurement().equals(this.getMeasurement()) == false)
return false;
if (other.getTransform() == null ^ this.getTransform() == null)
return false;
if (other.getTransform() != null && other.getTransform().equals(this.getTransform()) == false)
return false;
if (other.getMetric() == null ^ this.getMetric() == null)
return false;
if (other.getMetric() != null && other.getMetric().equals(this.getMetric()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAttribute() == null) ? 0 : getAttribute().hashCode());
hashCode = prime * hashCode + ((getMeasurement() == null) ? 0 : getMeasurement().hashCode());
hashCode = prime * hashCode + ((getTransform() == null) ? 0 : getTransform().hashCode());
hashCode = prime * hashCode + ((getMetric() == null) ? 0 : getMetric().hashCode());
return hashCode;
}
@Override
public PropertyType clone() {
try {
return (PropertyType) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.iotsitewise.model.transform.PropertyTypeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
]
| |
fa2b93bb876aa1b987b4cc928c4bc0709881bbab | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/15/15_00c8710bffab1c1ca7fc9ec7a96f74a9dfcf283b/RapcTask/15_00c8710bffab1c1ca7fc9ec7a96f74a9dfcf283b_RapcTask_t.java | 8664598d20b3bac1378b9f5d1d3edbe7bcd2bb34 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 17,544 | java | /*
* Copyright 2007 Josh Kropf
*
* This file is part of bb-ant-tools.
*
* bb-ant-tools is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* bb-ant-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bb-ant-tools; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package ca.slashdev.bb.tasks;
import java.io.File;
import java.io.PrintStream;
import java.lang.management.ManagementFactory;
import java.util.List;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.FileUtils;
import ca.slashdev.bb.types.JdpType;
import ca.slashdev.bb.types.TypeAttribute;
import ca.slashdev.bb.util.Utils;
/**
* @author josh
*/
public class RapcTask extends BaseTask
{
private File jdkHome;
private File destDir;
private String output;
private boolean quiet = true;
private boolean verbose;
private boolean nodebug;
private boolean nowarn;
private boolean warnerror;
private boolean noconvert;
private boolean nopreverify;
private boolean generateSourceList = false;
private String sourceListFile = "sources.txt";
private Path srcs;
private Path imports;
private File exePath;
private JdpType jdp = new JdpType();
private String definesLine;
private Vector<Define> defines = new Vector<Define>();
/**
* Represents a single preprocessor define.
*/
public static class Define {
private String tag;
private String ifCond;
private String unlessCond;
public String getTag() {
return tag;
}
public void setTag(String val) {
tag = val;
}
/**
* Sets the if attribute. The define is evaluated when the property
* named by this attribute is defined in the project.
* @param ifCond
*/
public void setIf(String ifCond) {
this.ifCond = ifCond;
}
/**
* Sets the unless attribute. The define is evaluated when the property
* named by this attribute is NOT defined in the project.
* @param unlessCond
*/
public void setUnless(String unlessCond) {
this.unlessCond = unlessCond;
}
@Override
public String toString() {
return tag;
}
public boolean valid(Project p) {
if (ifCond != null && p.getProperty(ifCond) == null) {
return false;
} else if (unlessCond != null && p.getProperty(unlessCond) != null) {
return false;
} else {
return true;
}
}
}
@Override
public void init() throws BuildException {
srcs = new Path(getProject());
imports = new Path(getProject());
super.init();
}
/**
* Sets the jde home directory and attempts to locate the rapc.jar file
* and the net_rim_api.jar file.
*/
@Override
public void setJdeHome(File jdeHome) {
super.setJdeHome(jdeHome);
}
/**
* Sets the jdk (or jre) home directory of the jvm to use for launching
* the rapc command. Set this property if the rim jde requires an older
* version of the jvm.
* @param jdkHome jdk home directory
*/
public void setJdkHome(File jdkHome) {
File bin = new File(jdkHome, "bin");
if (!bin.isDirectory()) {
throw new BuildException("jdk home missing \"bin\" directory");
}
this.jdkHome = jdkHome;
}
/**
* Sets the path for the preverify tool.
*/
public void setExePath(File exePath) {
this.exePath = exePath;
}
/**
* Sets output name (eg: ca_slashdev_MyApp). This name is used by
* the rapc compiler to create various output files such as the .cod,.cso,
* and .jar files.
* @param output
*/
public void setOutput(String output) {
this.output = output;
}
/**
* Tells the rapc compiler to be less chatty, default is true.
* @param quiet
*/
public void setQuiet(boolean quiet) {
this.quiet = quiet;
}
/**
* Turn on verbose output from rapc compiler, default is false. The verbose
* flag overrides the quiet flag.
* @param verbose
*/
public void setVerbose(boolean verbose) {
this.verbose = verbose;
}
/**
* Disable generation of debug information, default is false. Note: this
* causes rapc to skip creating the .debug file and has no effect on the
* final cod file.
* @param nodebug
*/
public void setNodebug(boolean nodebug) {
this.nodebug = nodebug;
}
/**
* Disable warning messages printed by rapc compiler, default is false.
* @param nowarn
*/
public void setNowarn(boolean nowarn) {
this.nowarn = nowarn;
}
/**
* Treat warnings as errors, default is false.
* @param warnerror
*/
public void setWarnerror(boolean warnerror) {
this.warnerror = warnerror;
}
/**
* Don't convert images to PNG, default is false.
* @param noconvert
*/
public void setNoconvert(boolean noconvert) {
this.noconvert = noconvert;
}
/**
* Don't call the preverifier, default is false.
* @param nopreverify
*/
public void setNopreverify(boolean nopreverify) {
this.nopreverify = nopreverify;
}
/**
* Generate file containing list of source files. The file will contain
* full path names of each source file separated by newline characters.
* The result is passed to the rapc compiler to work around the command
* line length limitation in Windows. This flag is set to false by default.
* @param generateSourceList true to generate source list
* @see RapcTask#setSourceListFile(String)
*/
public void setGenerateSourceList(boolean generateSourceList) {
this.generateSourceList = generateSourceList;
}
/**
* Sets name of source list file. This file will be created in the
* destination directory. The default value is <code>sources.txt</code>.
* @param sourceListFile source list file name
* @see RapcTask#
*/
public void setSourceListFile(String sourceListFile) {
this.sourceListFile = sourceListFile;
}
/**
* Sets working directory in which to run rapc compiler. All output
* files will be generated here.
* @param destDir
*/
public void setDestDir(File destDir) {
this.destDir = destDir;
}
/**
* Creates an implicit FileSet and adds it to the path of source files.
* @param srcDir
*/
public void setSrcDir(File srcDir) {
FileSet srcFiles = new FileSet();
srcFiles.setDir(srcDir);
srcs.addFileset(srcFiles);
}
/**
* Adds importPath to the path of import jars.
* @param importPath
*/
public void setImport(Path importPath) {
imports.add(importPath);
}
/**
* Adds to path of import jars by reference. If the referenced object
* is not a Path object, an exception is raised.
* @param importRef
*/
public void setImportRef(Reference importRef) {
Object obj = importRef.getReferencedObject(getProject());
if (!(obj instanceof Path)) {
throw new BuildException("importref must be a path");
}
imports.add((Path)obj);
}
/**
* Add srcPath to the path of source files.
* @param srcPath
*/
public void addSrc(Path srcPath) {
srcs.add(srcPath);
}
/**
* Add importPath to the path of import jars.
* @param importPath
*/
public void addImport(Path importPath) {
imports.add(importPath);
}
/**
* Sets the project settings object. This task only supports one
* nested <jdp> element.
* @param jdp
*/
public void addJdp(JdpType jdp) {
this.jdp = jdp;
}
/**
* Sets delimiter separated list of preprocessor defines. The delimiter
* is platform specific (semi-colon for Windows, colon for Unix).
* @param defines delimiter separated list of defines
*/
public void setDefines(String defines) {
definesLine = defines;
}
/**
* Add preprocessor define to collection of defines.
* @param def preprocessor define to add
*/
public void addDefine(Define def) {
defines.add(def);
}
@Override
public void execute() throws BuildException {
super.execute();
if (jdeHome == null) {
throw new BuildException("jdehome not set");
}
File lib = new File(jdeHome, "lib");
if (lib.isDirectory()) {
Path apiPath = new Path(getProject());
apiPath.setLocation(new File(lib, "net_rim_api.jar"));
imports.add(apiPath);
} else {
throw new BuildException("jde home missing \"lib\" directory");
}
if (output == null) {
throw new BuildException("output is a required attribute");
}
if (destDir == null) {
destDir = getProject().getBaseDir();
} else {
if (!destDir.isDirectory()) {
throw new BuildException("destdir must be a directory");
}
}
if (srcs.size() == 0) {
throw new BuildException("srcdir attribute or <src> element required!");
}
String[] files = srcs.list();
srcs = new Path(getProject());
File f;
// iterate through all source files
for (String file : files) {
f = new File(file);
// when source file is actually a directory, create fileset
if (f.isDirectory()) {
FileSet fs = new FileSet();
fs.setDir(f);
srcs.addFileset(fs);
} else { // otherwise add the source file back into the path object
srcs.setLocation(f);
}
}
// blackberry jde will create this file and pass it to the rapc command
jdp.writeManifest(new File(destDir, output+".rapc"), output);
if (!Utils.isUpToDate(srcs, new File(destDir, output+".cod"))) {
log(String.format("Compiling %d source files to %s", srcs.size(), output+".cod"));
executeRapc();
} else {
log("Compilation skipped, cod is up to date", Project.MSG_VERBOSE);
}
}
@SuppressWarnings("unchecked")
protected void executeRapc() {
File rapcJar;
File bin = new File(jdeHome, "bin");
if (bin.isDirectory()) {
rapcJar = new File(bin, "rapc.jar");
} else {
throw new BuildException("jde home missing \"bin\" directory");
}
Java java = (Java)getProject().createTask("java");
java.setTaskName(getTaskName());
java.setClassname("net.rim.tools.compiler.Compiler");
// must fork in order to set working directory and/or new environment
java.setFork(true);
// we want to fail if rapc returns non-zero
java.setFailonerror(true);
// loop through parent JVM arguments and add -X args to the java task
// compiling large projects sometimes results in OutOfMemory exceptions
// so the -Xmx vm argument needs to be propagated through to the rapc VM
List<String> jvmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments();
for (String arg : jvmArgs) {
if (arg.startsWith("-X"))
java.createJvmarg().setValue(arg);
}
// loop through the systems environment variables looking for PATH
Vector<String> env = Execute.getProcEnvironment();
for (String line : env) {
// setup our own path variable
if (line.toUpperCase().startsWith("PATH")) {
// create new env variable using jde bin directory as the value
Environment.Variable var = new Environment.Variable();
var.setKey("PATH");
var.setFile(new File(jdeHome, "bin"));
// now add the systems current PATH value back into the new var
var.setValue(String.format("%s%c%s",
line.substring(line.indexOf('=')+1),
File.pathSeparatorChar,
var.getValue()));
java.addEnv(var);
break;
}
}
// if jdk home was specified, set the jvm command
if (jdkHome != null) {
java.setJvm(String.format("%s%c%s",
new File(jdkHome, "bin").getAbsolutePath(),
File.separatorChar, "java"));
}
// directory from which command will be launched
java.setDir(destDir);
// add rapc jar file to classpath
java.createClasspath().setLocation(rapcJar);
if (verbose) java.createArg().setValue("-verbose");
else if (quiet) java.createArg().setValue("-quiet");
if (nodebug) java.createArg().setValue("-nodebug");
if (nowarn) java.createArg().setValue("-nowarn");
if (warnerror) java.createArg().setValue("-wx");
if (noconvert) java.createArg().setValue("-noconvertpng");
if (nopreverify) java.createArg().setValue("-nopreverified");
if (exePath != null)
java.createArg().setValue("-exepath="+exePath.getAbsolutePath());
if (definesLine != null || defines.size() > 0) {
StringBuffer def = new StringBuffer();
if (definesLine != null) {
def.append(File.pathSeparatorChar).append(definesLine);
}
for (Define define : defines) {
if (define.valid(getProject())) {
def.append(File.pathSeparatorChar).append(define);
}
}
String defs = def.toString();
if (defs.length() > 0) {
// defs contains Windows path separators on a Unix host
if (defs.indexOf(';') != -1 && File.pathSeparatorChar == ':') {
log("converting Windows style path separators to Unix style",
Project.MSG_WARN);
defs = defs.replace(';', ':');
// defs contains Unix path separators on a Windows host
} else if (defs.indexOf(':') != -1 && File.pathSeparatorChar == ';') {
log("converting Unix style path separators to Windows style",
Project.MSG_WARN);
defs = defs.replace(':', ';');
}
}
java.createArg().setValue("-define=PREPROCESSOR" + defs);
}
java.createArg().setValue("import="+imports.toString());
String type = jdp.getType().getValue();
if (TypeAttribute.MIDLET.equals(type)) {
java.createArg().setValue("codename="+output);
java.createArg().setValue("-midlet");
} else if (TypeAttribute.CLDC.equals(type)) {
java.createArg().setValue("codename="+output);
} else if (TypeAttribute.LIBRARY.equals(type)) {
java.createArg().setValue("library="+output);
}
// manifest file is last parameter before file list
java.createArg().setValue(output+".rapc");
// when true, generate text file containing list of source files
if (generateSourceList) {
PrintStream output = null;
try {
output = new PrintStream(new File(destDir, sourceListFile));
for (String file : srcs.list()) {
// full path of each file, followed by newline character
output.println(file);
}
// rapc command expects parameter to begin with '@'
java.createArg().setValue("@" + sourceListFile);
} catch (Exception e) {
throw new BuildException("error creating source list file", e);
} finally {
FileUtils.close(output);
}
} else {
// add each of the items in the srcs path as file args
for (String file : srcs.list()) {
java.createArg().setFile(new File(file));
}
}
log(java.getCommandLine().toString(), Project.MSG_DEBUG);
java.execute();
}
}
| [
"[email protected]"
]
| |
9afe9344a22cc3b39330eba585a6159934ff1943 | 5d0e2d4f36cdcc7f88d35883e64f0deeafdf4e11 | /src/com/client/vote/domain/Option.java | bdf58955c5ddfc8e075d77546a7ee7749183101d | [
"Apache-2.0"
]
| permissive | sgudupat/psc-vote-client | 94c151e65a77a6be4508d49f24d62b43c6a8b36f | 847cbedcc0242f181338e66d5d03eaa5144b720b | refs/heads/master | 2020-06-07T09:27:08.721572 | 2015-10-23T09:54:49 | 2015-10-23T09:54:49 | 40,595,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | package com.client.vote.domain;
public class Option {
String optionId;
String optionValue;
public Option(String optionId, String optionValue) {
this.optionId = optionId;
this.optionValue = optionValue;
}
public String getOptionId() {
return optionId;
}
public void setOptionId(String optionId) {
this.optionId = optionId;
}
public String getOptionValue() {
return optionValue;
}
public void setOptionValue(String optionValue) {
this.optionValue = optionValue;
}
@Override
public String toString() {
return "Option{" +
"optionId='" + optionId + '\'' +
", optionValue='" + optionValue + '\'' +
'}';
}
} | [
"[email protected]"
]
| |
958f81e8e5e64dca236fe82965eb5fa41e73532f | 99b178b56c8d4cc9949d452092e4462b5f3a026d | /src/main/java/br/com/CourseSpringBoot/domain/Client.java | 715a57d14e9d6f7565e28326b08c3003788001c6 | []
| no_license | FabricioCaires95/spring-boot-ionic-backend | 80c64fe38f53fe766952f0c47dd60be06754da82 | b0c62e8284f6c4b3cc445c276ef8fc8139ae62f8 | refs/heads/master | 2021-06-09T22:28:35.719823 | 2019-12-29T07:49:29 | 2019-12-29T07:49:29 | 173,306,588 | 0 | 0 | null | 2021-04-26T19:19:13 | 2019-03-01T13:28:43 | Java | UTF-8 | Java | false | false | 2,089 | java | package br.com.CourseSpringBoot.domain;
import br.com.CourseSpringBoot.enums.ClientType;
import br.com.CourseSpringBoot.enums.UserProfile;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author fabricio
*/
@Getter
@Setter
@EqualsAndHashCode
@Entity
public class Client implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@Column(unique = true)
private String email;
private String cpfOrCnpj;
private Integer clientType;
@JsonIgnore
private String password;
@OneToMany(mappedBy = "client")
private List<Address> addresses = new ArrayList<>();
@ElementCollection
@CollectionTable(name = "PHONE")
private Set<String> phones = new HashSet<>();
@JsonIgnore
@OneToMany(mappedBy = "client")
private List<Order> orders = new ArrayList<>();
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "PROFILES")
private Set<Integer> profiles = new HashSet<>();
public Client(){
addProfile(UserProfile.CLIENT);
}
public Client(Integer id, String name, String email, String cpfOrCnpj, ClientType clientType, String password) {
super();
this.id = id;
this.name = name;
this.email = email;
this.cpfOrCnpj = cpfOrCnpj;
this.clientType = (clientType==null) ? null : clientType.getCod();
this.password = password;
addProfile(UserProfile.CLIENT);
}
public ClientType getClientType(){
return ClientType.toEnum(clientType);
}
public Set<UserProfile> getProfile(){
return profiles.stream().map(x -> UserProfile.toEnum(x)).collect(Collectors.toSet());
}
public void addProfile(UserProfile profile){
profiles.add(profile.getCod());
}
}
| [
"[email protected]"
]
| |
b766ef1b855f93c9ac835d5a7bdb26ae2126a420 | 245cb55252a67891c3fc5bda6a644840df47847a | /DistMobile/src/com/dist/entity/SSystemuser.java | d64cdd12ec655febb2300f68d2492ccf02adb6bd | []
| no_license | wwmmyy/MyServerSourceCode | 764b140bf52eed2a830b84444b6389526837ee0b | cc3361f1dbee31e92391edeb661332a851ab9c33 | refs/heads/master | 2021-01-01T16:59:11.708642 | 2017-07-21T17:11:19 | 2017-07-21T17:11:19 | 97,970,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,482 | java | package com.dist.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
/**
* SSystemuser entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "s_systemuser", catalog = "distmobile")
public class SSystemuser implements java.io.Serializable {
// Fields
/**
*
*/
private static final long serialVersionUID = 8938876478775188065L;
private String id;
private String loginName;
private String password;
// Constructors
/** default constructor */
public SSystemuser() {
}
/** full constructor */
public SSystemuser(String loginName, String password) {
this.loginName = loginName;
this.password = password;
}
// Property accessors
@GenericGenerator(name = "generator", strategy = "uuid.hex")
@Id
@GeneratedValue(generator = "generator")
@Column(name = "id", unique = true, nullable = false, length = 50)
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
@Column(name = "LoginName", length = 100)
public String getLoginName() {
return this.loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
@Column(name = "Password", length = 50)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
} | [
"[email protected]"
]
| |
678ef039c2923ddf5ce0e252bff18faad39d20b1 | 6170da6eded924d02cbb02fdaf35ac1355bcd380 | /src/com/chejiawang/android/utils/UIHelper.java | 825e2daf2c302291ac2b7f44aee6ba1be90c1609 | []
| no_license | Stanley3/CoachClient | a206d80049606a51a9dd06692cea0d898d1f64fb | 7f3df10c8d4a1441d94e2c845391975b5c8893a6 | refs/heads/master | 2021-01-20T05:57:13.703269 | 2015-08-08T03:19:47 | 2015-08-08T03:19:47 | 40,390,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,499 | java | package com.chejiawang.android.utils;
import com.chejiawang.android.app.AppManager;
import com.chejiawang.android.ui.R;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class UIHelper {
public static void startActivityUtil(Context context, Class<?> clazz){
Intent intent = new Intent(context, clazz);
context.startActivity(intent);
}
/**
* 设置按钮的字体颜色
* @param resource
* @param view
* @param colorId
*/
public static void setButtonTextColor(Resources resource, Button view, int colorId){
view.setTextColor(colorId);
}
/**
* 设置TextView的字体颜色
* @param resource
* @param view
* @param colorId
*/
public static void setTextViewTextColor(Resources resource, TextView view, int colorId){
view.setTextColor(colorId);
}
/**
* 发送App异常崩溃报告
* @param cont
* @param crashReport
*/
public static void sendAppCrashReport(final Context cont, final String crashReport)
{
AlertDialog.Builder builder = new AlertDialog.Builder(cont);
builder.setIcon(android.R.drawable.ic_dialog_info);
builder.setTitle(R.string.app_error);
builder.setMessage(R.string.app_error_message);
builder.setPositiveButton(R.string.submit_report, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
//发送异常报告
Intent i = new Intent(Intent.ACTION_SEND);
//i.setType("text/plain"); //模拟器
i.setType("message/rfc822") ; //真机
i.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
i.putExtra(Intent.EXTRA_SUBJECT,"合合集团教练端 - 错误报告");
i.putExtra(Intent.EXTRA_TEXT,crashReport);
cont.startActivity(Intent.createChooser(i, "发送错误报告"));
//退出
AppManager.getAppManager().AppExit(cont);
}
});
builder.setNegativeButton(R.string.sure, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
//退出
AppManager.getAppManager().AppExit(cont);
}
});
builder.show();
}
/**
* 弹出消息
* @param context
* @param msg
*/
public static void ToastMessage(Context context,String msg)
{
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
}
| [
"[email protected]"
]
| |
ee06c70c00756050166f416645766b72654737ec | 135c2c52d44959fec455004d893401e68066a656 | /4_JAVA/0406_Implements/src/ex03/multiImplements/MultiClass.java | 3d42db9cd7f3b250598f1e210b1330e884e3b8c7 | []
| no_license | jiyun0524/douzone_fullstack | 6708533e0b24fffee341957aa91e1c079a4242be | 95d5d8474b447ede4aa71772a32f3b5155f40d15 | refs/heads/main | 2023-05-28T18:17:01.233799 | 2021-06-10T10:46:47 | 2021-06-10T10:46:47 | 352,933,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package ex03.multiImplements;
import ex01.multiImplements.Shape;
import ex02.Interface.IDraw;
public class MultiClass extends Shape implements IDraw {
int num = 129;
@Override
public void draw() {
System.out.println("idraw interface");
}
@Override
public double calc(double x) {
System.out.println(x + " test interface");
return 5.5;
}
@Override
public void show(String name) {
System.out.println(name + " shape abstract class");
}
}
| [
"[email protected]"
]
| |
f49c6098bdec81f9d18dbce66cb219cc99d17b5f | 435cc5ce731ca810a0b45c3650659adb1b1e9c7a | /app/src/main/java/com/example/nyambura/myfitness/AlbumStorageDirFactory.java | bc659b5993db60513013f07cf7babe6e6d1a100f | []
| no_license | annmunyare/MyFitness | b5916cc9580cea8e66c05ac5fe97c93c4028c2c0 | 2078cb6bcdd9a7a5e9c9d3a79b3fe9e55f4a7f75 | refs/heads/master | 2021-01-22T22:27:39.231508 | 2017-05-11T14:01:21 | 2017-05-11T14:01:21 | 85,543,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package com.example.nyambura.myfitness;
import java.io.File;
/**
* Created by nyambura on 4/7/17.
*/
abstract class AlbumStorageDirFactory {
public abstract File getAlbumStorageDir(String albumName);
}
| [
"[email protected]"
]
| |
d1059505ca581a702f76612f4f1dc522bff254a9 | a5ae9546b2c0c1c34afcfba60affe06d9817b4fb | /spring4+mybatis3/swagger-codegen-master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java | daf3d1543b10a8374ceb9aff971300e70789570c | [
"Apache-2.0"
]
| permissive | LiuJQ9674Git/abc-workbrench | 1233e753ee1cdd6ecc298ffe23d7a2c5f5b0ed05 | 5d6489bed46577ee77cf81fbd7d047e3e24f4204 | refs/heads/master | 2016-09-13T22:16:22.320658 | 2016-05-16T13:28:57 | 2016-05-16T13:28:57 | 58,934,157 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,786 | java | package io.swagger.codegen.languages;
import io.swagger.codegen.*;
import io.swagger.models.properties.*;
import java.util.*;
import java.io.File;
import org.apache.commons.lang.StringUtils;
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String modelPropertyNaming= "camelCase";
public AbstractTypeScriptClientCodegen() {
super();
supportsInheritance = true;
setReservedWordsLowerCase(Arrays.asList(
// local variable names used in API methods (endpoints)
"varLocalPath", "queryParameters", "headerParams", "formParams", "useFormData", "varLocalDeferred",
"requestOptions",
// Typescript reserved words
"abstract", "await", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with", "yield"));
languageSpecificPrimitives = new HashSet<String>(Arrays.asList(
"string",
"String",
"boolean",
"Boolean",
"Double",
"Integer",
"Long",
"Float",
"Object",
"Array",
"Date",
"number",
"any"
));
instantiationTypes.put("array", "Array");
typeMapping = new HashMap<String, String>();
typeMapping.put("Array", "Array");
typeMapping.put("array", "Array");
typeMapping.put("List", "Array");
typeMapping.put("boolean", "boolean");
typeMapping.put("string", "string");
typeMapping.put("int", "number");
typeMapping.put("float", "number");
typeMapping.put("number", "number");
typeMapping.put("long", "number");
typeMapping.put("short", "number");
typeMapping.put("char", "string");
typeMapping.put("double", "number");
typeMapping.put("object", "any");
typeMapping.put("integer", "number");
typeMapping.put("Map", "any");
typeMapping.put("DateTime", "Date");
//TODO binary should be mapped to byte array
// mapped to String as a workaround
typeMapping.put("binary", "string");
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
}
@Override
public void processOpts() {
super.processOpts();
if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) {
setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING));
}
}
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;
}
@Override
public String escapeReservedWord(String name) {
return "_" + name;
}
@Override
public String apiFileFolder() {
return outputFolder + "/" + apiPackage().replace('.', File.separatorChar);
}
@Override
public String modelFileFolder() {
return outputFolder + "/" + modelPackage().replace('.', File.separatorChar);
}
@Override
public String toParamName(String name) {
// replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
// if it's all uppper case, do nothing
if (name.matches("^[A-Z_]*$"))
return name;
// camelize the variable name
// pet_id => petId
name = camelize(name, true);
// for reserved word or word starting with number, append _
if (isReservedWord(name) || name.matches("^\\d.*"))
name = escapeReservedWord(name);
return name;
}
@Override
public String toVarName(String name) {
// should be the same as variable name
return getNameUsingModelPropertyNaming(name);
}
@Override
public String toModelName(String name) {
name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
if (!StringUtils.isEmpty(modelNamePrefix)) {
name = modelNamePrefix + "_" + name;
}
if (!StringUtils.isEmpty(modelNameSuffix)) {
name = name + "_" + modelNameSuffix;
}
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(name)) {
String modelName = camelize("object_" + name);
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName);
return modelName;
}
// camelize the model name
// phone_number => PhoneNumber
return camelize(name);
}
@Override
public String toModelFilename(String name) {
// should be the same as the model name
return toModelName(name);
}
@Override
public String getTypeDeclaration(Property p) {
if (p instanceof ArrayProperty) {
ArrayProperty ap = (ArrayProperty) p;
Property inner = ap.getItems();
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
} else if (p instanceof MapProperty) {
MapProperty mp = (MapProperty) p;
Property inner = mp.getAdditionalProperties();
return "{ [key: string]: "+ getTypeDeclaration(inner) + "; }";
} else if (p instanceof FileProperty) {
return "any";
}
return super.getTypeDeclaration(p);
}
@Override
public String getSwaggerType(Property p) {
String swaggerType = super.getSwaggerType(p);
String type = null;
if (typeMapping.containsKey(swaggerType)) {
type = typeMapping.get(swaggerType);
if (languageSpecificPrimitives.contains(type))
return type;
} else
type = swaggerType;
return toModelName(type);
}
@Override
public String toOperationId(String operationId) {
// throw exception if method name is empty
if (StringUtils.isEmpty(operationId)) {
throw new RuntimeException("Empty method name (operationId) not allowed");
}
// method name cannot use reserved keyword, e.g. return
// append _ at the beginning, e.g. _return
if (isReservedWord(operationId)) {
return escapeReservedWord(camelize(sanitizeName(operationId), true));
}
return camelize(sanitizeName(operationId), true);
}
public void setModelPropertyNaming(String naming) {
if ("original".equals(naming) || "camelCase".equals(naming) ||
"PascalCase".equals(naming) || "snake_case".equals(naming)) {
this.modelPropertyNaming = naming;
} else {
throw new IllegalArgumentException("Invalid model property naming '" +
naming + "'. Must be 'original', 'camelCase', " +
"'PascalCase' or 'snake_case'");
}
}
public String getModelPropertyNaming() {
return this.modelPropertyNaming;
}
public String getNameUsingModelPropertyNaming(String name) {
switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) {
case original: return name;
case camelCase: return camelize(name, true);
case PascalCase: return camelize(name);
case snake_case: return underscore(name);
default: throw new IllegalArgumentException("Invalid model property naming '" +
name + "'. Must be 'original', 'camelCase', " +
"'PascalCase' or 'snake_case'");
}
}
}
| [
"admin@hp.(none)"
]
| admin@hp.(none) |
0f1ff15152283c1ee0a5b111a6059b3ef3118338 | 0c754c04e9dc4e8d2df3ed99c0968cd5a573eb45 | /src/com/ccms/log/message/CreateAccountMessage.java | 795ae33bdd4c01e8db6497c528471ef36205ee1d | []
| no_license | cyb3727/Credit-Card-Manage-System | de3ec60f979506cb90bef5c7ab4956a2fd97b9cd | 346cb62ddc46ac5eec07e06600b7e56a6c64c707 | refs/heads/master | 2021-01-18T13:02:28.222414 | 2012-09-27T14:42:02 | 2012-09-27T14:42:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | /**
*
*/
package com.ccms.log.message;
import java.util.Date;
import com.ccms.account.AccountInfo;
/**
* @author magic282
*
*/
public class CreateAccountMessage extends OriginMessage {
public long BankID;
public Date date = new Date();
public AccountInfo info;
}
| [
"[email protected]"
]
| |
07859d186e37be4f73b77c0e9bdfc28193129ae3 | 2a1f26b9f81d09becf4a64608cf46580b0b2fcde | /src/me/Niklas/Client/SichererClient.java | 464965e44497fd87a1d0f961c3bd8748f07b8c3b | []
| no_license | GyhoEvents/inventar | 7fc119e7e9f67a16882f9f67b7e695dedf887431 | 0eba13ec2b7a2b7a6449a79794d1c22597ba3727 | refs/heads/master | 2016-09-06T19:04:54.800171 | 2014-11-09T09:30:20 | 2014-11-09T09:30:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,983 | 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 me.Niklas.Client;
import de.gyhoevents.inventar.listeners.network.NetworkListener;
import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Programmieren
*/
public class SichererClient {
private Socket client;
private List<NetworkListener> listeners;
public MessageLoop ml;
public SichererClient(String pAdresse, int pPort, NetworkListener nl) {
listeners = new ArrayList<>();
listeners.add(nl);
try {
client = new Socket(pAdresse,pPort);
ml = new MessageLoop(client,this);
ml.start();
} catch (IOException ex) {
bearbeiteVerbindungsende();
}
}
public void bearbeiteNachricht(String pNachricht) {
// System.out.println("Empfangen: " + pNachricht);
for (int i = 0, size = listeners.size(); i < size; i++) {
listeners.get(i).bearbeiteNachricht(pNachricht);
}
}
public void bearbeiteVerbindungsende() {
for (int i = 0, size = listeners.size(); i < size; i++) {
listeners.get(i).bearbeiteVerbindungsende();
}
}
public void bearbeiteVerbindungsaufbau() {
for (int i = 0, size = listeners.size(); i < size; i++) {
listeners.get(i).bearbeiteVerbindungsaufbau();
}
}
public void addListener(NetworkListener listener) {
listeners.add(listener);
}
public void removeListener(NetworkListener listener){
listeners.remove(listener);
}
public void beendeVerbindung(){
try {
this.client.close();
this.ml.istVerbunden = false;
this.bearbeiteVerbindungsende();
} catch (IOException ex) {
Logger.getLogger(SichererClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void sendeNachricht(String Nachricht){
while(!this.ml.istVerbunden){
}
try {
this.ml.objectOut.writeObject(this.ml.verschluessele(Nachricht));
System.out.println(Nachricht);
} catch (IOException ex) {
this.bearbeiteVerbindungsende();
try {
this.ml.socket.close();
} catch (IOException ex1) {
Logger.getLogger(SichererClient.class.getName()).log(Level.SEVERE, null, ex1);
}
this.ml.stop();
// Logger.getLogger(SichererClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"[email protected]"
]
| |
f2f1c2450f5cd8a9261eed13777b6aae9dcdddcb | 852b11994136aa7822d48a3187cb81a573b66d27 | /TESTBLUETOOTH/app/src/androidTest/java/com/truongsinh/testbluetooth/ExampleInstrumentedTest.java | 9794bede06f173930e4413294a032aa8f834491d | []
| no_license | DangTruongSinh/android-projects | 3b2202fb2015b63a8a602f4b90d0bc3a6e3e87fc | fa32811ce7018e0a87d788039fda0188125a7255 | refs/heads/master | 2020-12-01T07:52:34.618704 | 2019-12-28T09:14:17 | 2019-12-28T09:14:17 | 230,586,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.truongsinh.testbluetooth;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.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.getTargetContext();
assertEquals("com.truongsinh.testbluetooth", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
385b89f605e2d0515031a9e3e759adde7ef41a04 | fe93732f9acde7501f6979b96cdc5f0e79d385b9 | /app/src/main/java/com/johanlund/screens/events_templates_actions/mvc_controller/EventsTemplateActivity.java | 1dccfe2993a3175e114ea7c72e3b4e0032cd8cc7 | []
| no_license | lundjohan/IBSFoodAnalyzer | 49eeece9799ae6bc45b8007a17686ff62a6e7054 | fe22728f25f463a5c5438620ac5292195834eb75 | refs/heads/master | 2020-04-03T02:10:02.807140 | 2018-12-29T08:43:14 | 2018-12-29T08:43:14 | 154,948,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,055 | java | package com.johanlund.screens.events_templates_actions.mvc_controller;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import com.johanlund.base_classes.Event;
import com.johanlund.base_classes.Exercise;
import com.johanlund.base_classes.InputEvent;
import com.johanlund.base_classes.Meal;
import com.johanlund.base_classes.Other;
import com.johanlund.base_classes.TagWithoutTime;
import com.johanlund.constants.Constants;
import com.johanlund.dao.Dao;
import com.johanlund.dao.SqLiteDao;
import com.johanlund.database.DBHandler;
import com.johanlund.ibsfoodanalyzer.R;
import com.johanlund.model.EventsTemplate;
import com.johanlund.screens.event_activities.mvc_controllers.ChangeEventActivity;
import com.johanlund.screens.event_activities.mvc_controllers.ChangeEventInsideEtActivity;
import com.johanlund.screens.event_activities.mvc_controllers.NewEventActivity;
import com.johanlund.screens.events_container_classes.common.EventsContainer;
import com.johanlund.screens.events_container_classes.common.mvcviews.EventButtonsViewMvc;
import com.johanlund.screens.events_container_classes.common.mvcviews.EventButtonsViewMvcImpl;
import com.johanlund.screens.events_templates_actions.mvc_views.EventsTemplateViewMvc;
import com.johanlund.screens.info.ActivityInfoContent;
import org.threeten.bp.LocalDate;
import java.util.ArrayList;
import java.util.List;
import static com.johanlund.constants.Constants.EVENT_POSITION;
import static com.johanlund.constants.Constants.EVENT_TYPE;
import static com.johanlund.constants.Constants.ID_OF_EVENT;
import static com.johanlund.constants.Constants.LAYOUT_RESOURCE;
import static com.johanlund.constants.Constants.NEW_EVENT;
import static com.johanlund.constants.Constants.EVENT_TO_CHANGE;
import static com.johanlund.constants.Constants.POS_OF_EVENT_RETURNED;
import static com.johanlund.constants.Constants.RETURN_EVENT_SERIALIZABLE;
import static com.johanlund.constants.Constants.TITLE_STRING;
/**
* Reuses a lot of code from DiaryFragment.
* <p>
* Some implemenations uses a TextView for name and some (1) don't. Be aware of this! => It
* should be abstracted completely in this parent class.
*/
public abstract class EventsTemplateActivity extends AppCompatActivity
implements EventsTemplateViewMvc.Listener, EventButtonsViewMvc.Listener {
protected EventButtonsViewMvcImpl mButtonsViewMvc;
protected EventsTemplateViewMvc mViewMVC;
long idEventsTemplate;
public boolean onCreateOptionsMenu(Menu menu) {
return mViewMVC.createOptionsMenu(menu, getMenuInflater());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the root view of the associated MVC view as the content of this activity
setContentView(mViewMVC.getRootView());
mButtonsViewMvc = new EventButtonsViewMvcImpl(LayoutInflater.from(this), (ViewGroup) mViewMVC.getRootView().findViewById(R
.id.buttons));
}
protected void initMvcView(EventsTemplate et) {
mViewMVC.setListener(this);
mViewMVC.bindEventsTemplateToView(et);
mViewMVC.bindDateToView(LocalDate.now());
}
@Override
public void onStart() {
super.onStart();
mButtonsViewMvc.registerListener(this);
}
@Override
public void onStop() {
super.onStop();
mButtonsViewMvc.unregisterListener(this);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && data.hasExtra(NEW_EVENT)) {
executeNewEvent(requestCode, data);
}
mViewMVC.handleEcOnActivityResult(requestCode, resultCode, data);
}
protected abstract void saveToDB(EventsTemplate et);
protected abstract void saveToDiary(EventsTemplate et);
@Override
public void onBackPressed() {
super.onBackPressed();
}
//in case API<21 onBackPressed is not called
//this is blocking natural behavoiur of backbutton
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
break;
}
return true;
}
/**
* Function that removes tagtypes in EventsTemplate if there is no find for it in database
*
* @param et
* @return
*/
public EventsTemplate removeTagTypesThatDontExist(final EventsTemplate et) {
List<Event> cleansedEvents = new ArrayList<>();
Dao dao = new SqLiteDao(this.getApplicationContext());
for (Event e : et.getEvents()) {
Event cleansedEvent = null;
if (e instanceof InputEvent) {
List<TagWithoutTime> tags = ((InputEvent) e).getTagsWithoutTime();
List<TagWithoutTime> cleansedTags = new ArrayList<>();
for (TagWithoutTime t : tags) {
if (dao.tagTypeExists(t.getName())) {
cleansedTags.add(t);
}
}
if (e instanceof Meal) {
Meal m = ((Meal) e);
cleansedEvent = new Meal(m.getTime(), m.getComment(), m.hasBreak(),
cleansedTags, m.getPortions());
} else if (e instanceof Other) {
Other o = ((Other) e);
cleansedEvent = new Other(o.getTime(), o.getComment(), o.hasBreak(),
cleansedTags);
}
} else if (e instanceof Exercise) {
Exercise exercise = ((Exercise) e);
TagWithoutTime t = exercise.getTypeOfExercise();
if (t != null && dao.tagTypeExists(t.getName())) {
cleansedEvent = exercise;
} else {
cleansedEvent = new Exercise(exercise.getTime(), exercise.getComment(),
exercise.hasBreak(), null, exercise.getIntensity());
}
} else {
cleansedEvent = e;
}
cleansedEvents.add(cleansedEvent);
}
return new EventsTemplate(cleansedEvents, et.getNameOfTemplate());
}
@Override
public void completeSession(EventsTemplate et) {
saveToDB(et);
saveToDiary(et);
finish();
}
@Override
public void showInfo(String titleStr, int infoLayout) {
//move below to controller
Intent intent = new Intent(this, ActivityInfoContent.class);
intent.putExtra(LAYOUT_RESOURCE, infoLayout);
intent.putExtra(TITLE_STRING, titleStr);
startActivity(intent);
}
/*
--------------------------------------------------------------------------------------------
EventButtonsUser.Listener methods
--------------------------------------------------------------------------------------------
*/
@Override
public void newEventActivity(int eventType) {
Intent intent = new Intent(this, NewEventActivity.class);
intent.putExtra(Constants.EVENT_TYPE, eventType);
intent.putExtra(Constants.NEW_EVENT_DATE, LocalDate.now()); // date is insignificant here, but NewEventActivity requires it
startActivityForResult(intent, EventsContainer.EVENT_NEW);
}
@Override
public void executeNewEvent(int requestCode, Intent data) {
if (data.hasExtra(RETURN_EVENT_SERIALIZABLE)) {
Event event = (Event) data.getSerializableExtra(RETURN_EVENT_SERIALIZABLE);
mViewMVC.bindEventToList(event);
}
}
/*
--------------------------------------------------------------------------------------------
EventsContainerUser.Listener methods
--------------------------------------------------------------------------------------------
*/
//user requests to change event
@Override
public void changeEventActivity(Event event, int eventType, int valueToReturn, int
posInList) {
Intent intent = new Intent(this, ChangeEventInsideEtActivity.class);
intent.putExtra(EVENT_TO_CHANGE, event);
intent.putExtra(EVENT_POSITION, posInList);
startActivityForResult(intent, valueToReturn);
}
@Override
public void executeChangedEvent(int requestCode, Intent data) {
int posInList = data.getIntExtra(POS_OF_EVENT_RETURNED, -1);
if (posInList == -1) {
throw new RuntimeException("Received no EVENT POSITION from New/Changed Event " +
"Activity (MealActivity etc)");
}
if (data.hasExtra(RETURN_EVENT_SERIALIZABLE)) {
Event event = (Event) data.getSerializableExtra(RETURN_EVENT_SERIALIZABLE);
mViewMVC.bindChangedEventToList(event, posInList);
}
}
}
| [
"[email protected]"
]
| |
b3c949ab707d159b1bfffc136c6bcc7e427a950f | 87127dfc6a1e84e48fb6192021aa702f44091491 | /src/main/java/extendedrenderer/shader/IShaderRenderedEntity.java | b7c1f822da64a3d93193a34c4f4b0b0d068b5708 | []
| no_license | Corosauce/CoroUtil | c8880c85da20be4841622f6ff0988f982af03ff7 | 1b8f7298340d2cac9507471971b85924d2652123 | refs/heads/1.12.x | 2023-03-08T13:46:56.117847 | 2020-03-16T06:49:32 | 2020-03-16T06:49:32 | 3,435,540 | 26 | 42 | null | 2022-10-30T15:52:32 | 2012-02-14T00:09:09 | Java | UTF-8 | Java | false | false | 332 | java | package extendedrenderer.shader;
import org.lwjgl.util.vector.Quaternion;
import javax.vecmath.Vector3f;
public interface IShaderRenderedEntity {
Vector3f getPosition();
Quaternion getQuaternion();
Quaternion getQuaternionPrev();
//Vector3f getScale();
float getScale();
//boolean hasCustomMatrix();
}
| [
"[email protected]"
]
| |
1c1e1e4d7bcc2dc68f9fd87e6be109e391337021 | e596722316bf0b2db80a5711c311e318752a6276 | /termend-manager-web/src/main/java/com/termend/controller/user/UserController.java | 336287170f1ae4e7a9196b830fca81448588b5b8 | []
| no_license | xiaohui-cpu/UploadMaven | 0fbcf614626fda0ec9468558e1a51048c68a25a7 | 61e274d8b9e1b5da375cfd613fc50c3330a67890 | refs/heads/master | 2022-12-21T15:02:15.892167 | 2019-12-24T06:57:41 | 2019-12-24T06:57:41 | 228,996,105 | 2 | 0 | null | 2022-12-16T07:18:16 | 2019-12-19T07:07:55 | JavaScript | UTF-8 | Java | false | false | 2,350 | java | package com.termend.controller.user;
import java.io.IOException;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.termend.common.Result;
import com.termend.common.json.JsonUtils;
import com.termend.pojo.SysRight;
import com.termend.pojo.SysUser;
import com.termend.service.user.IUserService;
@Controller
public class UserController {
@Resource
private IUserService userService;
@RequestMapping("/")
public String login() {
return "login";
}
@RequestMapping("/toLogin")
@ResponseBody
public Result toLogin(SysUser sysUser, HttpSession session) {
SysUser user = userService.selectUser(sysUser);
if(user!=null) {
session.setAttribute("username",user.getUsrName());
return Result.ok();
}
return Result.error("用户名或密码错误!");
}
@RequestMapping("/loginout")
@ResponseBody
public void loginOut(HttpSession session, HttpServletResponse response) {
session.invalidate();
try {
response.sendRedirect("/");
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping("/toIndex")
public String index(Model model, HttpSession session) {
String username = (String) session.getAttribute("username");
model.addAttribute("username", username);
//如果直接返回字符串,视图解析器会转成物理视图
SysUser user = userService.selectUserByUserName(username);
List<SysRight> rights = userService.selectUserRights(user);
String str = "[";
for (int i = 0;i<rights.size();i++) {
if(i<rights.size()-1) {
str = str + JsonUtils.objectToJson(rights.get(i))+",";
}else {
str = str + JsonUtils.objectToJson(rights.get(i));
}
}
str =str+"]";
//System.out.println(str);
session.setAttribute("lists",str);
return "index";
}
@RequestMapping("pages/{pageName}")
public String toPage(@PathVariable("pageName") String pageName) {
return pageName;
}
}
| [
"[email protected]"
]
| |
f7fc70cc6c8e4524ac2252293a7f320d1f85b112 | eef4135630f800a8e51c015a297b5e785ba54207 | /framework-core-web-api/src/main/java/com/gbss/framework/core/web/api/builders/Builder.java | f783329f4f2c3e840ece5a4ab8681bed035d5ad3 | [
"Apache-2.0"
]
| permissive | akshay-misra-backend-products/framework-core | 00d51eb672a1ce6226ea3784a919044802cce0a0 | d7ed1fe0059172754b65723f16e5050bd9900fa9 | refs/heads/microservice | 2023-01-14T09:38:32.265770 | 2021-06-18T07:00:43 | 2021-06-18T07:00:43 | 201,622,053 | 0 | 0 | Apache-2.0 | 2023-01-07T19:25:05 | 2019-08-10T11:40:58 | Java | UTF-8 | Java | false | false | 130 | java | package com.gbss.framework.core.web.api.builders;
public interface Builder<T> {
Builder createBuilder();
T build();
}
| [
"[email protected]"
]
| |
8426388f3194d45b838f551b5a78ecd583c241f9 | e225b6d32429355244a30d6dc532bc2580d4f716 | /src/main/java/com/deca/diffequationscomputationalassignment/ExactSolution.java | 13e74b372ef4048c33a547f54133506adf255f0d | []
| no_license | sl1depengwyn/DiffEquationsComputationalAssignment | 665d2f53cabe5e3d0a9f417d8fb53494a5b495b4 | dcbdb0d62184a4b878e1b895cfe7698d02f7533e | refs/heads/main | 2023-08-24T02:00:32.355966 | 2021-10-25T15:14:00 | 2021-10-25T15:14:00 | 416,848,399 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,125 | java | package com.deca.diffequationscomputationalassignment;
import javafx.scene.chart.XYChart;
import javafx.scene.paint.Color;
import java.util.ArrayList;
import java.util.List;
public class ExactSolution extends Solution {
double pointOfDiscontinuity;
ExactSolution(double x0, double X, double y0, int N) {
super(x0, X, y0, N);
color = Color.GREEN;
pointOfDiscontinuity = 1 / c;
h = 0.1;
}
public double solution(double x) {
return 1 / (1 - x * c);
}
@Override
public List<XYChart.Series<Number, Number>> getSolution() {
XYChart.Series<Number, Number> seriesBeforePointOfDiscontinuity = new XYChart.Series<>();
XYChart.Series<Number, Number> seriesAfterPointOfDiscontinuity = new XYChart.Series<>();
double newY;
System.out.println(pointOfDiscontinuity);
if (x0 < pointOfDiscontinuity && pointOfDiscontinuity < X) {
System.out.println("pod in raange");
for (double x = x0; x < pointOfDiscontinuity; x += h) {
newY = solution(x);
if (!Double.isFinite(newY)) {
continue;
}
seriesBeforePointOfDiscontinuity.getData().add(new XYChart.Data<>(x, newY));
}
for (double x = pointOfDiscontinuity + h; x <= X + h; x += h) {
newY = solution(x);
if (!Double.isFinite(newY)) {
continue;
}
seriesAfterPointOfDiscontinuity.getData().add(new XYChart.Data<>(x, newY));
}
} else {
for (double x = x0; x <= X + h; x += h) {
newY = solution(x);
if (!Double.isFinite(newY)) {
continue;
}
seriesBeforePointOfDiscontinuity.getData().add(new XYChart.Data<>(x, newY));
}
}
List<XYChart.Series<Number, Number>> series = new ArrayList<>();
series.add(seriesBeforePointOfDiscontinuity);
series.add(seriesAfterPointOfDiscontinuity);
return series;
}
}
| [
"[email protected]"
]
| |
bbd2e280e40582537cc34b59afbbbc2aef8c4486 | ed865190ed878874174df0493b4268fccb636a29 | /PuridiomReviewFinalize/src/com/tsa/puridiom/reviewfinalize/tasks/ReviewFinalizeService.java | d124309650c129bd4029331d3531278002d23804 | []
| no_license | zach-hu/srr_java8 | 6841936eda9fdcc2e8185b85b4a524b509ea4b1b | 9b6096ba76e54da3fe7eba70989978edb5a33d8e | refs/heads/master | 2021-01-10T00:57:42.107554 | 2015-11-06T14:12:56 | 2015-11-06T14:12:56 | 45,641,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,221 | java | package com.tsa.puridiom.reviewfinalize.tasks;
import java.util.List;
import java.util.Map;
import com.tsa.puridiom.entity.ReviewFinalize;
import com.tsagate.foundation.processengine.Status;
import com.tsagate.foundation.processengine.Task;
public class ReviewFinalizeService extends Task
{
public static boolean isStepChecked(List reviewFinalizeList, String step)
{
if(reviewFinalizeList == null){ return false; }
for(int i = 0; i < reviewFinalizeList.size(); i++)
{
ReviewFinalize reviewFinalize = (ReviewFinalize)reviewFinalizeList.get(i);
if(step.equalsIgnoreCase(reviewFinalize.getStep()))
{
if(reviewFinalize.getCompleted().equalsIgnoreCase("Y")){ return true; }
}
}
return false;
}
public static ReviewFinalize getReviewFinalize(List reviewFinalizeList, String step)
{
if(reviewFinalizeList == null){ return null; }
for(int i = 0; i < reviewFinalizeList.size(); i++)
{
ReviewFinalize reviewFinalize = (ReviewFinalize)reviewFinalizeList.get(i);
if(step.equalsIgnoreCase(reviewFinalize.getStep())){ return reviewFinalize; }
}
return new ReviewFinalize();
}
public static boolean isCompleted(List reviewFinalizeList)
{
boolean completed = true;
if(reviewFinalizeList == null || reviewFinalizeList.size() < 1){ return false; }
for(int i = 0; i < reviewFinalizeList.size(); i++)
{
ReviewFinalize reviewFinalize = (ReviewFinalize)reviewFinalizeList.get(i);
if(!reviewFinalize.isReviewCompleted())
{
completed = false;
i = reviewFinalizeList.size();
}
}
return completed;
}
public static String getNotes(List reviewFinalizeList, String step)
{
if(reviewFinalizeList == null){ return ""; }
for(int i = 0; i < reviewFinalizeList.size(); i++)
{
ReviewFinalize reviewFinalize = (ReviewFinalize)reviewFinalizeList.get(i);
if(step.equalsIgnoreCase(reviewFinalize.getStep()))
{
return reviewFinalize.getNotes();
}
}
return "";
}
public Object executeTask (Object object) throws Exception
{
Map incomingRequest = (Map)object;
Object result = null;
try
{
this.setStatus(Status.SUCCEEDED);
}
catch (Exception e)
{
this.setStatus(Status.FAILED);
}
return result;
}
}
| [
"brickerz@9227675a-84a3-4efe-bc6c-d7b3a3cf6466"
]
| brickerz@9227675a-84a3-4efe-bc6c-d7b3a3cf6466 |
ceeea76782ae8687fc83ccd623881a1f14286ffd | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /frameworks/support/v7/mediarouter/dummy/Dummy.java | be16dc756b69e1717765518333fd75b79cb64105 | [
"MIT"
]
| permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | Java | false | false | 55 | java | // Dummy java file used to build the resource library.
| [
"[email protected]"
]
| |
25fd8d2bac96c24e81498052c01e6b362f94f0b4 | 2be1030cdf0204f47af66b5cac0832719de51936 | /android/app/src/main/java/com/wuduplz/MainActivity.java | 3c5037b90d6ae0536bffe07354c691958f2857fb | []
| no_license | levi0910/Wuduplz | edc59e965e62830cca45a06b9730b0ccd9d53f37 | 558ecb1bfe22d6f3a73b835baf5d71f440397b00 | refs/heads/master | 2023-07-14T07:25:37.044538 | 2021-08-14T00:58:17 | 2021-08-14T00:58:17 | 395,843,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package com.wuduplz;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "Wuduplz";
}
}
| [
"[email protected]"
]
| |
055202df29b680dadf09c66c4726159b57e18b41 | aad82f53c79bb1b0fa0523ca0b9dd18d8f39ec6d | /Shilpa Sreedhar K/jan30/pgm6_selectvalue_from_combobox.java | 38e9cdac98f1f4b8810e366207cfaad4b2612ef1 | []
| no_license | Cognizant-Training-Coimbatore/Lab-Excercise-Batch-2 | 54b4d87238949f3ffa0b3f0209089a1beb93befe | 58d65b309377b1b86a54d541c3d1ef5acb868381 | refs/heads/master | 2020-12-22T06:12:23.330335 | 2020-03-17T12:32:29 | 2020-03-17T12:32:29 | 236,676,704 | 1 | 0 | null | 2020-10-13T19:56:02 | 2020-01-28T07:00:34 | Java | UTF-8 | Java | false | false | 676 | java | import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class pgm6_selectvalue_from_combobox {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://examples.codecharge.com/Store/Default.php");
Select product= new Select(driver.findElement(By.name("category_id")));
product.selectByVisibleText("Databases");
Thread.sleep(5000);
driver.quit();
}
}
| [
"[email protected]"
]
| |
0f54809929f0c021016c4bb49211587fab273939 | 4a2af2384e44241922d4ef64eaf3b07d0bcc6540 | /10th - AP Comp Sci/9th - Computer Science/DTOIfElseConditionals.java | cc706a6f0a55e4962b273281bf503fb069cd3c81 | []
| no_license | RishiShah200/9th-10th-ComputerScience | 98d499179b3e913035e6e4873db79a7ec35d2ca9 | 42a48f63bf8ab19e8153e4aa40a29a02e7006efd | refs/heads/master | 2022-09-08T03:05:27.533384 | 2020-05-29T19:28:18 | 2020-05-29T19:28:18 | 267,938,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 162 | java | public class DTOIfElseConditionals{
public static void main(String[]args){
int x = 22;
int y = 23;
System.out.println(x>y?"X is larger" : "Y is larger");
}
} | [
"[email protected]"
]
| |
4fa35df9b6d839c9a345dd0bd059046370ce5c64 | 4e1538109c8bc93023ba13ae4eb06b650fcce58d | /app/src/main/java/com/sds/study/recordapp/record/FileListActivity.java | 4f9f2cb517db24a442bad1f4467cefc4de5f4958 | []
| no_license | mmdk77/RecordApp | e443f206c5cf6fd07508ac602e3c52d54c9507c5 | 07f2895efe2409a96fca8f3c930febf5c35c214e | refs/heads/master | 2020-07-11T19:05:28.406216 | 2016-11-17T08:35:21 | 2016-11-17T08:35:21 | 73,997,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,085 | java | package com.sds.study.recordapp.record;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.sds.study.recordapp.R;
/**
* Created by seon on 2016-11-17.
* 녹음으로 인하여 생성된 파일을 목록으로 보여주고,
* 해당 파일 선택시 재생.
*/
public class FileListActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener{
String TAG;
ViewPager viewPager ; //Fragment 관리 객체
RecordPagerAdapter pagerAdapter; //Fragment Controller?
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TAG=this.getClass().getName();
Log.d(TAG,"FileListActivity"+this);
setContentView(R.layout.list_layout);
viewPager = (ViewPager)findViewById(R.id.viewPager); //연결하기 위해 ViewPager 아이디 값 가져오기
pagerAdapter = new RecordPagerAdapter(getSupportFragmentManager()); //getSupportFragmentManager는 AppCompatActivity일 경우에만 가능
viewPager.setAdapter(pagerAdapter); //ViewPager와 pagerAdapter 연결
//OnPageChangeListener 연결
viewPager.addOnPageChangeListener(this);
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//Log.d(TAG,"onPageScrolled");
}
@Override
public void onPageSelected(int position) { //페이지가 선택이 확정시 commit
Log.d(TAG,"onPageSelected");
DetailFragment detailFragment=(DetailFragment) pagerAdapter.fragments[1];
ListFragment listFragment=(ListFragment) pagerAdapter.fragments[0];
detailFragment.txt_filename.setText(listFragment.filename);
}
@Override
public void onPageScrollStateChanged(int state) {
//Log.d(TAG,"onPageScrollStateChanged");
}
}
| [
"[email protected]"
]
| |
211552082e31c8f79891e13c73f2548e57cba397 | a816331a511ae9e1b855e671c4d0d3e94fd06594 | /compilador/src/br/furb/semantico/Acao2.java | d76e950b7d28a9d40874b201918cdd1dcee42b51 | []
| no_license | lucianetedesco/furb-compiladores | 4564b9d85d32e35c6baf93cf3875d66987cc03df | b190b4acfebbc7398015c13ea3ca6dacfd38679c | refs/heads/master | 2020-11-24T09:59:15.212848 | 2019-12-14T22:14:05 | 2019-12-14T22:14:05 | 228,095,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,098 | java | package br.furb.semantico;
import java.util.Deque;
import java.util.List;
import java.util.Map;
import br.furb.common.Token;
import br.furb.utils.Messages;
import br.furb.utils.Types64;
public class Acao2 implements Acao {
@Override
public SemanticVariables execute(String tipo, String operadorRelacional, List<String> codigo, Map<String, String> ts,
List<String> listaID, Deque<String> pilhaDeTipos, Deque<String> pilhaDeRotulos, int ctLabel, Token token,
String input) throws SemanticError {
String tipo1 = pilhaDeTipos.pop();
String tipo2 = pilhaDeTipos.pop();
SemanticStaticUtils.throwSemanticException(tipo1, tipo2, Messages.ENCONPATIBLE_TYPES_ARITHMETIC_EXPRESSION, token, input);
if (Types64.FLOAT.equalsIgnoreCase(tipo1) || Types64.FLOAT.equalsIgnoreCase(tipo2)) {
pilhaDeTipos.push(Types64.FLOAT);
} else {
pilhaDeTipos.push(Types64.INT);
}
codigo.add("sub");
SemanticVariables variables = new SemanticVariables();
variables.setVariables(tipo, operadorRelacional, codigo, ts, listaID, pilhaDeTipos, pilhaDeRotulos, ctLabel);
return variables;
}
}
| [
"[email protected]"
]
| |
68ef4e5f0c5bde2581c865dc8f26c3f1d5246abf | 34024d875c324f5df16e4d324f96da315d3fb139 | /day11/elasticsearch-demo/src/test/java/com/leyou/demo/ElasticsearchDemoApplicationTests.java | cc01cd4379dbf3071ee78799aaa6a56540514fdb | [
"Apache-2.0"
]
| permissive | tiancixiong/leyou-demo | ff83c3e1930d49113c88f1bf3d075560b007309d | 598fdafb98c98c42035adb2be44722c3658b3c41 | refs/heads/master | 2021-09-25T09:30:10.106217 | 2021-09-21T04:24:31 | 2021-09-21T04:24:31 | 218,664,123 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package com.leyou.demo;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ElasticsearchDemoApplicationTests {
// @Test
// void contextLoads() {
// }
}
| [
"[email protected]"
]
| |
762fec897298795cc775ba013d5bf36b7ec54003 | 9a0727d356d4018962db9bccfa2afb31b0185428 | /src/main/java/com/itu/shareonwheels/service/LoginServiceImpl.java | e5c8c46d596ab79289b1a70eecfc4aebad9a920a | []
| no_license | nikitasonthalia/Maven_Project_With_RestAPI | 37babf57368b138cfd5f038c4975e99ae3df4f35 | 096b689e2b2f8042c5be8ca403afc75f75634593 | refs/heads/master | 2020-12-24T20:32:59.173352 | 2016-04-19T03:32:24 | 2016-04-19T03:32:24 | 56,412,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.itu.shareonwheels.service;
import com.itu.shareonwheels.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by nikitasonthalia on 10/10/15.
*/
@Service
public class LoginServiceImpl implements LoginService{
@Autowired
private UserDao userDao;
public String validateUser(String userName, String password)
{
return userDao.verifyLogin(userName,password);
}
}
| [
"[email protected]"
]
| |
03878df3d1adf467b63aa3d72da2aac93e35a6d3 | 625d9da6e2e3bc0a21e0ee8eccb80c56dc2a9fda | /trainingjdbc/src/main/java/com/hasan/trainingjdbc/repository/InvoiceDetailsRepository.java | 7438352be1fff0f1c9e3842a5c6525d05e6be7b7 | []
| no_license | hasanikhsan17/trainingspringboot | 7c849db99951edc371611a76b9449bc322bb79f0 | d951839a019e0be16c9e922dbe11f13888b9dbd0 | refs/heads/master | 2022-05-17T20:43:55.432631 | 2020-04-29T09:27:52 | 2020-04-29T09:27:52 | 259,882,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.hasan.trainingjdbc.repository;
import java.util.List;
import com.hasan.trainingjdbc.entity.InvoiceDetails;
public interface InvoiceDetailsRepository {
public List<InvoiceDetails> getInvoiceDetail(int invoice_id);
} | [
"[email protected]"
]
| |
97a9dd77ae0dcb42d1220e83f59c108f5e4d5e41 | 8d2d46dc7a67e9d31edf40602e5f3290dbc22344 | /HR_Project_Maven/src/main/java/com/epam/zubar/hr/logic/CandidateLogic.java | aff19ff103eb52bd428f80a5b2a333a90c4d451f | []
| no_license | MikalaiZubar/Final_Project | e650eb0add0d9047e672b14a9b2770aefd957f28 | fa1c48107547e0374d111b3ad3452a9870a95049 | refs/heads/master | 2021-01-22T21:07:35.081585 | 2017-03-22T08:42:16 | 2017-03-22T08:42:16 | 85,395,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,107 | java | package com.epam.zubar.hr.logic;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import com.epam.zubar.hr.dao.AbstractDAO;
import com.epam.zubar.hr.dao.daofactory.AbstractDAOFactory;
import com.epam.zubar.hr.dao.daofactory.FactoryType;
import com.epam.zubar.hr.dao.mysqldao.CandidateDAO;
import com.epam.zubar.hr.db.ConnectionPool;
import com.epam.zubar.hr.entity.Candidate;
import com.epam.zubar.hr.entity.User;
import com.epam.zubar.hr.exception.HRProjectDAOException;
import com.epam.zubar.hr.exception.HRProjectLogicException;
/**
* contains various methods that use DAO layer to
* retrieve information from a database, add or update
* data, etc. These methods will be further used by Command layer.
* @author Mikalay Zubar
*
*/
public class CandidateLogic {
private ConnectionPool pool;
private Connection connection;
private AbstractDAOFactory factory;
public CandidateLogic(){
pool = ConnectionPool.getPool();
}
public List<Candidate> getCandidatesList() throws HRProjectLogicException{
List<Candidate> candidates = new ArrayList<>();
AbstractDAO<Candidate> dao = initDAOFactory().getCandidateDAO();
try {
candidates = dao.findAll();
} catch (HRProjectDAOException e) {
throw new HRProjectLogicException(
"Error. Unable to retrieve the list of Candidates!", e);
}finally{
pool.releaseConnection(connection);
}
return candidates;
}
public Candidate findCandidateByLogin(String login) throws HRProjectLogicException{
UserLogic ul = new UserLogic();
User user = ul.findUserByLogin(login);
Candidate candidate = null;
CandidateDAO dao = (CandidateDAO) initDAOFactory().getCandidateDAO();
try{
candidate = dao.findCandidateById(user.getId());
}catch (HRProjectDAOException e) {
throw new HRProjectLogicException(
"Error. Unable to retrieve a Candidate!", e);
}finally{
pool.releaseConnection(connection);
}
return candidate;
}
public Candidate findCandidateById(int id) throws HRProjectLogicException{
Candidate candidate = null;
CandidateDAO dao = (CandidateDAO) initDAOFactory().getCandidateDAO();
try{
candidate = dao.findCandidateById(id);
}catch (HRProjectDAOException e) {
throw new HRProjectLogicException(
"Error. Unable to retrieve a Candidate!", e);
}finally{
pool.releaseConnection(connection);
}
return candidate;
}
public boolean updateCandidate(Candidate candidate, int id) throws HRProjectLogicException{
boolean isUpdated = false;
AbstractDAO<Candidate> dao = initDAOFactory().getCandidateDAO();
try{
isUpdated = dao.update(candidate, id);
}catch(HRProjectDAOException e) {
throw new HRProjectLogicException("Error. Unable to update Candidates's data!", e);
} finally {
pool.releaseConnection(connection);
}
return isUpdated;
}
public boolean addNewCandidate(Candidate candidate) throws HRProjectLogicException{
boolean isAdded = false;
UserLogic ul = new UserLogic();
User user = ul.findUserById(candidate.getId());
if(user == null){
return isAdded;
}
AbstractDAO<Candidate> dao = initDAOFactory().getCandidateDAO();
try{
isAdded = dao.insert(candidate);
}catch(HRProjectDAOException e) {
throw new HRProjectLogicException("Error. Unable to add new Candidate!", e);
} finally {
pool.releaseConnection(connection);
}
return isAdded;
}
// initializes connection and DAO factory
private AbstractDAOFactory initDAOFactory() {
connection = pool.getConnection();
factory = AbstractDAOFactory.getDAOFactory(connection, FactoryType.MYSQL);
return factory;
}
}
| [
"[email protected]"
]
| |
e79a30593fa7c5a6b33336bde53781c1a936d88f | 05d5560f3b3f744ddd5d642720c8d1433d8ddce3 | /Entrega_Final/virtualstore/src/main/java/es/udc/mashup/productprovider/ebay/wsdl/ErrorSeverity.java | 601a45cea5f46a541ecd6025733e8712374da745 | []
| no_license | ricardodejuan/java-mashup | 7326aecb119a5aad0a78509b7bb9334630f62816 | 4173d3f3c1f6138bb7f6c3ccbf4f341c423cba61 | refs/heads/master | 2016-09-11T11:53:48.443059 | 2014-04-03T19:30:07 | 2014-04-03T19:30:07 | 17,154,041 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,110 | java |
package es.udc.mashup.productprovider.ebay.wsdl;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ErrorSeverity.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="ErrorSeverity">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="Error"/>
* <enumeration value="Warning"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "ErrorSeverity")
@XmlEnum
public enum ErrorSeverity {
/**
*
* eBay encountered a fatal error during the processing of the request,
* causing the request to fail. When eBay encounters an error, it returns
* error data instead of the requested business data. Inspect the error
* details and resolve the problem before resubmitting the request.
*
*
*/
@XmlEnumValue("Error")
ERROR("Error"),
/**
*
* The request was successfully processed, but eBay encountered a non-fatal
* error during the processing that could affect the data returned. For
* example, eBay might have changed the value of an input field. In this
* case, eBay returns a successful response, but it also returns a warning.
* For best results, requests should return without warnings. Inspect the
* warning details and resolve the problem before resubmitting the request.
*
*
*/
@XmlEnumValue("Warning")
WARNING("Warning");
private final String value;
ErrorSeverity(String v) {
value = v;
}
public String value() {
return value;
}
public static ErrorSeverity fromValue(String v) {
for (ErrorSeverity c: ErrorSeverity.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"[email protected]"
]
| |
3984fbde8c9da0e5e631d9be2d4f057386306b6a | 1662b0f48ecd88920a692128d5a169cfb9ca2f57 | /src/main/java/com/hnguigu/demo/tools/CalculateUtil.java | 42df2cfaaea6cd352100552e2a22f130b1d4b6e9 | []
| no_license | oneboat/SpringBootDuDu | 2e06716821dc4ee3954ae5020668eaddd8891979 | 6c63ada58ee95c691cb3f7ad2e8d9271f1e934ea | refs/heads/master | 2020-05-02T12:38:00.458523 | 2018-09-12T03:13:05 | 2018-09-12T03:13:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,097 | java | package com.hnguigu.demo.tools;
import java.util.Random;
public class CalculateUtil {
//随机码字典集
private static final String RANDOM_STR="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/**
* 取某个范围的任意数
* @param min
* @param max
* @return
*/
public static int getNext(int min, int max) {
Random random = new Random();
int s = random.nextInt(max) % (max - min + 1) + min;
return s;
}
/**
* 取某个范围的任意数
* @param min
* @param max
* @return
*/
public static int getNext(int max) {
Random random = new Random();
int s = random.nextInt(max) ;
return s;
}
/**
* 生成sum位随机码
* @return
*/
public static String generateDigitRandomCode(int sum){
Random rd = new Random();
String n = "";
int getNum;
do {
getNum = Math.abs(rd.nextInt(Integer.MAX_VALUE)) % 10 + 48;// 产生数字0-9的随机数
char num1 = (char) getNum;
String dn = Character.toString(num1);
n += dn;
} while (n.length() < sum);
return n;
}
/**
* 生成sum位数字字母随机码
* @param sum
* @return
*/
public static String generateMixRandomCode(int sum){
Random random = new Random();
StringBuffer sb = new StringBuffer();
for(int i = 0 ; i < sum; ++i){
int number = random.nextInt(62);//[0,62)
sb.append(RANDOM_STR.charAt(number));
}
return sb.toString();
}
/**
* IP 地址转换成 long 数据
* @param ipAddress
* @return
*/
public static long ipAddressToLong(String ipAddress) {
long ipInt = 0;
if (ValidatorUtil.isIPv4Address(ipAddress)) {
String[] ipArr = ipAddress.split("\\.");
if (ipArr.length == 3) {
ipAddress = ipAddress + ".0";
}
ipArr = ipAddress.split("\\.");
long p1 = Long.parseLong(ipArr[0]) * 256 * 256 * 256;
long p2 = Long.parseLong(ipArr[1]) * 256 * 256;
long p3 = Long.parseLong(ipArr[2]) * 256;
long p4 = Long.parseLong(ipArr[3]);
ipInt = p1 + p2 + p3 + p4;
}
return ipInt;
}
}
| [
"[email protected]"
]
| |
214a341d9df0210efd52b0dea04810765cde1373 | 906fd7389da7f31f087498a5c74a10d126e5d58a | /ruoyi/src/main/java/com/ruoyi/project/sjbapi/request/ReceiptModel.java | 5d15d16c25aca0ecc72ed600ff5e8c38200a75ad | [
"MIT"
]
| permissive | testerwang11/RuoYi-Vue | 1c6b5c35221c08e7a2c37f3e03f14b51c89d50c9 | 906c0cf261eba7c869e2305afd8b50926eabb430 | refs/heads/master | 2021-01-14T06:52:53.834762 | 2020-07-03T06:02:00 | 2020-07-03T06:02:00 | 242,632,061 | 0 | 0 | MIT | 2020-04-18T02:58:28 | 2020-02-24T02:46:10 | null | UTF-8 | Java | false | false | 924 | java | package com.ruoyi.project.sjbapi.request;
import lombok.Data;
import javax.validation.constraints.Digits;
import java.io.Serializable;
import java.util.List;
/**
* @ProjectName: v1.1.1
* @Package: com.sijibao.pay.model
* @ClassName: ReceiptModel
* @Description: java类作用描述
* @Author: Niki Zheng
* @CreateDate: 2019/5/28 11:05
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Data
public class ReceiptModel implements Serializable {
/**
* 如果有定义父级目录需要传此字段可以单级目录也可以多级目录(例如: zhangsan , 或者 zhangsan/2019)
*/
private String parentUrl;
/**
* 所有的第三方支付单号放入list中
*/
List<String> list;
/**
* payType 获取电子回单类型: 1交易类,2 ,充值入金类
*/
@Digits(integer = 2,fraction = 0,message = "交易类型错误!")
private int payType;
} | [
"[email protected]"
]
| |
3ecce36206f1f27c23450721784bc3f46d2a4f3f | 72532411ad90a7100400f8a4729b0416c47cef24 | /src/main/java/org/example/jchess/MoveSerializer.java | 3bdfd71eaf583655f11a78afa9deb9c84d690fb7 | []
| no_license | drumi/jchess | 6ea51f3973994b81140b7d3bb5be5d70d951aca0 | a7188818c6236174c239b1bfdf6939f270bfaa50 | refs/heads/main | 2023-08-01T06:30:16.642973 | 2021-09-20T00:13:25 | 2021-09-20T00:20:13 | 406,032,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 135 | java | package org.example.jchess;
public interface MoveSerializer {
byte[] serialize(Move move);
Move deserialize(byte[] bytes);
}
| [
"[email protected]"
]
| |
81994a3874b8a53f09a435d11a1b1cc8a7fa31eb | de4805b589a72169616b1d04439fde378ca06c4b | /src/main/java/ch/pschatzmann/jflightcontroller4pi/integration/MavlinkDevice.java | 5b52e00dfd28629d4c1536249ab2109d74c723e4 | []
| no_license | pschatzmann/jflightcontroller4pi | 961b663156a9676ee76ffec407edcd7d75e72238 | fcfe46d2846d3e3451fb04f8440a0e7289d8b070 | refs/heads/master | 2022-12-17T06:49:58.120961 | 2020-01-31T16:36:18 | 2020-01-31T16:36:18 | 216,637,195 | 1 | 0 | null | 2022-12-06T00:43:58 | 2019-10-21T18:24:47 | Java | UTF-8 | Java | false | false | 14,880 | java | package ch.pschatzmann.jflightcontroller4pi.integration;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.DatagramChannel;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.pschatzmann.jflightcontroller4pi.FlightController;
import ch.pschatzmann.jflightcontroller4pi.devices.IDevice;
import ch.pschatzmann.jflightcontroller4pi.devices.ISensor;
import ch.pschatzmann.jflightcontroller4pi.modes.IFlightMode;
import ch.pschatzmann.jflightcontroller4pi.parameters.ParameterValue;
import ch.pschatzmann.jflightcontroller4pi.parameters.ParametersEnum;
import io.dronefleet.mavlink.Mavlink2Message;
import io.dronefleet.mavlink.MavlinkConnection;
import io.dronefleet.mavlink.MavlinkMessage;
import io.dronefleet.mavlink.common.Attitude;
import io.dronefleet.mavlink.common.AutopilotVersion;
import io.dronefleet.mavlink.common.CommandAck;
import io.dronefleet.mavlink.common.CommandLong;
import io.dronefleet.mavlink.common.FollowTarget;
import io.dronefleet.mavlink.common.GlobalPositionInt;
import io.dronefleet.mavlink.common.GpsInput;
import io.dronefleet.mavlink.common.Heartbeat;
import io.dronefleet.mavlink.common.ManualControl;
import io.dronefleet.mavlink.common.MavAutopilot;
import io.dronefleet.mavlink.common.MavCmd;
import io.dronefleet.mavlink.common.MavEstimatorType;
import io.dronefleet.mavlink.common.MavModeFlag;
import io.dronefleet.mavlink.common.MavParamType;
import io.dronefleet.mavlink.common.MavProtocolCapability;
import io.dronefleet.mavlink.common.MavResult;
import io.dronefleet.mavlink.common.MavState;
import io.dronefleet.mavlink.common.MavSysStatusSensor;
import io.dronefleet.mavlink.common.MavType;
import io.dronefleet.mavlink.common.MissionCount;
import io.dronefleet.mavlink.common.MissionRequestList;
import io.dronefleet.mavlink.common.Odometry;
import io.dronefleet.mavlink.common.ParamRequestList;
import io.dronefleet.mavlink.common.ParamRequestRead;
import io.dronefleet.mavlink.common.ParamSet;
import io.dronefleet.mavlink.common.ParamValue;
import io.dronefleet.mavlink.common.ProtocolVersion;
import io.dronefleet.mavlink.common.RawImu;
import io.dronefleet.mavlink.common.SysStatus;
import io.dronefleet.mavlink.common.SystemTime;
/**
* Simple Mavlink command handler which uses UDP to communicate
*
* @author pschatzmann
*
*/
public class MavlinkDevice implements IDevice {
private static final Logger log = LoggerFactory.getLogger(MavlinkDevice.class);
private static String uid = UUID.randomUUID().toString();
private FlightController flightController;
private int port = 14550;
private int systemId = 1; // this device
private int componentId = 1;
private MavlinkConnection connection;
private boolean isArmed = false;
private long lastHartBeat;
private int version = 200;
private long bootTime = System.currentTimeMillis();
private boolean setup = true;
private DatagramSocket socket;
private UDPInputStream is;
private UDPOutputStream out;
private double frequency;
@Override
public void setup(FlightController flightController) {
log.info("setup");
try {
this.flightController = flightController;
socket = new DatagramSocket(port);
is = new UDPInputStream(socket);
out = new UDPOutputStream(socket);
connection = MavlinkConnection.create(is, out);
log.info("Mavlink is available on port {}", port);
// read and process messages
new Thread() {
public void run() {
log.info("setting up Mavlink read thread");
while (true) {
MavlinkMessage message = next();
if (message != null) {
processMessage(message);
}
}
};
}.start();
// send messages
new Thread() {
public void run() {
log.info("setting up Mavlink write thread");
while (true) {
try {
if (connection != null && is.getAddress()!=null) {
out.setAddress(is.getAddress());
log.info("send...");
if (setup) {
sendHeatBeat();
sendStatus();
setup = false;
}
sendIMU();
sendHeatBeat();
}
} catch (Exception e) {
log.error(e.getMessage(),e);
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
}.start();
} catch(Exception ex) {
log.error(ex.getMessage(),ex);
}
}
protected void sendIMU() throws IOException {
// Raw IMU values
RawImu imu = RawImu.builder().xacc(value(ParametersEnum.ACCELEROMETERX)).yacc(value(ParametersEnum.ACCELEROMETERY))
.zacc(value(ParametersEnum.ACCELEROMETERZ)).xgyro(value(ParametersEnum.GYROX)).ygyro(value(ParametersEnum.GYROY))
.zgyro(value(ParametersEnum.GYROZ)).xmag(value(ParametersEnum.MAGNETOMETERX)).ymag(value(ParametersEnum.MAGNETOMETERY))
.zmag(value(ParametersEnum.MAGNETOMETERZ)).temperature(value(ParametersEnum.TEMPERATURE)).build();
connection.send2(systemId, componentId, imu);
// IMU pitch/roll/yaw
float pitch = (float) Math.toRadians(this.flightController.getValue(ParametersEnum.SENSORPITCH).value);
float roll = (float) Math.toRadians(this.flightController.getValue(ParametersEnum.SENSORROLL).value);
float yaw = (float) Math.toRadians(this.flightController.getValue(ParametersEnum.SENSORYAW).value);
long time = System.currentTimeMillis() - bootTime;
Attitude att = Attitude.builder().pitch((float) pitch).roll(roll).yaw(yaw).timeBootMs(time).build();
connection.send2(systemId, componentId, att);
log.info("pitch: {} / roll: {} / yaw: {}",pitch, roll, yaw);
};
protected int value(ParametersEnum p) {
ParameterValue pv = this.flightController.getValue(p);
return pv == null ? 0 : (int) pv.value;
}
protected void sendStatus() throws IOException {
SysStatus status;
if (this.flightController.getValue(ParametersEnum.GYROX) == null) {
status = SysStatus.builder().onboardControlSensorsPresent(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_3D_ACCEL)
.onboardControlSensorsPresent(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_3D_GYRO)
.onboardControlSensorsPresent(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_3D_MAG)
.onboardControlSensorsPresent(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE).build();
send(status);
} else {
status = SysStatus.builder().onboardControlSensorsEnabled(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_3D_ACCEL)
.onboardControlSensorsEnabled(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_3D_GYRO)
.onboardControlSensorsEnabled(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_3D_MAG)
.onboardControlSensorsEnabled(MavSysStatusSensor.MAV_SYS_STATUS_SENSOR_ABSOLUTE_PRESSURE).build();
send(status);
}
}
protected void sendHeatBeat() {
Heartbeat heartbeat = Heartbeat.builder().type(MavType.MAV_TYPE_VTOL_QUADROTOR.MAV_TYPE_GENERIC).baseMode(getMavModeFlag()).customMode(0)
.autopilot(MavAutopilot.MAV_AUTOPILOT_GENERIC).systemStatus(getMavState()).mavlinkVersion(version).build();
// Write an unsigned heartbeat
try {
connection.send2(systemId, componentId, heartbeat);
} catch (IOException e) {
log.error("Could not send via mavlink", e);
close();
}
}
protected void send(Object status) {
try {
connection.send2(systemId, componentId, status);
} catch (IOException e) {
log.error("Could not send message", e);
}
}
protected MavModeFlag getMavModeFlag() {
MavModeFlag result = null;
result = MavModeFlag.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED;
String name = this.flightController.getMode().getName();
if (name.equalsIgnoreCase("stabilizedMode")) {
result = MavModeFlag.MAV_MODE_FLAG_STABILIZE_ENABLED;
}
return isArmed() ? result.MAV_MODE_FLAG_SAFETY_ARMED : result;
}
protected MavState getMavState() {
return MavState.MAV_STATE_ACTIVE;
}
protected void processMessage(MavlinkMessage message) {
Object payload = getPayload(message);
if (message.getOriginSystemId()==systemId) {
log.warn("Message received from same system - this is ignored!");
return;
}
if (payload instanceof SystemTime) {
SystemTime time = (SystemTime) payload;
log.info("time {}", time.timeUnixUsec());
} else if (payload instanceof Heartbeat) {
// This is a heartbeat message
MavlinkMessage<Heartbeat> heartbeatMessage = (MavlinkMessage<Heartbeat>) message;
lastHartBeat = System.currentTimeMillis();
} else if (payload instanceof ParamRequestList) {
log.debug("ParamRequestList");
for (ParametersEnum p : ParametersEnum.values()) {
ParameterValue pv = flightController.getParameterStore().getValue(p);
if (pv != null) {
ParamValue parValue = ParamValue.builder().paramId(p.name()).paramType(MavParamType.MAV_PARAM_TYPE_REAL64).paramValue((float)pv.value)
.build();
send(parValue);
log.info("-> {}", p.name());
}
}
} else if (payload instanceof ParamRequestRead) {
log.debug("ParamRequestRead");
ParamRequestRead ps = (ParamRequestRead) payload;
ParametersEnum par = ParametersEnum.valueOf(ps.paramId());
// return the actual parameter value
ParamValue parValue = ParamValue.builder().paramId(par.name()).paramType(MavParamType.MAV_PARAM_TYPE_REAL64).paramValue((float) this.flightController.getValue(par).value).build();
send(parValue);
} else if (payload instanceof ParamSet) {
log.debug("ParamSet");
ParamSet ps = (ParamSet) payload;
ParametersEnum par = ParametersEnum.valueOf(ps.paramId());
boolean updated = true;
if (par==ParametersEnum.FLIGHTMODE) {
updated = this.setMode(ps.paramValue());
}
// return the actual parameter value
ParamValue parValue = ParamValue.builder().paramId(par.name()).paramType(MavParamType.MAV_PARAM_TYPE_REAL64).paramValue((float) this.flightController.getValue(par).value).build();
send(parValue);
} else if (payload instanceof MissionRequestList) {
log.debug("MissionRequestList");
MissionCount mc = MissionCount.builder().count(0).build();
send(mc);
} else if (payload instanceof ManualControl) {
log.debug("ManualControl");
ManualControl mc = (ManualControl) payload;
if (isValid(mc.z()))
flightController.setValue(ParametersEnum.THROTTLE, mc.z()/1000.0);
if (isValid(mc.r()))
flightController.setValue(ParametersEnum.RUDDER, mc.r()/1000.0);
if (isValid(mc.x()))
flightController.setValue(ParametersEnum.ELEVATOR, mc.x()/-1000.0);
if (isValid(mc.y()))
flightController.setValue(ParametersEnum.AILERON, mc.y()/1000.0);
} else if (payload instanceof FollowTarget) {
log.info("FollowTarget {} -> not implemente!",payload.toString());
FollowTarget ft = (FollowTarget) payload;
} else if (payload instanceof CommandLong) {
CommandLong cmd = (CommandLong) payload;
CommandAck ack;
switch (cmd.command().entry()) {
case MAV_CMD_COMPONENT_ARM_DISARM:
log.info("MAV_CMD_COMPONENT_ARM_DISARM");
boolean active = (cmd.param1() == 1.0f);
this.setArmed(active);
log.info("armed {}", active);
ack = CommandAck.builder().command(MavCmd.MAV_CMD_COMPONENT_ARM_DISARM).result(MavResult.MAV_RESULT_ACCEPTED).build();
send(ack);
break;
case MAV_CMD_REQUEST_PROTOCOL_VERSION:
log.debug("MAV_CMD_REQUEST_PROTOCOL_VERSION");
ack = CommandAck.builder().command(MavCmd.MAV_CMD_REQUEST_PROTOCOL_VERSION).result(MavResult.MAV_RESULT_UNSUPPORTED).build();
send(ack);
break;
case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES:
log.info("MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES");
float version = cmd.param1();
ack = CommandAck.builder().command().result(MavResult.MAV_RESULT_UNSUPPORTED).build();
send(ack);
//AutopilotVersion apv = AutopilotVersion.builder().capabilities(MavProtocolCapability.MAV_PROTOCOL_CAPABILITY_COMPASS_CALIBRATION.MAV_PROTOCOL_CAPABILITY_FLIGHT_INFORMATION.MAV_PROTOCOL_CAPABILITY_FLIGHT_TERMINATION).uid2(uid.toString().getBytes()).build();
//send(apv);
break;
default:
log.info("CommandLong: {} {} {}", payload.getClass().getSimpleName(), cmd.command().entry(), payload.toString());
break;
}
} else {
log.info("Unhandled Message: {} {}", payload.getClass().getSimpleName(), message);
}
}
private boolean isValid(int y) {
return y >= -1000 && y <= 1000;
}
private boolean setMode(float mode) {
try {
int pos = (int) (mode/1.4E-45f);
IFlightMode fmode = this.flightController.getModes().get(pos);
this.flightController.setMode(fmode);
log.info("setMode {}",fmode.getName());
return true;
} catch(Exception ex) {
log.error("Could not set mode",ex);
return false;
}
}
protected Object getPayload(MavlinkMessage message) {
Object payload = message.getPayload();
Mavlink2Message message2;
if (message instanceof Mavlink2Message) {
// This is a Mavlink2 message.
message2 = (Mavlink2Message) message;
payload = message2.getPayload();
}
return payload;
}
/**
* Returns the next mavlink message
*
* @return
*/
protected MavlinkMessage next() {
if (connection != null) {
try {
return connection.next();
} catch (IOException e) {
log.error("Next has failed - we reset the connection", e);
close();
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
}
return null;
}
private void close() {
log.info("close");
try {
if (socket!=null) {
socket.close();
}
} catch (Exception e1) {
}
connection = null;
setup = true;
}
/**
* @return the port
*/
public int getPort() {
return port;
}
/**
* @param port
* the port to set
*/
public void setPort(int port) {
this.port = port;
}
@Override
public void shutdown() {
log.info("shutdown");
close();
try {
//serverSocket.close();
socket.close();
} catch (Exception e) {
}
}
@Override
public String getName() {
return this.getClass().getSimpleName();
}
/**
* Checks if the vehicle is armed
*
* @return the isArmed
*/
public boolean isArmed() {
return isArmed;
}
/**
* Defines the armed status of the vehicle
*
* @param isArmed
* the isArmed to set
*/
public void setArmed(boolean isArmed) {
this.isArmed = isArmed;
}
@Override
public void setFrequency(double frequency) {
this.frequency = frequency;
}
@Override
public double getFrequency() {
return this.frequency;
}
@Override
public String toString() {
return this.getName();
}
}
| [
"[email protected]"
]
| |
0911537792b324b178e80ade1c6634dfc2271eec | 0d17b1b50590b7094b20b62b4e28b5ba0d8c84b6 | /BackEnd/src/main/java/com/niit/Model/OutputMessage.java | e92f41d20dc3ee9c3e6698da50506ee25a10e159 | []
| no_license | syamadhiju/WotApp | 6280109b126de3b1a30e5ae57dce135796fff8f4 | 09dd0549808acaa1df3cb0f5daa74546da27b6ae | refs/heads/master | 2021-05-04T16:49:22.540693 | 2018-02-08T12:42:16 | 2018-02-08T12:42:16 | 120,258,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.niit.Model;
import java.util.Date;
public class OutputMessage extends Message {
private Date time;
public OutputMessage(Message original, Date time) {
super(original.getId(), original.getMessage());
this.time = time;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
}
| [
"[email protected]"
]
| |
5ea1519cea0463af88d5965365e23b90d72afc8c | d5b1beab4cd257001ba8d9812d8d3aee8e4f1a1d | /jsweet-quickstart/src/main/java/jsweet/dom/TextRangeCollection.java | edeed5c8ba12d35d2ed887945b4300e694501815 | [
"Apache-2.0"
]
| permissive | liuyaoao/polymer-project | 65e6ace94b150c16a93ac9cfe559b35529192232 | 0b10de5658b059ad544f48a856fca8c452b65ef4 | refs/heads/master | 2021-01-24T18:25:50.899371 | 2017-12-18T02:13:02 | 2017-12-18T02:13:02 | 84,430,279 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 477 | java | package jsweet.dom;
public class TextRangeCollection extends jsweet.lang.Object implements Iterable<TextRange> {
public double length;
native public TextRange item(double index);
native public TextRange $get(double index);
public static TextRangeCollection prototype;
public TextRangeCollection(){}
/** From Iterable, to allow foreach loop (do not use directly). */
@jsweet.lang.Erased
native public java.util.Iterator<TextRange> iterator();
}
| [
"[email protected]"
]
| |
6d8c3ecd8f91ce8b2fd35e540f3dc88ef5e14f5c | 38c1f19b74b76e1896830150264becc846398437 | /app/src/main/java/com/example/gluconnect/Models/MedicationsResponse.java | a1c23f2f586ac19d7aef71f0e57b718c26afa9a3 | []
| no_license | Anniekobia/Gluguard | 89a61efd13d30bab483d21c645f12bbc1b9f3c8d | a07aaa99a17c4b68a866507a2b90250a4056b2ef | refs/heads/master | 2021-06-25T23:52:36.160642 | 2021-01-28T04:35:40 | 2021-01-28T04:35:40 | 206,734,271 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java |
package com.example.gluconnect.Models;
import java.util.List;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class MedicationsResponse {
@SerializedName("medications")
private List<Medication> mMedications;
@SerializedName("success")
private Long mSuccess;
public List<Medication> getMedications() {
return mMedications;
}
public void setMedications(List<Medication> medications) {
mMedications = medications;
}
public Long getSuccess() {
return mSuccess;
}
public void setSuccess(Long success) {
mSuccess = success;
}
}
| [
"[email protected]"
]
| |
e6cd83b524f9c6037ec2375b04738b5826fddcb0 | 82671e3c703b1d737ae8cbc03a59a2678c8a5b12 | /src/main/java/de/jaide/courier/CourierService.java | 746afeb0285d34412b538e2cde1c29f1fb6c137d | [
"Apache-2.0"
]
| permissive | JAIDE/courier | acef14de551cc4cc730a667c028263f2e727db0f | 0a20ad99169373caf7874fdce82539794153f53a | refs/heads/master | 2021-01-22T13:58:04.879841 | 2013-09-02T12:56:17 | 2013-09-02T12:56:17 | 9,693,615 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,911 | java | /*
* Copyright 2011-2013 JAIDE GmbH
*
* 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 de.jaide.courier;
import java.io.IOException;
import de.jaide.courier.email.MessageHandlerEMail;
/**
* Instantiates the Singleton and provides static methods for returning handler services.
*
* @author Rias A. Sherzad, JAIDE GmbH // http://www.jaide.de
*/
public class CourierService {
/**
* Singleton pattern...
*/
private static CourierService instance = new CourierService();
/**
* The message handler for sending e-mails
*/
MessageHandlerEMail email = null;
/**
* Singleton pattern...
*/
private CourierService() {
}
/**
* Returns the only instance of this class.
*
* @return The only instance of this class.
*/
public static CourierService getInstance() {
return instance;
}
/**
* Returns the message handler for e-mails.
*
* @param smtpConfiguration The classpath: URL to the SMTP configuration (JSON file). May be null if called more than once.
* @return The message handler for e-mails
* @throws IOException Thrown, if the SMTP configuration couldn't be read.
*/
public MessageHandlerEMail getMessageHandlerEMail(String smtpConfiguration) throws IOException {
/*
* Lazily initialized
*/
if (email == null)
email = new MessageHandlerEMail(smtpConfiguration);
return email;
}
}
| [
"[email protected]"
]
| |
a2cc3ec6275f05b0d587d4218dfa25440c8953c2 | 72e133c5bc02fe4e02cf6beeafd19f0909bdf0ee | /piscicultura/src/main/java/br/net/biosenselab/piscicultura/repositories/UsuarioRepository.java | b7dabf2a1c1529a4fba12b0adac7c7f0f098a4a6 | []
| no_license | adrianosis/piscicultura | 02945cd8051d2adaeefbd6292c0eb55a24420385 | 137048866cd3c4a90c02f0a5afad1ae926aa657f | refs/heads/master | 2020-12-24T12:12:56.299387 | 2016-09-21T11:27:54 | 2016-09-21T11:27:54 | 73,068,128 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package br.net.biosenselab.piscicultura.repositories;
import br.net.biosenselab.piscicultura.models.Usuario;
import java.util.HashMap;
import javax.persistence.EntityManager;
/**
*
* @author Francisco Adriano da Silva
*/
public class UsuarioRepository extends BasicRepository {
public UsuarioRepository(EntityManager em) {
super(em);
}
public Usuario findByNome(String usuarioNome) {
try {
params = new HashMap<>();
query = new StringBuilder("select u from Usuario u ");
query.append("where u.nome = :usuarioNome");
params.put("usuarioNome", usuarioNome);
return findEntity(Usuario.class, query.toString(), params);
} catch (Exception e) {
throw e;
}
}
}
| [
"Adriano@DESKTOP-3TMEHU3"
]
| Adriano@DESKTOP-3TMEHU3 |
e7fbedc7c74e93f4545111d74d915a8316facad3 | 85bd7067c9be43f71b0663abc680c01048407c03 | /Extrct second digit from the first/Main.java | 4f42b2d1ad32744f06b347e3172bcf824601762b | []
| no_license | saikrishna9542/Playground | c103841e894df05eb5e612c4067b50523b5044fe | 264bae347d57474a35ddc4c7236195339a7fae07 | refs/heads/master | 2021-07-11T19:06:12.626160 | 2020-07-02T11:59:27 | 2020-07-02T11:59:27 | 166,536,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | import java.util.Scanner;
class Main {
public static void main (String[] args){
// Type your code here
Scanner v = new Scanner(System.in);
int n= v.nextInt();
while(n>99)
{
n=n/10;
}
int sl=n%10;
System.out.println(sl);
}
} | [
"[email protected]"
]
| |
3c26c72c07088cd0196f00e09d0e894a780f3009 | e8ecae9f49372129c3b19963411d7d98c66d2568 | /serv-wx/src/main/java/com/github/gserv/serv/wx/service/accept/NoticeAcceptService.java | b2a2a8d442d210f602cd3de31ba1612760471666 | [
"Apache-2.0"
]
| permissive | gserv/serv | 1f6218d2ba126ed6043b71ae10c9582cda3af42d | 9c67bceb09283025bbcbe2e001038866af81e7b8 | refs/heads/master | 2016-08-11T02:16:34.967435 | 2016-03-24T15:24:03 | 2016-03-24T15:24:03 | 53,813,353 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,629 | java | package com.github.gserv.serv.wx.service.accept;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.gserv.serv.commons.JsonUtils;
import com.github.gserv.serv.wx.message.revc.AbstractRevcMessage;
import com.github.gserv.serv.wx.message.send.AbstractSendMessage;
import com.github.gserv.serv.wx.service.manager.WxServiceManager;
import com.github.gserv.serv.wx.service.multiple.WxServiceMultipleManager;
import com.github.gserv.serv.wx.support.MessageHandlerException;
import com.github.gserv.serv.wx.support.WxMessageHandler;
import com.github.gserv.serv.wx.support.cache.Cache;
/**
* 微信通知受理服务
* @author shiying
*
*/
public class NoticeAcceptService {
private static final Logger logger = LoggerFactory.getLogger(NoticeAcceptService.class);
/**
* 消息分发器
*/
private WxMessageHandler wxMessageHandler;
/**
* 服务管理器(优先)
*/
private WxServiceManager wxServiceManager;
/**
* 支持多应用的服务管理器
*/
private WxServiceMultipleManager wxServiceMultipleManager;
/**
* 获取服务管理器
* @return
*/
private WxServiceManager getWxServiceManager(NoticeAcceptContext noticeAcceptContext) {
if (wxServiceManager != null) {
return wxServiceManager;
} else if (wxServiceMultipleManager == null || noticeAcceptContext.getAccessid() == null) {
return null;
} else {
return wxServiceMultipleManager.getWxServiceManager(noticeAcceptContext.getAccessid());
}
}
/**
* 微信通知消息受理
*
* accessid 系统的接入ID,通过该ID查找访问的微信配置
* sign 接入ID签名,用来验证accessid的有效性
* signature 签名(微信接入验证)
* timestamp 时间戳(微信接入验证)
* nonce 随机数(微信接入验证)
* echostr 唯一字符串(微信接入验证)
* resbody 接收内容
*
* @return
* @throws MessageHandlerException
*/
public String accept(NoticeAcceptContext noticeAcceptContext
) throws MessageHandlerException {
// 获取服务管理器
WxServiceManager wxServiceManager = getWxServiceManager(noticeAcceptContext);
if (wxServiceManager == null) {
throw new MessageHandlerException("not found weixin service manager, accessid["
+noticeAcceptContext.getAccessid()+"], sign["+noticeAcceptContext.getSign()+"]");
}
//
if (noticeAcceptContext.getEchostr() != null) {
logger.info("weixin access validate, noticeAcceptContext[{}]", JsonUtils.toJson(noticeAcceptContext));
// 计算签名
List<String> ss = new ArrayList<String>();
ss.add(noticeAcceptContext.getTimestamp());
ss.add(noticeAcceptContext.getNonce());
ss.add(wxServiceManager.getToken());
Collections.sort(ss);
StringBuilder builder = new StringBuilder();
for(String s : ss) {
builder.append(s);
}
@SuppressWarnings("deprecation")
String _signature = DigestUtils.shaHex(builder.toString());
if (noticeAcceptContext.getSignature().equalsIgnoreCase(_signature)) {
return noticeAcceptContext.getEchostr();
} else {
logger.warn("weixin access validate faild. signature[{}], expectation[{}]", noticeAcceptContext.getSignature(), _signature);
return "faild";
}
} else {
// 接收消息
if (noticeAcceptContext.getReqbody() == null || noticeAcceptContext.getReqbody().trim().length() <= 0) {
logger.warn("Illegal weixin message [{}]", noticeAcceptContext.getReqbody());
return "<xml>Illegal weixin message, " + noticeAcceptContext.getReqbody() + "</xml>";
}
logger.debug("revc weixin message [{}]", noticeAcceptContext.getReqbody());
AbstractRevcMessage revcObj = AbstractRevcMessage.parseWxRevcXml(noticeAcceptContext.getReqbody());
// 检查消息是否已经处理
String cacheKey = "revc_message_" + revcObj.getMsgId();
if (wxServiceManager.getWxService(Cache.class).get(cacheKey) != null) {
logger.warn("weixin message already accept, message [{}]", revcObj.toString());
return null;
}
wxServiceManager.getWxService(Cache.class).set(cacheKey, revcObj);
// 分发消息
try {
if (wxMessageHandler == null) {
logger.warn("not found wxMessage handler");
return null;
}
// 交给处理器处理
AbstractSendMessage sendObj = wxMessageHandler.messageHandler(revcObj, noticeAcceptContext);
if (sendObj == null) {
logger.debug("weixin message handle complate, but result message is null.");
return null;
}
// 全局属性赋值
sendObj.setCreateTime(new Date());
sendObj.setFromUserName(revcObj.getToUserName());
sendObj.setToUserName(revcObj.getFromUserName());
//
logger.debug("weixin message handle complate, sendMessage [{}]", sendObj.toWxXml());
// rebuild
sendObj.rebuild(wxServiceManager);
//
logger.debug("weixin message rebuild complate, sendMessage [{}]", sendObj.toWxXml());
//
return sendObj.toWxXml();
} catch (MessageHandlerException e) {
logger.warn("weixin message handle exception.", e);
return null;
}
}
}
public void setWxMessageHandler(WxMessageHandler wxMessageHandler) {
this.wxMessageHandler = wxMessageHandler;
}
public void setWxServiceManager(WxServiceManager wxServiceManager) {
this.wxServiceManager = wxServiceManager;
}
public void setWxServiceMultipleManager(
WxServiceMultipleManager wxServiceMultipleManager) {
this.wxServiceMultipleManager = wxServiceMultipleManager;
}
}
| [
"[email protected]"
]
| |
933c53f75ffe13e54b677300c2a490e574da135d | 1b356c4b870fdaa8f1a4878ecc5c84d4f60b766c | /src/leetcode/array/SearchInsertPosition.java | fb53ee693e2f0e367877193c3cbe011046b33333 | []
| no_license | ustc093/algorithm | 2b3bbb231e779bfb2056310741ca057335dd0415 | a7f59db7b37c75cc75d0f82cbab2450a668a3ac6 | refs/heads/master | 2020-11-24T19:52:47.259021 | 2020-05-15T07:38:59 | 2020-05-15T07:38:59 | 228,320,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 984 | java | package leetcode.array;
/**
* 35. 搜索插入位置
*
* 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。
* 你可以假设数组中无重复元素。
*
* 输入: [1,3,5,6], 5
* 输出: 2
*
* 输入: [1,3,5,6], 7
* 输出: 4
*
* @author gaozhen
* 2019年12月26日 17:59
*/
public class SearchInsertPosition {
public int searchInsert(int[] nums, int target) {
if (nums == null || nums.length == 0) {
return 0;
}
int left = 0;
int right = nums.length - 1;
while(left<=right){
int mid = (right+left)>>1;
if(nums[mid] == target){
return mid;
}else if(nums[mid] < target){
left = mid + 1;
}else if(nums[mid] > target){
right = mid - 1;
}
}
return left;
}
}
| [
"[email protected]"
]
| |
c2e401cc352a5ad96bd3e646f0bfee666b41fcfd | c2db9deb524c2e66cfa7cb6a9abf77cd0847f454 | /android/app/src/main/java/com/haihai34/MainActivity.java | 3ad27719349549f2fa7f19be19a196a1874f511a | []
| no_license | yeyesica/learn_react_native | a4df7f32f4371e57fb5441b82021e70adb109482 | b904255843b168699de87c13b845e6928e4f5e07 | refs/heads/master | 2020-03-27T09:13:49.491043 | 2018-10-06T13:51:32 | 2018-10-06T13:51:32 | 146,323,844 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.haihai34;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "haihai34";
}
}
| [
"[email protected]"
]
| |
da78e06bab8feb1195c5563f47bffb582f1e059d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_2f8b3c8446a1dbf579be545428384de3a1222248/ShopKeeper/6_2f8b3c8446a1dbf579be545428384de3a1222248_ShopKeeper_s.java | 6b2c25df1d9b521d5d359e0625d0a15f2c460550 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,368 | java | package game.things;
import game.*;
import java.util.*;
import serialization.*;
public class ShopKeeper extends Character implements Containable, Namable {
public static void makeSerializer(final SerializerUnion<GameThing> union, final GameWorld world){
union.addIdentifier(new SerializerUnion.Identifier<GameThing>(){
public String type(GameThing g){
return g instanceof ShopKeeper? "shopkeeper" : null;
}
});
union.addSerializer("shopkeeper", new Serializer<GameThing>(){
public Tree write(GameThing o){
ShopKeeper in = (ShopKeeper)o;
Tree out = new Tree();
out.add(new Tree.Entry("renderer", new Tree(in.renderer())));
out.add(new Tree.Entry("name", new Tree(in.name)));
out.add(new Tree.Entry("parts", Serializers.map(Serializers.Serializer_String, Container.serializer(union.serializer(), world)).write(in.parts)));
return out;
}
public GameThing read(Tree in) throws ParseException {
return new ShopKeeper(world,
in.find("renderer").value(),
in.find("name").value(),
Serializers.map(Serializers.Serializer_String, Container.serializer(union.serializer(), world)).read(in.find("parts")));
}
});
}
private final Map<String, Container> parts;
private String name;
private ShopKeeper(GameWorld world, String r, String n, Map<String, Container> p){
super(world, r);
name = n;
parts = p;
health(1000);
update();
}
public ShopKeeper(GameWorld w, String r, String n){
this(w, r, n, new HashMap<String, Container>());
}
public String name(){
return name;
}
public Container addPart(String name){
Container c = new Container(world());
parts.put(name, c);
update();
return c;
}
public List<String> interactions(){
List<String> out = new LinkedList<String>();
for(String n : parts.keySet())
out.add("buy " + n);
out.addAll(super.interactions());
return out;
}
public void interact(String name, Player who){
for(Map.Entry<String, Container> kv : parts.entrySet())
if(name.equals("buy " + kv.getKey()))
who.showContainer(kv.getValue(), "Buying " + kv.getKey());
super.interact(name, who);
}
public String name(String s){
return name = s;
}
public Map<String, Container> getContainers(){
return new HashMap<String, Container>(parts);
}
}
| [
"[email protected]"
]
| |
253040588cb7c05a52c582d73e12edf0df82439c | 383c9e43b11ed90a872b22efc6221f7a539a72c7 | /Chapter1AbstractInterface/src/chapter1_15/Instrument.java | 5c7c5c50377f9e0af8fa6cb0af499203e5a3936b | []
| no_license | BuiTruongMinhTuan/Advanced-Java-Source | d854fa49dfaebdb4fc00ceee209b654f2af1fe27 | f643fb352d0ed800ae2ccbcf90168e9271d66b85 | refs/heads/master | 2020-09-23T07:58:41.711799 | 2016-09-20T08:02:06 | 2016-09-20T08:02:06 | 65,964,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java |
package chapter1_15;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
*
* @author Bui Truong Minh Tuan
* @Date 23/08/2016
* @version 1.0
*/
abstract class Instrument {
String nameInstrument;
String manufacturer;
BufferedReader input;
public Instrument() {
input=new BufferedReader(new InputStreamReader(System.in));
}
abstract void play();
public String getNameInstrument() {
return nameInstrument;
}
public void setNameInstrument(String nameInstrument) {
this.nameInstrument = nameInstrument;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
}
| [
"[email protected]"
]
| |
9950972b34167239f132edc73291d6db2935468c | b13847c40c7a7ecef95e949a4c1c1a95bd1ad7aa | /android/src/com/example/crazycar_version/AndroidLauncher.java | 3050b49ab369308a693e577afe2598e307d1db5a | []
| no_license | kuffar35/crazy_cars | b8b47c1e1dddcab91f304a87936686bdb9bb7d97 | 7efb85103c4a7ddff629006637521933f057dd56 | refs/heads/master | 2022-04-21T01:12:20.321642 | 2020-04-22T16:41:10 | 2020-04-22T16:41:10 | 257,959,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package com.example.crazycar_version;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.example.crazycar_version.crazycar_version;
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new crazycar_version(), config);
}
}
| [
"[email protected]"
]
| |
b5f7944558d5d06cc2ce661529bd9afbf646f184 | 515b9decc98b2bb7b54ddcc4d590b590f3aef329 | /src/main/java/by/belstu/alchern/db/courseproject/dao/exception/impl/RoleDAOException.java | 69f986ca34cc8a770ae12ae2322be6b47bca6019 | []
| no_license | alchern2412/CourseProjectDb | 12f61821589aea4ad86410cc2b9615deb9218910 | 0333b87be44b0430ce3f2ea6d130dbed3d10fcdd | refs/heads/master | 2022-03-20T21:37:53.002007 | 2019-12-09T20:13:20 | 2019-12-09T20:13:20 | 225,135,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package by.belstu.alchern.db.courseproject.dao.exception.impl;
import by.belstu.alchern.db.courseproject.dao.exception.DAOException;
public class RoleDAOException extends DAOException {
public RoleDAOException() {
}
public RoleDAOException(String message) {
super(message);
}
public RoleDAOException(String message, Throwable cause) {
super(message, cause);
}
public RoleDAOException(Throwable cause) {
super(cause);
}
}
| [
"[email protected]"
]
| |
7a4c21e19891187f797e4a07d35e7c6a4c74e424 | 2ad5236ca6679a98f60219982dbc3d728ee1b1e4 | /Me/Me/Global/FrameWorkSource/Java/Framework/Presentation/Web/Ajax/JMaki/Utils/ExtJSGrid.java | e823f04e16719d77883e1e2bd7bff700ba88ec97 | [
"Apache-2.0"
]
| permissive | bydan/scode | 2097ddcc41b33145812b560d8e102284961abfb9 | 4ac143d579437e969602ecc71575ca6e17fb21b9 | refs/heads/master | 2020-12-08T06:54:41.010177 | 2016-08-31T19:08:59 | 2016-08-31T19:08:59 | 67,065,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,852 | java | package ByDan.Framework.Presentation.Web.Ajax.JMaki.Utils;
import java.util.ArrayList;
import ByDan.Seguridad.Business.Entities.Usuario;
public class ExtJSGrid {
static String startColumns="{columns:[";
static String startColumn="{ 'title' : '";
static String beetwenColumn=",";
static String endTitle="',";
static String endColumn="}";
static String endColumns="]}";
static String startFiles="[";
static String startFile="[";
static String beetwenFile=",";
static String endFile="]";
static String beetwenFiles=",";
static String endFiles="]";
public static void StartCreateColumns(StringBuilder tableAjax)
{
tableAjax.append(startColumns);
}
public static void CreateColumn(StringBuilder tableAjax,String column,String characteristic,Boolean withBeetwen)
{
tableAjax.append(startColumn);
tableAjax.append(column);
tableAjax.append(endTitle);
tableAjax.append(characteristic);
tableAjax.append(endColumn);
if(withBeetwen)
{
tableAjax.append(beetwenColumn);
}
}
public static void EndCreateColums(StringBuilder tableAjax)
{
tableAjax.append(endColumns);
}
public static void StartCreateFiles(StringBuilder tableAjax)
{
tableAjax.append(startFiles);
}
public static void CreateFile(StringBuilder tableAjax,String[] columns,Boolean withBeetwen)
{
Integer count=1;
tableAjax.append(startFile);
for(String column:columns)
{
tableAjax.append(column);
if(columns.length!=count)
{
tableAjax.append(beetwenFile);
}
count++;
}
tableAjax.append(endFile);
if(withBeetwen)
{
tableAjax.append(beetwenFiles);
}
}
public static void EndCreateFiles(StringBuilder tableAjax)
{
tableAjax.append(endFiles);
}
public static String TraerUsuariosArgs(ArrayList<Usuario> usuarios)
{
StringBuilder tableAjax=new StringBuilder();
StartCreateColumns(tableAjax) ;
CreateColumn(tableAjax,"NOMBRE","width : 200, locked:false",true);
CreateColumn(tableAjax,"CLAVE","width : 200, locked:false",false);
EndCreateColums(tableAjax) ;
return tableAjax.toString();
}
public static String TraerUsuariosValue(ArrayList<Usuario> usuarios)
{
StringBuilder tableAjax=new StringBuilder();
Integer count=1;
StartCreateFiles(tableAjax) ;
String columnsFile[]=new String[2];
for(Usuario usuario:usuarios)
{
//columnsFile[0]="'"+usuario.getNombre()+"'";
//columnsFile[1]="'"+usuario.getClave()+"'";
if(usuarios.size()!=count)
{
CreateFile(tableAjax,columnsFile,true);
}
else
{
CreateFile(tableAjax,columnsFile,false);
}
count++;
}
EndCreateFiles(tableAjax) ;
return tableAjax.toString();
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.