blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8548e6d4429056b487e0c3e5e167914303a4b666 | 2a956c875462f6c49aa0ac36aff2a419eb9c2d2a | /app/src/main/java/com/ynzz/gaodemap/adapter/Icon.java | fac42573f9dc099fb24a3ad0cf9c82a3ec3f5204 | [] | no_license | bj0821/LbsTestV1.0 | 24989a7f95ce7d084f4a2c36f03938adaa98b175 | 5576d9702169c7e09a9758ca2a1d22d6f92c4f1f | refs/heads/master | 2021-07-22T21:10:41.507590 | 2017-11-02T02:12:46 | 2017-11-02T02:12:46 | 104,696,431 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package com.ynzz.gaodemap.adapter;
/**
* Created by Jay on 2015/9/24 0024.
*/
public class Icon {
private int iId;
private String iName;
public Icon() {
}
public Icon(int iId, String iName) {
this.iId = iId;
this.iName = iName;
}
public int getiId() {
return iId;
}
public String getiName() {
return iName;
}
public void setiId(int iId) {
this.iId = iId;
}
public void setiName(String iName) {
this.iName = iName;
}
}
| [
"384576300@qq.com"
] | 384576300@qq.com |
706912c8420f5f60fb031154c6a45cab93d975d7 | 9d22747231e6a6a0b75c54bd0bafef42d5b2a195 | /GebPageObjectGenerator/src/test/java/com/sullivan/gareth/HtmlParserTest.java | 014e2c8c7b63255b39c06510c2ca1edc8300e641 | [] | no_license | sinsir/spock-geb-testing | bfc26698fc9293d5561644114b6eb52f9f547459 | 3f09b458e257e064998696432dc60458476d0b99 | refs/heads/master | 2020-05-15T02:25:45.588631 | 2014-08-20T08:25:45 | 2014-08-20T08:25:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,348 | java | package com.sullivan.gareth;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.jsoup.nodes.Document;
import org.junit.Before;
import org.junit.Test;
/**
* This class now superseded by the spock equivalent test class @see HtmlParserSpockTest.groovy
* @author GSULLIVA
*
*/
public class HtmlParserTest {
private static final String TEST_HTML_FILE_LOCATION = "src//test//resources//example.html";
private HtmlParser classToTest = null;
private static List<String> inputFieldsIdList = new ArrayList<String>();
private static final String myNameId = "myName";
private static final String myAgeId = "myAge";
private Document doc;
static
{
inputFieldsIdList.add(myNameId);
inputFieldsIdList.add(myAgeId);
}
@Before
public void setup()
{
classToTest = new HtmlParser();
assertNotNull(classToTest);
doc = (Document) classToTest.parse(TEST_HTML_FILE_LOCATION);
}
@Test
public void testGetFileContent() {
assertNull(classToTest.getFileContent(""));
assertNull(classToTest.getFileContent(null));
assertNull(classToTest.getFileContent("file.ht"));
assertNull(classToTest.getFileContent("file.htmlhmtl"));
String fileContent = classToTest.getFileContent(TEST_HTML_FILE_LOCATION);
assertNotNull(fileContent);
assertEquals(fileContent, HtmlContent.EXAMPLE_FORM);
}
@Test
public void testParse()
{
assertNotNull(doc);
assertNull(classToTest.parse(null));
//This will test groovy implementation where jsoup parses directly from a file
//Document doc = (Document) classToTest.parse(TEST_HTML_FILE_LOCATION);
}
@Test
public void testGetInputFieldsIterator()
{
List<String> inputFields = classToTest.getInputFieldsIterator();
assertNotNull(inputFields);
assertEquals(2, inputFields.size());
assertTrue(inputFields.containsAll(inputFieldsIdList));
}
@Test
public void testGetTitle()
{
assertEquals(HtmlContent.TITLE,classToTest.getTitle());
}
}
| [
"sullivan.gareth@gmail.com"
] | sullivan.gareth@gmail.com |
b88b32b591b9d428d0fbec2af7831709ad6ad7ae | 8d7319f3d83e5251f7de8db1841dbaa1ecd7ae90 | /src/controller/PhongBanIndexController.java | 1bd9c056e676b67f37e2c7d89e76b60af334132f | [] | no_license | sanhphanvan96/QuanLyPhongBan-ThucHanhLTM-Java | d64c0e0a4b67eb5a6901c627d6e2b88f2d745f2f | ac57a47050c21934a5bab50937dd5200c9a84ef8 | refs/heads/master | 2020-03-15T23:53:22.650019 | 2018-05-07T04:19:38 | 2018-05-07T04:19:38 | 132,402,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package controller;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.bean.PhongBan;
import model.dao.PhongBanDAO;
@WebServlet("/PhongBanIndexController")
public class PhongBanIndexController extends HttpServlet {
private static final long serialVersionUID = 1L;
public PhongBanIndexController() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ArrayList<PhongBan> listPB;
PhongBanDAO pbDAO = new PhongBanDAO();
listPB = pbDAO.getAllItem();
request.setAttribute("allItem", listPB);
RequestDispatcher rd = request.getRequestDispatcher("/phongban/index.jsp");
rd.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
| [
"sanhphanvan96@gmail.com"
] | sanhphanvan96@gmail.com |
35a4cfa646efc7868d6838532077f743406d5c07 | 7ddd3087be36dae6ebb76b7fb8e7f9cd963c038b | /src/main/java/mcjty/rftoolsutility/modules/screen/client/GuiScreen.java | bd64606f105221dfecd47d3b14e8e8974936a5cf | [
"MIT"
] | permissive | MoeHunt3r/RFToolsUtility | 920a9f74dcd232653cd46ccde1df2c7267e8e23a | 03fad25021f6188a6afe6db1ec79d31c424ddd4b | refs/heads/master | 2022-12-05T10:32:02.145150 | 2020-08-17T16:27:34 | 2020-08-17T16:27:34 | 288,220,448 | 0 | 0 | MIT | 2020-08-17T16:17:11 | 2020-08-17T15:44:08 | null | UTF-8 | Java | false | false | 8,267 | java | package mcjty.rftoolsutility.modules.screen.client;
import mcjty.lib.container.GenericContainer;
import mcjty.lib.gui.GenericGuiContainer;
import mcjty.lib.gui.Window;
import mcjty.lib.gui.layout.HorizontalAlignment;
import mcjty.lib.gui.layout.PositionalLayout;
import mcjty.lib.gui.widgets.ChoiceLabel;
import mcjty.lib.gui.widgets.Label;
import mcjty.lib.gui.widgets.Panel;
import mcjty.lib.gui.widgets.ToggleButton;
import mcjty.lib.typed.TypedMap;
import mcjty.rftoolsbase.api.screens.IClientScreenModule;
import mcjty.rftoolsbase.api.screens.IModuleProvider;
import mcjty.rftoolsutility.RFToolsUtility;
import mcjty.rftoolsutility.modules.screen.blocks.ScreenBlock;
import mcjty.rftoolsutility.modules.screen.blocks.ScreenTileEntity;
import mcjty.rftoolsutility.modules.screen.modulesclient.helper.ScreenModuleGuiBuilder;
import mcjty.rftoolsutility.modules.screen.network.PacketModuleUpdate;
import mcjty.rftoolsutility.setup.RFToolsUtilityMessages;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import java.awt.*;
import static mcjty.rftoolsutility.modules.screen.blocks.ScreenTileEntity.PARAM_TRUETYPE;
public class GuiScreen extends GenericGuiContainer<ScreenTileEntity, GenericContainer> {
public static final int SCREEN_WIDTH = 256;
public static final int SCREEN_HEIGHT = 224;
private static final ResourceLocation iconLocation = new ResourceLocation(RFToolsUtility.MODID, "textures/gui/screen.png");
private Panel toplevel;
private ToggleButton buttons[] = new ToggleButton[ScreenTileEntity.SCREEN_MODULES];
private Panel modulePanels[] = new Panel[ScreenTileEntity.SCREEN_MODULES];
private IClientScreenModule<?>[] clientScreenModules = new IClientScreenModule<?>[ScreenTileEntity.SCREEN_MODULES];
private ToggleButton bright;
private ChoiceLabel trueType;
private int selected = -1;
public GuiScreen(ScreenTileEntity screenTileEntity, GenericContainer container, PlayerInventory inventory) {
super(RFToolsUtility.instance, screenTileEntity, container, inventory, 0 /* @todo 1.14 GuiProxy.GUI_MANUAL_MAIN*/, "screens");
xSize = SCREEN_WIDTH;
ySize = SCREEN_HEIGHT;
}
@Override
public void init() {
super.init();
toplevel = new Panel(minecraft, this).setBackground(iconLocation).setLayout(new PositionalLayout());
for (int i = 0 ; i < ScreenTileEntity.SCREEN_MODULES ; i++) {
buttons[i] = new ToggleButton(minecraft, this).setLayoutHint(new PositionalLayout.PositionalHint(30, 7 + i * 18 + 1, 40, 16)).setEnabled(false).setTooltips("Open the gui for this", "module");
final int finalI = i;
buttons[i].addButtonEvent(parent -> selectPanel(finalI));
toplevel.addChild(buttons[i]);
modulePanels[i] = null;
clientScreenModules[i] = null;
}
bright = new ToggleButton(minecraft, this)
.setName("bright")
.setText("Bright")
.setCheckMarker(true)
.setTooltips("Toggle full brightness")
.setLayoutHint(85, 123, 55, 14);
// .setLayoutHint(7, 208, 63, 14);
toplevel.addChild(bright);
toplevel.addChild(new Label(minecraft, this).setText("Font:").setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(85+50+9, 123, 30, 14)));
trueType = new ChoiceLabel(minecraft, this)
.addChoices("Default", "Truetype", "Vanilla")
.setTooltips("Set truetype font mode", "for the screen")
.setLayoutHint(new PositionalLayout.PositionalHint(85+50+14+30, 123, 68, 14));
int trueTypeMode = tileEntity.getTrueTypeMode();
trueType.setChoice(trueTypeMode == 0 ? "Default" : (trueTypeMode == -1 ? "Vanilla" : "Truetype"));
trueType.addChoiceEvent((a, b) -> sendServerCommandTyped(RFToolsUtilityMessages.INSTANCE, ScreenTileEntity.CMD_SETTRUETYPE,
TypedMap.builder().put(PARAM_TRUETYPE, getCurrentTruetypeChoice()).build()));
toplevel.addChild(trueType);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
window.bind(RFToolsUtilityMessages.INSTANCE, "bright", tileEntity, ScreenTileEntity.VALUE_BRIGHT.getName());
minecraft.keyboardListener.enableRepeatEvents(true);
selected = -1;
}
private int getCurrentTruetypeChoice() {
String c = trueType.getCurrentChoice();
if ("Default".equals(c)) {
return 0;
}
if ("Truetype".equals(c)) {
return 1;
}
return -1;
}
private void selectPanel(int i) {
if (buttons[i].isPressed()) {
selected = i;
} else {
selected = -1;
}
}
private void refreshButtons() {
tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> {
for (int i = 0; i < ScreenTileEntity.SCREEN_MODULES; i++) {
final ItemStack slot = h.getStackInSlot(i);
if (!slot.isEmpty() && ScreenBlock.hasModuleProvider(slot)) {
int finalI = i;
ScreenBlock.getModuleProvider(slot).ifPresent(moduleProvider -> {
Class<? extends IClientScreenModule<?>> clientScreenModuleClass = moduleProvider.getClientScreenModule();
if (!clientScreenModuleClass.isInstance(clientScreenModules[finalI])) {
installModuleGui(finalI, slot, moduleProvider, clientScreenModuleClass);
}
});
} else {
uninstallModuleGui(i);
}
if (modulePanels[i] != null) {
modulePanels[i].setVisible(selected == i);
buttons[i].setPressed(selected == i);
}
}
});
}
private void uninstallModuleGui(int i) {
buttons[i].setEnabled(false);
buttons[i].setPressed(false);
buttons[i].setText("");
clientScreenModules[i] = null;
toplevel.removeChild(modulePanels[i]);
modulePanels[i] = null;
if (selected == i) {
selected = -1;
}
}
private void installModuleGui(int i, ItemStack slot, IModuleProvider moduleProvider, Class<? extends IClientScreenModule<?>> clientScreenModuleClass) {
buttons[i].setEnabled(true);
toplevel.removeChild(modulePanels[i]);
try {
IClientScreenModule<?> clientScreenModule = clientScreenModuleClass.newInstance();
clientScreenModules[i] = clientScreenModule;
} catch (InstantiationException|IllegalAccessException e) {
throw new RuntimeException(e);
}
CompoundNBT tagCompound = slot.getTag();
if (tagCompound == null) {
tagCompound = new CompoundNBT();
}
final CompoundNBT finalTagCompound = tagCompound;
ScreenModuleGuiBuilder guiBuilder = new ScreenModuleGuiBuilder(minecraft, this, tagCompound, () -> {
slot.setTag(finalTagCompound);
tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> {
((IItemHandlerModifiable)h).setStackInSlot(i, slot);
});
RFToolsUtilityMessages.INSTANCE.sendToServer(new PacketModuleUpdate(tileEntity.getPos(), i, finalTagCompound));
});
moduleProvider.createGui(guiBuilder);
modulePanels[i] = guiBuilder.build();
modulePanels[i].setLayoutHint(80, 8, 170, 114);
modulePanels[i].setFilledRectThickness(-2).setFilledBackground(0xff8b8b8b);
toplevel.addChild(modulePanels[i]);
buttons[i].setText(moduleProvider.getModuleName());
}
@Override
protected void drawGuiContainerBackgroundLayer(float v, int i, int i2) {
refreshButtons();
drawWindow();
}
}
| [
"slto15aGH10"
] | slto15aGH10 |
f85d6026458e696f7c88be786bc1a3aa618d0d90 | 0b17ca2eb48e32c561159fce527890c9509ffd24 | /src/notice/controller/NoticeUpdateServlet.java | b05d126a61a2dcd51dfd9939d3fddfa7613388a6 | [] | no_license | hiapt/hiapt | faeabb368da1c2165cb03dd48f17c2241dbff745 | 2411f20113040ee76339fd6e7e00b860b2c7c972 | refs/heads/master | 2022-04-09T20:18:30.171748 | 2020-02-24T23:50:58 | 2020-02-24T23:50:58 | 213,013,851 | 0 | 0 | null | 2019-11-05T12:36:01 | 2019-10-05T14:30:02 | Java | UTF-8 | Java | false | false | 8,817 | java | package notice.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Enumeration;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import com.oreilly.servlet.MultipartRequest;
import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
import notice.model.service.NoticeService;
import notice.model.vo.Notice;
import notice.model.vo.NoticeFiles;
/**
* Servlet implementation class NoticeUpdateServlet
*/
@WebServlet("/no.up")
public class NoticeUpdateServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public NoticeUpdateServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// 공지 수정 처리용 서블릿
//1.인코팅 처리
request.setCharacterEncoding("utf-8");
RequestDispatcher view = null;
//2.멀티파트 방식으로 왔는지 확인
if(!ServletFileUpload.isMultipartContent(request)) {
view = request.getRequestDispatcher("views/common/error.jsp");
request.setAttribute("message", "form 태그에 enctype 속성 사용이 안됨. 멀티파트 전송방식이 아닙니다!");
view.forward(request, response);
}
//3. 업로드할 용량 설정
int maxSize = 1024*1024*50;
//4. 저장할 경로 지정
String savePath = request.getSession().getServletContext().getRealPath("/resources/notice_upfiles");
//5. request 를 multipartrequest로 바꿈
MultipartRequest mrequest =
new MultipartRequest(request, savePath, maxSize, "utf-8", new DefaultFileRenamePolicy());
//--전달 받은 현재 페이지
int currentPage = Integer.parseInt(mrequest.getParameter("page"));
//6. 전송온 값이 많으니 객체에 저장하기
Notice notice = new Notice();
notice.setNoticeTitle(mrequest.getParameter("title"));
notice.setNoticeDate(Date.valueOf(mrequest.getParameter("date")));
notice.setNoticeContents(mrequest.getParameter("doccontent"));
int nNo = Integer.parseInt(mrequest.getParameter("no"));
notice.setNoticeNo(nNo);
notice.setNoticeWriter(mrequest.getParameter("writer"));
NoticeService nservice = new NoticeService();
int noticeInsertResult = nservice.updateNotice(notice);
ArrayList<String> oldlist = new ArrayList<String>();
for(int i = 1; i < 6 ;i++) {
String hiddenfile = mrequest.getParameter("hiddenfile"+i);
if(hiddenfile != null && !hiddenfile.equals("첨부파일 없음")) {
System.out.println("hiddenfile != null && !hiddenfile.equals(첨부파일 없음)는 true!!!");
oldlist.add(hiddenfile);
}
}
ArrayList<NoticeFiles> nflist = nservice.selectFile(nNo);
if(oldlist.size() > 0 && nflist.size() > 0) {
for(String hiddenfile : oldlist) {
for(int i = 0; i < nflist.size(); i++) {
//히든 태그에서 온 기존의 파일과 디비에 있던 원래 이름이 같다면
if(hiddenfile.equals(nflist.get(i).getNoticeOriginalFileName())) {
nflist.remove(i);//제거해라
}
}//히든의 값이랑 디비의 값이랑 같은거 빼서 이제 수정한 파일만 남은
}
}
for(NoticeFiles nf:nflist) {
String renameFileName = nf.getNoticeRnameFileName();
if(renameFileName != null) {
String savePath2 = request.getSession().getServletContext().getRealPath("/resources/notice_upfiles");
File renameFile = new File(savePath2+"\\"+renameFileName);
renameFile.delete();
nservice.deleteFile(renameFileName);
}
}
//파일 업데이트
NoticeFiles pnfile = new NoticeFiles();
Enumeration noticeFile = mrequest.getFileNames();
while(noticeFile.hasMoreElements()) {
String File = (String)noticeFile.nextElement();
String originalFileName = mrequest.getFilesystemName(File);
if(originalFileName != null) {
File files = mrequest.getFile(File);
double fileFullSize = (Math.round((double) files.length() / 1024 / 1024 * 1000) / 1000.0);
String fileSize = String.valueOf(fileFullSize)+"MB";
pnfile.setNoticeFileSize(fileSize);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String renameFileName=sdf.format(new java.sql.Date(System.currentTimeMillis()))// (밀리세컨드 롱형 정수로 리턴하는 메소드)
+"."+ originalFileName.substring(originalFileName.lastIndexOf(".")+1);
File originFile = new File(savePath +"\\"+originalFileName);
File renameFile = new File(savePath +"\\"+renameFileName);
if(!originFile.renameTo(renameFile)) {
int read = -1;
byte[] buf = new byte[1024];
FileInputStream fin = new FileInputStream(originFile);
FileOutputStream fout = new FileOutputStream(renameFile);
while((read = fin.read(buf, 0, buf.length)) != -1) {
fout.write(buf, 0, read);
}
fin.close();
fout.close();
originFile.delete();
}
pnfile.setNoticeOriginalFileName(originalFileName);
pnfile.setNoticeRnameFileName(renameFileName);
nservice.insertNoticeFile(nNo, pnfile);
}
}
/* if(originalFileName != null) {
notice.setNoticeOriginalFileName(originalFileName);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String renameFileName=sdf.format(new java.sql.Date(System.currentTimeMillis()))// (밀리세컨드 롱형 정수로 리턴하는 메소드)
+"."+ originalFileName.substring(originalFileName.lastIndexOf(".")+1);
//파일명을 바꾸려면 File 객체의 renameTo() 사용함
File originFile = new File(savePath + "\\" + originalFileName);
File renameFile = new File(savePath +"\\"+renameFileName);
if(!originFile.renameTo(renameFile)) {//실패한경우
//파일 입출력 스트림 생성하고, 원본을 읽어서 바꿀이름 파일에 기록함
int read = -1;
//한번에 1kbyte읽겟당
byte[] buf = new byte[1024];//한번에 읽어서 저장할 바이트 배열
FileInputStream fin = new FileInputStream(originFile);//doget메소드는 시그니쳐 보면 IOException throws처리 되어 있음~
FileOutputStream fout = new FileOutputStream(renameFile);
while((read = fin.read(buf, 0, buf.length)) != -1) {//언제까지 읽을지 모르니께
fout.write(buf, 0 ,read);//read사이즈만큼 읽어서 buf에 기록해라
}
fin.close();
fout.close();
originFile.delete();//원본 파일 삭제함.
//이렇게 해서 파일이름이 중복이 되는 작업을 막기 위해서 시분초 작업을 할수 있겠당
}//renameTo()
notice.setNoticeRenameFileName(renameFileName);//이름바꾸기가 성공 했을 때
//수정해서 새로운 첨부파일이 업로드 되었다면, 이전 파일을 찾아서 삭제함.//새로운 파일이 있다면****
new File(savePath+"\\"+mrequest.getParameter("rfile")).delete();
}else {//첨부파일 변경이 없을 때는 기존의 파일명을 notice에 기록해야함
notice.setNoticeOriginalFileName(mrequest.getParameter("ofile"));
notice.setNoticeRenameFileName(mrequest.getParameter("rfile"));
}
//6. 모델 서비스로 전달하고, 결과 받기
int result = new NoticeService().updateNotice(notice);
//7. 받은 결과로 성공 실패 페이지 내보내기
*
*
* */
if(noticeInsertResult > 0) {//성공하면 목록으로 이동되고 최신 글이 상단에 올라온다
response.sendRedirect("/hiapt/no.view?uporview=admin&nno="+nNo+"&page="+currentPage);
}else {
view = request.getRequestDispatcher("views/common/error.jsp");
request.setAttribute("message",nNo+"번 공지글 수정 실패!");
view.forward(request, response);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"dd55555bb@gmail.com"
] | dd55555bb@gmail.com |
33f8f6a20001468f7755b40507435280bbc1ed55 | 9c2bcf0678fecb7ba6b4220dba1147a68526992e | /TTMS_client/src/TTMS_client/UI/Schedule/ScheduleAdd.java | 3aae1451555294f921dbb6ed4eaa135d0865b3de | [] | no_license | zhangwendong333/TTMS_C-S_group1 | 2379fe851415e832c845137f3099310a981fbe21 | 59e300a57a97488afb4afddc9c8ba805136114ff | refs/heads/master | 2020-03-19T11:27:24.022881 | 2018-06-07T09:54:59 | 2018-06-07T09:54:59 | 136,442,610 | 0 | 0 | null | 2018-06-07T07:57:20 | 2018-06-07T07:57:20 | null | UTF-8 | Java | false | false | 5,556 | java | package Schedule;
import Schedule.FunButton;
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import java.io.File;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
public class ScheduleAdd extends GridPane{
public ScheduleAdd() {
this.setHgap(20);
this.setVgap(20);
this.setPadding(new Insets(25,25,25,25));
Text playadd = new Text("添加演出计划");
//playadd.getStyleClass().add("funText");
playadd.setFont(Font.font(30));
this.add(playadd,0,0);
Label id = new Label("演出计划编号:");
TextField sched_id= new TextField();
//play_id.getStyleClass().add("textField");
this.add(id,0,1);
this.add(sched_id,1,1);
Label studio_id = new Label("演出厅编号:");
ComboBox<String> sched_studio_id = new ComboBox<>();
sched_studio_id.setValue("请选择");
for (Map.Entry<String,Integer> entry:DataCollection.playTypeComboBox.entrySet()){
sched_studio_id.getItems().add(entry.getKey());
}
this.add(studio_id,0,2);
this.add(sched_studio_id,1,2);
Label play_id = new Label("剧目编号:");
TextField sched_play_id= new TextField();
this.add(play_id,0,3);
this.add(sched_play_id,1,3);
Label date = new Label("演出日期:");
DatePicker sched_date = new DatePicker();
date.getStyleClass().add("textField");
this.add(date,0,4);
this.add(sched_date,1,4);
Label time = new Label("演出时间:");
TextField sched_time= new TextField();
this.add(time,0,5);
this.add(sched_time,1,5);
Label ticket_price = new Label("票价:");
TextField sched_ticket_price = new TextField();
this.add(ticket_price,0,6);
this.add(sched_ticket_price,1,6);
FunButton Confirm = new FunButton("确认");
Confirm.setStyle("-fx-background-color: #6C9BBF");
FunButton Return = new FunButton("返回");
Return.setStyle("-fx-background-color: #6C9BBF");
HBox bottom_button = new HBox(100);
bottom_button.setPadding(new Insets(10,100,25,50));
bottom_button.setAlignment(Pos.CENTER_LEFT);
bottom_button.getChildren().addAll(Confirm,Return);
this.add(Confirm,0,7);
this.add(Return,1,7);
Confirm.setOnAction(e->{
Confirm.setDisable(true);
//创建后台获取数据的线程
Task<JSONObject> task = new Task<JSONObject>() {
@Override
protected JSONObject call() throws Exception {
String url = "/schedule/add";
//String str = Base64.encodeBase64String(data);
Map<String, Object> schedule = new HashMap<>();
schedule.put("studio_id",DataCollection.playTypeComboBox.get(sched_studio_id.getValue()));
schedule.put("play_id",play_id.getText());
// play.put("sched_date",sched_date.getText());
schedule.put("sched_time",Integer.valueOf(sched_time.getText()));
schedule.put("sched_ticket_price",new BigDecimal(sched_ticket_price.getText()));
String res = Httpclient.post(url, schedule);
return JSON.parseObject(res);
}
@Override
protected void running() {
}
@Override
protected void succeeded() {
super.succeeded();
JSONObject jsonObject = getValue();
if (jsonObject.get("flag").equals(true)) {
MessageBar.showMessageBar("添加成功!");
new ScheduleList();
} else {
MessageBar.showMessageBar(jsonObject.get("content").toString());
}
Confirm.setDisable(false);
updateMessage("Done!");
}
@Override
protected void cancelled() {
super.cancelled();
updateMessage("Cancelled!");
}
@Override
protected void failed() {
super.failed();
updateMessage("Failed!");
}
};
Thread thread = new Thread(task);
thread.start();
});
Return.setOnAction(e->{
new ScheduleList();
});
}
}
}
}
| [
"38044712+zhangwendong333@users.noreply.github.com"
] | 38044712+zhangwendong333@users.noreply.github.com |
0dd3f221fd3b57870cc5bec6eafac1f5e32ec2cc | c56da31b68d59e746ca3c7aec0791ac5b98cab44 | /app/src/main/java/com/cudo/mproject/Utils/CreatePath.java | 7d39ab0d73f79650616ce993df41960768b759b5 | [] | no_license | ptrnov/mp | 7a28212236ff461f1cabfeca6001bb7690b8a045 | 08c9e4779a4fd6501a3fcee3c6cb282204a6292a | refs/heads/master | 2020-03-26T07:47:44.842637 | 2018-08-14T05:14:09 | 2018-08-14T05:14:09 | 144,671,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,699 | java | package com.cudo.mproject.Utils;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.util.Base64;
import android.util.Log;
import com.cudo.mproject.BuildConfig;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class CreatePath {
public static String TAG = CreatePath.class.getSimpleName();
public static String SYSFOLDER = Environment.getExternalStorageDirectory() + File.separator;
public static String ROOT_FOLDER = BuildConfig.APPNAME + File.separator;
public static LocationManager mLocationManager = null;
public static String rootPath(Context mContext, String folder) {
File newFile = new File(SYSFOLDER + ROOT_FOLDER + File.separator + folder);
if (!newFile.getParentFile().exists()) {
newFile.getParentFile().mkdirs();
}
if (!newFile.exists()) {
if (newFile.mkdir()) {
return newFile.getAbsolutePath();
} else {
Utils.showToast(mContext, "CANT CREATE FOLDER2");
return null;
}
} else {
return newFile.getAbsolutePath();
}
}
public static String path(Context context, String folder, String name, String ext) throws IOException {
// try {
File path = new File(folder);
// File newPath = new File(FileUtils.SYSFOLDER + FileUtils.ROOT_FOLDER + File.separator + "_" + "photo_person" + "_");
File newPath = new File(folder + File.separator + name + "_" + ext);
boolean hasPermission = (ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
if (!hasPermission) {
ActivityCompat.requestPermissions(((Activity) context),
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
112);
}
String outputPath = newPath.toString();
Log.e("tag outputPath", outputPath.toString());
File dir = new File(outputPath);
// if (!dir.exists()) {
// dir.mkdirs();
// }else {
// Toast.makeText(context, newPath+" can't be created.", Toast.LENGTH_SHORT).show();
// }
if (!dir.exists()) {
try {
dir.createNewFile();
} catch (IOException e) {
dir = File.createTempFile(
name, /* prefix */
ext, /* suffix */
path /* directory */
);
}
}
return dir.getAbsolutePath();
// } catch (Exception e) {
// Log.e("tag e", e.getMessage());
// }
// return folder;
}
public static Uri getUri(Context mContext, String path) {
File photoFile = new File(path);
Uri photoURI = FileProvider.getUriForFile(mContext,
"com.cudo.mproject.provider",
photoFile);
return photoURI;
}
public static String convertStreamToString(InputStream is) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
reader.close();
return sb.toString();
}
public static void delete(Context context, String path) throws IOException {
File fdelete = new File(path);
System.out.println("file canWrite :" + fdelete.canWrite());
if (fdelete.exists()) {
if (fdelete.delete()) {
System.out.println("file Deleted :" + fdelete.getPath());
} else {
System.out.println("file not Deleted :" + fdelete.getPath());
}
}
if (fdelete.exists()) {
if (fdelete.getCanonicalFile().delete()) {
System.out.println("file Deleted :" + fdelete.getPath());
} else {
System.out.println("file not Deleted :" + fdelete.getPath());
}
if (fdelete.exists()) {
context.getApplicationContext().deleteFile(fdelete.getName());
}
}
}
public static String getStringFromFile(String filePath) throws Exception {
File fl = new File(filePath);
FileInputStream fin = new FileInputStream(fl);
String ret = convertStreamToString(fin);
//Make sure you close all streams.
fin.close();
return ret;
}
public static Bitmap getResizedBitmap(Bitmap bm) {
float aspectRatio = bm.getWidth() /
(float) bm.getHeight();
// int newWidth = 480;
int newWidth = 1280;
int newHeight = Math.round(newWidth / aspectRatio);
if (bm.getWidth() < bm.getHeight()) {
//newHeight = 480;
newHeight = 720;
newWidth = Math.round(newHeight * aspectRatio);
}
int width = bm.getWidth();
int height = bm.getHeight();
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true);
}
public static boolean writeFile(String toEdit, String id) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_4444;
Bitmap bitmap = getResizedBitmap(BitmapFactory.decodeFile(toEdit));
Bitmap dest = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_4444);
Canvas cs = new Canvas(dest);
// Paint tPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG | Paint.FILTER_BITMAP_FLAG );
Paint tPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
tPaint.setStyle(Paint.Style.FILL);
tPaint.setColor(Color.YELLOW);
tPaint.setElegantTextHeight(true);
// Draw background
Paint paint = new Paint(Paint.HINTING_OFF);
paint.setStyle(Paint.Style.FILL);
// create the Paint and set its color
paint.setColor(Color.parseColor("#80ffffff"));
// create a rectangle that we'll draw later
// int x = 1;
// int y = 0;
// int sideLength = 250;
// rectangle = new Rect(x, y, sideLength, sideLength);
// int color=Color.GRAY;
// paint.setColor(color);
// cs.drawRect(210, 80, 360, 200, paint);
//
cs.drawBitmap(bitmap, 0f, 0f, paint);
cs.drawColor(Color.TRANSPARENT, PorterDuff.Mode.LIGHTEN);
try {
return dest.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream(new File(toEdit)));
// return dest.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(new File(toEdit))); //100-best quality
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
return false;
}
}
public static String getBase64Img(String photoPath) throws Exception {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_4444;
Bitmap bitmap = BitmapFactory.decodeFile(photoPath, options);
return encodeImage(bitmap);
}
public static String encodeImage(Bitmap bm) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 90, baos);
byte[] b = baos.toByteArray();
return Base64.encodeToString(b, Base64.DEFAULT);
// return Base64.encodeToString(b, Base64.NO_WRAP);
}
}
| [
"ptr.nov@gmail.com"
] | ptr.nov@gmail.com |
c7e9844dba396b72b852b6b32540ec133ef07b47 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /plugins/kotlin/refactorings/kotlin.refactorings.tests.k2/test/org/jetbrains/kotlin/idea/k2/refactoring/safeDelete/K2SafeDeleteTestGenerated.java | 29e53f793cf69e17cf9ab61554ce87a3ce502601 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 51,781 | java | // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.k2.refactoring.safeDelete;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.idea.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.idea.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.jetbrains.kotlin.idea.base.test.TestRoot;
import org.junit.runner.RunWith;
/**
* This class is generated by {@link org.jetbrains.kotlin.testGenerator.generator.TestGenerator}.
* DO NOT MODIFY MANUALLY.
*/
@SuppressWarnings("all")
@TestRoot("refactorings/kotlin.refactorings.tests.k2")
@TestDataPath("$CONTENT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public abstract class K2SafeDeleteTestGenerated extends AbstractK2SafeDeleteTest {
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass")
public static class KotlinClass extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doClassTest, this, testDataFilePath);
}
@TestMetadata("class1.kt")
public void testClass1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/class1.kt");
}
@TestMetadata("class2.kt")
public void testClass2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/class2.kt");
}
@TestMetadata("classInString.kt")
public void testClassInString() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/classInString.kt");
}
@TestMetadata("classWithExternalConstructructorUsage.kt")
public void testClassWithExternalConstructructorUsage() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/classWithExternalConstructructorUsage.kt");
}
@TestMetadata("classWithInternalConstructructorUsage.kt")
public void testClassWithInternalConstructructorUsage() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/classWithInternalConstructructorUsage.kt");
}
@TestMetadata("enumEntry.kt")
public void testEnumEntry() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/enumEntry.kt");
}
@TestMetadata("interface1.kt")
public void testInterface1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/interface1.kt");
}
@TestMetadata("interface2.kt")
public void testInterface2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/interface2.kt");
}
@TestMetadata("localClass1.kt")
public void testLocalClass1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/localClass1.kt");
}
@TestMetadata("localClass2.kt")
public void testLocalClass2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/localClass2.kt");
}
@TestMetadata("nestedClass1.kt")
public void testNestedClass1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/nestedClass1.kt");
}
@TestMetadata("nestedClass2.kt")
public void testNestedClass2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/nestedClass2.kt");
}
@TestMetadata("noUsages.kt")
public void testNoUsages() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/noUsages.kt");
}
@TestMetadata("unsafeImport.kt")
public void testUnsafeImport() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/kotlinClass/unsafeImport.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteClass/javaClassWithKotlin")
public static class JavaClassWithKotlin extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doJavaClassTest, this, testDataFilePath);
}
@TestMetadata("ImportJavaClassToKotlin.java")
public void testImportJavaClassToKotlin() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/javaClassWithKotlin/ImportJavaClassToKotlin.java");
}
@TestMetadata("javaInterfaceInSuperTypeList.java")
public void testJavaInterfaceInSuperTypeList() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/javaClassWithKotlin/javaInterfaceInSuperTypeList.java");
}
@TestMetadata("javaInterfaceInSuperTypeListLast.java")
public void testJavaInterfaceInSuperTypeListLast() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteClass/javaClassWithKotlin/javaInterfaceInSuperTypeListLast.java");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject")
public static class KotlinObject extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doObjectTest, this, testDataFilePath);
}
@TestMetadata("anonymousObject.kt")
public void testAnonymousObject() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/anonymousObject.kt");
}
@TestMetadata("companionObject.kt")
public void testCompanionObject() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/companionObject.kt");
}
@TestMetadata("localObject1.kt")
public void testLocalObject1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/localObject1.kt");
}
@TestMetadata("localObject2.kt")
public void testLocalObject2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/localObject2.kt");
}
@TestMetadata("nestedObject1.kt")
public void testNestedObject1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/nestedObject1.kt");
}
@TestMetadata("nestedObject2.kt")
public void testNestedObject2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/nestedObject2.kt");
}
@TestMetadata("noUsages.kt")
public void testNoUsages() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/noUsages.kt");
}
@TestMetadata("object1.kt")
public void testObject1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/object1.kt");
}
@TestMetadata("object2.kt")
public void testObject2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/object2.kt");
}
@TestMetadata("unsafeImport.kt")
public void testUnsafeImport() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteObject/kotlinObject/unsafeImport.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction")
public static class KotlinFunction extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFunctionTest, this, testDataFilePath);
}
@TestMetadata("fun1.kt")
public void testFun1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/fun1.kt");
}
@TestMetadata("fun2.kt")
public void testFun2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/fun2.kt");
}
@TestMetadata("funExt1.kt")
public void testFunExt1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/funExt1.kt");
}
@TestMetadata("funExt2.kt")
public void testFunExt2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/funExt2.kt");
}
@TestMetadata("implement1.kt")
public void testImplement1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/implement1.kt");
}
@TestMetadata("implement2.kt")
public void testImplement2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/implement2.kt");
}
@TestMetadata("localFun1.kt")
public void testLocalFun1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/localFun1.kt");
}
@TestMetadata("localFun2.kt")
public void testLocalFun2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/localFun2.kt");
}
@TestMetadata("localFunExt1.kt")
public void testLocalFunExt1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/localFunExt1.kt");
}
@TestMetadata("localFunExt2.kt")
public void testLocalFunExt2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/localFunExt2.kt");
}
@TestMetadata("noUsages.kt")
public void testNoUsages() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/noUsages.kt");
}
@TestMetadata("override1.kt")
public void testOverride1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/override1.kt");
}
@TestMetadata("override2.kt")
public void testOverride2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/override2.kt");
}
@TestMetadata("overrideAndImplement1.kt")
public void testOverrideAndImplement1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/overrideAndImplement1.kt");
}
@TestMetadata("overrideAndImplement2.kt")
public void testOverrideAndImplement2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/overrideAndImplement2.kt");
}
@TestMetadata("overrideAndImplement3.kt")
public void testOverrideAndImplement3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/overrideAndImplement3.kt");
}
@TestMetadata("overrideWithUsages.kt")
public void testOverrideWithUsages() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/overrideWithUsages.kt");
}
@TestMetadata("withDefinitelyNotNullType.kt")
public void testWithDefinitelyNotNullType() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunction/withDefinitelyNotNullType.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava")
public static class KotlinFunctionWithJava extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFunctionTestWithJava, this, testDataFilePath);
}
@TestMetadata("funExt.kt")
public void testFunExt() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/funExt.kt");
}
@TestMetadata("implement1.kt")
public void testImplement1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/implement1.kt");
}
@TestMetadata("implement2.kt")
public void testImplement2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/implement2.kt");
}
@TestMetadata("implement3.kt")
public void testImplement3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/implement3.kt");
}
@TestMetadata("override1.kt")
public void testOverride1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/override1.kt");
}
@TestMetadata("override2.kt")
public void testOverride2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/override2.kt");
}
@TestMetadata("override3.kt")
public void testOverride3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/override3.kt");
}
@TestMetadata("overrideAndImplement1.kt")
public void testOverrideAndImplement1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/overrideAndImplement1.kt");
}
@TestMetadata("overrideAndImplement2.kt")
public void testOverrideAndImplement2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/overrideAndImplement2.kt");
}
@TestMetadata("usageInOverrideToDelete.kt")
public void testUsageInOverrideToDelete() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava/usageInOverrideToDelete.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/javaFunctionWithKotlin")
public static class JavaFunctionWithKotlin extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doJavaMethodTest, this, testDataFilePath);
}
@TestMetadata("mixedHierarchy1.kt")
public void testMixedHierarchy1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/javaFunctionWithKotlin/mixedHierarchy1.kt");
}
@TestMetadata("mixedHierarchy2.kt")
public void testMixedHierarchy2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteFunction/javaFunctionWithKotlin/mixedHierarchy2.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty")
public static class KotlinProperty extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doPropertyTest, this, testDataFilePath);
}
@TestMetadata("implement1.kt")
public void testImplement1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement1.kt");
}
@TestMetadata("implement2.kt")
public void testImplement2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement2.kt");
}
@TestMetadata("implement3.kt")
public void testImplement3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement3.kt");
}
@TestMetadata("implement4.kt")
public void testImplement4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement4.kt");
}
@TestMetadata("implement5.kt")
public void testImplement5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement5.kt");
}
@TestMetadata("implement6.kt")
public void testImplement6() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement6.kt");
}
@TestMetadata("implement7.kt")
public void testImplement7() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement7.kt");
}
@TestMetadata("implement8.kt")
public void testImplement8() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/implement8.kt");
}
@TestMetadata("localVar.kt")
public void testLocalVar() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/localVar.kt");
}
@TestMetadata("noUsages.kt")
public void testNoUsages() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/noUsages.kt");
}
@TestMetadata("override1.kt")
public void testOverride1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/override1.kt");
}
@TestMetadata("override2.kt")
public void testOverride2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/override2.kt");
}
@TestMetadata("override3.kt")
public void testOverride3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/override3.kt");
}
@TestMetadata("override4.kt")
public void testOverride4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/override4.kt");
}
@TestMetadata("overrideAndImplement1.kt")
public void testOverrideAndImplement1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/overrideAndImplement1.kt");
}
@TestMetadata("overrideAndImplement2.kt")
public void testOverrideAndImplement2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/overrideAndImplement2.kt");
}
@TestMetadata("overrideAndImplement3.kt")
public void testOverrideAndImplement3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/overrideAndImplement3.kt");
}
@TestMetadata("overrideAndImplement4.kt")
public void testOverrideAndImplement4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/overrideAndImplement4.kt");
}
@TestMetadata("overrideWithUsages.kt")
public void testOverrideWithUsages() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/overrideWithUsages.kt");
}
@TestMetadata("property1.kt")
public void testProperty1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/property1.kt");
}
@TestMetadata("property2.kt")
public void testProperty2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/property2.kt");
}
@TestMetadata("propertyExt1.kt")
public void testPropertyExt1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/propertyExt1.kt");
}
@TestMetadata("propertyExt2.kt")
public void testPropertyExt2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/propertyExt2.kt");
}
@TestMetadata("propertyInLocalObject.kt")
public void testPropertyInLocalObject() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/propertyInLocalObject.kt");
}
@TestMetadata("propertyInLocalObject2.kt")
public void testPropertyInLocalObject2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/kotlinProperty/propertyInLocalObject2.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin")
public static class JavaPropertyWithKotlin extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doJavaPropertyTest, this, testDataFilePath);
}
@TestMetadata("middleJava1.kt")
public void testMiddleJava1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin/middleJava1.kt");
}
@TestMetadata("middleJava2.kt")
public void testMiddleJava2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin/middleJava2.kt");
}
@TestMetadata("middleJava3.kt")
public void testMiddleJava3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin/middleJava3.kt");
}
@TestMetadata("middleJava4.kt")
public void testMiddleJava4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin/middleJava4.kt");
}
@TestMetadata("middleJava5.kt")
public void testMiddleJava5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin/middleJava5.kt");
}
@TestMetadata("middleJava6.kt")
public void testMiddleJava6() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin/middleJava6.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias")
public static class KotlinTypeAlias extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTypeAliasTest, this, testDataFilePath);
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias/simple.kt");
}
@TestMetadata("used.kt")
public void testUsed() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias/used.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter")
public static class KotlinTypeParameter extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTypeParameterTest, this, testDataFilePath);
}
@TestMetadata("internalUsages1.kt")
public void testInternalUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/internalUsages1.kt");
}
@TestMetadata("internalUsages2.kt")
public void testInternalUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/internalUsages2.kt");
}
@TestMetadata("internalUsages3.kt")
public void testInternalUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/internalUsages3.kt");
}
@TestMetadata("internalUsages4.kt")
public void testInternalUsages4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/internalUsages4.kt");
}
@TestMetadata("internalUsages5.kt")
public void testInternalUsages5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/internalUsages5.kt");
}
@TestMetadata("safeUsagesWithConstraint1.kt")
public void testSafeUsagesWithConstraint1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/safeUsagesWithConstraint1.kt");
}
@TestMetadata("safeUsagesWithConstraint2.kt")
public void testSafeUsagesWithConstraint2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/safeUsagesWithConstraint2.kt");
}
@TestMetadata("subclass1.kt")
public void testSubclass1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subclass1.kt");
}
@TestMetadata("subclass2.kt")
public void testSubclass2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subclass2.kt");
}
@TestMetadata("subst1.kt")
public void testSubst1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subst1.kt");
}
@TestMetadata("subst2.kt")
public void testSubst2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subst2.kt");
}
@TestMetadata("subst3.kt")
public void testSubst3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subst3.kt");
}
@TestMetadata("subst4.kt")
public void testSubst4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subst4.kt");
}
@TestMetadata("subst5.kt")
public void testSubst5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subst5.kt");
}
@TestMetadata("subst6.kt")
public void testSubst6() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subst6.kt");
}
@TestMetadata("subst7.kt")
public void testSubst7() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter/subst7.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava")
public static class KotlinTypeParameterWithJava extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTypeParameterTestWithJava, this, testDataFilePath);
}
@TestMetadata("internalUsages1.kt")
public void testInternalUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/internalUsages1.kt");
}
@TestMetadata("internalUsages2.kt")
public void testInternalUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/internalUsages2.kt");
}
@TestMetadata("internalUsages3.kt")
public void testInternalUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/internalUsages3.kt");
}
@TestMetadata("internalUsages4.kt")
public void testInternalUsages4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/internalUsages4.kt");
}
@TestMetadata("internalUsages5.kt")
public void testInternalUsages5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/internalUsages5.kt");
}
@TestMetadata("rawType.kt")
public void testRawType() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/rawType.kt");
}
@TestMetadata("safeUsagesWithConstraint1.kt")
public void testSafeUsagesWithConstraint1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/safeUsagesWithConstraint1.kt");
}
@TestMetadata("safeUsagesWithConstraint2.kt")
public void testSafeUsagesWithConstraint2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/safeUsagesWithConstraint2.kt");
}
@TestMetadata("subclass1.kt")
public void testSubclass1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subclass1.kt");
}
@TestMetadata("subclass2.kt")
public void testSubclass2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subclass2.kt");
}
@TestMetadata("subst1.kt")
public void testSubst1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subst1.kt");
}
@TestMetadata("subst2.kt")
public void testSubst2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subst2.kt");
}
@TestMetadata("subst3.kt")
public void testSubst3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subst3.kt");
}
@TestMetadata("subst4.kt")
public void testSubst4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subst4.kt");
}
@TestMetadata("subst5.kt")
public void testSubst5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subst5.kt");
}
@TestMetadata("subst6.kt")
public void testSubst6() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subst6.kt");
}
@TestMetadata("subst7.kt")
public void testSubst7() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava/subst7.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter")
public static class KotlinValueParameter extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doValueParameterTest, this, testDataFilePath);
}
@TestMetadata("dataClassComponent.kt")
public void testDataClassComponent() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/dataClassComponent.kt");
}
@TestMetadata("defaultParam1.kt")
public void testDefaultParam1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/defaultParam1.kt");
}
@TestMetadata("defaultParam2.kt")
public void testDefaultParam2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/defaultParam2.kt");
}
@TestMetadata("extNamedParam1.kt")
public void testExtNamedParam1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/extNamedParam1.kt");
}
@TestMetadata("extNamedParam2.kt")
public void testExtNamedParam2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/extNamedParam2.kt");
}
@TestMetadata("hierarchyWithSafeUsages1.kt")
public void testHierarchyWithSafeUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithSafeUsages1.kt");
}
@TestMetadata("hierarchyWithSafeUsages2.kt")
public void testHierarchyWithSafeUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithSafeUsages2.kt");
}
@TestMetadata("hierarchyWithSafeUsages3.kt")
public void testHierarchyWithSafeUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithSafeUsages3.kt");
}
@TestMetadata("hierarchyWithSafeUsages4.kt")
public void testHierarchyWithSafeUsages4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithSafeUsages4.kt");
}
@TestMetadata("hierarchyWithSafeUsages5.kt")
public void testHierarchyWithSafeUsages5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithSafeUsages5.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages1.kt")
public void testHierarchyWithUnsafeUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages1.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages2.kt")
public void testHierarchyWithUnsafeUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages2.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages3.kt")
public void testHierarchyWithUnsafeUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages3.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages4.kt")
public void testHierarchyWithUnsafeUsages4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages4.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages5.kt")
public void testHierarchyWithUnsafeUsages5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages5.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages6.kt")
public void testHierarchyWithUnsafeUsages6() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages6.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages7.kt")
public void testHierarchyWithUnsafeUsages7() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages7.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages8.kt")
public void testHierarchyWithUnsafeUsages8() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/hierarchyWithUnsafeUsages8.kt");
}
@TestMetadata("internalUsage1.kt")
public void testInternalUsage1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/internalUsage1.kt");
}
@TestMetadata("internalUsage2.kt")
public void testInternalUsage2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/internalUsage2.kt");
}
@TestMetadata("lambdaArg.kt")
public void testLambdaArg() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/lambdaArg.kt");
}
@TestMetadata("lambdaArgExt.kt")
public void testLambdaArgExt() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/lambdaArgExt.kt");
}
@TestMetadata("namedDefaultParam.kt")
public void testNamedDefaultParam() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/namedDefaultParam.kt");
}
@TestMetadata("namedParam1.kt")
public void testNamedParam1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/namedParam1.kt");
}
@TestMetadata("namedParam2.kt")
public void testNamedParam2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/namedParam2.kt");
}
@TestMetadata("propertyParam1.kt")
public void testPropertyParam1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/propertyParam1.kt");
}
@TestMetadata("propertyParam2.kt")
public void testPropertyParam2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/propertyParam2.kt");
}
@TestMetadata("safeUsages1.kt")
public void testSafeUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsages1.kt");
}
@TestMetadata("safeUsages2.kt")
public void testSafeUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsages2.kt");
}
@TestMetadata("safeUsages3.kt")
public void testSafeUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsages3.kt");
}
@TestMetadata("safeUsagesExt1.kt")
public void testSafeUsagesExt1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsagesExt1.kt");
}
@TestMetadata("safeUsagesExt2.kt")
public void testSafeUsagesExt2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsagesExt2.kt");
}
@TestMetadata("setter.kt")
public void testSetter() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameter/setter.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava")
public static class KotlinValueParameterWithJava extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doValueParameterTestWithJava, this, testDataFilePath);
}
@TestMetadata("dataClassComponent.kt")
public void testDataClassComponent() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/dataClassComponent.kt");
}
@TestMetadata("hierarchyWithSafeUsages1.kt")
public void testHierarchyWithSafeUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithSafeUsages1.kt");
}
@TestMetadata("hierarchyWithSafeUsages2.kt")
public void testHierarchyWithSafeUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithSafeUsages2.kt");
}
@TestMetadata("hierarchyWithSafeUsages3.kt")
public void testHierarchyWithSafeUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithSafeUsages3.kt");
}
@TestMetadata("hierarchyWithSafeUsages4.kt")
public void testHierarchyWithSafeUsages4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithSafeUsages4.kt");
}
@TestMetadata("hierarchyWithSafeUsages5.kt")
public void testHierarchyWithSafeUsages5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithSafeUsages5.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages1.kt")
public void testHierarchyWithUnsafeUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithUnsafeUsages1.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages2.kt")
public void testHierarchyWithUnsafeUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithUnsafeUsages2.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages3.kt")
public void testHierarchyWithUnsafeUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithUnsafeUsages3.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages4.kt")
public void testHierarchyWithUnsafeUsages4() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithUnsafeUsages4.kt");
}
@TestMetadata("hierarchyWithUnsafeUsages5.kt")
public void testHierarchyWithUnsafeUsages5() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/hierarchyWithUnsafeUsages5.kt");
}
@TestMetadata("internalUsage1.kt")
public void testInternalUsage1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/internalUsage1.kt");
}
@TestMetadata("internalUsage2.kt")
public void testInternalUsage2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/internalUsage2.kt");
}
@TestMetadata("lambdaArg.kt")
public void testLambdaArg() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/lambdaArg.kt");
}
@TestMetadata("lambdaArgExt.kt")
public void testLambdaArgExt() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/lambdaArgExt.kt");
}
@TestMetadata("mixedHierarchy1.kt")
public void testMixedHierarchy1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/mixedHierarchy1.kt");
}
@TestMetadata("mixedHierarchy2.kt")
public void testMixedHierarchy2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/mixedHierarchy2.kt");
}
@TestMetadata("mixedHierarchy3.kt")
public void testMixedHierarchy3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/mixedHierarchy3.kt");
}
@TestMetadata("mixedHierarchyWithUnsafeUsages1.kt")
public void testMixedHierarchyWithUnsafeUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/mixedHierarchyWithUnsafeUsages1.kt");
}
@TestMetadata("mixedHierarchyWithUnsafeUsages2.kt")
public void testMixedHierarchyWithUnsafeUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/mixedHierarchyWithUnsafeUsages2.kt");
}
@TestMetadata("mixedHierarchyWithUnsafeUsages3.kt")
public void testMixedHierarchyWithUnsafeUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/mixedHierarchyWithUnsafeUsages3.kt");
}
@TestMetadata("propertyParam1.kt")
public void testPropertyParam1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/propertyParam1.kt");
}
@TestMetadata("propertyParam2.kt")
public void testPropertyParam2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/propertyParam2.kt");
}
@TestMetadata("safeUsages1.kt")
public void testSafeUsages1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsages1.kt");
}
@TestMetadata("safeUsages2.kt")
public void testSafeUsages2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsages2.kt");
}
@TestMetadata("safeUsages3.kt")
public void testSafeUsages3() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsages3.kt");
}
@TestMetadata("safeUsagesExt1.kt")
public void testSafeUsagesExt1() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsagesExt1.kt");
}
@TestMetadata("safeUsagesExt2.kt")
public void testSafeUsagesExt2() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsagesExt2.kt");
}
}
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/javaParameterWithKotlin")
public static class JavaParameterWithKotlin extends AbstractK2SafeDeleteTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doJavaParameterTest, this, testDataFilePath);
}
@TestMetadata("hierarchyWithoutConflict.java")
public void testHierarchyWithoutConflict() throws Exception {
runTest("../../idea/tests/testData/refactoring/safeDelete/deleteValueParameter/javaParameterWithKotlin/hierarchyWithoutConflict.java");
}
}
}
| [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
ba5054e9ece5ec3550a45bb8fea0b5cfc2901b26 | e5a2cac793f19c42e73a1a68227d960e85f35d91 | /src/com/madhusudhan/wr/allaboutlambdas/specialisedfunctions/BiFunctions.java | 30f90eb82f236c025dd90d30901e208b0ba0c87f | [] | no_license | nitinkumargupta07/CoreJava8 | a368bfbb155e822aea3857e0ad3bbdcc79a6c388 | 8234ad013c3e0abea5e58cb0c0511de2dc166b2c | refs/heads/master | 2020-04-03T07:38:27.392660 | 2018-12-17T18:45:03 | 2018-12-17T18:45:03 | 155,108,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,448 | java | package com.madhusudhan.wr.allaboutlambdas.specialisedfunctions;
import java.util.function.BiFunction;
import java.util.function.Function;
import com.madhusudhan.wr.allaboutlambdas.domain.Employee;
import com.madhusudhan.wr.allaboutlambdas.domain.Manager;
/**
* Class that demonstrates Predicate function usage
*
* @author mkonda
*
*/
public class BiFunctions {
BiFunction<Employee, Manager, Employee> empManagerBiFunction = (emp, manager) ->{
Employee employee = null;
if(emp.getManager().equals(manager))
employee = manager.getPersonalAssistant();
return employee;
};
Function<Employee, Employee> emplManagerFunction = emp -> emp.getManager().getPersonalAssistant();
// Single argument function
Function<Employee, Employee> empManagerFunction = emp -> emp.getManager().getPersonalAssistant();
private void biFunction(Employee emp, Manager manager) {
Employee employee = empManagerBiFunction.apply(emp, manager);
System.out.println("Employee"+employee);
}
private void testAndThen(Employee emp, Manager manager) {
BiFunction<Employee, Manager, Employee> personalAssistant= empManagerBiFunction.andThen(empManagerFunction);
}
public static void main(String[] args) {
Employee emp = new Employee(99);
Manager manager = new Manager();
emp.setManager(manager);
manager.setPersonalAssistant(emp);
new BiFunctions().biFunction(emp, manager);
}
}
| [
"nitinguptamca@gmail.com"
] | nitinguptamca@gmail.com |
9621c8a48bd2ef730a55c7559c7b171950e3bacb | 6c54732fa1b0c324a844d6ee8f1e740b439a0331 | /src/test/java/bridgelabz/HotelReservation/HotelReservationServiceTest.java | f47d03b69d7cb9b306914d67bb4cf49b96b3a8d5 | [] | no_license | Ananya-Krishnappa/HotelReservationSystem | 81e64e4bf56dd48f6109f083404f409f52d731a2 | a0124c257f3be092f5541c38c7f6c21209bb8510 | refs/heads/master | 2023-06-02T14:01:41.452408 | 2021-06-26T14:14:37 | 2021-06-26T14:14:37 | 380,400,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,939 | java | package bridgelabz.HotelReservation;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
public class HotelReservationServiceTest {
HotelReservationService hotelReservationService;
List<Hotel> hotelList = new ArrayList<Hotel>();
@Before
public void init() {
hotelReservationService = new HotelReservationService();
}
private List<Hotel> createHotelList(String name, int rating, Double[] rateArray) {
Hotel hotel = new Hotel();
hotel.setName(name);
hotel.setRating(rating);
Map<CustomerType, Map<DayType, Double>> rateMap = new HashMap<CustomerType, Map<DayType, Double>>();
Map<DayType, Double> dayTypeAndRateMap = new HashMap<DayType, Double>();
dayTypeAndRateMap.put(DayType.WEEKDAY, rateArray[0]);
dayTypeAndRateMap.put(DayType.WEEKEND, rateArray[1]);
rateMap.put(CustomerType.REGULAR, dayTypeAndRateMap);
dayTypeAndRateMap.clear();
dayTypeAndRateMap.put(DayType.WEEKDAY, rateArray[2]);
dayTypeAndRateMap.put(DayType.WEEKEND, rateArray[3]);
rateMap.put(CustomerType.REWARDS, dayTypeAndRateMap);
hotel.setRateMap(rateMap);
hotelList.add(hotel);
return hotelList;
}
@Test
public void validate_shouldAddHotelToTheListWhenGivenHotelNameAndRate() throws HotelReservationException {
String name = "Lakewood";
int rating = 3;
Double[] rateArray = { 100.0, 120.0, 123.9, 789.0 };
createHotelList(name, rating, rateArray);
String name1 = "Bridgewood";
int rating1 = 4;
Double[] rateArray1 = { 200.0, 420.0, 120.9, 189.0 };
createHotelList(name1, rating1, rateArray1);
String name2 = "Ridgewood";
int rating2 = 3;
Double[] rateArray2 = { 500.0, 920.0, 823.9, 589.0 };
createHotelList(name2, rating2, rateArray2);
assertThat(hotelList, hasSize(3));
}
}
| [
"ananyak3395@gmail.com"
] | ananyak3395@gmail.com |
6643cfb551cf950e8892b2304596c4b72e94c213 | adf38cc20fedebec756b6dbebd033f555011db23 | /src/com/company/MenuPrincipal.java | a5a3f9bdf510a8410cde9757512aa74e7605fc45 | [] | no_license | Wolffarin/SistemaDeFinanzasEscolares | 34c399f6440bb2c2712d5d37448f41b7ad40f643 | 3f894076cab6989bb551f35c6414108ff782d4ff | refs/heads/master | 2022-10-26T08:44:17.115877 | 2020-06-12T04:59:51 | 2020-06-12T04:59:51 | 271,712,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,619 | java | package com.company;
public class MenuPrincipal {
public static void menuinicial() {
System.out.println("Escuela Junior Hight ");
System.out.println("1. menu de Maestros");
System.out.println("2. menu de alumnos");
System.out.println("3. buscar informacion por ID")
;
System.out.print("4.menu de la escuela");
System.out.print("5.Estado de cuenta total Alumnos o maestros:");
System.out.println("6. Salir ");
}
public static void menuMaestro() {
System.out.println("PLanillas de MAestros ");
System.out.println("1.Buscar Maestro ");
System.out.println("3.Salir");
}
public static void menuEstudiante() {
System.out.println("Estado de cuenta Estudiantes ");
System.out.println("1.Buscar Estudiante ");
System.out.println("2.Mostrar Todos Los Estudiantes");
System.out.println("3.ingresar estudiante");
System.out.println("4.Salir");
System.out.print("Ingrese su Eleccion:");
}
public static void menuID() {
System.out.println("Seleccione El tipo de ID ");
System.out.println("1.ID de Maestros ");
System.out.println("2.ID de Estudiante");
System.out.println("3.ingresar ID");
System.out.println("4.Salir");
System.out.print("Ingrese su Eleccion:");
}
public static void menuingresodedatos() {
System.out.println("ingresando datos ");
System.out.println("1.ingresar Estudiante ");
System.out.println("2.ingresar Docente");
System.out.println("3.Salir");
}} | [
"Wolffarin1@gmail.com"
] | Wolffarin1@gmail.com |
4a374a5a900eabbdafa7efa799158b8340582e4b | 5ac45ff671bd559c4f2c8c5b71eea779c5cef2df | /datastructure/src/com/justnow/tree/binarysearchtree/BinaryTreeMain.java | e0d20f4d157ee8e6b26f769d80d2ad3845117cfc | [] | no_license | justn0w/algorithm | 08608c860c7de477a6fcb6c910c0fd3ece0d104f | e69b6b9e156e527f67c06d557ce36454b44fb672 | refs/heads/master | 2020-06-17T11:42:08.176255 | 2020-01-12T07:22:17 | 2020-01-12T07:22:17 | 195,913,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,136 | java | package com.justnow.tree.binarysearchtree;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
public class BinaryTreeMain implements BinarySearchTree {
// 表示根节点
private Node root;
// 查找节点
@Override
public Node find(int key) {
Node current = root;
while (current != null) {
if (current.data > key) {//当前节点值比查找值大,搜索左子树
current = current.leftChild;
} else if (current.data < key) {//当前节点值比查找值小,搜索右子树
current = current.rightChild;
} else {
return current;
}
}
return null; // 遍历完整个树每找到,返回null
}
/**
* 递归查找节点
*
* @param key
* @return
*/
@Override
public Node findByRecursion(Node root, int key) {
if (root == null)
return null;
if (root.data == key) {
return root;
} else if (root.data > key) { //当前节点值比查找值大,搜索左子树
return findByRecursion(root.leftChild, key);
} else if (root.data < key) { //当前节点值比查找值小,搜索右子树
return findByRecursion(root.rightChild, key);
}
return null; //如果没有找到,就返回null
}
// 插入节点
@Override
public boolean insert(int data) {
Node newNode = new Node(data);
if (root == null) {//当前树为空树,没有任何节点
root = newNode;
return true;
} else {
Node current = root;
Node parentNode = null;
// 这里一直循环效果更好
while (true) {
parentNode = current;
if (current.data > data) {// 当前值比插入值大,搜索左子节点
current = current.leftChild;
if (current == null) {// 左子节点为空,直接将新值插入到该节点
parentNode.leftChild = newNode;
return true;
}
} else {
current = current.rightChild;
if (current == null) {// 右子节点为空,直接将新值插入到该节点
parentNode.rightChild = newNode;
return true;
}
}
}
}
}
// 前序遍历
// 根节点 -> 左子树 -> 右子树
@Override
public void preOrder(Node current) {
if (current != null) {
System.out.println(current.data + " ");
preOrder(current.leftChild);
preOrder(current.rightChild);
}
}
/**
* 非递归前序遍历
* 根节点 -> 左子树 -> 右子树
*
* @param root
*/
@Override
public void nonRecursivePreOrder(Node root) {
Stack<Node> stack = new Stack<>();
Node current = root;
while ((current != null) || (!stack.isEmpty())) {
if (current != null) {
System.out.println(current.data);
stack.push(current);
current = current.leftChild;
} else {
current = stack.pop(); // 返回栈顶元素,
current = current.rightChild;
}
}
}
// 中序遍历
// 左子树 -> 根节点 -> 右子树
@Override
public void inOrder(Node current) {
if (current != null) {
preOrder(current.leftChild);
System.out.println(current.data + " ");
preOrder(current.rightChild);
}
}
/**
* 非递归中序遍历
*
* @param root
*/
@Override
public void nonRecursiveInOrder(Node root) {
Stack<Node> stack = new Stack<>();
Node current = root;
while ((current != null) || (!stack.isEmpty())) {
if (current != null) {
stack.push(current);
current = current.leftChild;
} else {
current = stack.pop();
System.out.println(current.data);
current = current.rightChild;
}
}
}
// 后序遍历
// 左子树 -> 右子树 -> 根节点
@Override
public void postOrder(Node current) {
if (current != null) {
postOrder(current.leftChild);
postOrder(current.rightChild);
System.out.println(current.data + " ");
}
}
/**
* 非递归后序遍历
* https://blog.csdn.net/superballball/article/details/83689248
* https://blog.csdn.net/gatieme/article/details/51163010
*
* @param root
*/
@Override
public void nonRecursivePostOrder(Node root) {
/**
* 对于任一结点P,将其入栈,然后沿其左子树一直往下搜索,直到搜索到没有左孩子的结点,此时该结点出现在栈顶,
* 但是此时不能将其出栈并访问,因此其右孩子还为被访问。所以接下来按照相同的规则对其右子树进行相同的处理,
* 当访问完其右孩子时,该结点又出现在栈顶,此时可以将其出栈并访问。这样就保证了正确的访问顺序。
* 可以看出,在这个过程中,每个结点都两次出现在栈顶,只有在第二次出现在栈顶时,才能访问它。
* 因此需要多设置一个变量标识该结点是否是第一次出现在栈顶。
*/
Stack<Node> stack = new Stack<>();
Node current = root;
while ((current != null) || (!stack.isEmpty())) {
if (current != null) {
current.isFirst = true; // 第一个访问该节点
stack.push(current);
current = current.leftChild; // 沿其左子树一直往下搜索,直到搜索到没有左孩子的节点。
} else {
current = stack.pop(); // 如果该节点为空,将其父节点弹出
if (current.isFirst) { // 判断是否是第一次访问,如果是的话,还要将其再次入栈,然后将isFirst置为false,开始遍历其右子树
current.isFirst = false;
stack.push(current);
current = current.rightChild;
} else { // 如果该节点已经被访问了一次了,说明此时该节点为已经没有左右节点了或者其左右节点已经被打印完了,需要将其打印出来,并置为空
System.out.println(current.data);
current = null;
}
}
}
}
/**
* 树的层次遍历方法
* @param root
*/
@Override
public void bfs(Node root) {
Queue<Node> queue = new LinkedList<Node>();
Node current = root;
while ((current != null) || (!queue.isEmpty())) {
System.out.println(current.data);
if (current.leftChild != null) {
queue.add(current.leftChild);
}
if (current.rightChild != null) {
queue.add(current.rightChild);
}
current = queue.poll();
}
}
// 找最大值
@Override
public Node findMax() {
Node current = root;
Node maxNode = current;
while (current != null) {
maxNode = current;
current = current.rightChild;
}
return maxNode;
}
@Override
public Node findMin() {
Node current = root;
Node minNode = current;
while (current != null) {
minNode = current;
current = current.leftChild;
}
return minNode;
}
/**
* 删除节点
*
* @param data
* @return
*/
@Override
public boolean delete(int data) {
return false;
}
public static void main(String[] args) {
BinaryTreeMain bt = new BinaryTreeMain();
// 插入数据内容
bt.insert(50);
bt.insert(20);
bt.insert(80);
bt.insert(10);
bt.insert(30);
bt.insert(60);
bt.insert(90);
bt.insert(25);
bt.insert(85);
bt.insert(100);
//System.out.println(bt.find(50));
//System.out.println(bt.findByRecursion(bt.root, 50));
// 前序遍历
//bt.preOrder(bt.root);
//System.out.println("*********************************");
//bt.nonRecursivePreOrder(bt.root);
// 中序遍历
//bt.inOrder(bt.root);
// 后序遍历
// bt.postOrder(bt.root);
// bt.nonRecursivePostOrder(bt.root);
bt.bfs(bt.root);
// 查找最大值和最小值
System.out.println("**************\n最大值");
System.out.println(bt.findMax());
System.out.println("**************\n最小值");
System.out.println(bt.findMin());
}
}
| [
"ggjustnow@163.com"
] | ggjustnow@163.com |
8e81b85be058950c3b2dce5b18516af1f8d13503 | 25d951bafef823e05b5723630f86e8ddb5642c22 | /0.0.1/ontolog-lang/src/test/java/so/ontolog/samples/bean/CarInsuredCarInfo.java | 3950754946b3cdb5a7b908c75722493005a91681 | [
"Apache-2.0"
] | permissive | kighie/so.ontolog | 4128e2f468af35dbc9ef9150b1adf02bf09f640b | fd542ace5788cea18827418dc67cc7fea1236be7 | refs/heads/master | 2020-06-12T13:38:25.985878 | 2018-08-22T08:23:04 | 2018-08-22T08:23:04 | 35,025,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,093 | java | package so.ontolog.samples.bean;
import java.math.BigDecimal;
public class CarInsuredCarInfo {
private String carYear;
private String vanCostClCd;
private String carUsageClCd;
private String carNmCd;
private String oganCd;
private BigDecimal carAm;
private BigDecimal totalCarAm;
private String sedanJeepClCd;
private String carCategoryCd;
private String carTypeCd;
private String carDomesticClCd;
private String carNmClCd;
private String carNmModelGradeCd;
private String carDamageClCd;
/**
* @return the carYear
*/
public String getCarYear() {
return carYear;
}
/**
* @param carYear the carYear to set
*/
public void setCarYear(String carYear) {
this.carYear = carYear;
}
/**
* @return the vanCostClCd
*/
public String getVanCostClCd() {
return vanCostClCd;
}
/**
* @param vanCostClCd the vanCostClCd to set
*/
public void setVanCostClCd(String vanCostClCd) {
this.vanCostClCd = vanCostClCd;
}
/**
* @return the carUsageClCd
*/
public String getCarUsageClCd() {
return carUsageClCd;
}
/**
* @param carUsageClCd the carUsageClCd to set
*/
public void setCarUsageClCd(String carUsageClCd) {
this.carUsageClCd = carUsageClCd;
}
/**
* @return the carNmCd
*/
public String getCarNmCd() {
return carNmCd;
}
/**
* @param carNmCd the carNmCd to set
*/
public void setCarNmCd(String carNmCd) {
this.carNmCd = carNmCd;
}
/**
* @return the oganCd
*/
public String getOganCd() {
return oganCd;
}
/**
* @param oganCd the oganCd to set
*/
public void setOganCd(String oganCd) {
this.oganCd = oganCd;
}
/**
* @return the carAm
*/
public BigDecimal getCarAm() {
return carAm;
}
/**
* @param carAm the carAm to set
*/
public void setCarAm(BigDecimal carAm) {
this.carAm = carAm;
}
/**
* @return the totalCarAm
*/
public BigDecimal getTotalCarAm() {
return totalCarAm;
}
/**
* @param totalCarAm the totalCarAm to set
*/
public void setTotalCarAm(BigDecimal totalCarAm) {
this.totalCarAm = totalCarAm;
}
/**
* @return the sedanJeepClCd
*/
public String getSedanJeepClCd() {
return sedanJeepClCd;
}
/**
* @param sedanJeepClCd the sedanJeepClCd to set
*/
public void setSedanJeepClCd(String sedanJeepClCd) {
this.sedanJeepClCd = sedanJeepClCd;
}
/**
* @return the carCategoryCd
*/
public String getCarCategoryCd() {
return carCategoryCd;
}
/**
* @param carCategoryCd the carCategoryCd to set
*/
public void setCarCategoryCd(String carCategoryCd) {
this.carCategoryCd = carCategoryCd;
}
/**
* @return the carTypeCd
*/
public String getCarTypeCd() {
return carTypeCd;
}
/**
* @param carTypeCd the carTypeCd to set
*/
public void setCarTypeCd(String carTypeCd) {
this.carTypeCd = carTypeCd;
}
/**
* @return the carDomesticClCd
*/
public String getCarDomesticClCd() {
return carDomesticClCd;
}
/**
* @param carDomesticClCd the carDomesticClCd to set
*/
public void setCarDomesticClCd(String carDomesticClCd) {
this.carDomesticClCd = carDomesticClCd;
}
/**
* @return the carNmClCd
*/
public String getCarNmClCd() {
return carNmClCd;
}
/**
* @param carNmClCd the carNmClCd to set
*/
public void setCarNmClCd(String carNmClCd) {
this.carNmClCd = carNmClCd;
}
/**
* @return the carNmModelGradeCd
*/
public String getCarNmModelGradeCd() {
return carNmModelGradeCd;
}
/**
* @param carNmModelGradeCd the carNmModelGradeCd to set
*/
public void setCarNmModelGradeCd(String carNmModelGradeCd) {
this.carNmModelGradeCd = carNmModelGradeCd;
}
/**
* @return the carDamageClCd
*/
public String getCarDamageClCd() {
return carDamageClCd;
}
/**
* @param carDamageClCd the carDamageClCd to set
*/
public void setCarDamageClCd(String carDamageClCd) {
this.carDamageClCd = carDamageClCd;
}
}
| [
"kighie@gmail.com"
] | kighie@gmail.com |
2db1a02b34514a36a867e27b11bcb550d7052d94 | 22b1fe6a0af8ab3c662551185967bf2a6034a5d2 | /experimenting-rounds/massive-count-of-annotated-classes/src/main/java/fr/javatronic/blog/massive/annotation1/sub1/Class_0678.java | 9dc158df2d4a49b8b4481b2ba837bc9b8d170c38 | [
"Apache-2.0"
] | permissive | lesaint/experimenting-annotation-processing | b64ed2182570007cb65e9b62bb2b1b3f69d168d6 | 1e9692ceb0d3d2cda709e06ccc13290262f51b39 | refs/heads/master | 2021-01-23T11:20:19.836331 | 2014-11-13T10:37:14 | 2014-11-13T10:37:14 | 26,336,984 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package fr.javatronic.blog.massive.annotation1.sub1;
import fr.javatronic.blog.processor.Annotation_001;
@Annotation_001
public class Class_0678 {
}
| [
"sebastien.lesaint@gmail.com"
] | sebastien.lesaint@gmail.com |
fea533c445dc103f998e972c8b9364e1b5a362c8 | a16524ab4ac75c23293a3791a329823b1e8d5969 | /src/portal2d/SpriteImage.java | 8719f18ecb48c1b13ce3fc651df40a38a9303383 | [] | no_license | NathanMacLeod/Portal2D | f497e8dcee2c0918a8df3befa802ef3a44c367fa | e7e3bff8f99047a627219735403dac34ab93b3b0 | refs/heads/master | 2021-07-09T11:34:32.647876 | 2020-10-21T03:37:30 | 2020-10-21T03:37:30 | 206,900,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,710 | java | /*
* File added by Nathan MacLeod 2019
*/
package portal2d;
import java.awt.image.BufferedImage;
import java.awt.Graphics;
import java.awt.geom.AffineTransform;
import java.awt.Graphics2D;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
*
* @author Nathan
*/
public class SpriteImage {
private BufferedImage image;
private Vector centerOffset;
private double radialDist;
public SpriteImage(BufferedImage image, Vector centerOffset) {
this.image = image;
this.centerOffset = centerOffset;
calculateRadialDist();
}
public SpriteImage(String fileName, double size, Vector centerOffset) {
this.centerOffset = centerOffset;
try {
BufferedImage spriteImage = ImageIO.read(Class.class.getResourceAsStream("/sprites/" + fileName));
image = new BufferedImage((int)(size), (int)(size), BufferedImage.TYPE_INT_ARGB);
Graphics imageGraphics = image.getGraphics();
imageGraphics.drawImage(spriteImage, 0, 0, (int)(size), (int)(size), 0, 0, spriteImage.getWidth(), spriteImage.getHeight(), null);
calculateRadialDist();
}
catch(IOException e) {
System.out.println("cant find file: " + fileName);
System.exit(0);
}
}
private void calculateRadialDist() {
radialDist = Math.sqrt(image.getHeight() * image.getHeight() + image.getWidth() * image.getWidth()) + centerOffset.getMagnitude();
}
public BufferedImage getRotatedBaseImage(double rotation) {
BufferedImage newImage = new BufferedImage((int)(image.getWidth()), (int)(image.getHeight()), BufferedImage.TYPE_INT_ARGB);
AffineTransform transformation = new AffineTransform();
transformation.translate(image.getWidth()/2.0, image.getHeight()/2.0);
transformation.rotate(rotation);
transformation.translate(-image.getWidth()/2.0, -image.getHeight()/2.0);
((Graphics2D)newImage.getGraphics()).drawImage(image, transformation, null);
return newImage;
}
public BufferedImage getImage() {
return image;
}
public void flip() {
BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
newImage.getGraphics().drawImage(image, 0, 0, image.getWidth(), image.getHeight(), image.getWidth(), 0, 0, image.getHeight(), null);
image = newImage;
}
public boolean spriteInFrame(Camera c, Point position) {
return Math.abs(c.getPosition().x - position.x) < c.getWidth() + radialDist && Math.abs(c.getPosition().y - position.y) < c.getHeight() + radialDist;
}
public void drawNormallyCustomImage(Graphics g, Camera c, Point position, double orientation, BufferedImage image) {
if(spriteInFrame(c, position))
drawNormally(g, c, position, orientation, image);
}
public void drawNormally(Graphics g, Camera c, Point position, double orientation) {
if(spriteInFrame(c, position))
drawNormally(g, c, position, orientation, image);
}
public void drawNormally(Graphics g, Point position, double orientation) {
drawNormally(g, new Camera(0, 0), position, orientation, image);
}
private void drawNormally(Graphics g, Camera c, Point position, double orientation, BufferedImage image) {
if(!spriteInFrame(c, position))
return;
Graphics2D g2D = (Graphics2D) g;
AffineTransform transformation = new AffineTransform();
Point cp = c.getPosition();
transformation.translate(position.x -cp.x + c.getWidth(), position.y -cp.y + c.getHeight());
transformation.rotate(orientation);
transformation.translate(- image.getWidth()/2.0 - centerOffset.getXComp(), - image.getHeight()/2.0 - centerOffset.getYComp());
g2D.drawImage(image, transformation, null);
}
public void drawCustumSpriteSplitInPortal(Graphics g, Camera c, Point position, double orientation, Portal intersectingPortal, Portal otherPortal, PortalPair portals, BufferedImage otherImage) {
if(spriteInFrame(c, position))
drawSpriteSplitInPortal(g, c, position, orientation, intersectingPortal, otherPortal, portals, otherImage);
}
public void drawSpriteSplitInPortal(Graphics g, Camera c, Point position, double orientation, Portal intersectingPortal, Portal otherPortal, PortalPair portals) {
if(spriteInFrame(c, position))
drawSpriteSplitInPortal(g, c, position, orientation, intersectingPortal, otherPortal, portals, image);
}
private void drawSpriteSplitInPortal(Graphics g, Camera c, Point position, double orientation, Portal intersectingPortal, Portal otherPortal, PortalPair portals, BufferedImage image) {
if(!spriteInFrame(c, position))
return;
BufferedImage rotatedImage = new BufferedImage(image.getWidth() * 2, image.getHeight() * 2, BufferedImage.TYPE_INT_ARGB);
double angleOff = Math.acos(intersectingPortal.getDownVector().dotProduct(new Vector(0, 1)));
if(intersectingPortal.getDownVector().getXComp() > 0)
angleOff *= -1;
AffineTransform transform = new AffineTransform();
transform.translate(rotatedImage.getWidth()/2.0, rotatedImage.getHeight()/2.0);
transform.rotate(orientation - angleOff);
transform.translate(-image.getWidth()/2.0 - centerOffset.getXComp(), -image.getHeight()/2.0 - centerOffset.getYComp());
((Graphics2D)rotatedImage.getGraphics()).drawImage(image, transform, null);
double portalPlaneDist = new Vector(position.x - intersectingPortal.getCenter().x, position.y - intersectingPortal.getCenter().y).dotProduct(intersectingPortal.getDirection());
BufferedImage mainSide = new BufferedImage(image.getWidth() * 2, image.getHeight() * 2, BufferedImage.TYPE_INT_ARGB);
BufferedImage shadowSide = new BufferedImage(image.getWidth() * 2, image.getHeight() * 2, BufferedImage.TYPE_INT_ARGB);
boolean portalIsLeftBound = Math.cos(intersectingPortal.getDirection().getDirection() - angleOff) > 0;
if(portalIsLeftBound) {
portalPlaneDist = mainSide.getWidth()/2.0 - portalPlaneDist;
mainSide.getGraphics().drawImage(rotatedImage, (int)portalPlaneDist, 0, mainSide.getWidth(), mainSide.getHeight(), (int)portalPlaneDist, 0, mainSide.getWidth(), mainSide.getHeight(), null);
shadowSide.getGraphics().drawImage(rotatedImage, 0, 0, (int)portalPlaneDist, mainSide.getHeight(), 0, 0, (int)portalPlaneDist, mainSide.getHeight(), null);
}
else {
portalPlaneDist += mainSide.getWidth()/2.0;
mainSide.getGraphics().drawImage(rotatedImage, 0, 0, (int)portalPlaneDist, mainSide.getHeight(), 0, 0, (int)portalPlaneDist, mainSide.getHeight(), null);
shadowSide.getGraphics().drawImage(rotatedImage, (int)portalPlaneDist, 0, mainSide.getWidth(), mainSide.getHeight(), (int)portalPlaneDist, 0, mainSide.getWidth(), mainSide.getHeight(), null);
}
AffineTransform imageToWorldTransform = new AffineTransform();
imageToWorldTransform.translate(position.x - c.getPosition().x + c.getWidth(), position.y - c.getPosition().y + c.getHeight());
imageToWorldTransform.rotate(angleOff);
imageToWorldTransform.translate(-mainSide.getWidth()/2.0, -mainSide.getHeight()/2.0);
Graphics2D g2D = (Graphics2D) g;
g2D.drawImage(mainSide, imageToWorldTransform, null);
if(portals.needsXRotation(intersectingPortal, otherPortal)) {
BufferedImage newShadow = new BufferedImage(shadowSide.getHeight(), shadowSide.getWidth(), BufferedImage.TYPE_INT_ARGB);
newShadow.getGraphics().drawImage(shadowSide, 0, 0, newShadow.getWidth(), mainSide.getHeight(), newShadow.getWidth(), 0, 0, mainSide.getHeight(), null);
shadowSide = newShadow;
}
imageToWorldTransform = new AffineTransform();
Point shadowPoint = portals.teleportPointToOtherPortal(position, intersectingPortal, otherPortal);
imageToWorldTransform.translate(shadowPoint.x - c.getPosition().x + c.getWidth(), shadowPoint.y - c.getPosition().y + c.getHeight());
imageToWorldTransform.rotate(angleOff + otherPortal.getDownVector().getDirection() - intersectingPortal.getDownVector().getDirection());
imageToWorldTransform.translate(-mainSide.getWidth()/2.0, -mainSide.getHeight()/2.0);
g2D.drawImage(shadowSide, imageToWorldTransform, null);
}
}
| [
"macleod.nathanp@gmail.com"
] | macleod.nathanp@gmail.com |
00d75734bc9566ed54bf6012cebdac64247a257f | 541d39512889b8c06bee8da74eb5c212e7104902 | /src/main/java/ght/topinterviewquestions/Problem_0054_SpiralMatrix.java | 93ea52f5c91d04cb3f9839a0e380fe8393257ed3 | [] | no_license | 9256-gui/algorithmLearn | 65e11d5a8df44f00318dcafb86261713c7143a14 | 01ef4454f89e43d8d19f7a71fc96473b7f206db1 | refs/heads/master | 2023-03-12T02:41:17.281320 | 2021-02-28T14:38:39 | 2021-02-28T14:38:39 | 324,474,866 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,091 | java | package ght.topinterviewquestions;
import java.util.ArrayList;
import java.util.List;
public class Problem_0054_SpiralMatrix {
public static List<Integer> spiralOrder(int[][] matrix) {
List<Integer> ans = new ArrayList<>();
if (matrix == null || matrix.length == 0 || matrix[0] == null || matrix[0].length == 0) {
return ans;
}
int a = 0;
int b = 0;
int c = matrix.length - 1;
int d = matrix[0].length - 1;
while (a <= c && b <= d) {
addEdge(matrix, a++, b++, c--, d--, ans);
}
return ans;
}
public static void addEdge(int[][] m, int a, int b, int c, int d, List<Integer> ans) {
if (a == c) {
for (int i = b; i <= d; i++) {
ans.add(m[a][i]);
}
} else if (b == d) {
for (int i = a; i <= c; i++) {
ans.add(m[i][b]);
}
} else {
int curC = b;
int curR = a;
while (curC != d) {
ans.add(m[a][curC]);
curC++;
}
while (curR != c) {
ans.add(m[curR][d]);
curR++;
}
while (curC != b) {
ans.add(m[c][curC]);
curC--;
}
while (curR != a) {
ans.add(m[curR][b]);
curR--;
}
}
}
}
| [
"925630328@qq.com"
] | 925630328@qq.com |
5bc49ed1197ed9a547fae778f01a6e80d52a61d1 | 60c2f293fa9df1f8a696e675cebde95308fcef30 | /seleniumDemo12-master/src/test/java/com/scp/orange/hrm/login/OrangeHRMLoginTest.java | 4549e056469d8fe2c4eea1c7906fb3b4b51b597f | [] | no_license | prashantthorat91/Selenium | 7498fdb569811ae9a870044ae29aa21b09cc4348 | 410cf554870552c6a088115d12e9a5e255cfb438 | refs/heads/master | 2020-03-28T05:26:12.598823 | 2019-05-01T10:12:04 | 2019-05-01T10:12:04 | 147,775,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,979 | java | package com.scp.orange.hrm.login;
import java.io.IOException;
import junit.framework.Assert;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.scp.app.constants.AppConstants;
import com.scp.app.constants.AppConstants.BrowserNames;
import com.scp.app.util.AppUtil;
import com.scp.app.util.ReadTestDataFromExcel;
import com.scp.app.web.pageobjects.OrangeHRMDashaboard;
import com.scp.app.web.pageobjects.OrangeHRMLogin;
public class OrangeHRMLoginTest {
@DataProvider(name="data")
public Object[][] getTestData(){
try {
return ReadTestDataFromExcel.convertTwoDimenationArray();
} catch (InvalidFormatException | IOException e) {
e.printStackTrace();
return null;
}
}
@Test(dataProvider="data")
public void verifyUserLoginCredentials(String username,String password,String emsg){
System.out.println("Step1 - Launch Url and Enter ");
System.out.println("Expected - Orange HRM Login page should be displayed..!");
WebDriver driver = AppUtil.initializeBrowser(BrowserNames.Chrome, AppConstants.ORANGE_HRM_APP_URL);
OrangeHRMLogin loginPage=PageFactory.initElements(driver,OrangeHRMLogin.class);
driver.manage().window().maximize();
System.out.println("Step1 - Enter UserName and Password(" +username+", : "+password+", : " +emsg +")");
System.out.println("Expected - Dashboard page should be displayed..!");
loginPage.enterUserName(username);
loginPage.enterPassword(password);
if(emsg.equalsIgnoreCase("Welcome Admin")){
OrangeHRMDashaboard dashboardPage = loginPage.clickLoginWithSuccess();
Assert.assertEquals(emsg,dashboardPage.getWelcomeMsg());
}else{
loginPage.clickLoginWithError();
Assert.assertEquals(emsg, loginPage.getErrorMessage());
}
driver.close();
}
}
| [
"prashantthorat91@gmail.com"
] | prashantthorat91@gmail.com |
18ef228f3f50a0f985adeeecc8283e6bbfcf7eaf | e6dd77957c65991165d638786a74380c8156fea1 | /flashj-parent/flashj-user-service/src/main/java/com/flashj/user/entity/ResourceApplication.java | 576f02cee2f8a189ba086d52ef3eb7fcf607cb0c | [] | no_license | little6/flashj | 643f142d8a3b35ea5a3fb20dcf35ca89878db91a | 2109414c1678f19fcabc16291d17ecc9003fc007 | refs/heads/master | 2021-04-17T20:29:14.470167 | 2020-03-23T15:55:56 | 2020-03-23T15:55:56 | 249,473,224 | 0 | 0 | null | 2020-03-23T15:44:17 | 2020-03-23T15:44:16 | null | UTF-8 | Java | false | false | 811 | java | package com.flashj.user.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@Data
@TableName("resource_application")
public class ResourceApplication implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value="ID",type = IdType.AUTO)
private Long id;
/**
* 应用名称
*/
@TableField("NAME")
private String name;
/**
* 应用编码
*/
@TableField("CODE")
private String code;
/**
* 租户id
*/
@TableField("TENANT_ID")
private Long tenantId;
}
| [
"mic816@gmail.com"
] | mic816@gmail.com |
bbd9b356dfdecb4d94907a9c7ee9d808835d5df5 | 31e204e6aad552aa627b5d8ab3507a5f55f6e0d7 | /src/test/java/puissance4/vue/TestsFonctionnelsVue.java | eea55d3ec3fa533dee7465efd6857e8a178102b9 | [] | no_license | ZeHelioss/puissance4 | 182bf3bf71a937d533c429147bee7b8e8be7b74e | 72519abd0b2f1b4aac985912a46048c77138fbfa | refs/heads/master | 2020-04-02T22:20:29.821965 | 2018-11-23T10:43:36 | 2018-11-23T10:43:36 | 154,824,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,750 | java | package puissance4.vue;
import exemplecode.ExempleGlisserDeposer;
import javafx.geometry.Point2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.effect.Light;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import org.junit.Test;
import org.testfx.framework.junit.ApplicationTest;
import puissance4.controleur.ControleurPuissance4;
import puissance4.modele.Modele;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.testfx.api.FxAssert.verifyThat;
import static org.testfx.service.query.impl.NodeQueryUtils.hasText;
public class TestsFonctionnelsVue extends ApplicationTest {
private Parent parent;
// Commentaire test commit automatique TEST
@Override
public void start(Stage stage) {
Scene scene;
Vue vue = new Vue();
ControleurPuissance4 controleur = new ControleurPuissance4();
// lier la vue et le modele au controleur */
controleur.setVue( vue );
controleur.setModele( new Modele() );
parent = vue;
scene = new Scene(parent
, 500, 500, Color.GREY);
stage.setScene(scene);
stage.show();
}
@Test
public void testLacher7pionsDansColonne1EtVerifierAffichageColonnePleine()
{
for( int coup=0; coup<7; coup++) {
//drag("#pion-curseur").dropTo(new Point2D( 300 , 40 ));
clickOn("#btn-jouer-coup");
}
// Message
String message = ((Vue)parent).lireAvertissement();
assertEquals( "La colonne 1 est pleine", message );
}
}
| [
"noreply@github.com"
] | ZeHelioss.noreply@github.com |
f53a8db186c16960004f195592358c502b338bf5 | 46605647202ee3c40674db9959b9da3822cbb7ce | /Sistema-Livraria/src/java/br/edu/livraria/util/exception/ErroSistema.java | 82c8370afa481ced55c38bf35227662458b1793d | [
"MIT"
] | permissive | LudovicCeita/Sist.-Livraria | 7a365a06734c482ee23232066d0333f829e579dc | de21671b915b34fc3cf76808ac46dc2fac46065d | refs/heads/master | 2021-01-13T04:13:28.594710 | 2016-12-28T11:27:14 | 2016-12-28T11:27:14 | 77,493,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package br.edu.livraria.util.exception;
public class ErroSistema extends Exception {
public ErroSistema(String message) {
super(message);
}
public ErroSistema(String message, Throwable cause) {
super(message, cause);
}
}
| [
"ludovic.ceita@outlook.com"
] | ludovic.ceita@outlook.com |
d99bbf99c3fbbd53d717f62ced71d862ed944664 | 1615efdc51a763c603fca35650af3641bff9dc60 | /app/src/main/java/streetdirectory/mobile/modules/locationdetail/bus/BusArrivalActivity.java | 39098912548dcc20bc2c45c544105099421bf4f6 | [] | no_license | Leoxinghai/SingaporeStreetMap | 233c8abaa1e09df0fb8c389ef342a44af3d46d4b | 3be3a8d29e86ee279aa301c8ac5bbdef0a730b55 | refs/heads/master | 2021-01-19T06:46:55.927835 | 2016-07-01T13:32:22 | 2016-07-01T13:32:22 | 62,395,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,805 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
package streetdirectory.mobile.modules.locationdetail.bus;
import android.content.*;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.xinghai.mycurve.R;
import java.util.ArrayList;
import java.util.Iterator;
import streetdirectory.mobile.core.SDStory;
import streetdirectory.mobile.core.StringTools;
import streetdirectory.mobile.modules.SDActivity;
import streetdirectory.mobile.modules.core.LocationBusinessServiceOutput;
import streetdirectory.mobile.modules.locationdetail.bus.service.BusArrivalServiceInputV2;
import streetdirectory.mobile.modules.locationdetail.bus.service.BusArrivalServiceOutputV2;
import streetdirectory.mobile.modules.locationdetail.bus.service.BusArrivalServiceV2;
import streetdirectory.mobile.modules.locationdetail.bus.service.BusListService;
import streetdirectory.mobile.modules.locationdetail.bus.service.BusListServiceInput;
import streetdirectory.mobile.modules.locationdetail.bus.service.BusListServiceOutput;
import streetdirectory.mobile.modules.nearby.service.NearbyService;
import streetdirectory.mobile.modules.sdmob.SdMobHelper;
import streetdirectory.mobile.modules.sdmob.SmallBanner;
import streetdirectory.mobile.sd.SdMob;
import streetdirectory.mobile.service.*;
// Referenced classes of package streetdirectory.mobile.modules.locationdetail.bus:
// BusArrivalAdapterV2, BusRouteActivity
public class BusArrivalActivity extends SDActivity
{
public static class BusTimeHandler extends Handler
{
public Runnable r;
public BusArrivalServiceV2 service;
public BusTimeHandler()
{
}
}
public BusArrivalActivity()
{
busArrivals = new ArrayList();
handlerList = new ArrayList();
imagePool = new SDHttpImageServicePool();
adRequestRetryCount = 0;
mSdMobReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent)
{
updateSmallBanner();
}
};
}
private void abortServices()
{
BusTimeHandler bustimehandler;
for(Iterator iterator = handlerList.iterator(); iterator.hasNext(); bustimehandler.removeCallbacks(bustimehandler.r))
{
bustimehandler = (BusTimeHandler)iterator.next();
if(bustimehandler.service != null)
{
bustimehandler.service.abort();
bustimehandler.service = null;
}
}
if(_nearbyService != null)
{
_nearbyService.abort();
_nearbyService = null;
}
}
private void downloadBusList()
{
(new BusListService(new BusListServiceInput(busStopIdString)) {
public void onFailed(Exception exception)
{
super.onFailed(exception);
}
public void onSuccess(Object obj)
{
onSuccess((SDHttpServiceOutput)obj);
}
public void onSuccess(SDHttpServiceOutput sdhttpserviceoutput)
{
mProgressBar.setVisibility(View.INVISIBLE);
BusArrivalServiceOutputV2 busarrivalserviceoutputv2;
Iterator iterator;
for(iterator = sdhttpserviceoutput.childs.iterator(); iterator.hasNext(); downloadTime(busarrivalserviceoutputv2, null))
{
BusListServiceOutput buslistserviceoutput = (BusListServiceOutput)iterator.next();
busarrivalserviceoutputv2 = new BusArrivalServiceOutputV2();
busarrivalserviceoutputv2.busNumber = buslistserviceoutput.busNumber;
busArrivals.add(busarrivalserviceoutputv2);
mBustArrivalAdapter.items.add(busarrivalserviceoutputv2);
}
}
}).executeAsync();
}
private BusArrivalServiceV2 downloadTime(BusArrivalServiceOutputV2 busarrivalserviceoutputv2, BusTimeHandler bustimehandler)
{
final BusTimeHandler handle = bustimehandler;
final BusArrivalServiceOutputV2 item = busarrivalserviceoutputv2;
BusArrivalServiceV2 result = new BusArrivalServiceV2(null) {
public void onFailed(Exception exception)
{
super.onFailed(exception);
item.subsequentBus = "";
item.nextBus = "";
notifiyListView();
downloadTimeDelayed(item, handle);
if(handle != null)
handlerList.remove(handle);
}
public void onSuccess(Object obj)
{
onSuccess((SDHttpServiceOutput)obj);
}
public void onSuccess(SDHttpServiceOutput sdhttpserviceoutput)
{
if(sdhttpserviceoutput.childs.size() > 0)
{
BusArrivalServiceOutputV2 temp = (BusArrivalServiceOutputV2)sdhttpserviceoutput.childs.get(0);
item.subsequentBus = ((BusArrivalServiceOutputV2) (temp)).subsequentBus;
item.nextBus = ((BusArrivalServiceOutputV2) (temp)).nextBus;
} else
{
item.subsequentBus = "";
item.nextBus = "";
}
notifiyListView();
downloadTimeDelayed(item, handle);
if(handle != null)
handlerList.remove(handle);
}
};
result.executeAsync();
return result;
}
private void downloadTimeDelayed(final BusArrivalServiceOutputV2 item, final BusTimeHandler busHandler)
{
final BusTimeHandler busHandler0 = busHandler;
final BusArrivalServiceOutputV2 item0 = item;
BusTimeHandler temp = new BusTimeHandler();
temp.r = new Runnable() {
public void run()
{
busHandler.service = downloadTime(item0, busHandler0);
}
{
}
};
temp.postDelayed(busHandler.r, 30000L);
handlerList.add(temp);
}
private void initData()
{
String s = "";
LocationBusinessServiceOutput locationbusinessserviceoutput = (LocationBusinessServiceOutput)getIntent().getParcelableExtra("data");
if(locationbusinessserviceoutput != null)
{
mData = locationbusinessserviceoutput;
mTextviewTitle.setText(locationbusinessserviceoutput.venue);
mTextviewDetail.setText(locationbusinessserviceoutput.address);
if(locationbusinessserviceoutput.imageURL != null)
imagePool.queueRequest(URLFactory.createURLResizeImage(locationbusinessserviceoutput.imageURL, 130, 130), 130, 130, new streetdirectory.mobile.service.SDHttpImageServicePool.OnBitmapReceivedListener() {
public void bitmapReceived(String s2, Bitmap bitmap)
{
mButtonBusinessPhoto.setImageBitmap(bitmap);
}
});
if(locationbusinessserviceoutput.uniqueID != null && locationbusinessserviceoutput.uniqueID.startsWith("B"))
{
s = locationbusinessserviceoutput.uniqueID.substring(1);
} else
{
String s1 = "";
s = s1;
if(locationbusinessserviceoutput.address != null)
{
s = s1;
if(locationbusinessserviceoutput.address.length() > 5)
{
s = s1;
if(locationbusinessserviceoutput.address != "No Address")
s = locationbusinessserviceoutput.address;
}
}
int i = s.indexOf(")");
int j = s.indexOf("(B");
if(j < 0)
{
j = s.indexOf("B");
if(j >= 0)
s = s.substring(j + 1, i);
} else
{
s = s.substring(j + 2, i);
}
}
}
SDStory.post(URLFactory.createGantPlaceBusStop(s), SDStory.createDefaultParams());
mBustArrivalAdapter = new BusArrivalAdapterV2(this);
mBustArrivalAdapter.mData = busArrivals;
mBustArrivalAdapter.items.addAll(busArrivals);
mListViewBusArrival.setAdapter(mBustArrivalAdapter);
busStopIdint = StringTools.tryParseInt(s, 0);
busStopIdString = s;
if(busStopIdString.matches("[0-9]+"))
{
downloadBusList();
return;
} else
{
mProgressBar.setVisibility(View.INVISIBLE);
return;
}
}
private void initEvent()
{
mRefreshButton.setOnClickListener(new android.view.View.OnClickListener() {
public void onClick(View view)
{
BusArrivalServiceOutputV2 busarrivalserviceoutputv2;
Iterator iterator;
for(iterator = busArrivals.iterator(); iterator.hasNext(); downloadTime(busarrivalserviceoutputv2, null))
busarrivalserviceoutputv2 = (BusArrivalServiceOutputV2)iterator.next();
}
});
mBackButton.setOnClickListener(new android.view.View.OnClickListener() {
public void onClick(View view)
{
finish();
}
});
mListViewBusArrival.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView adapterview, View view, int i, long l)
{
String temp = (new StringBuilder()).append("B").append(busStopIdString).toString();
SDDataOutput temp2 = (SDDataOutput)(mBustArrivalAdapter.getItem(i));
if(temp2 instanceof BusArrivalServiceOutputV2)
{
temp2 = (BusArrivalServiceOutputV2)temp2;
Intent intent = new Intent(BusArrivalActivity.this, BusRouteActivity.class);
intent.putExtra("bus_number", ((BusArrivalServiceOutputV2) (temp2)).busNumber);
intent.putExtra("country_code", ((BusArrivalServiceOutputV2) (temp2)).countryCode);
intent.putExtra("bus_stop_id", temp);
startActivity(intent);
}
}
});
}
private void initLayout()
{
mMenuBar = (RelativeLayout)findViewById(R.id.MenuBar);
mBackButton = (Button)findViewById(R.id.BackButton);
mTitleBar = (TextView)findViewById(R.id.TitleBar);
mRefreshButton = (Button)findViewById(R.id.RefreshButton);
mLayoutHeader = (RelativeLayout)findViewById(R.id.layout_header);
mButtonBusinessPhoto = (ImageButton)findViewById(R.id.button_business_photo);
mTextviewTitle = (TextView)findViewById(R.id.textview_title);
mTextviewDetail = (TextView)findViewById(R.id.textview_detail);
mLayoutHeaderButton = (LinearLayout)findViewById(R.id.layout_header_button);
mButtonDirection = (Button)findViewById(R.id.button_direction);
mButtonMap = (Button)findViewById(R.id.button_map);
mButtonTips = (Button)findViewById(R.id.button_tips);
mListViewBusArrival = (ListView)findViewById(R.id.list_view_bus_arrival);
mProgressBar = (ProgressBar)findViewById(R.id.progressBar1);
mSdMobViewHolder = (RelativeLayout)findViewById(R.id.view_sdmob);
mButtonTips.setVisibility(View.INVISIBLE);
mButtonMap.setVisibility(View.INVISIBLE);
mButtonDirection.setVisibility(View.INVISIBLE);
initListView();
}
private void initListView()
{
if(mListViewBusArrival != null)
{
mBustArrivalAdapter = new BusArrivalAdapterV2(this);
mListViewBusArrival.setAdapter(mBustArrivalAdapter);
}
}
private void initialize()
{
initLayout();
initData();
initEvent();
}
private void updateSmallBanner()
{
mCurrentSmallBanner = SmallBanner.getBannerFromSdMobUnit(this, SdMobHelper.getInstance(this).getSdMobUnit(SdMob.ad_bnr_bus_listing));
// mCurrentSmallBanner.setAdMobSmallBannerListener(new streetdirectory.mobile.modules.sdmob.SmallBanner.AdMobSmallBannerListener() );
View view = mCurrentSmallBanner.getView(this);
mSdMobViewHolder.removeAllViews();
mSdMobViewHolder.addView(view, new ViewGroup.LayoutParams(-1, -1));
}
protected void notifiyListView()
{
mListViewBusArrival.post(new Runnable() {
public void run()
{
mBustArrivalAdapter.notifyDataSetChanged();
}
});
}
protected void onCreate(Bundle bundle)
{
onCreate(bundle);
setContentView(R.layout.activity_location_detail_bus_stop);
initialize();
updateSmallBanner();
LocalBroadcastManager.getInstance(this).registerReceiver(mSdMobReceiver, new IntentFilter("sdmob_broadcast"));
}
protected void onDestroy()
{
abortServices();
LocalBroadcastManager.getInstance(this).unregisterReceiver(mSdMobReceiver);
onDestroy();
}
protected void onPause()
{
abortServices();
onPause();
}
protected void onResume()
{
for(Iterator iterator = busArrivals.iterator(); iterator.hasNext(); downloadTime((BusArrivalServiceOutputV2)iterator.next(), null));
onResume();
}
private NearbyService _nearbyService;
private int adRequestRetryCount;
ArrayList busArrivals;
private String busStopIdString;
private int busStopIdint;
private ArrayList handlerList;
private SDHttpImageServicePool imagePool;
private Button mBackButton;
private BusArrivalAdapterV2 mBustArrivalAdapter;
private ImageButton mButtonBusinessPhoto;
private Button mButtonDirection;
private Button mButtonMap;
private Button mButtonTips;
private SmallBanner mCurrentSmallBanner;
LocationBusinessServiceOutput mData;
private RelativeLayout mLayoutHeader;
private LinearLayout mLayoutHeaderButton;
private ListView mListViewBusArrival;
private RelativeLayout mMenuBar;
private ProgressBar mProgressBar;
private Button mRefreshButton;
private BroadcastReceiver mSdMobReceiver;
private RelativeLayout mSdMobViewHolder;
private TextView mTextviewDetail;
private TextView mTextviewTitle;
private TextView mTitleBar;
/*
static int access$802(BusArrivalActivity busarrivalactivity, int i)
{
busarrivalactivity.adRequestRetryCount = i;
return i;
}
*/
/*
static int access$808(BusArrivalActivity busarrivalactivity)
{
int i = busarrivalactivity.adRequestRetryCount;
busarrivalactivity.adRequestRetryCount = i + 1;
return i;
}
*/
}
| [
"leoxinghai@hotmail.com"
] | leoxinghai@hotmail.com |
547782eb33c575e825be8d0e69f40ea0c7711db2 | e63021c2b0f8ff589980c46405c6f3f535a54259 | /carShop/CarDemo.java | 34a7658275563ed28a0ab170fd498bbea8c073d9 | [] | no_license | KBogoev/PROJECTS | a3efdf3ee96414e73556b0633c5abad02a9b9518 | 176b37d775e118e30e6e66b98644d0bef566295f | refs/heads/master | 2020-12-25T09:38:33.565192 | 2017-11-09T14:26:16 | 2017-11-09T14:26:16 | 63,007,284 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | package car.shop;
public class CarDemo {
public static void main(String[] args) {
CarShop kapitolia = new CarShop(12);
Car astra = new Car("Opel Astra");
Car zil150 = new Car("Zil 150");
Car naLilitoPasata = new Car("VW passat");
Car naKolioGklasata = new Car("G 550 AMG");
Car ladaNiva = new Car("LADA 2103");
Car naIvanAudito = new Car("Audi A4");
kapitolia.addCar(astra);
kapitolia.addCar(zil150);
kapitolia.addCar(naLilitoPasata);
kapitolia.addCar(naKolioGklasata);
kapitolia.addCar(ladaNiva);
kapitolia.addCar(naIvanAudito);
System.out.println(kapitolia.getNextCar().getModel());
Person pesho = new Person("Петър Петров", 22);
kapitolia.sellNextCar(pesho);
System.out.println("Sledvashta kola za prodavane e " + kapitolia.getNextCar().getModel());
Person gosho = new Person("Georgi", 23);
kapitolia.sellNextCar(gosho);
System.out.println("Sledvashta kola za prodavane e " + kapitolia.getNextCar().getModel());
Person krasi = new Person("Krasi", 28);
kapitolia.sellNextCar(krasi);
System.out.println("Sledvashta kola za prodavane e " + kapitolia.getNextCar().getModel());
}
}
| [
"k_bogoev@abv.bg"
] | k_bogoev@abv.bg |
8d1a51eee2f1fa66051f7fba5a71eb4d090b6a1a | a5a6746dbb1ac8651ed515dce90d6663bd3ce819 | /Assignment_2/j--/src/jminusminus/JConditionalExpression.java | a9a2509af4a090580a4b7eca8d0be3b4507fa09e | [] | no_license | BenBauf/LINGI2132-Langage_-_trad | b3ecd11a0518280a96c18ecacc9c24f901c47e02 | a7a97ae84096be74d60879357dcb52fea24fcff6 | refs/heads/master | 2020-05-27T01:51:12.152073 | 2014-05-12T14:05:09 | 2014-05-12T14:05:09 | 16,455,941 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,528 | java | package jminusminus;
public class JConditionalExpression extends JExpression {
/** the test expression of the conditional expression */
private JExpression testExpression;
/** the then expression of the conditional expression */
private JExpression thenExpression;
/** the else expression of the conditional expression */
private JExpression elseExpression;
/**
* Construct an AST node for a conditional expression, for example (a > b) ? a:b
*
* @param line
* line in which the conditional expression occurs in the
* source file.
* @param testE
* the test expression of the conditional expression.
* @param thenE
* the then expression of the conditional expression.
* @param elseE
* the else expression of the conditional expression.
*/
protected JConditionalExpression(int line, JExpression testE, JExpression thenE, JExpression elseE) {
super(line);
this.testExpression = testE;
this.thenExpression = thenE;
this.elseExpression = elseE;
}
@Override
public JExpression analyze(Context context) {
testExpression = (JExpression) testExpression.analyze(context);
thenExpression = (JExpression) thenExpression.analyze(context);
elseExpression = (JExpression) elseExpression.analyze(context);
testExpression.type().mustMatchExpected(line(),Type.BOOLEAN);
type = thenExpression.type();
return this;
}
@Override
public void codegen(CLEmitter output) {
String endLabel = output.createLabel();
String elseLabel = output.createLabel();
testExpression.codegen(output, elseLabel, false);
thenExpression.codegen(output);
output.addBranchInstruction(jminusminus.CLConstants.GOTO, endLabel);
output.addLabel(elseLabel);
elseExpression.codegen(output);
output.addLabel(endLabel);
}
public void writeToStdOut(PrettyPrinter p) {
p.printf("<JConditionalExpression line=\"%d\">\n", line());
p.indentRight();
p.printf("<TestExpression>\n");
p.indentRight();
testExpression.writeToStdOut(p);
p.indentLeft();
p.printf("</TestExpression>\n");
p.printf("<ThenExpression>\n");
p.indentRight();
thenExpression.writeToStdOut(p);
p.indentLeft();
p.printf("</ThenExpression>\n");
p.printf("<ElseExpression>\n");
p.indentRight();
elseExpression.writeToStdOut(p);
p.indentLeft();
p.printf("</ElseExpression>\n");
p.indentLeft();
p.printf("</JConditionalExpression>\n");
}
}
| [
"benoit.baufays@conceptbandb.be"
] | benoit.baufays@conceptbandb.be |
fbdbc8abda7ffe4e7b5cfaf28d2992a71e26601a | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project2/src/main/java/org/gradle/test/performance2_2/Production2_175.java | 0ffa1a5a7e0068b30854f02eae2cd72665580c80 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 300 | java | package org.gradle.test.performance2_2;
public class Production2_175 extends org.gradle.test.performance1_2.Production1_175 {
private final String property;
public Production2_175() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
236266b10bcf3b7a794784c90526e795e697963e | 2d9b654240dcb8927d8817499e42e48259a8c8c5 | /umax-sample/umax-sample-security/src/main/java/com/threeti/umax/sample/security/dao/UserDao.java | 2aa7bd875bc18e16dc66cedc707adab65ee9b325 | [] | no_license | bluishglc/demo-lib | 848d64716bc24c46b5095dfb7a6b469a228d49d4 | eb980fc1fdd17cfc420e71ba1bb9cee3d1ccc9a0 | refs/heads/master | 2021-01-18T22:47:12.867448 | 2016-03-17T06:02:25 | 2016-03-17T06:02:25 | 19,969,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,580 | java | package com.threeti.umax.sample.security.dao;
import com.threeti.umax.sample.security.model.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* User Data Access Object (GenericDao) interface.
*
* @author laurence.geng</a>
*/
public interface UserDao extends GenericDao<User, Long> {
/**
* Gets users information based on login name.
* @param username the user's username
* @return userDetails populated userDetails object
* @throws org.springframework.security.core.userdetails.UsernameNotFoundException thrown when user not
* found in database
*/
@Transactional
UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
/**
* Gets a list of users ordered by the uppercase version of their username.
*
* @return List populated list of users
*/
List<User> getUsers();
/**
* Saves a user's information.
* @param user the object to be saved
* @return the persisted User object
*/
User saveUser(User user);
/**
* Retrieves the password in DB for a user
* @param username the user's username
* @return the password in DB, if the user is already persisted
*/
@Transactional(propagation = Propagation.NOT_SUPPORTED)
String getUserPassword(String username);
}
| [
"bluishglc@126.com"
] | bluishglc@126.com |
d7a971d049e485902cbc7ad4c11606988de0ae36 | 97b46ff38b675d934948ff3731cf1607a1cc0fc9 | /DataPack/dist/game/data/scripts/ai/npc/BlackMarketeerOfMammon/BlackMarketeerOfMammon.java | 2fbe06a546ab50abdaaae347194b1cebcb3d79a7 | [] | no_license | l2brutal/pk-elfo_H5 | a6703d734111e687ad2f1b2ebae769e071a911a4 | 766fa2a92cb3dcde5da6e68a7f3d41603b9c037e | refs/heads/master | 2020-12-28T13:33:46.142303 | 2016-01-20T09:53:10 | 2016-01-20T09:53:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,561 | java | package ai.npc.BlackMarketeerOfMammon;
import java.util.Calendar;
import pk.elfo.gameserver.model.actor.L2Npc;
import pk.elfo.gameserver.model.actor.instance.L2PcInstance;
import pk.elfo.gameserver.model.itemcontainer.PcInventory;
import pk.elfo.gameserver.model.quest.QuestState;
import pk.elfo.gameserver.model.quest.State;
import pk.elfo.gameserver.model.quest.QuestState.QuestType;
import ai.npc.AbstractNpcAI;
/**
* Black Marketeer of Mammon - Exchange Adena for AA.
*/
public class BlackMarketeerOfMammon extends AbstractNpcAI
{
// NPC
private static final int BLACK_MARKETEER = 31092;
// Misc
private static final int MIN_LEVEL = 60;
private BlackMarketeerOfMammon(String name, String descr)
{
super(name, descr);
addStartNpc(BLACK_MARKETEER);
addTalkId(BLACK_MARKETEER);
}
@Override
public String onTalk(L2Npc npc, L2PcInstance talker)
{
return exchangeAvailable() ? "31092-01.html" : "31092-02.html";
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
QuestState qs = player.getQuestState(getName());
if ("exchange".equals(event))
{
if (exchangeAvailable())
{
if (player.getLevel() >= MIN_LEVEL)
{
if (!qs.isNowAvailable())
{
htmltext = "31092-03.html";
}
else
{
if (player.getAdena() >= 2000000)
{
qs.setState(State.STARTED);
takeItems(player, PcInventory.ADENA_ID, 2000000);
giveItems(player, PcInventory.ANCIENT_ADENA_ID, 500000);
htmltext = "31092-04.html";
qs.exitQuest(QuestType.DAILY, false);
}
else
{
htmltext = "31092-05.html";
}
}
}
else
{
htmltext = "31092-06.html";
}
}
else
{
htmltext = "31092-02.html";
}
}
return htmltext;
}
private boolean exchangeAvailable()
{
Calendar currentTime = Calendar.getInstance();
Calendar minTime = Calendar.getInstance();
minTime.set(Calendar.HOUR_OF_DAY, 20);
minTime.set(Calendar.MINUTE, 0);
minTime.set(Calendar.SECOND, 0);
Calendar maxtTime = Calendar.getInstance();
maxtTime.set(Calendar.HOUR_OF_DAY, 23);
maxtTime.set(Calendar.MINUTE, 59);
maxtTime.set(Calendar.SECOND, 59);
return (currentTime.compareTo(minTime) >= 0) && (currentTime.compareTo(maxtTime) <= 0);
}
public static void main(String[] args)
{
new BlackMarketeerOfMammon(BlackMarketeerOfMammon.class.getSimpleName(), "ai/npc");
}
} | [
"PkElfo@13720c4f-9a1f-4619-977f-b36a0ac534ba"
] | PkElfo@13720c4f-9a1f-4619-977f-b36a0ac534ba |
20dc5a53468864ee02496a5dd146d8a43f78b5ab | aee5a9ddebae06d2b5cce7b6ef1c401dd3890f2d | /app/cn/bmkp/jiang/droolscost/User.java | 9105578c0c26cebcf630b6c583c3c18383ef0490 | [
"Apache-2.0"
] | permissive | jiang7462582/drool-demo-sample | c58167db50c0d53ec14c6325bd0c6a30e1f5e35d | 871bc88839ca858a4e9fb6a465a56f1434e3523b | refs/heads/master | 2020-04-06T07:57:21.306050 | 2016-08-22T10:08:02 | 2016-08-22T10:08:02 | 63,682,841 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | package cn.bmkp.jiang.droolscost;
/**
* Created by jiang on 16/7/19.
*/
public class User implements java.io.Serializable {
static final long serialVersionUID = 1L;
public Long uid;
public Long distance;
public Long waitTime;
public Double cost;
public User()
{
}
public Long getUid()
{
return uid;
}
public void setUid(Long uid)
{
this.uid = uid;
}
public Long getDistance()
{
return distance;
}
public void setDistance(Long distance)
{
this.distance = distance;
}
public Long getWaitTime()
{
return waitTime;
}
public void setWaitTime(Long waitTime)
{
this.waitTime = waitTime;
}
public Double getCost()
{
return cost;
}
public void setCost(Double cost)
{
this.cost = cost;
}
public User(java.lang.Long uid, java.lang.Long distance,
java.lang.Long waitTime, java.lang.Double cost)
{
this.uid = uid;
this.distance = distance;
this.waitTime = waitTime;
this.cost = cost;
}
} | [
"jiang7462582@126.com"
] | jiang7462582@126.com |
46f31df8690ab622cbf05df326a174f2a45a1063 | 7c22226146b98746c0a686a2c2ad6b52e4c44415 | /src/main/java/com/assignment/urlshortener/urlshortener/model/URLMap.java | 6a78b829a1019d88f15370a4ebe6dfef07467ee9 | [] | no_license | joshcarroll93/urlshortener | 8b80f909dc34ed63ec4bd76028838b32c84b425f | f32814aaa41324bf316bb6cdc3a2f50ff504d7b5 | refs/heads/master | 2023-03-02T22:20:17.886956 | 2021-02-12T16:02:55 | 2021-02-12T16:02:55 | 337,109,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package com.assignment.urlshortener.urlshortener.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class URLMap {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private int id;
public String originalurl;
private String shorturl;
public URLMap(){};
public URLMap(String originalurl) {
this.originalurl = originalurl;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getOriginalUrl() {
return originalurl;
}
public void setOriginalUrl(String originalurl) {
this.originalurl = originalurl;
}
public String getShortUrl() {
return shorturl;
}
public void setShortUrl(String shortUrl) {
this.shorturl = shortUrl;
}
}
| [
"93.joshuacarroll@gmail.com"
] | 93.joshuacarroll@gmail.com |
2e8bd8f7f993626772d4ab7aeececff05e277e4d | 68b04fba94109569971046c8f31d6991aa09bbce | /milton/milton-api/src/main/java/com/bradmcevoy/http/http11/PutHelper.java | df754ee4b378e5ef6fefd0194c478ace04841ca0 | [
"Apache-2.0"
] | permissive | ponns/milton | 44ae16df122ec18d872aac17d950034262d84430 | 43d442d60833ae67de87153b809086b712004e9c | refs/heads/master | 2021-01-11T10:47:47.928748 | 2012-06-03T14:17:18 | 2012-06-03T14:17:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,120 | java | /*
* Copyright (C) 2012 McEvoy Software Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.bradmcevoy.http.http11;
import com.bradmcevoy.common.ContentTypeUtils;
import com.bradmcevoy.common.Path;
import com.bradmcevoy.http.*;
import com.bradmcevoy.http.exceptions.BadRequestException;
import com.bradmcevoy.http.exceptions.ConflictException;
import com.bradmcevoy.http.exceptions.NotAuthorizedException;
import com.bradmcevoy.http.exceptions.NotFoundException;
import com.ettrema.common.LogUtils;
import java.io.IOException;
import java.io.OutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A collection of utility methods for PutHandler
*
*/
public class PutHelper {
private static final Logger log = LoggerFactory.getLogger( PutHelper.class );
/**
* Largly copied from tomcat
*
* See the spec
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
*
* @param r
* @param request
* @return
* @throws IOException
* @throws BadRequestException - if the range header is invalid
*/
public Range parseContentRange(Resource r, Request request) throws IOException, BadRequestException {
// Retrieving the content-range header (if any is specified
String rangeHeader = request.getContentRangeHeader();
if (rangeHeader == null) {
return null;
}
// bytes is the only range unit supported
if (!rangeHeader.startsWith("bytes")) {
log.warn("Invalid range header, does not start with 'bytes': " + rangeHeader);
throw new BadRequestException(r);
}
rangeHeader = rangeHeader.substring(6).trim();
int dashPos = rangeHeader.indexOf('-');
int slashPos = rangeHeader.indexOf('/');
if (dashPos == -1) {
log.warn("Invalid range header, dash not found: " + rangeHeader);
throw new BadRequestException(r);
}
if (slashPos == -1) {
log.warn("Invalid range header, slash not found: " + rangeHeader);
throw new BadRequestException(r);
}
String s;
long start;
s = rangeHeader.substring(0, dashPos);
try {
start = Long.parseLong(s);
} catch (NumberFormatException e) {
log.warn("Invalid range header, start is not a valid number: " + s + " Raw header:" + rangeHeader);
throw new BadRequestException(r);
}
long finish;
s = rangeHeader.substring(dashPos + 1, slashPos);
try {
finish = Long.parseLong(s);
} catch (NumberFormatException e) {
log.warn("Invalid range header, finish is not a valid number: " + s + " Raw header:" + rangeHeader);
throw new BadRequestException(r);
}
Range range = new Range(start, finish);
if (!validate(range)) {
throw new BadRequestException(r);
}
return range;
}
private boolean validate(Range r) {
if( r.getStart() < 0 ) {
log.warn("invalid range, start is negative");
return false;
} else if( r.getFinish() < 0 ) {
log.warn("invalid range, finish is negative");
return false;
} else if( r.getStart() > r.getFinish()) {
log.warn("invalid range, start is greater then finish");
return false;
} else {
return true;
}
}
public Long getContentLength( Request request ) throws BadRequestException {
Long l = request.getContentLengthHeader();
if( l == null ) {
String s = request.getRequestHeader( Request.Header.X_EXPECTED_ENTITY_LENGTH );
if( s != null && s.length() > 0 ) {
log.debug( "no content-length given, but founhd non-standard length header: " + s );
try {
l = Long.parseLong( s );
} catch( NumberFormatException e ) {
throw new BadRequestException( null, "invalid length for header: " + Request.Header.X_EXPECTED_ENTITY_LENGTH.code + ". value is: " + s );
}
}
}
return l;
}
/**
* returns a textual representation of the list of content types for the
* new resource. This will be the content type header if there is one,
* otherwise it will be determined by the file name
*
* @param request
* @param newName
* @return
*/
public String findContentTypes( Request request, String newName ) {
// String ct = request.getContentTypeHeader();
// if( ct != null ) {
// LogUtils.trace(log, "findContentTypes: got header: " + ct);
// return ct;
// }
String s = ContentTypeUtils.findContentTypes( newName );
LogUtils.trace(log, "findContentTypes: got type from name. Type: " + s);
return s;
}
public CollectionResource findNearestParent( HttpManager manager, String host, Path path ) throws NotAuthorizedException, ConflictException, BadRequestException {
if( path == null ) return null;
Resource thisResource = manager.getResourceFactory().getResource( host, path.toString() );
if( thisResource != null ) {
if( thisResource instanceof CollectionResource ) {
return (CollectionResource) thisResource;
} else {
log.warn( "parent is not a collection: " + path );
return null;
}
}
CollectionResource parent = findNearestParent( manager, host, path.getParent() );
return parent;
}
/**
* Copy the current content of the resource to the outputstream, except
* writing the new partial update for the given range.
*
*
* @param replacee - the resource to get the content for and to update
* @param request
* @param range
* @param tempOut
*/
public void applyPartialUpdate(GetableResource replacee, Request request, Range range, OutputStream tempOut) throws NotAuthorizedException, BadRequestException, NotFoundException {
try {
replacee.sendContent(tempOut, null, null, null);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
| [
"kwsalyaa@gmail.com"
] | kwsalyaa@gmail.com |
68a139d25b8156c9af91588493fc01f1fa61e8f9 | fe86510c19d5fb9814ca758b96e3c8a6d7edc4f8 | /dsa/src/_java/dsa/bstreenode.java | 74e677c2eacb62b089b349079bc2d5c82408145f | [] | no_license | xavierguan/dsa_optm | 92560a221c3c752286c733bd5a1722b5986d73db | 3b821fc9cc20297f5c555f898b6179cfce8072f7 | refs/heads/master | 2021-01-12T06:12:51.307672 | 2016-12-27T15:28:30 | 2016-12-27T15:28:30 | 77,326,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,538 | java | /* *****************************************************************************************
* Data Structures in C++
* ISBN: 7-302-33064-6 & 7-302-33065-3 & 7-302-29652-2 & 7-302-26883-3
* Junhui DENG, deng@tsinghua.edu.cn
* Computer Science & Technology, Tsinghua University
* Copyright (c) 2006-2013. All rights reserved.
***************************************************************************************** */
/*
* 基于链表实现的BST节点类
*/
package dsa;
public class BSTreeNode extends BinTreeNode implements BinTreePosition, Entry {
/* *************************** 构造方法 *************************** */
public BSTreeNode()
{ super(); }
public BSTreeNode(
Object e,//节点内容
BinTreePosition p,//父节点
boolean asLChild,//是否作为父节点的左孩子
BinTreePosition l,//左孩子
BinTreePosition r)//右孩子
{ super(e, p, asLChild, l, r); }
/* *************************** 实现Entry接口的方法 *************************** */
//返回当前节点的关键码
public Object getKey()
{ return ((Entry)getElem()).getKey(); }
//修改条目的关键码,返回此前存放的关键码
public Object setKey(Object k)
{ return ((Entry)getElem()).setKey(k); }
//取条目的数据对象
public Object getValue()
{ return ((Entry)getElem()).getValue(); }
//修改条目的数据对象,返回此前存放的数据对象
public Object setValue(Object v)
{ return ((Entry)getElem()).setValue(v); }
}
| [
"gtlab.dev@outlook.com"
] | gtlab.dev@outlook.com |
60bd6cf94c3c98f8e355c4aac16174d23af30927 | 3acf11f5b153cd6156c8da9c7823ad804625a165 | /SkellettGit/src/com/gmail/thelimeglass/Npcs/CondEntityIsNpc.java | 8d3bbda200aae69751fec88bc965d68bdbdbf1a8 | [] | no_license | MCBRasil/Skellett | 0615e34d905ea5acb964afc5ec2404afd7141c49 | f5b82a2bf997e6dd3c5c838e1dfb788fc9650e4c | refs/heads/master | 2021-01-20T16:55:18.317339 | 2017-02-18T02:26:28 | 2017-02-18T02:26:28 | null | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 1,328 | java | package com.gmail.thelimeglass.Npcs;
import javax.annotation.Nullable;
import org.bukkit.entity.Entity;
import org.bukkit.event.Event;
import com.gmail.thelimeglass.Utils.Config;
import com.gmail.thelimeglass.Utils.FullConfig;
import com.gmail.thelimeglass.Utils.MainConfig;
import com.gmail.thelimeglass.Utils.Syntax;
import ch.njol.skript.lang.Condition;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.util.Kleenean;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.npc.NPCRegistry;
@Syntax("[entity] %entity% (1Žis|2Žis(n't| not)) [a[n]] (npc|citizen)")
@Config("PluginHooks.Npc")
@FullConfig
@MainConfig
public class CondEntityIsNpc extends Condition {
private Expression<Entity> entity;
@SuppressWarnings("unchecked")
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
entity = (Expression<Entity>) e[0];
setNegated(parser.mark == 1);
return true;
}
public String toString(@Nullable Event e, boolean arg1) {
return "(npc|citizen) %npc% (1Žis|2Žis(n't| not)) spawned";
}
public boolean check(Event e) {
NPCRegistry registry = CitizensAPI.getNPCRegistry();
if (registry.isNPC(entity.getSingle(e))) {
return isNegated();
} else {
return !isNegated();
}
}
} | [
"seantgrover@gmail.com"
] | seantgrover@gmail.com |
35ec663519b20b88387b853771a03854c1f27252 | 08c637545ec4a0d35304054cec9db8dbcd7ff18a | /作业/阶段一/模块二-Spring/Code/transfer/src/main/java/com/study/utils/LogUtils.java | 4334b79b4df2e99b144f947820ec8a1d0117020c | [] | no_license | zhuzhudan/zhudan | 6ecdf5b87727326d6a415ef5c456e3174761d785 | 33685589185aed1b91393979aea2624f7af317bb | refs/heads/master | 2022-12-24T06:04:41.334499 | 2021-02-08T03:11:36 | 2021-02-08T03:11:36 | 228,524,576 | 0 | 0 | null | 2022-12-16T04:42:50 | 2019-12-17T03:24:13 | HTML | UTF-8 | Java | false | false | 1,955 | java | package com.study.utils;
import com.springframework.annotation.Component;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
@Component
@Aspect
public class LogUtils {
@Pointcut("execution(* com.study.service.impl.TransferServiceImpl.*(..))")
public void pt1(){
}
/**
* 业务逻辑开始执行之前执行
*/
@Before("pt1()")
public void beforeMethod(JoinPoint joinPoint){
Object[] args = joinPoint.getArgs();
for (Object arg : args) {
System.out.println(arg);
}
System.out.println("业务逻辑开始执行之前执行");
}
/**
* 业务逻辑结束执行时执行(无论异常与否)
*/
@After("pt1()")
public void afterMethod(){
System.out.println("业务逻辑结束时执行,无论异常与否");
}
/**
* 业务逻辑异常时执行
*/
@AfterThrowing("pt1()")
public void exceptionMethod(){
System.out.println("业务逻辑异常时执行");
}
/**
* 业务逻辑正常结束执行时执行
*/
@AfterReturning(value = "pt1()", returning = "retVal")
public void successMethod(Object retVal){
System.out.println("业务逻辑正常结束时执行");
}
/**
* 业务逻辑正常结束执行时执行
*/
@Around("pt1()")
public Object aroundMethod(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
System.out.println("before method");
Object result = null;
try {
result = proceedingJoinPoint.proceed(proceedingJoinPoint.getArgs());
}catch (Exception e){
System.out.println("exception method:"+ result);
} finally {
System.out.println("finally method");
}
System.out.println("after method");
System.out.println("环绕通知");
return result;
}
}
| [
"dan.zhu@aliyun.com"
] | dan.zhu@aliyun.com |
a5e42367a5ab80dfc337e2a6854bde3ad17a69b9 | 8fffa1cba01f29311df876530b289dfe56b2e408 | /app/src/main/java/com/cricket/material/cricket/UpComingMatchesFragment.java | 71ce0e249b92b170e14caa82e08de37225da1e9b | [] | no_license | kairon007/Cricket | 33d4abda299a2abdd73b637123c33e80737a2755 | 48e95eab335eb07ecf5947e5784756f288632fd4 | refs/heads/master | 2021-01-15T21:43:52.883259 | 2015-09-12T15:37:34 | 2015-09-12T15:37:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,947 | java | package com.cricket.material.cricket;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.cricket.material.cricket.Upcoming.Match;
/**
* Created by smitald on 9/4/2015.
*/
public class UpComingMatchesFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
private static final String ARG_SECTION_NUMBER = "section_number";
public static final String NEWS_URL = "NEWS_URL";
private static final String includes_news = "select * from cricket.news where region=\"in\"";
private SimpleSectionAdapter<Match> mAdapter;
/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static NewsFragment newInstance(int sectionNumber) {
NewsFragment fragment = new NewsFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
public UpComingMatchesFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_upcoming, container, false);
ListView listView = (ListView) rootView.findViewById(R.id.listview_upcoming);
mAdapter = new SimpleSectionAdapter<Match>(listView, R.layout.upcoming_match_header,
R.layout.upcoming_match_item) {
@Override
public void onSectionItemClick(Match item) {
}
};
listView.setAdapter(mAdapter);
return rootView;
}
}
| [
"desaismital@gmail.com"
] | desaismital@gmail.com |
1dcb7532d52a2b953f238b19cda54fecc0dc0782 | de18d6c11f968c199882c39e66a1e63ce0e723fa | /src/java/services/CategoriaService.java | d09d4ce111647c2e277e3fbf674b602308755b04 | [] | no_license | ThiVieiraDev/College_projeto_POO2 | 2bf75649eec4edac0ddfc4ddc2be9fb4d84083d2 | 2342ffd3f31e2221c18e92da97e27d8320385247 | refs/heads/master | 2022-01-11T17:05:12.637924 | 2019-06-11T14:43:56 | 2019-06-11T14:43:56 | 191,248,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package services;
import generico.BDService;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import modelos.Categoria;
public class CategoriaService extends BDService <Categoria, Integer> {
}
| [
"conta@TzVieira"
] | conta@TzVieira |
ee24fbe63b7e8cde1e19c1d816de88280e038839 | c3a427af959bce4717c06ea59d881740d3600005 | /src/main/java/com/example/jwt/repository/UserRepository.java | 9cecf4b2f78d9529199b35711265816e01ebf969 | [] | no_license | sayedahammed/spring-boot-jwt-auth | 55e9a9c976c6ed00d80108d0d90f50e3d11786db | 4945f8fda09424212c032d77017626d6a5aca4fd | refs/heads/master | 2023-03-22T02:24:45.259994 | 2021-03-10T06:12:35 | 2021-03-10T06:12:35 | 346,003,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package com.example.jwt.repository;
import com.example.jwt.models.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findByUsername(String username);
Boolean existsByUsername(String username);
Boolean existsByEmail(String email);
}
| [
"sayed.ahammed@reddotdigitalit.com"
] | sayed.ahammed@reddotdigitalit.com |
2e3680baeb1099df601351e5cb89fdd8b081ef30 | 15dd221e1cb01bb3952755923aa1b74be52dba07 | /contoh.java | 7a3692132dd1fec95693ff90e2f3aed92c32257e | [] | no_license | NurulFitriani/tes | 5bced7f28f4257bcfaef405b10a0aa43f3308e9e | de118f1093d6624cb278c582ab57736a54df2f45 | refs/heads/master | 2020-03-30T12:31:07.082194 | 2018-10-02T10:34:12 | 2018-10-02T10:34:12 | 151,227,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package tipedata;
public class contoh {
public int sethasil;
public int hasil;
public int sethasil1;
public int sethasil2;
public void setpanjang(int i) {
// TODO Auto-generated method stub
}
public void setlebar(int i) {
// TODO Auto-generated method stub
}
public int getpanjang() {
// TODO Auto-generated method stub
return 0;
}
public int getlebar() {
// TODO Auto-generated method stub
return 0;
}
}
| [
"noreply@github.com"
] | NurulFitriani.noreply@github.com |
326f5ed5337bb15e418ccd3adcf8dba65ef2e53e | b690d16eadce75ddf8dd45bba3171fd1236925a9 | /Lab8/spr/src/main/java/com/iot/spring/spr/Repository/SportsmanRepository.java | 23773949e545a3cf1b643d7dbf8a56df1d26456f | [] | no_license | Sv1at1k/DataBases | 60558dc177493bbfff8c3e6b47fde5c3083b526b | ebff78fe5a3bebb4287480e885fa2669d0134de9 | refs/heads/master | 2020-04-01T07:17:37.127623 | 2018-11-05T20:54:32 | 2018-11-05T20:54:32 | 152,984,280 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package com.iot.spring.spr.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iot.spring.spr.domain.Category;
import com.iot.spring.spr.domain.Sportsman;
public interface SportsmanRepository extends JpaRepository<Sportsman, Integer> {
}
| [
"sviatik1208@gmail.com"
] | sviatik1208@gmail.com |
b12b9e5fb2e7bcc70efa8ab6c40ed031c7c587c6 | 08c5675ad0985859d12386ca3be0b1a84cc80a56 | /src/main/java/com/sun/jmx/snmp/agent/SnmpMibOid.java | 78ba7fa1a32fafaab93de3f3e9130d82a994224c | [] | no_license | ytempest/jdk1.8-analysis | 1e5ff386ed6849ea120f66ca14f1769a9603d5a7 | 73f029efce2b0c5eaf8fe08ee8e70136dcee14f7 | refs/heads/master | 2023-03-18T04:37:52.530208 | 2021-03-09T02:51:16 | 2021-03-09T02:51:16 | 345,863,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,010 | java | /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.jmx.snmp.agent;
// java imports
//
import java.io.Serializable;
import java.util.Vector;
import java.util.Enumeration;
// jmx imports
//
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
/**
* Represents a node in an SNMP MIB which is neither a group nor a variable.
* This class defines a list of sub-nodes and the methods that allow to
* manipulate the sub-nodes.
* <P>
* This class is used internally and by the class generated by
* <CODE>mibgen</CODE>.
* You should not need to use this class directly.
*
* <p><b>This API is a Sun Microsystems internal API and is subject
* to change without notice.</b></p>
*/
public class SnmpMibOid extends SnmpMibNode implements Serializable {
private static final long serialVersionUID = 5012254771107446812L;
/**
* Default constructor.
*/
public SnmpMibOid() {
}
// PUBLIC METHODS
//---------------
/**
* Generic handling of the <CODE>get</CODE> operation.
*
* <p> This method should be overridden in subclasses.
* <p>
*
* @param req The sub-request that must be handled by this node.
* @param depth The depth reached in the OID tree.
* @throws SnmpStatusException The default implementation (if not
* overridden) is to generate a SnmpStatusException.
*/
@Override
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
for (Enumeration<SnmpVarBind> e = req.getElements(); e.hasMoreElements(); ) {
SnmpVarBind var = e.nextElement();
SnmpStatusException x =
new SnmpStatusException(SnmpStatusException.noSuchObject);
req.registerGetException(var, x);
}
}
/**
* Generic handling of the <CODE>set</CODE> operation.
*
* <p> This method should be overridden in subclasses.
* <p>
*
* @param req The sub-request that must be handled by this node.
* @param depth The depth reached in the OID tree.
* @throws SnmpStatusException The default implementation (if not
* overridden) is to generate a SnmpStatusException.
*/
@Override
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
for (Enumeration<SnmpVarBind> e = req.getElements(); e.hasMoreElements(); ) {
SnmpVarBind var = e.nextElement();
SnmpStatusException x =
new SnmpStatusException(SnmpStatusException.noAccess);
req.registerSetException(var, x);
}
}
/**
* Generic handling of the <CODE>check</CODE> operation.
*
* <p> This method should be overridden in subclasses.
* <p>
*
* @param req The sub-request that must be handled by this node.
* @param depth The depth reached in the OID tree.
* @throws SnmpStatusException The default implementation (if not
* overridden) is to generate a SnmpStatusException.
*/
@Override
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
for (Enumeration<SnmpVarBind> e = req.getElements(); e.hasMoreElements(); ) {
SnmpVarBind var = e.nextElement();
SnmpStatusException x =
new SnmpStatusException(SnmpStatusException.noAccess);
req.registerCheckException(var, x);
}
}
// ---------------------------------------------------------------------
//
// Implements the method defined in SnmpMibNode.
//
// ---------------------------------------------------------------------
//
@Override
void findHandlingNode(SnmpVarBind varbind,
long[] oid, int depth,
SnmpRequestTree handlers)
throws SnmpStatusException {
final int length = oid.length;
SnmpMibNode node = null;
if (handlers == null)
throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
if (depth > length) {
// Nothing is left... the oid is not valid
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
} else if (depth == length) {
// The oid is not complete...
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
} else {
// Some children variable or subobject is being querried
// getChild() will raise an exception if no child is found.
//
final SnmpMibNode child = getChild(oid[depth]);
// XXXX zzzz : what about null children?
// (variables for nested groups)
// if child==null, then we're dealing with a variable or
// a table: we register this node.
// This behaviour should be overriden in subclasses,
// in particular in group meta classes: the group
// meta classes that hold tables should take care
// of forwarding this call to all the tables involved.
//
if (child == null)
handlers.add(this, depth, varbind);
else
child.findHandlingNode(varbind, oid, depth + 1, handlers);
}
}
// ---------------------------------------------------------------------
//
// Implements the method defined in SnmpMibNode.
//
// ---------------------------------------------------------------------
//
@Override
long[] findNextHandlingNode(SnmpVarBind varbind,
long[] oid, int pos, int depth,
SnmpRequestTree handlers,
AcmChecker checker)
throws SnmpStatusException {
final int length = oid.length;
SnmpMibNode node = null;
long[] result = null;
if (handlers == null) {
// This should be considered as a genErr, but we do not want to
// abort the whole request, so we're going to throw
// a noSuchObject...
//
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
final Object data = handlers.getUserData();
final int pduVersion = handlers.getRequestPduVersion();
if (pos >= length) {
long[] newOid = new long[1];
newOid[0] = getNextVarId(-1, data, pduVersion);
result = findNextHandlingNode(varbind, newOid, 0, depth, handlers,
checker);
return result;
}
// search the element specified in the oid
//
long[] newOid = new long[1];
long index = oid[pos];
while (true) {
try {
final SnmpMibNode child = getChild(index);
// SnmpOid result = null;
if (child == null) {
// shouldn't happen
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
// validateVarId(index);
// handlers.add(this,varbind,depth);
// result = new SnmpOid(0);
} else {
checker.add(depth, index);
try {
result = child.findNextHandlingNode(varbind, oid, pos + 1,
depth + 1, handlers,
checker);
} finally {
checker.remove(depth);
}
}
// Build up the leaf OID
result[depth] = index;
return result;
} catch (SnmpStatusException e) {
// If there is no such element go one level up ...
//
index = getNextVarId(index, data, pduVersion);
// There is no need to carry the original oid ...
newOid[0] = index;
pos = 1;
oid = newOid;
}
}
}
/**
* Computes the root OID of the MIB.
*/
@Override
public void getRootOid(Vector<Integer> result) {
// If a node has several children, let assume that we are one step to
// far in order to get the MIB root.
//
if (nbChildren != 1)
return;
result.addElement(varList[0]);
// Now query our child.
//
children.firstElement().getRootOid(result);
}
/**
* Registers a specific node in the tree.
*/
public void registerNode(String oidString, SnmpMibNode node)
throws IllegalAccessException {
SnmpOid oid = new SnmpOid(oidString);
registerNode(oid.longValue(), 0, node);
}
// PROTECTED METHODS
//------------------
/**
* Registers a specific node in the tree.
*/
void registerNode(long[] oid, int cursor, SnmpMibNode node)
throws IllegalAccessException {
if (cursor >= oid.length)
throw new IllegalAccessException();
// Check if the node is already defined
//
long var = oid[cursor];
//System.out.println("entering registration for val="
// + String.valueOf(var) + " position= " + cursor);
int pos = retrieveIndex(var);
if (pos == nbChildren) {
nbChildren++;
varList = new int[nbChildren];
varList[0] = (int) var;
pos = 0;
if ((cursor + 1) == oid.length) {
// That 's the end of the trip.
// Do not forward the registration
//System.out.println("End of trip for val="
// + String.valueOf(var) + " position= " + cursor);
children.insertElementAt(node, pos);
return;
}
//System.out.println("Create node for val="
// + String.valueOf(var) + " position= " + cursor);
SnmpMibOid child = new SnmpMibOid();
children.insertElementAt(child, pos);
child.registerNode(oid, cursor + 1, node);
return;
}
if (pos == -1) {
// The node is not yet registered
//
int[] tmp = new int[nbChildren + 1];
tmp[nbChildren] = (int) var;
System.arraycopy(varList, 0, tmp, 0, nbChildren);
varList = tmp;
nbChildren++;
SnmpMibNode.sort(varList);
int newPos = retrieveIndex(var);
varList[newPos] = (int) var;
if ((cursor + 1) == oid.length) {
// That 's the end of the trip.
// Do not forward the registration
//System.out.println("End of trip for val="
// + String.valueOf(var) + " position= " + cursor);
children.insertElementAt(node, newPos);
return;
}
SnmpMibOid child = new SnmpMibOid();
// System.out.println("Create node for val=" +
// String.valueOf(var) + " position= " + cursor);
children.insertElementAt(child, newPos);
child.registerNode(oid, cursor + 1, node);
} else {
// The node is already registered
//
SnmpMibNode child = children.elementAt(pos);
if ((cursor + 1) == oid.length) {
//System.out.println("Node already registered val=" +
// String.valueOf(var) + " position= " + cursor);
if (child == node) return;
if (child != null && node != null) {
// Now we're going to patch the tree the following way:
// if a subgroup has been registered before its father,
// we're going to replace the father OID node with
// the actual group-node and export the children from
// the temporary OID node to the actual group node.
//
if (node instanceof SnmpMibGroup) {
// `node' is a group => replace `child' with `node'
// export the child's subtree to `node'.
//
((SnmpMibOid) child).exportChildren((SnmpMibOid) node);
children.setElementAt(node, pos);
return;
} else if ((node instanceof SnmpMibOid) &&
(child instanceof SnmpMibGroup)) {
// `node' is a temporary node, and `child' is a
// group => keep child and export the node's
// subtree to `child'.
//
((SnmpMibOid) node).exportChildren((SnmpMibOid) child);
return;
} else if (node instanceof SnmpMibOid) {
// `node' and `child' are both temporary OID nodes
// => replace `child' with `node' and export child's
// subtree to `node'.
//
((SnmpMibOid) child).exportChildren((SnmpMibOid) node);
children.setElementAt(node, pos);
return;
}
}
children.setElementAt(node, pos);
} else {
if (child == null)
throw new IllegalAccessException();
((SnmpMibOid) child).registerNode(oid, cursor + 1, node);
}
}
}
/**
* Export this node's children to a brother node that will replace
* this node in the OID tree.
* This method is a patch that fixes the problem of registering
* a subnode before its father node.
**/
void exportChildren(SnmpMibOid brother)
throws IllegalAccessException {
if (brother == null) return;
final long[] oid = new long[1];
for (int i = 0; i < nbChildren; i++) {
final SnmpMibNode child = children.elementAt(i);
if (child == null) continue;
oid[0] = varList[i];
brother.registerNode(oid, 0, child);
}
}
// PRIVATE METHODS
//----------------
SnmpMibNode getChild(long id) throws SnmpStatusException {
// first we need to retrieve the identifier in the list of children
//
final int pos = getInsertAt(id);
if (pos >= nbChildren) {
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
if (varList[pos] != (int) id) {
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
// Access the node
//
SnmpMibNode child = null;
try {
child = children.elementAtNonSync(pos);
} catch (ArrayIndexOutOfBoundsException e) {
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
if (child == null) {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
return child;
}
private int retrieveIndex(long val) {
int low = 0;
int cursor = (int) val;
if (varList == null || varList.length < 1)
return nbChildren;
int max = varList.length - 1;
int curr = low + (max - low) / 2;
int elmt;
while (low <= max) {
elmt = varList[curr];
if (cursor == elmt) {
// We need to get the next index ...
//
return curr;
}
if (elmt < cursor) {
low = curr + 1;
} else {
max = curr - 1;
}
curr = low + (max - low) / 2;
}
return -1;
}
private int getInsertAt(long val) {
int low = 0;
final int index = (int) val;
if (varList == null)
return -1;
int max = varList.length - 1;
int elmt;
//final int[] v = varList;
//if (index > a[max])
//return max +1;
int curr = low + (max - low) / 2;
while (low <= max) {
elmt = varList[curr];
// never know ...we might find something ...
//
if (index == elmt)
return curr;
if (elmt < index) {
low = curr + 1;
} else {
max = curr - 1;
}
curr = low + (max - low) / 2;
}
return curr;
}
// PRIVATE VARIABLES
//------------------
/**
* Contains the list of sub nodes.
*/
private NonSyncVector<SnmpMibNode> children = new NonSyncVector<>(1);
/**
* The number of sub nodes.
*/
private int nbChildren = 0;
// All the methods of the Vector class are synchronized.
// Synchronization is a very expensive operation. In our case it is
// not always required...
//
@SuppressWarnings("serial")
// We will never serialize this
class NonSyncVector<E> extends Vector<E> {
public NonSyncVector(int size) {
super(size);
}
final void addNonSyncElement(E obj) {
ensureCapacity(elementCount + 1);
elementData[elementCount++] = obj;
}
@SuppressWarnings("unchecked") // cast to E
final E elementAtNonSync(int index) {
return (E) elementData[index];
}
}
}
| [
"787491096@qq.com"
] | 787491096@qq.com |
adcdd1886ce558e27e7777dd514b126337b1ff88 | 47c7eaa76a493ce6d660e9bc6be46781be564ead | /eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexImageTransform.java | 451eb704f84026dac4eac9f599b63a418a889b8d | [] | no_license | xq2537/platform_sdk | 923d6f144ff208332bc81df9806ed60b9b41b05e | 6ba547e6628ecc8ba1bb2ea02ec9837708de489d | refs/heads/master | 2021-01-18T14:11:49.807176 | 2012-11-30T22:26:28 | 2012-11-30T22:26:28 | 7,911,620 | 1 | 8 | null | null | null | null | UTF-8 | Java | false | false | 11,701 | java | /*
* Copyright (C) 2012 The Android Open Source Project
*
* 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.android.ide.eclipse.gltrace.state.transforms;
import com.android.ide.eclipse.gltrace.FileUtils;
import com.android.ide.eclipse.gltrace.GLEnum;
import com.android.ide.eclipse.gltrace.state.GLStringProperty;
import com.android.ide.eclipse.gltrace.state.IGLProperty;
import com.google.common.io.Files;
import com.google.common.primitives.UnsignedBytes;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
/**
* {@link TexImageTransform} transforms the state to reflect the effect of a
* glTexImage2D or glTexSubImage2D GL call.
*/
public class TexImageTransform implements IStateTransform {
private static final String PNG_IMAGE_FORMAT = "PNG";
private static final String TEXTURE_FILE_PREFIX = "tex";
private static final String TEXTURE_FILE_SUFFIX = ".png";
private final IGLPropertyAccessor mAccessor;
private final File mTextureDataFile;
private final int mxOffset;
private final int myOffset;
private final int mWidth;
private final int mHeight;
private String mOldValue;
private String mNewValue;
private GLEnum mFormat;
private GLEnum mType;
/**
* Construct a texture image transformation.
* @param accessor accessor to obtain the GL state variable to modify
* @param textureData texture data passed in by the call. Could be null.
* @param format format of the source texture data
* @param xOffset x offset for the source data (used only in glTexSubImage2D)
* @param yOffset y offset for the source data (used only in glTexSubImage2D)
* @param width width of the texture
* @param height height of the texture
*/
public TexImageTransform(IGLPropertyAccessor accessor, File textureData, GLEnum format,
GLEnum type, int xOffset, int yOffset, int width, int height) {
mAccessor = accessor;
mTextureDataFile = textureData;
mFormat = format;
mType = type;
mxOffset = xOffset;
myOffset = yOffset;
mWidth = width;
mHeight = height;
}
@Override
public void apply(IGLProperty currentState) {
assert mOldValue == null : "Transform cannot be applied multiple times"; //$NON-NLS-1$
IGLProperty property = mAccessor.getProperty(currentState);
if (!(property instanceof GLStringProperty)) {
return;
}
GLStringProperty prop = (GLStringProperty) property;
mOldValue = prop.getStringValue();
// Applying texture transformations is a heavy weight process. So we perform
// it only once and save the result in a temporary file. The property is actually
// the path to the file.
if (mNewValue == null) {
try {
if (mOldValue == null) {
mNewValue = createTexture(mTextureDataFile, mWidth, mHeight);
} else {
mNewValue = updateTextureData(mOldValue, mTextureDataFile, mxOffset, myOffset,
mWidth, mHeight);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
prop.setValue(mNewValue);
}
@Override
public void revert(IGLProperty state) {
if (mOldValue != null) {
IGLProperty property = mAccessor.getProperty(state);
property.setValue(mOldValue);
mOldValue = null;
}
}
@Override
public IGLProperty getChangedProperty(IGLProperty state) {
return mAccessor.getProperty(state);
}
/**
* Creates a texture of provided width and height. If the texture data file is provided,
* then the texture is initialized with the contents of that file, otherwise an empty
* image is created.
* @param textureDataFile path to texture data, could be null.
* @param width width of texture
* @param height height of texture
* @return path to cached texture
*/
private String createTexture(File textureDataFile, int width, int height) throws IOException {
File f = FileUtils.createTempFile(TEXTURE_FILE_PREFIX, TEXTURE_FILE_SUFFIX);
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
if (textureDataFile != null) {
byte[] initialData = Files.toByteArray(textureDataFile);
img.getRaster().setDataElements(0, 0, width, height,
formatSourceData(initialData, width, height));
}
ImageIO.write(img, PNG_IMAGE_FORMAT, f);
return f.getAbsolutePath();
}
/**
* Update part of an existing texture.
* @param currentImagePath current texture image.
* @param textureDataFile new data to update the current texture with
* @param xOffset x offset for the update region
* @param yOffset y offset for the update region
* @param width width of the update region
* @param height height of the update region
* @return path to the updated texture
*/
private String updateTextureData(String currentImagePath, File textureDataFile,
int xOffset, int yOffset, int width, int height) throws IOException {
assert currentImagePath != null : "Attempt to update a null texture";
if (textureDataFile == null) {
// Do not perform any updates if we don't have the actual data.
return currentImagePath;
}
File f = FileUtils.createTempFile(TEXTURE_FILE_PREFIX, TEXTURE_FILE_SUFFIX);
BufferedImage image = null;
image = ImageIO.read(new File(currentImagePath));
byte[] subImageData = Files.toByteArray(textureDataFile);
image.getRaster().setDataElements(xOffset, yOffset, width, height,
formatSourceData(subImageData, width, height));
ImageIO.write(image, PNG_IMAGE_FORMAT, f);
return f.getAbsolutePath();
}
private byte[] formatSourceData(byte[] subImageData, int width, int height) {
if (mType != GLEnum.GL_UNSIGNED_BYTE) {
subImageData = unpackData(subImageData, mType);
}
switch (mFormat) {
case GL_RGBA:
// no conversions necessary
return subImageData;
case GL_RGB:
return addAlphaChannel(subImageData, width, height);
case GL_ALPHA:
return addRGBChannels(subImageData, width, height);
case GL_LUMINANCE:
return createRGBAFromLuminance(subImageData, width, height);
case GL_LUMINANCE_ALPHA:
return createRGBAFromLuminanceAlpha(subImageData, width, height);
default:
throw new RuntimeException();
}
}
private byte[] unpackData(byte[] data, GLEnum type) {
switch (type) {
case GL_UNSIGNED_BYTE:
return data;
case GL_UNSIGNED_SHORT_4_4_4_4:
return convertShortToUnsigned(data, 0xf000, 12, 0x0f00, 8, 0x00f0, 4, 0x000f, 0,
true);
case GL_UNSIGNED_SHORT_5_6_5:
return convertShortToUnsigned(data, 0xf800, 11, 0x07e0, 5, 0x001f, 0, 0, 0,
false);
case GL_UNSIGNED_SHORT_5_5_5_1:
return convertShortToUnsigned(data, 0xf800, 11, 0x07c0, 6, 0x003e, 1, 0x1, 0,
true);
default:
return data;
}
}
private byte[] convertShortToUnsigned(byte[] shortData,
int rmask, int rshift,
int gmask, int gshift,
int bmask, int bshift,
int amask, int ashift,
boolean includeAlpha) {
int numChannels = includeAlpha ? 4 : 3;
byte[] unsignedData = new byte[(shortData.length/2) * numChannels];
for (int i = 0; i < (shortData.length / 2); i++) {
int hi = UnsignedBytes.toInt(shortData[i*2 + 0]);
int lo = UnsignedBytes.toInt(shortData[i*2 + 1]);
int x = hi << 8 | lo;
int r = (x & rmask) >>> rshift;
int g = (x & gmask) >>> gshift;
int b = (x & bmask) >>> bshift;
int a = (x & amask) >>> ashift;
unsignedData[i * numChannels + 0] = UnsignedBytes.checkedCast(r);
unsignedData[i * numChannels + 1] = UnsignedBytes.checkedCast(g);
unsignedData[i * numChannels + 2] = UnsignedBytes.checkedCast(b);
if (includeAlpha) {
unsignedData[i * numChannels + 3] = UnsignedBytes.checkedCast(a);
}
}
return unsignedData;
}
private byte[] addAlphaChannel(byte[] sourceData, int width, int height) {
assert sourceData.length == 3 * width * height; // should have R, G & B channels
byte[] data = new byte[4 * width * height];
for (int src = 0, dst = 0; src < sourceData.length; src += 3, dst += 4) {
data[dst + 0] = sourceData[src + 0]; // copy R byte
data[dst + 1] = sourceData[src + 1]; // copy G byte
data[dst + 2] = sourceData[src + 2]; // copy B byte
data[dst + 3] = 1; // add alpha = 1
}
return data;
}
private byte[] addRGBChannels(byte[] sourceData, int width, int height) {
assert sourceData.length == width * height; // should have a single alpha channel
byte[] data = new byte[4 * width * height];
for (int src = 0, dst = 0; src < sourceData.length; src++, dst += 4) {
data[dst + 0] = data[dst + 1] = data[dst + 2] = 0; // set R = G = B = 0
data[dst + 3] = sourceData[src]; // copy over alpha
}
return data;
}
private byte[] createRGBAFromLuminance(byte[] sourceData, int width, int height) {
assert sourceData.length == width * height; // should have a single luminance channel
byte[] data = new byte[4 * width * height];
for (int src = 0, dst = 0; src < sourceData.length; src++, dst += 4) {
int l = sourceData[src] * 3;
if (l > 255) { // clamp to 255
l = 255;
}
data[dst + 0] = data[dst + 1] = data[dst + 2] = (byte) l; // set R = G = B = L * 3
data[dst + 3] = 1; // set alpha = 1
}
return data;
}
private byte[] createRGBAFromLuminanceAlpha(byte[] sourceData, int width, int height) {
assert sourceData.length == 2 * width * height; // should have luminance & alpha channels
byte[] data = new byte[4 * width * height];
for (int src = 0, dst = 0; src < sourceData.length; src += 2, dst += 4) {
int l = sourceData[src] * 3;
if (l > 255) { // clamp to 255
l = 255;
}
data[dst + 0] = data[dst + 1] = data[dst + 2] = (byte) l; // set R = G = B = L * 3
data[dst + 3] = sourceData[src + 1]; // copy over alpha
}
return data;
}
}
| [
"vsiva@google.com"
] | vsiva@google.com |
9bdbdeb467e641dd71f4f03c62c82b4050651a4f | fc305807839d5b6d177748aca0a3f48caa017b4f | /src/main/java/com/wy/stream2kafka/MySqlTwoPhaseCommitSink.java | f8663f1fb2e6afa1628833ad9903850893840200 | [] | no_license | wangyne/flinkdemo | 71dc09df485afb9e1834f0ac00c68a827e78e44b | 8dc9210ebc2be91353fe83c27074d39a05415290 | refs/heads/master | 2022-07-09T23:15:50.539057 | 2021-01-19T10:44:33 | 2021-01-19T10:44:33 | 233,778,129 | 1 | 0 | null | 2022-06-21T02:38:22 | 2020-01-14T07:04:10 | Java | UTF-8 | Java | false | false | 2,861 | java | package com.wy.stream2kafka;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.base.VoidSerializer;
import org.apache.flink.api.java.typeutils.runtime.kryo.KryoSerializer;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.flink.streaming.api.functions.sink.TwoPhaseCommitSinkFunction;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
/**
* @author wangyn3
* @date 2019-12-30 11:25
*/
public class MySqlTwoPhaseCommitSink extends TwoPhaseCommitSinkFunction<String, Connection, Void> {
public MySqlTwoPhaseCommitSink() {
super(new KryoSerializer<>(Connection.class, new ExecutionConfig()), VoidSerializer.INSTANCE);
}
/**
* 执行数据库写入操作
*/
@Override
protected void invoke(Connection connection, String value, Context context) {
// String value = objectNode.get("value").toString();
System.out.println("=============="+value);
String sql = "insert into `t_test` (`name`,`insert_time`) values (?,?)";
PreparedStatement ps = null;
try {
ps = connection.prepareStatement(sql);
ps.setString(1, value);
ps.setTimestamp(2, new Timestamp(System.currentTimeMillis()));
//执行insert语句
ps.execute();
} catch (Exception e) {
e.printStackTrace();
}
// if("asdasd".equals(value)){
// System.out.println(1/0);
// }
}
/**
* 获取连接,开启手动提交事务
* */
@Override
protected Connection beginTransaction() throws Exception {
String url = "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&autoReconnect=true";
Connection connection = DBConnectUtil.getConnection(url, "root", "123456");
System.err.println("start beginTransaction......."+connection);
return connection;
}
/**
* 预提交,提交逻辑在invoke方法中
* */
@Override
protected void preCommit(Connection connection) throws Exception {
System.err.println("start preCommit......."+connection);
}
/**
* 如果invoke执行正常则提交事务
* */
@Override
protected void commit(Connection connection) {
System.err.println("start commit......."+connection);
DBConnectUtil.commit(connection);
}
/**
* 如果invoke执行异常则回滚事物,下一次的checkpoint操作也不会执行
* */
@Override
protected void abort(Connection connection) {
System.err.println("start abort rollback......."+connection);
DBConnectUtil.rollback(connection);
}
}
| [
"827498612@qq.com"
] | 827498612@qq.com |
e971e635f1349a7d64bb075e63d24cd172e6a7fc | b27bfe9db8f0c7e5ca9377397b23ef2ef27d4ddc | /morozov/system/kinect/modes/converters/errors/WrongArgumentIsNotKinectDisplayingMode.java | 888250f6c777e2392695d4a1aa502ae805cf6184 | [] | no_license | Morozov2012/actor-prolog-java-library | 85fe97eb6a37709d742f4ab06b29d0718c7269c3 | 5a7e2011ac2152278b8ebae3dfb2da4d925619a3 | refs/heads/master | 2021-01-20T15:39:14.173431 | 2019-12-13T13:09:01 | 2019-12-13T13:09:01 | 7,780,078 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | // (c) 2016 IRE RAS Alexei A. Morozov
package morozov.system.kinect.modes.converters.errors;
import morozov.terms.*;
import morozov.terms.errors.*;
public class WrongArgumentIsNotKinectDisplayingMode extends WrongArgument {
public WrongArgumentIsNotKinectDisplayingMode(Term value) {
super(value);
}
}
| [
"AlexeiMorozov2006@rambler.ru"
] | AlexeiMorozov2006@rambler.ru |
e94d89860ae74089c5b82a14581f37f8a9f7eb09 | 84e064c973c0cc0d23ce7d491d5b047314fa53e5 | /latest9.8/hej/net/sf/saxon/dom/DOMNodeWrapper.java | b21ea4c486b78480004b8b6ee7c6a7c6c51dee7c | [] | no_license | orbeon/saxon-he | 83fedc08151405b5226839115df609375a183446 | 250c5839e31eec97c90c5c942ee2753117d5aa02 | refs/heads/master | 2022-12-30T03:30:31.383330 | 2020-10-16T15:21:05 | 2020-10-16T15:21:05 | 304,712,257 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 44,907 | java | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Saxonica Limited.
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package net.sf.saxon.dom;
import net.sf.saxon.event.Receiver;
import net.sf.saxon.expr.parser.Location;
import net.sf.saxon.lib.NamespaceConstant;
import net.sf.saxon.om.*;
import net.sf.saxon.pattern.AnyNodeTest;
import net.sf.saxon.pattern.NameTest;
import net.sf.saxon.pattern.NodeTest;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.tree.iter.AxisIterator;
import net.sf.saxon.tree.iter.AxisIteratorImpl;
import net.sf.saxon.tree.iter.LookaheadIterator;
import net.sf.saxon.tree.util.FastStringBuffer;
import net.sf.saxon.tree.util.Navigator;
import net.sf.saxon.tree.util.SteppingNavigator;
import net.sf.saxon.tree.util.SteppingNode;
import net.sf.saxon.tree.wrapper.AbstractNodeWrapper;
import net.sf.saxon.tree.wrapper.SiblingCountingNode;
import net.sf.saxon.type.Type;
import net.sf.saxon.type.UType;
import org.w3c.dom.*;
import java.util.ArrayList;
import java.util.Arrays;
/**
* A node in the XML parse tree representing an XML element, character content, or attribute.<P>
* This is the implementation of the NodeInfo interface used as a wrapper for DOM nodes.
* <p/>
* <p>Because the DOM is not thread-safe even when reading, and because Saxon-EE can spawn multiple
* threads that access the same input tree, all methods that invoke DOM methods are synchronized
* on the Document object.</p>
*/
@SuppressWarnings({"SynchronizeOnNonFinalField"})
public class DOMNodeWrapper extends AbstractNodeWrapper implements SiblingCountingNode, SteppingNode<DOMNodeWrapper> {
protected Node node;
protected short nodeKind;
private DOMNodeWrapper parent; // null means unknown
protected DocumentWrapper docWrapper; // effectively final
protected int index; // -1 means unknown
protected int span = 1; // the number of adjacent text nodes wrapped by this NodeWrapper.
// If span>1, node will always be the first of a sequence of adjacent text nodes
private NamespaceBinding[] localNamespaces = null;
/**
* This constructor is protected: nodes should be created using the makeWrapper
* factory method
*
* @param node The DOM node to be wrapped
* @param docWrapper The wrapper for the Document node at the root of the DOM tree. Never null
* except in the case where we are creating the DocumentWrapper itself (which is a subclass).
* @param parent The DOMNodeWrapper that wraps the parent of this node. May be null if unknown.
* @param index Position of this node among its siblings, 0-based. May be -1 if unknown.
*/
protected DOMNodeWrapper(Node node, DocumentWrapper docWrapper, /*@Nullable*/ DOMNodeWrapper parent, int index) {
this.node = node;
this.parent = parent;
this.index = index;
this.docWrapper = docWrapper;
}
/**
* Factory method to wrap a DOM node with a wrapper that implements the Saxon
* NodeInfo interface.
*
* @param node The DOM node
* @param docWrapper The wrapper for the containing Document node
* @return The new wrapper for the supplied node
* @throws NullPointerException if the node or the document wrapper are null
*/
protected static DOMNodeWrapper makeWrapper(Node node, DocumentWrapper docWrapper) {
if (node == null) {
throw new NullPointerException("NodeWrapper#makeWrapper: Node must not be null");
}
if (docWrapper == null) {
throw new NullPointerException("NodeWrapper#makeWrapper: DocumentWrapper must not be null");
}
return makeWrapper(node, docWrapper, null, -1);
}
/**
* Factory method to wrap a DOM node with a wrapper that implements the Saxon
* NodeInfo interface.
*
* @param node The DOM node
* @param docWrapper The wrapper for the containing Document node *
* @param parent The wrapper for the parent of the JDOM node
* @param index The position of this node relative to its siblings
* @return The new wrapper for the supplied node
*/
protected static DOMNodeWrapper makeWrapper(Node node, DocumentWrapper docWrapper,
/*@Nullable*/ DOMNodeWrapper parent, int index) {
DOMNodeWrapper wrapper;
switch (node.getNodeType()) {
case Node.DOCUMENT_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
wrapper = (DOMNodeWrapper)docWrapper.getRootNode();
if (wrapper == null) {
wrapper = new DOMNodeWrapper(node, docWrapper, parent, index);
wrapper.nodeKind = Type.DOCUMENT;
}
break;
case Node.ELEMENT_NODE:
wrapper = new DOMNodeWrapper(node, docWrapper, parent, index);
wrapper.nodeKind = Type.ELEMENT;
break;
case Node.ATTRIBUTE_NODE:
wrapper = new DOMNodeWrapper(node, docWrapper, parent, index);
wrapper.nodeKind = Type.ATTRIBUTE;
break;
case Node.TEXT_NODE:
wrapper = new DOMNodeWrapper(node, docWrapper, parent, index);
wrapper.nodeKind = Type.TEXT;
break;
case Node.CDATA_SECTION_NODE:
wrapper = new DOMNodeWrapper(node, docWrapper, parent, index);
wrapper.nodeKind = Type.TEXT;
break;
case Node.COMMENT_NODE:
wrapper = new DOMNodeWrapper(node, docWrapper, parent, index);
wrapper.nodeKind = Type.COMMENT;
break;
case Node.PROCESSING_INSTRUCTION_NODE:
wrapper = new DOMNodeWrapper(node, docWrapper, parent, index);
wrapper.nodeKind = Type.PROCESSING_INSTRUCTION;
break;
case Node.ENTITY_REFERENCE_NODE:
throw new IllegalStateException("DOM contains entity reference nodes, which Saxon does not support. The DOM should be built using the expandEntityReferences() option");
default:
throw new IllegalArgumentException("Unsupported node type in DOM! " + node.getNodeType() + " instance " + node.toString());
}
wrapper.treeInfo = docWrapper;
return wrapper;
}
public DocumentWrapper getTreeInfo() {
return (DocumentWrapper)treeInfo;
}
/**
* Get the underlying DOM node, to implement the VirtualNode interface
*/
public Object getUnderlyingNode() {
return node;
}
/**
* Return the kind of node.
*
* @return one of the values Node.ELEMENT, Node.TEXT, Node.ATTRIBUTE, etc.
*/
public int getNodeKind() {
return nodeKind;
}
/**
* Determine whether this is the same node as another node. <br />
* Note: a.isSameNodeInfo(b) if and only if generateId(a)==generateId(b)
*
* @return true if this Node object and the supplied Node object represent the
* same node in the tree.
*/
public boolean isSameNodeInfo(NodeInfo other) {
if (!(other instanceof DOMNodeWrapper)) {
return false;
}
if (docWrapper.domLevel3) {
synchronized (docWrapper.docNode) {
return node.isSameNode(((DOMNodeWrapper) other).node);
}
} else {
DOMNodeWrapper ow = (DOMNodeWrapper) other;
return getNodeKind() == ow.getNodeKind() &&
equalOrNull(getLocalPart(), ow.getLocalPart()) && // redundant, but gives a quick exit
getSiblingPosition() == ow.getSiblingPosition() &&
getParent().isSameNodeInfo(ow.getParent());
}
}
private boolean equalOrNull(String a, String b) {
return a==null ? b==null : a.equals(b);
}
/**
* Determine the relative position of this node and another node, in document order.
* The other node will always be in the same document.
*
* @param other The other node, whose position is to be compared with this node
* @return -1 if this node precedes the other node, +1 if it follows the other
* node, or 0 if they are the same node. (In this case, isSameNode() will always
* return true, and the two nodes will produce the same result for generateId())
*/
public int compareOrder(NodeInfo other) {
// Use the DOM Level-3 compareDocumentPosition() method
if (other instanceof DOMNodeWrapper && docWrapper.domLevel3) {
if (isSameNodeInfo(other)) {
return 0;
}
try {
synchronized (docWrapper.docNode) {
short relationship = node.compareDocumentPosition(((DOMNodeWrapper) other).node);
if ((relationship &
(Node.DOCUMENT_POSITION_PRECEDING | Node.DOCUMENT_POSITION_CONTAINS)) != 0) {
return +1;
} else if ((relationship &
(Node.DOCUMENT_POSITION_FOLLOWING | Node.DOCUMENT_POSITION_CONTAINED_BY)) != 0) {
return -1;
}
}
// otherwise use fallback implementation (e.g. nodes in different documents)
} catch (DOMException e) {
// can happen if nodes are from different DOM implementations.
// use fallback implementation
}
}
if (other instanceof SiblingCountingNode) {
return Navigator.compareOrder(this, (SiblingCountingNode) other);
} else {
// it's presumably a Namespace Node
return -other.compareOrder(this);
}
}
/**
* Determine the relative position of this node and another node, in document order,
* distinguishing whether the first node is a preceding, following, descendant, ancestor,
* or the same node as the second.
* <p/>
* The other node must always be in the same tree; the effect of calling this method
* when the two nodes are in different trees is undefined. If either node is a namespace
* or attribute node, the method should throw UnsupportedOperationException.
*
* @param other The other node, whose position is to be compared with this
* node
* @return {@link net.sf.saxon.om.AxisInfo#PRECEDING} if this node is on the preceding axis of the other node;
* {@link net.sf.saxon.om.AxisInfo#FOLLOWING} if it is on the following axis; {@link net.sf.saxon.om.AxisInfo#ANCESTOR} if the first node is an
* ancestor of the second; {@link net.sf.saxon.om.AxisInfo#DESCENDANT} if the first is a descendant of the second;
* {@link net.sf.saxon.om.AxisInfo#SELF} if they are the same node.
* @throws UnsupportedOperationException if either node is an attribute or namespace
* @since 9.5
*/
public int comparePosition(NodeInfo other) {
// Use the DOM Level-3 compareDocumentPosition() method
if (other instanceof DOMNodeWrapper && docWrapper.domLevel3) {
if (isSameNodeInfo(other)) {
return AxisInfo.SELF;
}
try {
synchronized (docWrapper.docNode) {
short relationship = node.compareDocumentPosition(((DOMNodeWrapper) other).node);
if ((relationship & Node.DOCUMENT_POSITION_PRECEDING) != 0) {
return AxisInfo.FOLLOWING;
} else if ((relationship & Node.DOCUMENT_POSITION_FOLLOWING) != 0) {
return AxisInfo.PRECEDING;
} else if ((relationship & Node.DOCUMENT_POSITION_CONTAINS) != 0) {
return AxisInfo.ANCESTOR;
} else if ((relationship & Node.DOCUMENT_POSITION_CONTAINED_BY) != 0) {
return AxisInfo.DESCENDANT;
}
}
// otherwise use fallback implementation (e.g. nodes in different documents)
} catch (DOMException e) {
//
}
}
return Navigator.comparePosition(this, other);
}
/**
* Get the value of the item as a CharSequence. This is in some cases more efficient than
* the version of the method that returns a String.
*/
public CharSequence getStringValueCS() {
synchronized (docWrapper.docNode) {
switch (nodeKind) {
case Type.DOCUMENT:
case Type.ELEMENT:
NodeList children1 = node.getChildNodes();
FastStringBuffer sb1 = new FastStringBuffer(16);
expandStringValue(children1, sb1);
return sb1;
case Type.ATTRIBUTE:
return emptyIfNull(((Attr) node).getValue());
case Type.TEXT:
if (span == 1) {
return emptyIfNull(node.getNodeValue());
} else {
FastStringBuffer fsb = new FastStringBuffer(FastStringBuffer.C64);
Node textNode = node;
for (int i = 0; i < span; i++) {
fsb.append(emptyIfNull(textNode.getNodeValue()));
textNode = textNode.getNextSibling();
}
return fsb.condense();
}
case Type.COMMENT:
case Type.PROCESSING_INSTRUCTION:
return emptyIfNull(node.getNodeValue());
default:
return "";
}
}
}
/**
* Treat a node value of null as an empty string.
*
* @param s the node value
* @return a zero-length string if s is null, otherwise s
*/
private static String emptyIfNull(String s) {
return s == null ? "" : s;
}
public static void expandStringValue(NodeList list, FastStringBuffer sb) {
final int len = list.getLength();
for (int i = 0; i < len; i++) {
Node child = list.item(i);
switch (child.getNodeType()) {
case Node.ELEMENT_NODE:
expandStringValue(child.getChildNodes(), sb);
break;
case Node.COMMENT_NODE:
case Node.PROCESSING_INSTRUCTION_NODE:
break;
case Node.DOCUMENT_TYPE_NODE:
break;
default:
sb.append(emptyIfNull(child.getNodeValue()));
break;
}
}
}
/**
* Get the local part of the name of this node. This is the name after the ":" if any.
*
* @return the local part of the name. For an unnamed node, returns "".
*/
public String getLocalPart() {
synchronized (docWrapper.docNode) {
switch (getNodeKind()) {
case Type.ELEMENT:
case Type.ATTRIBUTE:
return getLocalName(node);
case Type.PROCESSING_INSTRUCTION:
return node.getNodeName();
default:
return "";
}
}
}
/**
* Get the local name of a DOM element or attribute node.
*
* @param node the DOM element or attribute node
* @return the local name as defined in XDM
*/
public static String getLocalName(Node node) {
String s = node.getLocalName();
if (s == null) {
// true if the node was created using a DOM level 1 method
String n = node.getNodeName();
int colon = n.indexOf(':');
if (colon >= 0) {
return n.substring(colon + 1);
}
return n;
} else {
return s;
}
}
/**
* Get the URI part of the name of this node. This is the URI corresponding to the
* prefix, or the URI of the default namespace if appropriate.
*
* @return The URI of the namespace of this node. For an unnamed node,
* or for a node with an empty prefix, return an empty
* string.
*/
public String getURI() {
synchronized (docWrapper.docNode) {
if (nodeKind == Type.ELEMENT) {
return getElementURI((Element) node);
} else if (nodeKind == Type.ATTRIBUTE) {
return getAttributeURI((Attr) node);
}
return "";
}
}
private static String getElementURI(Element element) {
// The DOM methods getPrefix() and getNamespaceURI() do not always
// return the prefix and the URI; they both return null, unless the
// prefix and URI have been explicitly set in the node by using DOM
// level 2 interfaces. There's no obvious way of deciding whether
// an element whose name has no prefix is in the default namespace,
// other than searching for a default namespace declaration. So we have to
// be prepared to search.
// If getPrefix() and getNamespaceURI() are non-null, however,
// we can use the values.
String uri = element.getNamespaceURI();
if (uri != null) {
return uri;
}
// Otherwise we have to work it out the hard way...
String displayName = element.getNodeName();
int colon = displayName.indexOf(':');
String attName = colon < 0 ? "xmlns" : "xmlns:" + displayName.substring(0, colon);
if (attName.equals("xmlns:xml")) {
return NamespaceConstant.XML;
}
Node node = element;
do {
if (((Element) node).hasAttribute(attName)) {
return ((Element) node).getAttribute(attName);
}
node = node.getParentNode();
} while (node != null && node.getNodeType() == Node.ELEMENT_NODE);
if (colon < 0) {
return "";
} else {
throw new IllegalStateException("Undeclared namespace prefix in element name " + displayName + " in DOM input");
}
}
private static String getAttributeURI(Attr attr) {
String uri = attr.getNamespaceURI();
if (uri != null) {
return uri;
}
// Otherwise we have to work it out the hard way...
String displayName = attr.getNodeName();
int colon = displayName.indexOf(':');
if (colon < 0) {
return "";
}
String attName = "xmlns:" + displayName.substring(0, colon);
if (attName.equals("xmlns:xml")) {
return NamespaceConstant.XML;
}
Node node = attr.getOwnerElement();
do {
if (((Element) node).hasAttribute(attName)) {
return ((Element) node).getAttribute(attName);
}
node = node.getParentNode();
} while (node != null && node.getNodeType() == Node.ELEMENT_NODE);
throw new IllegalStateException("Undeclared namespace prefix in attribute name " + displayName + " in DOM input");
}
/**
* Get the prefix of the name of the node. This is defined only for elements and attributes.
* If the node has no prefix, or for other kinds of node, return a zero-length string.
*
* @return The prefix of the name of the node.
*/
public String getPrefix() {
synchronized (docWrapper.docNode) {
int kind = getNodeKind();
if (kind == Type.ELEMENT || kind == Type.ATTRIBUTE) {
String name = node.getNodeName();
int colon = name.indexOf(':');
if (colon < 0) {
return "";
} else {
return name.substring(0, colon);
}
}
return "";
}
}
/**
* Get the display name of this node. For elements and attributes this is [prefix:]localname.
* For unnamed nodes, it is an empty string.
*
* @return The display name of this node.
* For a node with no name, return an empty string.
*/
public String getDisplayName() {
switch (nodeKind) {
case Type.ELEMENT:
case Type.ATTRIBUTE:
case Type.PROCESSING_INSTRUCTION:
synchronized (docWrapper.docNode) {
return node.getNodeName();
}
default:
return "";
}
}
/**
* Get the NodeInfo object representing the parent of this node
*/
public DOMNodeWrapper getParent() {
if (parent == null) {
synchronized (docWrapper.docNode) {
switch (getNodeKind()) {
case Type.ATTRIBUTE:
parent = makeWrapper(((Attr) node).getOwnerElement(), docWrapper);
break;
default:
Node p = node.getParentNode();
if (p == null) {
return null;
} else {
parent = makeWrapper(p, docWrapper);
}
}
}
}
return parent;
}
/**
* Get the index position of this node among its siblings (starting from 0).
* In the case of a text node that maps to several adjacent siblings in the DOM,
* the numbering actually refers to the position of the underlying DOM nodes;
* thus the sibling position for the text node is that of the first DOM node
* to which it relates, and the numbering of subsequent XPath nodes is not necessarily
* consecutive.
* <p/>
* <p>Despite the name, this method also returns a meaningful result for attribute
* nodes; it returns the position of the attribute among the attributes of its
* parent element, when they are listed in document order.</p>
*/
public int getSiblingPosition() {
if (index == -1) {
synchronized (docWrapper.docNode) {
switch (nodeKind) {
case Type.ELEMENT:
case Type.TEXT:
case Type.COMMENT:
case Type.PROCESSING_INSTRUCTION:
int ix = 0;
Node start = node;
while (true) {
start = start.getPreviousSibling();
if (start == null) {
index = ix;
return ix;
}
ix++;
}
case Type.ATTRIBUTE:
ix = 0;
AxisIterator iter = parent.iterateAxis(AxisInfo.ATTRIBUTE);
while (true) {
NodeInfo n = iter.next();
if (n == null || Navigator.haveSameName(this, n)) {
index = ix;
return ix;
}
ix++;
}
case Type.NAMESPACE:
ix = 0;
iter = parent.iterateAxis(AxisInfo.NAMESPACE);
while (true) {
NodeInfo n = iter.next();
if (n == null || Navigator.haveSameName(this, n)) {
index = ix;
return ix;
}
ix++;
}
default:
index = 0;
return index;
}
}
}
return index;
}
@Override
protected AxisIterator iterateAttributes(NodeTest nodeTest) {
AxisIterator iter = new AttributeEnumeration(this);
if (nodeTest != AnyNodeTest.getInstance()) {
iter = new Navigator.AxisFilter(iter, nodeTest);
}
return iter;
}
@Override
protected AxisIterator iterateChildren(NodeTest nodeTest) {
boolean elementOnly = nodeTest.getUType() == UType.ELEMENT;
AxisIterator iter = new Navigator.EmptyTextFilter(
new ChildEnumeration(this, true, true, elementOnly));
if (nodeTest != AnyNodeTest.getInstance()) {
iter = new Navigator.AxisFilter(iter, nodeTest);
}
return iter;
}
@Override
protected AxisIterator iterateSiblings(NodeTest nodeTest, boolean forwards) {
boolean elementOnly = nodeTest.getUType() == UType.ELEMENT;
AxisIterator iter = new Navigator.EmptyTextFilter(
new ChildEnumeration(this, false, forwards, elementOnly));
if (nodeTest != AnyNodeTest.getInstance()) {
iter = new Navigator.AxisFilter(iter, nodeTest);
}
return iter;
}
@Override
protected AxisIterator iterateDescendants(NodeTest nodeTest, boolean includeSelf) {
return new SteppingNavigator.DescendantAxisIterator(this, includeSelf, nodeTest);
}
/**
* Get the string value of a given attribute of this node
*
* @param uri the namespace URI of the attribute name. Supply the empty string for an attribute
* that is in no namespace
* @param local the local part of the attribute name.
* @return the attribute value if it exists, or null if it does not exist. Always returns null
* if this node is not an element.
* @since 9.4
*/
public String getAttributeValue(/*@NotNull*/ String uri, /*@NotNull*/ String local) {
NameTest test = new NameTest(Type.ATTRIBUTE, uri, local, getNamePool());
AxisIterator iterator = iterateAxis(AxisInfo.ATTRIBUTE, test);
NodeInfo attribute = iterator.next();
if (attribute == null) {
return null;
} else {
return attribute.getStringValue();
}
}
/**
* Get the root node - always a document node with this tree implementation
*
* @return the NodeInfo representing the containing document
*/
public NodeInfo getRoot() {
return docWrapper.getRootNode();
}
/**
* Determine whether the node has any children. <br />
* Note: the result is equivalent to <br />
* getEnumeration(Axis.CHILD, AnyNodeTest.getInstance()).hasNext()
*/
public boolean hasChildNodes() {
// An attribute node has child text nodes
synchronized (docWrapper.docNode) {
return node.getNodeType() != Node.ATTRIBUTE_NODE && node.hasChildNodes();
}
}
/**
* Get a character string that uniquely identifies this node.
* Note: a.isSameNode(b) if and only if generateId(a)==generateId(b)
*
* @param buffer a buffer to contain a string that uniquely identifies this node, across all
* documents
*/
public void generateId(FastStringBuffer buffer) {
Navigator.appendSequentialKey(this, buffer, true);
}
/**
* Copy this node to a given outputter (deep copy)
*/
public void copy(Receiver out, int copyOptions, Location locationId) throws XPathException {
Navigator.copy(this, out, copyOptions, locationId);
}
/**
* Get all namespace undeclarations and undeclarations defined on this element.
*
* @param buffer If this is non-null, and the result array fits in this buffer, then the result
* may overwrite the contents of this array, to avoid the cost of allocating a new array on the heap.
* @return An array of integers representing the namespace declarations and undeclarations present on
* this element. For a node other than an element, return null. Otherwise, the returned array is a
* sequence of namespace codes, whose meaning may be interpreted by reference to the name pool. The
* top half word of each namespace code represents the prefix, the bottom half represents the URI.
* If the bottom half is zero, then this is a namespace undeclaration rather than a declaration.
* The XML namespace is never included in the list. If the supplied array is larger than required,
* then the first unused entry will be set to -1.
* <p/>
* <p>For a node other than an element, the method returns null.</p>
*/
public NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] buffer) {
synchronized (docWrapper.docNode) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (localNamespaces != null) {
return localNamespaces;
}
Element elem = (Element) node;
NamedNodeMap atts = elem.getAttributes();
if (atts == null) {
localNamespaces = NamespaceBinding.EMPTY_ARRAY;
return NamespaceBinding.EMPTY_ARRAY;
}
int count = 0;
final int attsLen = atts.getLength();
for (int i = 0; i < attsLen; i++) {
Attr att = (Attr) atts.item(i);
String attName = att.getName();
if (attName.equals("xmlns")) {
count++;
} else if (attName.startsWith("xmlns:")) {
count++;
}
}
if (count == 0) {
localNamespaces = NamespaceBinding.EMPTY_ARRAY;
return NamespaceBinding.EMPTY_ARRAY;
} else {
NamespaceBinding[] result = buffer == null || count > buffer.length ? new NamespaceBinding[count] : buffer;
int n = 0;
for (int i = 0; i < attsLen; i++) {
Attr att = (Attr) atts.item(i);
String attName = att.getName();
if (attName.equals("xmlns")) {
String prefix = "";
String uri = att.getValue();
result[n++] = new NamespaceBinding(prefix, uri);
} else if (attName.startsWith("xmlns:")) {
String prefix = attName.substring(6);
String uri = att.getValue();
result[n++] = new NamespaceBinding(prefix, uri);
}
}
if (count < result.length) {
result[count] = null;
}
localNamespaces = Arrays.copyOf(result, result.length);
return result;
}
} else {
return null;
}
}
}
/**
* Determine whether this node has the is-id property
*
* @return true if the node is an ID
*/
public boolean isId() {
synchronized (docWrapper.docNode) {
return (node instanceof Attr) && ((Attr) node).isId();
}
}
public DOMNodeWrapper getNextSibling() {
synchronized (docWrapper.docNode) {
Node currNode = node.getNextSibling();
if (currNode != null) {
if (currNode.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
currNode = currNode.getNextSibling();
}
return makeWrapper(currNode, docWrapper);
}
return null;
}
}
public DOMNodeWrapper getFirstChild() {
synchronized (docWrapper.docNode) {
Node currNode = node.getFirstChild();
if (currNode != null) {
if (currNode.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
currNode = currNode.getNextSibling();
}
return makeWrapper(currNode, docWrapper);
}
return null;
}
}
public DOMNodeWrapper getPreviousSibling() {
synchronized (docWrapper.docNode) {
Node currNode = node.getPreviousSibling();
if (currNode != null) {
if (currNode.getNodeType() == Node.DOCUMENT_TYPE_NODE) {
return null;
}
return makeWrapper(currNode, docWrapper);
}
return null;
}
}
public DOMNodeWrapper getSuccessorElement(DOMNodeWrapper anchor, String uri, String local) {
synchronized (docWrapper.docNode) {
Node stop = anchor == null ? null : anchor.node;
Node next = node;
do {
next = getSuccessorNode(next, stop);
} while (next != null &&
!(next.getNodeType() == Node.ELEMENT_NODE &&
(local == null || local.equals(getLocalName(next))) &&
(uri == null || uri.equals(getElementURI((Element) next)))));
if (next == null) {
return null;
} else {
return makeWrapper(next, docWrapper);
}
}
}
/**
* Get the following DOM node in an iteration of a subtree
*
* @param start the start DOM node
* @param anchor the DOM node marking the root of the subtree within which navigation takes place (may be null)
* @return the next DOM node in document order after the start node, excluding attributes and namespaces
*/
private static Node getSuccessorNode(Node start, Node anchor) {
if (start.hasChildNodes()) {
return start.getFirstChild();
}
if (anchor != null && start.isSameNode(anchor)) {
return null;
}
Node p = start;
while (true) {
Node s = p.getNextSibling();
if (s != null) {
return s;
}
p = p.getParentNode();
if (p == null || (anchor != null && p.isSameNode(anchor))) {
return null;
}
}
}
private final class AttributeEnumeration implements AxisIterator, LookaheadIterator {
private ArrayList<Node> attList = new ArrayList<Node>(10);
private int ix = 0;
private DOMNodeWrapper start;
private DOMNodeWrapper current;
public AttributeEnumeration(DOMNodeWrapper start) {
synchronized (start.docWrapper.docNode) {
this.start = start;
NamedNodeMap atts = start.node.getAttributes();
if (atts != null) {
final int attsLen = atts.getLength();
for (int i = 0; i < attsLen; i++) {
String name = atts.item(i).getNodeName();
if (!(name.startsWith("xmlns") &&
(name.length() == 5 || name.charAt(5) == ':'))) {
attList.add(atts.item(i));
}
}
}
ix = 0;
}
}
public boolean hasNext() {
return ix < attList.size();
}
public NodeInfo next() {
if (ix >= attList.size()) {
return null;
}
current = makeWrapper(attList.get(ix), docWrapper, start, ix);
ix++;
return current;
}
public void close() {
}
/**
* Get properties of this iterator, as a bit-significant integer.
*
* @return the properties of this iterator. This will be some combination of
* properties such as {@link #GROUNDED}, {@link #LAST_POSITION_FINDER},
* and {@link #LOOKAHEAD}. It is always
* acceptable to return the value zero, indicating that there are no known special properties.
* It is acceptable for the properties of the iterator to change depending on its state.
*/
public int getProperties() {
return LOOKAHEAD;
}
}
/**
* The class ChildEnumeration handles not only the child axis, but also the
* following-sibling and preceding-sibling axes. It can also iterate the children
* of the start node in reverse order, something that is needed to support the
* preceding and preceding-or-ancestor axes (the latter being used by xsl:number)
*/
private final class ChildEnumeration extends AxisIteratorImpl implements LookaheadIterator {
private DOMNodeWrapper start;
private DOMNodeWrapper commonParent;
private boolean downwards; // iterate children of start node (not siblings)
private boolean forwards; // iterate in document order (not reverse order)
private boolean elementsOnly;
NodeList childNodes;
private int childNodesLength;
private int ix; // index of the current DOM node within childNodes;
// in the case of adjacent text nodes, index of the first in the group
private int currentSpan; // number of DOM nodes mapping to the current XPath node
/**
* Create an iterator over the children or siblings of a given node
*
* @param start the start node for the iteration
* @param downwards if true, iterate over the children of the start node; if false, iterate
* over the following or preceding siblings
* @param forwards if true, iterate in forwards document order; if false, iterate in reverse
* document order
* @param elementsOnly if true, retrieve element nodes only; if false, retrieve all nodes
*/
public ChildEnumeration(DOMNodeWrapper start,
boolean downwards, boolean forwards, boolean elementsOnly) {
synchronized (start.docWrapper.docNode) {
this.start = start;
this.downwards = downwards;
this.forwards = forwards;
this.elementsOnly = elementsOnly;
currentSpan = 1;
if (downwards) {
commonParent = start;
} else {
commonParent = start.getParent();
}
childNodes = commonParent.node.getChildNodes();
childNodesLength = childNodes.getLength();
if (downwards) {
currentSpan = 1;
if (forwards) {
ix = -1; // just before first
} else {
ix = childNodesLength; // just after last
}
} else {
ix = start.getSiblingPosition(); // at current node
currentSpan = start.span;
}
}
}
/**
* Starting with ix positioned at a node, which in the last in a span, calculate the length
* of the span, that is the number of DOM nodes mapped to this XPath node.
*
* @return the number of nodes spanned
*/
private int skipPrecedingTextNodes() {
int count = 0;
while (ix >= count) {
Node node = childNodes.item(ix - count);
short kind = node.getNodeType();
if (kind == Node.TEXT_NODE || kind == Node.CDATA_SECTION_NODE) {
count++;
} else {
break;
}
}
return count == 0 ? 1 : count;
}
/**
* Starting with ix positioned at a node, which in the first in a span, calculate the length
* of the span, that is the number of DOM nodes mapped to this XPath node.
*
* @return the number of nodes spanned
*/
private int skipFollowingTextNodes() {
int count = 0;
int pos = ix;
final int len = childNodesLength;
while (pos < len) {
Node node = childNodes.item(pos);
short kind = node.getNodeType();
if (kind == Node.TEXT_NODE || kind == Node.CDATA_SECTION_NODE) {
pos++;
count++;
} else {
break;
}
}
return count == 0 ? 1 : count;
}
public boolean hasNext() {
if (forwards) {
return ix + currentSpan < childNodesLength;
} else {
return ix > 0;
}
}
/*@Nullable*/
public NodeInfo next() {
synchronized(start.docWrapper.docNode) {
while (true) {
if (forwards) {
ix += currentSpan;
if (ix >= childNodesLength) {
return null;
} else {
currentSpan = skipFollowingTextNodes();
Node currentDomNode = childNodes.item(ix);
switch (currentDomNode.getNodeType()) {
case Node.DOCUMENT_TYPE_NODE:
continue;
case Node.ELEMENT_NODE:
break;
default:
if (elementsOnly) {
continue;
} else {
break;
}
}
DOMNodeWrapper wrapper = makeWrapper(currentDomNode, docWrapper, commonParent, ix);
wrapper.span = currentSpan;
return wrapper;
}
} else {
ix--;
if (ix < 0) {
return null;
} else {
currentSpan = skipPrecedingTextNodes();
ix -= currentSpan - 1;
Node currentDomNode = childNodes.item(ix);
switch (currentDomNode.getNodeType()) {
case Node.DOCUMENT_TYPE_NODE:
continue;
case Node.ELEMENT_NODE:
break;
default:
if (elementsOnly) {
continue;
} else {
break;
}
}
DOMNodeWrapper wrapper = makeWrapper(currentDomNode, docWrapper, commonParent, ix);
wrapper.span = currentSpan;
return wrapper;
}
}
}
}
}
/**
* Get properties of this iterator, as a bit-significant integer.
*
* @return the properties of this iterator. This will be some combination of
* properties such as {@link #GROUNDED}, {@link #LAST_POSITION_FINDER},
* and {@link #LOOKAHEAD}. It is always
* acceptable to return the value zero, indicating that there are no known special properties.
* It is acceptable for the properties of the iterator to change depending on its state.
*/
public int getProperties() {
return LOOKAHEAD;
}
} // end of class ChildEnumeration
}
| [
"oneil@saxonica.com"
] | oneil@saxonica.com |
8aa73a15551d7dd4a7787a169e75499663049330 | b95a201e1939319c6cd6a0a26d6d63230600103d | /desktop/src/com/banzai/game/desktop/DesktopLauncher.java | 7d7789cc6f4d151acdee257c4c9bf84f9640e7d2 | [] | no_license | Sergei-Bragin/RockGamePractice | 1795fcf265ea526b6e35dcefd5695700e49e3b21 | 961dcdc38edc4dc4b7e374906ed4598b342ac57e | refs/heads/master | 2021-01-18T11:21:15.998685 | 2015-12-09T19:22:24 | 2015-12-09T19:22:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.banzai.game.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.banzai.game.MyGdxGame;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new MyGdxGame(), config);
}
}
| [
"mr.sergei.bragin@gmail.ru"
] | mr.sergei.bragin@gmail.ru |
b640d8405ecf612f98bf9506f7817efaa5b2f705 | 8ad8fd1174efbba1176e5cc3ba159e6c9c6d7005 | /src/Person.java | 78f5fbafc0ec142f532ec3526c6faa3ef09252fa | [] | no_license | Cooks-Johns/codeup-java-exercises | 45e34b9b4d67582bff87d6021f86ee7293fa2621 | ed44aaf56c1e8f207f1ecf6d8b9ac72600af7cb0 | refs/heads/master | 2020-03-14T12:43:01.825881 | 2018-06-06T05:06:26 | 2018-06-06T05:06:26 | 131,550,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,674 | java | //import java.util.Scanner;
//
//public class Person {
//
// private String name;
//
// public Person(String name){
// this.name = name;
// }
//
//
//// returns the person's name
//
// public String getName(){
// return this.name;
// }
//
//
// // changes the name property to the passed value
//
//
// public void setName(String name){
// this.name = name;
//
//
// }
//
//
//
// public void greeting(String name) {
// this.name = name + " Whats Up?! ";
// }
//
//
//// prints a message to the console using the person's name
//
// public void sayHello(String name) {
// this.name = name + " looking Great today!!!";
//
// }
//
//
// /////////--------=============================---------------->
//
// public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
// System.out.println("Welcome Enter Your Name ");
// String newUser = sc.next();
//
//
//
//
//
// Person John = new Person("John");
// Person Lisa = new Person("Lisa");
//
//
//
// System.out.println("New user");
//
//
//
// System.out.println("Hello " + John.getName());
// System.out.println("Heeey! " + Lisa.getName());
//
// System.out.print(newUser);
//// John.setName("");
//
//// String newName = John.nextInt();
//// System.out.println(John);
//
//
//// System.out.println("So what are we going to do now " + John.);
////
//// Lisa.setName("");
////
//
//
//
//sc.close();
//
//
//
//
//
//
// //------========= part2
//
//// Person person1 = new Person("john");
//// Person person2 = new Person("John");
//// System.out.println(person1.getName().equals(person2.getName()));
//// System.out.println(person1 == person2);
//
//// Person person1 = new Person("John");
//// Person person2 = person1;
//// System.out.println((person1 == person2));
//
//// Person person1 = new Person("John");
//// Person person2 = person1;
//// System.out.println(person1.getName());
//// System.out.println(person2.hetName());
//// person2.setName("Jane");
//// System.out.println(person1.getName());
//// System.out.println(person2.getName());
//
//
// }
//
//
//}
//============---------------> Notes
public class Person {
private String name;
public Person(String name) {
setName(name);
}
public String getName(){ // method's signature
return name;
}
public void setName(String name) {
if (name.isEmpty()) System.out.println("That is invalid!");
this.name = name;
}
public void sayHello() {
System.out.printf("hello %s!%n", name);
// this.name = "Heyy, how are you doing today " + name + ". Nice shoes!";
}
// psvm create a main method
public static void main(String[] args) {
Person person = new Person("John");
Person Lisa = new Person("Lisaa");
System.out.println(person.getName());
person.setName("Big John");
person.sayHello();
Person person1 = new Person("John");
Person person2 = new Person("John");
System.out.println(person1.getName().equals(person2.getName())); // returns true
System.out.println(person1 == person2); /// returns false you cannot use == to compaire objects
// Person person1 = new Person("John");
// Person person2 = person1;
// System.out.println(person1 == person2);
}
} | [
"cooks.johns@gmail.com"
] | cooks.johns@gmail.com |
8fe26bd170d2fe6d66f98e8d7ab6d54071624bb7 | cc6281bbe694d57f7f1bf6f41221b84cd85cd2d5 | /app/src/androidTest/java/com/example/abhinav_rapidbox/childdaycare/ExampleInstrumentedTest.java | 7d25d16f17b369850090c4da3f503e601a674725 | [] | no_license | studioproject293/ChildDayCare | 673571ac93b6c1782fc1c2c65a276f235649ff07 | 2b1e47c8c80d10fd58c4bada5c747311e70c3d80 | refs/heads/master | 2021-06-21T02:18:01.153161 | 2019-09-24T09:48:25 | 2019-09-24T09:48:25 | 143,640,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 783 | java | package com.example.abhinav_rapidbox.childdaycare;
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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.abhinav_rapidbox.childdaycare", appContext.getPackageName());
}
}
| [
"vikram@bloomsmobility.com"
] | vikram@bloomsmobility.com |
5e64cb0d8f46ba6b416141ac900d48ebf5c6438a | 63de5ffdc2dd58516b933ab8941a22bc31296a20 | /src/test/java/sn/fatou/dakparking/config/WebConfigurerTest.java | ec25bd80aec0db64aac7f0ffc2f6ceda5c2b43b6 | [] | no_license | Faaline/parking-reservation-application | 03df3980744a85d088c5cee7f36adcd6fb9e5a10 | e834f6a5a1e19cafd8c974fcf32cc0f2a3c52b6d | refs/heads/main | 2023-03-16T15:02:10.688674 | 2021-03-15T18:30:05 | 2021-03-15T18:30:05 | 348,081,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,512 | java | package sn.fatou.dakparking.config;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.JHipsterProperties;
import io.github.jhipster.web.filter.CachingHttpHeadersFilter;
import java.io.File;
import java.util.*;
import javax.servlet.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
/**
* Unit tests for the {@link WebConfigurer} class.
*/
public class WebConfigurerTest {
private WebConfigurer webConfigurer;
private MockServletContext servletContext;
private MockEnvironment env;
private JHipsterProperties props;
@BeforeEach
public void setup() {
servletContext = spy(new MockServletContext());
doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class));
doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class));
env = new MockEnvironment();
props = new JHipsterProperties();
webConfigurer = new WebConfigurer(env, props);
}
@Test
public void testStartUpProdServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
webConfigurer.onStartup(servletContext);
}
@Test
public void testStartUpDevServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
webConfigurer.onStartup(servletContext);
}
@Test
public void testCustomizeServletContainer() {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
webConfigurer.customize(container);
assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
if (container.getDocumentRoot() != null) {
assertThat(container.getDocumentRoot()).isEqualTo(new File("target/classes/static/"));
}
}
@Test
public void testCorsFilterOnApiPath() throws Exception {
props.getCors().setAllowedOrigins(Collections.singletonList("*"));
props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
props.getCors().setAllowedHeaders(Collections.singletonList("*"));
props.getCors().setMaxAge(1800L);
props.getCors().setAllowCredentials(true);
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
mockMvc
.perform(
options("/api/test-cors")
.header(HttpHeaders.ORIGIN, "other.domain.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")
)
.andExpect(status().isOk())
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com"))
.andExpect(header().string(HttpHeaders.VARY, "Origin"))
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE"))
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"))
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800"));
mockMvc
.perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com"));
}
@Test
public void testCorsFilterOnOtherPath() throws Exception {
props.getCors().setAllowedOrigins(Collections.singletonList("*"));
props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
props.getCors().setAllowedHeaders(Collections.singletonList("*"));
props.getCors().setMaxAge(1800L);
props.getCors().setAllowCredentials(true);
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
mockMvc
.perform(get("/test/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
}
@Test
public void testCorsFilterDeactivated() throws Exception {
props.getCors().setAllowedOrigins(null);
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
mockMvc
.perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
}
@Test
public void testCorsFilterDeactivated2() throws Exception {
props.getCors().setAllowedOrigins(new ArrayList<>());
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
mockMvc
.perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
b8b9cd4de3bcbc086f77d93d6a2d9c22d2714587 | 731397e9866223d482995483ba6fac428af3408d | /src/showplaylistResult.java | 01116f42c8a49bab5096f1c429f1e201c8987a14 | [] | no_license | CrimsonRegulus/MusicPlayer | 973dc649abe498f9ab9013d81578b5d1dad33a9e | 0111141ccd54d6432f4cf8e670b6ef74c5f2d286 | refs/heads/master | 2020-09-13T06:53:53.501201 | 2019-11-21T18:18:16 | 2019-11-21T18:18:16 | 222,686,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,887 | java |
import java.awt.Color;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/*
* 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.
*/
/**
*
* @author Darren
*/
public class showplaylistResult extends javax.swing.JFrame {
private Dashboard owner;
private Connection con;
private User user;
private String playlistname;
private ArrayList<Song> queue;
private String playlistCreator;
public void setcon(Connection con)
{
this.con = con;
}
public Connection getcon()
{
return this.con;
}
public void setuser(User user)
{
this.user = user;
}
public User getuser()
{
return this.user;
}
public void setOwner(Dashboard owner){
this.owner = owner;
}
public Dashboard getOwner(){
return this.owner;
}
public void setQueue(ArrayList<Song> queue){
this.queue = queue;
}
public void setPlaylistName(String name){
this.playlistname = name;
playlistnameLabel.setText(this.playlistname);
queue = new ArrayList<>();
}
public void playSong(){
try {
Musicplayer player = new Musicplayer(this,true);
Statement statechecker = getcon().createStatement();
ResultSet resultchecker = statechecker.executeQuery("SELECT * FROM databasedc.songdetail NATURAL JOIN databasedc.playlistdc NATURAL JOIN song NATURAL JOIN databasedc.useraccount WHERE PlaylistName = '"+playlistname+"' AND UserName = '"+playlistCreator+"' AND SongTitle = '"+playlistcontentsTable.getValueAt(playlistcontentsTable.getSelectedRow(), 0).toString()+"'");
Song song = null;
while(resultchecker.next()){
String genre = resultchecker.getString("SongGenre");
Director build = new Director();
if(genre.equals("Happy")){
build.setSongBuilder(new HappyBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
else if(genre.equals("Sad")){
build.setSongBuilder(new SadBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
else if(genre.equals("Senti")){
build.setSongBuilder(new SentiBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
else{
build.setSongBuilder(new NoBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
song = build.getSong();
}
// queue.clear();
// queue.add(song);
player.setsong(song);
player.setcon(getcon());
// player.setQueue(queue);
player.songtoplay();
playlistcontentsTable.clearSelection();
player.setVisible(true);
player.stoptimer();
player.getwav().stopMusic();
// owner.setQueue(queue);
} catch (SQLException ex) {
Logger.getLogger(showplaylistResult.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void addtoLib(){
try {
Statement statechecker = getcon().createStatement();
ResultSet resultchecker = statechecker.executeQuery("SELECT * FROM databasedc.songdetail NATURAL JOIN databasedc.playlistdc NATURAL JOIN song NATURAL JOIN databasedc.useraccount WHERE PlaylistName = '"+playlistname+"' AND UserName = '"+playlistCreator+"' AND SongTitle = '"+playlistcontentsTable.getValueAt(playlistcontentsTable.getSelectedRow(), 0).toString()+"'");
while(resultchecker.next()){
Statement insertStatement = getcon().createStatement();
insertStatement.execute("INSERT INTO databasedc.songlibrary(OwnerID, SongID) VALUES('"+getuser().getid()+"', '"+resultchecker.getInt("SongID")+"')");
}
owner.loadlibrary();
} catch (SQLException ex) {
Logger.getLogger(showplaylistResult.class.getName()).log(Level.SEVERE, null, ex);
}
}
public showplaylistResult() {
initComponents();
Color theme = new Color(25,25,25);
jScrollPane1.getViewport().setBackground(theme);
jScrollPane1.setBorder(BorderFactory.createEmptyBorder());
}
public void addtoQueue(){
try {
Statement statechecker = getcon().createStatement();
ResultSet resultchecker = statechecker.executeQuery("SELECT * FROM databasedc.songdetail NATURAL JOIN databasedc.playlistdc NATURAL JOIN song NATURAL JOIN databasedc.useraccount WHERE PlaylistName = '"+playlistname+"' AND UserName = '"+playlistCreator+"'");
Song song = null;
while(resultchecker.next()){
String genre = resultchecker.getString("SongGenre");
Director build = new Director();
if(genre.equals("Happy")){
build.setSongBuilder(new HappyBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
else if(genre.equals("Sad")){
build.setSongBuilder(new SadBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
else if(genre.equals("Senti")){
build.setSongBuilder(new SentiBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
else{
build.setSongBuilder(new NoBuilder());
build.constructSong(resultchecker.getInt("SongID"), "", resultchecker.getString("SongTitle").trim(), resultchecker.getString("SongArtist").trim());
}
song = build.getSong();
queue.add(song);
}
owner.setQueue(queue);
} catch (SQLException ex) {
Logger.getLogger(showplaylistResult.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void setplaylistcreator(String name){
this.playlistCreator = name;
}
public void initialize(){
if(getuser().gettype().equals("Artist"))
addtolibButton.setVisible(false);
try {
DefaultTableModel model = (DefaultTableModel) playlistcontentsTable.getModel();
model.setRowCount(0);
Statement statementgetartist = getcon().createStatement();
ResultSet resultgetartist= statementgetartist.executeQuery("SELECT * FROM databasedc.playlistdc NATURAL JOIN useraccount WHERE PlaylistName = '"+playlistname+"' AND UserName = '"+playlistCreator+"'");
while(resultgetartist.next()){
playlistcreatorLabel.setText(resultgetartist.getString("UserName"));
}
Statement statement = getcon().createStatement();
ResultSet result= statement.executeQuery("SELECT * FROM databasedc.songdetail NATURAL JOIN databasedc.playlistdc NATURAL JOIN song NATURAL JOIN databasedc.useraccount WHERE PlaylistName = '"+playlistname+"' AND UserName = '"+playlistCreator+"'");
while(result.next()){
model.insertRow(playlistcontentsTable.getRowCount(), new Object[]{
result.getString("SongTitle"),
result.getString("SongArtist"),
result.getString("SongGenre"),
});
}
} catch (SQLException ex) {
Logger.getLogger(showplaylistResult.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
playlistnameLabel = new javax.swing.JLabel();
playlistcreatorLabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
playlistcontentsTable = new javax.swing.JTable();
playsongButton = new javax.swing.JLabel();
addtoqueueButton = new javax.swing.JLabel();
addtolibButton = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(25, 25, 25));
playlistnameLabel.setFont(new java.awt.Font("Verdana", 1, 36)); // NOI18N
playlistnameLabel.setForeground(new java.awt.Color(255, 255, 255));
playlistnameLabel.setText("Playlist Name");
playlistcreatorLabel.setFont(new java.awt.Font("Verdana", 1, 14)); // NOI18N
playlistcreatorLabel.setForeground(new java.awt.Color(255, 255, 255));
playlistcreatorLabel.setText("Playlist Name");
playlistcontentsTable.setBackground(new java.awt.Color(25, 25, 25));
playlistcontentsTable.setFont(new java.awt.Font("Verdana", 0, 12)); // NOI18N
playlistcontentsTable.setForeground(new java.awt.Color(255, 255, 255));
playlistcontentsTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title", "Artist", "Genre"
}
));
playlistcontentsTable.setShowHorizontalLines(false);
playlistcontentsTable.setShowVerticalLines(false);
jScrollPane1.setViewportView(playlistcontentsTable);
playsongButton.setBackground(new java.awt.Color(51, 51, 51));
playsongButton.setFont(new java.awt.Font("Verdana", 1, 18)); // NOI18N
playsongButton.setForeground(new java.awt.Color(255, 255, 255));
playsongButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
playsongButton.setText("Play");
playsongButton.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
playsongButton.setOpaque(true);
playsongButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
playsongButtonMouseClicked(evt);
}
});
addtoqueueButton.setBackground(new java.awt.Color(51, 51, 51));
addtoqueueButton.setFont(new java.awt.Font("Verdana", 1, 18)); // NOI18N
addtoqueueButton.setForeground(new java.awt.Color(255, 255, 255));
addtoqueueButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
addtoqueueButton.setText("Add to Queue");
addtoqueueButton.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
addtoqueueButton.setOpaque(true);
addtoqueueButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
addtoqueueButtonMouseClicked(evt);
}
});
addtolibButton.setBackground(new java.awt.Color(51, 51, 51));
addtolibButton.setFont(new java.awt.Font("Verdana", 1, 18)); // NOI18N
addtolibButton.setForeground(new java.awt.Color(255, 255, 255));
addtolibButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
addtolibButton.setText("Add to Library");
addtolibButton.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
addtolibButton.setOpaque(true);
addtolibButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
addtolibButtonMouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(playlistnameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(addtolibButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(playlistcreatorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(playsongButton, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(addtoqueueButton, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 69, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(playlistnameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(addtolibButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(playlistcreatorLabel)
.addComponent(addtoqueueButton)
.addComponent(playsongButton))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 306, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void playsongButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_playsongButtonMouseClicked
if(playlistcontentsTable.getSelectedRow() < 0 )
JOptionPane.showMessageDialog(null, "Please Select a Song First!","No Song Selected",JOptionPane.WARNING_MESSAGE);
else
playSong();
}//GEN-LAST:event_playsongButtonMouseClicked
private void addtoqueueButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addtoqueueButtonMouseClicked
addtoQueue();
}//GEN-LAST:event_addtoqueueButtonMouseClicked
private void addtolibButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addtolibButtonMouseClicked
addtoLib();
}//GEN-LAST:event_addtolibButtonMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced playlistcontentsTable SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(showplaylistResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(showplaylistResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(showplaylistResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(showplaylistResult.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new showplaylistResult().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel addtolibButton;
private javax.swing.JLabel addtoqueueButton;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable playlistcontentsTable;
private javax.swing.JLabel playlistcreatorLabel;
private javax.swing.JLabel playlistnameLabel;
private javax.swing.JLabel playsongButton;
// End of variables declaration//GEN-END:variables
}
| [
"47263298+CrimsonRegulus@users.noreply.github.com"
] | 47263298+CrimsonRegulus@users.noreply.github.com |
5a9045ed653fc07e176ffc5c7d8927319a36e094 | 272aa50b044d04ac5ff0f8a3112360f0325bc9e6 | /Parte 1/Ejercicios/m15u1.ejerciciosbasicos1/src/m15u1/ejerciciosbasicos1/ejerciciosbasicos2.java | b437c5de99365dad2c42ef705baf7de6afc95b2e | [] | no_license | Bort86/M15U1 | b5d926d9fa57f34bb6e7983fc1b8423b0790d39e | 4f54724d3b72e1655e6aa81f0dce83ea25d22718 | refs/heads/master | 2020-04-30T22:57:59.681620 | 2019-04-02T10:58:44 | 2019-04-02T10:58:44 | 177,132,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | 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 m15u1.ejerciciosbasicos1;
import java.util.Scanner;
/**
*
* @author bort
*/
public class ejerciciosbasicos2 {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
int numero;
int factor = 1;
System.out.println("introduce un numero: ");
numero = reader.nextInt();
if (numero % 2 == 0) {
System.out.println("El numero es par");
while (numero !=0) {
factor=factor*numero;
numero--;
}
System.out.println("El factor del numero es: ");
System.out.println(factor);
} else {
System.out.println("El numero no es par");
}
}
}
| [
"dinocolmillo@gmail.com"
] | dinocolmillo@gmail.com |
5c8a7e930dfce3811a9bbf60de8ff7a9bea1c021 | c386eecbe7eebca4552cde05a72138a194e619b3 | /com/example/Hibernate/HibernateState/Student.java | 231d6d336a8de6ee6c71d68b0af24825926bfb77 | [] | no_license | nammavar-guru/java | 34184f3b718637b32b289a2856fef7fbdd192b3a | 7bf0784decc22b42580cb62f4bbedd002fc5d067 | refs/heads/master | 2020-08-31T12:44:58.756400 | 2020-02-25T14:35:11 | 2020-02-25T14:35:11 | 218,694,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package com.example.Hibernate.HibernateState;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import lombok.Getter;
import lombok.Setter;
@Entity
@Setter
@Getter
public class Student {
@Id
@GeneratedValue
private int id;
private String firstName;
private String lastName;
private String email;
public Student() {}
public Student(String firstName, String lastName, String email) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
}
| [
"noreply@github.com"
] | nammavar-guru.noreply@github.com |
b091d13fb845271d6b79712c6d0d6b6ea6530c7a | 8dd0c0d30891bddb82db57f9187758d9e6933f2c | /src/test/java/com/api/json/GetTest.java | 283023bfcded03dd2d087a81d5352120a3f354e3 | [] | no_license | hemanthdevops/jsonapi | bc9bd41ab5bbb57888141ac786421618bd71a71a | b81cb87292017cd6a13a69f3b322daa640ff72f5 | refs/heads/main | 2022-12-30T14:47:43.411096 | 2020-10-21T12:22:58 | 2020-10-21T12:22:58 | 304,910,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,264 | java | package com.api.json;
import com.github.fge.jsonschema.SchemaVersion;
import com.github.fge.jsonschema.cfg.ValidationConfiguration;
import com.github.fge.jsonschema.main.JsonSchemaFactory;
import io.restassured.http.ContentType;
import io.restassured.module.jsv.JsonSchemaValidator;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import org.apache.http.HttpStatus;
import org.junit.Test;
import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.when;
import static io.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchemaInClasspath;
import static io.restassured.module.jsv.JsonSchemaValidatorSettings.settings;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class GetTest {
private static final Logger LOGGER = LogManager.getLogger(GetTest.class.getName());
/* Verify Status code is 200
*/
@org.junit.Test
public void verifyStatusCodeVerify(){
given()
.header("Content-type","application/json")
.header("charset","utf-8")
.when()
.get("https://jsonplaceholder.typicode.com/posts").
then()
.statusCode(200) // verify status code 200
.log().status();
LOGGER.info("Status Code 200!!!");
}
/* Verify Schema as per JSON schema Draft V4
*/
@org.junit.Test
public void verifyGetRecordSchema(){
JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
.setValidationConfiguration(
ValidationConfiguration.newBuilder()
.setDefaultVersion(SchemaVersion.DRAFTV4).freeze())
.freeze();
JsonSchemaValidator.settings = settings()
.with().jsonSchemaFactory(factory)
.and().with().checkedValidation(false);
given()
.header("Content-type","application/json")
.header("charset","utf-8")
.when()
.get("https://jsonplaceholder.typicode.com/posts")
.then()
.assertThat()
.body(matchesJsonSchemaInClasspath("event_0.json")
.using(factory));
LOGGER.info("Schema Validated !!!");
}
/* Verify API returns more than 100 records
*/
@org.junit.Test
public void isThereHundredRecords(){
given()
.header("Content-type","application/json")
.header("charset","utf-8")
.when()
.get("https://jsonplaceholder.typicode.com/posts").
then()
.contentType(ContentType.JSON)
.statusCode(200) .log().all()
.body("id", hasSize(100)); // verify 100 records exist or not
LOGGER.info("100 Records present !!!");
}
/* Verify only one record is returned
*/
@org.junit.Test
public void verifySingleRecord(){
Response response = given()
.header("Content-type","application/json")
.header("charset","utf-8")
.when()
.get("https://jsonplaceholder.typicode.com/posts/1").
then()
.contentType(ContentType.JSON)
.statusCode(HttpStatus.SC_OK)// Verify status code 200
.extract().response();
// verify not more than 1 record exist
JsonPath json = response.jsonPath();
assertNotEquals("2", json.getString("id"));
LOGGER.info("Only one record present!!!");
}
/* Verify that id in response matches input(1)
*/
@org.junit.Test
public void verifySingleRecordId(){
Response response = given()
.header("Content-type","application/json")
.header("charset","utf-8")
.when()
.get("https://jsonplaceholder.typicode.com/posts/1").
then()
.statusCode(HttpStatus.SC_OK) //verify status code 200
.extract()
.response();
JsonPath json = response.jsonPath();
assertEquals("1", json.getString("id")); // verify input(1) in id of response
}
/* Verify Schema
*/
@org.junit.Test
public void verifySingleRecordSchema(){
JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
.setValidationConfiguration(
ValidationConfiguration.newBuilder()
.setDefaultVersion(SchemaVersion.DRAFTV4).freeze())
.freeze();
JsonSchemaValidator.settings = settings()
.with().jsonSchemaFactory(factory)
.and().with().checkedValidation(false);
Response response = given()
.header("Content-type","application/json")
.header("charset","utf-8")
.when()
.get("https://jsonplaceholder.typicode.com/posts/1").
then()
.statusCode(HttpStatus.SC_OK) //verify status code 200
.extract()
.response();
JsonPath json = response.jsonPath();
assertEquals("1", json.getString("id")); // verify input(1) in id of response
response.then()
.assertThat()
.body(matchesJsonSchemaInClasspath("event_2.json") //Verify Schema as per JSON schema Draft V4
.using(factory));
}
/* Verify Status code is 404 for Invalid Posts and log full response
*/
@Test
public void verifyInvalidStatusCode(){
given()
.header("Content-type","application/json")
.header("charset","utf-8")
.when()
.get("https://jsonplaceholder.typicode.com/invalidposts").
then()
.statusCode(HttpStatus.SC_NOT_FOUND) // verify status code 404
.log().all(); // log complete request and response details
LOGGER.info("Status code 404 !!!");
}
}
| [
"hkr.softwaretesting@gmail.com"
] | hkr.softwaretesting@gmail.com |
42e976dc967c1b010199a3f7c226149f2d12a544 | 473b76b1043df2f09214f8c335d4359d3a8151e0 | /benchmark/bigclonebenchdata_completed/12913232.java | 286e16994d41211db4a2e834ef11ff2e16f9d078 | [] | no_license | whatafree/JCoffee | 08dc47f79f8369af32e755de01c52d9a8479d44c | fa7194635a5bd48259d325e5b0a190780a53c55f | refs/heads/master | 2022-11-16T01:58:04.254688 | 2020-07-13T20:11:17 | 2020-07-13T20:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,772 | java |
class c12913232 {
// @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String fullUrl = req.getRequestURL().toString();
MyHelperClass ip = new MyHelperClass();
if (fullUrl.indexOf((int)(Object)ip) != -1) {
// MyHelperClass ip = new MyHelperClass();
fullUrl = fullUrl.replaceAll((String)(Object)ip, "a.tbcdn.cn");
}
URL url = new URL(fullUrl);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
PrintWriter out =(PrintWriter)(Object) resp.getWriter();
String line;
while ((line =(String)(Object) in.readLine()) != null) {
out.println(line);
}
in.close();
out.flush();
}
}
// Code below this line has been added to remove errors
class MyHelperClass {
}
class HttpServletRequest {
public MyHelperClass getRequestURL(){ return null; }}
class HttpServletResponse {
public MyHelperClass getWriter(){ return null; }}
class ServletException extends Exception{
public ServletException(String errorMessage) { super(errorMessage); }
}
class IOException extends Exception{
public IOException(String errorMessage) { super(errorMessage); }
}
class URL {
URL(String o0){}
URL(){}
public MyHelperClass openStream(){ return null; }}
class BufferedReader {
BufferedReader(){}
BufferedReader(InputStreamReader o0){}
public MyHelperClass readLine(){ return null; }
public MyHelperClass close(){ return null; }}
class InputStreamReader {
InputStreamReader(MyHelperClass o0){}
InputStreamReader(){}}
class PrintWriter {
public MyHelperClass println(String o0){ return null; }
public MyHelperClass flush(){ return null; }}
| [
"piyush16066@iiitd.ac.in"
] | piyush16066@iiitd.ac.in |
0ba5aae0cccb2c1c0c9cf31c8fb59cb2d837de56 | 3713053dba8e4243a7469460dab72dc3470796a7 | /webportal-root/src/main/java/com/arjuna/databroker/webportal/UserMO.java | 1b9e69cbf1a5763b4d6927d6840954ee39a78c47 | [
"Apache-2.0"
] | permissive | mtaylor/DataBroker | 43321dc19b910a773760eee8104550864317333e | d53e5d5aa18a062b47e0ec0ffac54e0389b9b95b | refs/heads/master | 2021-01-15T11:02:20.290153 | 2014-10-06T10:52:37 | 2014-10-06T10:52:37 | 26,011,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,853 | java | /*
* Copyright (c) 2013-2014, Arjuna Technologies Limited, Newcastle-upon-Tyne, England. All rights reserved.
*/
package com.arjuna.databroker.webportal;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.ejb.EJBException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import com.arjuna.databroker.webportal.store.UserEntity;
import com.arjuna.databroker.webportal.store.UsersUtils;
@SessionScoped
@ManagedBean(name="user")
public class UserMO implements Serializable
{
private static final long serialVersionUID = 1291911620957873665L;
private static final Logger logger = Logger.getLogger(UserMO.class.getName());
public UserMO()
{
_userName = "";
_password = "";
_activeAccount = Boolean.FALSE;
_adminRole = Boolean.FALSE;
_userRole = Boolean.TRUE;
_guestRole = Boolean.TRUE;
_errorMessage = null;
}
public String getUserName()
{
return _userName;
}
public void setUserName(String userName)
{
_userName = userName;
}
public String getPassword()
{
return "";
}
public void setPassword(String password)
{
_password = password;
}
public Boolean getActiveAccount()
{
return _activeAccount;
}
public void setActiveAccount(Boolean activeAccount)
{
_activeAccount = activeAccount;
}
public Boolean getAdminRole()
{
return _adminRole;
}
public void setAdminRole(Boolean adminRole)
{
_adminRole = adminRole;
}
public Boolean getUserRole()
{
return _userRole;
}
public void setUserRole(Boolean userRole)
{
_userRole = userRole;
}
public Boolean getGuestRole()
{
return _guestRole;
}
public void setGuestRole(Boolean guestRole)
{
_guestRole = guestRole;
}
public String getErrorMessage()
{
return _errorMessage;
}
public void setErrorMessage(String errorMessage)
{
_errorMessage = errorMessage;
}
public String doAdd()
{
clear();
_errorMessage = null;
return "/users/user_add?faces-redirect=true";
}
public String doAddSubmit()
{
try
{
if ((_password != null) && _password.trim().equals(""))
_password = null;
_usersUtils.createUser(_userName, _password, _adminRole, _userRole, _guestRole);
_activeAccount = (_password != null);
_errorMessage = null;
}
catch (EJBException ejbException)
{
if (ejbException.getCausedByException() instanceof IllegalArgumentException)
_errorMessage = ejbException.getCausedByException().getMessage();
else
_errorMessage = ejbException.getCausedByException().toString();
_activeAccount = Boolean.FALSE;
}
catch (Throwable throwable)
{
_errorMessage = "Problem: " + throwable.toString();
_activeAccount = Boolean.FALSE;
}
return "/users/user?faces-redirect=true";
}
public String doChange(String id)
{
load(id);
return "/users/user_change?faces-redirect=true";
}
public String doChangeSubmit()
{
if ((_userName != null) && (! _userName.equals("")))
{
try
{
if ((_password != null) && _password.trim().equals(""))
_password = null;
_usersUtils.changeUser(_userName, _password, _adminRole, _userRole, _guestRole);
_activeAccount = (_password != null);
_errorMessage = null;
}
catch (EJBException ejbException)
{
if (ejbException.getCausedByException() instanceof IllegalArgumentException)
_errorMessage = ejbException.getCausedByException().getMessage();
else
_errorMessage = ejbException.getCausedByException().toString();
_activeAccount = Boolean.FALSE;
}
catch (Throwable throwable)
{
_errorMessage = "Problem: " + throwable.toString();
_activeAccount = Boolean.FALSE;
}
}
else
_errorMessage = "Unable to update information.";
return "/users/user?faces-redirect=true";
}
private void clear()
{
_userName = "";
_password = "";
_activeAccount = Boolean.FALSE;
_adminRole = Boolean.FALSE;
_userRole = Boolean.TRUE;
_guestRole = Boolean.TRUE;
}
private void load(String id)
{
try
{
UserEntity user = null;
_errorMessage = null;
user = _usersUtils.retrieveUser(id);
clear();
if (user != null)
{
_userName = user.getUserName();
_activeAccount = (user.getPassword() != null);
}
else if (_errorMessage == null)
_errorMessage = "Unable to load information.";
}
catch (Throwable throwable)
{
logger.log(Level.WARNING, "Unexpected problem in 'load'", throwable);
clear();
_errorMessage = "Unexpected problem in 'load'";
}
}
private String _userName;
private String _password;
private Boolean _activeAccount;
private Boolean _adminRole;
private Boolean _userRole;
private Boolean _guestRole;
private String _errorMessage;
@EJB
private UsersUtils _usersUtils;
}
| [
"stuart.wheater@arjuna.com"
] | stuart.wheater@arjuna.com |
8cede00efd2f508ff32e0f7e46fb611264573dd7 | 098b37c346b917504f5e7b37acbc18448e4fec75 | /InnerClass and NestedClass and NestedInterface/src/com/shuvabiswas/program2/TestMain_Interface.java | fcd2dd44eca5042f11e0ada170a154b66e8f11fc | [] | no_license | shuvabiswas12/JavaLearning | 8066176b1931ad79fc5cb83cfc01ed483faf81d7 | 9e94b0cb09ee6e23f2a9fa14da19f7fc012fea84 | refs/heads/master | 2020-05-18T16:34:15.234002 | 2019-05-02T06:15:49 | 2019-05-02T06:15:49 | 184,529,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package com.shuvabiswas.program2;
public class TestMain_Interface implements Main_Interfaces {
@Override
public void bio(String name, String address) {
Main_Interfaces.showLength();
System.out.println(name+" "+address+".");
}
}
class Test_Nested_Interface extends TestMain_Interface implements Main_Interfaces.Nested_Interface_1, Main_Interfaces.Nested_Interface_2 {
@Override
public void showEmailNumber(String email) {
System.out.println(Main_Interfaces.Nested_Interface_2.email);
Main_Interfaces.Nested_Interface_1.showLength();
}
@Override
public void showPhoneNumber(String phone) {
System.out.println(Main_Interfaces.Nested_Interface_1.phone);
Main_Interfaces.Nested_Interface_2.showLength();
}
}
| [
"shuvabiswas12@gmail.com"
] | shuvabiswas12@gmail.com |
72b5670105232f2ed586ae891be77746e117bc2d | a1699f208dee85a3c60c429bbb58cf8557fbb7b4 | /src/main/java/com/sw/controller/AppUserPositionController.java | ae0028dd84012f6a1e4a13d80c430cdb480ddef1 | [] | no_license | lhy1234/sw-app-server | 785f9d42e5366d2a4501a7aa9e523805f4dfee8e | 054672b67f7865356bb777280a38a1d1172ebc39 | refs/heads/master | 2023-08-06T12:00:13.002256 | 2019-06-15T04:46:25 | 2019-06-15T04:46:25 | 192,037,324 | 1 | 0 | null | 2022-06-17T02:11:26 | 2019-06-15T04:41:23 | Java | UTF-8 | Java | false | false | 1,688 | java | package com.sw.controller;
import com.sw.beans.AppResult;
import com.sw.beans.response.NearbyPeopleResp;
import com.sw.common.utils.IpUtils;
import com.sw.core.service.IAppUserPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author lihaoyang123
* @since 2019-05-25
*/
@RestController
@RequestMapping("/api/open/users/position")
public class AppUserPositionController {
@Autowired
private IAppUserPositionService appUserPositionService;
/**
* 客户端上送位置信息
*/
@PostMapping("/loc")
public AppResult clientLocation(HttpServletRequest request,String uid, String longitude, String latitude){
String ip = IpUtils.getIpAddr(request);
ip = "111.196.244.208";
//判断ip所在省份
appUserPositionService.addClientPosition(Long.valueOf(uid),ip,new BigDecimal(longitude),new BigDecimal(latitude));
System.out.println(uid+" , "+ longitude+" , "+ latitude);
System.out.println(ip);
return AppResult.ok();
}
@GetMapping("/nearby")
public AppResult nearbyPeople(String uid){
List<NearbyPeopleResp> list = appUserPositionService.nearbyPeople(1001L);
return AppResult.ok(list);
}
}
| [
"13298457669@163.com"
] | 13298457669@163.com |
51ec8c4b51fd99ce20f25b51d097cf161c9de5ca | 1b4affdb2cd213136ad6a9b34a08c372b0f7b643 | /CORE JAVA/src/collection_frameworks/concept1.java | 603666c6fd1a83ced0464c4ce0e97a18ba5ee60f | [] | no_license | DS76001935/Java-Projects | 0a7ad26bc0df4b098768aec5b24ea30a36b0a12d | 9e9d83c8a95c538cfa01da8cc862a5db4907a5e0 | refs/heads/master | 2022-06-18T00:04:56.093920 | 2020-05-19T14:23:41 | 2020-05-19T14:23:41 | 265,256,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,171 | java | package collection_frameworks;
import java.util.ArrayList;
import java.util.Scanner;
public class concept1 {
static int bca;
static int bcom;
static int bba;
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int i;
ArrayList arr=new ArrayList();
System.out.print("Enter The Admissions Of How Many Students =>");
int size=sc.nextInt();
sc.nextLine();
for(i=0;i<size;i++)
{
System.out.print("Enter the Admission of " + (i+1) + "Student =>");
String admission=sc.nextLine();
arr.add(admission);
}
System.out.println("Total Admissions Of GLS UNIVERSITY =>");
for(i=0;i<arr.size();i++)
{
System.out.println((i+1) + " Student's Admission =>" + arr.get(i));
if(arr.get(i).equals("bca"))
{
bca++;
}
else if(arr.get(i).equals("bba"))
{
bba++;
}
else if(arr.get(i).equals("bcom"))
{
bcom++;
}
}
System.out.println("Total Numbers Of Admission In BCA Field => " + bca);
System.out.println("Total Numbers Of Admission In BBA Field => " + bba);
System.out.println("Total Numbers Of Admission In BCOM Field => " + bcom);
}
}
| [
"Deep@TOSHIBA"
] | Deep@TOSHIBA |
e03781bb9936acc1033dfed327a2556436633605 | 8ccd1c071b19388f1f2e92c5e5dbedc78fead327 | /src/main/java/ohos/com/sun/org/apache/xerces/internal/impl/dtd/XMLEntityDecl.java | 0fc1ce2fe73bca6af47d1c10ce564094f1d71760 | [] | no_license | yearsyan/Harmony-OS-Java-class-library | d6c135b6a672c4c9eebf9d3857016995edeb38c9 | 902adac4d7dca6fd82bb133c75c64f331b58b390 | refs/heads/main | 2023-06-11T21:41:32.097483 | 2021-06-24T05:35:32 | 2021-06-24T05:35:32 | 379,816,304 | 6 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,166 | java | package ohos.com.sun.org.apache.xerces.internal.impl.dtd;
public class XMLEntityDecl {
public String baseSystemId;
public boolean inExternal;
public boolean isPE;
public String name;
public String notation;
public String publicId;
public String systemId;
public String value;
public void setValues(String str, String str2, String str3, String str4, String str5, boolean z, boolean z2) {
setValues(str, str2, str3, str4, str5, null, z, z2);
}
public void setValues(String str, String str2, String str3, String str4, String str5, String str6, boolean z, boolean z2) {
this.name = str;
this.publicId = str2;
this.systemId = str3;
this.baseSystemId = str4;
this.notation = str5;
this.value = str6;
this.isPE = z;
this.inExternal = z2;
}
public void clear() {
this.name = null;
this.publicId = null;
this.systemId = null;
this.baseSystemId = null;
this.notation = null;
this.value = null;
this.isPE = false;
this.inExternal = false;
}
}
| [
"yearsyan@gmail.com"
] | yearsyan@gmail.com |
9ca60e5f4235772cbd0236912016e31496e948ab | 498d46877d31bb5a519822c504bd0b8880131c59 | /src/java/uts/isd/model/User.java | 621d0dd39ebd1bf6e87b0821ed312c28f84eb728 | [] | no_license | IoTBay/uts-iotbay | e417e0f07ac08e2d18f9e35eef5892b99693be06 | a935b84d919367127e790aeb8f9ee2638775facc | refs/heads/master | 2021-05-17T15:24:23.612597 | 2020-06-08T14:15:29 | 2020-06-08T14:15:29 | 250,842,764 | 0 | 0 | null | 2020-06-14T01:38:29 | 2020-03-28T16:31:23 | Java | UTF-8 | Java | false | false | 8,642 | java | /*
* UTS Introduction to Software Development
* IOT Bay - Assignment 1
* @author Rhys Hanrahan 11000801
*/
package uts.isd.model;
import uts.isd.model.dao.*;
import java.io.Serializable;
import java.sql.ResultSet;
import java.text.ParseException;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.concurrent.TimeUnit;
import javax.servlet.ServletRequest;
import uts.isd.util.Hash;
import uts.isd.util.Logging;
/**
* User model
*
* @author Rhys Hanrahan 11000801
* @since 2020-05-16
*/
public class User implements Serializable {
private int id;
private int customerId;
private int defaultCurrencyId;
private String email;
private String password;
private int accessLevel;
private Date birthDate;
private int sex;
private String biography;
private String passwordResetHash;
private Date createdDate;
private int createdBy;
private Date modifiedDate;
private int modifiedBy;
//Use this code to allow users to register as a staff member.
public static final String STAFF_CODE = "Escalate";
public User() {
this.email = "";
this.password = "";
this.birthDate = new Date();
this.biography = "";
this.passwordResetHash = "";
this.createdDate = new Date();
this.modifiedDate = new Date();
this.createdBy = 0;
this.modifiedBy = 0;
}
/**
* This constructor takes an SQL ResultSet and grabs the values from the DB Record
* to populate each property in the user model.
*
* @param rs The SQL ResultSet row to populate values from.
*/
public User(ResultSet rs)
{
try
{
this.id = rs.getInt("ID");
this.customerId = rs.getInt("CustomerID");
//this.defaultCurrencyId =
this.email = rs.getString("Email");
this.password = rs.getString("Password");
this.accessLevel = rs.getInt("AccessLevel");
this.birthDate = rs.getDate("BirthDate");
this.sex = rs.getInt("Gender");
this.biography = rs.getString("Biography");
//this.passwordResetHash = rs.getString("PasswordResetHash");
this.createdDate = rs.getTimestamp("CreatedDate");
this.createdBy = rs.getInt("CreatedBy");
this.modifiedDate = rs.getTimestamp("ModifiedDate");
this.modifiedBy = rs.getInt("ModifiedBy");
}
catch (Exception e)
{
Logging.logMessage("Unable to load User from ResultSet for ID", e);
}
}
public User(String email) {
this.email = email;
}
/**
* This method populates this instance's properties based on form inputs.
*
* @param request The controller's HTTPServlet POST request properties.
*/
public void loadRequest(ServletRequest request)
{
if (request.getParameter("id") != null)
this.id = Integer.parseInt(request.getParameter("id"));
if (request.getParameter("customerId") != null)
this.customerId = Integer.parseInt(request.getParameter("customerId"));
this.email = request.getParameter("email");
if (request.getParameter("password") != null)
this.setPassword(request.getParameter("password"));
if (request.getParameter("accessLevel") != null)
this.accessLevel = Integer.parseInt(request.getParameter("accessLevel"));
//https://www.javatpoint.com/java-string-to-date
String dob = request.getParameter("dob_yyyy")+"-"+request.getParameter("dob_mm")+"-"+request.getParameter("dob_dd");
try {
this.birthDate = new SimpleDateFormat("yyyy-MM-dd").parse(dob);
} catch (ParseException ex) {
Logging.logMessage("Unable to parse Date for addUser", ex);
return;
}
this.sex = Integer.parseInt(request.getParameter("sex"));
}
public boolean add(IUser db, Customer customer)
{
try
{
//Assumes the User object (this) has been populated already.
//Takes object properties and inserts into DB.
boolean added = db.addUser(this, customer);
//Always close DB when done.
return added;
}
catch (Exception e)
{
Logging.logMessage("Failed to add user", e);
return false;
}
}
public boolean update(IUser db, Customer customer)
{
try
{
//Assumes the User object (this) has been populated already.
//Takes object properties and inserts into DB.
boolean updated = db.updateUser(this, customer);
//Always close DB when done.
return updated;
}
catch (Exception e)
{
Logging.logMessage("Failed to update user", e);
return false;
}
}
public boolean delete(IUser db)
{
try
{
//Assumes the User object (this) has been populated already.
//Takes object properties and inserts into DB.
boolean deleted = db.deleteUserById(this.id);
//Always close DB when done.
return deleted;
}
catch (Exception e)
{
Logging.logMessage("Failed to delete user", e);
return false;
}
}
/**
* This method determines if a user has access to admin functions.
*
* @return Returns ture if user is an admin.
*/
public boolean isAdmin()
{
return (this.accessLevel >= 10);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword()
{
return this.password;
}
public void setPassword(String password)
{
this.password = Hash.SHA256(password);
}
public int getAccessLevel() {
return accessLevel;
}
public void setAccessLevel(int accessLevel) {
this.accessLevel = accessLevel;
}
public Date getBirthDate() {
return birthDate;
}
public void setBirthDate(String s)
{
try {
this.birthDate = new SimpleDateFormat("yyyy-MM-dd").parse(s);
} catch (ParseException ex) {
Logging.logMessage("Unable to parse Date for setBirthDate", ex);
}
}
public void setBirthDate(Date date)
{
this.birthDate = date;
}
public int getAge() {
Date now = new Date();
long diffMs = Math.abs(now.getTime() - this.birthDate.getTime());
long diff = TimeUnit.DAYS.convert(diffMs, TimeUnit.MILLISECONDS);
return (int)Math.floor((double)diff / (double)365);
}
public String getBiography() {
return biography;
}
public void setBiography(String biography) {
this.biography = biography;
}
public int getGender()
{
return this.sex;
}
public String getSex() {
if (this.sex == 1)
return "Male";
else if (this.sex == 2)
return "Female";
else
return "Unknown";
}
public String getPasswordResetHash() {
return passwordResetHash;
}
public void setPasswordResetHash(String passwordResetHash) {
this.passwordResetHash = passwordResetHash;
}
public Date getCreatedDate() {
return this.createdDate;
}
public Date getModifiedDate() {
return this.modifiedDate;
}
public Customer getCreatedBy() {
try
{
ICustomer dbCustomer = new DBCustomer();
Customer c = dbCustomer.getCustomerById(this.createdBy);
return c;
}
catch (Exception e)
{
return new Customer();
}
}
public Customer getModifiedBy() {
try
{
ICustomer dbCustomer = new DBCustomer();
Customer c = dbCustomer.getCustomerById(this.modifiedBy);
return c;
}
catch (Exception e)
{
return new Customer();
}
}
}
| [
"rhys.hanrahan@gmail.com"
] | rhys.hanrahan@gmail.com |
957bfba265dec9a6349f62e349db16efa3d4cbfc | 996c9b76b615a384628b5c0ee3f389d26341d56b | /src/com/game/ObjRenderer.java | 6417440b20a3528a980102c6dab7c8d56060a61f | [] | no_license | bmruner/Obj-File-loader | 702a892fc25cce8f904e4c3b15984571960c52a6 | ee8296ae502b16d26970caeeec87e3917ba03153 | refs/heads/master | 2020-05-01T12:09:15.007279 | 2013-12-09T07:36:51 | 2013-12-09T07:36:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,739 | java | package com.game;
import java.io.IOException;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import com.game.R;
import android.content.Context;
import android.opengl.GLSurfaceView.Renderer;
import android.opengl.GLES20;
import android.opengl.Matrix;
/**
* Renderer for the Game GLSurfaceView
* Some code taken from learnopengles.com
* @author Iyaz
*
*/
public class ObjRenderer implements Renderer{
/**
* Store the model matrix. This matrix is used to move models from
* object space (where each model can be thought
* of being located at the center of the universe) to world space.
*/
private float[] mModelMatrix = new float[16];
/**
* Store the view matrix. This can be thought of as our camera.
* This matrix transforms world space to eye space;
* it positions things relative to our eye.
*/
private float[] mViewMatrix = new float[16];
/** Store the projection matrix. This is used to project the scene
* onto a 2D viewport. */
private float[] mProjectionMatrix = new float[16];
private float[] mMVMatrix = new float[16];
/** Allocate storage for the final combined matrix. This will be
* passed into the shader program. */
private float[] mMVPMatrix = new float[16];
private ObjLoader loader;
private final int bytesPerFloat = 4;
private final int bytesPerShort = 2;
/** These will be used to pass in the matrices. */
private int mMVPMatrixHandle;
private int mMVMatrixHandle;
/** These will be used to pass in model information. */
private int mPositionHandle;
private int mLightPosHandle;
private int mNormalHandle;
private int mColorHandle;
private int mTextureCoordsHandle;
private int mTextureUniformHandle;
private int mProgramHandle;
private int mPointProgramHandle;
private int mTextureDataHandle;
/**
* Stores a copy of the model matrix specifically for the light position.
*/
private float[] mLightModelMatrix = new float[16];
private int verticesPBuffer;
private int verticesNBuffer;
private int verticesTCBuffer;
private int indicesPBuffer;
private Context context;
/** Used to hold a light centered on the origin in model space. We need a 4th coordinate so we can get translations to work when
* we multiply this by our transformation matrices. */
private final float[] mLightPosInModelSpace = new float[] {0.0f, 0.0f, 0.0f, 1.0f};
/** Used to hold the current position of the light in world space (after transformation via model matrix). */
private final float[] mLightPosInWorldSpace = new float[4];
/** Used to hold the transformed position of the light in eye space (after transformation via modelview matrix) */
private final float[] mLightPosInEyeSpace = new float[4];
private final String pointVertexShader =
"uniform mat4 u_MVPMatrix; \n"
+ "attribute vec4 a_Position; \n"
+ "void main() \n"
+ "{"
+ "gl_Position = u_MVPMatrix * a_Position; \n"
+ "gl_PointSize = 5.0; \n"
+ "} \n";
private final String pointFragmentShader =
"precision mediump float; \n"
+ "void main() \n"
+ "{"
+ "gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); \n"
+ "} \n";
private final String vertexShader =
"uniform mat4 u_MVPMatrix; \n" //Model-View-Projection Matrix.
+ "uniform mat4 u_MVMatrix; \n" //Model-View Matrix.
+ "attribute vec3 a_Normal; \n" //Per-vertex Normal of the obj
+ "attribute vec4 a_Position; \n" // Per-vertex position information we will pass in.
+ "attribute vec2 a_TextureCoords; \n"
+ "varying vec3 v_position; \n"
+ "varying vec3 v_normal; \n"
+ "varying vec2 v_TextureCoords; \n"
+ "void main() \n" // The entry point for our vertex shader.
+ "{"
+ "v_TextureCoords = a_TextureCoords; \n"
+ "v_position = vec3(u_MVMatrix * a_Position); \n"
+ "v_normal = vec3(u_MVMatrix * vec4(a_Normal, 0.0)); \n"
+ "gl_Position = u_MVPMatrix * a_Position; \n"
+ "} \n";
private final String fragmentShader =
"precision mediump float; \n" // Set the default precision to medium. We don't need as high of a
// precision in the fragment shader.
+ "uniform vec3 lightPos; \n"
+ "uniform sampler2D u_Texture; \n"
+ "varying vec3 v_position; \n" //passed in from the vertex shader.
+ "varying vec3 v_normal; \n"
+ "varying vec2 v_TextureCoords; \n"
+ "void main() \n" // The entry point for our fragment shader.
+ "{ \n"
+ "float distance = length(lightPos - v_position); \n"
+ "vec3 lightVector = normalize(lightPos - v_position); \n"
+ "float diffuse = max(dot(lightVector, v_normal), 0.1); \n"
+ "diffuse = diffuse * (1.0 / (1.0 + (0.25 * distance * distance))); \n"
+ " gl_FragColor = diffuse * texture2D(u_Texture, v_TextureCoords);\n" // Pass the color directly through the pipeline.
+ "} \n";
/**
* Constructor for the GameRenderer. This includes an objloader so the game
* renderer can get data on models from the assets folder.
* @param loader
*/
public ObjRenderer(ObjLoader loader, Context context)
{
this.context = context;
this.loader = loader;
try {
loader.parseObject("cube4.obj");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void onSurfaceChanged(GL10 arg0, int width, int height)
{
//Set the viewport to be the size of the screen.
GLES20.glViewport(0, 0, width, height);
// Create a new perspective projection matrix. The height will stay the same
// while the width will vary as per aspect ratio.
final float ratio = (float) width / height;
final float left = -ratio;
final float right = ratio;
final float bottom = -1.0f;
final float top = 1.0f;
final float near = 1.0f;
final float far = 10.0f;
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
}
@Override
public void onSurfaceCreated(GL10 arg0, EGLConfig arg1)
{
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
//generate the VBOS and IBOS for the vertices and indices
final int buffers[] = new int[4];
GLES20.glGenBuffers(4, buffers, 0);
//The VBO generation
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, buffers[0]);
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, loader.getModels().get(0).
getVerticesPositions().capacity() * bytesPerFloat,
loader.getModels().get(0).getVerticesPositions(),
GLES20.GL_STATIC_DRAW);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, buffers[1]);
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, loader.getModels().get(0).
getVerticesNormals().capacity() * bytesPerFloat,
loader.getModels().get(0).getVerticesNormals(),
GLES20.GL_STATIC_DRAW);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, buffers[2]);
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, loader.getModels().get(0).
getVerticesColors().capacity() * bytesPerFloat,
loader.getModels().get(0).getVerticesColors(),
GLES20.GL_STATIC_DRAW);
//The IBO generation
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, buffers[3]);
GLES20.glBufferData(GLES20.GL_ELEMENT_ARRAY_BUFFER, loader.getModels().get(0).
getIndicesPositions().capacity() * bytesPerShort,
loader.getModels().get(0).getIndicesPositions(),
GLES20.GL_STATIC_DRAW);
verticesPBuffer = buffers[0];
verticesNBuffer = buffers[1];
verticesTCBuffer = buffers[2];
indicesPBuffer = buffers[3];
// Position the eye behind the origin.
final float eyeX = 0.0f;
final float eyeY = 0.0f;
final float eyeZ = 5.0f;
// We are looking toward the distance
final float lookX = 0.0f;
final float lookY = 0.0f;
final float lookZ = -5.0f;
// Set our up vector. This is where our head would be pointing were we holding the camera.
final float upX = 0.0f;
final float upY = 1.0f;
final float upZ = 0.0f;
// Set the view matrix. This matrix can be said to represent the camera position.
// NOTE: In OpenGL 1, a ModelView matrix is used, which is a combination of a model and
// view matrix. In OpenGL 2, we can keep track of these matrices separately if we choose.
Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);
final int vertexShaderHandle = GLHelper.loadShader(GLES20.GL_VERTEX_SHADER,
vertexShader);
final int fragmentShaderHandle = GLHelper.loadShader(GLES20.GL_FRAGMENT_SHADER,
fragmentShader);
mProgramHandle = GLHelper.createAndLinkProgram
(vertexShaderHandle, fragmentShaderHandle,
new String[] {"a_Position", "a_Normal",
"a_TextureCoords"});
final int pointVertexShaderHandle = GLHelper.loadShader(GLES20.GL_VERTEX_SHADER, pointVertexShader);
final int pointFragmentShaderHandle = GLHelper.loadShader(GLES20.GL_FRAGMENT_SHADER, pointFragmentShader);
mPointProgramHandle = GLHelper.createAndLinkProgram(pointVertexShaderHandle, pointFragmentShaderHandle,
new String[] {"a_Position"});
mTextureDataHandle = GLHelper.loadTexture(context, R.drawable.metal);
GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
}
@Override
public void onDrawFrame(GL10 arg0)
{
if (mProgramHandle != 0)
{
GLES20.glUseProgram(mProgramHandle);
}
else
{
throw new RuntimeException("Program isn't valid");
}
mPositionHandle = GLES20.glGetAttribLocation(mProgramHandle, "a_Position");
mNormalHandle = GLES20.glGetAttribLocation(mProgramHandle, "a_Normal");
mTextureCoordsHandle = GLES20.glGetAttribLocation(mProgramHandle, "a_TextureCoords");
mTextureUniformHandle = GLES20.glGetUniformLocation(mProgramHandle, "u_Texture");
mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgramHandle, "u_MVPMatrix");
mMVMatrixHandle = GLES20.glGetUniformLocation(mProgramHandle, "u_MVMatrix");
mLightPosHandle = GLES20.glGetUniformLocation(mProgramHandle, "lightPos");
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
// Set program handles. These will later be used to pass in values to the program.
// Set the active texture unit to texture unit 0.
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
// Bind the texture to this unit.
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataHandle);
// Tell the texture uniform sampler to use this texture in the shader by binding to texture unit 0.
GLES20.glUniform1i(mTextureUniformHandle, 0);
Matrix.setIdentityM(mLightModelMatrix, 0);
Matrix.translateM(mLightModelMatrix, 0, 0.0f, 0.0f, 2.0f);
Matrix.multiplyMV(mLightPosInWorldSpace, 0, mLightModelMatrix, 0, mLightPosInModelSpace, 0);
Matrix.multiplyMV(mLightPosInEyeSpace, 0, mViewMatrix, 0, mLightPosInWorldSpace, 0);
// Draw the triangle facing straight on.
Matrix.setIdentityM(mModelMatrix, 0);
Matrix.rotateM(mModelMatrix, 0, 45.0f, 1.0f, 1.0f, 1.0f);
drawModel();
// Draw a point to indicate the light.
GLES20.glUseProgram(mPointProgramHandle);
drawLight();
}
private void drawLight()
{
final int pointMVPMatrixHandle = GLES20.glGetUniformLocation(mPointProgramHandle, "u_MVPMatrix");
final int pointPositionHandle = GLES20.glGetAttribLocation(mPointProgramHandle, "a_Position");
// Pass in the position.
GLES20.glVertexAttrib3f(pointPositionHandle, mLightPosInModelSpace[0], mLightPosInModelSpace[1], mLightPosInModelSpace[2]);
// Since we are not using a buffer object, disable vertex arrays for this attribute.
GLES20.glDisableVertexAttribArray(pointPositionHandle);
// Pass in the transformation matrix.
Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mLightModelMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);
GLES20.glUniformMatrix4fv(pointMVPMatrixHandle, 1, false, mMVPMatrix, 0);
// Draw the point.
GLES20.glDrawArrays(GLES20.GL_POINTS, 0, 1);
}
private void drawModel()
{
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, verticesPBuffer);
GLES20.glEnableVertexAttribArray(mPositionHandle);
GLES20.glVertexAttribPointer(mPositionHandle, 3, GLES20.GL_FLOAT,
false, 0, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, verticesNBuffer);
GLES20.glEnableVertexAttribArray(mNormalHandle);
GLES20.glVertexAttribPointer(mNormalHandle, 3, GLES20.GL_FLOAT,
false, 0, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, verticesTCBuffer);
GLES20.glEnableVertexAttribArray(mTextureCoordsHandle);
GLES20.glVertexAttribPointer(mTextureCoordsHandle, 2, GLES20.GL_FLOAT,
false, 0, 0);
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, indicesPBuffer);
Matrix.multiplyMM(mMVMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);
// This multiplies the view matrix by the model matrix, and stores the result in the MVP matrix
// (which currently contains model * view).
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVMatrix, 0);
GLES20.glUniformMatrix4fv(mMVMatrixHandle, 1, false, mMVMatrix, 0);
GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);
// Pass in the light position in eye space.
GLES20.glUniform3f(mLightPosHandle, mLightPosInEyeSpace[0], mLightPosInEyeSpace[1], mLightPosInEyeSpace[2]);
GLES20.glDrawElements(GLES20.GL_TRIANGLES,
loader.getModels().get(0).getIndicesPositions().capacity(), GLES20.GL_UNSIGNED_SHORT, 0);
}
}
| [
"iyaz63@vt.edu"
] | iyaz63@vt.edu |
ea565d1fda15666e9d356dc1a88f55017db06d2b | c3e439c7b0253e706cd1969d1cad4c7193fd6119 | /src/com/company/Main.java | f047765032fa0de4e9d6749bd9b137d0caba793f | [] | no_license | miguelogren/Excercise-BestGymEver | a48c195978a24a2e5e54038b91bdc8b23051529f | 9086c8b52dce84e1daa832e52f574e8aa81366ff | refs/heads/master | 2023-08-12T12:54:00.543522 | 2021-10-15T11:07:39 | 2021-10-15T11:07:39 | 417,468,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,409 | java | package com.company;
import javax.swing.*;
import java.io.File;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
String parentFolder = System.getProperty("user.dir");
File membersFile = new File(parentFolder+"\\Customers.txt");
ArrayList<Member> members = FileControl.readMembersFile(membersFile);
String id = JOptionPane.showInputDialog("Skriv in personnummer eller namn och efternamn: ");
Member currentCustomer = Check.isActiveMember(members, id);
if (currentCustomer != null) {
if (currentCustomer.isMember()) {
String member = currentCustomer.getIdNr()+currentCustomer.getName()+".txt";
File memberFile = new File(parentFolder+"\\"+member);
currentCustomer.setTrainingDates(FileControl.readVisitsFile(memberFile));
currentCustomer.train();
System.out.println(currentCustomer.getName() + " is a member. Membership was paid " + currentCustomer.getPaid());
FileControl.WriteFile(memberFile, currentCustomer.getTrainingDates());
}
else
System.out.println(currentCustomer.getName() + "Is no longer a member. Membership was last paid " + currentCustomer.getPaid());
}
else System.out.println("Person has never been here before.");
}
}
| [
"miguel.h.ogren@gmail.com"
] | miguel.h.ogren@gmail.com |
49461370551cdc98f77fad2bd66caf456605ece8 | 5bb2e088652f9bea8d78f80ca8b9a4c032bc4e46 | /FitnessTracker/src/main/java/com/fit/Controller/SignupForm.java | d5081621f8c1bd0fe95b366b898dfec41efe0a2d | [] | no_license | javayp/JavaProjects | 8fef4c5c476cb1622d9612dcdafc2501884def97 | ee07dc2bc6d45acc5be6c2408c425abfb6076eb2 | refs/heads/master | 2021-01-19T03:18:31.170068 | 2014-12-11T07:13:54 | 2014-12-11T07:13:54 | 27,390,092 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 989 | java | package com.fit.Controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMethod;
import com.fit.Model.SignupData;
@Controller
public class SignupForm {
@RequestMapping(value="/signup")
public String request(Model model){
model.addAttribute("SignupData",new SignupData());
List<String> professonallist=new ArrayList<String>();
professonallist.add("Developer IT");
professonallist.add("programmer");
model.addAttribute("professionalList",professonallist);
return "signupPage";
}
@RequestMapping(value="/signupCompleted", method=RequestMethod.POST)
public String response(@ModelAttribute("SignupData") SignupData data){
return "signupPageDisplay";
}
}
| [
"prashanth.yp89@gmail.com"
] | prashanth.yp89@gmail.com |
4f1114bc097771bb4a28ff3b37ce7b8157547c57 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/1212/tar_0.java | b532d6e3c849cefbb1b40db786649ab09045373f | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,397 | java | package org.eclipse.swt.ole.win32;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.Compatibility;
import org.eclipse.swt.internal.ole.win32.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.internal.win32.*;
/**
* OleClientSite provides a site to manage an embedded OLE Document within a container.
*
* <p>The OleClientSite provides the following capabilities:
* <ul>
* <li>creates the in-place editor for a blank document or opening an existing OLE Document
* <li>lays the editor out
* <li>provides a mechanism for activating and deactivating the Document
* <li>provides a mechanism for saving changes made to the document
* </ul>
*
* <p>This object implements the OLE Interfaces IUnknown, IOleClientSite, IAdviseSink,
* IOleInPlaceSite
*
* <p>Note that although this class is a subclass of <code>Composite</code>,
* it does not make sense to add <code>Control</code> children to it,
* or set a layout on it.
* </p><p>
* <dl>
* <dt><b>Styles</b> <dd>BORDER
* <dt><b>Events</b> <dd>Dispose, Move, Resize
* </dl>
*
*/
public class OleClientSite extends Composite {
// Interfaces for this Ole Client Container
private COMObject iUnknown;
private COMObject iOleClientSite;
private COMObject iAdviseSink;
private COMObject iOleInPlaceSite;
protected GUID appClsid;
private GUID objClsid;
private int refCount;
// References to the associated Frame.
protected OleFrame frame;
// Access to the embedded/linked Ole Object
protected IUnknown objIUnknown;
protected IOleObject objIOleObject;
protected IViewObject2 objIViewObject2;
protected IOleInPlaceObject objIOleInPlaceObject;
protected IOleCommandTarget objIOleCommandTarget;
// Related storage information
protected IStorage tempStorage; // IStorage interface of the receiver
// Internal state and style information
private int aspect; // the display aspect of the embedded object, e.g., DvaspectContent or DvaspectIcon
private int type; // Indicates the type of client that can be supported inside this container
private boolean isStatic; // Indicates item's display is static, i.e., a bitmap, metafile, etc.
private RECT borderWidths = new RECT();
private RECT indent = new RECT();
private boolean inUpdate = false;
private boolean inInit = true;
private boolean inDispose = false;
private static final String WORDPROGID = "Word.Document";
private Listener listener;
static final int STATE_NONE = 0;
static final int STATE_RUNNING = 1;
static final int STATE_INPLACEACTIVE = 2;
static final int STATE_UIACTIVE = 3;
static final int STATE_ACTIVE = 4;
int state = STATE_NONE;
protected OleClientSite(Composite parent, int style) {
/*
* NOTE: this constructor should never be used by itself because it does
* not create an Ole Object
*/
super(parent, style);
createCOMInterfaces();
// install the Ole Frame for this Client Site
while (parent != null) {
if (parent instanceof OleFrame){
frame = (OleFrame)parent;
break;
}
parent = parent.getParent();
}
if (frame == null) OLE.error(SWT.ERROR_INVALID_ARGUMENT);
frame.AddRef();
aspect = COM.DVASPECT_CONTENT;
type = COM.OLEEMBEDDED;
isStatic = false;
listener = new Listener() {
public void handleEvent(Event e) {
switch (e.type) {
case SWT.Resize :
case SWT.Move : onResize(e); break;
case SWT.Dispose : onDispose(e); break;
case SWT.FocusIn: onFocusIn(e); break;
case SWT.FocusOut: onFocusOut(e); break;
case SWT.Paint: onPaint(e); break;
case SWT.Traverse: onTraverse(e); break;
case SWT.KeyDown: /* required for traversal */ break;
default :
OLE.error(SWT.ERROR_NOT_IMPLEMENTED);
}
}
};
frame.addListener(SWT.Resize, listener);
frame.addListener(SWT.Move, listener);
addListener(SWT.Dispose, listener);
addListener(SWT.FocusIn, listener);
addListener(SWT.FocusOut, listener);
addListener(SWT.Paint, listener);
addListener(SWT.Traverse, listener);
addListener(SWT.KeyDown, listener);
}
/**
* Create an OleClientSite child widget using the OLE Document type associated with the
* specified file. The OLE Document type is determined either through header information in the file
* or through a Registry entry for the file extension. Use style bits to select a particular look
* or set of properties.
*
* @param parent a composite widget; must be an OleFrame
* @param style the bitwise OR'ing of widget styles
* @param file the file that is to be opened in this OLE Document
*
* @exception SWTError
* <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null</ul>
* @exception SWTError
* <ul><li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
* <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
* <li>ERROR_CANNOT_OPEN_FILE when failed to open file
* <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
*
*/
public OleClientSite(Composite parent, int style, File file) {
this(parent, style);
try {
if (file == null || file.isDirectory() || !file.exists())
OLE.error(OLE.ERROR_INVALID_ARGUMENT);
// Is there an associated CLSID?
appClsid = new GUID();
char[] fileName = (file.getAbsolutePath()+"\0").toCharArray();
int result = COM.GetClassFile(fileName, appClsid);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
// Open a temporary storage object
tempStorage = createTempStorage();
// Create ole object with storage object
int[] address = new int[1];
result = COM.OleCreateFromFile(appClsid, fileName, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
objIUnknown = new IUnknown(address[0]);
// Init sinks
addObjectReferences();
if (COM.OleRun(objIUnknown.getAddress()) == OLE.S_OK) state = STATE_RUNNING;
} catch (SWTException e) {
disposeCOMInterfaces();
frame.Release();
throw e;
}
}
/**
* Create an OleClientSite child widget to edit a blank document using the specified OLE Document
* application. Use style bits to select a particular look or set of properties.
*
* @param parent a composite widget; must be an OleFrame
* @param style the bitwise OR'ing of widget styles
* @param progID the unique program identifier of am OLE Document application;
* the value of the ProgID key or the value of the VersionIndependentProgID key specified
* in the registry for the desired OLE Document (for example, the VersionIndependentProgID
* for Word is Word.Document)
*
* @exception SWTError
* <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
* <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
* <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
* <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
* <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
*
*/
public OleClientSite(Composite parent, int style, String progId) {
this(parent, style);
try {
appClsid = getClassID(progId);
if (appClsid == null)
OLE.error(OLE.ERROR_INVALID_CLASSID);
// Open a temporary storage object
tempStorage = createTempStorage();
// Create ole object with storage object
int[] address = new int[1];
int result = COM.OleCreate(appClsid, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
objIUnknown = new IUnknown(address[0]);
// Init sinks
addObjectReferences();
if (COM.OleRun(objIUnknown.getAddress()) == OLE.S_OK) state = STATE_RUNNING;
} catch (SWTException e) {
disposeCOMInterfaces();
frame.Release();
throw e;
}
}
/**
* @private
*
* Create an OleClientSite child widget to edit the specified file using the specified OLE Document
* application. Use style bits to select a particular look or set of properties.
*
* @param parent a composite widget; must be an OleFrame
* @param style the bitwise OR'ing of widget styles
* @param progID the unique program identifier of am OLE Document application;
* the value of the ProgID key or the value of the VersionIndependentProgID key specified
* in the registry for the desired OLE Document (for example, the VersionIndependentProgID
* for Word is Word.Document)
* @param file the file that is to be opened in this OLE Document
*
* @exception SWTError
* <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* <li>ERROR_ERROR_NULL_ARGUMENT when the parent is null
* <li>ERROR_INVALID_CLASSID when the progId does not map to a registered CLSID
* <li>ERROR_CANNOT_CREATE_OBJECT when failed to create OLE Object
* <li>ERROR_CANNOT_OPEN_FILE when failed to open file
* <li>ERROR_INVALID_ARGUMENT when the parent is not an OleFrame
* <li>ERROR_INTERFACES_NOT_INITIALIZED when unable to create callbacks for OLE Interfaces</ul>
*
*/
public OleClientSite(Composite parent, int style, String progId, File file) {
this(parent, style);
try {
if (file == null || file.isDirectory() || !file.exists())
OLE.error(OLE.ERROR_INVALID_ARGUMENT);
appClsid = getClassID(progId);
// Are we opening this file with the preferred OLE object?
char[] fileName = (file.getAbsolutePath()+"\0").toCharArray();
GUID fileClsid = new GUID();
COM.GetClassFile(fileName, fileClsid);
if (COM.IsEqualGUID(appClsid, fileClsid)){
// use default mechanism
// Open a temporary storage object
tempStorage = createTempStorage();
// Create ole object with storage object
int[] address = new int[1];
int result = COM.OleCreateFromFile(appClsid, fileName, COM.IIDIUnknown, COM.OLERENDER_DRAW, null, 0, tempStorage.getAddress(), address);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
objIUnknown = new IUnknown(address[0]);
} else {
// use a conversion mechanism
// Word does not follow the standard and does not use "CONTENTS" as the name of
// its primary stream
String contentStream = "CONTENTS";
GUID wordGUID = getClassID(WORDPROGID);
if (COM.IsEqualGUID(appClsid, wordGUID)) contentStream = "WordDocument";
// Copy over the contents of the file into a new temporary storage object
OleFile oleFile = new OleFile(file, contentStream, OleFile.READ);
IStorage storage = oleFile.getRootStorage();
storage.AddRef();
// Open a temporary storage object
tempStorage = createTempStorage();
// Copy over contents of file
int result = storage.CopyTo(0, null, null, tempStorage.getAddress());
storage.Release();
if (result != COM.S_OK)
OLE.error(OLE.ERROR_CANNOT_OPEN_FILE, result);
oleFile.dispose();
// create ole client
int[] ppv = new int[1];
result = COM.CoCreateInstance(appClsid, 0, COM.CLSCTX_INPROC_HANDLER | COM.CLSCTX_INPROC_SERVER, COM.IIDIUnknown, ppv);
if (result != COM.S_OK){
tempStorage.Release();
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
}
objIUnknown = new IUnknown(ppv[0]);
// get the persistant storage of the ole client
ppv = new int[1];
result = objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppv);
if (result != COM.S_OK){
tempStorage.Release();
objIUnknown.Release();
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
}
IPersistStorage iPersistStorage = new IPersistStorage(ppv[0]);
// load the contents of the file into the ole client site
result = iPersistStorage.Load(tempStorage.getAddress());
iPersistStorage.Release();
if (result != COM.S_OK){
tempStorage.Release();
tempStorage = null;
objIUnknown.Release();
objIUnknown = null;
OLE.error(OLE.ERROR_CANNOT_CREATE_OBJECT, result);
}
}
// Init sinks
addObjectReferences();
if (COM.OleRun(objIUnknown.getAddress()) == OLE.S_OK) state = STATE_RUNNING;
} catch (SWTException e) {
disposeCOMInterfaces();
frame.Release();
throw e;
}
}
protected void addObjectReferences() {
//
int[] ppvObject = new int[1];
if (objIUnknown.QueryInterface(COM.IIDIPersist, ppvObject) == COM.S_OK) {
IPersist objIPersist = new IPersist(ppvObject[0]);
GUID tempid = new GUID();
if (objIPersist.GetClassID(tempid) == COM.S_OK)
objClsid = tempid;
objIPersist.Release();
}
//
ppvObject = new int[1];
int result = objIUnknown.QueryInterface(COM.IIDIViewObject2, ppvObject);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_INTERFACE_NOT_FOUND, result);
objIViewObject2 = new IViewObject2(ppvObject[0]);
objIViewObject2.SetAdvise(aspect, 0, iAdviseSink.getAddress());
//
ppvObject = new int[1];
result = objIUnknown.QueryInterface(COM.IIDIOleObject, ppvObject);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_INTERFACE_NOT_FOUND, result);
objIOleObject = new IOleObject(ppvObject[0]);
objIOleObject.SetClientSite(iOleClientSite.getAddress());
int[] pdwConnection = new int[1];
objIOleObject.Advise(iAdviseSink.getAddress(), pdwConnection);
objIOleObject.SetHostNames("main", "main");
// Notify the control object that it is embedded in an OLE container
COM.OleSetContainedObject(objIUnknown.getAddress(), true);
// Is OLE object linked or embedded?
ppvObject = new int[1];
if (objIUnknown.QueryInterface(COM.IIDIOleLink, ppvObject) == COM.S_OK) {
IOleLink objIOleLink = new IOleLink(ppvObject[0]);
int[] ppmk = new int[1];
if (objIOleLink.GetSourceMoniker(ppmk) == COM.S_OK) {
IMoniker objIMoniker = new IMoniker(ppmk[0]);
objIMoniker.Release();
type = COM.OLELINKED;
objIOleLink.BindIfRunning();
} else {
isStatic = true;
}
objIOleLink.Release();
}
}
protected int AddRef() {
refCount++;
return refCount;
}
private int CanInPlaceActivate() {
if (aspect == COM.DVASPECT_CONTENT && type == COM.OLEEMBEDDED)
return COM.S_OK;
return COM.S_FALSE;
}
private int ContextSensitiveHelp(int fEnterMode) {
return COM.S_OK;
}
protected void createCOMInterfaces() {
iUnknown = new COMObject(new int[]{2, 0, 0}){
public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
public int method1(int[] args) {return AddRef();}
public int method2(int[] args) {return Release();}
};
iOleClientSite = new COMObject(new int[]{2, 0, 0, 0, 3, 1, 0, 1, 0}){
public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
public int method1(int[] args) {return AddRef();}
public int method2(int[] args) {return Release();}
public int method3(int[] args) {return SaveObject();}
// method4 GetMoniker - not implemented
public int method5(int[] args) {return GetContainer(args[0]);}
public int method6(int[] args) {return ShowObject();}
public int method7(int[] args) {return OnShowWindow(args[0]);}
// method8 RequestNewObjectLayout - not implemented
};
iAdviseSink = new COMObject(new int[]{2, 0, 0, 2, 2, 1, 0, 0}){
public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
public int method1(int[] args) {return AddRef();}
public int method2(int[] args) {return Release();}
public int method3(int[] args) {return OnDataChange(args[0], args[1]);}
public int method4(int[] args) {return OnViewChange(args[0], args[1]);}
//method5 OnRename - not implemented
public int method6(int[] args) {OnSave();return 0;}
public int method7(int[] args) {return OnClose();}
};
iOleInPlaceSite = new COMObject(new int[]{2, 0, 0, 1, 1, 0, 0, 0, 5, 1, 1, 0, 0, 0, 1}){
public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
public int method1(int[] args) {return AddRef();}
public int method2(int[] args) {return Release();}
public int method3(int[] args) {return GetWindow(args[0]);}
public int method4(int[] args) {return ContextSensitiveHelp(args[0]);}
public int method5(int[] args) {return CanInPlaceActivate();}
public int method6(int[] args) {return OnInPlaceActivate();}
public int method7(int[] args) {return OnUIActivate();}
public int method8(int[] args) {return GetWindowContext(args[0], args[1], args[2], args[3], args[4]);}
public int method9(int[] args) {return Scroll(args[0]);}
public int method10(int[] args) {return OnUIDeactivate(args[0]);}
public int method11(int[] args) {return OnInPlaceDeactivate();}
// method12 DiscardUndoState - not implemented
// method13 DeactivateAndUndoChange - not implemented
public int method14(int[] args) {return OnPosRectChange(args[0]);}
};
}
protected IStorage createTempStorage() {
int[] tempStorage = new int[1];
int grfMode = COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_DELETEONRELEASE;
int result = COM.StgCreateDocfile(null, grfMode, 0, tempStorage);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_CANNOT_CREATE_FILE, result);
return new IStorage(tempStorage[0]);
}
/**
* Deactivates an active in-place object and discards the object's undo state.
*/
public void deactivateInPlaceClient() {
if (objIOleInPlaceObject != null) {
objIOleInPlaceObject.InPlaceDeactivate();
}
}
private void deleteTempStorage() {
//Destroy this item's contents in the temp root IStorage.
if (tempStorage != null){
tempStorage.Release();
}
tempStorage = null;
}
protected void disposeCOMInterfaces() {
if (iUnknown != null)
iUnknown.dispose();
iUnknown = null;
if (iOleClientSite != null)
iOleClientSite.dispose();
iOleClientSite = null;
if (iAdviseSink != null)
iAdviseSink.dispose();
iAdviseSink = null;
if (iOleInPlaceSite != null)
iOleInPlaceSite.dispose();
iOleInPlaceSite = null;
}
/**
* Requests that the OLE Document or ActiveX Control perform an action; actions are almost always
* changes to the activation state.
*
* @param verb the operation that is requested. This is one of the OLE.OLEIVERB_ values
*
* @return an HRESULT value indicating the success of the operation request; OLE.S_OK indicates
* success
*/
public int doVerb(int verb) {
// Not all OLE clients (for example PowerPoint) can be set into the running state in the constructor.
// The fix is to ensure that the client is in the running state before invoking any verb on it.
if (state == STATE_NONE) {
if (COM.OleRun(objIUnknown.getAddress()) == OLE.S_OK) state = STATE_RUNNING;
}
if (state == STATE_NONE || isStatic)
return COM.E_FAIL;
// See PR: 1FV9RZW
int result = objIOleObject.DoVerb(verb, null, iOleClientSite.getAddress(), 0, handle, null);
if (state != STATE_RUNNING && inInit) {
updateStorage();
inInit = false;
}
return result;
}
/**
* Asks the OLE Document or ActiveX Control to execute a command from a standard
* list of commands. The OLE Document or ActiveX Control must support the IOleCommandTarget
* interface. The OLE Document or ActiveX Control does not have to support all the commands
* in the standard list. To check if a command is supported, you can call queryStatus with
* the cmdID.
*
* @param cmdID the ID of a command; these are the OLE.OLECMDID_ values - a small set of common
* commands
* @param options the optional flags; these are the OLE.OLECMDEXECOPT_ values
* @param in the argument for the command
* @param out the return value of the command
*
* @return an HRESULT value; OLE.S_OK is returned if successful
*
*/
public int exec(int cmdID, int options, Variant in, Variant out) {
if (objIOleCommandTarget == null) {
int[] address = new int[1];
if (objIUnknown.QueryInterface(COM.IIDIOleCommandTarget, address) != COM.S_OK)
return OLE.ERROR_INTERFACE_NOT_FOUND;
objIOleCommandTarget = new IOleCommandTarget(address[0]);
}
int inAddress = 0;
if (in != null){
inAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
in.getData(inAddress);
}
int outAddress = 0;
if (out != null){
outAddress = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
out.getData(outAddress);
}
int result = objIOleCommandTarget.Exec(null, cmdID, options, inAddress, outAddress);
if (inAddress != 0){
COM.VariantClear(inAddress);
OS.GlobalFree(inAddress);
}
if (outAddress != 0) {
out.setData(outAddress);
COM.VariantClear(outAddress);
OS.GlobalFree(outAddress);
}
return result;
}
IDispatch getAutomationObject() {
int[] ppvObject = new int[1];
if (objIUnknown.QueryInterface(COM.IIDIDispatch, ppvObject) != COM.S_OK)
return null;
return new IDispatch(ppvObject[0]);
}
protected GUID getClassID(String clientName) {
// create a GUID struct to hold the result
GUID guid = new GUID();
// create a null terminated array of char
char[] buffer = null;
if (clientName != null) {
int count = clientName.length();
buffer = new char[count + 1];
clientName.getChars(0, count, buffer, 0);
}
if (COM.CLSIDFromProgID(buffer, guid) != COM.S_OK){
int result = COM.CLSIDFromString(buffer, guid);
if (result != COM.S_OK)
OLE.error(OLE.ERROR_INVALID_CLASSID, result);
}
return guid;
}
private int GetContainer(int ppContainer) {
/* Simple containers that do not support links to their embedded
* objects probably do not need to implement this method. Instead,
* they can return E_NOINTERFACE and set ppContainer to NULL.
*/
if (ppContainer != 0)
COM.MoveMemory(ppContainer, new int[]{0}, 4);
return COM.E_NOINTERFACE;
}
private SIZE getExtent() {
SIZE sizel = new SIZE();
// get the current size of the embedded OLENatives object
if (objIOleObject != null) {
if ( objIViewObject2 != null && !COM.OleIsRunning(objIOleObject.getAddress())) {
objIViewObject2.GetExtent(aspect, -1, null, sizel);
} else {
objIOleObject.GetExtent(aspect, sizel);
}
}
return xFormHimetricToPixels(sizel);
}
public Rectangle getIndent() {
return new Rectangle(indent.left, indent.right, indent.top, indent.bottom);
}
/**
* Returns the program ID of the OLE Document or ActiveX Control.
*
* @return the program ID of the OLE Document or ActiveX Control
*/
public String getProgramID(){
if (appClsid != null){
int[] lplpszProgID = new int[1];
if (COM.ProgIDFromCLSID(appClsid, lplpszProgID) == COM.S_OK) {
int length = OS.GlobalSize(lplpszProgID[0]);
int ptr = OS.GlobalLock(lplpszProgID[0]);
char[] buffer = new char[length];
COM.MoveMemory(buffer, lplpszProgID[0], length);
OS.GlobalUnlock(ptr);
OS.GlobalFree(lplpszProgID[0]);
String result = new String(buffer);
// remove null terminator
int index = result.indexOf("\0");
return result.substring(0, index);
}
}
return null;
}
protected int GetWindow(int phwnd) {
if (phwnd == 0)
return COM.E_INVALIDARG;
if (frame == null) {
COM.MoveMemory(phwnd, new int[] {0}, 4);
return COM.E_NOTIMPL;
}
// Copy the Window's handle into the memory passed in
COM.MoveMemory(phwnd, new int[] {frame.handle}, 4);
return COM.S_OK;
}
private int GetWindowContext(int ppFrame, int ppDoc, int lprcPosRect, int lprcClipRect, int lpFrameInfo) {
if (frame == null || ppFrame == 0)
return COM.E_NOTIMPL;
// fill in frame handle
int iOleInPlaceFrame = frame.getIOleInPlaceFrame();
COM.MoveMemory(ppFrame, new int[] {iOleInPlaceFrame}, 4);
frame.AddRef();
// null out document handle
if (ppDoc != 0) {
COM.MoveMemory(ppDoc, new int[] {0}, 4);
}
// fill in position and clipping info
Rectangle clientArea = this.getClientArea();
Point clientLocation = this.getLocation();
setExtent(clientArea.width - indent.left - indent.right, clientArea.height - indent.top - indent.bottom);
RECT posRect = new RECT();
posRect.left = clientLocation.x + indent.left;
posRect.top = clientLocation.y + indent.top;
posRect.right = clientLocation.x + clientArea.width - indent.right;
posRect.bottom = clientLocation.y + clientArea.height - indent.bottom;
RECT clipRect = new RECT();
Rectangle frameArea = frame.getClientArea();
clipRect.left = frameArea.x;
clipRect.top = frameArea.y;
clipRect.right = frameArea.x + frameArea.width;
clipRect.bottom = frameArea.y + frameArea.height;
if (lprcPosRect != 0) {
OS.MoveMemory(lprcPosRect, posRect, RECT.sizeof);
}
if (lprcClipRect != 0) {
OS.MoveMemory(lprcClipRect, clipRect, RECT.sizeof);
}
// get frame info
OLEINPLACEFRAMEINFO frameInfo = new OLEINPLACEFRAMEINFO();
frameInfo.cb = OLEINPLACEFRAMEINFO.sizeof;
frameInfo.fMDIApp = 0;
frameInfo.hwndFrame = frame.handle;
Shell shell = getShell();
Menu menubar = shell.getMenuBar();
if (menubar != null && !menubar.isDisposed()) {
int hwnd = shell.handle;
int cAccel = OS.SendMessage(hwnd, OS.WM_APP, 0, 0);
if (cAccel != 0) {
int hAccel = OS.SendMessage(hwnd, OS.WM_APP+1, 0, 0);
if (hAccel != 0) {
frameInfo.cAccelEntries = cAccel;
frameInfo.haccel = hAccel;
}
}
}
COM.MoveMemory(lpFrameInfo, frameInfo, OLEINPLACEFRAMEINFO.sizeof);
return COM.S_OK;
}
public boolean isDirty() {
/*
* Note: this method must return true unless it is absolutely clear that the
* contents of the Ole Document do not differ from the contents in the file
* on the file system.
*/
// Get access to the persistant storage mechanism
int[] address = new int[1];
if (objIOleObject.QueryInterface(COM.IIDIPersistFile, address) != COM.S_OK)
return true;
IPersistStorage permStorage = new IPersistStorage(address[0]);
// Are the contents of the permanent storage different from the file?
int result = permStorage.IsDirty();
permStorage.Release();
if (result == COM.S_FALSE) return false;
return true;
}
public boolean isFocusControl () {
checkWidget ();
int focusHwnd = OS.GetFocus();
if (objIOleInPlaceObject == null) return (handle == focusHwnd);
int[] phwnd = new int[1];
objIOleInPlaceObject.GetWindow(phwnd);
while (focusHwnd != 0) {
if (phwnd[0] == focusHwnd) return true;
focusHwnd = OS.GetParent(focusHwnd);
}
return false;
}
private int OnClose() {
return COM.S_OK;
}
private int OnDataChange(int pFormatetc, int pStgmed) {
return COM.S_OK;
}
private void onDispose(Event e) {
inDispose = true;
doVerb(OLE.OLEIVERB_DISCARDUNDOSTATE);
deactivateInPlaceClient();
releaseObjectInterfaces(); // Note, must release object interfaces before releasing frame
deleteTempStorage();
// remove listeners
removeListener(SWT.Dispose, listener);
removeListener(SWT.FocusIn, listener);
removeListener(SWT.Paint, listener);
removeListener(SWT.Traverse, listener);
removeListener(SWT.KeyDown, listener);
frame.removeListener(SWT.Resize, listener);
frame.removeListener(SWT.Move, listener);
frame.Release();
frame = null;
}
void onFocusIn(Event e) {
if (inDispose) return;
if (state != STATE_UIACTIVE) doVerb(OLE.OLEIVERB_SHOW);
if (objIOleInPlaceObject == null) return;
if (isFocusControl()) return;
int[] phwnd = new int[1];
objIOleInPlaceObject.GetWindow(phwnd);
if (phwnd[0] == 0) return;
OS.SetFocus(phwnd[0]);
}
void onFocusOut(Event e) {
}
private int OnInPlaceActivate() {
state = STATE_INPLACEACTIVE;
frame.setCurrentDocument(this);
if (objIOleObject == null)
return COM.S_OK;
int[] ppvObject = new int[1];
if (objIOleObject.QueryInterface(COM.IIDIOleInPlaceObject, ppvObject) == COM.S_OK) {
objIOleInPlaceObject = new IOleInPlaceObject(ppvObject[0]);
}
return COM.S_OK;
}
private int OnInPlaceDeactivate() {
if (objIOleInPlaceObject != null) objIOleInPlaceObject.Release();
objIOleInPlaceObject = null;
state = STATE_RUNNING;
redraw();
if (getDisplay().getFocusControl() == null) {
getShell().traverse(SWT.TRAVERSE_TAB_NEXT);
}
return COM.S_OK;
}
private int OnPosRectChange(int lprcPosRect) {
// Not resetting object rects because this causes Word to loose its scrollbars
//setObjectRects();
return COM.S_OK;
}
private void onPaint(Event e) {
if (state == STATE_RUNNING || state == STATE_INPLACEACTIVE) {
SIZE size = getExtent();
Rectangle area = getClientArea();
RECT rect = new RECT();
if (getProgramID().startsWith("Excel.Sheet")) {
rect.left = area.x; rect.right = area.x + (area.height * size.cx / size.cy);
rect.top = area.y; rect.bottom = area.y + area.height;
} else {
rect.left = area.x; rect.right = area.x + size.cx;
rect.top = area.y; rect.bottom = area.y + size.cy;
}
int pArea = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, RECT.sizeof);
OS.MoveMemory(pArea, rect, RECT.sizeof);
COM.OleDraw(objIUnknown.getAddress(), aspect, e.gc.handle, pArea);
OS.GlobalFree(pArea);
}
}
private void onResize(Event e) {
Rectangle area = frame.getClientArea();
setBounds(borderWidths.left,
borderWidths.top,
area.width - borderWidths.left - borderWidths.right,
area.height - borderWidths.top - borderWidths.bottom);
setObjectRects();
}
private void OnSave() {
}
private int OnShowWindow(int fShow) {
return COM.S_OK;
}
private int OnUIActivate() {
state = STATE_UIACTIVE;
int[] phwnd = new int[1];
if (objIOleInPlaceObject.GetWindow(phwnd) == COM.S_OK) {
OS.SetWindowPos(phwnd[0], OS.HWND_TOP, 0, 0, 0, 0, OS.SWP_NOSIZE | OS.SWP_NOMOVE);
}
return COM.S_OK;
}
private int OnUIDeactivate(int fUndoable) {
// currently, we are ignoring the fUndoable flag
if (frame == null || frame.isDisposed()) return COM.S_OK;
state = STATE_INPLACEACTIVE;
frame.SetActiveObject(0,0);
redraw();
if (getDisplay().getFocusControl() == frame) {
getShell().traverse(SWT.TRAVERSE_TAB_NEXT);
}
Shell shell = getShell();
Menu menubar = shell.getMenuBar();
if (menubar == null || menubar.isDisposed())
return COM.S_OK;
int shellHandle = shell.handle;
OS.SetMenu(shellHandle, menubar.handle);
return COM.OleSetMenuDescriptor(0, shellHandle, 0, 0, 0);
}
private void onTraverse(Event event) {
switch (event.detail) {
case SWT.TRAVERSE_ESCAPE:
case SWT.TRAVERSE_RETURN:
case SWT.TRAVERSE_TAB_NEXT:
case SWT.TRAVERSE_TAB_PREVIOUS:
case SWT.TRAVERSE_PAGE_NEXT:
case SWT.TRAVERSE_PAGE_PREVIOUS:
case SWT.TRAVERSE_MNEMONIC:
event.doit = true;
break;
}
}
private int OnViewChange(int dwAspect, int lindex) {
return COM.S_OK;
}
private IStorage openStorage(IStorage storage, String name) {
int mode = COM.STGM_TRANSACTED | COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE;
int[] ppStg = new int[1];
if (storage.OpenStorage(name, 0, mode, null, 0, ppStg) != COM.S_OK) {
// IStorage does not exist, so create one
mode = mode | COM.STGM_CREATE;
if (storage.CreateStorage(name, mode, 0, 0, ppStg) != COM.S_OK)
return null;
}
return new IStorage(ppStg[0]);
}
protected int QueryInterface(int riid, int ppvObject) {
if (riid == 0 || ppvObject == 0)
return COM.E_NOINTERFACE;
GUID guid = new GUID();
COM.MoveMemory(guid, riid, GUID.sizeof);
if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
AddRef();
return COM.S_OK;
}
if (COM.IsEqualGUID(guid, COM.IIDIAdviseSink)) {
COM.MoveMemory(ppvObject, new int[] {iAdviseSink.getAddress()}, 4);
AddRef();
return COM.S_OK;
}
if (COM.IsEqualGUID(guid, COM.IIDIOleClientSite)) {
COM.MoveMemory(ppvObject, new int[] {iOleClientSite.getAddress()}, 4);
AddRef();
return COM.S_OK;
}
if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceSite)) {
COM.MoveMemory(ppvObject, new int[] {iOleInPlaceSite.getAddress()}, 4);
AddRef();
return COM.S_OK;
}
COM.MoveMemory(ppvObject, new int[] {0}, 4);
return COM.E_NOINTERFACE;
}
/**
* Returns the status of the specified command. The status is any bitwise OR'd combination of
* SWTOLE.OLECMDF_SUPPORTED, SWTOLE.OLECMDF_ENABLED, SWTOLE.OLECMDF_LATCHED, SWTOLE.OLECMDF_NINCHED.
* You can query the status of a command before invoking it with OleClientSite.exec. The
* OLE Document or ActiveX Control must support the IOleCommandTarget to make use of this method.
*
* @param cmd the ID of a command; these are the OLE.OLECMDID_ values - a small set of common
* commands
*
* @return the status of the specified command or 0 if unable to query the OLE Object; these are the
* OLE.OLECMDF_ values
*/
public int queryStatus(int cmd) {
if (objIOleCommandTarget == null) {
int[] address = new int[1];
if (objIUnknown.QueryInterface(COM.IIDIOleCommandTarget, address) != COM.S_OK)
return 0;
objIOleCommandTarget = new IOleCommandTarget(address[0]);
}
OLECMD olecmd = new OLECMD();
olecmd.cmdID = cmd;
int result = objIOleCommandTarget.QueryStatus(null, 1, olecmd, null);
if (result != COM.S_OK) return 0;
return olecmd.cmdf;
}
protected int Release() {
refCount--;
if (refCount == 0) {
disposeCOMInterfaces();
}
return refCount;
}
protected void releaseObjectInterfaces() {
if (objIOleInPlaceObject!= null)
objIOleInPlaceObject.Release();
objIOleInPlaceObject = null;
if (objIOleObject != null) {
objIOleObject.Close(COM.OLECLOSE_NOSAVE);
objIOleObject.Release();
}
objIOleObject = null;
if (objIViewObject2 != null) {
objIViewObject2.SetAdvise(aspect, 0, 0);
objIViewObject2.Release();
}
objIViewObject2 = null;
if (objIOleCommandTarget != null)
objIOleCommandTarget.Release();
objIOleCommandTarget = null;
if (objIUnknown != null){
objIUnknown.Release();
}
objIUnknown = null;
COM.CoFreeUnusedLibraries();
}
public boolean save(File file, boolean includeOleInfo) {
if (includeOleInfo)
return saveToStorageFile(file);
return saveToTraditionalFile(file);
}
private boolean saveFromContents(int address, File file) {
boolean success = false;
IStream tempContents = new IStream(address);
tempContents.AddRef();
try {
FileOutputStream writer = new FileOutputStream(file);
int increment = 1024 * 4;
int pv = COM.CoTaskMemAlloc(increment);
int[] pcbWritten = new int[1];
while (tempContents.Read(pv, increment, pcbWritten) == COM.S_OK && pcbWritten[0] > 0) {
byte[] buffer = new byte[ pcbWritten[0]];
OS.MoveMemory(buffer, pv, pcbWritten[0]);
writer.write(buffer); // Note: if file does not exist, this will create the file the
// first time it is called
success = true;
}
COM.CoTaskMemFree(pv);
writer.close();
} catch (IOException err) {
}
tempContents.Release();
return success;
}
private boolean saveFromOle10Native(int address, File file) {
boolean success = false;
IStream tempContents = new IStream(address);
tempContents.AddRef();
// The "\1Ole10Native" stream contains a DWORD header whose value is the length
// of the native data that follows.
int pv = COM.CoTaskMemAlloc(4);
int[] size = new int[1];
int rc = tempContents.Read(pv, 4, null);
OS.MoveMemory(size, pv, 4);
COM.CoTaskMemFree(pv);
if (rc == COM.S_OK && size[0] > 0) {
// Read the data
byte[] buffer = new byte[size[0]];
pv = COM.CoTaskMemAlloc(size[0]);
rc = tempContents.Read(pv, size[0], null);
OS.MoveMemory(buffer, pv, size[0]);
COM.CoTaskMemFree(pv);
// open the file and write data into it
try {
FileOutputStream writer = new FileOutputStream(file);
writer.write(buffer); // Note: if file does not exist, this will create the file
writer.close();
success = true;
} catch (IOException err) {
}
}
tempContents.Release();
return success;
}
private int SaveObject() {
updateStorage();
return COM.S_OK;
}
/**
* Saves the document to the specified file and includes OLE spcific inforrmation. This method
* must <b>only</b> be used for files that have an OLE Storage format. For example, a word file
* edited with Word.Document should be saved using this method because there is formating information
* that should be stored in the OLE specific Storage format.
*
* @param file the file to which the changes are to be saved
*
* @return true if the save was successful
*/
private boolean saveToStorageFile(File file) {
// Note: if the file already exists, some applications will not overwrite the file
// In these cases, you should delete the file first (probably save the contents of the file in case the
// save fails)
if (file == null || file.isDirectory())
return false;
if (!updateStorage())
return false;
// get access to the persistant storage mechanism
int[] address = new int[1];
if (objIOleObject.QueryInterface(COM.IIDIPersistStorage, address) != COM.S_OK)
return false;
IPersistStorage permStorage = new IPersistStorage(address[0]);
// The file will be saved using the formating of the current application - this
// may not be the format of the application that was originally used to create the file
// e.g. if an Excel file is opened in Word, the Word application will save the file in the
// Word format
boolean success = false;
OleFile oleFile = new OleFile(file, null, OleFile.WRITE);
IStorage storage = oleFile.getRootStorage();
storage.AddRef();
if (COM.OleSave(permStorage.getAddress(), storage.getAddress(), false) == COM.S_OK) {
if (storage.Commit(COM.STGC_DEFAULT) == COM.S_OK)
success = true;
}
storage.Release();
oleFile.dispose();
permStorage.Release();
return success;
}
/**
* Saves the document to the specified file. This method must be used for
* files that do not have an OLE Storage format. For example, a bitmap file edited with MSPaint
* should be saved using this method because bitmap is a standard format that does not include any
* OLE specific data.
*
* @param file the file to which the changes are to be saved
*
* @return true if the save was successful
*/
private boolean saveToTraditionalFile(File file) {
// Note: if the file already exists, some applications will not overwrite the file
// In these cases, you should delete the file first (probably save the contents of the file in case the
// save fails)
if (file == null || file.isDirectory())
return false;
if (!updateStorage())
return false;
int[] address = new int[1];
// Look for a CONTENTS stream
if (tempStorage.OpenStream("CONTENTS", 0, COM.STGM_DIRECT | COM.STGM_READ | COM.STGM_SHARE_EXCLUSIVE, 0, address) == COM.S_OK)
return saveFromContents(address[0], file);
// Look for Ole 1.0 object stream
if (tempStorage.OpenStream("\1Ole10Native", 0, COM.STGM_DIRECT | COM.STGM_READ | COM.STGM_SHARE_EXCLUSIVE, 0, address) == COM.S_OK)
return saveFromOle10Native(address[0], file);
return false;
}
private int Scroll(int scrollExtant) {
return COM.S_OK;
}
void setBorderSpace(RECT newBorderwidth) {
borderWidths = newBorderwidth;
// readjust size and location of client site
Rectangle area = frame.getClientArea();
setBounds(borderWidths.left, borderWidths.top,
area.width - borderWidths.left - borderWidths.right,
area.height - borderWidths.top - borderWidths.bottom);
setObjectRects();
}
private void setExtent(int width, int height){
// Resize the width and height of the embedded/linked OLENatives object
// to the specified values.
if (objIOleObject == null || isStatic) return;
if (inUpdate) return;
SIZE currentExtent = getExtent();
if (width == currentExtent.cx && height == currentExtent.cy) return;
SIZE newExtent = new SIZE();
newExtent.cx = width; newExtent.cy = height;
newExtent = xFormPixelsToHimetric(newExtent);
// Get the server running first, then do a SetExtent, then show it
boolean alreadyRunning = COM.OleIsRunning(objIOleObject.getAddress());
if (!alreadyRunning)
COM.OleRun(objIOleObject.getAddress());
if (objIOleObject.SetExtent(aspect, newExtent) == COM.S_OK){
inUpdate = true;
objIOleObject.Update();
inUpdate = false;
if (!alreadyRunning)
// Close server if it wasn't already running upon entering this method.
objIOleObject.Close(COM.OLECLOSE_SAVEIFDIRTY);
}
}
public void setIndent(Rectangle newIndent) {
indent = new RECT();
indent.left = newIndent.x;
indent.right = newIndent.width;
indent.top = newIndent.y;
indent.bottom = newIndent.height;
}
private void setObjectRects() {
if (objIOleInPlaceObject == null) return;
// size the object to fill the available space
// leave a border
Rectangle clientArea = this.getClientArea();
Point clientLocation = this.getLocation();
setExtent(clientArea.width - indent.left - indent.right, clientArea.height - indent.top - indent.bottom);
RECT posRect = new RECT();
posRect.left = clientLocation.x + indent.left;
posRect.top = clientLocation.y + indent.top;
posRect.right = clientLocation.x + clientArea.width - indent.right;
posRect.bottom = clientLocation.y + clientArea.height - indent.bottom;
RECT clipRect = new RECT();
Rectangle frameArea = frame.getClientArea();
clipRect.left = frameArea.x;
clipRect.top = frameArea.y;
clipRect.right = frameArea.x + frameArea.width;
clipRect.bottom = frameArea.y + frameArea.height;
objIOleInPlaceObject.SetObjectRects(posRect, clipRect);
}
private int ShowObject() {
/* Tells the container to position the object so it is visible to
* the user. This method ensures that the container itself is
* visible and not minimized.
*/
return COM.S_OK;
}
/**
* Displays a dialog with the property information for this OLE Object. The OLE Document or
* ActiveX Control must support the ISpecifyPropertyPages interface.
*
* @param title the name that will appear in the titlebar of the dialog
*/
public void showProperties(String title) {
// Get the Property Page information from the OLE Object
int[] ppvObject = new int[1];
if (objIUnknown.QueryInterface(COM.IIDISpecifyPropertyPages, ppvObject) != COM.S_OK) return;
ISpecifyPropertyPages objISPP = new ISpecifyPropertyPages(ppvObject[0]);
CAUUID caGUID = new CAUUID();
int result = objISPP.GetPages(caGUID);
objISPP.Release();
if (result != COM.S_OK) return;
// create a frame in which to display the pages
char[] chTitle = null;
if (title != null) {
chTitle = new char[title.length()];
title.getChars(0, title.length(), chTitle, 0);
}
result = COM.OleCreatePropertyFrame(frame.handle, 10, 10, chTitle, 1, new int[] {objIUnknown.getAddress()}, caGUID.cElems, caGUID.pElems, COM.LOCALE_USER_DEFAULT, 0, 0);
// free the property page information
COM.CoTaskMemFree(caGUID.pElems);
}
private boolean updateStorage() {
if (tempStorage == null) return false;
int[] ppv = new int[1];
if (objIUnknown.QueryInterface(COM.IIDIPersistStorage, ppv) != COM.S_OK) return false;
IPersistStorage iPersistStorage = new IPersistStorage(ppv[0]);
int result = COM.OleSave(iPersistStorage.getAddress(), tempStorage.getAddress(), true);
if (result != COM.S_OK){
// OleSave will fail for static objects, so do what OleSave does.
COM.WriteClassStg(tempStorage.getAddress(), objClsid);
result = iPersistStorage.Save(tempStorage.getAddress(), true);
}
tempStorage.Commit(COM.STGC_DEFAULT);
result = iPersistStorage.SaveCompleted(0);
iPersistStorage.Release();
return true;
}
private SIZE xFormHimetricToPixels(SIZE aSize) {
// Return a new Size which is the pixel transformation of a
// size in HIMETRIC units.
int hDC = OS.GetDC(0);
int xppi = OS.GetDeviceCaps(hDC, 88); // logical pixels/inch in x
int yppi = OS.GetDeviceCaps(hDC, 90); // logical pixels/inch in y
OS.ReleaseDC(0, hDC);
int cx = Compatibility.round(aSize.cx * xppi, 2540); // 2540 HIMETRIC units per inch
int cy = Compatibility.round(aSize.cy * yppi, 2540);
SIZE size = new SIZE();
size.cx = cx;
size.cy = cy;
return size;
}
private SIZE xFormPixelsToHimetric(SIZE aSize) {
// Return a new size which is the HIMETRIC transformation of a
// size in pixel units.
int hDC = OS.GetDC(0);
int xppi = OS.GetDeviceCaps(hDC, 88); // logical pixels/inch in x
int yppi = OS.GetDeviceCaps(hDC, 90); // logical pixels/inch in y
OS.ReleaseDC(0, hDC);
int cx = Compatibility.round(aSize.cx * 2540, xppi); // 2540 HIMETRIC units per inch
int cy = Compatibility.round(aSize.cy * 2540, yppi);
SIZE size = new SIZE();
size.cx = cx;
size.cy = cy;
return size;
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
6427a21c57148a89ac15c77fffc2e3f9f28014e6 | f9098c154a8c3fbf7280f76cac861050ac5905e9 | /src/com/pmp/pet/vo/PetType.java | c186bd6f29dc5711b0055118fca5625e2416cc3b | [] | no_license | kang3856/petground | 2e1714b6377994bc691bcb597ba21e7b01030f6e | ff5d2b46c51e657616242c8de6539cd793fb311d | refs/heads/master | 2020-05-01T11:16:10.533573 | 2019-03-24T16:13:54 | 2019-03-24T16:13:54 | 177,433,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package com.pmp.pet.vo;
public class PetType {
public PetType() {
// TODO Auto-generated constructor stub
}
public int getKindNo() {
return kindNo;
}
public void setKindNo(int kindNo) {
this.kindNo = kindNo;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getPetType() {
return petType;
}
public void setPetType(String petType) {
this.petType = petType;
}
private int kindNo;
private String kind , petType;
}
| [
"멍멍야옹@DESKTOP-7CI9KAE"
] | 멍멍야옹@DESKTOP-7CI9KAE |
8c777ad893a97a0c90774ce4b7ed3204337f6456 | 3673b3c69b282a97d98e6a2e20c8b26b9bff7ccf | /algorithms/src/main/java/cn/jokang/misc/InetAddressTest.java | 3250fb1f193c1aee6a5e8c8104c71958b75227a0 | [] | no_license | jokang/JobProjects | f1e86c76f8c0e207bddb4881233e8b2fbdc0586f | 7f6db0398e82044bcba1750aaaa7275b9313a0d5 | refs/heads/master | 2020-03-25T00:09:55.602492 | 2018-10-26T01:46:48 | 2018-10-26T01:46:48 | 143,172,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package cn.jokang.misc;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class InetAddressTest {
public static void main(String[] args) throws UnknownHostException {
InetAddress local = InetAddress.getLocalHost();
System.out.println(local);
// 在配置了hostname,但没有配置相应域名解析的机器上,因为需要域名解析,下面的语句会很慢。
System.out.println(local.getCanonicalHostName());
System.out.println(local.getHostAddress());
}
}
| [
"zhoukang123"
] | zhoukang123 |
6d5fe735a5fd41c5819834fd0fe2ebd16bc8aadc | e20535d6ff701613190499780bd2d5c1eee201f8 | /movie/moviedemo/nosqldb/bigdatademo/dataparser/src/oracle/demo/oow/bd/to/CastMovieTO.java | e779ac62c9b4de22672a64826a91002362389db2 | [
"MIT"
] | permissive | oracle/big-data-lite | f89db675826a7933b1888eeb0d55afe01550f068 | bdf166f4a9f8db4c565aa1294f099a6b6c264637 | refs/heads/master | 2023-08-21T18:12:52.988682 | 2018-03-14T13:53:35 | 2018-03-14T13:53:35 | 41,071,590 | 30 | 30 | MIT | 2017-11-30T20:48:39 | 2015-08-20T02:43:32 | Java | UTF-8 | Java | false | false | 2,649 | java | package oracle.demo.oow.bd.to;
import java.io.IOException;
import org.codehaus.jackson.node.ObjectNode;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.JsonNodeFactory;
import oracle.demo.oow.bd.constant.JsonConstant;
public class CastMovieTO extends BaseTO{
private int id;
private int order;
private String character;
private String jsonTxt = null;
/** For SerDe purpose JSON object is used to write data into json text and
* from json text to CastTO **/
private ObjectNode castMovieNode = null;
public CastMovieTO() {
super();
}
public CastMovieTO(ObjectNode castMovieNode) {
super();
this.setJsonObject(castMovieNode);
}
public CastMovieTO(String jsonTxt) {
super();
try {
castMovieNode = super.parseJson(jsonTxt);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
this.setJsonObject(castMovieNode);
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setOrder(int order) {
this.order = order;
}
public int getOrder() {
return order;
}
public void setCharacter(String character) {
this.character = character;
}
public String getCharacter() {
return character;
}
public void setJsonTxt(String jsonTxt) {
this.jsonTxt = jsonTxt;
}
public String getJsonTxt() {
return this.getJsonObject().toString();
}
public void setJsonObject(ObjectNode castMovieNode) {
this.castMovieNode = castMovieNode;
int id = castMovieNode.get(JsonConstant.ID).getIntValue();
int order = castMovieNode.get(JsonConstant.ORDER).getIntValue();
String character = castMovieNode.get(JsonConstant.CHARACTER).getTextValue();
this.setCharacter(character);
this.setId(id);
this.setOrder(order);
}
public ObjectNode getJsonObject() {
ObjectNode castMovieJson = super.getObjectNode();
castMovieJson.put(JsonConstant.ID, this.getId());
castMovieJson.put(JsonConstant.ORDER, this.getOrder());
castMovieJson.put(JsonConstant.CHARACTER, this.getCharacter());
return castMovieJson;
}
@Override
public String toJsonString() {
// TODO Implement this method
return getJsonTxt();
}
}
| [
"oracle@bigdatalite.localdomain"
] | oracle@bigdatalite.localdomain |
a617dd23cdbfcfd00d55bc64cfe5bdff05f23923 | a0559cedaa31fce87999197f81c84479f45f0b41 | /src/main/java/ppi/sensors/benchmark/cli/impl/TriangleMeshGeneratorImpl.java | e236b02b4c861d6cb9ed42e9fc90a721f7081b15 | [] | no_license | moccaplusplus/benchmark-cli | c1e46c02466e823cd8c1dc9246db1b555e4209b4 | 918ab6cd44b271f9194f0199a84f7b31f2f7a7ab | refs/heads/main | 2023-06-01T14:48:44.471113 | 2021-06-17T08:21:57 | 2021-06-17T08:21:57 | 373,268,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | package ppi.sensors.benchmark.cli.impl;
import ppi.sensors.benchmark.cli.PointMeshGenerator;
import ppi.sensors.benchmark.cli.model.Point;
import ppi.sensors.benchmark.cli.util.ServiceName;
import java.util.ArrayList;
import java.util.List;
/**
* Generator siatki punktów opartej na trójkątach równobocznych.
*/
@ServiceName("triangle")
public class TriangleMeshGeneratorImpl implements PointMeshGenerator {
/**
* Zwraca listę punktów tworzących siatkę opartą na trójkątach równobocznych.
*
* @param distance odległość pomiędzy node'ami siatki - długość boku trójkata równobocznego.
* @param sideLength długość boku kwadratowego obszaru, w którym znajdują się punkty.
* @return lista punktów tworzących siatkę.
*/
@Override
public List<Point> createMesh(double distance, int sideLength) {
final var result = new ArrayList<Point>();
final var h = distance * Math.sqrt(3) / 2;
var odd = false;
for (var y = 0.0; y <= sideLength; y += h, odd = !odd)
for (var x = odd ? distance / 2.0 : 0.0; x <= sideLength; x += distance)
result.add(new Point(x, y));
return result;
}
}
| [
"tomaszgawel@op.pl"
] | tomaszgawel@op.pl |
c16b4740ad15aac801972b658f269357dfa48d9f | f5f93253c9c72761c0fa68c6f8a265f8cd7ca286 | /src/main/java/JavaDemo2/StaticClassDemo.java | 65e59f9090950034f5fb601e063a253cead64e5d | [] | no_license | sujoymandal/JavaSampleProgram | 8f4dbe1fd71736cdf77275593694f769c38c645d | eeb903cfc2c7c2935d5cffda3f89b49c0702a50a | refs/heads/master | 2020-04-19T05:06:10.592838 | 2019-01-28T14:41:36 | 2019-01-28T14:41:36 | 167,978,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 626 | java | package JavaDemo2;
class CarParts{
public static String name="static variable of enclosed class..";
String name2="non static variable of enclosed class..";
static class Wheel{
Wheel(){
System.out.println("Wheel class object created..");
}
public void accessingStaticVariable(){
System.out.println(name);
}
}
CarParts(){
System.out.println("CraParts Class object created..");
}
}
public class StaticClassDemo {
public static void main(String[] args) {
CarParts car=new CarParts();
CarParts.Wheel wheel=new CarParts.Wheel();
wheel.accessingStaticVariable();
}
}
| [
"SujoyM@rssoftware.com"
] | SujoyM@rssoftware.com |
62932a5a261ab9be1fd652ac307d4d8a4e3f75ea | 7e6753e780133cb0bd43ffd2923f03071f456f52 | /src/main/java/com/test/zooplautilities/Listners.java | 7aa7cd0ed4237396796a3500746841c89673d4c5 | [] | no_license | adilakshmi91/Zoopla | 2731f82e798c670028a93ba771d22caae550fda5 | dac93b4b0069f18b5e4fbdf836f8090bbfdf1676 | refs/heads/master | 2023-01-31T03:14:23.939144 | 2020-12-18T17:08:59 | 2020-12-18T17:08:59 | 322,656,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,409 | java | package com.test.zooplautilities;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
public class Listners implements ITestListener {
public static ExtentTest extentTest;
public static ExtentReports extent = zooplabrowser.createReports();
public void onTestStart(ITestResult result) {
System.out.println("Test started- " + result.getName());
extentTest = extent.startTest(result.getName());
}
public void onTestSuccess(ITestResult result) {
System.out.println("Test completed successfully- " + result.getName());
extentTest.log(LogStatus.PASS, "Test success");
}
public void onTestFailure(ITestResult result) {
System.out.println("Test Failed- " + result.getName());
extentTest.log(LogStatus.FAIL, "Test Failure");
}
public void onTestSkipped(ITestResult result) {
System.out.println("Test Skipped- " + result.getName());
}
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
}
public void onStart(ITestContext context) {
System.out.println("Started- " + context.getName());
}
public void onFinish(ITestContext context) {
System.out.println("Finished- " + context.getName());
extent.flush();
}
}
| [
"adilakshmi64@gmail.com"
] | adilakshmi64@gmail.com |
c2e88ff70ae8f83578f9a347fb68974fac60bbfc | 252e30311d3c5bf04f7945332a84d37655cb0642 | /app/src/main/java/com/Trichain/chatapp/utils/FirebaseMessagingService.java | 4560f3135999327db78779c086fd3440a51e189b | [
"Apache-2.0"
] | permissive | yoosinpaddy/ChatApp-master | d1e61fd4f3a5eb22d38c281d754eccb8746af49d | 056e8bccd147960658a2018d7eb0aa558c163929 | refs/heads/master | 2022-12-27T19:55:26.121282 | 2020-10-08T10:14:09 | 2020-10-08T10:14:09 | 302,302,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,975 | java | package com.Trichain.chatapp.utils;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import com.Trichain.chatapp.R;
import com.Trichain.chatapp.activities.ChatActivity;
import com.google.firebase.messaging.RemoteMessage;
/**
* This is a part of ChatApp Project (https://github.com/h01d/ChatApp)
* Licensed under Apache License 2.0
*
* @author Raf (https://github.com/h01d)
* @version 1.1
* @since 27/02/2018
*/
public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService
{
@Override
public void onMessageReceived(RemoteMessage remoteMessage)
{
super.onMessageReceived(remoteMessage);
// Notification data
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if(Build.VERSION.SDK_INT >= 26)
{
// API 26+ is required to provide a channel Id
NotificationChannel notificationChannel = new NotificationChannel(getString(R.string.default_notification_channel_id), "My Notifications", NotificationManager.IMPORTANCE_HIGH);
notificationChannel.setDescription("Channel description");
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Notification.DEFAULT_LIGHTS);
notificationChannel.setVibrationPattern(new long[]{0, 100, 100, 100, 100, 100});
notificationChannel.enableVibration(true);
notificationManager.createNotificationChannel(notificationChannel);
}
String notificationTitle = remoteMessage.getData().get("title");
String notificationMessage = remoteMessage.getData().get("body");
String notificationAction = remoteMessage.getData().get("click_action");
String notificationFrom = remoteMessage.getData().get("from_user_id");
if(notificationTitle.equals("You have a new Message"))
{
// If it's a message notification
// Checking if ChatActivity is not open or if its, it should have a different userId from current
if(!ChatActivity.running || ChatActivity.running && !ChatActivity.otherUserId.equals(notificationFrom))
{
// Creating the notification
NotificationCompat.Builder notification = new NotificationCompat.Builder(this, getString(R.string.default_notification_channel_id))
.setContentTitle(notificationTitle)
.setContentText(notificationMessage)
.setSmallIcon(R.drawable.logo)
.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.mipmap.ic_launcher_round))
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
Intent intent = new Intent(notificationAction);
intent.putExtra("userid", notificationFrom);
// Extract a unique notification from sender userId so we can have only 1 notification per user
int notificationId = Integer.parseInt(notificationFrom.replaceAll("[^0-9]", ""));
PendingIntent pendingIntent = PendingIntent.getActivity(this, notificationId % 65535, intent, PendingIntent.FLAG_ONE_SHOT);
notification.setContentIntent(pendingIntent);
// Pushing notification to device
notificationManager.notify(notificationId % 65535, notification.build());
}
}
else if(notificationTitle.equals("You have a Friend Request"))
{
// If it's friend request notification
// Creating the notification
NotificationCompat.Builder notification = new NotificationCompat.Builder(this, getString(R.string.default_notification_channel_id))
.setContentTitle(notificationTitle)
.setContentText(notificationMessage)
.setSmallIcon(R.drawable.ic_person_add_white_24dp)
.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.mipmap.ic_launcher_round))
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
Intent intent = new Intent(notificationAction);
intent.putExtra("userid", notificationFrom);
// Extract a unique notification from sender userId so we can have only 1 notification per user
int notificationId = Integer.parseInt(notificationFrom.replaceAll("[^0-9]", ""));
// Adding +1 to notification Id se we can have a Friend Request and a Message Notification at the same time
PendingIntent pendingIntent = PendingIntent.getActivity(this, notificationId + 1 % 65535, intent, PendingIntent.FLAG_ONE_SHOT);
notification.setContentIntent(pendingIntent);
// Pushing notification to device
notificationManager.notify(notificationId + 1 % 65535, notification.build());
}
else if(notificationTitle.equals("You have a new friend"))
{
// If it's a new friend
// Creating the notification
NotificationCompat.Builder notification = new NotificationCompat.Builder(this, getString(R.string.default_notification_channel_id))
.setContentTitle(notificationTitle)
.setContentText(notificationMessage)
.setSmallIcon(R.drawable.ic_person_add_white_24dp)
.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.mipmap.ic_launcher_round))
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
Intent intent = new Intent(notificationAction);
intent.putExtra("userid", notificationFrom);
// Extract a unique notification from sender userId so we can have only 1 notification per user
int notificationId = Integer.parseInt(notificationFrom.replaceAll("[^0-9]", ""));
// Adding +2 to notification Id se we can have a all notifications at the same time
PendingIntent pendingIntent = PendingIntent.getActivity(this, notificationId + 2 % 65535, intent, PendingIntent.FLAG_ONE_SHOT);
notification.setContentIntent(pendingIntent);
// Pushing notification to device
notificationManager.notify(notificationId + 2 % 65535, notification.build());
}
}
}
| [
"yoosinfrancis@gmail.com"
] | yoosinfrancis@gmail.com |
24f88b0e1e02211f35b328010f36c45d69cc8b37 | 38245f9ee3cf15cb8b6244c00525a1e11ae34df4 | /spring-basics/04-annotation-config/src/main/java/org/example/domain/wiring/case2nd/Booking.java | 0f63be1d3918e5bfbb3b27ce4766b5d9a1fe2901 | [] | no_license | fainbogdan/core-spring-workshop | 7baf30a592c649b847f353f74a8fcb237f2b01f0 | 24b34c5a5398b051b77631a0b2a44522a723ca28 | refs/heads/master | 2021-12-14T02:23:29.529495 | 2014-05-27T13:12:43 | 2014-05-27T13:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,093 | java | package org.example.domain.wiring.case2nd;
import org.example.domain.BookingDate;
import org.example.domain.Person;
import org.example.domain.Room;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
/**
* User: bakka
* Date: 31.03.14
*/
public class Booking {
private Person person;
private Room room;
private BookingDate bookingDate;
@Autowired
public Booking(Person person, Room room, @Qualifier("jodaTimeStub") BookingDate bookingDate) {
this.person = person;
this.room = room;
this.bookingDate = bookingDate;
}
public Person getPerson() {
return person;
}
public Room getRoom() {
return room;
}
public BookingDate getBookingDate() {
return bookingDate;
}
@Override
public String toString() {
return "Booking{" +
"person=" + person +
", room=" + room +
", bookingDate='" + bookingDate.getFormattedDate() + '\'' +
'}';
}
}
| [
"kacper.bak@pentasys.de"
] | kacper.bak@pentasys.de |
ceb8264fc2fd8a8fb9d51a31cd8a1ad5855a7340 | 42fe529efc2a385c41e4ed18299a1dba590898be | /pullable/src/main/java/com/yz/pullable/HeaderStateHelper.java | 2d51e3e3032d51f75b886aae1bbe8ae2858ba137 | [] | no_license | BigGameYang/pullablelayout | 65181f38b225479db69b9e16d3e6add423f89b57 | cabe0a15a5403630071866f4a21d8eab21bfd9da | refs/heads/master | 2021-01-19T09:00:13.670926 | 2017-04-12T11:46:19 | 2017-04-12T11:46:19 | 87,711,490 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package com.yz.pullable;
import android.view.View;
/**
* 头部状态辅助接口
* Created by YangZhi on 2017/4/3 1:33.
*/
public interface HeaderStateHelper {
/**
* 判断头部是否还在显示中
* @return
*/
boolean isHeadOnShow();
/**
* 判断头部是否处于过度下拉状态
* @return
*/
boolean isHeadOnOverPull();
/**
* 判断头部是否全部显示
* @return
*/
boolean isHeadShowFull();
/**
* 设置头部View
* @param view
*/
void setHeadView(View view);
/**
* 获取头部View
* @return
*/
View getHeadView();
/**
* 设置头部测量后的高度
* @param headHeight
*/
void setHeadHeight(int headHeight);
/**
* 拿到头部测量后的高度
* @return
*/
int getHeadHeight();
}
| [
"yang.zhi01@whaley.cn"
] | yang.zhi01@whaley.cn |
57d9964cde1442da215971f5d8e9602ef606e805 | eb5f5353f49ee558e497e5caded1f60f32f536b5 | /sun/security/provider/certpath/OCSPResponse.java | 93974228ebadbb9c04b299afc0a392fdf6686dcc | [] | no_license | mohitrajvardhan17/java1.8.0_151 | 6fc53e15354d88b53bd248c260c954807d612118 | 6eeab0c0fd20be34db653f4778f8828068c50c92 | refs/heads/master | 2020-03-18T09:44:14.769133 | 2018-05-23T14:28:24 | 2018-05-23T14:28:24 | 134,578,186 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 27,796 | java | package sun.security.provider.certpath;
import java.io.IOException;
import java.security.AccessController;
import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.cert.CRLReason;
import java.security.cert.CertPathValidatorException;
import java.security.cert.CertPathValidatorException.BasicReason;
import java.security.cert.CertificateException;
import java.security.cert.CertificateParsingException;
import java.security.cert.TrustAnchor;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.security.auth.x500.X500Principal;
import sun.misc.HexDumpEncoder;
import sun.security.action.GetIntegerAction;
import sun.security.util.Debug;
import sun.security.util.DerInputStream;
import sun.security.util.DerValue;
import sun.security.util.ObjectIdentifier;
import sun.security.x509.AlgorithmId;
import sun.security.x509.KeyIdentifier;
import sun.security.x509.PKIXExtensions;
import sun.security.x509.X509CertImpl;
public final class OCSPResponse
{
private static final ResponseStatus[] rsvalues = ;
private static final Debug debug = Debug.getInstance("certpath");
private static final boolean dump = (debug != null) && (Debug.isOn("ocsp"));
private static final ObjectIdentifier OCSP_BASIC_RESPONSE_OID = ObjectIdentifier.newInternal(new int[] { 1, 3, 6, 1, 5, 5, 7, 48, 1, 1 });
private static final int CERT_STATUS_GOOD = 0;
private static final int CERT_STATUS_REVOKED = 1;
private static final int CERT_STATUS_UNKNOWN = 2;
private static final int NAME_TAG = 1;
private static final int KEY_TAG = 2;
private static final String KP_OCSP_SIGNING_OID = "1.3.6.1.5.5.7.3.9";
private static final int DEFAULT_MAX_CLOCK_SKEW = 900000;
private static final int MAX_CLOCK_SKEW = initializeClockSkew();
private static final CRLReason[] values = CRLReason.values();
private final ResponseStatus responseStatus;
private final Map<CertId, SingleResponse> singleResponseMap;
private final AlgorithmId sigAlgId;
private final byte[] signature;
private final byte[] tbsResponseData;
private final byte[] responseNonce;
private List<X509CertImpl> certs;
private X509CertImpl signerCert = null;
private final ResponderId respId;
private Date producedAtDate = null;
private final Map<String, java.security.cert.Extension> responseExtensions;
private static int initializeClockSkew()
{
Integer localInteger = (Integer)AccessController.doPrivileged(new GetIntegerAction("com.sun.security.ocsp.clockSkew"));
if ((localInteger == null) || (localInteger.intValue() < 0)) {
return 900000;
}
return localInteger.intValue() * 1000;
}
public OCSPResponse(byte[] paramArrayOfByte)
throws IOException
{
if (dump)
{
localObject1 = new HexDumpEncoder();
debug.println("OCSPResponse bytes...\n\n" + ((HexDumpEncoder)localObject1).encode(paramArrayOfByte) + "\n");
}
Object localObject1 = new DerValue(paramArrayOfByte);
if (tag != 48) {
throw new IOException("Bad encoding in OCSP response: expected ASN.1 SEQUENCE tag.");
}
DerInputStream localDerInputStream1 = ((DerValue)localObject1).getData();
int i = localDerInputStream1.getEnumerated();
if ((i >= 0) && (i < rsvalues.length)) {
responseStatus = rsvalues[i];
} else {
throw new IOException("Unknown OCSPResponse status: " + i);
}
if (debug != null) {
debug.println("OCSP response status: " + responseStatus);
}
if (responseStatus != ResponseStatus.SUCCESSFUL)
{
singleResponseMap = Collections.emptyMap();
certs = new ArrayList();
sigAlgId = null;
signature = null;
tbsResponseData = null;
responseNonce = null;
responseExtensions = Collections.emptyMap();
respId = null;
return;
}
localObject1 = localDerInputStream1.getDerValue();
if (!((DerValue)localObject1).isContextSpecific((byte)0)) {
throw new IOException("Bad encoding in responseBytes element of OCSP response: expected ASN.1 context specific tag 0.");
}
DerValue localDerValue1 = data.getDerValue();
if (tag != 48) {
throw new IOException("Bad encoding in responseBytes element of OCSP response: expected ASN.1 SEQUENCE tag.");
}
localDerInputStream1 = data;
ObjectIdentifier localObjectIdentifier = localDerInputStream1.getOID();
if (localObjectIdentifier.equals(OCSP_BASIC_RESPONSE_OID))
{
if (debug != null) {
debug.println("OCSP response type: basic");
}
}
else
{
if (debug != null) {
debug.println("OCSP response type: " + localObjectIdentifier);
}
throw new IOException("Unsupported OCSP response type: " + localObjectIdentifier);
}
DerInputStream localDerInputStream2 = new DerInputStream(localDerInputStream1.getOctetString());
DerValue[] arrayOfDerValue1 = localDerInputStream2.getSequence(2);
if (arrayOfDerValue1.length < 3) {
throw new IOException("Unexpected BasicOCSPResponse value");
}
DerValue localDerValue2 = arrayOfDerValue1[0];
tbsResponseData = arrayOfDerValue1[0].toByteArray();
if (tag != 48) {
throw new IOException("Bad encoding in tbsResponseData element of OCSP response: expected ASN.1 SEQUENCE tag.");
}
DerInputStream localDerInputStream3 = data;
DerValue localDerValue3 = localDerInputStream3.getDerValue();
if ((localDerValue3.isContextSpecific((byte)0)) && (localDerValue3.isConstructed()) && (localDerValue3.isContextSpecific()))
{
localDerValue3 = data.getDerValue();
int j = localDerValue3.getInteger();
if (data.available() != 0) {
throw new IOException("Bad encoding in version element of OCSP response: bad format");
}
localDerValue3 = localDerInputStream3.getDerValue();
}
respId = new ResponderId(localDerValue3.toByteArray());
if (debug != null) {
debug.println("Responder ID: " + respId);
}
localDerValue3 = localDerInputStream3.getDerValue();
producedAtDate = localDerValue3.getGeneralizedTime();
if (debug != null) {
debug.println("OCSP response produced at: " + producedAtDate);
}
DerValue[] arrayOfDerValue2 = localDerInputStream3.getSequence(1);
singleResponseMap = new HashMap(arrayOfDerValue2.length);
if (debug != null) {
debug.println("OCSP number of SingleResponses: " + arrayOfDerValue2.length);
}
Object localObject3;
for (localObject3 : arrayOfDerValue2)
{
SingleResponse localSingleResponse = new SingleResponse((DerValue)localObject3, null);
singleResponseMap.put(localSingleResponse.getCertId(), localSingleResponse);
}
??? = new HashMap();
if (localDerInputStream3.available() > 0)
{
localDerValue3 = localDerInputStream3.getDerValue();
if (localDerValue3.isContextSpecific((byte)1)) {
??? = parseExtensions(localDerValue3);
}
}
responseExtensions = ((Map)???);
sun.security.x509.Extension localExtension = (sun.security.x509.Extension)((Map)???).get(PKIXExtensions.OCSPNonce_Id.toString());
responseNonce = (localExtension != null ? localExtension.getExtensionValue() : null);
if ((debug != null) && (responseNonce != null)) {
debug.println("Response nonce: " + Arrays.toString(responseNonce));
}
sigAlgId = AlgorithmId.parse(arrayOfDerValue1[1]);
signature = arrayOfDerValue1[2].getBitString();
if (arrayOfDerValue1.length > 3)
{
DerValue localDerValue4 = arrayOfDerValue1[3];
if (!localDerValue4.isContextSpecific((byte)0)) {
throw new IOException("Bad encoding in certs element of OCSP response: expected ASN.1 context specific tag 0.");
}
localObject3 = localDerValue4.getData().getSequence(3);
certs = new ArrayList(localObject3.length);
try
{
for (int n = 0; n < localObject3.length; n++)
{
X509CertImpl localX509CertImpl = new X509CertImpl(localObject3[n].toByteArray());
certs.add(localX509CertImpl);
if (debug != null) {
debug.println("OCSP response cert #" + (n + 1) + ": " + localX509CertImpl.getSubjectX500Principal());
}
}
}
catch (CertificateException localCertificateException)
{
throw new IOException("Bad encoding in X509 Certificate", localCertificateException);
}
}
else
{
certs = new ArrayList();
}
}
void verify(List<CertId> paramList, IssuerInfo paramIssuerInfo, X509Certificate paramX509Certificate, Date paramDate, byte[] paramArrayOfByte, String paramString)
throws CertPathValidatorException
{
switch (responseStatus)
{
case SUCCESSFUL:
break;
case TRY_LATER:
case INTERNAL_ERROR:
throw new CertPathValidatorException("OCSP response error: " + responseStatus, null, null, -1, CertPathValidatorException.BasicReason.UNDETERMINED_REVOCATION_STATUS);
case UNAUTHORIZED:
default:
throw new CertPathValidatorException("OCSP response error: " + responseStatus);
}
Iterator localIterator1 = paramList.iterator();
Object localObject2;
Object localObject3;
while (localIterator1.hasNext())
{
localObject2 = (CertId)localIterator1.next();
localObject3 = getSingleResponse((CertId)localObject2);
if (localObject3 == null)
{
if (debug != null) {
debug.println("No response found for CertId: " + localObject2);
}
throw new CertPathValidatorException("OCSP response does not include a response for a certificate supplied in the OCSP request");
}
if (debug != null) {
debug.println("Status of certificate (with serial number " + ((CertId)localObject2).getSerialNumber() + ") is: " + ((SingleResponse)localObject3).getCertStatus());
}
}
Object localObject1;
if (signerCert == null)
{
try
{
if (paramIssuerInfo.getCertificate() != null) {
certs.add(X509CertImpl.toImpl(paramIssuerInfo.getCertificate()));
}
if (paramX509Certificate != null) {
certs.add(X509CertImpl.toImpl(paramX509Certificate));
}
}
catch (CertificateException localCertificateException1)
{
throw new CertPathValidatorException("Invalid issuer or trusted responder certificate", localCertificateException1);
}
if (respId.getType() == ResponderId.Type.BY_NAME)
{
localObject1 = respId.getResponderName();
localObject2 = certs.iterator();
while (((Iterator)localObject2).hasNext())
{
localObject3 = (X509CertImpl)((Iterator)localObject2).next();
if (((X509CertImpl)localObject3).getSubjectX500Principal().equals(localObject1))
{
signerCert = ((X509CertImpl)localObject3);
break;
}
}
}
else if (respId.getType() == ResponderId.Type.BY_KEY)
{
localObject1 = respId.getKeyIdentifier();
localObject2 = certs.iterator();
while (((Iterator)localObject2).hasNext())
{
localObject3 = (X509CertImpl)((Iterator)localObject2).next();
localObject4 = ((X509CertImpl)localObject3).getSubjectKeyId();
if ((localObject4 != null) && (((KeyIdentifier)localObject1).equals(localObject4)))
{
signerCert = ((X509CertImpl)localObject3);
break;
}
try
{
localObject4 = new KeyIdentifier(((X509CertImpl)localObject3).getPublicKey());
}
catch (IOException localIOException) {}
if (((KeyIdentifier)localObject1).equals(localObject4))
{
signerCert = ((X509CertImpl)localObject3);
break;
}
}
}
}
if (signerCert != null) {
if ((signerCert.getSubjectX500Principal().equals(paramIssuerInfo.getName())) && (signerCert.getPublicKey().equals(paramIssuerInfo.getPublicKey())))
{
if (debug != null) {
debug.println("OCSP response is signed by the target's Issuing CA");
}
}
else if (signerCert.equals(paramX509Certificate))
{
if (debug != null) {
debug.println("OCSP response is signed by a Trusted Responder");
}
}
else if (signerCert.getIssuerX500Principal().equals(paramIssuerInfo.getName()))
{
try
{
localObject1 = signerCert.getExtendedKeyUsage();
if ((localObject1 == null) || (!((List)localObject1).contains("1.3.6.1.5.5.7.3.9"))) {
throw new CertPathValidatorException("Responder's certificate not valid for signing OCSP responses");
}
}
catch (CertificateParsingException localCertificateParsingException)
{
throw new CertPathValidatorException("Responder's certificate not valid for signing OCSP responses", localCertificateParsingException);
}
AlgorithmChecker localAlgorithmChecker = new AlgorithmChecker(paramIssuerInfo.getAnchor(), paramDate, paramString);
localAlgorithmChecker.init(false);
localAlgorithmChecker.check(signerCert, Collections.emptySet());
try
{
if (paramDate == null) {
signerCert.checkValidity();
} else {
signerCert.checkValidity(paramDate);
}
}
catch (CertificateException localCertificateException2)
{
throw new CertPathValidatorException("Responder's certificate not within the validity period", localCertificateException2);
}
sun.security.x509.Extension localExtension = signerCert.getExtension(PKIXExtensions.OCSPNoCheck_Id);
if ((localExtension != null) && (debug != null)) {
debug.println("Responder's certificate includes the extension id-pkix-ocsp-nocheck.");
}
try
{
signerCert.verify(paramIssuerInfo.getPublicKey());
if (debug != null) {
debug.println("OCSP response is signed by an Authorized Responder");
}
}
catch (GeneralSecurityException localGeneralSecurityException)
{
signerCert = null;
}
}
else
{
throw new CertPathValidatorException("Responder's certificate is not authorized to sign OCSP responses");
}
}
if (signerCert != null)
{
AlgorithmChecker.check(signerCert.getPublicKey(), sigAlgId, paramString);
if (!verifySignature(signerCert)) {
throw new CertPathValidatorException("Error verifying OCSP Response's signature");
}
}
else
{
throw new CertPathValidatorException("Unable to verify OCSP Response's signature");
}
if ((paramArrayOfByte != null) && (responseNonce != null) && (!Arrays.equals(paramArrayOfByte, responseNonce))) {
throw new CertPathValidatorException("Nonces don't match");
}
long l = paramDate == null ? System.currentTimeMillis() : paramDate.getTime();
Date localDate = new Date(l + MAX_CLOCK_SKEW);
Object localObject4 = new Date(l - MAX_CLOCK_SKEW);
Iterator localIterator2 = singleResponseMap.values().iterator();
while (localIterator2.hasNext())
{
SingleResponse localSingleResponse = (SingleResponse)localIterator2.next();
if (debug != null)
{
String str = "";
if (nextUpdate != null) {
str = " until " + nextUpdate;
}
debug.println("OCSP response validity interval is from " + thisUpdate + str);
debug.println("Checking validity of OCSP response on: " + new Date(l));
}
if (!localDate.before(thisUpdate))
{
if (!((Date)localObject4).after(nextUpdate != null ? nextUpdate : thisUpdate)) {}
}
else {
throw new CertPathValidatorException("Response is unreliable: its validity interval is out-of-date");
}
}
}
public ResponseStatus getResponseStatus()
{
return responseStatus;
}
private boolean verifySignature(X509Certificate paramX509Certificate)
throws CertPathValidatorException
{
try
{
Signature localSignature = Signature.getInstance(sigAlgId.getName());
localSignature.initVerify(paramX509Certificate.getPublicKey());
localSignature.update(tbsResponseData);
if (localSignature.verify(signature))
{
if (debug != null) {
debug.println("Verified signature of OCSP Response");
}
return true;
}
if (debug != null) {
debug.println("Error verifying signature of OCSP Response");
}
return false;
}
catch (InvalidKeyException|NoSuchAlgorithmException|SignatureException localInvalidKeyException)
{
throw new CertPathValidatorException(localInvalidKeyException);
}
}
public SingleResponse getSingleResponse(CertId paramCertId)
{
return (SingleResponse)singleResponseMap.get(paramCertId);
}
public Set<CertId> getCertIds()
{
return Collections.unmodifiableSet(singleResponseMap.keySet());
}
X509Certificate getSignerCertificate()
{
return signerCert;
}
public ResponderId getResponderId()
{
return respId;
}
public String toString()
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("OCSP Response:\n");
localStringBuilder.append("Response Status: ").append(responseStatus).append("\n");
localStringBuilder.append("Responder ID: ").append(respId).append("\n");
localStringBuilder.append("Produced at: ").append(producedAtDate).append("\n");
int i = singleResponseMap.size();
localStringBuilder.append(i).append(i == 1 ? " response:\n" : " responses:\n");
Iterator localIterator = singleResponseMap.values().iterator();
Object localObject;
while (localIterator.hasNext())
{
localObject = (SingleResponse)localIterator.next();
localStringBuilder.append(localObject).append("\n");
}
if ((responseExtensions != null) && (responseExtensions.size() > 0))
{
i = responseExtensions.size();
localStringBuilder.append(i).append(i == 1 ? " extension:\n" : " extensions:\n");
localIterator = responseExtensions.keySet().iterator();
while (localIterator.hasNext())
{
localObject = (String)localIterator.next();
localStringBuilder.append(responseExtensions.get(localObject)).append("\n");
}
}
return localStringBuilder.toString();
}
private static Map<String, java.security.cert.Extension> parseExtensions(DerValue paramDerValue)
throws IOException
{
DerValue[] arrayOfDerValue1 = data.getSequence(3);
HashMap localHashMap = new HashMap(arrayOfDerValue1.length);
for (DerValue localDerValue : arrayOfDerValue1)
{
sun.security.x509.Extension localExtension = new sun.security.x509.Extension(localDerValue);
if (debug != null) {
debug.println("Extension: " + localExtension);
}
if (localExtension.isCritical()) {
throw new IOException("Unsupported OCSP critical extension: " + localExtension.getExtensionId());
}
localHashMap.put(localExtension.getId(), localExtension);
}
return localHashMap;
}
static final class IssuerInfo
{
private final TrustAnchor anchor;
private final X509Certificate certificate;
private final X500Principal name;
private final PublicKey pubKey;
IssuerInfo(TrustAnchor paramTrustAnchor)
{
this(paramTrustAnchor, paramTrustAnchor != null ? paramTrustAnchor.getTrustedCert() : null);
}
IssuerInfo(X509Certificate paramX509Certificate)
{
this(null, paramX509Certificate);
}
IssuerInfo(TrustAnchor paramTrustAnchor, X509Certificate paramX509Certificate)
{
if ((paramTrustAnchor == null) && (paramX509Certificate == null)) {
throw new NullPointerException("TrustAnchor and issuerCert cannot be null");
}
anchor = paramTrustAnchor;
if (paramX509Certificate != null)
{
name = paramX509Certificate.getSubjectX500Principal();
pubKey = paramX509Certificate.getPublicKey();
certificate = paramX509Certificate;
}
else
{
name = paramTrustAnchor.getCA();
pubKey = paramTrustAnchor.getCAPublicKey();
certificate = paramTrustAnchor.getTrustedCert();
}
}
X509Certificate getCertificate()
{
return certificate;
}
X500Principal getName()
{
return name;
}
PublicKey getPublicKey()
{
return pubKey;
}
TrustAnchor getAnchor()
{
return anchor;
}
public String toString()
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("Issuer Info:\n");
localStringBuilder.append("Name: ").append(name.toString()).append("\n");
localStringBuilder.append("Public Key:\n").append(pubKey.toString()).append("\n");
return localStringBuilder.toString();
}
}
public static enum ResponseStatus
{
SUCCESSFUL, MALFORMED_REQUEST, INTERNAL_ERROR, TRY_LATER, UNUSED, SIG_REQUIRED, UNAUTHORIZED;
private ResponseStatus() {}
}
public static final class SingleResponse
implements OCSP.RevocationStatus
{
private final CertId certId;
private final OCSP.RevocationStatus.CertStatus certStatus;
private final Date thisUpdate;
private final Date nextUpdate;
private final Date revocationTime;
private final CRLReason revocationReason;
private final Map<String, java.security.cert.Extension> singleExtensions;
private SingleResponse(DerValue paramDerValue)
throws IOException
{
if (tag != 48) {
throw new IOException("Bad ASN.1 encoding in SingleResponse");
}
DerInputStream localDerInputStream = data;
certId = new CertId(getDerValuedata);
DerValue localDerValue = localDerInputStream.getDerValue();
int i = (short)(byte)(tag & 0x1F);
if (i == 1)
{
certStatus = OCSP.RevocationStatus.CertStatus.REVOKED;
revocationTime = data.getGeneralizedTime();
if (data.available() != 0)
{
localObject = data.getDerValue();
i = (short)(byte)(tag & 0x1F);
if (i == 0)
{
int j = data.getEnumerated();
if ((j >= 0) && (j < OCSPResponse.values.length)) {
revocationReason = OCSPResponse.values[j];
} else {
revocationReason = CRLReason.UNSPECIFIED;
}
}
else
{
revocationReason = CRLReason.UNSPECIFIED;
}
}
else
{
revocationReason = CRLReason.UNSPECIFIED;
}
if (OCSPResponse.debug != null)
{
OCSPResponse.debug.println("Revocation time: " + revocationTime);
OCSPResponse.debug.println("Revocation reason: " + revocationReason);
}
}
else
{
revocationTime = null;
revocationReason = null;
if (i == 0) {
certStatus = OCSP.RevocationStatus.CertStatus.GOOD;
} else if (i == 2) {
certStatus = OCSP.RevocationStatus.CertStatus.UNKNOWN;
} else {
throw new IOException("Invalid certificate status");
}
}
thisUpdate = localDerInputStream.getGeneralizedTime();
if (OCSPResponse.debug != null) {
OCSPResponse.debug.println("thisUpdate: " + thisUpdate);
}
Object localObject = null;
Map localMap = null;
if (localDerInputStream.available() > 0)
{
localDerValue = localDerInputStream.getDerValue();
if (localDerValue.isContextSpecific((byte)0))
{
localObject = data.getGeneralizedTime();
if (OCSPResponse.debug != null) {
OCSPResponse.debug.println("nextUpdate: " + localObject);
}
localDerValue = localDerInputStream.available() > 0 ? localDerInputStream.getDerValue() : null;
}
if (localDerValue != null) {
if (localDerValue.isContextSpecific((byte)1))
{
localMap = OCSPResponse.parseExtensions(localDerValue);
if (localDerInputStream.available() > 0) {
throw new IOException(localDerInputStream.available() + " bytes of additional data in singleResponse");
}
}
else
{
throw new IOException("Unsupported singleResponse item, tag = " + String.format("%02X", new Object[] { Byte.valueOf(tag) }));
}
}
}
nextUpdate = ((Date)localObject);
singleExtensions = (localMap != null ? localMap : Collections.emptyMap());
if (OCSPResponse.debug != null)
{
Iterator localIterator = singleExtensions.values().iterator();
while (localIterator.hasNext())
{
java.security.cert.Extension localExtension = (java.security.cert.Extension)localIterator.next();
OCSPResponse.debug.println("singleExtension: " + localExtension);
}
}
}
public OCSP.RevocationStatus.CertStatus getCertStatus()
{
return certStatus;
}
public CertId getCertId()
{
return certId;
}
public Date getThisUpdate()
{
return thisUpdate != null ? (Date)thisUpdate.clone() : null;
}
public Date getNextUpdate()
{
return nextUpdate != null ? (Date)nextUpdate.clone() : null;
}
public Date getRevocationTime()
{
return revocationTime != null ? (Date)revocationTime.clone() : null;
}
public CRLReason getRevocationReason()
{
return revocationReason;
}
public Map<String, java.security.cert.Extension> getSingleExtensions()
{
return Collections.unmodifiableMap(singleExtensions);
}
public String toString()
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("SingleResponse:\n");
localStringBuilder.append(certId);
localStringBuilder.append("\nCertStatus: ").append(certStatus).append("\n");
if (certStatus == OCSP.RevocationStatus.CertStatus.REVOKED)
{
localStringBuilder.append("revocationTime is ");
localStringBuilder.append(revocationTime).append("\n");
localStringBuilder.append("revocationReason is ");
localStringBuilder.append(revocationReason).append("\n");
}
localStringBuilder.append("thisUpdate is ").append(thisUpdate).append("\n");
if (nextUpdate != null) {
localStringBuilder.append("nextUpdate is ").append(nextUpdate).append("\n");
}
Iterator localIterator = singleExtensions.values().iterator();
while (localIterator.hasNext())
{
java.security.cert.Extension localExtension = (java.security.cert.Extension)localIterator.next();
localStringBuilder.append("singleExtension: ");
localStringBuilder.append(localExtension.toString()).append("\n");
}
return localStringBuilder.toString();
}
}
}
/* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\sun\security\provider\certpath\OCSPResponse.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"mohit.rajvardhan@ericsson.com"
] | mohit.rajvardhan@ericsson.com |
103589d1778cb3857265bac6099cd0660bfb658b | 6bbd3a30806ea3f33d9e08ddbb2720fe75e579c6 | /app/build/generated/source/r/debug/android/support/fragment/R.java | 4858eed9eb289d4d23312ce1dd602c8cde08201c | [] | no_license | juniomik14/Practica-Android | 5013c4989f29f6956253b1e38e5fa5c70a687e20 | 752b7d8f43a91dcf2e555ddac4ebbb24a8779ac1 | refs/heads/master | 2021-04-15T04:51:21.548081 | 2018-03-21T17:40:51 | 2018-03-21T17:40:51 | 126,214,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,612 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.fragment;
public final class R {
public static final class attr {
public static final int font = 0x7f030070;
public static final int fontProviderAuthority = 0x7f030072;
public static final int fontProviderCerts = 0x7f030073;
public static final int fontProviderFetchStrategy = 0x7f030074;
public static final int fontProviderFetchTimeout = 0x7f030075;
public static final int fontProviderPackage = 0x7f030076;
public static final int fontProviderQuery = 0x7f030077;
public static final int fontStyle = 0x7f030078;
public static final int fontWeight = 0x7f030079;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f040000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f05003f;
public static final int notification_icon_bg_color = 0x7f050040;
public static final int ripple_material_light = 0x7f05004b;
public static final int secondary_text_default_material_light = 0x7f05004d;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f06004b;
public static final int compat_button_inset_vertical_material = 0x7f06004c;
public static final int compat_button_padding_horizontal_material = 0x7f06004d;
public static final int compat_button_padding_vertical_material = 0x7f06004e;
public static final int compat_control_corner_material = 0x7f06004f;
public static final int notification_action_icon_size = 0x7f06005c;
public static final int notification_action_text_size = 0x7f06005d;
public static final int notification_big_circle_margin = 0x7f06005e;
public static final int notification_content_margin_start = 0x7f06005f;
public static final int notification_large_icon_height = 0x7f060060;
public static final int notification_large_icon_width = 0x7f060061;
public static final int notification_main_column_padding_top = 0x7f060062;
public static final int notification_media_narrow_margin = 0x7f060063;
public static final int notification_right_icon_size = 0x7f060064;
public static final int notification_right_side_padding_top = 0x7f060065;
public static final int notification_small_icon_background_padding = 0x7f060066;
public static final int notification_small_icon_size_as_large = 0x7f060067;
public static final int notification_subtext_size = 0x7f060068;
public static final int notification_top_pad = 0x7f060069;
public static final int notification_top_pad_large_text = 0x7f06006a;
}
public static final class drawable {
public static final int notification_action_background = 0x7f070057;
public static final int notification_bg = 0x7f070058;
public static final int notification_bg_low = 0x7f070059;
public static final int notification_bg_low_normal = 0x7f07005a;
public static final int notification_bg_low_pressed = 0x7f07005b;
public static final int notification_bg_normal = 0x7f07005c;
public static final int notification_bg_normal_pressed = 0x7f07005d;
public static final int notification_icon_background = 0x7f07005e;
public static final int notification_template_icon_bg = 0x7f07005f;
public static final int notification_template_icon_low_bg = 0x7f070060;
public static final int notification_tile_bg = 0x7f070061;
public static final int notify_panel_notification_icon_bg = 0x7f070062;
}
public static final class id {
public static final int action_container = 0x7f080012;
public static final int action_divider = 0x7f080014;
public static final int action_image = 0x7f080015;
public static final int action_text = 0x7f08001b;
public static final int actions = 0x7f08001c;
public static final int async = 0x7f080022;
public static final int blocking = 0x7f080025;
public static final int chronometer = 0x7f08002e;
public static final int forever = 0x7f08003c;
public static final int icon = 0x7f08003f;
public static final int icon_group = 0x7f080040;
public static final int info = 0x7f080043;
public static final int italic = 0x7f080044;
public static final int line1 = 0x7f080045;
public static final int line3 = 0x7f080046;
public static final int normal = 0x7f080050;
public static final int notification_background = 0x7f080051;
public static final int notification_main_column = 0x7f080052;
public static final int notification_main_column_container = 0x7f080053;
public static final int right_icon = 0x7f08005a;
public static final int right_side = 0x7f08005b;
public static final int text = 0x7f08007a;
public static final int text2 = 0x7f08007b;
public static final int time = 0x7f08007e;
public static final int title = 0x7f08007f;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f090004;
}
public static final class layout {
public static final int notification_action = 0x7f0a001f;
public static final int notification_action_tombstone = 0x7f0a0020;
public static final int notification_template_custom_big = 0x7f0a0027;
public static final int notification_template_icon_group = 0x7f0a0028;
public static final int notification_template_part_chronometer = 0x7f0a002c;
public static final int notification_template_part_time = 0x7f0a002d;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0c0026;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0d00fa;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00fb;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00fd;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d0100;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d0102;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d016b;
public static final int Widget_Compat_NotificationActionText = 0x7f0d016c;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f030072, 0x7f030073, 0x7f030074, 0x7f030075, 0x7f030076, 0x7f030077 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x7f030070, 0x7f030078, 0x7f030079 };
public static final int FontFamilyFont_font = 0;
public static final int FontFamilyFont_fontStyle = 1;
public static final int FontFamilyFont_fontWeight = 2;
}
}
| [
"juniomik14@gmail.com"
] | juniomik14@gmail.com |
017e0dbbc968f6e7527969c1078c253904011fb0 | 6c93ba0d0bef3873ecd56b496c73e256883fb514 | /thinkingInJava/generics/GenericArray2.java | 494629a079700b08a3f809718fe93601cd00791e | [] | no_license | binshion/Thinking_in_Java | fcb57502f526481df13ef6db0723af5d6089b8df | fd804260db4b8311ec2e021aa9bb56005da48538 | refs/heads/master | 2020-04-01T21:01:45.303868 | 2019-07-05T09:39:45 | 2019-07-05T09:39:45 | 153,633,740 | 1 | 0 | null | 2018-10-18T14:53:52 | 2018-10-18T14:04:20 | Java | UTF-8 | Java | false | false | 995 | java | package thinkingInJava.generics;
public class GenericArray2<T> {
private Object[] array;
public GenericArray2(int size) {
array = new Object[size];
}
public void put(int index, T item) {
array[index] = item;
}
public T get(int index) {
return (T) array[index];
}
public T[] rep() {
return (T[])array;
}
public static void main(String[] args) {
GenericArray2<Integer> gai =
new GenericArray2<>(10);
for(int i = 0; i < 10; i++) {
gai.put(i, i);
}
for(int i = 0; i < 10; i++) {
System.out.print(gai.get(i) + " ");
}
System.out.println();
try {
//没有任何方式能推翻底层的数组类型
//尝试将Object[]转型为T[],但仍旧不正确,在运行时产生异常
Integer[] ia = gai.rep();
} catch (Exception e) {
System.out.println(e);
}
}
}
| [
"binshion@hotmail.com"
] | binshion@hotmail.com |
4c2c079c98ec5a7334747158e465d8b7c7e1b5c2 | f03cac89655845281242326caf7c472bfabe674c | /app/src/main/java/com/shail/boundservicesample/ThreadPoolExecutorActivity.java | 58e4cc9c510ea63a218d3c6e2c0c064322b58260 | [] | no_license | shailendra-singh-dev/AndroidBoundService | 0622eca7b8897b74e6223d8b72adee74fda92de3 | 3d9f2d8be81e17f39cf2ee273e82353eb6e7154f | refs/heads/master | 2021-04-15T07:59:31.730664 | 2016-07-05T20:38:26 | 2016-07-05T20:38:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,433 | java | package com.shail.boundservicesample;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
/**
* Created by iTexico Developer on 7/5/2016.
*/
public class ThreadPoolExecutorActivity extends AppCompatActivity {
// Flag indicating whether we have called bind on the service.
boolean mBound;
private ThreadPoolExecutorService mThreadPoolExecutorService;
// Class for interacting with the main interface of the service.
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder iBinder) {
// This is called when the connection with the iBinder has been established, giving us the object we can use
// to interact with the iBinder. We are communicating with the iBinder using a Messenger, so here we get a
// client-side representation of that from the raw IBinder object.
ThreadPoolExecutorService.ThreadPoolExecutorServiceBinder threadPoolExecutorServiceBinder = (ThreadPoolExecutorService.ThreadPoolExecutorServiceBinder) iBinder;
mThreadPoolExecutorService = threadPoolExecutorServiceBinder.getService();
mBound = true;
}
public void onServiceDisconnected(ComponentName className) {
// This is called when the connection with the service has been unexpectedly disconnected -- that is,
// its process crashed.
mBound = false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.threadpoolexcutor_main);
Button button = (Button) findViewById(R.id.performBackgroundOperationButton);
assert button != null;
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
performBackgroundOperation();
}
});
}
@Override
protected void onStart() {
super.onStart();
// Bind to the service
bindService(new Intent(this, ThreadPoolExecutorService.class), mConnection, Context.BIND_AUTO_CREATE);
}
@Override
protected void onStop() {
super.onStop();
// Unbind from the service
if (mBound) {
unbindService(mConnection);
mBound = false;
}
}
public void performBackgroundOperation() {
if (mBound) {
// Call a method from the ThreadPoolExecutorService.
// However, if this call were something that might hang, then this request should
// occur in a separate thread to avoid slowing down the activity performance.
mThreadPoolExecutorService.generateRandomNumber();
}
}
@Override
protected void onResume() {
super.onResume();
// Register for the particular broadcast based on ACTION string
IntentFilter filter = new IntentFilter(ThreadPoolExecutorService.ACTION);
LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter);
// or `registerReceiver(mBroadcastReceiver, filter)` for a normal broadcast
}
@Override
protected void onPause() {
super.onPause();
// Unregister the listener when the application is paused
LocalBroadcastManager.getInstance(this).unregisterReceiver(mBroadcastReceiver);
// or `unregisterReceiver(mBroadcastReceiver)` for a normal broadcast
}
// Define the callback for what to do when message is received
private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction() == ThreadPoolExecutorService.ACTION){
int result = intent.getIntExtra("result",0);
Toast.makeText(ThreadPoolExecutorActivity.this, "Result:"+result, Toast.LENGTH_SHORT).show();
}
}
};
}
| [
"ssingh@itexico.net"
] | ssingh@itexico.net |
be97a7e374672466ac62ccddcb68f9cbfa4adf44 | f58192e415ec3244470598194350ef1c2bd9283f | /src/main/java/com/gemsrobotics/lib/subsystems/drivetrain/WheelState.java | e9a69ecf88dd590fbbfdba677fd96bd693a508e9 | [] | no_license | frc4362/gemlib | 200af997edfbcd5375cb5b12d5437aed1b3c521d | 8318332285a27e8fc0b9a57574bbdd03b50a402a | refs/heads/master | 2022-12-10T20:33:33.251666 | 2022-12-03T14:02:36 | 2022-12-03T14:02:36 | 221,908,057 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,355 | java | package com.gemsrobotics.lib.subsystems.drivetrain;
import com.gemsrobotics.lib.utils.FastDoubleToString;
import java.util.function.DoubleFunction;
// Can refer to velocity, acceleration, torque, voltage, etcetera, depending on context.
public class WheelState {
public double left, right;
public WheelState(final double left, final double right) {
this.left = left;
this.right = right;
}
public WheelState() {
this(0, 0);
}
public WheelState(final WheelState other) {
this(other.left, other.right);
}
public WheelState copy() {
return new WheelState(left, right);
}
public WheelState map(final DoubleFunction<Double> f) {
return new WheelState(f.apply(left), f.apply(right));
}
public WheelState inverse() {
return map(n -> -n);
}
public WheelState sum(final WheelState other) {
return new WheelState(left + other.left, right + other.right);
}
public WheelState difference(final WheelState other) {
return sum(other.inverse());
}
public void flip() {
final var tempL = left;
left = -right;
right = -tempL;
}
@Override
public String toString() {
return "[" + FastDoubleToString.format(left, 2) + ", " + FastDoubleToString.format(right, 2) + "]";
}
}
| [
"ejmalzone@gmail.com"
] | ejmalzone@gmail.com |
391e52acfa77e8b31b88ccb9900c2350e93b3047 | 10fc17a900224691fa6ace2082926839f70b8e9f | /Firstmevenproject/src/main/java/com/OrageHRM/LoginTest.java | a1b38cca588d2095d0d7fd73077a56ef0dd9fbb9 | [] | no_license | swethaUG/AutomateSelenium | e0cc4cbfa633883a663dac628e8f7fcba3f92643 | 652fcbbc330617a5c3682cd77d314b2ca6bcab8c | refs/heads/master | 2020-05-03T14:49:30.930157 | 2019-03-31T13:23:08 | 2019-03-31T13:23:08 | 178,688,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package com.OrageHRM;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.BeforeTest;
public class LoginTest {
WebDriver driver=null;
String URL="http://localhost/orangehrm/orangehrm-2.6/orangehrm-2.6/login.php";
@BeforeTest
public void main()
{
}
}
| [
"swetha.uppara@gmail.com"
] | swetha.uppara@gmail.com |
a2f71c422164898cda00cd46b569af5fdbf2859b | ee96ad985190b145228f504a308aebed7f874d3a | /src/main/java/com/cp/epa/permission/services/IRoleAuthValueService.java | 6c5a9a95d6bed0cf01f077959036b7231e5fb1b9 | [] | no_license | WangxiaoboRD/shrimp2 | fe3ec9725ad0b4b8933ed101b682883e165709b8 | 5dc7413d4edcd9c4e47b7e5bc443c7af274536ea | refs/heads/master | 2020-03-27T09:02:17.462662 | 2018-08-27T14:24:12 | 2018-08-27T14:24:12 | 146,308,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | /**
* 文件名:@IRoleAuthValueService.java <br/>
* 包名:com.zhongpin.pap.permission.services <br/>
* 项目名:PAP1.0 <br/>
* @author 孟雪勤 <br/>
*/
package com.cp.epa.permission.services;
import java.util.List;
import com.cp.epa.base.IBaseService;
import com.cp.epa.permission.entity.RoleAuthValue;
/**
* 类名:IRoleAuthValueService <br />
*
* 功能:角色权限规则业务逻辑层定义
*
* @author 孟雪勤 <br />
* 创建时间:2013-11-6 下午02:42:40 <br />
* @version 2013-11-6
*/
public interface IRoleAuthValueService extends IBaseService<RoleAuthValue> {
/**
* 功能:根据角色、权限对象查询角色权限规则信息<br/>
*
* @author 孟雪勤
* @version 2013-11-11 下午02:26:47 <br/>
*/
public List<RoleAuthValue> selectByRoleAuthObj(RoleAuthValue entity) throws Exception;
/**
* 功能:分配权限<br/>
*
* @author 孟雪勤
* @version 2013-11-16 下午04:02:00 <br/>
*/
public void allotAuth(RoleAuthValue entity) throws Exception;
/**
* 功能:清空已分配的权限<br/>
*
* @author 孟雪勤
* @version 2013-11-16 下午04:02:35 <br/>
*/
public void cancelAuth(RoleAuthValue entity) throws Exception;
}
| [
"370423310@qq.com"
] | 370423310@qq.com |
547dd359dcae711a59d3ad56b4e422f7d015acbb | 0c71858ed04d665ea16718fe704265762844822e | /HelloServerHttp.java | 881ed344c8421df3f93a9ed1fe7c3fdcca711330 | [] | no_license | pedromachuca/ServerJava | 02c8ef61ebedefa4342a4ee7437853207b5b5c05 | 953fb91f4e92502da7bc48f28edcd4cf806f0d41 | refs/heads/master | 2020-04-10T23:24:27.056528 | 2018-10-23T14:05:17 | 2018-10-23T14:05:17 | 161,352,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,009 | java | /*
Server HTTP en JAVA:
-creer un serveur sur le port 8080
-récupérer la requête du client et l'afficher
-forger à la main avec telnet
-avec un vrai navigateur
-3 fichiers (avec gestion des erreurs minimal)
-un fichier text/html
-un fichier pdf
-un fichier PNG
Protocol HTTP/1.1
GET /toto.html
GET /toto.pdf
GET /toto.png
*/
import java.net.*;
import java.io.*;
class HelloServerHttp {
public static void main(String argv[]) throws Exception
{
int i =0;
//On installe le combine sur le numero de telephone
ServerSocket serversocket = new ServerSocket(8080);
//On attend les appels entrants
Socket socket = serversocket.accept();
InputStreamReader inputStream = new InputStreamReader( socket.getInputStream() );
BufferedReader input = new BufferedReader(inputStream );
PrintWriter out = new PrintWriter(socket.getOutputStream());
String header="";
while(true){
String line = input.readLine();
header+=""+line+"\n";
if(line.equals("")){
break;
}
}
System.out.print(header);
String []get =header.split("\n");
String []f=header.split(" /");
String f1 =f[1];
String []name=f1.split(" ");
File file =null;
StringBuilder sb = new StringBuilder();
try{
file = new File(name[0]);
BufferedReader thefile = new BufferedReader(new FileReader(file));
String fileLine = thefile.readLine();
while (fileLine != null) {
sb.append(fileLine);
sb.append("\n");
fileLine = thefile.readLine();
}
}catch(FileNotFoundException s){
out.print("HTTP/1.1 404 Not Found");
out.print("Content-Type: text/html");
out.print("\r\n");
out.print("<p> ERROR 404 file not found !!</p>");
}
if(get[0].equals("GET /toto.html HTTP/1.1")){
out.println("HTTP/1.1 200 OK");
out.println("Content-Type: text/html");
out.println("\r\n");
out.println("<p> Text sent </p>"+sb);
out.flush();
}
//On raccroche
socket.close();
}
}
| [
"pierre.coiffey@gmail.com"
] | pierre.coiffey@gmail.com |
109897ad79483e5aff210f4e2139858583903d0a | c3d1e9deac34ad6c09d66ab4086e01a0452bca44 | /Card.java | 65cec6fcf06275501ca08008de0d07b2b5f1c3c3 | [] | no_license | cmitchiner/BlackJackGUI | ebbd4997c925730018953af47adbba898fd111c5 | 609201c148dc3244d7f268d9fc8bbe7a84741f83 | refs/heads/master | 2023-04-30T19:17:23.349009 | 2021-05-21T16:46:12 | 2021-05-21T16:46:12 | 369,572,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,311 | java | public class Card {
private char suit;
private int value;
protected Card()
{
suit = ' ';
value = 0;
}
public Card(char newSuit, int newValue)
{
if (newValue < 1 || newValue > 13)
{
System.out.println("Error, my cpu cannot handle these incorrect 0's and 1's mate");
}
else
{
this.value = newValue;
}
if (newSuit != 'H' && newSuit != 'S' && newSuit != 'D' && newSuit != 'C')
{
System.out.println("Error wrong suit");
}
else
{
this.suit = newSuit;
}
}
public String toString()
{
return ( getValueName() + "_of_" + getSuitName() + ".png");
}
public String getSuitName()
{
String suit;
if (this.suit == 'H') {
suit = "Hearts";
}
else if (this.suit == 'S') {
suit = "Spades";
}
else if (this.suit == 'C') {
suit = "Clubs";
}
else if (this.suit == 'D') {
suit = "Diamonds";
} else {
suit = "Unknown";
}
return suit;
}
public String getValueName(){
String name = "Unknown";
if (this.value == 1) {
name = "Ace";
}
else if (this.value == 2) {
name = "Two";
}
else if (this.value == 3) {
name = "Three";
}
else if (this.value == 4) {
name = "Four";
}
else if (this.value == 5) {
name = "Five";
}
else if (this.value == 6) {
name = "Six";
}
else if (this.value == 7) {
name = "Seven";
}
else if (this.value == 8) {
name = "Eight";
}
else if (this.value == 9) {
name = "Nine";
}
else if (this.value == 10) {
name = "Ten";
}
else if (this.value == 11) {
name = "Jack";
}
else if (this.value == 12) {
name = "Queen";
}
else if (this.value == 13) {
name = "King";
}
return name;
}
public int getValue()
{
return this.value;
}
public int getSuitChar()
{
return this.suit;
}
public int getWeight()
{
if (this.value > 1 && this.value < 10)
{
return this.value;
}
else if (this.value > 9 && this.value < 14)
{
return 10;
}
else if (this.value == 1)
{
return 1;
}
else
{
System.out.println("Card get weight error");
return -1;
}
}
}
| [
"c.l.mitchiner@student.tue.nl"
] | c.l.mitchiner@student.tue.nl |
e1b7700c5b9529c6df66ec708067ff62e1a4756c | de0cc089be9e7770c00dcd31619e3522f26ed6d7 | /exercise/src/com/xnj/trie/TrieNode.java | ce2927798a0e0f4698556453fe8b8172cfd9a5b1 | [] | no_license | cfxing/Algorithm | 71660b542a0a4f98366ebc38c873172493cbc9e5 | 2039a0193d14e025a4c1579384cd3d8fc30baaab | refs/heads/master | 2023-01-09T01:34:56.533051 | 2020-11-05T12:07:33 | 2020-11-05T12:07:33 | 282,416,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package com.xnj.trie;
/**
* @author chen xuanyi
* @Date 2020/5/13 16:33
*/
public class TrieNode {
public TrieNode[] nexts;
public int path;
public int end;
public TrieNode() {
path = 0;
end = 0;
nexts = new TrieNode[26];
}
}
| [
"1945390189@qq.com"
] | 1945390189@qq.com |
62e07d6323858ff7e61b5f5fd3282b96d00f260b | 70d80759c7fe6158fc9f7aa41f335dd91e9b46e7 | /SimpleGame/ref/flappy/com/google/android/gms/maps/model/LatLng.java | bdebb0f80701ea0948a70c8e014b59ea2824031a | [] | no_license | dazziest/word | fe1bc157f0f2cfd57312e5c9099cccd4f0398499 | 54d30f21c921525985a00b86b0fc933421d82ac0 | refs/heads/master | 2021-01-01T20:16:52.035457 | 2014-03-12T06:48:53 | 2014-03-12T06:48:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,024 | java | package com.google.android.gms.maps.model;
import android.os.Parcel;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.maps.a.bk;
public final class LatLng
implements SafeParcelable
{
public static final g CREATOR = new g();
public final double a;
public final double b;
private final int c;
public LatLng(double paramDouble1, double paramDouble2)
{
this(1, paramDouble1, paramDouble2);
}
LatLng(int paramInt, double paramDouble1, double paramDouble2)
{
this.c = paramInt;
if ((-180.0D <= paramDouble2) && (paramDouble2 < 180.0D)) {}
for (this.b = paramDouble2;; this.b = ((360.0D + (paramDouble2 - 180.0D) % 360.0D) % 360.0D - 180.0D))
{
this.a = Math.max(-90.0D, Math.min(90.0D, paramDouble1));
return;
}
}
int a()
{
return this.c;
}
public int describeContents()
{
return 0;
}
public boolean equals(Object paramObject)
{
if (this == paramObject) {}
LatLng localLatLng;
do
{
return true;
if (!(paramObject instanceof LatLng)) {
return false;
}
localLatLng = (LatLng)paramObject;
} while ((Double.doubleToLongBits(this.a) == Double.doubleToLongBits(localLatLng.a)) && (Double.doubleToLongBits(this.b) == Double.doubleToLongBits(localLatLng.b)));
return false;
}
public int hashCode()
{
long l1 = Double.doubleToLongBits(this.a);
int i = 31 + (int)(l1 ^ l1 >>> 32);
long l2 = Double.doubleToLongBits(this.b);
return i * 31 + (int)(l2 ^ l2 >>> 32);
}
public String toString()
{
return "lat/lng: (" + this.a + "," + this.b + ")";
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
if (bk.a())
{
u.a(this, paramParcel, paramInt);
return;
}
g.a(this, paramParcel, paramInt);
}
}
/* Location: P:\Side\classes-dex2jar.jar
* Qualified Name: com.google.android.gms.maps.model.LatLng
* JD-Core Version: 0.7.0.1
*/ | [
"dazziest@gmail.com"
] | dazziest@gmail.com |
27136cfba085f785728415a63845f2b3d30d7dbd | 2a6910b37186be1cd466103c1116f2b8d94739e0 | /DataByJava/EduProject/src/com/hk/bean/Wf.java | 740e1a0753e1f3b730cca2cef44fed95f1a5b91d | [] | no_license | renqu4n/Edu-Base-Web | 296bba9bab86874b1aede867081c3be68c7dacb0 | c9ec3543bde8d0cc9101be0bc73139a4f9e545ab | refs/heads/master | 2020-03-31T20:29:09.699877 | 2018-12-13T08:29:59 | 2018-12-13T08:29:59 | 152,542,406 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.hk.bean;
public class Wf {
private String name;
private String phone;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
| [
"296435342@qq.com"
] | 296435342@qq.com |
0c6447d33727bd8c6348475473c917dfd533339e | fbf631accf96de675ab6b11e053a122808004960 | /src/main/java/cart/Application.java | 87622fa99e129911d8b4290217d252ed84138fb2 | [] | no_license | mosca850/codedeploy | 832b1a13ea4f8024df5ea467d3cbc5808cee87bc | f412f77ae8352fe4dd0807542b3f0c97fa273cea | refs/heads/master | 2020-03-26T22:48:47.825988 | 2015-09-14T11:54:54 | 2015-09-14T11:54:54 | 28,507,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package cart;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"ec2-user@ip-172-31-45-215.eu-west-1.compute.internal"
] | ec2-user@ip-172-31-45-215.eu-west-1.compute.internal |
9a9b1c0f8a5e1c36a7e39d6f3eac67b0bab67bc9 | 7e14fa621d5d74e6e0afbc4ef4cbe87485c5c60b | /Codify/test.appgate/src/test/java/com/appgate/test/UpdateBDD.java | 26f92ff66dd37efc8ebdb21607ff9eedab6ca604 | [] | no_license | SaraBustamanteAcevedo/TestAppGate | 004f54d9999f1433d8245dc4d2aed2182315b9d6 | 07305cc8e3925c602b8e2f44e51914efe939c7ed | refs/heads/master | 2023-04-27T11:26:10.965275 | 2021-05-19T20:50:46 | 2021-05-19T20:50:46 | 368,997,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | package com.appgate.test;
import com.appgate.test.util.Employee;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateBDD {
public void Update(){
Employee employee[] = {new Employee(12258,"Simón",3,6000000),
new Employee(13545,"Tomas",3,5400000),
new Employee(45687,"Bartolomé",3,7200000),
new Employee(21546,"Juan",3,4300000),
new Employee(46875,"Andrés",3,3500000)};
{
try {
// create a mysql database connection
String myDriver = "org.gjt.mm.mysql.Driver";
String myUrl = "jdbc:mysql://127.0.0.1:5432/test";
Class.forName(myDriver);
Connection conn = DriverManager.getConnection(myUrl, "root", "");
// the mysql insert statement
String query =
" insert into users (idEmployee, name, months, salary)"
+ " values (?, ?, ?, ?)";
PreparedStatement preparedStmt = conn.prepareStatement(query);
for (int i = 1; i < employee.length; i++) {
preparedStmt.setString(i, String.valueOf(employee[i]));
i++;
}
// execute the preparedstatement
preparedStmt.execute();
conn.close();
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
}
}
| [
"sbustam@bancolombia.com.co"
] | sbustam@bancolombia.com.co |
2e5b218cab74348487812863184b8a34e3bdf04b | 498dd2daff74247c83a698135e4fe728de93585a | /clients/google-api-services-migrationcenter/v1alpha1/2.0.0/com/google/api/services/migrationcenter/v1alpha1/model/RegionPreferences.java | 983dae852c9c5b2415ae3a3280546741a8a92926 | [
"Apache-2.0"
] | permissive | googleapis/google-api-java-client-services | 0e2d474988d9b692c2404d444c248ea57b1f453d | eb359dd2ad555431c5bc7deaeafca11af08eee43 | refs/heads/main | 2023-08-23T00:17:30.601626 | 2023-08-20T02:16:12 | 2023-08-20T02:16:12 | 147,399,159 | 545 | 390 | Apache-2.0 | 2023-09-14T02:14:14 | 2018-09-04T19:11:33 | null | UTF-8 | Java | false | false | 2,767 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.migrationcenter.v1alpha1.model;
/**
* The user preferences relating to target regions.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Migration Center API. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class RegionPreferences extends com.google.api.client.json.GenericJson {
/**
* A list of preferred regions, ordered by the most preferred region first. Set only valid Google
* Cloud region names. See https://cloud.google.com/compute/docs/regions-zones for available
* regions.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> preferredRegions;
/**
* A list of preferred regions, ordered by the most preferred region first. Set only valid Google
* Cloud region names. See https://cloud.google.com/compute/docs/regions-zones for available
* regions.
* @return value or {@code null} for none
*/
public java.util.List<java.lang.String> getPreferredRegions() {
return preferredRegions;
}
/**
* A list of preferred regions, ordered by the most preferred region first. Set only valid Google
* Cloud region names. See https://cloud.google.com/compute/docs/regions-zones for available
* regions.
* @param preferredRegions preferredRegions or {@code null} for none
*/
public RegionPreferences setPreferredRegions(java.util.List<java.lang.String> preferredRegions) {
this.preferredRegions = preferredRegions;
return this;
}
@Override
public RegionPreferences set(String fieldName, Object value) {
return (RegionPreferences) super.set(fieldName, value);
}
@Override
public RegionPreferences clone() {
return (RegionPreferences) super.clone();
}
}
| [
"noreply@github.com"
] | googleapis.noreply@github.com |
aee4c00552d900bb9219441bb86d4730a5cb94de | 926b55391b36391a9bcbc864041dab19d346a95c | /IMp/Client/src/View.java | 31660cc21edd708137ed48ed4814248549af2838 | [] | no_license | Aracturat/JavaProjects | 26931065a5b6e957850682c2162a90403baad9e0 | 82a4dbff3db1ee3b9748f6537d7f0d0fbae50af4 | refs/heads/master | 2016-09-05T23:56:46.599408 | 2015-03-11T14:36:14 | 2015-03-11T14:36:14 | 32,022,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,626 | java | import dialog.*;
import dialog.History;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.*;
public class View extends JFrame implements Observer {
private Controller controller;
private final HashMap<String, Chat> chats;
private JFrame chatWindow;
private ViewRoster viewRoster;
private JTabbedPane chatTab;
private final FrameStart start;
private String username;
private JMenuBar menu;
public View(Controller controller) {
super("IMp");
this.controller = controller;
controller.addObserver(this);
chats = new HashMap<>();
start = new FrameStart(controller);
this.setJMenuBar(getMenu());
startChatWindow();
this.add(start);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.pack();
this.setLocationRelativeTo(null);
}
public void addNewChat(String sessionName) {
if (false == chats.containsKey(sessionName)) {
//Creation new chat.
Chat chat = new Chat(controller, sessionName);
chats.put(sessionName, chat);
controller.addConference(chat, sessionName);
chatTab.add(chat, sessionName);
}
chatWindow.setVisible(true);
chatWindow.setSize(300,300);
}
public void update(Observable ob, Object o) {
if (o instanceof AbstractMap.SimpleEntry) {
AbstractMap.SimpleEntry<String, String> entry = (AbstractMap.SimpleEntry<String, String>) o;
String key = entry.getKey();
String value = entry.getValue();
switch (key) {
case "LOGIN":
this.username = value;
//Remove start panel, and add roster.
this.remove(start);
viewRoster = new ViewRoster(controller);
this.add(viewRoster);
controller.addUserListObserver(viewRoster);
//Change title of window.
this.setTitle("Imp - " + this.username);
//Request list of all users.
controller.requestList();
break;
case "LOGOUT":
this.username = null;
//Remove roster, and add start panel.
this.remove(viewRoster);
//Close chat window.
chatWindow.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
chatWindow.setVisible(false);
this.add(start);
//Change title of window.
this.setTitle("Imp");
break;
case "NEW_SESSION":
addNewChat(value);
break;
case "JOIN_TO_SESSION":
addNewChat(value);
//controller.requestHistory(value);
break;
case "SOCKET ERROR":
case "UNKNOWN HOST":
case "ERROR NEW_USER":
case "ERROR LOGIN":
start.process(entry);
break;
case "ERROR NEW_SESSION":
break;
}
}
this.repaint();
}
private void startChatWindow() {
chatTab = new JTabbedPane();
chatWindow = new JFrame("Chats");
chatWindow.add(chatTab);
chatWindow.setDefaultCloseOperation(HIDE_ON_CLOSE);
chatWindow.setVisible(false);
chatWindow.setLocationRelativeTo(null);
}
private void stopChatWindow() {
chatWindow.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
chatWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
controller.closeAllConference();
}
});
}
private JMenuBar getMenu() {
if (null == menu) {
menu = new JMenuBar();
JMenu main = new JMenu("Main");
JMenu setting = new JMenu("Setting");
JMenu about = new JMenu("About");
JMenuItem exit = new JMenuItem("Exit");
JMenuItem joinToSession = new JMenuItem("Join to session");
JMenuItem aboutItem = new JMenuItem("About");
JMenuItem connections = new JMenuItem("Connections");
JMenuItem disconnect = new JMenuItem("Disconnect");
exit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
System.exit(0);
}
});
joinToSession.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
final JFrame connectToSession = new JFrame("Connect to session.");
connectToSession.add(new JLabel("Enter session's name"));
final JTextField text = new JTextField();
connectToSession.add(text);
JButton connect = new JButton("Connect");
connectToSession.add(connect);
connect.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
controller.requestJoinToSession(text.getText());
connectToSession.setVisible(false);
}
});
connectToSession.add(connect);
connectToSession.setLayout(new GridLayout(3, 1));
connectToSession.pack();
connectToSession.setVisible(true);
}
});
disconnect.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
controller.requestLogout();
}
});
main.add(joinToSession);
main.add(exit);
main.add(disconnect);
setting.add(connections);
about.add(aboutItem);
menu.add(main);
menu.add(setting);
menu.add(about);
}
return menu;
}
}
| [
"ndozmorov@yandex.ru"
] | ndozmorov@yandex.ru |
fec96d817871bb44669caf996de8d98c229bddea | 601582228575ca0d5f61b4c211fd37f9e4e2564c | /logisoft_revision1/src/com/logiware/common/job/DispositionChangeAnytimeJob.java | 6f12fc73a1928659734a6af169ff9763e1d034b9 | [] | no_license | omkarziletech/StrutsCode | 3ce7c36877f5934168b0b4830cf0bb25aac6bb3d | c9745c81f4ec0169bf7ca455b8854b162d6eea5b | refs/heads/master | 2021-01-11T08:48:58.174554 | 2016-12-17T10:45:19 | 2016-12-17T10:45:19 | 76,713,903 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package com.logiware.common.job;
import com.gp.cong.hibernate.HibernateSessionFactory;
import com.gp.cong.lcl.common.constant.LclCommonConstant;
import com.logiware.common.dao.JobDAO;
import com.logiware.common.domain.Job;
import com.logiware.common.utils.NotificationUtil;
import java.util.Date;
import org.apache.log4j.Logger;
import org.hibernate.Transaction;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;
/**
*
* @author Lakshmi Narayanan
*/
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
public class DispositionChangeAnytimeJob implements org.quartz.Job, LclCommonConstant {
private static final Logger log = Logger.getLogger(DispositionChangeAnytimeJob.class);
public void run() throws Exception {
new NotificationUtil().sendDispositionStatusUpdate("minute", EMAIL_TYPE_E2, FAX_TYPE_F2);
}
@Override
public void execute(JobExecutionContext jec) throws JobExecutionException {
JobDAO jobDAO = new JobDAO();
Transaction transaction = null;
try {
log.info("Disposition Status Update Minutely Job started on " + new Date());
transaction = jobDAO.getCurrentSession().getTransaction();
if (!transaction.isActive()) {
transaction.begin();
}
Job job = jobDAO.findByClassName(DispositionChangeAnytimeJob.class.getCanonicalName());
job.setStartTime(new Date());
run();
job.setEndTime(new Date());
transaction.commit();
log.info("Disposition Status Update Minutely Job ended on " + new Date());
} catch (Exception e) {
log.info("Disposition Status Update Minutely Job failed on " + new Date(), e);
if (null != transaction && transaction.isActive() && jobDAO.getCurrentSession().isConnected() && jobDAO.getCurrentSession().isOpen()) {
transaction.rollback();
}
} finally {
HibernateSessionFactory.closeSession();
}
}
}
| [
"omkar@ziletech.com"
] | omkar@ziletech.com |
5e0b5d00317ebea253812409f025909d0044271b | de3f5c7c3021232cf53e452b938df688929fc345 | /tags/JAIN-SIP-1-2-96/src/gov/nist/javax/sip/parser/ChallengeParser.java | 435dc7d3beda3ce17f1c826fba8f01a7e9236305 | [
"LicenseRef-scancode-public-domain"
] | permissive | rkday/jain-sip | bd3f728948bdaafd98c17bb4843148edab74cd0d | cf52d49d540f8515b209352f861365dbe3d59d90 | refs/heads/master | 2021-01-22T09:26:50.309500 | 2014-01-25T19:59:06 | 2014-01-25T19:59:06 | 16,236,776 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,855 | java | /*
* Conditions Of Use
*
* This software was developed by employees of the National Institute of
* Standards and Technology (NIST), an agency of the Federal Government.
* Pursuant to title 15 Untied States Code Section 105, works of NIST
* employees are not subject to copyright protection in the United States
* and are considered to be in the public domain. As a result, a formal
* license is not needed to use the software.
*
* This software is provided by NIST as a service and is expressly
* provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
* AND DATA ACCURACY. NIST does not warrant or make any representations
* regarding the use of the software or the results thereof, including but
* not limited to the correctness, accuracy, reliability or usefulness of
* the software.
*
* Permission to use this software is contingent upon your acceptance
* of the terms of this agreement
*
* .
*
*/
package gov.nist.javax.sip.parser;
import gov.nist.javax.sip.header.*;
import gov.nist.core.*;
import java.text.ParseException;
/**
* Parser for the challenge portion of the authentication header.
*
* @version 1.2 $Revision: 1.7 $ $Date: 2007-02-06 16:40:02 $
* @since 1.1
*
* @author Olivier Deruelle <br/>
*
*
*/
public abstract class ChallengeParser extends HeaderParser {
/**
* Constructor
* @param String challenge message to parse to set
*/
protected ChallengeParser(String challenge) {
super(challenge);
}
/**
* Constructor
* @param String challenge message to parse to set
*/
protected ChallengeParser(Lexer lexer) {
super(lexer);
}
/**
* Get the parameter of the challenge string
* @return NameValue containing the parameter
*/
protected void parseParameter(AuthenticationHeader header)
throws ParseException {
if (debug)
dbg_enter("parseParameter");
try {
NameValue nv = this.nameValue('=');
header.setParameter(nv);
} finally {
if (debug)
dbg_leave("parseParameter");
}
}
/**
* parser the String message.
* @param header - header structure to fill in.
* @throws ParseException if the message does not respect the spec.
*/
public void parse(AuthenticationHeader header) throws ParseException {
// the Scheme:
this.lexer.SPorHT();
lexer.match(TokenTypes.ID);
Token type = lexer.getNextToken();
this.lexer.SPorHT();
header.setScheme(type.getTokenValue());
// The parameters:
try {
while (lexer.lookAhead(0) != '\n') {
this.parseParameter(header);
this.lexer.SPorHT();
char la = lexer.lookAhead(0);
if (la == '\n' || la == '\0')
break;
this.lexer.match(',');
this.lexer.SPorHT();
}
} catch (ParseException ex) {
throw ex;
}
}
}
| [
"(no author)@8e71dc83-d81e-6649-80f2-80b843a9b2be"
] | (no author)@8e71dc83-d81e-6649-80f2-80b843a9b2be |
58a9110728108fa916135b4bd55826946b3ea66a | 527457291394447bb62ddd63866cb5dd09aeb788 | /PentalogJSP/src/md/victordov/lab/services/StudentToXmlParserService.java | 069d43fe343efbb84ad79cead9ae2f87ff9c4999 | [] | no_license | victordov/PLab2 | 1b94be4c5f2616e2f7ebb80d6c9ae7171c49fa79 | f0efcd5ffe000084a829340b10bf431632e7d9f1 | refs/heads/master | 2021-01-22T13:51:55.557548 | 2012-11-01T10:00:57 | 2012-11-01T10:00:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,460 | java | package md.victordov.lab.services;
import java.io.StringWriter;
import java.util.ArrayList;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import md.victordov.lab.Test.XmlDomHandler;
import md.victordov.lab.common.exception.MyDaoException;
import md.victordov.lab.common.exception.MyServiceException;
import md.victordov.lab.common.other.LabParseStringConstants;
import md.victordov.lab.dao.StudentDAO;
import md.victordov.lab.vo.Student;
/**
* @author victor
*
*/
public class StudentToXmlParserService {
/**
* @param args
* @param parser
* , will be accessed as a static function without Class
* initialization
* @throws TransformerException
*/
static Logger logger = LogManager.getLogger(StudentToXmlParserService.class);
public static String parser() throws MyServiceException, MyDaoException,
TransformerException {
logger.info("Initializarea methoda parser");
GenericService<Student> genService = new StudentService(
new StudentDAO());
ArrayList<Student> studList = new ArrayList<Student>();
try {
studList = genService.getAll();
} catch (MyDaoException mDexcp) {
throw mDexcp;
}
XmlDomHandler mxh = new XmlDomHandler();
Transformer transformer = mxh.getTransformer();
Document doc = mxh.getDoc();
Element rootElement = mxh.getRootElement();
doc.appendChild(rootElement);
Element studenti = doc.createElement(LabParseStringConstants.STUD_ROOT);
rootElement.appendChild(studenti);
for (int i = 0; i < studList.size(); i++) {
Element student = doc
.createElement(LabParseStringConstants.STUD_TAG);
studenti.appendChild(student);
Element s_id = doc.createElement(LabParseStringConstants.STUD_ID);
student.appendChild(s_id);
s_id.appendChild(doc.createTextNode(Long.toString(studList.get(i)
.getStudentId())));
Element nume = doc.createElement(LabParseStringConstants.STUD_NUME);
student.appendChild(nume);
nume.appendChild(doc.createTextNode(studList.get(i).getNume()));
Element prenume = doc
.createElement(LabParseStringConstants.STUD_PRENUME);
student.appendChild(prenume);
prenume.appendChild(doc
.createTextNode(studList.get(i).getPrenume()));
Element grupa = doc
.createElement(LabParseStringConstants.STUD_GRUPA);
student.appendChild(grupa);
grupa.appendChild(doc.createTextNode(studList.get(i).getGrupa()));
Element email = doc
.createElement(LabParseStringConstants.STUD_EMAIL);
student.appendChild(email);
email.appendChild(doc.createTextNode(studList.get(i).getEmail()));
Element telFix = doc
.createElement(LabParseStringConstants.STUD_TEL_FIX);
student.appendChild(telFix);
telFix.appendChild(doc.createTextNode(studList.get(i).getTelFix()));
}
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
DOMSource source = new DOMSource(doc);
try {
transformer.transform(source, result);
} catch (TransformerException e) {
throw e;
}
String xmlString = sw.toString();
logger.info("Sfirsit methoda parser");
return xmlString;
}
} | [
"victordov2001@yahoo.com"
] | victordov2001@yahoo.com |
69458a5686d02e065a4266d20e345ec2e38494d9 | 72d77b70f018f04ac78fbfd9a6312117b1e64334 | /src/main/java/io/FileManagerFactory.java | 3f9bc369407004739cb06eb9566e3190f2ac75f7 | [] | no_license | ElexirMining/w2vModelTrainer | cc87a23cc050bcb4c2174479ec9f08bfad51b877 | 60f171e90c85deed9941a4ef6b7f93b469263ec0 | refs/heads/master | 2020-05-31T09:28:29.260081 | 2017-06-11T19:25:33 | 2017-06-11T19:25:33 | 94,026,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package io;
public class FileManagerFactory {
public static FileManager CreateByFS(String path, FileSystemTypeEnum fileSystemType){
switch (fileSystemType){
case WindowsFS:
return new WindowsFileManager(path);
case HDFS:
return new HdfsFileManager(path);
default:
return null;
}
}
public static FileManager CreateByCurrentFS(String path){
FileSystemTypeEnum currentFS = FSConfiguration.Instance.FileSystemType;
return CreateByFS(path, currentFS);
}
}
| [
"lena2k01@yandex.ru"
] | lena2k01@yandex.ru |
59bfe32e49b996dc381e4a49d00ad2ddb2787178 | f8252c5f77d1a332212036b90581266bed0ec324 | /Thinking_in_Java/src/generics/Ex34_SelfBoundTest.java | ef2a1d400d41d92f10a064b23a0942ceeeb1edd7 | [] | no_license | yeqing123/Thinking_in_java | 38da1c90e158f6d10291a86e90870d7844c265ac | a5013c6f358824d329872986cfbc07d149126bc5 | refs/heads/master | 2023-04-11T02:05:49.098992 | 2021-04-23T10:00:45 | 2021-04-23T10:00:45 | 296,249,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package generics;
abstract class SelfBounded<T extends SelfBounded<T>> {
abstract T process(T a);
T test() {
return process(null);
}
}
class Derived extends SelfBounded<Derived> {
Derived process(Derived d) {
if(d == null)
return this;
return d;
}
}
public class Ex34_SelfBoundTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
Derived d = new Derived();
System.out.println(d.test() == d.process(d));
}
}
| [
"yeqing_613@163.com"
] | yeqing_613@163.com |
d8321623d3432e19d908da610bfa62fac66bcf06 | 4ad17f7216a2838f6cfecf77e216a8a882ad7093 | /clbs/src/main/java/com/zw/platform/domain/vas/switching/SwitchType.java | b41d977aa6c49953339c3c833d53b8db83cb72f0 | [
"MIT"
] | permissive | djingwu/hybrid-development | b3c5eed36331fe1f404042b1e1900a3c6a6948e5 | 784c5227a73d1e6609b701a42ef4cdfd6400d2b7 | refs/heads/main | 2023-08-06T22:34:07.359495 | 2021-09-29T02:10:11 | 2021-09-29T02:10:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package com.zw.platform.domain.vas.switching;
import com.zw.platform.util.common.BaseFormBean;
import com.zw.platform.util.excel.annotation.ExcelField;
import lombok.Data;
/**
* <p>
* Title:开关类传感器类型
* <p>
* Copyright: Copyright (c) 2016
* <p>
* Company: ZhongWei
* <p>
* team: ZhongWeiTeam
*
* @version 1.0
* @author: nixiangqian
* @date 2017年06月21日 13:48
*/
@Data
public class SwitchType extends BaseFormBean {
@ExcelField(title = "功能ID")
private String identify;//功能ID
@ExcelField(title = "检测功能类型")
private String name;//名称
@ExcelField(title = "状态1")
private String stateOne;
@ExcelField(title = "状态2")
private String stateTwo;
@ExcelField(title = "备注")
private String description;//说明
/**
* 是否重复
*/
private Boolean isRepeat = false;
}
| [
"wuxuetao@zwlbs.com"
] | wuxuetao@zwlbs.com |
853c8b2136e6547c42e4edcdc00d9f9d66b2e572 | 86adc8ccbac1a6cb53c08b2b4c78021aba79e8be | /src/repl_it/Repl_It_079_Without_X_x.java | 97553c754b84fa1cc6237854eb29910648041104 | [] | no_license | okan-dogan/JavaProgrammingB15Online | 2067703806215cf741cc8f59730d8a8b8874738d | ea03e5756e265aacc4b6033a26c73e29aa9ceb4b | refs/heads/master | 2020-11-27T22:20:18.500159 | 2020-02-23T22:26:54 | 2020-02-23T22:26:54 | 229,624,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package repl_it;
import java.util.Scanner;
public class Repl_It_079_Without_X_x {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String word = scan.next();
if((word.startsWith("x")||word.startsWith("X"))&&(word.endsWith("x")||word.endsWith("X"))){
word=word.substring(1,word.length()-1);
}else if(word.startsWith("x")||word.startsWith("X")){
word=word.substring(1);
}else if(word.endsWith("x")||word.endsWith("X")){
word=word.substring(0,word.length()-1);
}
System.out.println(word);
}
}
| [
"okan2317@gmail.com"
] | okan2317@gmail.com |
053a3b6af89398c9bfdedc2282057689d443d6d3 | 9aed0d28d857d56e441b93f3daa231e7eb46ef8f | /app/src/main/java/hackathon_mobile_2016/randomio/activities/Unknown.java | 0c3dd38c444e328518799e634552635224195d32 | [] | no_license | ductri/Random.IO | 32be35cb491cf470875c2f3b9c99521a206de04a | 11b911c379713388a65f405d52d14f83fde33aa1 | refs/heads/master | 2021-01-11T07:01:50.298492 | 2019-06-24T15:14:10 | 2019-06-24T15:14:10 | 72,317,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,965 | java | package hackathon_mobile_2016.randomio.activities;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import java.util.List;
import hackathon_mobile_2016.randomio.R;
/**
* Created by Flynn on 10/29/2016.
*/
public class Unknown extends ArrayAdapter<Integer> implements SpinnerAdapter {
public Unknown(Context context, int resource, List<Integer> objects) {
super(context, resource, objects);
}
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Get the data item for this position
int color = getItem(position);
// Log.i("any view: ", String.valueOf(color));
// Check if an existing view is being reused, otherwise inflate the view
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.spinner_color, parent, false);
}
convertView.setBackgroundColor(color);
((TextView) convertView).setText("");
// Return the completed view to render on screen
return convertView;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
super.getDropDownView(position, convertView, parent);
int color = getItem(position);
// Log.i("any dropdown view: ", String.valueOf(color));
View rowView = convertView;
if (rowView == null) {
rowView = convertView = LayoutInflater.from(getContext()).inflate(R.layout.spinner_color, parent, false);
}
rowView.setBackgroundColor(color);
((TextView) rowView).setText("");
return rowView;
}
}
| [
"thehien115@gmail.com"
] | thehien115@gmail.com |
a6765fd2cbdb7e91256d422d4947003d7b00612f | 5fbd0f5186755161920fa2869a3f953f935b85fc | /app/src/main/java/com/example/alejandroisazad/myapplication/dao/DbHelper.java | 6bf6d436d5f1682bac9579dc2ea8fda97075602b | [] | no_license | hildyale/canciones | 149efcebb9a63eae1293505588bd9caad55bd7e5 | ad8f59653552ebf69d53325c1e84b5777f33090e | refs/heads/master | 2020-12-28T19:07:09.078375 | 2016-09-22T03:07:58 | 2016-09-22T03:07:58 | 68,759,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | package com.example.alejandroisazad.myapplication.dao;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.example.alejandroisazad.myapplication.Contract;
/**
* Created by alejandro.isazad on 20/09/16.
*/
public class DbHelper extends SQLiteOpenHelper{
private static final String TAG=DbHelper.class.getSimpleName();
public DbHelper(){
super(null,Contract.DB_NAME,null, Contract.DB_VERSION);
//
}
@Override
public void onCreate(SQLiteDatabase db){
String sql=String
.format("create table %s(%s int,%s text, %s text, %s text, %s text)",
Contract.CANCION,
Contract.Column.ID,
Contract.Column.TITULO,
Contract.Column.ALBUM,
Contract.Column.ARTISTA,
Contract.Column.RUTA
);
//Sentencia para crear tabla
Log.d(TAG, "onCreate with SQL: " + sql);
db.execSQL(sql);//Ejecución de la sentencia
}
//Se llama cada que el schema cambie(nueva versión)
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int NewVersion){
db.execSQL("drop table if exists "+ Contract.CANCION);//Borrar datos
onCreate(db);//Crear Tabla de nuevo
}
}
| [
"hildyale@gmail.com"
] | hildyale@gmail.com |
6c7fb5bb39182da1092aa814d3c195643c8df0da | 32ac55ca28bf9a8b2929ce03e02adf4e27472825 | /src/main/java/com/company/ChatroomApplication.java | 0236a9c16453ab639dbf9dde1db8c007a10cd448 | [] | no_license | GMLmihai/GruiaMihai_FinalProject_API | 0d28a2cb738f951bebce1ee0100644b4003c5d13 | f6744e607c28df09e3b971547ba8c4d3e9ccacd5 | refs/heads/master | 2023-06-25T06:44:07.924104 | 2021-07-26T14:35:32 | 2021-07-26T14:35:32 | 389,753,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.company;
import com.company.controller.hashers.HashAlgorithm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ChatroomApplication {
public static void main(String[] args) {
SpringApplication.run(ChatroomApplication.class, args);
}
} | [
"mihai.a.gruia@gmail.com"
] | mihai.a.gruia@gmail.com |
81e30068b24c3e8aa9c5b9328d69cecd8748d3aa | 81719679e3d5945def9b7f3a6f638ee274f5d770 | /aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/transform/ListDeploymentsRequestProtocolMarshaller.java | b9cb5c4415b4a62f0f26dd1ae940b1597fec2dd1 | [
"Apache-2.0"
] | permissive | ZeevHayat1/aws-sdk-java | 1e3351f2d3f44608fbd3ff987630b320b98dc55c | bd1a89e53384095bea869a4ea064ef0cf6ed7588 | refs/heads/master | 2022-04-10T14:18:43.276970 | 2020-03-07T12:15:44 | 2020-03-07T12:15:44 | 172,681,373 | 1 | 0 | Apache-2.0 | 2019-02-26T09:36:47 | 2019-02-26T09:36:47 | null | UTF-8 | Java | false | false | 2,686 | java | /*
* Copyright 2014-2019 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.greengrass.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.greengrass.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* ListDeploymentsRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ListDeploymentsRequestProtocolMarshaller implements Marshaller<Request<ListDeploymentsRequest>, ListDeploymentsRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON)
.requestUri("/greengrass/groups/{GroupId}/deployments").httpMethodName(HttpMethodName.GET).hasExplicitPayloadMember(false).hasPayloadMembers(false)
.serviceName("AWSGreengrass").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public ListDeploymentsRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<ListDeploymentsRequest> marshall(ListDeploymentsRequest listDeploymentsRequest) {
if (listDeploymentsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<ListDeploymentsRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
listDeploymentsRequest);
protocolMarshaller.startMarshalling();
ListDeploymentsRequestMarshaller.getInstance().marshall(listDeploymentsRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
97b9fbbaf842e4a5051e430d4dac40ccef459017 | 6c26a689f97750bec691547736b0834542360eb3 | /src/main/java/com/idvsbruck/pplflw/api/config/SecurityConfiguration.java | 34cd50a633f19f684286c8867f021cccd236f047 | [
"Apache-2.0"
] | permissive | IDVsbruck/peopleflow | 71bf4500e28679f3220ecff3b554ffdf616d0574 | 62ab6089a8b732a662388eaeb40d05d985bfb0d9 | refs/heads/master | 2023-04-20T08:49:14.272974 | 2021-04-23T11:09:06 | 2021-04-23T11:09:06 | 360,852,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,367 | java | package com.idvsbruck.pplflw.api.config;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
public void configure(final WebSecurity webSecurity) {
webSecurity.ignoring()
.antMatchers(HttpMethod.POST, "/authorization/signup", "/authorization/token")
.antMatchers(HttpMethod.GET, "/authorization/confirm");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
}
@Bean
public PasswordEncoder encoder() {
return new BCryptPasswordEncoder();
}
}
| [
"idvsbruck@Dmitrys-MacBook-Pro.local"
] | idvsbruck@Dmitrys-MacBook-Pro.local |
40968beea45aaa205b72f9c526a2dd762257ceb9 | c39e761e706874de80785515f01e6e3979b204e8 | /competition/AtCoder Beginner Contest 134/D - Preparing Boxes/Main.java | b0663b809854a2ce882b0440db59efba60435ba1 | [] | no_license | taksk/atcoder-solutions | 92e3ce49d64e3fe8b90335f2d132044cbcf35d4d | d6d0557dd363daf6d900f8fbdf159810498ead3b | refs/heads/master | 2021-07-08T21:34:02.683759 | 2020-08-02T15:47:08 | 2020-08-02T15:47:08 | 169,889,230 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,047 | java | import java.util.*;
import java.io.*;
public class Main {
private static void solve(){
//Implement solution here.
int n = ni();
int[] a = new int[n + 1];
int[] b = new int[n + 1];
int boxcnt = 0;
for(int i = 1; i <= n; i++) {
a[i] = ni();
}
for(int i = n; i > 0; i--) {
int ballcnt = 0;
for(int j = 2 * i; j <= n; j += i) {
ballcnt += b[j];
}
if(ballcnt % 2 != a[i]) {
b[i]++;
}
if(b[i] > 0)boxcnt++;
}
System.out.println(boxcnt);
for(int i = 1; i <= n; i++) {
if(b[i] > 0) {
System.out.print(i + " ");
}
}
}
//Switch input source (stdin/file)
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args){
String debugDataPath = System.getenv("DD_PATH");
if(debugDataPath != null){
try{
br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
}catch(Exception e){
throw new RuntimeException(e);
}
}
solve();
}
//Input read utility
private static StringTokenizer tokenizer = null;
public static String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(br.readLine());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
//Get next single int
private static int ni() {
return Integer.parseInt(next());
}
//Get next single long
private static long nl() {
return Long.parseLong(next());
}
//Get next single double
private static double nd() {
return Double.parseDouble(next());
}
//Get next int array from one line
private static int[] na(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
//Get next char array from one line
private static char[] ns() {
return next().toCharArray();
}
//Get next long array from one line
private static long[] nal(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nl();
return a;
}
}
| [
"sakashitatk@me.com"
] | sakashitatk@me.com |
85ebc4fad90cd309503edd1a4b9144f75525cce0 | 3e8d2fb683779be56149fc883ad93a33c6a687f7 | /source/Spring_MVC_Hibernate/src/com/springmvchibernate/dao/CustomerDao.java | 6a2641f7a67b6af9e5012e4419099ba38db7fe8e | [] | no_license | raghu153/Learnforlife | d63be2e59c77ddc0a04489caf9e21b4e9f436e00 | 0b9c04eb57dc82a3578d6b4c120ab71db9282e14 | refs/heads/master | 2020-03-27T02:18:24.353135 | 2018-08-23T01:23:07 | 2018-08-23T01:23:07 | 145,780,786 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.springmvchibernate.dao;
import java.util.List;
import com.springmvchibernate.entity.Customer;
public interface CustomerDao {
public List<Customer> getCustomers();
public void addCustomers(Customer customer);
public void putCustomers(Customer customer);
public void deleteCustomer(int customerid);
public Customer getCustomer(int id);
}
| [
"42627542+raghu153@users.noreply.github.com"
] | 42627542+raghu153@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.