text stringlengths 10 2.72M |
|---|
/*
* Copyright (c) 2014 ICM Uniwersytet Warszawski All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package pl.edu.icm.unity.server.translation.out;
import org.apache.log4j.NDC;
import pl.edu.icm.unity.exceptions.EngineException;
import pl.edu.icm.unity.server.translation.TranslationActionInstance;
import pl.edu.icm.unity.types.translation.TranslationActionType;
/**
* Base class of all output profile action instances.
* Ensures proper logging of action invocation.
* @author K. Benedyczak
*/
public abstract class OutputTranslationAction extends TranslationActionInstance
{
public OutputTranslationAction(TranslationActionType actionType, String[] parameters)
{
super(actionType, parameters);
}
public void invoke(TranslationInput input, Object mvelCtx, String currentProfile,
TranslationResult result) throws EngineException
{
try
{
NDC.push("[" + input + "]");
invokeWrapped(input, mvelCtx, currentProfile, result);
} finally
{
NDC.pop();
}
}
protected abstract void invokeWrapped(TranslationInput input, Object mvelCtx, String currentProfile,
TranslationResult result) throws EngineException;
}
|
package leetcode.solution;
/**
* 116. 填充每个节点的下一个右侧节点指针
* <p>
* https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node/
* <p>
* 给定一个 完美二叉树 ,其所有叶子节点都在同一层,每个父节点都有两个子节点。二叉树定义如下:
* <p>
* struct Node {
* int val;
* Node *left;
* Node *right;
* Node *next;
* }
* 填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL。
* <p>
* 初始状态下,所有 next 指针都被设置为 NULL。
* <p>
* 进阶:
* <p>
* 你只能使用常量级额外空间。
* 使用递归解题也符合要求,本题中递归程序占用的栈空间不算做额外的空间复杂度。
* <p>
* Solution: 利用辅助函数递归,覆盖全部链接情况,考虑不是同一父节点的情况
*/
public class Solution116 {
public Node connect(Node root) {
if (root == null || root.left == null) {
return root;
}
margeTwo(root.left, root.right);
return root;
}
/**
* 讲两个节点相关联
*
* @param node1 节点1
* @param node2 节点2
*/
private void margeTwo(Node node1, Node node2) {
if (node1 == null || node2 == null) {
return;
}
node1.next = node2;
margeTwo(node1.left, node1.right); //节点1的左右
margeTwo(node2.left, node2.right); //节点2的左右
margeTwo(node1.right, node2.left); //不同父节点的情况
}
public static void main(String[] args) {
Solution116 solution116 = new Solution116();
Node test = new Node(1);
test.left = new Node(2);
test.right = new Node(3);
test.left.left = new Node(4);
test.left.right = new Node(5);
test.right.left = new Node(6);
test.right.right = new Node(7);
solution116.connect(test);
while (test != null) {
Node tmp = test;
while (tmp != null) {
System.out.print(tmp.val);
tmp = tmp.next;
}
System.out.println();
test = test.left;
}
}
}
class Node {
public int val;
public Node left;
public Node right;
public Node next;
public Node() {
}
public Node(int _val) {
val = _val;
}
public Node(int _val, Node _left, Node _right, Node _next) {
val = _val;
left = _left;
right = _right;
next = _next;
}
};
|
package github.dwstanle.tickets;
import github.dwstanle.tickets.model.Account;
import github.dwstanle.tickets.model.Event;
import github.dwstanle.tickets.model.Section;
import github.dwstanle.tickets.model.Venue;
import github.dwstanle.tickets.repository.*;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import static github.dwstanle.tickets.util.SeatMapStrings.SIMPLE_LAYOUT_STR;
@SpringBootApplication
public class TicketsApplication {
public static void main(String[] args) {
SpringApplication.run(TicketsApplication.class, args);
}
@Bean
CommandLineRunner init(AccountRepository accountRepository,
EventRepository eventRepository,
ReservationRepository reservationRepository,
SectionRepository sectionRepository,
VenueRepository venueRepository) {
return new CommandLineRunner() {
@Override
public void run(String... args) throws Exception {
Section section = sectionRepository.save(new Section(loadDemoStr()));
Venue venue = venueRepository.save(Venue.builder().section(section).build());
section.setVenue(venue);
section.setName("A");
sectionRepository.save(section);
Event event = eventRepository.save(new Event("demoEvent", venue));
Account account = accountRepository.save(new Account("demo@fakeemail.com"));
}
};
}
private String loadDemoStr() throws URISyntaxException, IOException {
Path path = Paths.get(ClassLoader.getSystemResource("DemoLayout.csv").toURI());
return SeatMap.fromPath(path).toString();
}
}
|
package com.amundi.tech.onsite.db.model;
import lombok.Data;
import javax.persistence.*;
import java.time.LocalDate;
@Entity
@Data
public class RestaurantCapacity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@ManyToOne
@JoinColumn(name = "restaurant", nullable = false)
private RestaurantDefinition restaurant;
@Column(name = "startDate", nullable = false)
private LocalDate startDate;
@Column(name = "endDate", nullable = false)
private LocalDate endDate;
// Arrivals -----------------------------
@Column(name = "arrival_1130")
private int arrival_1130;
@Column(name = "arrival_1200")
private int arrival_1200;
@Column(name = "arrival_1230")
private int arrival_1230;
@Column(name = "arrival_1300")
private int arrival_1300;
@Column(name = "arrival_1330")
private int arrival_1330;
}
|
package com.itfacesystem.domain.sourcegenerator;
import java.io.Serializable;
/**
* Created by wangrongtao on 16/3/16.
*/
public class FieldModel implements Serializable {
private String type;
private String id;
private String name;
private boolean queryAble;
private boolean showInList;
private boolean showInEditForm;
private boolean showInReadForm;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isShowInList() {
return showInList;
}
public void setShowInList(boolean showInList) {
this.showInList = showInList;
}
public boolean isShowInEditForm() {
return showInEditForm;
}
public void setShowInEditForm(boolean showInEditForm) {
this.showInEditForm = showInEditForm;
}
public boolean isShowInReadForm() {
return showInReadForm;
}
public void setShowInReadForm(boolean showInReadForm) {
this.showInReadForm = showInReadForm;
}
public boolean isQueryAble() {
return queryAble;
}
public void setQueryAble(boolean queryAble) {
this.queryAble = queryAble;
}
}
|
package com.everysports.service;
import com.everysports.domain.PaymentVO;
public interface PaymentService {
public PaymentVO selectPayment(Long teacher_ID, Long class_ID);
}
|
package com.robin.springboot.demo.java_designPatterns.adapter;
/**
* 调用的接口
*/
public interface A {
void a();
}
|
package com.bridgelabz.linkedlist;
public class LinkedList<K> {
Node<K> head;
Node<K> tail;
public LinkedList() {
this.head = null;
this.tail = null;
}
// Method to add element at first
public void addFirst(K key) {
Node<K> newNode = new Node<K>(key);
if (tail == null) {
tail = newNode;
}
if (head == null) {
head = newNode;
} else {
Node<K> tempNode = head;
head = newNode;
head.setNext(tempNode);
}
}
// Method to append linked list
public void append(K key) {
Node<K> newNode = new Node<K>(key);
if (tail == null) {
tail = newNode;
}
if (head == null) {
head = newNode;
} else {
Node<K> tempNode = tail;
tempNode.setNext(newNode);
tail = newNode;
}
}
// Method to insert element at the given index
public void insert(int index, K key) {
if (index == 0) {
addFirst(key);
} else if (index == getLength()) {
append(key);
} else if (index > getLength()) {
System.out.println("Index is out of bound");
} else if (index < getLength()) {
Node<K> newNode = new Node<K>(key);
Node<K> tempNode = head;
for (int i = 0; i <= index - 2; i++) {
tempNode = tempNode.getNext();
}
newNode.setNext(tempNode.getNext());
tempNode.setNext(newNode);
}
}
// Method to get length of linked list
public int getLength() {
int length = 0;
Node<K> node = head;
while (node.getNext() != null) {
length++;
node = node.getNext();
}
return length + 1;
}
// Method to delete first element
public K pop() {
Node<K> tempNode = head;
head = head.getNext();
return tempNode.getKey();
}
// Method to delete last element
public K popLast() {
K element = null;
Node<K> tempNode = head;
while (tempNode.getNext().getNext() != null) {
tempNode = tempNode.getNext();
element = tempNode.getNext().getKey();
}
tail = tempNode;
tempNode.setNext(null);
return element;
}
// Method to delete when index is given
public K delete(int index) {
K element=null;
if(index==0)
element = pop();
else if(index==getLength())
element = popLast();
else {
Node<K> tempNode = head;
for (int i = 0; i <= index - 2; i++) {
tempNode = tempNode.getNext();
}
element = tempNode.getKey();
Node<K> node = tempNode.getNext();
tempNode.setNext(node.getNext());
}
return element;
}
// Method to search linked list with given key
public int search(K key) {
int index = 0;
Node<K> tempNode = head;
while (tempNode.getNext() != null) {
if (tempNode.getKey().equals(key))
break;
tempNode = tempNode.getNext();
index++;
}
return index;
}
// Method to insert element after a given key
public void insertAfterKey(K key1, K key2) {
insert(search(key1) + 1, key2);
}
// Method to delete element after a given key
public K deleteKey(K key) {
int index = search(key);
K element = delete(index);
return element;
}
//Method to find maximum between two keys
public <K extends Comparable<K>> boolean isgreater(K key1, K key2){
if(key2.compareTo(key1)>0)
return false;
return true;
}
//Method to sort list
public <K extends Comparable<K>> void sortList() {
Node<K> tempNode = (Node<K>) head;
Node<K> currentNode = null;
K tempKey;
while(tempNode!=null) {
currentNode = tempNode.getNext();
while(currentNode!=null) {
if(isgreater(tempNode.getKey(),currentNode.getKey())) {
tempKey = tempNode.getKey();
tempNode.setKey(currentNode.getKey());
currentNode.setKey(tempKey);
}
currentNode = currentNode.getNext();
}
tempNode = tempNode.getNext();
}
}
// Method to print linked list
public void printLinkedList() {
System.out.println("Linked List");
Node<K> node = head;
while (node.getNext() != null) {
System.out.print(node.getKey());
if (!(node.equals(tail))) {
System.out.print("->");
}
node = node.getNext();
}
System.out.print(node.getKey());
}
}
|
public class Transportation {
private int id;
private int type;
private double MAX_LOAD;
private double load;
private double speed;
private double charge;
public Transportation(int type, int max, int speed, int charge, int load) {
// TODO Auto-generated constructor stub
this.type = type;
this.load = load;
this.speed = speed;
this.charge = charge;
this.MAX_LOAD = max;
}
public void reduceLoad(int load) {
this.load -= load;
}
public double getCharge() {
return charge;
}
public int getId() {
return id;
}
public double getLoad() {
return load;
}
public double getSpeed() {
return speed;
}
public int getType() {
return type;
}
public void setCharge(double charge) {
this.charge = charge;
}
public boolean addLoad(double load) {
if(this.load + load < MAX_LOAD) {
this.load += load;
return true;
}
return false;
}
public boolean subLoad(double load) {
if(this.load - load > 0) {
this.load -= load;
return true;
}
return false;
}
public void setSpeed(double speed) {
this.speed = speed;
}
}
|
/*
* Copyright (c) 2015 ICM Uniwersytet Warszawski All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package pl.edu.icm.unity.server.translation.form;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.NDC;
import pl.edu.icm.unity.confirmations.ConfirmationRedirectURLBuilder;
import pl.edu.icm.unity.exceptions.EngineException;
import pl.edu.icm.unity.exceptions.InternalException;
import pl.edu.icm.unity.server.registries.RegistrationActionsRegistry;
import pl.edu.icm.unity.server.registries.TypesRegistryBase;
import pl.edu.icm.unity.server.translation.ExecutionBreakException;
import pl.edu.icm.unity.server.translation.TranslationActionFactory;
import pl.edu.icm.unity.server.translation.TranslationActionInstance;
import pl.edu.icm.unity.server.translation.TranslationCondition;
import pl.edu.icm.unity.server.translation.TranslationProfileInstance;
import pl.edu.icm.unity.server.translation.form.RegistrationMVELContext.RequestSubmitStatus;
import pl.edu.icm.unity.server.translation.form.TranslatedRegistrationRequest.AutomaticRequestAction;
import pl.edu.icm.unity.server.translation.form.action.AutoProcessActionFactory;
import pl.edu.icm.unity.server.translation.form.action.ConfirmationRedirectActionFactory;
import pl.edu.icm.unity.server.translation.form.action.RedirectActionFactory;
import pl.edu.icm.unity.server.translation.form.action.SubmitMessageActionFactory;
import pl.edu.icm.unity.server.utils.Log;
import pl.edu.icm.unity.types.I18nMessage;
import pl.edu.icm.unity.types.basic.Attribute;
import pl.edu.icm.unity.types.basic.IdentityParam;
import pl.edu.icm.unity.types.registration.BaseForm;
import pl.edu.icm.unity.types.registration.BaseRegistrationInput;
import pl.edu.icm.unity.types.registration.GroupRegistrationParam;
import pl.edu.icm.unity.types.registration.RegistrationContext;
import pl.edu.icm.unity.types.registration.Selection;
import pl.edu.icm.unity.types.registration.UserRequestState;
import pl.edu.icm.unity.types.translation.ProfileType;
import pl.edu.icm.unity.types.translation.TranslationRule;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Classic translation profile used for post-processing registration requests.
* @author K. Benedyczak
*/
public abstract class BaseFormTranslationProfile extends TranslationProfileInstance
<RegistrationTranslationAction, RegistrationTranslationRule>
{
private static final Logger log = Log.getLogger(Log.U_SERVER_TRANSLATION, BaseFormTranslationProfile.class);
public BaseFormTranslationProfile(ObjectNode json, RegistrationActionsRegistry registry)
{
super(json, registry);
}
public BaseFormTranslationProfile(String name, List<? extends TranslationRule> rules,
TypesRegistryBase<? extends TranslationActionFactory> registry)
{
super(name, "", ProfileType.REGISTRATION, rules, registry);
}
public TranslatedRegistrationRequest translate(BaseForm form,
UserRequestState<? extends BaseRegistrationInput> request)
throws EngineException
{
NDC.push("[TrProfile " + getName() + "]");
Map<String, Object> mvelCtx = new RegistrationMVELContext(form, request.getRequest(),
RequestSubmitStatus.submitted,
request.getRegistrationContext().triggeringMode,
request.getRegistrationContext().isOnIdpEndpoint,
request.getRequestId());
return executeFilteredActions(form, request.getRequest(), mvelCtx, null);
}
public AutomaticRequestAction getAutoProcessAction(BaseForm form,
UserRequestState<? extends BaseRegistrationInput> request, RequestSubmitStatus status)
{
Map<String, Object> mvelCtx = new RegistrationMVELContext(form, request.getRequest(), status,
request.getRegistrationContext().triggeringMode,
request.getRegistrationContext().isOnIdpEndpoint,
request.getRequestId());
TranslatedRegistrationRequest result;
try
{
result = executeFilteredActions(form,
request.getRequest(), mvelCtx, AutoProcessActionFactory.NAME);
} catch (EngineException e)
{
log.error("Couldn't establish automatic request processing action from profile", e);
return null;
}
return result.getAutoAction();
}
public I18nMessage getPostSubmitMessage(BaseForm form, BaseRegistrationInput request,
RegistrationContext context, String requestId)
{
Map<String, Object> mvelCtx = new RegistrationMVELContext(form, request, RequestSubmitStatus.submitted,
context.triggeringMode, context.isOnIdpEndpoint, requestId);
TranslatedRegistrationRequest result;
try
{
result = executeFilteredActions(form, request, mvelCtx, SubmitMessageActionFactory.NAME);
} catch (EngineException e)
{
log.warn("Couldn't establish post submission message from profile", e);
return null;
}
return result.getPostSubmitMessage();
}
public String getPostSubmitRedirectURL(BaseForm form, BaseRegistrationInput request,
RegistrationContext context, String requestId)
{
Map<String, Object> mvelCtx = new RegistrationMVELContext(form, request, RequestSubmitStatus.submitted,
context.triggeringMode, context.isOnIdpEndpoint, requestId);
TranslatedRegistrationRequest result;
try
{
result = executeFilteredActions(form, request, mvelCtx, RedirectActionFactory.NAME);
} catch (EngineException e)
{
log.warn("Couldn't establish redirect URL from profile", e);
return null;
}
return result.getRedirectURL();
}
public String getPostCancelledRedirectURL(BaseForm form, RegistrationContext context)
{
Map<String, Object> mvelCtx = new RegistrationMVELContext(form, RequestSubmitStatus.notSubmitted,
context.triggeringMode, context.isOnIdpEndpoint);
TranslatedRegistrationRequest result;
try
{
result = executeFilteredActions(form, null, mvelCtx, RedirectActionFactory.NAME);
} catch (EngineException e)
{
log.warn("Couldn't establish redirect URL from profile", e);
return null;
}
return result.getRedirectURL();
}
public String getPostConfirmationRedirectURL(BaseForm form, UserRequestState<?> request,
IdentityParam confirmed, String requestId)
{
return getPostConfirmationRedirectURL(form, request.getRequest(), request.getRegistrationContext(),
requestId,
ConfirmationRedirectURLBuilder.ConfirmedElementType.identity.toString(),
confirmed.getTypeId(), confirmed.getValue());
}
public String getPostConfirmationRedirectURL(BaseForm form, UserRequestState<?> request,
Attribute<?> confirmed, String requestId)
{
return getPostConfirmationRedirectURL(form, request.getRequest(), request.getRegistrationContext(),
requestId,
ConfirmationRedirectURLBuilder.ConfirmedElementType.attribute.toString(),
confirmed.getName(), confirmed.getValues().get(0).toString());
}
private String getPostConfirmationRedirectURL(BaseForm form, BaseRegistrationInput request,
RegistrationContext regContxt, String requestId,
String cType, String cName, String cValue)
{
RegistrationMVELContext mvelCtx = new RegistrationMVELContext(form, request,
RequestSubmitStatus.submitted,
regContxt.triggeringMode, regContxt.isOnIdpEndpoint, requestId);
mvelCtx.addConfirmationContext(cType, cName, cValue);
TranslatedRegistrationRequest result;
try
{
result = executeFilteredActions(form,
request, mvelCtx, ConfirmationRedirectActionFactory.NAME);
} catch (EngineException e)
{
log.error("Couldn't establish redirect URL from profile", e);
return null;
}
return "".equals(result.getRedirectURL()) ? null : result.getRedirectURL();
}
protected TranslatedRegistrationRequest executeFilteredActions(BaseForm form,
BaseRegistrationInput request, Map<String, Object> mvelCtx,
String actionNameFilter) throws EngineException
{
if (log.isDebugEnabled())
log.debug("Unprocessed data from registration request:\n" + mvelCtx);
try
{
int i=1;
TranslatedRegistrationRequest translationState = initializeTranslationResult(form, request);
for (RegistrationTranslationRule rule: ruleInstances)
{
String actionName = rule.getAction().getName();
if (actionNameFilter != null && !actionNameFilter.equals(actionName))
continue;
NDC.push("[r: " + (i++) + "]");
try
{
rule.invoke(translationState, mvelCtx, getName());
} catch (ExecutionBreakException e)
{
break;
} finally
{
NDC.pop();
}
}
return translationState;
} finally
{
NDC.pop();
}
}
protected TranslatedRegistrationRequest initializeTranslationResult(BaseForm form,
BaseRegistrationInput request)
{
TranslatedRegistrationRequest initial = new TranslatedRegistrationRequest();
if (request == null)
return initial;
request.getAttributes().stream().
filter(a -> a != null).
forEach(a -> initial.addAttribute(a));
request.getIdentities().stream().
filter(i -> i != null).
forEach(i -> initial.addIdentity(i));
for (int i = 0; i<request.getGroupSelections().size(); i++)
{
GroupRegistrationParam groupRegistrationParam = form.getGroupParams().get(i);
Selection selection = request.getGroupSelections().get(i);
if (selection != null && selection.isSelected())
initial.addMembership(new GroupParam(groupRegistrationParam.getGroupPath(),
selection.getExternalIdp(), selection.getTranslationProfile()));
}
return initial;
}
@Override
protected RegistrationTranslationRule createRule(TranslationActionInstance action,
TranslationCondition condition)
{
if (!(action instanceof RegistrationTranslationAction))
{
throw new InternalException("The translation action of the input translation "
+ "profile is not compatible with it, it is " + action.getClass());
}
return new RegistrationTranslationRule((RegistrationTranslationAction) action, condition);
}
}
|
package ch.mitti.geometrische_figuren;
import java.awt.geom.*; //Alle Klassen des Geometrie-Pakets
public class Kreis extends Figur {
// Attribute
private int radius; //Radius des Kreises
//Konstruktor
public Kreis() {
super(50,50,"blue");
this.radius=10;
this.draw();
}
public Kreis(int xPosition, int yPosition, int radius, String color) {
super(xPosition, yPosition, color);
this.radius=radius;
this.draw();
}
// Dienste
public void draw(){ //mit private und public ausprobieren
Canvas canvas = Canvas.getCanvas();
canvas.draw(this, super.getColor(), "Kreis", new Ellipse2D.Double(super.getxPosition(), super.getyPosition(), radius, radius));
}
}
|
package com.delaroystudios.teacherassistant;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
/**
* Created by Sourabh Amancha on 2/3/2017.
*/
public class admin2 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.admin2);
}
public void onadmin2 (View v)
{
if(v.getId() == R.id.vsButton)
{
Intent ivs = new Intent(admin2.this, viewstaff.class);
startActivity(ivs);
}
if(v.getId() == R.id.rnButton)
{
Intent irn = new Intent(admin2.this, register_new_member.class);
startActivity(irn);
}
}
}
|
/*
* 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 org.exolin.sudoku.solver.view;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.font.LineMetrics;
import java.util.function.Supplier;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import org.exolin.sudoku.solver.Position;
import org.exolin.sudoku.solver.SudokoCell;
/**
* Zeigt eine einzelne Zelle des Sudokus an.
*
* @author Thomas
*/
public class CellView extends JTextField
{
private final Supplier<Boolean> onEdit;
private final SudokoCell cell;
public CellView(SudokoCell cell, Supplier<Boolean> onEdit)
{
this.cell = cell;
setPreferredSize(new Dimension(40, 40));
setFont(new Font(getFont().getFontName(), 0, 30));
setHorizontalAlignment(CENTER);
setBorder(new EmptyBorder(0, 0, 0, 0));
this.onEdit = onEdit;
addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e)
{
}
@Override
public void focusLost(FocusEvent e)
{
String txt = getText();
if(!txt.isEmpty())
cell.setGivenNumber(Integer.parseInt(txt));
else
cell.setNoGivenNumber();
}
});
}
public void onChanged()
{
setForeground(cell.isNumberGiven() ? Color.BLUE : Color.BLACK);
if(cell.isComplete())
setText(cell.getDisplayNumber());
else
setText("");
repaint();
}
@Override
public void paint(Graphics g)
{
if(cell.isComplete() || onEdit.get())
{
super.paintComponent(g);
}else{
Graphics2D g2 = (Graphics2D)g;
g2.clearRect(0, 0, getWidth(), getHeight());
double bw = getWidth() / 3.0;
double bh = getHeight()/ 3.0;
g2.setFont(new Font(getFont().getFontName(), 0, 10));
for(int number : cell.getPossibleValues())
{
Position p = Position.fromNumber(number);
// g2.setColor(Color.BLACK);
// g2.fillRect(
// (int)(p.getColumn()*bw),
// (int)(p.getRow()*bh),
// (int)bw,
// (int)bh);
LineMetrics lineMetrics = g2.getFontMetrics().getLineMetrics(number+"", g);
// g2.setColor(Color.WHITE);
g2.drawString(number+"",
(int)(p.getColumn()*bw + bw / 2 - g.getFontMetrics().stringWidth(number+"")/2),
(int)(p.getRow()*bh) + lineMetrics.getAscent());
}
}
}
}
|
package com.foxweave.connector.cloudant.query;
import com.foxweave.connector.cloudant.CloudantInputConnector;
import com.foxweave.connector.cloudant.InputQueryHandler;
import com.foxweave.exception.FoxWeaveException;
import com.foxweave.http.HttpUtil;
import com.foxweave.internal.util.ExchangeUtil;
import com.foxweave.internal.util.StreamUtils;
import com.foxweave.json.streaming.JSONObjectCallback;
import com.foxweave.json.streaming.JSONStreamer;
import com.foxweave.pipeline.exchange.EntityState;
import com.foxweave.pipeline.exchange.Exchange;
import com.foxweave.pipeline.exchange.Message;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class ViewQueryHandler implements InputQueryHandler {
private static final Logger logger = LoggerFactory.getLogger(ViewQueryHandler.class);
private static final String LAST_KEY_CACHE_KEY = CloudantInputConnector.class.getName() + "#LAST_KEY_CACHE_KEY";
private static final String WEAVE_NO_DOCS = "$WEAVE-NO-DOCS$";
private CloudantInputConnector cloudantInputConnector;
@Override
public void setCloudantInputConnector(CloudantInputConnector cloudantInputConnector) {
this.cloudantInputConnector = cloudantInputConnector;
}
@Override
public void poll() throws Exception {
String lastKey = getLastKey();
if (lastKey == null) {
if (cloudantInputConnector.getPipelineContext().isSync()) {
initializeStartKey();
return;
}
}
GetMethod method = new GetMethod(cloudantInputConnector.requestURI.toString());
try {
if (lastKey != null && !lastKey.equals(WEAVE_NO_DOCS)) {
// FIXME: multiple docs can have the same key. This dos not allow for that.
NameValuePair[] queryParams = new NameValuePair[2];
queryParams[0] = new NameValuePair("startkey", lastKey);
queryParams[1] = new NameValuePair("skip", "1");
method.setQueryString(queryParams);
}
method.setRequestHeader("Authorization", "Basic " + cloudantInputConnector.encodedAuthCredentials);
if (logger.isDebugEnabled()) {
logger.debug("Executing Cloudant View poll: {}", method.getURI());
}
if (HttpUtil.getHttpClient().executeMethod(method) == 200) {
InputStream dataStream = method.getResponseBodyAsStream();
if (dataStream != null) {
try {
String charEnc = method.getResponseCharSet();
if (charEnc == null) {
charEnc = "UTF-8";
}
InputStreamReader dataStreamReader = new InputStreamReader(dataStream, charEnc);
try {
ViewCallback callback = new ViewCallback();
try {
JSONStreamer jsonStreamer = new JSONStreamer(callback, "rows");
jsonStreamer.stream(dataStreamReader);
} finally {
callback.endExchange();
}
} finally {
StreamUtils.safeClose(dataStreamReader);
}
} finally {
StreamUtils.safeClose(dataStream);
}
}
} else {
if (logger.isDebugEnabled()) {
logger.debug("Cloudant View poll failed: {} - {}", method.getStatusCode(), method.getResponseBodyAsString());
}
}
} finally {
method.releaseConnection();
}
}
private void initializeStartKey() throws IOException, JSONException {
GetMethod method = new GetMethod(cloudantInputConnector.requestURI.toString());
NameValuePair[] queryParams = new NameValuePair[2];
queryParams[0] = new NameValuePair("limit", "1");
queryParams[1] = new NameValuePair("descending", "true");
method.setQueryString(queryParams);
method.setRequestHeader("Authorization", "Basic " + cloudantInputConnector.encodedAuthCredentials);
if (HttpUtil.getHttpClient().executeMethod(method) == 200) {
JSONObject responseJSON = new JSONObject(method.getResponseBodyAsString());
long total_rows = responseJSON.getLong("total_rows");
if (total_rows == 0) {
storeLastStartKey(WEAVE_NO_DOCS);
} else {
Object key = responseJSON.getJSONArray("rows").getJSONObject(0).get("key");
storeLastStartKey(key.toString());
}
}
}
private void storeLastStartKey(String seq) {
cloudantInputConnector.getPipelineContext().getPipelineScopedCache().put(LAST_KEY_CACHE_KEY, seq);
}
private String getLastKey() {
return (String) cloudantInputConnector.getPipelineContext().getPipelineScopedCache().get(LAST_KEY_CACHE_KEY);
}
private class ViewCallback implements JSONObjectCallback {
private Exchange exchange;
@Override
public boolean onJSONObject(JSONObject jsonObject) {
JSONObject doc = jsonObject.optJSONObject("value");
if (doc == null) {
logger.warn("Cloudant view document without a 'value' element? Potential JSONStreamer issue!");
return cloudantInputConnector.pollContext.okayToContinue();
}
if (exchange == null) {
exchange = cloudantInputConnector.exchangeFactory.newExchange();
exchange.start();
}
Message message = exchange.newMessage();
message.setPayload(doc);
exchange.send(message);
if (exchange.getState() != EntityState.OK) {
return false;
}
storeLastStartKey(jsonObject.optString("key"));
return cloudantInputConnector.pollContext.okayToContinue();
}
private void endExchange() {
if (exchange != null) {
logger.debug("Sync'd {} doc(s) from '{}'.", ExchangeUtil.getMessageCount(exchange), cloudantInputConnector.requestURI);
exchange.end();
} else {
logger.debug("Nothing to sync from '{}'.", cloudantInputConnector.requestURI);
}
}
@Override
public void onException(Exception e) throws Exception {
throw new FoxWeaveException("Error processing Cloudant view stream: " + cloudantInputConnector.getRESTResource(), e);
}
}
}
|
package com.gaoshin.onsalelocal.osl.entity;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class FollowDetailsList {
private User user;
private List<FollowDetails> items = new ArrayList<FollowDetails>();
public List<FollowDetails> getItems() {
return items;
}
public void setItems(List<FollowDetails> items) {
this.items = items;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
|
package lk.logic;
/**
*@author Veranga Sooriyabandara
*Our Java Class
*/
public interface UserInterface {
public boolean checkUserCredential(String username,String password);
}
|
package proeza.sah.desktop.core;
import org.springframework.beans.factory.annotation.Autowired;
import com.digi.xbee.api.exceptions.XBeeException;
import com.guiBuilder.api.component.application.DesktopApp;
import proeza.sah.device.DeviceNetwork;
public class MainApp extends DesktopApp<MainFrame, Splash> {
@Autowired
private DeviceNetwork deviceNetwork;
@Autowired
private Splash splash;
@Override
protected Splash createSplash() {
return this.splash;
}
@Override
protected void authenticateUser() {
}
@Override
protected void challengeUser() {
}
@Override
protected void init() {
try {
this.deviceNetwork.createNetwork();
} catch (XBeeException e) {
e.printStackTrace();
}
}
@Override
protected MainFrame createMainFrame() {
return new MainFrame();
}
} |
package algo.backtracking;
/**
* Created by orca on 2018/12/28.
*问题;正则表达式匹配
* 输入:正则表达式、字符串
* 输出:是否匹配
*/
public class Pattern {
public boolean match = false;
public void match(int i,int j,String in,String p){
}
}
|
package structural.decorator.my.htmldemo.decorators;
import structural.decorator.my.htmldemo.htmlnodes.HtmlNode;
// 祖先包装器
public class Decorator extends HtmlNode{
// 引用 HtmlNode 对象
protected HtmlNode htmlNode;
public Decorator(HtmlNode node) { htmlNode = node; }
@Override
public String getText() {
return htmlNode.getText();
}
@Override
public void setText(String text) {
htmlNode.setText(text);
}
}
|
/*
* 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 dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import model.Trainer;
import utils.DBUtils;
/**
*
* @author Los_e
*/
public class TrainerDAO {
public static ArrayList<Trainer> getAllTrainers() {
ArrayList<Trainer> list = new ArrayList<Trainer>();
Connection con = DBUtils.getConnection();
PreparedStatement pst = null;
String sql = "select * from trainers";
try {
pst = con.prepareStatement(sql);
ResultSet rs = pst.executeQuery(sql);
while (rs.next()) {
Trainer trainer = new Trainer();
trainer.setTrainerid(rs.getInt(1));
trainer.setFirstname(rs.getString(2));
trainer.setLastname(rs.getString(3));
trainer.setSubject(rs.getString(4));
list.add(trainer);
}
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
pst.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
try {
con.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
}
return list;
}
public Trainer getTrainerById(int trainerid) {
Trainer trainer = new Trainer();
Connection con = DBUtils.getConnection();
PreparedStatement pst = null;
String sql = "select * from trainers where trainerid=?;";
try {
pst = con.prepareStatement(sql);
pst.setInt(1, trainerid);
ResultSet rs = pst.executeQuery();
while (rs.next()) {
trainer.setTrainerid(rs.getInt(1));
trainer.setFirstname(rs.getString(2));
trainer.setLastname(rs.getString(3));
trainer.setSubject(rs.getString(4));
}
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
pst.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
try {
con.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
}
return trainer;
}
public static void insertTrainer(Trainer trainer) {
Connection con = DBUtils.getConnection();
PreparedStatement pst = null;
String sql = "insert into trainers(trainerid, firstname, lastname, subject) values (?, ?, ?, ?)";
boolean result = false;
try {
pst = con.prepareStatement(sql);
pst.setInt(1, trainer.getTrainerid());
pst.setString(2, trainer.getFirstname());
pst.setString(3, trainer.getLastname());
pst.setString(4, trainer.getSubject());
pst.executeUpdate();
result = true;
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
result = false;
} finally {
try {
pst.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
try {
con.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (result) {
System.out.println("Inserted new Trainer");
}
// return result;
}
public static void updateTrainer(Trainer trainer) {
Connection con = DBUtils.getConnection();
PreparedStatement pst = null;
String sql = "UPDATE trainers SET firstname = ? /*1*/, lastname= ? /*2*/, subject = ? /*3*/ WHERE trainerid = ? /*4*/";
boolean result = false;
try {
pst = con.prepareStatement(sql);
pst.setString(1, trainer.getFirstname());
pst.setString(2, trainer.getLastname());
pst.setString(3, trainer.getSubject());
pst.setInt(4, trainer.getTrainerid());
pst.executeUpdate();
result = true;
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
result = false;
} finally {
try {
pst.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
try {
con.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (result) {
System.out.println("Updated Trainer");
}
// return result;
}
public static void deleteTrainer(int trainerid) {
Connection con = DBUtils.getConnection();
PreparedStatement pst = null;
String sql = "DELETE FROM trainers WHERE trainerid = ?";
boolean result = false;
try {
pst = con. prepareStatement(sql);
pst.setInt(1, trainerid);
pst.executeUpdate();
result = true;
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
result = false;
} finally {
try {
pst.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
try {
con.close();
} catch (SQLException ex) {
Logger.getLogger(TrainerDAO.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (result) {
System.out.println("Deleted Trainer");
}
// return result;
}
}
|
package com.csalazar.activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.i("LifeCycle", "onCreate");
if((savedInstanceState != null) && (savedInstanceState.containsKey("valor"))){
String valor = savedInstanceState.getString("valor");
Log.i("InstanceState", valor);
}
}
@Override
protected void onStart(){
super.onStart();
Log.i("LifeCycle", "onStart");
}
@Override
protected void onResume(){
super.onResume();
Log.i("LifeCycle", "onResume");
}
@Override
protected void onRestart(){
super.onRestart();
Log.i("Lifecycle", "onRestart");
}
@Override
protected void onStop(){
super.onStop();
Log.i("LifeCycle", "onStop");
}
@Override
protected void onPause(){
super.onPause();
Log.i("LifeCycle", "onPause");
}
@Override
protected void onDestroy(){
super.onDestroy();
Log.i("LifeCycle", "onDestroy");
}
public void openResult(View view){
Intent intent = new Intent(this, ResultActivity.class);
startActivityForResult(intent, 1001);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if((resultCode == RESULT_OK) && (requestCode == 1001)){
String message = data.getStringExtra("message");
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
}
}
@Override
protected void onSaveInstanceState(Bundle state){
super.onSaveInstanceState(state);
Log.i("LifeCycle", "onSaveInstanceState");
state.putString("valor", "Valor para restaurar");
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState){
super.onRestoreInstanceState(savedInstanceState);
Log.i("LifeCycle", "onRestoreInstanceState");
if((savedInstanceState != null) && (savedInstanceState.containsKey("valor"))){
String valor = savedInstanceState.getString("valor");
Log.i("InstanceState", valor);
}
}
}
|
package edu.asu.commons.net.event;
import edu.asu.commons.event.AbstractEvent;
import edu.asu.commons.net.Identifier;
/**
* $Id$
*
* Signifies that a disconnection should happen for the given identifier.
*
* @author Allen Lee
* @version $Revision$
*/
public class DisconnectionRequest extends AbstractEvent {
private static final long serialVersionUID = 8135584626891675116L;
private final Throwable exception;
public DisconnectionRequest(Identifier id) {
this(id, null);
}
public DisconnectionRequest(Identifier id, Throwable exception) {
super(id);
this.exception = exception;
}
public Throwable getException() {
return exception;
}
public String toString() {
return "Disconnecting id " + id + " due to exception: " + exception;
}
}
|
package com.everis.controller;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.everis.dal.JdbcClienteDao;
import com.everis.dal.JdbcProjetoDao;
import com.everis.entidades.Projeto;
@RequestMapping("/projeto")
@Controller
public class ProjetoController {
private ApplicationContext context;
private JdbcClienteDao clienteDao;
private JdbcProjetoDao projetoDao;
public ProjetoController() {
/* Realiza a instanciação de um bean descrito no XML */
this.context = new ClassPathXmlApplicationContext("beanJDBC.xml");
this.clienteDao = (JdbcClienteDao) context.getBean("jdbcClienteDao");
this.projetoDao = (JdbcProjetoDao) context.getBean("jdbcProjetoDao");
}
@RequestMapping(value = "/cadastro", method = RequestMethod.GET)
public ModelAndView incluirProjetoForm() {
ModelAndView mv = new ModelAndView("projeto/cadastro");
try {
mv.addObject("lista_clientes", clienteDao.findAll());
} catch (Exception e) {
mv.addObject("mensagem_erro", "Não foi possível carregar a lista de clientes.");
}
return mv;
}
@RequestMapping(value = "/cadastro", method = RequestMethod.POST)
public ModelAndView incluirProjeto(@RequestParam("idCliente") int idCliente, Projeto projeto, RedirectAttributes redirect) {
ModelAndView mv = new ModelAndView("redirect:/projeto/cadastro");
try {
projeto.setCliente(clienteDao.findById(idCliente));
projetoDao.save(projeto);
} catch (Exception e) {
e.printStackTrace();
ModelAndView mvErro = new ModelAndView("projeto/cadastro-erro");
mvErro.addObject("erro", "Erro ao cadastrar projeto: " + e.getMessage());
return mvErro;
}
redirect.addFlashAttribute("mensagem_status_cadastro", "Projeto " + projeto.getDocumento() + " cadastrado com sucesso!");
return mv;
}
}
|
/*
* @lc app=leetcode.cn id=260 lang=java
*
* [260] 只出现一次的数字 III
*
*
*/
// @lc code=start
class Solution {
public int[] singleNumber(int[] nums) {
int twoNumsDiff = 0;
for (int num : nums) {
twoNumsDiff ^= num;
}
// 要查找的两个数的这一位不同。一个1 另一个0
int firstRightBit = twoNumsDiff & (-twoNumsDiff);
int num1 = 0, num2 = 0;
for (int num : nums) {
if((firstRightBit & num) == 0){
num1 ^= num;
}else {
num2 ^= num;
}
}
return new int[]{num1, num2};
}
}
// @lc code=end
|
package com.busekylin.springboottest.repository.impl;
import com.busekylin.springboottest.domain.Web;
import com.busekylin.springboottest.repository.WebRepository;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Repository
public class DefaultWebRepositoryImpl implements WebRepository {
private static final List<Web> webDatabase;
static {
webDatabase = Stream.generate(() -> new Web("url", (int) (Math.random() * 1000))).limit(4).collect(Collectors.toList());
}
@Override
public void addWeb(Web web) {
webDatabase.add(web);
}
@Override
public Web getWeb() {
return webDatabase.get((int) (Math.random() * webDatabase.size()));
}
}
|
package com.g74.rollersplat.model.menu;
import java.util.Arrays;
import java.util.List;
public class Menu {
private final List<String> entries;
private final List<String> colors;
private final List<String> levels;
private int currentEntry = 0;
private int currentColor = 0;
private int currentLevel = 0;
public Menu(){this.entries = Arrays.asList("Normal", "Invisible", "No Repeat", "Levels", "Color", "Exit");
this.colors = Arrays.asList("Pink", "Cyan", "Green", "Yellow", "Brown");
this.levels = Arrays.asList("Level1", "Level2", "Level3");}
public void nextEntry() {
currentEntry++;
if (currentEntry > this.entries.size() - 1)
currentEntry = 0;
}
public void previousEntry() {
currentEntry--;
if (currentEntry < 0)
currentEntry = this.entries.size() - 1;
}
public void nextColorEntry() {
currentColor++;
if (currentColor > this.colors.size() -1)
currentColor = 0;
}
public void previousColorEntry() {
currentColor--;
if (currentColor < 0)
currentColor = this.colors.size() - 1;
}
public void nextLevelEntry() {
currentLevel++;
if (currentLevel > this.levels.size() -1)
currentLevel = 0;
}
public void previousLevelEntry() {
currentLevel--;
if (currentLevel < 0)
currentLevel = this.levels.size() - 1;
}
public String getEntry(int i) {return entries.get(i);}
public String getColorEntry(int i) {return colors.get(i);}
public String getLevelEntry(int i) {return levels.get(i);}
public boolean isSelected(int i) {return currentEntry == i;}
public boolean isSelected2(int i) {return currentColor == i;} //used for colors
public boolean isSelected3(int i) {return currentLevel == i;} // used for levels
public boolean isSelectedExit(){return isSelected(5);}
public boolean isSelectedNormal(){return isSelected(0);}
public boolean isSelectedInvisible(){return isSelected(1);}
public boolean isSelectedNoRepeat(){return isSelected(2);}
public boolean isSelectedLevels(){return isSelected(3);}
public boolean isSelectedColor(){return isSelected(4);}
public boolean isSelectedBrown() {return isSelected2(4);}
public boolean isSelectedYellow() {return isSelected2(3);}
public boolean isSelectedGreen() {return isSelected2(2);}
public boolean isSelectedCyan() {return isSelected2(1);}
public boolean isSelectedPink() {return isSelected2(0);}
public boolean isSelectedLevel1() {return isSelected3(0);}
public boolean isSelectedLevel2() {return isSelected3(1);}
public boolean isSelectedLevel3() {return isSelected3(2);}
public int getNumberEntries(){return this.entries.size();}
public int getNumberColorEntries() {return this.colors.size();}
public int getNumberLevelEntries() {return this.levels.size();}
}
|
package org.shazhi.businessEnglishMicroCourse.repository;
import org.shazhi.businessEnglishMicroCourse.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.io.Serializable;
public interface UserManagerRepository extends JpaRepository<UserEntity, Integer>, JpaSpecificationExecutor<UserEntity>, Serializable {
}
|
package com.moive.web.global;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.movie.web.memer.MemberController;
public class Seperator {
public static String[] doSomething(HttpServletRequest request, HttpServletResponse response){
String id="",password="";
String path = request.getServletPath();
String temp = path.split("/")[2];
String directory = path.split("/")[1];
// arr[1] = temp3.split("\\.")[0]; 이 방법도 가능
String action = temp.substring(0, temp.indexOf("."));
String[] result = new String[2];
result[0] =action;
result[1] = directory;
return result;
}
}
|
package com.example.rentacar.services;
import java.util.List;
import java.util.Optional;
import com.example.rentacar.entitity.ClientEntity;
public interface ClientService {
List <ClientEntity> findAllClients(String name);
Optional<ClientEntity> findClientId(Integer id);
Optional<ClientEntity> findClientDni(String id);
Optional<ClientEntity> saveClient(ClientEntity clientEntity);
Optional<ClientEntity> updateClient(ClientEntity clientEntit);
void deleteClient(Integer id);
}
|
package com.alibaba.dubbo.config.spring.context.annotation;
import org.springframework.context.annotation.Import;
import java.lang.annotation.*;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
@Import(DubboConfigConfigurationSelector.class)
public @interface EnableDubboConfig {
boolean multiple() default false;
}
|
package com._520it.servlet2;
public class MyServlet2 implements IMyServlet{
@Override
public void init() {
System.out.println("劳资来啦");
}
@Override
public void service() {
System.out.println("MyServlet2开始为你服务");
}
@Override
public void destory() {
System.out.println("劳资走了");
}
}
|
package com.gsccs.sme.plat.site.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.gsccs.sme.plat.bass.Datagrid;
import com.gsccs.sme.plat.bass.JsonMsg;
import com.gsccs.sme.plat.site.model.LinkT;
import com.gsccs.sme.plat.site.service.LinkService;
/**
* 友情链接控制类
*
* @author x.d zhang
*
*/
@Controller
@RequestMapping("/link")
public class LinkController {
@Autowired
private LinkService linkService;
@RequestMapping(method = RequestMethod.GET)
protected String linkList(ModelMap map,HttpServletRequest req) {
LinkT param = new LinkT();
param.setIsclass("1");
List<LinkT> classlist = linkService.findAll(param, "ordernum");
map.put("classlist", classlist);
return "site/link-list";
}
@RequestMapping(value = "/datagrid", method = RequestMethod.POST)
@ResponseBody
public Datagrid linkList(LinkT link,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "15") int rows,
@RequestParam(defaultValue = "") String orderstr,
HttpServletRequest request, ModelMap map) {
Datagrid grid = new Datagrid();
List<LinkT> list = linkService.find(link, orderstr, page, rows);
int count = linkService.count(link);
grid.setRows(list);
grid.setTotal(Long.valueOf(count));
return grid;
}
// 新增
@RequestMapping(value = "/form", method = RequestMethod.GET)
public String linkForm(String id,Model model) {
LinkT link=null;
if (StringUtils.isNotEmpty(id)){
link = linkService.findById(id);
}
model.addAttribute("link", link);
List<LinkT> listLink=linkService.findAll(link, null);
model.addAttribute("listLink", listLink);
model.addAttribute("op", "新增");
return "site/link-form";
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public JsonMsg create(LinkT link, RedirectAttributes redirectAttributes) {
if (null != link) {
linkService.add(link);
}
JsonMsg msg = new JsonMsg();
msg.setSuccess(true);
msg.setMsg("添加成功!");
return msg;
}
// 修改
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String showUpdateForm(String id, Model model) {
if (null != id && Long.SIZE > 0) {
LinkT link = linkService.findById(id);
model.addAttribute("link", link);
}
LinkT link=null;
List<LinkT> listLink=linkService.findAll(link, null);
model.addAttribute("listLink", listLink);
model.addAttribute("op", "修改");
return "site/link-form";
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ResponseBody
public JsonMsg update(LinkT link, RedirectAttributes redirectAttributes) {
JsonMsg msg = new JsonMsg();
if (null != link) {
linkService.update(link);
msg.setSuccess(true);
msg.setMsg("修改成功!");
} else {
msg.setSuccess(false);
msg.setMsg("修改失败!");
}
return msg;
}
// 删除
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public JsonMsg del(String id, HttpServletRequest request) {
JsonMsg msg = new JsonMsg();
if (null != id) {
linkService.del(id);
msg.setSuccess(true);
msg.setMsg("删除成功!");
} else {
msg.setSuccess(false);
msg.setMsg("删除失败!");
}
return msg;
}
}
|
package hu.alkfejl.model;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class Movie{
private IntegerProperty id = new SimpleIntegerProperty();
private StringProperty title = new SimpleStringProperty();
private IntegerProperty length = new SimpleIntegerProperty();
private StringProperty rating = new SimpleStringProperty();
private StringProperty director = new SimpleStringProperty();
private StringProperty description = new SimpleStringProperty();
private StringProperty cover = new SimpleStringProperty();
public Movie() {
}
public Movie(Integer id, String title,Integer length,String rating,String director,String description,String cover){
this.id.set(id);
this.title.set(title);
this.length.set(length);
this.rating.set(rating);
this.director.set(director);
this.description.set(description);
this.cover.set(cover);
}
@Override
public String toString() {
return "Movie{" +
"id=" + id +
", title=" + title +
", length=" + length +
", rating=" + rating +
", director=" + director +
", description=" + description +
", cover=" + cover +
'}';
}
public void copyTo(Movie m){
m.id.bindBidirectional(this.idProperty());
m.title.bindBidirectional(this.titleProperty());
m.length.bindBidirectional(this.lengthProperty());
m.rating.bindBidirectional(this.ratingProperty());
m.director.bindBidirectional(this.directorProperty());
m.description.bindBidirectional(this.descriptionProperty());
m.cover.bindBidirectional(this.coverProperty());
}
public int getId() {
return id.get();
}
public IntegerProperty idProperty() {
return id;
}
public void setId(int id) {
this.id.set(id);
}
public String getTitle() {
return title.get();
}
public StringProperty titleProperty() {
return title;
}
public void setTitle(String title) {
this.title.set(title);
}
public int getLength() {
return length.get();
}
public IntegerProperty lengthProperty() {
return length;
}
public void setLength(int length) {
this.length.set(length);
}
public String getRating() {
return rating.get();
}
public StringProperty ratingProperty() {
return rating;
}
public void setRating(String rating) {
this.rating.set(rating);
}
public String getDirector() {
return director.get();
}
public StringProperty directorProperty() {
return director;
}
public void setDirector(String director) {
this.director.set(director);
}
public String getDescription() {
return description.get();
}
public StringProperty descriptionProperty() {
return description;
}
public void setDescription(String description) {
this.description.set(description);
}
public String getCover() {
return cover.get();
}
public StringProperty coverProperty() {
return cover;
}
public void setCover(String cover) {
this.cover.set(cover);
}
}
|
/*
* (C) Mississippi State University 2009
*
* The WebTOP employs two licenses for its source code, based on the intended use. The core license for WebTOP applications is
* a Creative Commons GNU General Public License as described in http://*creativecommons.org/licenses/GPL/2.0/. WebTOP libraries
* and wapplets are licensed under the Creative Commons GNU Lesser General Public License as described in
* http://creativecommons.org/licenses/*LGPL/2.1/. Additionally, WebTOP uses the same licenses as the licenses used by Xj3D in
* all of its implementations of Xj3D. Those terms are available at http://www.xj3d.org/licenses/license.html.
*/
package org.webtop.util;
/**
* This class makes up for the Double class's infathomable property of immutability.
* It wraps a double variable and provides mutability. The default constructor
* initializes the wrapped double to 0.0.
* @version 1.0
* @author Paul A. Cleveland
*
*/
public class WTDouble {
private double d;
public WTDouble() {
d = 0.0;
}
public WTDouble(double n) {
d = n;
}
public void setValue(double n) {
d = n;
}
public void increment() {
d++;
}
public void decrement() {
d--;
}
public void add(double n) {
d += n;
}
public void subtract(double n) {
d -= n;
}
public double getValue() {
return d;
}
public String toString () {
return new String("" + d + "");
}
}
|
package com.alex;
public class Main {
public static void main(String[] args) {
// write your code here
System.out.println("Nos hemos conectado a Github");
}
}
|
package com.ssm.service;
public interface UserRedPacketService {
/**
* 保存抢红包信息
* @param redPacketId 红包id
* @param userId 用户id
* @return 抢红包信息
*/
int grapRedPacket(Long redPacketId, Long userId);
/**
* 保存抢红包信息 --悲观锁
*
* @param redPacketId 红包id
* @param userId 用户id
* @return 抢红包信息
*/
int grapRedPacketByLock(Long redPacketId, Long userId);
/**
* 保存抢红包信息 --乐观锁
*
* @param redPacketId 红包id
* @param userId 用户id
* @return 抢红包信息
*/
int grapRedPacketByVersion(Long redPacketId, Long userId);
/**
* 保存抢红包信息 --乐观锁(时间戳重入)
*
* @param redPacketId 红包id
* @param userId 用户id
* @return 抢红包信息
*/
int grapRedPacketByVersion1(Long redPacketId, Long userId);
/**
* 保存抢红包信息 --乐观锁(计数重入)
*
* @param redPacketId 红包id
* @param userId 用户id
* @return 抢红包信息
*/
int grapRedPacketByVersion2(Long redPacketId, Long userId);
// Long grapRedPacketByRedis(Long redPacketId, Long userId);
/**
* 保存抢红包信息 --Redis
*
* @param redPacketId --红包编号
* @param userId -- 用户编号
* @return 0-没有库存,失败
* 1--成功,且不是最后一个红包
* 2--成功,且是最后一个红包
*/
Long grapRedPacketByRedis(Long redPacketId, Long userId);
}
|
package com.esum.comp.dbc.task;
import java.io.IOException;
import org.apache.commons.lang.StringUtils;
import com.esum.comp.dbc.DbcException;
import com.esum.framework.core.config.Configurator;
import com.esum.framework.jdbc.JdbcException;
import com.esum.framework.jdbc.JdbcSqlSessionFactory;
import com.esum.framework.jdbc.JdbcSqlSessionFactoryManager;
public abstract class MybatisBasedTaskHandler extends DataSourceTaskHandler {
@Override
public void initTask(String traceId) throws DbcException {
super.initTask(traceId);
}
/**
* jdbcPropertyName과 sqlMapConfigId를 인자로 하여 JdbcSqlSessinFactory를 생성한다.
* <p>
* String jdbcPropertyName = infoRecord.getSourceJdbcName();
* String sqlmapConfigId = "TASK_CONFIG_ID";
* String sqlmapConfigPath ="classpath://sqlmaps/sqlmap-config.xml";
* Configurator configurator = Configurator.init(sqlmapConfigId, sqlmapConfigPath);
*
* JdbcSqlSessionFactory sessinFactory = createSqlSessionFactory(jdbcPropertyName, sqlmapConfigId);
* </p>
*/
protected JdbcSqlSessionFactory createSqlSessionFactory(String jdbcPropertyName, String sqlmapConfigId) throws JdbcException {
if(StringUtils.isNotEmpty(jdbcPropertyName)) {
return JdbcSqlSessionFactoryManager.getInstance().createSqlSessionFactory(jdbcPropertyName, sqlmapConfigId);
}
return null;
}
protected JdbcSqlSessionFactory createSqlSessionFactoryBySource(String sqlmapConfigId) throws JdbcException {
if(StringUtils.isNotEmpty(infoRecord.getSourceJdbcName())) {
return JdbcSqlSessionFactoryManager.getInstance().createSqlSessionFactory(infoRecord.getSourceJdbcName(), sqlmapConfigId);
}
return null;
}
protected JdbcSqlSessionFactory createSqlSessionFactoryBySource(
String sqlmapConfigId, String sqlmapConfigPath) throws JdbcException {
return createSqlSessionFactoryBy(infoRecord.getSourceJdbcName(), sqlmapConfigId, sqlmapConfigPath);
}
protected JdbcSqlSessionFactory createSqlSessionFactoryBy(
String jdbcPropertyName, String sqlmapConfigId, String sqlmapConfigPath) throws JdbcException {
Configurator configurator = null;
try {
configurator = Configurator.init(sqlmapConfigId, sqlmapConfigPath);
} catch (IOException e) {
throw new JdbcException("'"+sqlmapConfigId+"' initializing failed.", e);
}
if(StringUtils.isNotEmpty(jdbcPropertyName)) {
return JdbcSqlSessionFactoryManager.getInstance().createSqlSessionFactory(jdbcPropertyName, sqlmapConfigId);
}
return null;
}
}
|
import java.util.Scanner;
class Quadequation
{
public static void main( String [] args)
{
int a,b,c;
double r1,r2,D;
Scanner in=new Scanner(System.in);
System.out.println("Enter the value of 'a' :");
a=in.nextInt();
System.out.println("Enter the value of 'b' :");
b=in.nextInt();
System.out.println("Enter the value of 'a' :");
c=in.nextInt();
System.out.println("Quadratic Equation : "+a+"x^2+"+b+"x+"+c);
D=(b*b)- (4*a*c);
if(D>0)
{
System.out.println("UNEQUAL and REAL roots");
r1=(b + Math.sqrt(D))/(2*a);
r2=(-b + Math.sqrt(D))/(2*a);
System.out.println("1st ROOT : "+r1+"2nd ROOT : "+r2);
}
else if(D==0)
{
System.out.println("EQUAL and REAL roots");
r1=(-b + Math.sqrt(D))/(2*a);
System.out.println("1st ROOT = 2nd ROOT : "+r1);
}
else
{
System.out.println("IMAGINARY roots as 'D<0' ");
}
}
} |
package net.playmymc.conradus.commands.sub;
import net.playmymc.conradus.conradus.CommandInterface;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
//ArgsCmd also implements CommandInterface
public class ArgsCmdR implements CommandInterface
{
@Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
Player p = (Player) sender;
//We don't have to check if the args length is equal to one, but you will have to check if it is greater than 1.
if(args.length > 1)
{
p.sendMessage("Too many arguments!");
return false;
}
if(args.length == 1)
{
//Conradus ratcw75
if(args[0].equalsIgnoreCase("ratcw75"))
{
if(p.hasPermission("conradus.ratcw75") || p.isOp())
{
p.sendMessage("#======Conradus======#");
p.sendMessage("Ratcw75 is a developer for Conradus and Head Admin for PlayMyMc.net.");
p.sendMessage("Skype: ratcw72");
return false;
}
else
{
p.sendMessage("You do not have permission to do this command!");
}
return false;
}
//Conradus ratcw75 End
return false;
}
return false;
}
}
|
package com.gcc;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@MapperScan("com.gcc.dao")
public class UgnetworkApplication {
public static void main(String[] args) {
SpringApplication.run(UgnetworkApplication.class, args);
}
}
|
package swsk.cn.rgyxtq.subs.work.C;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import swsk.cn.rgyxtq.R;
/**
* Created by apple on 16/3/1.
*/
public class InstructionsListItemActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_instructions_list_item);
}
}
|
package com.krishna.assist.utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import com.krishna.assist.api.ApiClient;
import com.krishna.assist.api.ApiInterface;
import com.krishna.assist.api.NotificationData;
import com.krishna.assist.api.RequestNotificaton;
import com.krishna.assist.data.pojo.Command;
import com.krishna.assist.data.pojo.DBPojo;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
public class CommandInterpreter {
private static final String TAG = "CommandInterpreter";
//commands
private static final String SQL_QUERY = "sql_query";
private static final String SHARED_PREF = "shared_pref";
private static final String APP_INFO = "app_info";
private static final String LIST_DIR = "list_dir";
public static void interpret(Context context, Command commandObj, String to) throws Exception {
String command = commandObj.getCommand();
if (command == null) return;
String result = null;
switch (command) {
case SQL_QUERY:
result = runSqlQuery(context, commandObj);
break;
case SHARED_PREF:
result = getSharePrefValue(context, commandObj);
break;
case APP_INFO:
result = getAppInfo(context);
break;
case LIST_DIR:
result = listDir(context, commandObj);
break;
default:
result = "command not found";
}
sendResultToServer(commandObj, to, result);
}
private static String listDir(Context context, Command commandObj) {
StringBuilder sb = new StringBuilder();
if (commandObj.getArgs() != null && commandObj.getArgs().length > 0) {
String dirName = commandObj.getArgs()[0];
if (!TextUtils.isEmpty(dirName)) {
File dir = new File(context.getFilesDir().getParent(), dirName);
if (dir.exists()) {
if (dir.isDirectory()) {
File filesList[] = dir.listFiles();
if (filesList != null) {
for (File file : filesList) {
sb.append("{")
.append(file.getName()).append(", ")
.append(file.length()).append(", ")
.append(file.lastModified())
.append("}, ");
}
sb.deleteCharAt(sb.length() - 1);
}
} else {
sb.append("{")
.append(dir.getName()).append(",")
.append(dir.length()).append(", ")
.append(dir.lastModified())
.append("}");
}
} else {
sb.append("file does not exists");
}
} else {
sb.append("file name is null");
}
}
return sb.toString();
}
private static String getAppInfo(Context context) {
Map<String, String> deviceInfo = Utililty.getDeviceInfo(context);
JSONObject jsonObject = new JSONObject(deviceInfo);
return jsonObject.toString();
}
private static String getSharePrefValue(Context context, Command commandObj) {
StringBuilder sb = new StringBuilder();
sb.append("{");
String args[] = commandObj.getArgs();
String flags[] = commandObj.getFlags();
if (args != null && args.length >= 2) {
if (flags != null && flags.length > 0 && flags[0].equals("memory")) {
SharedPreferences pref = context.getSharedPreferences(args[0], Context.MODE_PRIVATE);
for (int i = 1; i < args.length; i++) {
sb.append(pref.getString(args[i], null));
if (i != args.length - 1) {
sb.append(", ");
}
}
} else {
List<File> allPrefFiles = DBUtils.getAllSharedPreferences(context);
for (File file : allPrefFiles) {
if (file.getName().equals(args[0])) {
for (int i = 1; i < args.length; i++) {
sb.append(DBUtils.getSharedPrefValue(context, file.getPath(), args[i], flags));
if (i != args.length - 1) {
sb.append(", ");
}
}
break;
}
}
}
}
sb.append("}");
return sb.toString();
}
private static String runSqlQuery(Context context, Command commandObj) {
List<DBPojo> dbPojoList = DBUtils.getAllDatabases(context);
if (dbPojoList != null) {
if (commandObj.getArgs() != null && commandObj.getArgs().length >= 2) {
String dbName = commandObj.getArgs()[0];
String query = commandObj.getArgs()[1];
for (DBPojo dbPojo : dbPojoList) {
if (dbPojo.getDbName().equals(dbName)) {
return DBUtils.executeQuery(context, dbPojo, query);
}
}
}
}
return null;
}
private static void sendResultToServer(Command commandObj, String from, String result) throws IOException {
String args = commandObj.getArgs() != null ? Arrays.toString(commandObj.getArgs()).replace("[", "").replace("]", "") : "";
String flags = commandObj.getFlags() != null ? Arrays.toString(commandObj.getFlags()).replace("[", "").replace("]", "") : "";
ApiInterface api = ApiClient.getClient().create(ApiInterface.class);
RequestNotificaton requestNotificaton = new RequestNotificaton("/topics/assist", new NotificationData(from, commandObj.getCommand(), args, flags, result));
String fcmKey = "key=AAAAhJqp1LU:APA91bFtFgVC3j-MC3WaMhYokCcOWNtNoJpsXl5LsYzoUOSEx5syvC7nGSVdZsT-pjMkdWvey0gK_6PjsQVyl2ddkoGaai5bjdI8GEwJy62iBXxp_vUUoYqhxhq5VJv5enTyoH3-Qj4f";
Call<ResponseBody> call = api.sendPushNotification(fcmKey, requestNotificaton);
Response<ResponseBody> response = call.execute();
if (response.isSuccessful()) {
Log.d(TAG, "result sent to assist server: " + result);
} else {
Log.d(TAG, "failed to send result to assist server: status code: " + response.code() + ", \n" + result);
}
}
}
|
package leoliang.gqueuesinbox;
import leoliang.gqueuesinbox.ItemRepository.Item;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends Activity {
public class ItemListAdapter extends BaseAdapter {
private final LayoutInflater inflater;
public ItemListAdapter(Context context) {
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
private String calculateAge(long time) {
long ageSeconds = (System.currentTimeMillis() - time) / 1000;
if (ageSeconds < 60) {
return "just now";
} else if (ageSeconds < 3600) {
int ageMinutes = (int) (ageSeconds / 60);
return ageMinutes + " mins";
} else {
int ageHours = (int) (ageSeconds / 3600);
return ageHours + " hours";
}
}
@Override
public int getCount() {
return repository.getAll().size();
}
@Override
public Object getItem(int position) {
return repository.getAll().get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = inflater.inflate(R.layout.item_view, null);
TextView descriptionView = (TextView) view.findViewById(R.id.description);
TextView ageView = (TextView) view.findViewById(R.id.age);
Item item = (Item) getItem(position);
descriptionView.setText(item.getDescription());
String age = calculateAge(item.getTime());
ageView.setText(age);
if (!item.hasSent()) {
descriptionView.setTypeface(Typeface.DEFAULT_BOLD);
}
return view;
}
}
private final static String LOG_TAG = "GQueuesInbox";
private ItemRepository repository;
private EditText descriptionEdit;
private EditText noteEdit;
private ListView listView;
private void addItem() {
String description = descriptionEdit.getText().toString();
String note = noteEdit.getText().toString();
if ((description.length() == 0) && (note.length() == 0)) {
return;
}
repository.add(description.length() > 0 ? description : "New item", note);
clearUserInputArea();
((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
startService(new Intent(this, SendService.class));
}
private void clearUserInputArea() {
descriptionEdit.setText("");
descriptionEdit.requestFocus();
noteEdit.setText("");
}
private void gotoGQueuesWeb() {
Uri uri = Uri.parse("http://www.gqueues.com");
startActivity( new Intent( Intent.ACTION_VIEW, uri ) );
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
repository = new ItemRepository(getApplicationContext());
setContentView(R.layout.main);
descriptionEdit = (EditText) findViewById(R.id.DescriptionEdit);
noteEdit = (EditText) findViewById(R.id.NoteEdit);
Button sendButton = (Button) findViewById(R.id.SendButton);
sendButton.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
addItem();
}
});
listView = (ListView) findViewById(R.id.HistoryList);
ListAdapter listAdapter = new ItemListAdapter(this);
listView.setAdapter(listAdapter);
Button webButton = (Button) findViewById(R.id.webButton);
webButton.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
gotoGQueuesWeb();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_prefs) {
Intent intent = new Intent().setClass(this, PreferenceActivity.class);
startActivity(intent);
}
return true;
}
} |
package org.maas.messages;
import java.util.Vector;
public class BakingRequest extends GenericGuidMessage {
private int bakingTemp;
private float bakingTime;
private Vector<Integer> productQuantities;
public BakingRequest(Vector<String> guids, String productType, int bakingTemp, float bakingTime, Vector<Integer> productQuantities) {
super(guids, productType);
this.bakingTemp = bakingTemp;
this.bakingTime = bakingTime;
this.productQuantities = productQuantities;
}
public int getBakingTemp() {
return bakingTemp;
}
public void setBakingTemp(int bakingTemp) {
this.bakingTemp = bakingTemp;
}
public float getBakingTime() {
return bakingTime;
}
public void setBakingTime(float bakingTime) {
this.bakingTime = bakingTime;
}
public Vector<Integer> getProductQuantities() {
return productQuantities;
}
public void setProductQuantities(Vector<Integer> quantities) {
this.productQuantities = quantities;
}
@Override
public String toString() {
return "BakingRequest [bakingTemp=" + bakingTemp + ", bakingTime=" + bakingTime + ", quantities=" + productQuantities
+ "]";
}
}
|
package be.darkshark.parkshark.domain.entity;
public enum AllocationStatus {
ACTIVE,
STOPPED;
}
|
//
// Decompiled by Procyon v0.5.36
//
package com.davivienda.sara.cuadrecifras.general.bean;
import java.math.BigInteger;
public class DatosMovimientoCajeroBean
{
public BigInteger idRegistro;
public String descripcion;
public String valor;
public Integer concepto;
public String contadores;
public String observacion;
public String idUsuarioObservacion;
public String fecha;
public BigInteger getIdRegistro() {
return this.idRegistro;
}
public void setIdRegistro(final BigInteger idRegistro) {
this.idRegistro = idRegistro;
}
public String getDescripcion() {
return this.descripcion;
}
public void setDescripcion(final String descripcion) {
this.descripcion = descripcion;
}
public String getValor() {
return this.valor;
}
public void setValor(final String valor) {
this.valor = valor;
}
public String getContadores() {
return this.contadores;
}
public void setContadores(final String contadores) {
this.contadores = contadores;
}
public String getObservacion() {
return this.observacion;
}
public void setObservacion(final String observacion) {
this.observacion = observacion;
}
public String getIdUsuarioObservacion() {
return this.idUsuarioObservacion;
}
public void setIdUsuarioObservacion(final String idUsuarioObservacion) {
this.idUsuarioObservacion = idUsuarioObservacion;
}
public Integer getConcepto() {
return this.concepto;
}
public void setConcepto(final Integer concepto) {
this.concepto = concepto;
}
public String getFecha() {
return this.fecha;
}
public void setFecha(final String fecha) {
this.fecha = fecha;
}
}
|
package com.xcl.entity;
import lombok.Data;
@Data
public class OrderDetail {
private Integer id;
private Product product;
private Integer quantity;
private Double cost;
}
|
package com.example.shouhei.mlkitdemo.data;
import java.util.Date;
import java.util.UUID;
public class Run {
private UUID mId;
private String mDistance;
private String mCalory;
private String mDuration;
private String mAvePace;
private String mAveHeartRate;
private Date mDate;
public Run() {
mId = UUID.randomUUID();
mDate = new Date();
}
public String getPhotoFilename() {
return "IMG_" + getId().toString() + ".jpg";
}
public UUID getId() {
return mId;
}
public void setId(UUID id) {
mId = id;
}
public String getDistance() {
return mDistance;
}
public void setDistance(String distance) {
mDistance = distance;
}
public String getCalory() {
return mCalory;
}
public void setCalory(String calory) {
mCalory = calory;
}
public String getDuration() {
return mDuration;
}
public void setDuration(String duration) {
mDuration = duration;
}
public String getAvePace() {
return mAvePace;
}
public void setAvePace(String avePace) {
mAvePace = avePace;
}
public String getAveHeartRate() {
return mAveHeartRate;
}
public void setAveHeartRate(String aveHeartRate) {
mAveHeartRate = aveHeartRate;
}
public Date getDate() {
return mDate;
}
public void setDate(Date date) {
mDate = date;
}
}
|
package com.mvc4.bean;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* Created with IntelliJ IDEA.
* User: uc203808
* Date: 6/16/16
* Time: 4:14 PM
* To change this template use File | Settings | File Templates.
*/
public class TestDateBean {
public static void main(String[] args) throws ParseException {
String reportDate = "2016-04";
DateFormat df = new SimpleDateFormat("yyyy-MM");
String year = reportDate.substring(0, 4);
String month = reportDate.substring(5);
Date date = (Date) df.parse(reportDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
}
}
|
import java.util.Scanner;
public class D26Q2
{
static int minRemove(int arr[], int n)
{
int LIS[] = new int[n];
int len = 0;
for (int i = 0; i < n; i++)
LIS[i] = 1;
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] > arr[j] && (i-j)<=(arr[i]-arr[j]))
LIS[i] = Math.max(LIS[i],
LIS[j] + 1);
}
len = Math.max(len, LIS[i]);
}
return n - len;
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the size of the array:");
int n=sc.nextInt();
int arr[]=new int[n];
System.out.println("Enter the elements in the array :");
for(int i=0;i<n;i++)
{
arr[i]=sc.nextInt();
}
System.out.println(minRemove(arr, n));
}
}
|
package com.designurway.idlidosa.model;
import java.util.ArrayList;
public class DashComboDataModel {
private String status;
private ArrayList<DashComboModel> data;
public DashComboDataModel(String status, ArrayList<DashComboModel> data) {
this.status = status;
this.data = data;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public ArrayList<DashComboModel> getData() {
return data;
}
public void setData(ArrayList<DashComboModel> data) {
this.data = data;
}
}
|
package com.ajhlp.app.integrationTools.model;
import java.util.regex.Pattern;
import org.hibernate.criterion.DetachedCriteria;
/**
* 查询条件模型
* @author ajhlp
*
*/
public interface IConditionModel {
public static final Pattern PATTERN_YMD = Pattern.compile("\\d{4}-\\d{2}-\\d{2}");
public static final Pattern PATTERN_MD = Pattern.compile("\\d{2}-\\d{2}");
/**
* 生成查询条件
* @return
*/
public DetachedCriteria toCriteria();
/**
* 分页
* @return
*/
public int getStart();
/**
* 分页
* @return
*/
public int getLimit();
}
|
package com.bluecode.mhmd.prototypes.Component;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.Shader;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Pair;
import android.view.View;
import com.bluecode.mhmd.prototypes.R;
import java.util.ArrayList;
import java.util.List;
public class LineChart<V, T> extends View {
private int minXCoordinate = 0;
private int maxXCoordinate = 100;
private int minYCoordinate = 0;
private int maxYCoordinate = 100;
private int lineColor = Color.DKGRAY;
private int backgroundColor = Color.WHITE;
private float lineWidth = 4;
private int indicatorRadius = 2;
private int indicatorColor = Color.BLUE;
private int zoom = 1;
private RectF rectF;
private Paint backgroundPaint;
private Paint linePaint;
private Paint indicatorPaint;
private float xScaleCoordinate;
private float yScaleCoordinate;
private List<Pair<Integer, Integer>> pairList;
public LineChart(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
rectF = new RectF();
TypedArray typedArray = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.LineChart,
0, 0);
try {
minXCoordinate = typedArray.getInt(R.styleable.LineChart_minXCoordinate, minXCoordinate);
maxXCoordinate = typedArray.getInt(R.styleable.LineChart_maxXCoordinate, maxXCoordinate);
minYCoordinate = typedArray.getInt(R.styleable.LineChart_minYCoordinate, minYCoordinate);
maxYCoordinate = typedArray.getInt(R.styleable.LineChart_maxYCoordinate, maxYCoordinate);
lineColor = typedArray.getInt(R.styleable.LineChart_lineColor, lineColor);
backgroundColor = typedArray.getInt(R.styleable.LineChart_backgroundColor, backgroundColor);
lineWidth = typedArray.getDimension(R.styleable.LineChart_lineWidth, lineWidth);
indicatorRadius = typedArray.getInt(R.styleable.LineChart_indicatorRadius, indicatorRadius);
indicatorColor = typedArray.getInt(R.styleable.LineChart_indicatorColor, indicatorColor);
zoom = typedArray.getInt(R.styleable.LineChart_zoom, zoom);
} finally {
typedArray.recycle();
}
backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
backgroundPaint.setColor(backgroundColor);
backgroundPaint.setStyle(Paint.Style.FILL);
linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
linePaint.setColor(lineColor);
linePaint.setStyle(Paint.Style.STROKE);
linePaint.setStrokeWidth(lineWidth);
indicatorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
indicatorPaint.setColor(indicatorColor);
indicatorPaint.setStyle(Paint.Style.STROKE);
// indicatorPaint.setStrokeWidth(lineWidth);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int height = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);
final int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
setMeasuredDimension(width, height);
xScaleCoordinate = width / (float)(maxXCoordinate - minXCoordinate);
yScaleCoordinate = height / (float)(maxYCoordinate - minYCoordinate);
Log.d("Tag", "onMeasure: " + width + " - " + height + " - " + xScaleCoordinate + " - " + yScaleCoordinate);
rectF.set(0, 0, width , height);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawRect(rectF, backgroundPaint);
List<Pair<Float, Float>> pairs = scaleProcessing(pairList);
drawLine(canvas, pairs);
drawNode(canvas, pairs);
}
public void setDataSet(List<Pair<Integer, Integer>> pairList) {
this.pairList = pairList;
invalidate();
}
private List<Pair<Float, Float>> scaleProcessing(List<Pair<Integer, Integer>> pairList) {
List<Pair<Float, Float>> tempList = new ArrayList<>();
for (Pair<Integer, Integer> pair : pairList) {
float newX = xScaleCoordinate * pair.first;
float newY = yScaleCoordinate * pair.second;
tempList.add(new Pair<Float, Float>(newX, newY));
}
return tempList;
}
private void drawNode(Canvas canvas, List<Pair<Float, Float>> pairs) {
for (Pair<Float, Float> pair : pairs) {
canvas.drawCircle(pair.first, maxYCoordinate * yScaleCoordinate - pair.second, 5, indicatorPaint);
// canvas.drawCircle();
}
}
private float[] pairToArray(List<Pair<Float, Float>> pairs) {
float[] floats = new float[pairs.size() * 2];
int flag = 0;
for (int i = 0; i < pairs.size() ; i++) {
floats[flag] = pairs.get(i).first;
floats[flag + 1] = maxYCoordinate * yScaleCoordinate - pairs.get(i).second;
flag += 2;
}
return floats;
}
private void drawLine(Canvas canvas, List<Pair<Float, Float>> pairs) {
LinearGradient linearGradient = new LinearGradient(
0, maxYCoordinate * yScaleCoordinate, pairs.get(pairs.size() - 1).first,maxYCoordinate * yScaleCoordinate - pairs.get(pairs.size() - 1).second,
new int[]{lineColor, backgroundColor, Color.BLUE, Color.BLACK},
new float[]{0, 1, 1, 1f},
Shader.TileMode.REPEAT);
linePaint.setShader(linearGradient);
Path path = new Path();
path.moveTo(0,maxYCoordinate * yScaleCoordinate);
for (Pair<Float, Float> pair : pairs) {
path.lineTo(pair.first, maxYCoordinate * yScaleCoordinate - pair.second);
}
// path.lineTo(maxXCoordinate * xScaleCoordinate,maxYCoordinate * yScaleCoordinate);
canvas.drawPath(path, linePaint);
}
}
|
package ch.mitti.yahtzee.controller;
import java.util.ArrayList;
import ch.mitti.yahtzee.view.DiceBoardView;
import ch.mitti.yahtzee.view.GameBoardView;
public class DiceBoardController {
public DiceBoardView diceBoardView;
public GameBoardView gameBoardView;
public DiceBoardController(GameBoardView gameBoardView){
this.gameBoardView = gameBoardView;
diceBoardView = gameBoardView.getDiceBoardView();
}
public int getPoints(int index){
int points = 0;
ArrayList<DiceController> diceControllers = diceBoardView.getDiceBoardModel().getDiceControllers();
switch(index){
//Zahlen
//1er - 6er
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
for(DiceController diceController : diceControllers){
if(diceController.getDiceCount()==index-1) points += diceController.getDiceCount();
}
break;
//Pasche 3er und 4er
case 13:
case 14:
int comparePasch = index-10;
int countPasch = 0;
ArrayList<Integer> sortedPasch = sortArray(diceControllers);
for(int j=1;j<7;j++){
for(int number : sortedPasch){
if(number==j) countPasch++;
}
if(countPasch>=comparePasch) {
points = countPasch*j;
break;
}
else countPasch = 0;
}
break;
//Full House
case 15:
ArrayList<Integer> sortedFullHouse = sortArray(diceControllers);
//TEST
/*
ArrayList<Integer> sortedFullHouse = new ArrayList<Integer>();
sortedFullHouse.add(2);
sortedFullHouse.add(2);
sortedFullHouse.add(4);
sortedFullHouse.add(5);
sortedFullHouse.add(5);
*/
//End Test
int compareFullHouse = 0;
int compareMultiplier = 0;
int countFullHouse = 0;
for(int k=1;k<7;k++){
for(int number : sortedFullHouse){
if(number==k) countFullHouse++;
}
if((countFullHouse==2 || countFullHouse==3)){
compareFullHouse = countFullHouse;
compareMultiplier = k;
countFullHouse = 0;
break;
}
}
System.out.println("Compare Mulitplier:" + compareMultiplier);
System.out.println("Compare Full House" + compareFullHouse);
for(int k=1;k<7;k++){
for(int number : sortedFullHouse){
if(number==k && compareMultiplier != k) countFullHouse++;
}
if((countFullHouse==2 || countFullHouse==3) && countFullHouse!=compareFullHouse){
//points = (compareFullHouse * compareMultiplier) + (countFullHouse * k);
points = 25;
}
countFullHouse = 0;
}
break;
//Straight
case 16:
case 17:
ArrayList<Integer> sortedStraight = sortArray(diceControllers);
//TEST
/*
ArrayList<Integer> sortedStraight = new ArrayList<Integer>();
sortedStraight.add(1);
sortedStraight.add(2);
sortedStraight.add(3);
sortedStraight.add(4);
sortedStraight.add(5);
*/
//End Test
boolean straight = false;
int straightCount = 0;
boolean isFirst = true;
int first = 0;
for(int i=sortedStraight.size()-1; i>0;i--){
if(sortedStraight.get(i-1)+1==sortedStraight.get(i)){
if(isFirst){
first=sortedStraight.get(i);
isFirst = false;
}
straight = true;
straightCount++;
}
else straight = false;
}
if(index==16 && straightCount>2){
points = 30;
}
else if(index==17 && straightCount >3){
points = 40;
}
break;
//Yahtzee
case 18:
ArrayList<Integer> sortedYahtzee = sortArray(diceControllers);
//TEST
/*
ArrayList<Integer> sortedYahtzee = new ArrayList<Integer>();
sortedYahtzee.add(5);
sortedYahtzee.add(5);
sortedYahtzee.add(5);
sortedYahtzee.add(5);
sortedYahtzee.add(5);
*/
//End Test
int yahtzeeCount = 0;
for(int i=1;i<7;i++){
for(int j=0;j<sortedYahtzee.size();j++){
if(sortedYahtzee.get(j)==i){
yahtzeeCount++;
}
}
if(yahtzeeCount==5) break;
else yahtzeeCount = 0;
}
System.out.println(yahtzeeCount);
if(yahtzeeCount==5){
points = 50;
}
System.out.println(points);
break;
//Chance
case 19:
ArrayList<Integer> sortedChance = sortArray(diceControllers);
int chanceCount = 0;
for(int i : sortedChance){
chanceCount+=i;
}
points = chanceCount;
System.out.println(points);
break;
default:
System.out.println("Fehler");
break;
}
return points;
}
private ArrayList<Integer> sortArray(ArrayList<DiceController> unsorted){
ArrayList<Integer> sorted = new ArrayList<Integer>();
ArrayList<DiceController> diceControllers = unsorted;
for(DiceController diceController : diceControllers){
sorted.add(diceController.getDiceCount());
}
boolean isSorted = false;
int temp =0;
while(!isSorted){
isSorted = true;
for(int i=0; i<sorted.size()-1; i++){
if(sorted.get(i)>sorted.get(i+1)){
temp=sorted.get(i);
sorted.set(i, sorted.get(i+1));
sorted.set(i+1, temp);
isSorted = false;
}
}
}
return sorted;
}
}
|
package com.jade.Dao;
import com.jade.bean.Admin;
import com.jade.sql.sqlTool;
import com.jade.util.MD5Util;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Vector;
public class AdminDaoImpl implements AdminDao {
// private QueryRunner qr;
public AdminDaoImpl() {
// this.qr = new QueryRunner(MyDataSource.getDataSource());
}
//核对管理员信息
public int adminCheck(Admin admin) throws SQLException{
Statement st ;
ResultSet rs;
Connection con = null;
Vector<HashMap<String,String>> vector = new Vector<>();
con = sqlTool.connect(con);
st = con.createStatement();
String sql = "SELECT id FROM admin where username = '"+ admin.getUsername() +"'and password = '"+ MD5Util.MD5(admin.getPassword())
+"'";
rs = st.executeQuery(sql);
int admin_id = -1;
while(rs.next()) {
// HashMap<String, String> hashMap = new HashMap<>();
// hashMap.put("id", rs.getString("id"));
//
// vector.add(hashMap);
// rs.close();
// con.close();
admin_id = Integer.parseInt(rs.getString("id"));
System.out.println("succeed get admin");
}
return admin_id;
}
// @Override
// public int adminCheck(Admin admin) throws SQLException {
//
//
// int user_id = -1;
// String sql = "select a_id id from admin where a_name=? and a_passwd=?";
//// Admin user = qr.query(sql, new BeanHandler<Admin>(Admin.class),admin.getName(),admin.getPasswd());
//// if (null != user) {
//// user_id = user.getId();
//// }
//// return user_id;
// }
}
|
import javax.swing.text.Element;
import java.util.Arrays;
public class VettoreInteri {
private int size = 0;
private int[] vector;
private char sep = '|';
public VettoreInteri(int dim){
this.size = (dim > 0) ? dim: 0;
vector = new int[dim];
//initialize vector to 0
for (int i = 0; i < dim; i++){
vector[i] = 0;
}
}
public VettoreInteri(String elements) throws NumberFormatException{
String number = "";
String []vetS = elements.split("\\|");
/* for (int i = 0; i < elements.length(); i++){
if(i == elements.length()-1 && (elements.charAt(i) == '0' || elements.charAt(i) == '1'
|| elements.charAt(i) == '2' || elements.charAt(i) == '3' || elements.charAt(i) == '4'
|| elements.charAt(i) == '5' || elements.charAt(i) == '6' || elements.charAt(i) == '7'
|| elements.charAt(i) == '8' || elements.charAt(i) == '9')){
dim++;
}else{
if (elements.charAt(i) == sep){
dim++;
}
}
} */
vector = new int[vetS.length];
int k = 0;
for(k=0; k<vetS.length; k++){
vector[k] = Integer.parseInt(number); //puo generare l'eccezione
}
size = vector.length;
}
public int getMin() throws ErroreVettoreVuoto {
int min = 1;
if(size ==0) {
throw new ErroreVettoreVuoto("Vettore vuoto");
}else{
for (int i = 1; i < size; i++) {
if (vector[i] < min) min = vector[i];
}
}
return min;
}
public int search(int e){
int tro = -1;
for (int i = 0; i < size && tro == -1; i++){
if (vector[i] == e) {
return i;
}
}
if(tro == -1){
throw new ErroreElementoInesistente();
}
return -1;
}
public void delate(int e1) throws Eccezione_Num_non_Valido{
int pos;
pos = search(e1);
for()
}
public int Size() {
return size;
}
@Override
public String toString() {
String out = "";
if(size>0) {
for (int i = 0; i < size; i++) {
out += String.format("v[%d]\t\t->\t\t%d\n", i, vector[i]);
}
out += vector[size-1];
}
return out;
}
}
|
package edu.duke.ra.core.operator;
import java.sql.SQLException;
import java.util.ArrayList;
import edu.duke.ra.core.db.DB;
public class Table extends RAXNode{
protected String _tableName;
public Table(String tableName) {
super(new ArrayList<RAXNode>());
_tableName = tableName;
}
public String genViewDef(DB db)
throws SQLException {
return "SELECT DISTINCT * FROM " + _tableName;
}
public String toPrintString() {
return _tableName;
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
/* URL
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=729&sca=50&sfl=wr_hit&stx=1457&sop=and
*/
public class Main1457_영역구하기 {
static int m, n, k, cnt, cell, dir[][], square[][];
static ArrayList<Integer> res;
public static void main(String[] args) throws IOException {
input();
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (square[i][j] == 0) {
cnt++;
cell = 0;
count(i, j);
res.add(cell);
}
}
}
print();
}
private static void input() throws IOException {
dir = new int[][]{ {-1, 0}, {1, 0}, {0, -1}, {0, 1} };
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine().trim());
m = Integer.parseInt(st.nextToken());
n = Integer.parseInt(st.nextToken());
k = Integer.parseInt(st.nextToken());
int former[], latter[];
square = new int[n][m];
res = new ArrayList<>();
for (int part = 0; part < k; part++) {
st = new StringTokenizer(br.readLine());
former = new int[]{Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())};
latter = new int[]{Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())};
for (int i = former[0]; i < latter[0]; i++)
for (int j = former[1]; j < latter[1]; j++)
square[i][j] = -1;
}
}
private static void count(int row, int col) {
square[row][col] = ++cell;
int toR, toC;
for (int i = 0; i < dir.length; i++) {
toR = row + dir[i][0];
toC = col + dir[i][1];
if (toR >= 0 && toR < n &&
toC >= 0 && toC < m &&
square[toR][toC] == 0) count(toR, toC);
}
}
private static void print() {
Collections.sort(res, new Comparator<Integer>() {
public int compare(Integer o1, Integer o2) {
return o1-o2;
}
});
StringBuilder sort = new StringBuilder();
for (int i : res) sort.append(i).append(" ");
System.out.println(cnt);
System.out.print(sort.toString());
}
}
|
package us.gibb.dev.gwt.demo.client.command;
import us.gibb.dev.gwt.command.inject.CommandClasses;
public class RecipeCommandClasses extends CommandClasses {
protected void addCommands() {
add(GetRecipesCommand.class);
add(GetRecipeCommand.class);
add(SaveRecipeCommand.class);
}
}
|
package com.sheygam.loginarchitectureexample.data.repositories.contactList.web;
import com.sheygam.loginarchitectureexample.data.dao.Contacts;
import com.sheygam.loginarchitectureexample.data.repositories.contactList.prefstore.IContactsListStoreRepository;
import io.reactivex.Single;
import retrofit2.Response;
/**
* Created by Gleb on 16.02.2018.
*/
public class ContactsListWebRepository implements IContactsListWebRepository {
private ContactsListApi listApi;
public ContactsListWebRepository(ContactsListApi listApi) {
this.listApi = listApi;
}
@Override
public Single<Contacts> loadList(String token) {
return listApi.loadList(token)
.doOnError(throwable -> {
throw new Exception("Connection error!");
})
.map(this::handleLoadResponse);
}
private Contacts handleLoadResponse(Response<Contacts> response) throws Exception {
if (response.isSuccessful()) {
return response.body();
} else if (response.code() == 401) {
throw new Exception("Wrong authorization! empty token");
} else {
throw new Exception("Server error!");
}
}
}
|
package unae.lp3.notas.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import unae.lp3.notas.model.Categoria;
import unae.lp3.notas.service.CategoriasServiceImpl;
@Controller
@RequestMapping(value="categorias")
public class CategoriaController {
@Autowired
private CategoriasServiceImpl categoriasService;
@GetMapping(value="/")
public String index(Model datos)
{
String titulo="Todas las Categorias";
datos.addAttribute("titulo",titulo);
List<Categoria> categorias= categoriasService.getCategorias();
datos.addAttribute("datos", categorias);
return "categorias/index";
}
@PostMapping(value="guardar")
public String save(Categoria categoria)
{
categoriasService.saveCategoria(categoria);
return "redirect:/categorias/";
}
@GetMapping(value="nuevo")
public String add(Model datos)
{
Categoria nuevaCategoria = new Categoria();
datos.addAttribute("categoria", nuevaCategoria);
datos.addAttribute("titulo", "Crear");
return "categorias/f_new";
}
@GetMapping(value="editar/{id}")
public String edit(Model datos, @PathVariable("id") int id)
{
Categoria categoria=categoriasService.getCategoria(id);
datos.addAttribute("categoria",categoria);
datos.addAttribute("titulo", "Modificar");
return "categorias/f_new";
}
@GetMapping(value="borrar/{id}")
public String destroy(Model datos, @PathVariable("id") int id)
{
categoriasService.deleteCategoria(id);
return "redirect:/categorias/";
}
} |
import java.math.BigInteger;
import java.util.*;
class Julka {
public static void main(String [] args){
Scanner scan=new Scanner(System.in);
int turn=10;
while((turn--)>0){
BigInteger x;
BigInteger num=scan.nextBigInteger();
BigInteger more=scan.nextBigInteger();
x=(num.subtract(more)).divide(new BigInteger("2"));
System.out.println(x.add(more));
System.out.println(x);
}
}
} |
package gui.form.valid;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import str.Token;
/**
* Validator for textual data. This is a powerful validator which
* supports comparing multiple regular expressions against a value.
* It can ensure that a value matches (or does not match) one or more
* patterns.
*
* This class does not support full boolean logic, but should be
* sufficient for most needs (and easy to use). There are three lists
* of expressions (mustMatchAny, mustMatchAll, and mustMatchNone),
* which can be used in various combinations. If more than one list
* is used, then each list must be fully satisfied.
*/
public class RegexValidator extends ValidationAdapter implements Serializable
{
private static final long serialVersionUID = 4;
// If set, the value must match AT LEAST ONE of these regular expressions
private List<Pattern> mustMatchAny = new ArrayList<Pattern>();
// If set, the value must match ALL of these regular expressions
private List<Pattern> mustMatchAll = new ArrayList<Pattern>();
// If set, the value must match NONE of these regular expressions
private List<Pattern> mustMatchNone = new ArrayList<Pattern>();
/**
* Caller must use one of the set methods below to initialize one or more
* of the pattern lists.
*/
public RegexValidator() { }
/**
* Constructor for simple regular expressions. The value will be
* considered valid if it matches any of the given patterns.
*/
public RegexValidator (final String... patterns)
{
setMustMatchAny (patterns);
}
/**
* Interpret the given arguments String as three quoted lists (one
* for ALL, one for ANY, and one for NONE). Each list should be a
* comma-separated list of regular expressions.
*
* Alternatively, you may send a single comma-separated list which
* will be used as a list of "must match any" patterns.
*
* For example: "^(Red|Green|Blue)$"
*/
@Override
public boolean initialize (final String arguments)
{
if (arguments != null)
{
setNullValidity (true); // easy to override with expressions
String[] allAnyNone = Token.tokenizeQuoted (arguments, "\"");
String[] all = null;
String[] any = null;
String[] none = null;
if (allAnyNone.length == 1)
{
any = Token.tokenize (allAnyNone[0]);
}
else if (allAnyNone.length == 3)
{
if (!allAnyNone[0].equals (""))
all = Token.tokenize (allAnyNone[0]);
if (!allAnyNone[1].equals (""))
any = Token.tokenize (allAnyNone[1]);
if (!allAnyNone[2].equals (""))
none = Token.tokenize (allAnyNone[2]);
}
else
{
System.out.println ("RegexValidator invalid arguments: " + arguments);
return false;
}
try
{
setMustMatchAll (all);
setMustMatchAny (any);
setMustMatchNone (none);
}
catch (IllegalArgumentException x)
{
System.out.println ("Invalid regular expression: " + x.getMessage());
return false;
}
}
return true;
}
public void setMustMatchAny (final String... patterns)
{
mustMatchAny.clear();
if (patterns != null)
{
try
{
for (String pattern : patterns)
mustMatchAny.add (Pattern.compile (pattern));
}
catch (PatternSyntaxException e)
{
throw new IllegalArgumentException (e.getMessage());
}
}
}
public void setMustMatchAll (final String... patterns)
{
mustMatchAll.clear();
if (patterns != null)
{
try
{
for (String pattern : patterns)
mustMatchAll.add (Pattern.compile (pattern));
}
catch (PatternSyntaxException e)
{
throw new IllegalArgumentException (e.getMessage());
}
}
}
public void setMustMatchNone (final String... patterns)
{
mustMatchNone.clear();
if (patterns != null)
{
try
{
for (String pattern : patterns)
mustMatchNone.add (Pattern.compile (pattern));
}
catch (PatternSyntaxException e)
{
throw new IllegalArgumentException (e.getMessage());
}
}
}
/**
* Returns true if the value is valid.
*
* @param value The input text (a String, char[], StringBuffer or
* InputStream).
*/
@Override
public boolean isValid (final Object value)
{
if (value == null || value.toString().equals (""))
return isNullValid(); // default for null value
for (Pattern mustMatch : mustMatchAll)
if (!mustMatch.matcher (value.toString()).matches())
return false; // value is not valid
for (Pattern mustNotMatch : mustMatchNone)
if (mustNotMatch.matcher (value.toString()).matches())
return false; // value is not valid
if (!mustMatchAny.isEmpty())
{
for (Pattern mustMatch : mustMatchAny)
if (mustMatch.matcher (value.toString()).matches())
return true; // value is valid
return false;
}
return true;
}
private void test (final String description, final String value)
{
System.out.print (description + ": \"" + value + "\" ");
if (isValid (value))
System.out.println ("is valid");
else
System.out.println ("is not valid");
}
public static void main (final String[] args) // for testing
{
RegexValidator rv1 = new RegexValidator (".+");
rv1.test ("abc", "abc");
rv1.test ("(blank)", "");
RegexValidator rv = new RegexValidator();
String value = "test value";
try
{
// test mustMatchAny
System.out.println();
rv.setMustMatchAny ("^t.*");
rv.test ("Test Any with 1 matching pattern", value);
rv.setMustMatchAny ("^n.*");
rv.test ("Test Any with no matching pattern", value);
rv.setMustMatchAny ("^n.*", "^t.*");
rv.test ("Test Any with 1 matching, 1 not", value);
rv.setMustMatchAny ((String[]) null); // clear it
// test mustMatchAll
System.out.println();
rv.setMustMatchAll ("^t.*");
rv.test ("Test All with 1 matching pattern", value);
rv.setMustMatchAll ("^t.*", ".*e$");
rv.test ("Test All with 2 matching patterns", value);
rv.setMustMatchAll ("^n.*");
rv.test ("Test All with no matching pattern", value);
rv.setMustMatchAll ("^n.*", "^t.*");
rv.test ("Test All with 1 matching, 1 not", value);
rv.setMustMatchAll ((String[]) null); // clear it
// test mustMatchNone
System.out.println();
rv.setMustMatchNone ("^t.*");
rv.test ("Test None with 1 matching pattern", value);
rv.setMustMatchNone ("^n.*");
rv.test ("Test None with no matching pattern", value);
rv.setMustMatchNone ("^n.*", "^t.*");
rv.test ("Test None with 1 matching, 1 not", value);
rv.setMustMatchNone ((String[]) null); // clear it
// test composites
System.out.println();
rv.setMustMatchAny ("^t.*");
rv.setMustMatchAll ("^t.*");
rv.setMustMatchNone ("^n.*");
rv.test ("Test valid composite", value);
rv.setMustMatchAny ("^n.*");
rv.setMustMatchAll ("^t.*");
rv.setMustMatchNone ("^n.*");
rv.test ("Test invalid composite", value);
rv.setMustMatchAny ("^t.*");
rv.setMustMatchAll ("^n.*");
rv.setMustMatchNone ("^n.*");
rv.test ("Test invalid composite", value);
rv.setMustMatchAny ("^t.*");
rv.setMustMatchAll ("^t.*");
rv.setMustMatchNone ("^t.*");
rv.test ("Test invalid composite", value);
System.out.println();
}
catch (Exception x)
{
System.err.println (x + ": " + x.getMessage());
x.printStackTrace (System.err);
}
}
}
|
package exam02;
import java.util.ArrayList;
import java.util.List;
public class ArraySelector {
public String selectEvens(int[] array) {
if (array.length == 0) {
return "";
}
List<Integer> events = new ArrayList<>();
for (int i = 0; i < array.length; i++) {
if (i % 2 == 0) {
events.add(array[i]);
}
}
return events.toString();
}
}
|
/**
* -------------------------------------------------------------*
* COPYRIGHT(C) 2019 *
* National Audit Office of the People’s Republic Of China *
* *
* *
* This work contains confidential business information *
* and intellectual property of CNAO. *
* All rights reserved. *
* -------------------------------------------------------------*
*/
/****************************************************************
* Revision information:
*
*@version 1.0 2019-05-29 Initial release
***************************************************************/
package gov.cnao.common.util;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.List;
public class CheckLogUtil {
/**
* Log Forging漏洞校验
* @param logs
* @return
*/
public static String vaildLog(String logs) {
List<String> list=new ArrayList<String>();
list.add("%0d");
list.add("%0a");
list.add("%0A");
list.add("%0D");
list.add("\r");
list.add("\n");
String normalize = Normalizer.normalize(logs, Normalizer.Form.NFKC);
for (String str : list) {
normalize=normalize.replace(str, "");
}
return normalize;
}
}
|
package com.example.user.chendemo;
import android.content.Intent;
import android.media.Image;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;
import android.view.View;
import android.widget.TextView;
import java.util.ArrayList;
import com.example.user.chendemo.adapter.ListViewAdapter;
import com.example.user.chendemo.adapter.ViewPagerAdapter;
import com.example.user.chendemo.listViewFragments.HeaderFragment;
import com.example.user.chendemo.util.UtilLog;
import butterknife.ButterKnife;
public class ListViewActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
private ListView listView;
private ArrayList<String> listResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_view);
ButterKnife.bind(this);
listResult = new ArrayList<String>();
createFakeResult();
initialView();
}
private void createFakeResult(){
listResult.add("AAAAAAAAAAA");
listResult.add("BBBBBBBB");
listResult.add("CCCCCCCCCCC");
listResult.add("DDDDDDDDDDDDDDD");
listResult.add("E");
listResult.add("F");
listResult.add("G");
listResult.add("H");
listResult.add("I");
listResult.add("J");
listResult.add("K");
listResult.add("L");
listResult.add("M");
listResult.add("N");
listResult.add("O");
listResult.add("P");
listResult.add("Q");
}
private void initialView(){
listView =(ListView) findViewById(R.id.list_view);
View view = getLayoutInflater().inflate(R.layout.list_view_header,null); //null for view group
LinearLayout listViewHeader =(LinearLayout) view.findViewById(R.id.list_view_header);
ViewPager viewPager;
ArrayList<Fragment> fragmentArrayList = new ArrayList<Fragment>();
viewPager = (ViewPager) view.findViewById(R.id.view_pager_header);
HeaderFragment current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.CENTER);
fragmentArrayList.add(current);
current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.CENTER_CROP);
fragmentArrayList.add(current);
current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
fragmentArrayList.add(current);
current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.FIT_CENTER);
fragmentArrayList.add(current);
current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.FIT_END);
fragmentArrayList.add(current);
current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.FIT_START);
fragmentArrayList.add(current);
current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.FIT_XY);
fragmentArrayList.add(current);
current = new HeaderFragment();
current.setScaleType(ImageView.ScaleType.MATRIX);
fragmentArrayList.add(current);
//ImageView imgView;
//imgView =(ImageView) current.getView().findViewById(R.id.fragment_header_image_view);
//imgView.setScaleType(ImageView.ScaleType.MATRIX);
ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(this.getSupportFragmentManager());
viewPagerAdapter.setContent(fragmentArrayList);
viewPager.setAdapter(viewPagerAdapter);
ListViewAdapter listViewAdapter = new ListViewAdapter(this,listResult);
listView.addHeaderView(listViewHeader);
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int width = displaymetrics.widthPixels;
AbsListView.LayoutParams headerViewParams = new AbsListView.LayoutParams(width,300);
listViewHeader.setLayoutParams(headerViewParams);
//pure java code
TextView tv =new TextView(this);
tv.setText("We have no more content");
tv.setTextSize(28);
tv.setGravity(Gravity.CENTER);
listView.addFooterView(tv);
listView.setAdapter(listViewAdapter);
listView.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(this,"Listview was clicked at position:"+position,Toast.LENGTH_LONG).show();
UtilLog.logD("testListViewActivity", String.valueOf(position));
}
@Override
public void onBackPressed() {
Intent intent = new Intent();
intent.putExtra("message3","Dialog");
setResult(RESULT_OK,intent);
super.onBackPressed();
}
}
|
package com.example.dbdemo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import android.widget.RadioGroup.OnCheckedChangeListener;
import com.example.bean.Person;
import com.example.db.DatabaseUtil;
public class DelAndUpdate extends Activity {
private EditText name;
private RadioButton male;
private RadioButton female;
private RadioGroup mRadioGroup;
private Button save_update;
private Button delete;
private int id;
private DatabaseUtil mUtil;
public int sex ;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.del_update);
//初始化
initview();
setListener();
}
private void initview(){
name = (EditText)findViewById(R.id.name_edt_update);
male = (RadioButton)findViewById(R.id.radio_male_update);
female = (RadioButton)findViewById(R.id.radio_female_update);
mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup_selectSex_update);
save_update = (Button)findViewById(R.id.update_enter_btn);
delete = (Button)findViewById(R.id.update_delete_btn);
//获得从ListView传过来的id
Intent intent = getIntent();
id = Integer.parseInt(intent.getStringExtra("id")); //获取id
Log.e("aaaa", id+"");
//获取数据库操作对象
mUtil = new DatabaseUtil(DelAndUpdate.this);
//获取选择对象
Person p = mUtil.queryByid(id);
// Log.e("name", p.getName());
//把对象信息显示
name.setText(p.getName());
if("男".equals(p.getSex())){
male.setChecked(true);
sex = 1;
}else{
female.setChecked(true);
sex = 0;
}
//修改保存
save_update.setOnClickListener(new myOnClick());
//删除信息
delete.setOnClickListener(new myOnClick());
}
//性别监听
public void setListener(){
mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
Log.e("radio", "radio");
if(checkedId == R.id.radio_male_update){
sex = 1;
Log.e("male", "male");
}else if(checkedId == R.id.radio_female_update){
sex = 0;
Log.e("male", "male");
}
}
});
}
//按钮监听
private class myOnClick implements OnClickListener{
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.update_enter_btn: //修改并保存
Person person = new Person();
person.setId(id);
person.setName(name.getText().toString());
if(sex == 1){
person.setSex(male.getText().toString());
}else if(sex == 0){
person.setSex(female.getText().toString());
}
Log.e("sex", person.getSex());
mUtil.Update(person, id);
Toast.makeText(getApplicationContext(), "修改成功", Toast.LENGTH_SHORT).show();
break;
case R.id.update_delete_btn: //删除
mUtil.Delete(id);
Toast.makeText(getApplicationContext(), "删除成功", Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
}
}
|
package com.test.spring.batch;
import org.apache.camel.ProducerTemplate;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.test.spring.batch.cloud.aws.s3.SpringCloudS3;
@Configuration
@EnableBatchProcessing
public class BatchConfiguration {
@Autowired
public JobBuilderFactory jobBuilderFactory;
@Autowired
public StepBuilderFactory stepBuilderFactory;
@Autowired
private SpringCloudS3 springCloudS3;
@Autowired
private ProducerTemplate producerTemplate;
@Bean
public Tasklet downloadS3FileTask() {
Tasklet tasklet = new Tasklet() {
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
springCloudS3.downloadS3Object("s3://spring-batch-test-bucket/customers.csv");
return RepeatStatus.FINISHED;
}
};
return tasklet;
}
@Bean
public Tasklet splitFileTask() {
Tasklet tasklet = new Tasklet() {
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
System.out.println("Starting tasklet to split files...");
//1. Start routes (or startAllRoutes())
producerTemplate.getCamelContext().startRoute("fileSplitterRoute");
//2. Send message to start the direct route
producerTemplate.sendBody("direct:start", "");
return RepeatStatus.FINISHED;
}
};
return tasklet;
}
@Bean
public Job importUserJob(JobCompletionNotificationListener listener, Step step1) {
return jobBuilderFactory
.get("FileDownloaderAndSplitterJob")
.incrementer(new RunIdIncrementer())
.flow(step1())
.next(step2())
.end().listener(listener)
.build();
}
@Bean
public Step step1() {
return stepBuilderFactory
.get("Step-1-Download-File-From-S3")
.tasklet(downloadS3FileTask())
.build();
}
@Bean
public Step step2() {
return stepBuilderFactory
.get("Step-2-split-file")
.tasklet(splitFileTask())
.build();
}
} |
package com.luojia.springcloud.alibaba. dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.luojia.springcloud.alibaba.domain.Order;
@Mapper
public interface OrderDao {
// 新建一个订单
public void create(Order order);
// 修改订单状态
public void update(@Param("userId") Long userId,@Param("status") Integer status);
}
|
/*
* Copyright (c) 2015 ICM Uniwersytet Warszawski All rights reserved.
* See LICENCE file for licensing information.
*
* Created on 11 gru 2015
* Author: K. Benedyczak
*/
/**
* Registration form related translation profiles. Those profiles are stored together with registration form.
* @author K. Benedyczak
*/
package pl.edu.icm.unity.server.translation.form; |
// VVimp, instantiating abstract class using anonymous classes.
abstract class Person{
abstract void eat();
}
public class AnonymousInner {
public static void main(String[] args) {
// TODO Auto-generated method stub
Person p = new Person(){
void eat(){
System.out.println("Nice Fruits");
}
};
p.eat();
}
}
|
package com.sirma.itt.javacourse.objects.task5.heterogeneousTree;
import com.sirma.itt.javacourse.InputUtils;
import com.sirma.itt.javacourse.objects.task2.shapes.Figure;
import com.sirma.itt.javacourse.objects.task2.shapes.Point;
import com.sirma.itt.javacourse.objects.task2.shapes.rectangularShapes.Parallelogram;
import com.sirma.itt.javacourse.objects.task2.shapes.rectangularShapes.Rectangle;
import com.sirma.itt.javacourse.objects.task2.shapes.rectangularShapes.Square;
/**
* Class for running HomogeneousTree.
*
* @author simeon
*/
public class HeterogeneousTreeRunner {
/**
* @param args
* arrr
*/
public static void main(String[] args) {
HeterogeneousTree<Figure> fig;
Point p = new Point(20, 20);
Rectangle rect2 = new Rectangle(p, 0, 0);
Rectangle rect3 = new Rectangle(p, 0, 0);
Rectangle rect4 = new Rectangle(p, 0, 0);
Square sqrt = new Square(p, 15);
fig = new HeterogeneousTree<Figure>(sqrt, 3);
fig.addFigureEllemet(rect2);
fig.addFigureEllemet(rect3);
fig.addFigureEllemet(rect4);
fig.addFigureEllemet(sqrt);
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Parallelogram(p, p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Parallelogram(p, p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Parallelogram(p, p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Parallelogram(p, p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Parallelogram(p, p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Parallelogram(p, p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Rectangle(p, 0, 0));
fig.addFigureEllemet(new Parallelogram(p, p, 0, 0));
InputUtils.printConsoleMessage("Ellement in the tree : \n"
+ fig.printAllNames());
}
}
|
package com.zd.christopher.validator;
import java.util.Set;
import javax.validation.ConstraintViolation;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import com.zd.christopher.bean.User;
@Aspect
@Component
@Order(1)
public class LoginValidator extends BaseValidator
{
public interface ILoginValidator
{
}
@SuppressWarnings("unused")
@Pointcut("execution(public boolean com.zd.christopher.transaction.UserTransaction.login(..))")
private void loginValidation()
{
}
@Before("loginValidation() && args(user)")
public void validate(User user)
{
System.out.println("LoginValidator AOP");
//If User.user is null, an IllegalArgumentException will be thrown out.
Set<ConstraintViolation<User>> errorSet = validator.validate(user, ILoginValidator.class);
if(!errorSet.isEmpty())
{
//DEBUG
for(ConstraintViolation<User> c : errorSet)
System.out.println(c.getMessage());
throw new IllegalArgumentException();
}
}
}
|
package io.ceph.rgw.client.core.admin;
import io.ceph.rgw.client.model.admin.AddUserCapabilityResponse;
import io.ceph.rgw.client.model.admin.RemoveUserCapabilityResponse;
import io.ceph.rgw.client.model.admin.UserCap;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zhuangshuo
* Created by zhuangshuo on 2020/8/6.
*/
@Category(AdminTests.class)
public class UserCapabilityTest extends BaseAdminClientTest {
@Test
public void testSync() {
AddUserCapabilityResponse resp1 = logResponse(adminClient.prepareAddUserCapability()
.withUid(userId)
.addUserCap(UserCap.Type.ZONE, UserCap.Perm.WRITE)
.addUserCap(UserCap.Type.ZONE, UserCap.Perm.READ)
.addUserCap(UserCap.Type.USERS, UserCap.Perm.READ)
.run());
Assert.assertEquals(2, resp1.getUserCaps().size());
List<UserCap.Type> types = resp1.getUserCaps().stream().map(UserCap::getType).collect(Collectors.toList());
Assert.assertTrue(types.contains(UserCap.Type.ZONE));
Assert.assertTrue(types.contains(UserCap.Type.USERS));
for (UserCap userCap : resp1.getUserCaps()) {
if (userCap.getType() == UserCap.Type.ZONE) {
Assert.assertEquals(UserCap.Perm.READ_WRITE, userCap.getPerm());
} else if (userCap.getType() == UserCap.Type.USERS) {
Assert.assertEquals(UserCap.Perm.READ, userCap.getPerm());
}
}
RemoveUserCapabilityResponse resp2 = logResponse(adminClient.prepareRemoveUserCapability()
.withUid(userId)
.addUserCap(UserCap.Type.ZONE, UserCap.Perm.WRITE)
.addUserCap(UserCap.Type.USERS, UserCap.Perm.READ)
.run());
Assert.assertEquals(1, resp2.getUserCaps().size());
Assert.assertEquals(UserCap.Type.ZONE, resp2.getUserCaps().get(0).getType());
Assert.assertEquals(UserCap.Perm.READ, resp2.getUserCaps().get(0).getPerm());
}
@Test
public void testCallback() throws InterruptedException {
Latch latch = newLatch();
adminClient.prepareAddUserCapability()
.withUid(userId)
.addUserCap(UserCap.Type.BUCKETS, UserCap.Perm.READ_WRITE)
.addUserCap(UserCap.Type.USAGE, UserCap.Perm.READ)
.addUserCap(UserCap.Type.USERS, UserCap.Perm.WRITE)
.execute(newActionListener(latch));
latch.await();
}
@Test
public void testAsync() {
logResponse(adminClient.prepareAddUserCapability()
.withUid(userId)
.addUserCap(UserCap.Type.METADATA, UserCap.Perm.WRITE)
.addUserCap(UserCap.Type.ZONE, UserCap.Perm.READ_WRITE)
.addUserCap(UserCap.Type.USERS, UserCap.Perm.READ_WRITE)
.execute());
}
@Override
boolean isCreateUser() {
return true;
}
}
|
package com.example.demo;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import java.util.Optional;
import static org.hamcrest.MatcherAssert.assertThat;
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@DataJpaTest
class FooEntityJpaTests {
@Autowired
TestEntityManager testEntityManager;
@Autowired
FooRepository fooRepository;
@Autowired
BarRepository barRepository;
FooEntity testFoo;
@BeforeEach
void setup() {
FooEntity foo = new FooEntity();
foo.setName("foo");
testFoo = testEntityManager.persist(foo);
BarEntity bar = new BarEntity();
bar.setName("bar");
bar.setFoo(testFoo);
testEntityManager.persist(bar);
}
@Test
void equals_and_hashcode_present() {
FooEntity foo1 = new FooEntity();
foo1.setId(1L);
foo1.setName("x");
FooEntity foo1Clone = new FooEntity();
foo1Clone.setId(1L);
foo1Clone.setName("x");
FooEntity foo2 = new FooEntity();
foo2.setId(2L);
foo2.setName("y");
assertThat("equal", foo1.equals(foo1Clone));
assertThat("Hashcode is based on data props", foo1.hashCode() == foo1Clone.hashCode());
assertThat("Different props - different instances", !foo1.equals(foo2));
assertThat("Different props - different hashcode", foo1.hashCode() != foo2.hashCode());
}
@Test
void repository_finds_by_id() {
Optional<FooEntity> f = fooRepository.findById(testFoo.getId());
assertThat("exists", f.isPresent());
}
@Test
void uses_custom_projection() {
Optional<ProjectedFooResult> f = fooRepository.getByIdToProjected(testFoo.getId());
assertThat("exists", f.isPresent());
assertThat("name matches", f.get().getName().equals("foo"));
assertThat("bars found", f.get().getBarCount() == 1);
}
}
|
package com.example.szupek.datepickerszupek;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.szupek.datepickerszupek.model.Wesele;
public class Edytuj_Activity extends AppCompatActivity {
TextView data;
EditText miejscowosc,lokal,imie,nazwisko,uklon,godzinaUklonu,cena,wyjazd,tel_mlody,tel_mloda,
notatki;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edytuj_);
data = (TextView) findViewById(R.id.textView_dodaj);
miejscowosc = (EditText) findViewById(R.id.editText_miejscowosc);
lokal = (EditText) findViewById(R.id.editTextLokal);
imie = (EditText) findViewById(R.id.editImie);
nazwisko = (EditText) findViewById(R.id.editNazwisko);
uklon = (EditText) findViewById(R.id.editUklon);
godzinaUklonu = (EditText) findViewById(R.id.editgodzinaUklonu);
cena = (EditText) findViewById(R.id.editCena);
wyjazd = (EditText) findViewById(R.id.editGodzinaWyjazdu);
tel_mlody = (EditText) findViewById(R.id.edittelefonMlody);
tel_mloda = (EditText) findViewById(R.id.editTelefonMloda);
//TODO Zrobić dodawanie notatek
notatki = (EditText) findViewById(R.id.editText_miejscowosc);
Intent intent= getIntent();
DAO zb = new DAO(new DBManager(this));
String databiezaca=intent.getStringExtra("dataDoEdycji");
Wesele k = zb.pokazJednaUmowe(databiezaca);
data.setText(k.getData());
miejscowosc.setText(k.getMiejscowosc());
lokal.setText(k.getLokal());
imie.setText(k.getImie());
nazwisko.setText(k.getNazwisko());
uklon.setText(k.getUklon());
godzinaUklonu.setText(k.getGodzinaUklonu());
cena.setText(k.getCena());
wyjazd.setText(k.getWyjazd());
tel_mlody.setText(k.getTel_Mlody());
tel_mloda.setText(k.getTel_Mloda());
final Context con = this;
Button ZatwierdzZmiany = (Button)findViewById(R.id.buttonZatwierdzZmiany);
ZatwierdzZmiany.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String data1 = data.getText().toString();
String miejscowosc1 = miejscowosc.getText().toString();
String lokal1 = lokal.getText().toString();
String imie1 = imie.getText().toString();
String nazwisko1 = nazwisko.getText().toString();
String uklon1 = uklon.getText().toString();
String godzinaUklonu1 = godzinaUklonu.getText().toString();
String cena1 = cena.getText().toString();
String wyjazd1 = wyjazd.getText().toString();
String tel_mlody1 = tel_mlody.getText().toString();
String tel_mloda1 = tel_mloda.getText().toString();
String notatki1 = notatki.getText().toString();
Wesele wesele = new Wesele(data1, miejscowosc1, lokal1, imie1, nazwisko1, uklon1,
godzinaUklonu1, cena1, wyjazd1, tel_mlody1, tel_mloda1, notatki1);
DAO nowy = new DAO(new DBManager(con));
boolean dodalo = nowy.Dodaj_Wesele(wesele);
if (dodalo = true){
Toast.makeText(Edytuj_Activity.this, "Pomyślnie zedytowano wesele",
Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Edytuj_Activity.this, dodaj_Activity2.class);
intent.putExtra("dataUmowy",data1);
startActivity(intent);
}else{
Toast.makeText(Edytuj_Activity.this, "UPPPSS coś poszło nie tak :/",
Toast.LENGTH_SHORT).show();
}
}
});
}
}
|
package com.stk123.web.action;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import com.stk123.model.tree.Tree;
import com.stk123.common.util.JsonUtils;
import com.stk123.common.CommonConstant;
import com.stk123.service.IndexService;
import com.stk123.service.StkService;
import com.stk123.web.context.StkContext;
public class IndexAction {
public final static StkService stkService = new StkService();
public final static IndexService indexService = new IndexService();
public String perform() throws Exception {
return CommonConstant.ACTION_SUCC;
}
public void getUpdownRank() throws Exception {
StkContext sc = StkContext.getContext();
List<String> codes = stkService.getUpdownCodes("desc");
String json = stkService.getStksAsJson(codes);
sc.setResponseAsJson(json);
}
public void getIndexTree() throws Exception {
StkContext sc = StkContext.getContext();
String json = indexService.getTreeJson();
sc.setResponseAsJson(json);
}
public void index() throws Exception {
StkContext sc = StkContext.getContext();
HttpServletRequest request = sc.getRequest();
String sid = request.getParameter(CommonConstant.PARAMETER_ID);
Tree tree = indexService.getTree();
String template = "undefined";
if(sid != null && sid.length() > 0){
int id = Integer.parseInt(sid);
System.out.println(id);
List<Map> list = null;
if(id > 1000 && id < 2000){//自定义指标
}else if(id > 2000 && id < 3000){//宏观经济指标
}else if(id > 3000 && id < 4000){//小智慧指标
if(id == 3001){
list = indexService.bias(id);
}
}else if(id > 4000 && id < 5000){//个股K线指标
}else if(id > 5000 && id < 6000){//个股财务指标
}else if(id > 60000 && id < 70000){//行业平均PE
template = tree.getNode(IndexService.ID_INDUSTRY_PE).getStkIndexNode().getChartTemplate();
template = StringUtils.replace(template, "\"", "\\\"");
list = indexService.industryPE(id - IndexService.ID_INDUSTRY_PE);
}else if(id > 700000 && id < 800000) {
list = indexService.getPPI(id);
}
String json = JsonUtils.getJsonString4JavaPOJO(list, CommonConstant.DATE_FORMAT_YYYY_MM_DD);
StringBuffer sb = new StringBuffer();
sb.append("{\"template\":\"").append(template).append("\",\"datas\":").append(json).append("}");
//System.out.println(sb.toString());
sc.setResponse(sb.toString());
return;
}
}
}
|
package apartment;
import form.FromApartment;
import form.FormRoom;
import form.FormTenant;
import form.FormTenantRoom;
import formManagement.FormMainApartment;
import formManagement.FormRentApartment;
import javax.swing.JOptionPane;
import report.ReportNetIncome;
import report.ReportRentCondition;
import report.ReportRoom;
public class JFrameApartment extends javax.swing.JFrame {
public JFrameApartment() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
myDesktop = new javax.swing.JDesktopPane();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();
menuApartment = new javax.swing.JMenuItem();
menuRoom = new javax.swing.JMenuItem();
menuTenant = new javax.swing.JMenuItem();
menuTenantRoom = new javax.swing.JMenuItem();
menuExit1 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
menuRentApartment = new javax.swing.JMenuItem();
menuMainApartment = new javax.swing.JMenuItem();
menuExit2 = new javax.swing.JMenuItem();
jMenu1 = new javax.swing.JMenu();
menuReportIncome = new javax.swing.JMenuItem();
menuReportRoom = new javax.swing.JMenuItem();
menuRentCondition = new javax.swing.JMenuItem();
menuExit3 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("โปรแกรมจัดการอพาร์ทเมนท์");
setName("myDesktop"); // NOI18N
jMenu2.setText("ระบบจัดการข้อมูลพื้นฐาน");
menuApartment.setText("ข้อมูลอพาร์ทเมนท์");
menuApartment.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuApartmentActionPerformed(evt);
}
});
jMenu2.add(menuApartment);
menuRoom.setText("ข้อมูลห้องพัก");
menuRoom.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuRoomActionPerformed(evt);
}
});
jMenu2.add(menuRoom);
menuTenant.setText("ข้อมูลผู้เช่า");
menuTenant.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuTenantActionPerformed(evt);
}
});
jMenu2.add(menuTenant);
menuTenantRoom.setText("ข้อมูลผู้เช่าห้องพัก");
menuTenantRoom.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuTenantRoomActionPerformed(evt);
}
});
jMenu2.add(menuTenantRoom);
menuExit1.setText("ออกจากโปรแกรม");
menuExit1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuExit1ActionPerformed(evt);
}
});
jMenu2.add(menuExit1);
jMenuBar1.add(jMenu2);
jMenu3.setText("ระบบการจัดการอพาร์ทเมนท์");
menuRentApartment.setText("การเช่าอพาร์ทเมนท์");
menuRentApartment.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuRentApartmentActionPerformed(evt);
}
});
jMenu3.add(menuRentApartment);
menuMainApartment.setText("การบำรุงรักษาอพาร์ทเมนท์");
menuMainApartment.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuMainApartmentActionPerformed(evt);
}
});
jMenu3.add(menuMainApartment);
menuExit2.setText("ออกจากโปรแกรม");
menuExit2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuExit2ActionPerformed(evt);
}
});
jMenu3.add(menuExit2);
jMenuBar1.add(jMenu3);
jMenu1.setText("ระบบการแสดงรายงาน");
menuReportIncome.setText("รายงานรายได้สุทธิ");
menuReportIncome.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuReportIncomeActionPerformed(evt);
}
});
jMenu1.add(menuReportIncome);
menuReportRoom.setText("รายงานข้อมูลห้องว่าง");
menuReportRoom.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuReportRoomActionPerformed(evt);
}
});
jMenu1.add(menuReportRoom);
menuRentCondition.setText("รายงานข้อมูลผู้เช่าตามเงื่อนไข");
menuRentCondition.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuRentConditionActionPerformed(evt);
}
});
jMenu1.add(menuRentCondition);
menuExit3.setText("ออกจากโปรแกรม");
menuExit3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuExit3ActionPerformed(evt);
}
});
jMenu1.add(menuExit3);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(myDesktop, javax.swing.GroupLayout.DEFAULT_SIZE, 1000, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(myDesktop, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 574, Short.MAX_VALUE)
);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-1018)/2, (screenSize.height-647)/2, 1018, 647);
}// </editor-fold>//GEN-END:initComponents
private void menuExit1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuExit1ActionPerformed
if(JOptionPane.showConfirmDialog(this ,"ยืนยันการปิดโปรแกรม","ยืนยัน",JOptionPane.YES_NO_CANCEL_OPTION)==JOptionPane.YES_NO_OPTION)
{System.exit(0);}
}//GEN-LAST:event_menuExit1ActionPerformed
private void menuExit2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuExit2ActionPerformed
if(JOptionPane.showConfirmDialog(this ,"ยืนยันการปิดโปรแกรม","ยืนยัน",JOptionPane.YES_NO_CANCEL_OPTION)==JOptionPane.YES_NO_OPTION)
{System.exit(0);}
}//GEN-LAST:event_menuExit2ActionPerformed
private void menuExit3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuExit3ActionPerformed
if(JOptionPane.showConfirmDialog(this ,"ยืนยันการปิดโปรแกรม","ยืนยัน",JOptionPane.YES_NO_CANCEL_OPTION)==JOptionPane.YES_NO_OPTION)
{System.exit(0);}
}//GEN-LAST:event_menuExit3ActionPerformed
private void menuApartmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuApartmentActionPerformed
FromApartment fam = new FromApartment();
fam.setVisible(true);
myDesktop.add(fam);
}//GEN-LAST:event_menuApartmentActionPerformed
private void menuRoomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRoomActionPerformed
FormRoom fr = new FormRoom();
fr.setVisible(true);
myDesktop.add(fr);
}//GEN-LAST:event_menuRoomActionPerformed
private void menuTenantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuTenantActionPerformed
FormTenant ftn = new FormTenant();
ftn.setVisible(true);
myDesktop.add(ftn);
}//GEN-LAST:event_menuTenantActionPerformed
private void menuTenantRoomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuTenantRoomActionPerformed
FormTenantRoom ftr = new FormTenantRoom();
ftr.setVisible(true);
myDesktop.add(ftr);
}//GEN-LAST:event_menuTenantRoomActionPerformed
private void menuRentApartmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRentApartmentActionPerformed
FormRentApartment fra = new FormRentApartment();
fra.setVisible(true);
myDesktop.add(fra);
}//GEN-LAST:event_menuRentApartmentActionPerformed
private void menuMainApartmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuMainApartmentActionPerformed
FormMainApartment fma = new FormMainApartment();
fma.setVisible(true);
myDesktop.add(fma);
}//GEN-LAST:event_menuMainApartmentActionPerformed
private void menuReportIncomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuReportIncomeActionPerformed
ReportNetIncome rpnic = new ReportNetIncome();
rpnic.setVisible(true);
myDesktop.add(rpnic);
}//GEN-LAST:event_menuReportIncomeActionPerformed
private void menuReportRoomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuReportRoomActionPerformed
ReportRoom rpr = new ReportRoom();
rpr.setVisible(true);
myDesktop.add(rpr);
}//GEN-LAST:event_menuReportRoomActionPerformed
private void menuRentConditionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRentConditionActionPerformed
ReportRentCondition rpr = new ReportRentCondition();
rpr.setVisible(true);
myDesktop.add(rpr);
}//GEN-LAST:event_menuRentConditionActionPerformed
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JFrameApartment().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem menuApartment;
private javax.swing.JMenuItem menuExit1;
private javax.swing.JMenuItem menuExit2;
private javax.swing.JMenuItem menuExit3;
private javax.swing.JMenuItem menuMainApartment;
private javax.swing.JMenuItem menuRentApartment;
private javax.swing.JMenuItem menuRentCondition;
private javax.swing.JMenuItem menuReportIncome;
private javax.swing.JMenuItem menuReportRoom;
private javax.swing.JMenuItem menuRoom;
private javax.swing.JMenuItem menuTenant;
private javax.swing.JMenuItem menuTenantRoom;
private javax.swing.JDesktopPane myDesktop;
// End of variables declaration//GEN-END:variables
}
|
package com.example.lbyanBack.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.example.lbyanBack.pojo.UserInfo;
@Mapper
public interface UserInfoMapper {
/**
* 保存用户个人信息
* @param userInfo
* @return
*/
@Insert("INSERT INTO T_LbyBack_UserInfo (c_id,c_user_id,c_username,c_email,dt_cjsj,c_num) VALUES(#{id},#{userid},#{username},#{email},#{cjsj},#{num})")
public int insertUserInfo(UserInfo userInfo);
/**
* 通过用户id查询用户详细信息
* @param id
* @return
*/
@Select("SELECT C_ID AS id,C_USERNAME as username, C_EMAIL AS email,C_USER_ID as userid,DT_CJSJ as cjsj,C_NUM AS num FROM T_LbyBack_UserInfo where C_USER_ID = #{id}")
public UserInfo getuserinfoById(@Param("id") String id);
@Select("SELECT C_ID AS id,C_USERNAME as username, C_EMAIL AS email,C_USER_ID as userid,DT_CJSJ as cjsj,C_NUM AS num FROM T_LbyBack_UserInfo where C_EMAIL = #{email}")
public List<UserInfo> getUserInfo(@Param("email") String email);
@Update("")
public int updateUserInfo(UserInfo userInfo);
}
|
package io.ceph.rgw.client.model.admin;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.builder.Buildable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Function;
/**
* Created by zhuangshuo on 2020/7/30.
*/
public class Entries implements SdkPojo, Buildable {
private static final SdkField<String> USER_FIELD = SdkField
.builder(MarshallingType.STRING)
.getter(getter(Entries::getUser))
.setter(setter(Entries::setUser))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("user")
.unmarshallLocationName("user").build()).build();
private static final SdkField<List<BucketUsage>> BUCKET_USAGES_FIELD = SdkField
.<List<BucketUsage>>builder(MarshallingType.LIST)
.getter(getter(Entries::getBucketUsages))
.setter(setter(Entries::setBucketUsages))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("buckets")
.unmarshallLocationName("buckets").build(),
ListTrait
.builder()
.memberLocationName("buckets")
.memberFieldInfo(
SdkField.builder(MarshallingType.SDK_POJO)
.constructor(BucketUsage::new)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("bucket").unmarshallLocationName("bucket").build()).build())
.build()).build();
private static final List<SdkField<?>> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(USER_FIELD, BUCKET_USAGES_FIELD));
private String user;
private List<BucketUsage> bucketUsages;
Entries() {
}
private static <T> Function<Object, T> getter(Function<Entries, T> g) {
return obj -> g.apply((Entries) obj);
}
private static <T> BiConsumer<Object, T> setter(BiConsumer<Entries, T> s) {
return (obj, val) -> s.accept((Entries) obj, val);
}
public String getUser() {
return user;
}
private void setUser(String user) {
this.user = user;
}
public List<BucketUsage> getBucketUsages() {
return bucketUsages;
}
private void setBucketUsages(List<BucketUsage> bucketUsages) {
this.bucketUsages = AdminRequest.unmodifiableList(bucketUsages);
}
@Override
public List<SdkField<?>> sdkFields() {
return SDK_FIELDS;
}
@Override
public Object build() {
return this;
}
@Override
public String toString() {
return "Entries{" +
"user='" + user + '\'' +
", bucketUsages=" + bucketUsages +
'}';
}
}
|
package com.eron.gbox.gui;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.permissions.Permission;
import com.eron.gbox.Crate;
import net.md_5.bungee.api.ChatColor;
public class CrateEditor {
Player p;
Crate crate;
int currentPage = 0;
Inventory c;
List<Inventory> pages = new ArrayList<Inventory>();
public static HashMap<UUID, CrateEditor> editing = new HashMap<UUID, CrateEditor>();
public CrateEditor(Player p, Crate crate) {
this.p = p;
this.crate = crate;
}
public Player getPlayer() {
return p;
}
public Crate getCrate() {
return crate;
}
public int getCurrentPage() {
return currentPage;
}
public Inventory getInventory() {
return c;
}
public Permission getEditCratePermission() {
return new Permission("gbox.edit." + crate.crateName);
}
public void AddItem(ItemStack item) {
if(crate.getMaximumChance() <= 0) {
//note player that no more items can get in because of precent problems.
p.sendMessage(ChatColor.RED + "You cannot add more items. Precent total is 100%.");
return;
}
ChanceGUI chanceInv = new ChanceGUI(this, item);
chanceInv.openChanceGUI();
}
public ItemStack createGUIitem(ItemStack item) {
ItemStack guiItem = item.clone();
ItemMeta meta = guiItem.getItemMeta();
List<String> lore = meta.getLore();
if (lore == null) {
lore = new ArrayList<String>();
}
lore.add("Item chance: " + crate.getItemChance(item) + "%");
meta.setLore(lore);
guiItem.setItemMeta(meta);
return guiItem;
}
public void openCrateGUI() {
this.c = Bukkit.createInventory(null, 54, crate.crateName);
int index = 0;
for (ItemStack i : crate.getItems()) {
ItemStack item = createGUIitem(i);
c.setItem(index, item);
index++;
}
p.openInventory(c);
editing.put(p.getUniqueId(), this);
}
}
|
package behavioral.mediator;
public interface IMediator {
public void send(String message,AColleague colleague);
}
|
package com.arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Majority {
public static void main(String[] args) {
Majority major = new Majority();
List<Integer> input = new ArrayList<Integer>();
input.add(1);
input.add(2);
input.add(1);
System.out.println(major.majorityElement(input));
}
public int majorityElement(final List<Integer> a) {
if(a ==null) return 0;
int length = a.size();
if(length ==0) return 0;
if(length <2) return a.get(0);
int majority = a.size()/2;
Map<Integer,Integer> countMap = new HashMap<Integer,Integer>();
for(int i=0 ;i<length;i++){
if(countMap.containsKey(a.get(i))){
int count = countMap.get(a.get(i));
if(count+1 >= majority)
return a.get(i);
else
countMap.put(a.get(i) , countMap.get(a.get(i)+1));
}else{
countMap.put(a.get(i),1);
}
}
return 0;
}
}
|
package jire.plugin;
import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public final class UniversalPluginLoader extends AbstractPluginLoader {
@Override
@SuppressWarnings("unchecked")
public Plugin load(File file) {
if (file.isDirectory()
|| !file.getName().toLowerCase().endsWith(".jar")) {
return null;
}
Class<? extends Plugin> pluginClass = null;
try {
Method method = URLClassLoader.class.getDeclaredMethod("addURL",
URL.class);
method.setAccessible(true);
method.invoke((URLClassLoader) ClassLoader.getSystemClassLoader(),
file.toURI().toURL());
ZipFile zf = new ZipFile(file);
Enumeration<? extends ZipEntry> entries = zf.entries();
while (entries.hasMoreElements()) {
ZipEntry e = entries.nextElement();
if (e.getName().toLowerCase().endsWith(".class")) {
Class<? extends Plugin> potentialClass = (Class<? extends Plugin>) Class
.forName(e.getName()
.substring(0, e.getName().length() - 6)
.replace("/", "."));
if (potentialClass
.isAnnotationPresent(PluginManifest.class)) {
pluginClass = potentialClass;
break;
}
}
}
zf.close();
return pluginClass.newInstance();
} catch (Throwable t) {
t.printStackTrace();
return null;
}
}
} |
package com.networks.ghosttears.user_profiles;
/**
* Created by NetWorks on 9/18/2017.
*/
public class PowerUps {
private int skip;
private int hint;
private int ban;
public PowerUps(){}
public PowerUps(int hint, int skip, int ban){
this.hint = hint;
this.skip = skip;
this.ban = ban;
}
public int getBan() {
return ban;
}
public int getHint() {
return hint;
}
public int getSkip() {
return skip;
}
public void setBan(int ban) {
this.ban = ban;
}
public void setHint(int hint) {
this.hint = hint;
}
public void setSkip(int skip) {
this.skip = skip;
}
}
|
package com.yc.education.controller.basic;
import com.github.pagehelper.PageInfo;
import com.yc.education.constants.SpringFxmlLoader;
import com.yc.education.controller.BaseController;
import com.yc.education.model.ProductStock;
import com.yc.education.model.basic.*;
import com.yc.education.model.purchase.InquiryProduct;
import com.yc.education.model.purchase.PurchaseProduct;
import com.yc.education.model.sale.SaleGoodsProduct;
import com.yc.education.model.sale.SaleOfferProduct;
import com.yc.education.model.sale.SalePurchaseOrderProduct;
import com.yc.education.model.sale.SaleReturnGoodsProduct;
import com.yc.education.model.stock.PurchaseStockProduct;
import com.yc.education.model.stock.StockOutSaleProduct;
import com.yc.education.service.ProductStockService;
import com.yc.education.service.basic.*;
import com.yc.education.service.purchase.InquiryProductService;
import com.yc.education.service.purchase.PurchaseProductService;
import com.yc.education.service.sale.ISaleGoodsProductService;
import com.yc.education.service.sale.ISaleOfferProductService;
import com.yc.education.service.sale.ISalePurchaseOrderProductService;
import com.yc.education.service.sale.ISaleReturnGoodsProductService;
import com.yc.education.service.stock.IStockOutSaleProductService;
import com.yc.education.service.stock.PurchaseStockProductService;
import com.yc.education.util.*;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;
import java.util.ResourceBundle;
/**
* @ClassName ProductBasicController
* @Description TODO 产品基本资料
* @Author QuZhangJing
* @Date 2018-08-14 13:47
* @Version 1.0
*/
@Controller
public class ProductBasicController extends BaseController implements Initializable {
@Autowired
private ProductBasicService productBasicService; //产品 Service
@Autowired
private DepotBasicService depotBasicService; //库位 SErvice
@Autowired
private SupplierBasicService supplierBasicService;//供应商基本资料 Service
@Autowired
private ProductSupplierService productSupplierService;//产品-供应商
@Autowired
private ProductDetailsService productDetailsService;//产品-规格明细
@Autowired
private ProductStockService productStockService;//产品 --- 库存
@Autowired
private EmployeeBasicService employeeBasicService;//员工 Service
@FXML
Label fxmlStatus; //窗体状态
@FXML private VBox first; //第一页
@FXML private VBox prev; //上一页
@FXML private VBox next; //下一页
@FXML private VBox last; //最后一页
@FXML private VBox submitvbox; //提交
@FXML private VBox clearvbox; //清除
@FXML private VBox insertvbox; //新增
@FXML private VBox updatevbox; //修改
@FXML private VBox deletevbox; //删除
@FXML private VBox printingvbox; //打印
@FXML private HBox insertHBox; //库位
@FXML private HBox textFieldHBox; //库位
@FXML private Label scope;//折扣
private long statusid = 0;
/*************************************************表单控件 Start *************************************************************/
/**
*
* isnum
* proname
* pronum
* invoicenum
* basicunit
* protype
* normpricetype;
* normprice;
* lowpricetype;
* lowprice;
* pronature;
* prosource;
* packnum;
* minnum;
* businesstype;
* business;
* purchasetype;
* purchase;
* maxstock;
* safetystock;
* inventoryplace;
* remarks;
* addpeople;
* adddate;
* updatepeople;
* updatedate;
* costtype;
* Double cost;
* Integer isstop;
* String stopdes;
*
* 控件件名与字段名对应 见 com.yc.education.model.ProductBasic
*/
@FXML TextField isnum;
@FXML TextField proname;
@FXML TextField pronum;
@FXML TextField invoicenum;
@FXML ComboBox basicunit;
@FXML ComboBox protype;
@FXML ComboBox normpricetype;
@FXML TextField normprice;
@FXML ComboBox lowpricetype;
@FXML TextField lowprice;
@FXML ComboBox pronature;
@FXML ComboBox prosource;
@FXML TextField packnum;
@FXML TextField minnum;
@FXML ComboBox businesstype;
@FXML TextField business;
@FXML ComboBox purchasetype;
@FXML TextField purchase;
@FXML TextField maxstock;
@FXML TextField safetystock;
@FXML TextField weights;
@FXML TextField inventoryplace;
@FXML TextField remarks;
@FXML TextField addpeople;
@FXML TextField adddate;
@FXML TextField updatepeople;
@FXML TextField updatedate;
@FXML ComboBox costtype;
@FXML TextField cost;
@FXML TextField costusd; //美金
@FXML CheckBox isstop;
@FXML TextField stopdes;
/**
* 产品管理之供应商
*/
private ObservableList<ProductSupplierProperty> productSupplierProperties = FXCollections.observableArrayList();
/**
* 产品管理之规格明细
*/
private ObservableList<ProductDetailsProperty> productDetailsProperties = FXCollections.observableArrayList();
/*************************************************表单控件 End *************************************************************/
/**
* ******************************** 供应商
*/
@FXML TableView product_supplier;
@FXML TableColumn supplier_supid; //编号
@FXML TableColumn supplier_supplierid; //供应商编号
@FXML TableColumn supplier_supdes; //供应商简称
@FXML TableColumn supplier_supply;//主要供应
@FXML TableColumn supplier_remarks;//备注
private long supplierNum=0,remarkNum=0;
/**
********************************************* 规格明细
*/
@FXML TableView product_detail;
@FXML TableColumn detail_id; //id
@FXML TableColumn detail_declare; //说明
@FXML private TableView tableViewProduct; //产品基本查询
@FXML private TableColumn depid; //id
@FXML private TableColumn findproductid; //产品基本编号
@FXML private TableColumn findproductname; //产品基本名称
@FXML private TableColumn findprotype; //产品类型
@FXML private TableColumn findnormprice; //产品标准售价
@FXML private TableColumn findlowprice; //产品最低售价
@FXML private TableColumn findsafetystock; //安全存量
@FXML private TableColumn findremarks; //备注
@FXML TableView tableViewDepot;
@FXML TableColumn finddepid;
@FXML TableColumn finddepotid; //id
@FXML TableColumn finddepotname; //说明
@FXML private TableView tableView3; //供应商查询
@FXML private TableColumn supid; //id
@FXML private TableColumn findsupplierid; //供应商编号
@FXML private TableColumn findsuppliername; //供应商简称
@FXML private CheckBox offerOrder; //报价
@FXML private CheckBox OrderGoods; //订货
@FXML private CheckBox saleOrder; //销货
@FXML private CheckBox sellingBack; //销退
@FXML private CheckBox inquiryOrder; //询价
@FXML private CheckBox purchaseOrder; //采购
@FXML private CheckBox saleOut; //销货出库
@FXML private CheckBox purchaseIn; //采购入库
@FXML private Button searchBtn; //查找
//历史交易开始日期
@FXML DatePicker historyDateStart;
//历史交易结束日期
@FXML DatePicker historyDateEnd;
//报价单 报价产品
@Autowired
private ISaleOfferProductService iSaleOfferProductService;
//订货单 订货产品
@Autowired
private ISalePurchaseOrderProductService iSalePurchaseOrderProductService;
//销货单 销货产品
@Autowired
private ISaleGoodsProductService iSaleGoodsProductService;
//销退单 销退产品
@Autowired
private ISaleReturnGoodsProductService iSaleReturnGoodsProductService;
//询价单 询价产品
@Autowired
private InquiryProductService inquiryProductService;
//采购订单 订单产品
@Autowired
private PurchaseProductService purchaseProductService;
//销货出库 销货出库产品
@Autowired
private IStockOutSaleProductService iStockOutSaleProductService;
//采购入库单 采购入库产品
@Autowired
private PurchaseStockProductService purchaseStockProductService;
@FXML private TableView productHistoryTableView;
//制单日期
@FXML private TableColumn createDate;
//单据类型
@FXML private TableColumn orderType;
//单号
@FXML private TableColumn orderNo;
//客户/供应
@FXML private TableColumn supplierName;
//客户/供应
@FXML private TableColumn productName;
//数量
@FXML private TableColumn productNum;
//单价
@FXML private TableColumn productPrice;
//税别
@FXML private TableColumn taxType;
//备注
@FXML private TableColumn productRemarks;
//产品基本资料历史查询记录
ObservableList<ProductHistoryProperty> productHistoryProperties = FXCollections.observableArrayList();
private Stage stage = new Stage();
private static SpringFxmlLoader loader = new SpringFxmlLoader();
@FXML private VBox productBasic_find_fast;
@FXML private VBox productBasic_find_prev;
@FXML private VBox productBasic_find_next;
@FXML private VBox productBasic_find_last;
private int pageSize;
@FXML private TextField product_basic_textField;
@FXML private VBox depot_find_fast;
@FXML private VBox depot_find_prev;
@FXML private VBox depot_find_next;
@FXML private VBox depot_find_last;
@FXML private TextField depot_textField;
//交易历史 分页条数
@FXML private TextField historySize;
private int tableViewIndex = 0;
@FXML private VBox supplier_find_fast;
@FXML private VBox supplier_find_prev;
@FXML private VBox supplier_find_next;
@FXML private VBox supplier_find_last;
@FXML private TextField supplier_textField;
@FXML private CheckBox stopCheckBox;
@FXML private TextField order_textField;
@FXML private TextField order_supplier_textField;
@FXML
private Label costlable;
@FXML
private Label dllable;
/**
* 生成编号
* @return
*/
// public String createIsnum(){
// String maxIsnum = companyBasicService.selectMaxIdnum();
// if(maxIsnum != null){
// String maxAlphabet = maxIsnum.substring(0,1);
// int currenNumber = Integer.parseInt(maxIsnum.substring(1,maxIsnum.length()));
// for (int i = 0; i< NumberUtil.ALPHABET.length; i++){
// if(currenNumber == NumberUtil.MAXNUMBER){
// if( maxAlphabet.equals(NumberUtil.ALPHABET[i]) ){
// return NumberUtil.ALPHABET[i+1]+"001";
// }
// }
// }
// if(currenNumber>0 && currenNumber < 9){
// return maxAlphabet +"00"+(currenNumber+1);
// }else if(currenNumber >= 9 && currenNumber< 99){
// return maxAlphabet +"0"+(currenNumber+1);
// }else{
// return maxAlphabet +(currenNumber+1);
// }
// }
// return "A001";
// }
public void findProductBasicSearch(){
String pageSizes =product_basic_textField.getText();
if(!"".equals(pageSizes) || pageSizes != null ){
pageSize = Integer.parseInt(pageSizes);
loadMoreProduct(1);
}else{
alert_informationDialog("请输入页码数!");
}
}
public void findProductBasicPages(MouseEvent event){
Node node =(Node)event.getSource();
//当前页码
int pageNum =Integer.parseInt(String.valueOf(node.getUserData()));
loadMoreProduct(pageNum);
}
public void moreProductButtonClick(){
stage.setTitle("现有产品基本查询");
Pane pane = new Pane();
pane.getChildren().setAll(loader.load("/fxml/basic/product_find.fxml"));
Scene scene = new Scene(pane);
stage.setScene(scene);
/*stage.setResizable(false);*/
/*stage.initStyle(StageStyle.UNDECORATED);
DragUtil.addDragListener(stage, pane); //拖拽监听*/
stage.show();
pageSize = 10;
loadMoreProduct(1);
}
/**
* 现有产品查询
*/
public void loadMoreProduct(int pageNum){
List<ProductBasic> productBasics = productBasicService.selectProductBasic(stopCheckBox.isSelected() ? 1 :0,pageNum,pageSize);
PageInfo<ProductBasic> pageInfo = new PageInfo<>(productBasics);
productBasic_find_fast.setUserData(1); //首页
productBasic_find_prev.setUserData(pageInfo.getPrePage()); //上一页
productBasic_find_next.setUserData(pageInfo.getNextPage());//下一页
productBasic_find_last.setUserData(pageInfo.getPages());//尾页
ObservableList<ProductBasic> list = FXCollections.observableArrayList();
tableViewProduct.setEditable(true);
/*staffcode.setCellFactory((TableColumn<Object,Object> a ) -> new EditingCell<>());*/
// depid.setCellValueFactory(new PropertyValueFactory("id"));
findproductid.setCellValueFactory(new PropertyValueFactory("isnum"));
findproductname.setCellValueFactory(new PropertyValueFactory("proname"));
findprotype.setCellValueFactory(new PropertyValueFactory("protype"));
findnormprice.setCellValueFactory(new PropertyValueFactory("normprice"));
findlowprice.setCellValueFactory(new PropertyValueFactory("lowprice"));
findsafetystock.setCellValueFactory(new PropertyValueFactory("safetystock"));
findremarks.setCellValueFactory(new PropertyValueFactory("remarks"));
for (ProductBasic productBasic:productBasics) {
if(productBasic.getIsstop() ==1){
productBasic.setProname(productBasic.getProname()+"(停用)");
}
list.add(productBasic);
}
tableViewProduct.setItems(list); //tableview添加list
tableViewProduct.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ProductBasic>() {
@Override
public void changed(ObservableValue<? extends ProductBasic> observableValue, ProductBasic oldItem, ProductBasic newItem) {
if(newItem.getIsnum()!= null && !("".equals(newItem.getIsnum()))){
isnum.setUserData(newItem.getId());
}
}
});
tableViewProduct.setOnMouseClicked((MouseEvent t) -> {
if (t.getClickCount() == 2) {
closeSureWin();
}
});
}
public void closeSureWin(){
long id =(long)isnum.getUserData();
ProductBasic productBasic = productBasicService.selectByKey(id);
loadData(productBasic);
coseWin();
}
public void coseWin(){
stage.close();
}
public void findDepotSearch(){
String pageSizes =depot_textField.getText();
if(!"".equals(pageSizes) || pageSizes != null ){
pageSize = Integer.parseInt(pageSizes);
loadMoreProductDepot(1);
}else{
alert_informationDialog("请输入页码数!");
}
}
public void findDepotPages(MouseEvent event){
Node node =(Node)event.getSource();
//当前页码
int pageNum =Integer.parseInt(String.valueOf(node.getUserData()));
loadMoreProductDepot(pageNum);
}
/**
* 现有库位查询
*/
public void moreProductDepotButtonClick(){
stage.setTitle("现有库位查询");
Pane pane = new Pane();
pane.getChildren().setAll(loader.load("/fxml/basic/product_depot_find.fxml"));
Scene scene = new Scene(pane);
stage.setScene(scene);
/*stage.setResizable(false);*/
/*stage.initStyle(StageStyle.UNDECORATED);
DragUtil.addDragListener(stage, pane); //拖拽监听*/
stage.show();
pageSize = 10;
loadMoreProductDepot(1);
}
/**
* 现有库位查询
*/
public void loadMoreProductDepot(int pageNum){
List<DepotBasic> depotBasicList = depotBasicService.selectDepotBasic("".equals(order_textField.getText()) || order_textField.getText() == null ? "" : order_textField.getText(),pageNum,pageSize);
PageInfo<DepotBasic> pageInfo = new PageInfo<>(depotBasicList);
depot_find_fast.setUserData(1); //首页
depot_find_prev.setUserData(pageInfo.getPrePage()); //上一页
depot_find_next.setUserData(pageInfo.getNextPage());//下一页
depot_find_last.setUserData(pageInfo.getPages());//尾页
ObservableList<DepotBasic> list = FXCollections.observableArrayList();
/*staffcode.setCellFactory((TableColumn<Object,Object> a ) -> new EditingCell<>());*/
// finddepid.setCellValueFactory(new PropertyValueFactory("id"));
finddepotid.setCellValueFactory(new PropertyValueFactory("isnum"));
finddepotname.setCellValueFactory(new PropertyValueFactory("depname"));
for (DepotBasic depotBasic:depotBasicList) {
list.add(depotBasic);
}
tableViewDepot.setItems(list); //tableview添加list
tableViewDepot.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<DepotBasic>() {
@Override
public void changed(ObservableValue<? extends DepotBasic> observableValue, DepotBasic oldItem, DepotBasic newItem) {
if(newItem.getIsnum()!= null && !("".equals(newItem.getIsnum()))){
statusid = newItem.getId();
}
}
});
tableViewDepot.setOnMouseClicked((MouseEvent t) -> {
if (t.getClickCount() == 2) {
closeDepotWin();
}
});
}
public void closeDepotWin(){
DepotBasic depotBasic = depotBasicService.selectByKey(statusid);
if(depotBasic != null){
ObservableList<Node> textFields = textFieldHBox.getChildren();
textFieldHBox.setUserData("");
for(int i=0,len=textFields.size();i<len;i++){
TextField textField = (TextField)textFields.get(i);
if(i==len-1){
textField.setText(depotBasic.getIsnum());
}
if(textFieldHBox.getUserData().equals("")){
textFieldHBox.setUserData(textField.getText());
}else{
textFieldHBox.setUserData(textFieldHBox.getUserData()+","+textField.getText());
}
}
}
coseWin(); //关闭窗体
}
/**
* 加载数据
* @param productBasic
*/
public void loadData(ProductBasic productBasic){
isnum.setUserData(productBasic.getId());
isnum.setText(productBasic.getIsnum());
if(productBasic.getIsstop() == 1){
proname.setText(productBasic.getProname()+"(停用)");
}else{
proname.setText(productBasic.getProname());
}
pronum.setText(productBasic.getPronum());
invoicenum.setText(productBasic.getInvoicenum());
/* basicunit.getItems().setAll(
"斤","公斤","吨"
);*/
int bct = productBasic.getBasicunit().intValue();
/* basicunit.getSelectionModel().select(--bct);*/
setComboBox(5L,basicunit,--bct);
/* protype.getItems().setAll(
"零件","螺纹刀片"
);*/
int pte = productBasic.getProtype().intValue();
/* protype.getSelectionModel().select(--pte);*/
setComboBox(6L,protype,--pte);
setComboBox(7L,normpricetype,0);
/*normpricetype.getItems().setAll(
"RMB"
);*/
/* int nte = productBasic.getNormpricetype().intValue();*/
/* normpricetype.getSelectionModel().select(0);*/
normprice.setText(productBasic.getNormprice().toString());
/* int lte = productBasic.getLowpricetype().intValue();*/
/* lowpricetype.getItems().setAll(
"RMB"
);*/
setComboBox(7L,lowpricetype,0);
/* lowpricetype.getSelectionModel().select(0);*/
lowprice.setText(productBasic.getLowprice().toString());
{
String nomPriceStr = normprice.getText();
String lowPriceStr = lowprice.getText();
if(!"".equals(nomPriceStr)&&!"".equals(lowPriceStr)){
Double nomprice = Double.parseDouble(nomPriceStr);//标准售价
Double lowprice = Double.parseDouble(lowPriceStr);//最低售价
Double scopePoint = (lowprice/nomprice)*100;
if(scopePoint.toString().equals("NaN"))scopePoint = 0.00;
if(scopePoint.toString().equals("-Infinity"))scopePoint = 0.00;
BigDecimal bigDecimal = new BigDecimal(scopePoint);
scope.setText(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()+"%");
}
}
int pae = productBasic.getPronature().intValue();
setComboBox(8L,pronature,--pae);
int pse = productBasic.getProsource().intValue();
setComboBox(9L,prosource,--pse);
packnum.setText(productBasic.getPacknum().toString());
minnum.setText(productBasic.getMinnum().toString());
int bet = productBasic.getBusinesstype().intValue();
businesstype.getSelectionModel().select(--bet);
business.setText(productBasic.getBusiness());
int phe = productBasic.getPurchasetype().intValue();
purchasetype.getSelectionModel().select(--phe);
purchase.setText(productBasic.getPurchase());
maxstock.setText(productBasic.getMaxstock().toString());
safetystock.setText(productBasic.getSafetystock().toString());
weights.setText(productBasic.getWeights().toString());
String place = productBasic.getInventoryplace();
ObservableList<TextField> placeList = FXCollections.observableArrayList();
String[] places= place.split(",");
textFieldHBox.setPrefWidth(0);
textFieldHBox.setUserData("");
insertHBox.setPrefWidth(227);
for (int i=0;i<places.length;i++){
textFieldHBox.setPrefWidth(textFieldHBox.getPrefWidth()+70);
insertHBox.setPrefWidth(insertHBox.getPrefWidth()+70);
TextField textField = new TextField();
textField.setPrefWidth(70.0);
textField.setPrefHeight(23.0);
textField.setText(places[i]);
textField.setOnKeyPressed(new EventHandler<KeyEvent>(){
@Override
public void handle(KeyEvent event) {
if(event.getCode()==KeyCode.ENTER){
findIsNum(event);
}
if(event.getCode()==KeyCode.DELETE){
if(f_alert_confirmDialog(AppConst.ALERT_HEADER, AppConst.ALERT_DELETE)) {
DepotKeyPress(event);
}
}
}
});
if(i==0){
textFieldHBox.setUserData(places[i]);
}else{
textFieldHBox.setUserData(textFieldHBox.getUserData()+","+places[i]);
}
placeList.add(textField);
}
textFieldHBox.getChildren().setAll(placeList);
remarks.setText(productBasic.getRemarks());
addpeople.setText(productBasic.getAddpeople());
adddate.setText(productBasic.getAdddate());
updatepeople.setText(productBasic.getUpdatepeople());
updatedate.setText(productBasic.getUpdatedate());
/* costtype.getItems().setAll(
"RMB"
);*/
setComboBox(7L,costtype,0);
/*int cte = productBasic.getCosttype().intValue();*/
/*costtype.getSelectionModel().select(0);*/
cost.setText(productBasic.getCost().toString());
costusd.setText(productBasic.getUsdcost().toString());
if(productBasic.getIsstop()==1){
isstop.setSelected(true);
}else{
isstop.setSelected(false);
}
stopdes.setText(productBasic.getStopdes());
loadSupplier(productBasic.getId());
changeEditable(false);
submitvbox.setDisable(true);
insertvbox.setDisable(false);
updatevbox.setDisable(false);
deletevbox.setDisable(false);
//权限管理
matchingPermissions("产品基本资料",insertvbox,deletevbox,updatevbox,printingvbox,clearvbox);
}
public void loadSupplier(long productId){
/**
* ******************************************供应商&&TableView
*/
List<ProductSupplier > productSuppliers = productSupplierService.selectProducctSupplierByProid(productId);
supplier_supplierid.setCellFactory(TextFieldTableCell.forTableColumn());
supplier_supdes.setCellFactory(TextFieldTableCell.forTableColumn());
supplier_supply.setCellFactory(TextFieldTableCell.forTableColumn());
supplier_remarks.setCellFactory(TextFieldTableCell.forTableColumn());
supplier_supid.setCellValueFactory(new PropertyValueFactory("id"));
supplier_supplierid.setCellValueFactory(new PropertyValueFactory("supplierid"));
supplier_supdes.setCellValueFactory(new PropertyValueFactory("supdes"));
supplier_supply.setCellValueFactory(new PropertyValueFactory("supply"));
supplier_remarks.setCellValueFactory(new PropertyValueFactory("remarks"));
productSupplierProperties.clear();
if(productSuppliers.size()>0) {
for (ProductSupplier productSupplier : productSuppliers) {
ProductSupplierProperty productSupplierProperty = new ProductSupplierProperty(productSupplier.getId(),productSupplier.getSupplierid(),productSupplier.getSupdes(),productSupplier.getSupply(),productSupplier.getRemarks());
productSupplierProperties.add(productSupplierProperty);
}
}
product_supplier.setItems(productSupplierProperties);
product_supplier.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ProductSupplierProperty>() {
@Override
public void changed(ObservableValue<? extends ProductSupplierProperty> observableValue, ProductSupplierProperty oldItem, ProductSupplierProperty newItem) {
if(newItem.getId() >0){
supplierNum=newItem.getId();
}else{
supplierNum=0;
}
}
});
/**
* ******************************************规格明细&&TableView
*/
List<ProductDetails> productDetails = productDetailsService.selectProductDetailsByProid(productId);
detail_declare.setCellFactory(TextFieldTableCell.forTableColumn());
detail_id.setCellValueFactory(new PropertyValueFactory("id"));
detail_declare.setCellValueFactory(new PropertyValueFactory("declare"));
productDetailsProperties.clear();
if(productSuppliers.size()>0) {
for (ProductDetails productDetails1 : productDetails) {
ProductDetailsProperty productDetailsProperty = new ProductDetailsProperty(productDetails1.getId(),productDetails1.getDeclare());
productDetailsProperties.add(productDetailsProperty);
}
}
product_detail.setItems(productDetailsProperties);
product_detail.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ProductDetailsProperty>() {
@Override
public void changed(ObservableValue<? extends ProductDetailsProperty> observableValue, ProductDetailsProperty oldItem, ProductDetailsProperty newItem) {
if(newItem.getId() >0){
remarkNum=newItem.getId();
}
}
});
}
/**
* 产品管理供应商 之TabelView 增改
* @param proid
*/
public void saveProductSupplier(long proid){
for (ProductSupplierProperty productSupplierProperty :productSupplierProperties) {
if(productSupplierProperty.getSupplierid()!=null){
if(productSupplierProperty.getId()>0){
//修改供应商
ProductSupplier productSupplier = new ProductSupplier(productSupplierProperty.getId(),productSupplierProperty.getSupplierid(),productSupplierProperty.getSupdes(),productSupplierProperty.getSupply(),productSupplierProperty.getRemarks());
productSupplierService.updateNotNull(productSupplier);
}else{
//新增供应商
ProductSupplier productSupplier = new ProductSupplier(productSupplierProperty.getId(),productSupplierProperty.getSupplierid(),productSupplierProperty.getSupdes(),productSupplierProperty.getSupply(),productSupplierProperty.getRemarks(),proid);
productSupplierService.save(productSupplier);
}
}
}
}
/**
* 产品管理规格明细 之TabelView 增改
* @param proid
*/
public void saveProductDetails(long proid){
for (ProductDetailsProperty productDetailsProperty :productDetailsProperties) {
if(productDetailsProperty.getDeclare()!=null){
if(productDetailsProperty.getId()>0){
//修改规格明细
ProductDetails productDetails = new ProductDetails(productDetailsProperty.getId(),productDetailsProperty.getDeclare());
productDetailsService.updateNotNull(productDetails);
}else{
//新增规格明细
ProductDetails productDetails = new ProductDetails(productDetailsProperty.getId(),productDetailsProperty.getDeclare(),proid);
productDetailsService.save(productDetails);
}
}
}
}
//产品供应商空白行
public void blankProductSupplier(){
ProductSupplierProperty productSupplierProperty = new ProductSupplierProperty();
productSupplierProperties.add(productSupplierProperty);
}
//产品规格明细空白行
public void blankDetails(){
ProductDetailsProperty productDetailsProperty = new ProductDetailsProperty();
productDetailsProperties.add(productDetailsProperty);
}
public void findSupplierSearch(){
String pageSizes =supplier_textField.getText();
if(!"".equals(pageSizes) || pageSizes != null ){
pageSize = Integer.parseInt(pageSizes);
loadMoreProductSupplier(1);
}else{
alert_informationDialog("请输入页码数!");
}
}
public void findSupplierPages(MouseEvent event){
Node node =(Node)event.getSource();
//当前页码
int pageNum =Integer.parseInt(String.valueOf(node.getUserData()));
loadMoreProductSupplier(pageNum);
}
public void moreProductSupplierButtonClick(){
stage.setTitle("现有供应商查询");
Pane pane = new Pane();
pane.getChildren().setAll(loader.load("/fxml/basic/product_supplier_find.fxml"));
Scene scene = new Scene(pane);
stage.setScene(scene);
/*stage.setResizable(false);*/
/*stage.initStyle(StageStyle.UNDECORATED);
DragUtil.addDragListener(stage, pane); //拖拽监听*/
stage.show();
pageSize = 10;
loadMoreProductSupplier(1);
}
/**
* 现有供应商查询
*/
public void loadMoreProductSupplier(int pageNum){
List<SupplierBasic> supplierBasics = supplierBasicService.selectSupplierBasic("".equals(order_supplier_textField.getText()) || order_supplier_textField.getText() == null ? "" :order_supplier_textField.getText(),pageNum,pageSize);
PageInfo<SupplierBasic> pageInfo = new PageInfo<>(supplierBasics);
supplier_find_fast.setUserData(1); //首页
supplier_find_prev.setUserData(pageInfo.getPrePage()); //上一页
supplier_find_next.setUserData(pageInfo.getNextPage());//下一页
supplier_find_last.setUserData(pageInfo.getPages());//尾页
ObservableList<SupplierBasic> list =FXCollections.observableArrayList();
tableView3.setEditable(true);
/*staffcode.setCellFactory((TableColumn<Object,Object> a ) -> new EditingCell<>());*/
// supid.setCellValueFactory(new PropertyValueFactory("id"));
findsupplierid.setCellValueFactory(new PropertyValueFactory("idnum"));
findsuppliername.setCellValueFactory(new PropertyValueFactory("supdes"));
for (SupplierBasic supplierBasics1:supplierBasics) {
list.add(supplierBasics1);
}
tableView3.setItems(list); //tableview添加list
tableView3.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<SupplierBasic>() {
@Override
public void changed(ObservableValue<? extends SupplierBasic> observableValue, SupplierBasic oldItem, SupplierBasic newItem) {
if(newItem.getIdnum() != null && !("".equals(newItem.getIdnum()))){
tableView3.setUserData(newItem.getId());
}
}
});
tableView3.setOnMouseClicked((MouseEvent t) -> {
if (t.getClickCount() == 2) {
closeProductSupplierWin();
}
});
}
public void closeProductSupplierWin(){
long id =(long)tableView3.getUserData();
SupplierBasic supplierBasic = supplierBasicService.selectByKey(id);
for(int i=0,len=productSupplierProperties.size();i<len;i++){
ProductSupplierProperty supplierPurchaserProperty =productSupplierProperties.get(i);
if(i == tableViewIndex){
supplierPurchaserProperty.setSupplierid(supplierBasic.getIdnum());
supplierPurchaserProperty.setSupdes(supplierBasic.getSupdes());
supplierPurchaserProperty.setRemarks(supplierBasic.getRemarks());
}
}
coseWin();
}
/**
* product_supplier 键盘按下触发
* @param event
*/
public void product_supplierKey(KeyEvent event){
if (event.getCode() == KeyCode.DELETE) {
if(f_alert_confirmDialog(AppConst.ALERT_HEADER, AppConst.ALERT_DELETE)) {
productSupplierService.delete(supplierNum);
ObservableList<ProductSupplierProperty> productSupplierPropertiesNew = FXCollections.observableArrayList();
for (ProductSupplierProperty productSupplierProperty : productSupplierProperties) {
if (productSupplierProperty.getId() != supplierNum) {
productSupplierPropertiesNew.add(productSupplierProperty);
}
}
productSupplierProperties.clear();
productSupplierProperties.setAll(productSupplierPropertiesNew);
}
}
if (event.getCode() == KeyCode.INSERT) {
//联系人空白行
blankProductSupplier();
}
if(event.getCode() == KeyCode.F4){
moreProductSupplierButtonClick();
}
}
/**
* product_detail 键盘按下触发
* @param event
*/
public void product_detailKey(KeyEvent event){
if (event.getCode() == KeyCode.DELETE) {
if(f_alert_confirmDialog(AppConst.ALERT_HEADER, AppConst.ALERT_DELETE)) {
productDetailsService.delete(remarkNum);
ObservableList<ProductDetailsProperty> productDetailsPropertiesNew = FXCollections.observableArrayList();
for (ProductDetailsProperty productDetailsProperty : productDetailsProperties) {
if (productDetailsProperty.getId() != remarkNum) {
productDetailsPropertiesNew.add(productDetailsProperty);
}
}
productDetailsProperties.clear();
productDetailsProperties.setAll(productDetailsPropertiesNew);
}
}
if (event.getCode() == KeyCode.INSERT) {
//空白行
blankDetails();
}
}
/**
* 分页查询供应商查询供应商
*/
public void findSupplier(int pageNum){
List<ProductBasic> productBasics = productBasicService.selectProductBasic(pageNum,1);
PageInfo<ProductBasic> pageInfo = new PageInfo<>(productBasics);
first.setUserData(1); //首页
prev.setUserData(pageInfo.getPrePage()); //上一页
next.setUserData(pageInfo.getNextPage());//下一页
last.setUserData(pageInfo.getPages());//尾页
productBasics.forEach(companyBasic1 ->loadData(companyBasic1));
if(productBasics == null || productBasics.size() == 0){
loadSupplier(0);
changeEditable(false);
submitvbox.setDisable(true);
insertvbox.setDisable(false);
updatevbox.setDisable(false);
deletevbox.setDisable(false);
//权限管理
matchingPermissions("产品基本资料",insertvbox,deletevbox,updatevbox,printingvbox,clearvbox);
}
}
/**
* 上下首尾跳页
* @param event
*/
public void pages(MouseEvent event){
Node node =(Node)event.getSource();
int pageNum =Integer.parseInt(String.valueOf(node.getUserData()));
findSupplier(pageNum);
NumberUtil.changeStatus(fxmlStatus,0);
}
/**
* 不可编辑
* @param status
*/
public void changeEditable(boolean status){
proname.setDisable(!status);
pronum.setDisable(!status);
invoicenum.setDisable(!status);
basicunit.setDisable(!status);
protype.setDisable(!status);
normpricetype.setDisable(!status);
normprice.setDisable(!status);
lowpricetype.setDisable(!status);
lowprice.setDisable(!status);
pronature.setDisable(!status);
prosource.setDisable(!status);
packnum.setDisable(!status);
minnum.setDisable(!status);
businesstype.setDisable(!status);
business.setDisable(!status);
purchasetype.setDisable(!status);
purchase.setDisable(!status);
maxstock.setDisable(!status);
safetystock.setDisable(!status);
weights.setDisable(!status);
/*inventoryplace.setEditable(status);*/
remarks.setDisable(!status);
addpeople.setDisable(!status);
adddate.setDisable(!status);
updatepeople.setDisable(!status);
updatedate.setDisable(!status);
costtype.setDisable(!status);
cost.setDisable(!status);
costusd.setDisable(!status);
isstop.setDisable(!status);
stopdes.setDisable(!status);
insertHBox.setDisable(!status);
product_supplier.setEditable(status);
product_detail.setEditable(status);
}
/**
* 清空
*/
public void clearValue(){
isnum.setText(NumberUtil.NULLSTRING);
proname.setText(NumberUtil.NULLSTRING);
pronum.setText(NumberUtil.NULLSTRING);
invoicenum.setText(NumberUtil.NULLSTRING);
basicunit.getSelectionModel().select(0);
protype.getSelectionModel().select(0);
normpricetype.getSelectionModel().select(0);
normprice.setText("0.00");
lowpricetype.getSelectionModel().select(0);
lowprice.setText("0.00");
pronature.getSelectionModel().select(0);
prosource.getSelectionModel().select(0);
packnum.setText("0");
minnum.setText("0");
businesstype.getSelectionModel().select(0);
business.setText(NumberUtil.NULLSTRING);
purchasetype.getSelectionModel().select(0);
purchase.setText(NumberUtil.NULLSTRING);
maxstock.setText("0");
safetystock.setText("0");
weights.setText("0.00");
/*inventoryplace.setText(NumberUtil.NULLSTRING);*/
remarks.setText(NumberUtil.NULLSTRING);
addpeople.setText(NumberUtil.NULLSTRING);
LocalDateTime localDateTime = LocalDateTime.now();
adddate.setText(NumberUtil.NULLSTRING);
updatepeople.setText(NumberUtil.NULLSTRING);
updatedate.setText(NumberUtil.NULLSTRING);
isstop.setSelected(false);
stopdes.setText(NumberUtil.NULLSTRING);
cost.setText("0.00");
costusd.setText("0.00");
scope.setText("0"+"%");
productDetailsProperties.clear();
productSupplierProperties.clear();
}
/**
* 提交
*/
public void submit(){
int submitStuts = (int)fxmlStatus.getUserData(); //1、新增 2、修改
/*String idnums ="";
if(submitStuts==2){
idnums=isnum.getText();
}*/
String isnumText = isnum.getText();
if("".equals(isnumText) || isnum.getText() == null ){
alert_informationDialog("请填写产品编号!");
return;
}
String newsupdes = proname.getText();
if(newsupdes.indexOf("(停用)") != -1){
newsupdes = newsupdes.substring(0,newsupdes.indexOf("("));
}
ProductBasic productBasic = productBasicService.selectProductBasicByIsnum(isnumText);
if(productBasic != null){
alert_informationDialog("产品编号重复!");
return;
}else{
productBasic = new ProductBasic(0L,
isnum.getText(),
newsupdes,
pronum.getText(),
invoicenum.getText(),
(long)basicunit.getSelectionModel().getSelectedIndex()+1,
(long)protype.getSelectionModel().getSelectedIndex()+1,
(long)normpricetype.getSelectionModel().getSelectedIndex()+1,
!normprice.getText().equals("")?Double.parseDouble(normprice.getText()):0.00,
(long)lowpricetype.getSelectionModel().getSelectedIndex()+1,
!lowprice.getText().equals("")?Double.parseDouble(lowprice.getText()):0.00,
(long)pronature.getSelectionModel().getSelectedIndex()+1,
(long)prosource.getSelectionModel().getSelectedIndex()+1,
!packnum.getText().equals("")?Integer.parseInt(packnum.getText()):0,
!minnum.getText().equals("")?Integer.parseInt(minnum.getText()):0,
(long)businesstype.getSelectionModel().getSelectedIndex()+1,
business.getText(),
(long)purchasetype.getSelectionModel().getSelectedIndex()+1,
purchase.getText(),
!maxstock.getText().equals("")?Integer.parseInt(maxstock.getText()):0,
!safetystock.getText().equals("")?Integer.parseInt(safetystock.getText()):0,
!weights.getText().equals("")?Double.parseDouble(weights.getText()):0.00,
textFieldHBox.getUserData().toString(),
remarks.getText(),
addpeople.getText(),
adddate.getText(),
updatepeople.getText(),
updatedate.getText(),
(long)costtype.getSelectionModel().getSelectedIndex()+1,
!cost.getText().equals("")?Double.parseDouble(cost.getText()):0.00,
!costusd.getText().equals("")?Double.parseDouble(costusd.getText()):0.00,
isstop.isSelected()?1:0,
stopdes.getText());
if(submitStuts==1){
productBasicService.save(productBasic);
updateDepotAndProduct(productBasic,1);
}else if(submitStuts ==2){
productBasic.setId((long)isnum.getUserData());
updateDepotAndProduct(productBasic,2);
productBasicService.updateNotNull(productBasic);
}
saveProductSupplier(productBasic.getId());
saveProductDetails(productBasic.getId());
this.loadData(productBasic); //重新加载数据
NumberUtil.changeStatus(fxmlStatus,0);
submitvbox.setDisable(true);
}
}
/**
* 根据产品信息添加产品库存
* 新建产品库存信息
* @param productBasic
* @param type 1、新增 2、修改
*/
public void updateDepotAndProduct(ProductBasic productBasic,int type){
String place = productBasic.getInventoryplace();
if(type == 1){
if(!"".equals(place)){
String places[] = place.split(",");
for (int i=0,len=places.length;i<len;i++){
ProductStock productStock = new ProductStock(productBasic.getIsnum(),productBasic.getProname(),0,0,0,0,0,0,productBasic.getNormprice(),productBasic.getNormprice(),places[i]);
productStockService.save(productStock);
}
}else{
ProductStock productStock = new ProductStock(productBasic.getIsnum(),productBasic.getProname(),0,0,0,0,0,0,productBasic.getNormprice(),productBasic.getNormprice(),"");
productStockService.save(productStock);
}
}else if(type == 2){
if(!"".equals(place)){
String places[] = place.split(",");
for (int i=0,len=places.length;i<len;i++){
ProductStock productStock = productStockService.findProductStockByDepotAndIsnum(places[i],productBasic.getIsnum());
if(productStock != null){
productStock.setParprice(productBasic.getNormprice());
productStock.setProductname(productBasic.getProname());
productStockService.updateNotNull(productStock);
}
}
}else{
ProductStock productStock = productStockService.findProductStockByDepotAndIsnum("",productBasic.getIsnum());
if(productStock != null){
productStock.setParprice(productBasic.getNormprice());
productStock.setProductname(productBasic.getProname());
productStockService.updateNotNull(productStock);
}
}
}
}
/**
* 删除
*/
public void delete(){
if(f_alert_confirmDialog(AppConst.ALERT_HEADER, AppConst.ALERT_DELETE)){
long id = (long) isnum.getUserData();
int rows = productBasicService.delete(id);
if (rows > 0) {
findSupplier((int) prev.getUserData()); //初始化第一条数据
}
NumberUtil.changeStatus(fxmlStatus, 0); //修改为修改状态
this.changeEditable(false);
}
}
/**
* 修改
*/
public void update(){
NumberUtil.changeStatus(fxmlStatus,NumberUtil.UPDATE);//修改为修改状态
lastUpdatePeopel(updatepeople,updatedate); //最后修改人 和最后修改日期
this.changeEditable(true);
submitvbox.setDisable(false);
insertvbox.setDisable(true);
deletevbox.setDisable(true);
updatevbox.setDisable(true);
blankProductSupplier();
blankDetails();
}
/**
* 新增按钮
*/
public void insert(){
NumberUtil.changeStatus(fxmlStatus,NumberUtil.INSERT);//修改为新增状态
ObservableList<TextField> placeList = FXCollections.observableArrayList();
textFieldHBox.setPrefWidth(0);
textFieldHBox.setUserData("");
insertHBox.setPrefWidth(227);
textFieldHBox.setPrefWidth(textFieldHBox.getPrefWidth()+70);
insertHBox.setPrefWidth(insertHBox.getPrefWidth()+70);
TextField textField = new TextField();
textField.setPrefWidth(70.0);
textField.setPrefHeight(23.0);
textField.setText("");
textField.setOnKeyPressed(new EventHandler<KeyEvent>(){
@Override
public void handle(KeyEvent event) {
if(event.getCode()==KeyCode.ENTER){
findIsNum(event);
}
}
});
placeList.add(textField);
textFieldHBox.getChildren().setAll(placeList);
this.changeEditable(true);
clearValue();//清空控件
createPeople(addpeople,adddate);//建档人、建档日期
submitvbox.setDisable(false);
insertvbox.setDisable(true);
deletevbox.setDisable(true);
updatevbox.setDisable(true);
blankProductSupplier();
blankDetails();
}
/**
* 回车查询
* @param event
*/
public void isNumKey(KeyEvent event){
if(event.getCode()== KeyCode.ENTER){
String value = isnum.getText();
if(!"".equals(value)){
ProductBasic productBasic = productBasicService.selectProductBasicByIsnum(value);
if(productBasic != null){
this.loadData(productBasic);
}
}
}
}
/**
* 新增库位
*/
public void insertWarehouse(){
if(insertHBox.getPrefWidth()+70<900){
textFieldHBox.setPrefWidth(textFieldHBox.getPrefWidth()+70);
insertHBox.setPrefWidth(insertHBox.getPrefWidth()+70);
TextField textField = new TextField();
textField.setPrefWidth(70.0);
textField.setPrefHeight(23.0);
textField.setOnKeyPressed(new EventHandler<KeyEvent>(){
@Override
public void handle(KeyEvent event) {
if(event.getCode()==KeyCode.ENTER){
findIsNum(event);
}
if(event.getCode()==KeyCode.DELETE){
if(f_alert_confirmDialog(AppConst.ALERT_HEADER, AppConst.ALERT_DELETE)) {
DepotKeyPress(event);
}
}
}
});
textField.setPadding(new Insets(0,0,0,10));
textFieldHBox.getChildren().add(textField);
}
}
/**
* 删除库位
* 根据TextField的layouX位置和盒子总位置来判断删除盒子的下标
* @param event
*/
public void DepotKeyPress(KeyEvent event){
TextField textField1 = (TextField)event.getSource();
Double layouX = textField1.getLayoutX();
int deleteIndex = (int)(layouX+70)/70;
ObservableList<Node> nodes = textFieldHBox.getChildren();
ObservableList<Node> nodes1 =FXCollections.observableArrayList();
//删除库位控件
for(int i=0,len=nodes.size();i<len;i++){
if((i+1) != deleteIndex){
nodes1.add(nodes.get(i));
}
}
//库位信息
String oldDepot = textFieldHBox.getUserData().toString();
String[] depot = oldDepot.split(",");
textFieldHBox.setUserData("");
//删除库位编号
for(int i=0,len=depot.length;i<len;i++){
if((i+1) != deleteIndex){
if(textFieldHBox.getUserData().equals("")){
textFieldHBox.setUserData(depot[i]);
}else{
textFieldHBox.setUserData(textFieldHBox.getUserData()+","+depot[i]);
}
}
}
textFieldHBox.setPrefWidth(textFieldHBox.getPrefWidth()-70);
textFieldHBox.getChildren().setAll(nodes1);
}
public void findIsNum(KeyEvent event){
TextField textField1 = (TextField)event.getSource();
DepotBasic depotBasic = depotBasicService.selectDepotBasicByIsnum(textField1.getText());
if(depotBasic == null){
textField1.setText(NumberUtil.NULLSTRING);
}else{
if(textFieldHBox.getUserData().equals("")){
textFieldHBox.setUserData(textField1.getText());
}else{
textFieldHBox.setUserData(textFieldHBox.getUserData()+","+textField1.getText());
}
}
}
/**
* 计算折扣
*/
public void scopePrice(){
String nomPriceStr = normprice.getText();
String lowPriceStr = lowprice.getText();
if(!"".equals(nomPriceStr)&&!"".equals(lowPriceStr)){
//标准售价
Double nomprice = Double.parseDouble(nomPriceStr);
//最低售价
Double lowprice = Double.parseDouble(lowPriceStr);
Double scopePoint = (lowprice/nomprice)*100;
if(scopePoint.toString().equals("NaN"))scopePoint = 0.00;
if(scopePoint.toString().equals("-Infinity"))scopePoint = 0.00;
BigDecimal b = new BigDecimal(scopePoint);
scopePoint = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
scope.setText(scopePoint+"%");
}else{
scope.setText("0"+"%");
}
}
@Override
public void initialize(URL location, ResourceBundle resources) {
isstop.selectedProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
boolean isbool =(boolean)newValue;
if(isbool){
stopdes.setText(new SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date()));
}else{
stopdes.setText("");
}
}
});
String newStr = location.toString();
int index = newStr.indexOf("product_basic");
if(index != -1){
BaseController.clickEvent(product_supplier, data ->{
tableViewIndex = product_supplier.getSelectionModel().getSelectedIndex();
moreProductSupplierButtonClick();
}, 2);
setComboBox(5L,basicunit,0);
setComboBox(6L,protype,0);
setComboBox(7L,normpricetype,0);
setComboBox(7L,lowpricetype,0);
setComboBox(8L,pronature,0);
setComboBox(9L,prosource,0);
setComboBox(7L,costtype,0);
bindEmployee(businesstype,business);
bindEmployee(purchasetype,purchase);
findSupplier(1);
//产品基本资料-成本 查看
if(!getPermissions("8_138_4")){
// cost.setText();
costtype.setVisible(false);
cost.setVisible(false);
costusd.setVisible(false);
costlable.setVisible(false);
dllable.setVisible(false);
}
}
}
/**
* 输入产品名称 自动填充 产品条码和发票品名
* @param keyEvent
*/
public void keyTextFiled(KeyEvent keyEvent){
String keyProName = proname.getText();
pronum.setText(keyProName);
invoicenum.setText(keyProName);
}
public void printing(){
String print = pronum.getText();
if(!"".equals(print) && print != null){
JbarcodeUtil.printCode(print);
alert_informationDialog("打印成功!");
}
// alert_informationDialog("请连接打印设备.....");
}
/**
* 产品基本资料交易历史
*/
public void searchCheck(){
String hisSize = historySize.getText();
int hisPageSize = 15;
if(!"".equals(hisSize) && hisSize != null){
hisPageSize = Integer.parseInt(hisSize);
}
String historyStart = "",historyEnd = "";
ProductBasic productBasic = productBasicService.selectByKey((long)isnum.getUserData());
if(historyDateStart.getValue() != null){
historyStart = historyDateStart.getValue().toString();
}
if(historyDateEnd.getValue() != null) {
historyEnd = historyDateEnd.getValue().toString();
}
createDate.setCellValueFactory(new PropertyValueFactory("createDate"));
orderType.setCellValueFactory(new PropertyValueFactory("orderType"));
orderNo.setCellValueFactory(new PropertyValueFactory("orderNo"));
supplierName.setCellValueFactory(new PropertyValueFactory("supplierName"));
productName.setCellValueFactory(new PropertyValueFactory("productName"));
productNum.setCellValueFactory(new PropertyValueFactory("productNum"));
productPrice.setCellValueFactory(new PropertyValueFactory("productPrice"));
taxType.setCellValueFactory(new PropertyValueFactory("taxType"));
productRemarks.setCellValueFactory(new PropertyValueFactory("productRemarks"));
productHistoryProperties.clear();
if (offerOrder.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询报价单
List<SaleOfferProduct> saleOfferProducts = iSaleOfferProductService.selectSaleOfferProductsByProductNumAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (SaleOfferProduct saleOfferProduct:saleOfferProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(saleOfferProduct.getSaleQuotations().getAddtime()),"报价单",saleOfferProduct.getSaleQuotations().getOfferNo(),saleOfferProduct.getSaleQuotations().getCustomerName(),"",saleOfferProduct.getNum().toString(),saleOfferProduct.getPrice().doubleValue(),saleOfferProduct.getSaleQuotations().getTax(),saleOfferProduct.getRemark());
productHistoryProperties.add(productHistoryProperty);
}
}
if (OrderGoods.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询订货单
List<SalePurchaseOrderProduct> salePurchaseOrderProducts = iSalePurchaseOrderProductService.selectSalePurchaseOrderProductByProductNameAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (SalePurchaseOrderProduct salePurchaseOrderProduct:salePurchaseOrderProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(salePurchaseOrderProduct.getSalePurchaseOrders().getAddtime()),"订货单",salePurchaseOrderProduct.getSalePurchaseOrders().getOrderNo(),salePurchaseOrderProduct.getSalePurchaseOrders().getCustomerName(),"",salePurchaseOrderProduct.getNum().toString(),salePurchaseOrderProduct.getPrice().doubleValue(),salePurchaseOrderProduct.getSalePurchaseOrders().getTax(),salePurchaseOrderProduct.getRemark());
productHistoryProperties.add(productHistoryProperty);
}
}
if (saleOrder.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询销货单
List<SaleGoodsProduct> saleGoodsProducts = iSaleGoodsProductService.selectSaleGoodsProdutByProductNameAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (SaleGoodsProduct saleGoodsProduct:saleGoodsProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(saleGoodsProduct.getSaleGoods().getAddtime()),"销货单",saleGoodsProduct.getSaleGoods().getSaleNo(),saleGoodsProduct.getSaleGoods().getCustomerName(),"",saleGoodsProduct.getNum().toString(),saleGoodsProduct.getPrice().doubleValue(),saleGoodsProduct.getSaleGoods().getTax(),saleGoodsProduct.getRemark());
productHistoryProperties.add(productHistoryProperty);
}
}
if (sellingBack.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询销退单
List<SaleReturnGoodsProduct> saleReturnGoodsProducts = iSaleReturnGoodsProductService.selectSaleReturnGoodsProductdByProductNameAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (SaleReturnGoodsProduct saleReturnGoodsProduct:saleReturnGoodsProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(saleReturnGoodsProduct.getSaleReturnGoods().getAddtime()),"销退单",saleReturnGoodsProduct.getSaleReturnGoods().getPinbackNo(),saleReturnGoodsProduct.getSaleReturnGoods().getCustomerNoStr(),"",saleReturnGoodsProduct.getNum().toString(),saleReturnGoodsProduct.getPricing(),saleReturnGoodsProduct.getSaleReturnGoods().getTax(),saleReturnGoodsProduct.getRemark());
productHistoryProperties.add(productHistoryProperty);
}
}
if (inquiryOrder.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询询价单
List<InquiryProduct> inquiryProducts = inquiryProductService.selectInquiryProdutByProductNameAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (InquiryProduct inquiryProduct:inquiryProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(inquiryProduct.getInquiryOrders().getCreatedate()),"询价单",inquiryProduct.getInquiryOrders().getOrders(),inquiryProduct.getInquiryOrders().getSuppliername(),"",inquiryProduct.getPronum().toString(),inquiryProduct.getProprice(),returnTax(inquiryProduct.getInquiryOrders().getTaxs()),inquiryProduct.getProremark());
productHistoryProperties.add(productHistoryProperty);
}
}
if (purchaseOrder.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询采购订单
List<PurchaseProduct> purchaseProducts = purchaseProductService.findPurchaseProductAndProductNameAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (PurchaseProduct purchaseProduct:purchaseProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(purchaseProduct.getPurchaseOrders().getCreatedate()),"采购订单",purchaseProduct.getPurchaseOrders().getOrders(),purchaseProduct.getPurchaseOrders().getSuppliername(),"",purchaseProduct.getNum().toString(),purchaseProduct.getPrice(),returnTax(purchaseProduct.getPurchaseOrders().getPtax()),purchaseProduct.getRemarks());
productHistoryProperties.add(productHistoryProperty);
}
}
if (saleOut.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询销货出库单
List<StockOutSaleProduct> stockOutSaleProducts = iStockOutSaleProductService.selectStockOutSaleProductByProductNameAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (StockOutSaleProduct stockOutSaleProduct:stockOutSaleProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(stockOutSaleProduct.getStockOutSales().getCreateDate()),"销货出库单",stockOutSaleProduct.getStockOutSales().getOutboundNo(),stockOutSaleProduct.getStockOutSales().getCustomerNoStr(),"",stockOutSaleProduct.getNum().toString(),stockOutSaleProduct.getPrice(),"",stockOutSaleProduct.getRemark());
productHistoryProperties.add(productHistoryProperty);
}
}
if (purchaseIn.isSelected() || !offerOrder.isSelected() && !OrderGoods.isSelected() && !saleOrder.isSelected() && !sellingBack.isSelected() && !inquiryOrder.isSelected() && !purchaseOrder.isSelected() && !saleOut.isSelected() && !purchaseIn.isSelected()) {
//根据产品编号查询采购入库单
List<PurchaseStockProduct> purchaseStockProducts = purchaseStockProductService.findPurchaseStockProductByProductNameAndStartTimeAndEndTime(productBasic.getIsnum(),historyStart,historyEnd);
for (PurchaseStockProduct purchaseStockProduct:purchaseStockProducts) {
if(productHistoryProperties.size()==hisPageSize){
continue;
}
/**
* 产品基本资料--入库单价权限
*/
Double stockPrice = 0.00;
if(getPermissions("1022_1023_4")){
stockPrice = purchaseStockProduct.getPrice();
}
ProductHistoryProperty productHistoryProperty = new ProductHistoryProperty(new SimpleDateFormat("yyyy-MM-dd").format(purchaseStockProduct.getPurchaseStocks().getCreatedate()),"采购入库单",purchaseStockProduct.getPurchaseStocks().getStockorder(),purchaseStockProduct.getPurchaseStocks().getSuppliername(),"",purchaseStockProduct.getStocknum().toString(),stockPrice,"",purchaseStockProduct.getRemarks());
productHistoryProperties.add(productHistoryProperty);
}
}
productHistoryTableView.setItems(productHistoryProperties);
}
@FXML
private ImageView rightImage;
/**
* 右侧查询Panne 公司基本资料
*/
public void shoRightPane(){
// C:\Users\jzdsh\Desktop\login
// String path = PathUtil.projectPath.replaceAll("\\\\","\\\\\\\\");
// System.out.println("PATH:"+PathUtil.projectPath);
// System.out.println("PATH:"+path);
// Image image = new Image("file:"+path+"\\images\\rightgo.png");
//
// rightImage.setImage(image);
Stage stageStock = (Stage) StageManager.CONTROLLER.get("rightWinStage");
StageManager.rightWin = !StageManager.rightWin;
if(StageManager.rightWin){
attrImages(rightImage, PathUtil.imageLeft);
stageStock.setTitle("产品基本资料");
Pane pane = new Pane();
pane.getChildren().setAll(loader.load("/fxml/basic/loadMoreProduct.fxml"));
Scene scene = new Scene(pane);
stageStock.setScene(scene);
Stage stageHome = (Stage)StageManager.CONTROLLER.get("homeStage");
stageStock.setX(stageHome.getScene().getWindow().getWidth()+stageHome.getScene().getWindow().getX()-15);
stageStock.setY(stageHome.getScene().getWindow().getY());
loadCompanyRight(false);
stageStock.setResizable(false); //禁止窗体缩放
stageStock.show();
}else{
attrImages(rightImage,PathUtil.imageRight);
stageStock.close();
}
}
@FXML
private TableView rightSupplierTableView;
@FXML
private TableColumn rightSupplierSort;
@FXML
private TableColumn rightSupplierOrder;
@FXML
private TableColumn rightSupplierDes;
@FXML
private CheckBox rightCheckBox;
public void loadCompanyRight(boolean isStop){
rightCheckBox.selectedProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
boolean isbool =(boolean)newValue;
loadCompanyRight(isbool);
}
});
List<ProductBasic> productBasics = isStop ? productBasicService.selectProductBasic(0) : productBasicService.selectProductBasic("");
ObservableList<ProductBasic> productBasicsList = FXCollections.observableArrayList();
rightSupplierSort.setCellValueFactory(new PropertyValueFactory("sort"));
rightSupplierOrder.setCellValueFactory(new PropertyValueFactory("isnum"));
rightSupplierDes.setCellValueFactory(new PropertyValueFactory("proname"));
if(productBasics != null && productBasics.size() > 0){
for (int i=0,len = productBasics.size();i < len;i++) {
productBasics.get(i).setSort(i+1);
if(productBasics.get(i).getIsstop() == 1){
productBasics.get(i).setProname(productBasics.get(i).getProname()+"(停用)");
}
productBasicsList.add(productBasics.get(i));
}
}
rightSupplierTableView.setItems(productBasicsList);
rightSupplierTableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ProductBasic>() {
@Override
public void changed(ObservableValue<? extends ProductBasic> observableValue, ProductBasic oldItem, ProductBasic newItem) {
// alert_informationDialog("=="+newItem.getId());
ProductBasic productBasic = productBasicService.selectByKey(newItem.getId());
loadData(productBasic);
}
});
}
}
|
package org.jaxws.stub2html.util;
import java.util.Collection;
/**
*
* @author chenjianjx
*
*/
public class MyClassUtils {
public static boolean isClassArrayOrCollection(Class<?> clazz) {
return clazz.isArray() || Collection.class.isAssignableFrom(clazz);
}
}
|
package com.sherry.epaydigital.data.model;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "epay_me_link")
public class EpayDigitalMeLink implements Serializable {
private static final long serialVersionId = -3009157732242241606l;
@Id
@GeneratedValue
private Long id;
private String me_link;
@OneToOne(mappedBy = "epayDigitalMeLink")
private Customer customer;
//region Setters
public void setMe_link(String me_link) {
this.me_link = me_link;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
//endregion
//region Getters
public String getMe_link() {
return me_link;
}
public Customer getCustomer() {
return customer;
}
//endregion
}
|
package com.project.universitystudentassistant.data;
import android.app.Activity;
import android.content.Context;
import androidx.lifecycle.LiveData;
import com.project.universitystudentassistant.models.Subject;
import com.project.universitystudentassistant.models.SubjectSchedule;
import com.project.universitystudentassistant.models.UniversityEntity;
import com.project.universitystudentassistant.models.User;
import com.project.universitystudentassistant.data.local.AppDatabase;
import com.project.universitystudentassistant.data.remote.dummyremote.DummyRemoteDataProvider;
import com.project.universitystudentassistant.data.remote.firebase.FirebaseAuthService;
import com.project.universitystudentassistant.data.remote.firebase.FirestoreService;
import com.project.universitystudentassistant.utils.AppConstants;
import java.time.DayOfWeek;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
public class Repository {
private FirebaseAuthService firebaseAuthService;
private DummyRemoteDataProvider dummyRemoteDataProvider;
private FirestoreService firestoreService;
private AppDatabase roomDb;
private Executor executor = Executors.newSingleThreadExecutor();
private static Repository repository;
//TODO: change the constructor to private
public Repository(Context context) {
firebaseAuthService = new FirebaseAuthService();
dummyRemoteDataProvider = new DummyRemoteDataProvider();
firestoreService = new FirestoreService();
roomDb = AppDatabase.getInstance(context);
}
public static Repository getInstance(Context context) {
if (repository == null) {
repository = new Repository(context);
}
return repository;
}
//Firebase Authentication
public void createAccount(String email, String password, Activity activity, User user) {
firebaseAuthService.createAccount(email, password, activity, user);
}
public void signIn(String email, String password, Context context) {
firebaseAuthService.signIntoAccount(email, password, context);
}
//Remote dummy data
public List<UniversityEntity> getRemoteUniversityData() {
return dummyRemoteDataProvider.getListOFUniversities();
}
//Firestore Database
public void registerUser(User user) {
firestoreService.uploadUserDetails(user);
}
//Room local database
//User
public void insertUserToRoomDb(User user) {
executor.execute(() -> roomDb.userDao().insertUser(user));
;
}
//My Universities Data
public void insertUniveristy(UniversityEntity universityEntity) {
executor.execute(() -> roomDb.universityDao().insertUniversity(universityEntity));
}
public void updateUniversity(UniversityEntity entity) {
executor.execute(() -> roomDb.universityDao().update(entity));
}
public LiveData<List<UniversityEntity>> getAllUniversities() {
return roomDb.universityDao().getAll();
}
public LiveData<List<UniversityEntity>> getSavedUniversities() {
return roomDb.universityDao().getSavedUniversities(AppConstants.SAVED);
}
public void deleteUniversity(UniversityEntity entity) {
String name = entity.getName();
executor.execute(() -> roomDb.universityDao().deleteUniversityByName(name));
}
public LiveData<List<UniversityEntity>> getAllPrepUniversities() {
return roomDb.universityDao().getAll();
}
public LiveData<List<UniversityEntity>> getPrepUniversitiesByStates(String... states) {
return roomDb.universityDao().getUniversitiesByStates(states);
}
public LiveData<Integer> getMinCost() {
return roomDb.universityDao().getMinCost();
}
public LiveData<Integer> getMaxCost() {
return roomDb.universityDao().getMaxCost();
}
public LiveData<Integer> getMinAccRate() {
return roomDb.universityDao().getMinAccRate();
}
public LiveData<Integer> getMaxAccRate() {
return roomDb.universityDao().getMaxAccRate();
}
public LiveData<Integer> getMinGradRate() {
return roomDb.universityDao().getMinGradRate();
}
public LiveData<Integer> getMaxGradRate() {
return roomDb.universityDao().getMaxGradRate();
}
//Subjects
public void insertSubject(Subject subject) {
executor.execute(() -> roomDb.subjectDao().insertSubject(subject));
}
public LiveData<List<Subject>> getAllSubjects() {
return roomDb.subjectDao().getAll();
}
public void insertSubjectSchedule(SubjectSchedule subject) {
executor.execute(() -> roomDb.subjectScheduleDao().insertSubject(subject));
}
public LiveData<List<SubjectSchedule>> getAllSubjectsSchedule() {
return roomDb.subjectScheduleDao().getAll();
}
public LiveData<List<SubjectSchedule>> getAllSubjectsOnThisDay(DayOfWeek dayOfWeek) {
return roomDb.subjectScheduleDao().getAllOnThisDay(dayOfWeek);
}
public LiveData<List<SubjectSchedule>> getSubject(String name) {
return roomDb.subjectScheduleDao().getSubject(name);
}
public void deleteSubject(String name) {
executor.execute(() -> roomDb.subjectScheduleDao().deleteSubject(name));
}
public void updateSubject(SubjectSchedule subjectSchedule) {
executor.execute(() -> roomDb.subjectScheduleDao().update(subjectSchedule));
}
}
|
package ua.siemens.dbtool.model.entities;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import ua.siemens.dbtool.model.enums.EmployeePosition;
import ua.siemens.dbtool.model.enums.UserGroup;
import ua.siemens.dbtool.model.enums.UserRole;
import ua.siemens.dbtool.utils.Constants;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* The class is a representation of app User Entity
*
* @author Perevoznyk Pavlo
* creation date 10 May 2017
* @version 1.0
*/
@Entity
@Table(name = "users")
public class User extends Person implements UserDetails {
//user basic information section
@NotNull
@Column(name = "password", nullable = false)
private String password;
@Transient
private String confirmPassword;
@ManyToOne
@JoinColumn(name = "user_profile_id")
private Profile userProfile;
@Column(name = "user_group", nullable = false)
@Enumerated(EnumType.STRING)
private UserGroup userGroup;
@Column(name = "role", nullable = false)
@Enumerated(EnumType.STRING)
private UserRole role;
//user additional information section
@Column(name = "position")
@Enumerated(EnumType.STRING)
private EmployeePosition employeePosition;
@Column(name = "image_id")
private long imageId;
/**
* This field has information about locking user's account. If isLocked == false, then account isn't locked,
* if isLocked == true, then account is locked
*/
@Column(name = "is_locked")
private boolean isLocked;
@Column(name = "is_dismissed")
private boolean isDismissed;
@Column(name = "hire_date")
private LocalDate hireDate;
@Column(name = "birthday")
private LocalDate birthDay;
@Column(name = "notes")
private String notes;
@Column(name = "personal_email")
private String personalEmail;
@Column(name = "work_land_phone")
private String workLandPhone;
@Column(name = "work_mob_phone")
private String workMobilePhone;
@ElementCollection
@CollectionTable(name = "additional_phones")
@MapKeyColumn(name = "number")
@Column(name = "comment")
private Map<String, String> additionalPhones;
/**
* Default constructor
*/
public User() {
super();
this.password = "";
this.imageId = Constants.DEFAULT_IMAGE_ID;
this.additionalPhones = new HashMap<>();
}
@Override
public String toString() {
return "User [ id=" + id +
", email=" + email +
", firstName=" + firstName +
", lastName=" + lastName +
", userProfile=" + userProfile +
", userGroup=" + userGroup +
", role=" + role +
", employeePosition=" + employeePosition +
", isDismissed=" + isDismissed + " ]";
}
/**
* An overridden method from UserDetails interface. The method checks user's account expiring.
*
* @return true if account is't expired, or false otherwise. In our case returns not isLocked value.
*/
@Override
public boolean isAccountNonExpired() {
return !isLocked;
}
/**
* An overridden method from UserDetails interface. The method checks user's account locking.
*
* @return true if account is't locked, or false otherwise. In our case returns not isLocked value.
*/
@Override
public boolean isAccountNonLocked() {
return !isLocked;
}
/**
* An overridden method from UserDetails interface. The method checks expiring of user's account credentials.
*
* @return true if account's credentials is't expired, or false otherwise. In our case returns not isLocked value.
*/
@Override
public boolean isCredentialsNonExpired() {
return !isLocked;
}
/**
* An overridden method from UserDetails interface. The method checks user's account is enabled, or not.
*
* @return true if account is enabled, or false otherwise. In our case returns not isLocked value.
*/
@Override
public boolean isEnabled() {
return !isLocked;
}
/**
* Method for getting collection of user's authorities. An overridden method from UserDetails interface.
*
* @return a collection of user's authorities. In our case the collection has just one entry,
* and the entry contains information about user's role.
*/
@Override
public Collection<GrantedAuthority> getAuthorities() {
Collection<GrantedAuthority> grantedAuthorities = new ArrayList<>();
SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority("ROLE_" + getRole().name());
grantedAuthorities.add(simpleGrantedAuthority);
return grantedAuthorities;
}
/**
* A getter for the password
*
* @return user's password
*/
@Override
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return this.getEmail();
}
/**
* A setter for the password.
* If parameter is null or whitespace, method sets empty string as password.
*
* @param password a user's password.
*/
public void setPassword(String password) {
this.password = password;
}
public String getConfirmPassword() {
return confirmPassword;
}
public void setConfirmPassword(String confirmPassword) {
this.confirmPassword = confirmPassword;
}
/**
* A getter for the role field.
*
* @return user's role
*/
public UserRole getRole() {
return role;
}
/**
* A setter for the role field.
* If parameter is null, method sets 'USER' as role.
*
* @param role a user's role.
*/
public void setRole(UserRole role) {
this.role = (role != null) ? role : UserRole.USER;
}
/**
* A getter for the field isLocked
*
* @return value of the field isLocked, a boolean value of locking user's account
*/
public boolean isLocked() {
return isLocked;
}
/**
* A setter for the field isLocked.
*
* @param locked a boolean value of locking user's account
*/
public void setLocked(boolean locked) {
isLocked = locked;
}
public long getImageId() {
return imageId;
}
public void setImageId(long imageId) {
this.imageId = imageId;
}
public Profile getUserProfile() {
return userProfile;
}
public void setUserProfile(Profile userProfile) {
this.userProfile = userProfile;
}
public UserGroup getUserGroup() {
return userGroup;
}
public void setUserGroup(UserGroup userGroup) {
this.userGroup = userGroup;
}
public EmployeePosition getEmployeePosition() {
return employeePosition;
}
public void setEmployeePosition(EmployeePosition employeePosition) {
this.employeePosition = employeePosition;
}
public LocalDate getHireDate() {
return hireDate;
}
public void setHireDate(LocalDate hireDate) {
this.hireDate = hireDate;
}
public LocalDate getBirthDay() {
return birthDay;
}
public void setBirthDay(LocalDate birthDay) {
this.birthDay = birthDay;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
public String getPersonalEmail() {
return personalEmail;
}
public void setPersonalEmail(String personalEmail) {
this.personalEmail = personalEmail;
}
public String getWorkLandPhone() {
return workLandPhone;
}
public void setWorkLandPhone(String workLandPhone) {
this.workLandPhone = workLandPhone;
}
public String getWorkMobilePhone() {
return workMobilePhone;
}
public void setWorkMobilePhone(String workMobilePhone) {
this.workMobilePhone = workMobilePhone;
}
public Map<String, String> getAdditionalPhones() {
return additionalPhones;
}
public void setAdditionalPhones(Map<String, String> additionalPhones) {
this.additionalPhones = additionalPhones;
}
public boolean isDismissed() {
return isDismissed;
}
public void setDismissed(boolean dismissed) {
isDismissed = dismissed;
}
}
|
package com.davivienda.sara.cuadrecifras.general.helper;
import com.davivienda.sara.cuadrecifras.general.bean.MovimientoCuadreCifrasBean;
import java.util.Calendar;
import java.util.Collection;
/**
* DiarioElectronicoHelperInterface - 27/08/2008
* Descripción :
* Versión : 1.0
*
* @author jjvargas
* Davivienda 2008
*/
public interface CuadreCifrasHelperInterface {
public Collection<MovimientoCuadreCifrasBean> obtenerDatosCollectionCC(Calendar fechaInicial, Integer codigoOcca) throws IllegalAccessException;
//public String generarDiarioelectronicoXML();
public void procesoInformeDescuadre(Calendar fechaInicial, Integer codigoOcca) throws IllegalAccessException;
}
|
package com.yc.education.service.impl.check;
import com.github.pagehelper.PageHelper;
import com.yc.education.mapper.check.CheckDataMapper;
import com.yc.education.model.check.CheckData;
import com.yc.education.service.check.CheckDataService;
import com.yc.education.service.impl.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName CheckDataServiceImpl
* @Description TODO 考勤资料结转
* @Author QuZhangJing
* @Date 2019/2/20 16:32
* @Version 1.0
*/
@Service("CheckDataService")
public class CheckDataServiceImpl extends BaseService<CheckData> implements CheckDataService {
@Autowired
private CheckDataMapper checkDataMapper;
@Override
public List<CheckData> findCheckData() {
try {
return checkDataMapper.findCheckData();
} catch (Exception e) {
return null;
}
}
@Override
public List<CheckData> findCheckData(int pageNum, int pageSize) {
try {
PageHelper.startPage(pageNum,pageSize);
return checkDataMapper.findCheckData();
} catch (Exception e) {
return null;
}
}
}
|
kkksjsjsjsjjsjjsjjsjsjkk:Wq
k
ooookkkko
|
package org.apache.hadoop.hdfs.server.namenode.persistance.storage.mysqlserver;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.hadoop.hdfs.server.namenode.persistance.storage.StorageException;
/**
* This class is to do count operations using Mysql Server.
*
* @author hooman
*/
public class CountHelper {
public static final String COUNT_QUERY = "select count(*) from %s";
private static MysqlServerConnector connector = MysqlServerConnector.INSTANCE;
/**
* Counts the number of rows in a given table.
*
* This creates and closes connection in every request.
*
* @param tableName
* @return Total number of rows a given table.
* @throws StorageException
*/
public static int countAll(String tableName) throws StorageException {
// TODO[H]: Is it good to create and close connections in every call?
String query = String.format(COUNT_QUERY, tableName);
return count(query);
}
private static int count(String query) throws StorageException {
try {
Connection conn = connector.obtainSession();
PreparedStatement s = conn.prepareStatement(query);
ResultSet result = s.executeQuery();
if (result.next()) {
return result.getInt(1);
} else {
throw new StorageException(
String.format("Count result set is empty. Query: %s", query));
}
} catch (SQLException ex) {
throw new StorageException(ex);
} finally {
connector.closeSession();
}
}
/**
* Counts the number of rows in a table specified by the table name where
* satisfies the given criterion. The criterion should be a valid SLQ
* statement.
*
* @param tableName
* @param criterion E.g. criterion="id > 100".
* @return
*/
public static int countWithCriterion(String tableName, String criterion) throws StorageException {
StringBuilder queryBuilder = new StringBuilder(String.format(COUNT_QUERY, tableName)).
append(" where ").
append(criterion);
return count(queryBuilder.toString());
}
}
|
package nobile.riccardo.azienda;
public class GestioneContabile {
}
|
package com.konew.musicapp.repository;
import com.konew.musicapp.entity.Artist;
import com.konew.musicapp.entity.Track;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface ArtistRepository extends JpaRepository<Artist, Long>
{
@Query(value = "SELECT a.* from artists as a inner join user_artists ua " +
"on a.id=ua.artist_id inner join users as u on ua.user_id = u.id where u.id=:user_id", nativeQuery = true)
List<Artist> findUserSavedArtists(@Param("user_id") long user_id);
@Query(value = "SELECT * from artists where deezer_id=:deezer_id", nativeQuery = true)
Optional<Artist> ifArtistExist(@Param("deezer_id") long deezer_id);
}
|
package hu.juzraai.proxymanager.cli;
import com.beust.jcommander.Parameters;
/**
* @author Zsolt Jurányi
*/
@Parameters(commandNames = "stat", commandDescription = "Prints statistics of proxy lists")
public class StatCommand {
}
|
package me.kpali.wolfflow.core.scheduler;
import me.kpali.wolfflow.core.exception.TaskFlowStopException;
import me.kpali.wolfflow.core.exception.TaskFlowTriggerException;
import java.util.concurrent.ConcurrentHashMap;
/**
* 任务流调度器
*
* @author kpali
*/
public interface ITaskFlowScheduler {
/**
* 启动任务流调度器
*/
void startup();
/**
* 执行任务流
*
* @param taskFlowId
* @param params
* @return taskFlowLogId
* @throws TaskFlowTriggerException
*/
long execute(Long taskFlowId, ConcurrentHashMap<String, Object> params) throws TaskFlowTriggerException;
/**
* 执行任务流,执行指定任务
*
* @param taskFlowId
* @param taskId
* @param params
* @return taskFlowLogId
* @throws TaskFlowTriggerException
*/
long execute(Long taskFlowId, Long taskId, ConcurrentHashMap<String, Object> params) throws TaskFlowTriggerException;
/**
* 执行任务流,从指定任务开始
*
* @param taskFlowId
* @param fromTaskId
* @param params
* @return taskFlowLogId
* @throws TaskFlowTriggerException
*/
long executeFrom(Long taskFlowId, Long fromTaskId, ConcurrentHashMap<String, Object> params) throws TaskFlowTriggerException;
/**
* 执行任务流,到指定任务结束
*
* @param taskFlowId
* @param toTaskId
* @param params
* @return taskFlowLogId
* @throws TaskFlowTriggerException
*/
long executeTo(Long taskFlowId, Long toTaskId, ConcurrentHashMap<String, Object> params) throws TaskFlowTriggerException;
/**
* 回滚任务流
*
* @param taskFlowId
* @param params
* @return taskFlowLogId
* @throws TaskFlowTriggerException
*/
long rollback(Long taskFlowId, ConcurrentHashMap<String, Object> params) throws TaskFlowTriggerException;
/**
* 停止任务流
*
* @param taskFlowLogId
* @throws TaskFlowStopException
*/
void stop(Long taskFlowLogId) throws TaskFlowStopException;
}
|
package utils;
import java.util.Date;
public class DateValidator {
/**
* Used for validate the check-in and check-out date.
* 1. check-in date should be a future date
* 2. check-out date should after check-in date
* @param checkInDate
* @param checkOutDate
* @return
*/
public static boolean validateCheckInOutDate(Date checkInDate, Date checkOutDate) {
//if checkinDate has past
if (checkInDate.before(new Date())) {
return false;
}
// if checkOutDate is earlier than checkInDate
if (checkOutDate.before(checkInDate)) {
return false;
}
return true;
}
/**
* Used for calculate the number of days between two Date objects.
* Result will take the result of its ceil value.
* e.g. calculateDateGap(2018-10-10 10:00:00, 2018-10-10 11:00:00) = 1
* @param checkinDate
* @param checkOutDate
* @return the days between checkinDate and checkOutDate
*/
public static int calculateDateGap(Date checkinDate, Date checkOutDate) {
return (int) Math.ceil(
(double)(checkOutDate.getTime()-checkinDate.getTime())
/1000/60/60/24);
}
}
|
package ch.ethz.geco.t4j.internal.json;
import java.util.List;
/**
* Represents a discipline json object.
*/
public class DisciplineObject {
public long id;
public String name;
public String shortname;
public String fullname;
public String copyrights;
public List<String> platforms_available;
public TeamSizeObject team_size;
public static class TeamSizeObject {
public short min;
public short max;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.