text stringlengths 10 2.72M |
|---|
package SUT.SE61.Team07.Entity;
import lombok.*;
import javax.validation.constraints.NotNull;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Entity;
import java.util.Date;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.JoinColumn;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.validation.constraints.*;
@Entity
@Data
public class Notification {
@Id
@SequenceGenerator(name = "notification_seq", sequenceName = "notification_seq")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "notification_seq")
@NotNull(message = "data notificationId must not be null to be valid")
private Long notificationId;
@NotNull(message = "notificationName not null")
@Size(min = 10, max = 20)
@Pattern(regexp = "[0-9]{1,2}\\s(กุมภาพันธ์|มกราคม|มีนาคม|เมษายน|พฤษภาคม|มิถุนายน|กรกฎาคม|สิงหาคม|กันยายน|ตุลาคม|พฤษจิกายน|ธันวาคม)\\s[0-9]{2,4}")
private String notificationName;
@NotNull(message = "date not null")
private Date date;
@NotNull(message = "customer not null")
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "customerId")
private Customer customer;
@NotNull(message = "drug not null")
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "drugId")
private Drug drug;
@NotNull(message = "timeEat not null")
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "timeEatId")
private TimeEat timeEat;
public Notification() {
}
public Notification(String notificationName, Customer customer, Drug drug, TimeEat timeEat) {
this.notificationName = notificationName;
this.customer = customer;
this.drug = drug;
this.timeEat = timeEat;
this.date = new Date();
}
} |
package ch.heigvd.iict.ser.imdb;
import java.text.DecimalFormat;
import ch.heigvd.iict.ser.imdb.db.MySQLAccess;
import ch.heigvd.iict.ser.imdb.models.Data;
public class Worker {
private int step = -1;
public Worker(int step) {
this.step = step;
}
public Data run() {
//we notify ui that the thread is running
System.out.println("Starting dataset "+ step + "...");
//log
long s = System.currentTimeMillis();
//we connect to DB
MySQLAccess db = new MySQLAccess();
db.connect();
Data data = db.getData(this.step);
//log
System.out.println("Done dataset "+ step +" [" + displaySeconds(s, System.currentTimeMillis()) + "]");
//we disconnect from database
db.disconnect();
return data;
}
private static final DecimalFormat doubleFormat = new DecimalFormat("#.#");
private static final String displaySeconds(long start, long end) {
long diff = Math.abs(end - start);
double seconds = ((double) diff) / 1000.0;
return doubleFormat.format(seconds) + " s";
}
}
|
package com.jake.ffmpegandroid.camera;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.opengl.GLSurfaceView;
import com.jake.ffmpegandroid.gpuimage.FilterFactory;
import com.jake.ffmpegandroid.gpuimage.FilterType;
import java.io.IOException;
/**
* @author jake
* @since 2017/4/24 下午9:54
*/
public class GlCameraHolderOld extends BaseCameraHolder {
// private CameraRenderer mCameraRenderer;
//
// public GlCameraHolderOld(GLSurfaceView glSurfaceView) {
// setDefaultPreviewSize(800, 480);
// mCameraRenderer = new CameraRenderer(glSurfaceView, onRendererListener);
// mCameraRenderer.setFilter(FilterFactory.getFilter(FilterType.BEAUTY, glSurfaceView.getContext()));
// }
@Override
protected void setCameraPreviewDisplay(Camera camera) {
// SurfaceTexture texture = mCameraRenderer.getSurfaceTexture();
// if (texture != null) {
// try {
// camera.setPreviewTexture(texture);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
}
//
// private CameraRenderer.OnRendererListener onRendererListener = new CameraRenderer.OnRendererListener() {
// @Override
// public void openRendererCamera(SurfaceTexture surfaceTexture) {
// onResume();
// final Camera.Size previewSize = mCamera.getParameters().getPreviewSize();
// mCameraRenderer.updateRotation(getCameraDisplayOrientation(), previewSize.width, previewSize.height, isFacingFront());
//
// }
// };
//
// public void onResume() {
// if (mCameraRenderer.isSurfaceCreated()) {
// openCamera(mPositionCameraId);
// startPreview();
// }
// }
//
// public void onPause() {
// stopPreviewAndRelease();
// }
//
// public void onDestroy() {
// if (isCameraOpen()) {
// stopPreviewAndRelease();
// }
// }
}
|
package material;
import processing.core.*;
import processing.event.*;
import material.events.*;
import material.util.Alignment;
import material.util.MaterialColor;
import material.components.*;
/**
* This is a template class and can be used to start a new processing Library.
* Make sure you rename this class as well as the name of the example package 'template'
* to your own Library naming convention.
*
* (the tag example followed by the name of an example included in folder 'examples' will
* automatically include the example in the javadoc.)
*
* @example MaterialUI
*/
public class MaterialUI extends _ComponentContainer{
// myParent is a reference to the parent sketch
public PApplet sketch;
int packed = 0;
float x, y;
float width, height;
MaterialColor backgroundColor;
// do I need this?
public final static String VERSION = "2.1337.4u";
/**
* a Constructor, usually called in the setup() method in your sketch to
* initialize and start the Library.
*
* @example MaterialUI
* @param sketchPApplet
*/
public MaterialUI(PApplet sketch) {
super();
this.x = 0;
this.y = 0;
this.width = sketch.width;
this.height = sketch.height;
this.sketch = sketch;
this.setHorizontalAlignment(Alignment.START);
this.setVerticalAlignment(Alignment.START);
this.setBackgroundColor(MaterialColor.grey(100));
this.x = sketch.width / 2;
this.y = sketch.height / 2;
this.width = sketch.width;
this.height = sketch.height;
this.sketch.registerMethod("dispose", this);
this.sketch.registerMethod("draw", this);
this.sketch.registerMethod("mouseEvent", this);
}
public void draw() {
if (this.sketch.frameRate != 35)
this.sketch.frameRate(35);
if (this.packed == 1)
this.draw(this.sketch);
else if (this.packed == 0){
this.packed = 2;
}
}
/**
* return the version of the Library.
*
* @return String
*/
public static String version() {
return VERSION;
}
public void mouseEvent(MouseEvent e) {
if (e.TOUCH == e.getAction() || e.getAction() == e.PRESS || e.getAction() == e.DRAG) {
Touchables.getInstance().touching(e.getX(), e.getY());
}
}
// for testing purposes
public void simulateTouch(float touchX, float touchY) {
Touchables.getInstance().touching(touchX, touchY);
}
public void pack() {
this.pack(0, 0);
this.packed = 1;
}
public void dispose() {
System.out.println("Destroying material");
}
}
|
package com.rishi.baldawa.iq;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.Arrays;
import java.util.Collection;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@RunWith(Parameterized.class)
public class TwoSumTest {
private final int[] input;
private final int target;
private final int[] expected;
public TwoSumTest(int[] input, int target, int[] expected) {
this.input = input;
this.target = target;
this.expected = expected;
}
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{new int[]{2, 7, 11, 15}, 9, new int[]{0, 1}},
{new int[]{2, 7, 11, 15}, 17, new int[]{0, 3}},
{new int[]{0, 0, 0, 0}, 0, new int[]{0, 1}},
{new int[]{1, 1, 1, 1}, 2, new int[]{0, 1}},
{new int[]{1, 1, -1, -1}, 0, new int[]{1, 2}}
});
}
@Test
public void testSolution() throws Exception {
assertThat(new TwoSum().solution(input, target), is(expected));
}
} |
package com.example.paula.recipeasy.models;
import java.util.UUID;
public class Recipe {
private UUID mId;
private String mName;
private float mDuration;
private float mPortions;
private String mInstruction;
private int mQttIngredients;
private String mType;
private byte[] mPhoto;
public Recipe(){
this(UUID.randomUUID());
}
public Recipe(UUID id){
mId = id;
}
public Recipe(String name, float duration, float portions, String instruction, int qttIngredients,
String type, byte[] photo){
this(UUID.randomUUID());
setName(name);
setDuration(duration);
setPortions(portions);
setInstruction(instruction);
setQttIngredients(qttIngredients);
setType(type);
setPhoto(photo);
}
public UUID getId() {
return mId;
}
public void setId(UUID mId) {
this.mId = mId;
}
public String getName() {
return mName;
}
public void setName(String name) {
this.mName = name;
}
public float getDuration() {
return mDuration;
}
public void setDuration(float duration) {
this.mDuration = duration;
}
public float getPortions() {
return mPortions;
}
public void setPortions(float portions) {
this.mPortions = portions;
}
public String getInstruction() {
return mInstruction;
}
public void setInstruction(String instruction) {
this.mInstruction = instruction;
}
public int getQttIngredients() {
return mQttIngredients;
}
public void setQttIngredients(int qttIngredients) {
this.mQttIngredients = qttIngredients;
}
public String getType() {
return mType;
}
public void setType(String type) {
mType = type;
}
public byte[] getPhoto() {
return mPhoto;
}
public void setPhoto(byte[] photo) {
mPhoto = photo;
}
@Override
public String toString() {
return getId()+","+getName()+","+getDuration()+","+getPortions()+","+getInstruction()+","+getType()+","+getPhoto();
}
}
|
package multithreading;
/**
* @author malf
* @description 死锁示例
* @project how2jStudy
* @since 2020/10/22
*/
public class DeadLockDemo {
public static void main(String[] args) {
final Hero ahri = new Hero();
ahri.name = "九尾妖狐";
final Hero annie = new Hero();
annie.name = "安妮";
Thread thread1 = new Thread() {
public void run() {
synchronized (ahri) {
System.out.println("thread1 占有九尾妖狐");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
System.out.println("thread1 试图占有安妮");
System.out.println("thread1 等待中");
synchronized (annie) {
System.out.println("..........");
}
}
}
};
thread1.start();
Thread thread2 = new Thread() {
public void run() {
synchronized (annie) {
System.out.println("thread2 占有安妮");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
System.out.println("thread2 试图占有九尾妖狐");
System.out.println("thread2 等待中");
synchronized (ahri) {
System.out.println("..........");
}
}
}
};
thread2.start();
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.kkstudio.springcrud.service;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.transaction.Transactional;
import org.springframework.stereotype.Service;
/**
*
* @author Xiangsheng Li
*/
@Service("CrudService")
@Transactional
public class CrudServiceBean implements CrudService{
@PersistenceContext(unitName = "SamplePU")
private EntityManager em;
@Override
public <T> void create(T entity) {
em.persist(entity);
}
@Override
public <T> void edit(T entity) {
em.merge(entity);
}
@Override
public <T> void remove(T entity) {
em.remove(em.merge(entity));
}
@Override
public <T> T find(Class<T> entityClass, Object id) {
return em.find(entityClass, id);
}
@Override
public List findWithNamedQuery(String queryName) {
return this.em.createNamedQuery(queryName).getResultList();
}
@Override
public List findWithNamedQuery(String queryName, int resultLimit) {
return this.em.createNamedQuery(queryName).
setMaxResults(resultLimit).
getResultList();
}
@Override
public List findWithNamedQuery(String queryName, Map<String, Object> parameters) {
return findWithNamedQuery(queryName, parameters, 0);
}
@Override
public List findWithNamedQuery(String queryName, Map<String, Object> parameters, int resultLimit) {
Query query = this.em.createNamedQuery(queryName);
if(resultLimit > 0){
query.setMaxResults(resultLimit);
}
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
query.setParameter(entry.getKey(), entry.getValue());
}
return query.getResultList();
}
@Override
public <T> int count(Class<T> entityClass) {
javax.persistence.criteria.CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
javax.persistence.criteria.Root<T> rt = cq.from(entityClass);
cq.select(em.getCriteriaBuilder().count(rt));
javax.persistence.Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
}
@Override
public <T> List findAll(Class<T> entityClass) {
javax.persistence.criteria.CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
return em.createQuery(cq).getResultList();
}
} |
package com.tencent.mm.pluginsdk.g.a.a;
import com.tencent.mm.pluginsdk.g.a.c.q.a;
import com.tencent.mm.pluginsdk.g.a.c.s;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
class b$7 implements Runnable {
final /* synthetic */ String ewx;
final /* synthetic */ int kPA;
final /* synthetic */ int kPB;
final /* synthetic */ b qBO;
final /* synthetic */ int qBY;
b$7(b bVar, int i, int i2, String str, int i3) {
this.qBO = bVar;
this.kPA = i;
this.kPB = i2;
this.ewx = str;
this.qBY = i3;
}
public final void run() {
b bVar = this.qBO;
int i = this.kPA;
int i2 = this.kPB;
String str = this.ewx;
int i3 = this.qBY;
s Tn = a.ccH().Tn(i.ex(i, i2));
if (Tn != null) {
boolean z = Tn.field_fileUpdated;
Tn.field_fileUpdated = false;
a.ccH().g(Tn);
if (i3 != bi.getInt(Tn.field_fileVersion, 0)) {
return;
}
if (a.ccH().handler == null) {
x.f("MicroMsg.ResDownloader.CheckResUpdateHelper", "sendEventFileCached: get null eventThread ");
} else {
a.ccH().handler.post(new b$8(bVar, i, i2, str, i3, z));
}
}
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.hybris.backoffice.workflow.impl;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.isNull;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import de.hybris.platform.core.model.ItemModel;
import de.hybris.platform.servicelayer.internal.i18n.LocalizationService;
import de.hybris.platform.servicelayer.model.ItemModelContext;
import de.hybris.platform.servicelayer.type.TypeService;
import de.hybris.platform.workflow.ScriptEvaluationService;
import de.hybris.platform.workflow.constants.WorkflowConstants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.internal.util.collections.Sets;
import com.hybris.backoffice.workflow.WorkflowTemplateActivationAction;
import com.hybris.backoffice.workflow.WorkflowTemplateActivationCtx;
import com.hybris.cockpitng.dataaccess.context.Context;
import com.hybris.cockpitng.dataaccess.context.impl.DefaultContext;
import com.hybris.cockpitng.dataaccess.facades.type.DataAttribute;
import com.hybris.cockpitng.dataaccess.facades.type.DataType;
import com.hybris.cockpitng.dataaccess.facades.type.TypeFacade;
import com.hybris.cockpitng.dataaccess.facades.type.exceptions.TypeNotFoundException;
import bsh.EvalError;
public class DefaultWorkflowTemplateActivationServiceTest
{
public static final String TEST_ITEM_TYPE = "TestItemType";
@Mock
private TypeFacade typeFacade;
@Mock
private ScriptEvaluationService scriptEvaluationService;
@Mock
private LocalizationService localizationService;
@Mock
private TypeService typeService;
@InjectMocks
@Spy
private DefaultWorkflowTemplateActivationService service;
private Locale[] availableLocales;
@Before
public void setUp()
{
availableLocales = new Locale[]
{ Locale.ENGLISH, Locale.GERMAN, Locale.ITALY, Locale.CHINA };
MockitoAnnotations.initMocks(this);
service.setWorkflowActivationSupportedTypes(Sets.newSet(TEST_ITEM_TYPE));
doReturn(Boolean.TRUE).when(typeService).isAssignableFrom(TEST_ITEM_TYPE, TEST_ITEM_TYPE);
doAnswer(mock -> ((Locale) mock.getArguments()[0]).toLanguageTag()).when(localizationService)
.getDataLanguageIsoCode(any(Locale.class));
}
@Test
public void testActivateWorkflowTemplates() throws EvalError
{
final List<WorkflowTemplateActivationCtx> ctxes = new ArrayList<>();
final Map<String, Object> currentValues = new HashMap<>();
final Map<String, Object> initialValues = new HashMap<>();
ctxes.add(new WorkflowTemplateActivationCtx(mockItemModel(), currentValues, initialValues, null));
ctxes.add(new WorkflowTemplateActivationCtx(mockItemModel(), currentValues, null, null));
ctxes.add(new WorkflowTemplateActivationCtx(mockItemModel(), null, initialValues, null));
service.activateWorkflowTemplates(ctxes);
verify(scriptEvaluationService).evaluateActivationScripts(any(ItemModel.class), same(currentValues), same(initialValues),
anyString());
verify(scriptEvaluationService).evaluateActivationScripts(any(ItemModel.class), same(currentValues), isNull(Map.class),
anyString());
verify(scriptEvaluationService).evaluateActivationScripts(any(ItemModel.class), isNull(Map.class), same(initialValues),
anyString());
}
@Test
public void testPrepareWorkflowTemplateActivationContexts()
{
doReturn(new WorkflowTemplateActivationCtx(null, null, null, null)).when(service).prepareWorkflowTemplateActivationCtx(
any(ItemModel.class), any(WorkflowTemplateActivationAction.class), any(Context.class));
final Map<ItemModel, WorkflowTemplateActivationAction> itemModels = new HashMap<>();
itemModels.put(mockItemModel(), WorkflowTemplateActivationAction.CREATE);
itemModels.put(mockItemModel(), WorkflowTemplateActivationAction.SAVE);
itemModels.put(mockItemModel(), WorkflowTemplateActivationAction.CREATE);
final List<WorkflowTemplateActivationCtx> ctxes = service.prepareWorkflowTemplateActivationContexts(itemModels, null);
assertThat(ctxes).hasSize(3);
verify(service, times(2)).prepareWorkflowTemplateActivationCtx(any(ItemModel.class),
same(WorkflowTemplateActivationAction.CREATE), any(Context.class));
verify(service, times(1)).prepareWorkflowTemplateActivationCtx(any(ItemModel.class),
same(WorkflowTemplateActivationAction.SAVE), any(Context.class));
}
@Test
public void testCreateWorkflowTemplateActivationCtxForSave() throws TypeNotFoundException
{
final DataType dataType = mockDataTypeWithAttributes("a", "b", "c", "d");
when(typeFacade.load(TEST_ITEM_TYPE)).thenReturn(dataType);
final ItemModelContext itemModelContext = mockItemModelCtxWithAttributes(Sets.newSet("a", "b"), Sets.newSet("c", "d"));
doReturn(itemModelContext).when(service).getItemModelContext(any(ItemModel.class));
doReturn(Boolean.FALSE).when(itemModelContext).isNew();
final Context invocationCtx = createFakeInvocationCtx("ctxAttr1", "ctxAttr2");
final ItemModel itemModel = mockItemModel();
final WorkflowTemplateActivationCtx ctx = service.prepareWorkflowTemplateActivationCtx(itemModel,
WorkflowTemplateActivationAction.SAVE, invocationCtx);
verify(service).prepareContextForSave(itemModel, dataType, invocationCtx);
assertThat(ctx.getWorkflowOperationType()).isEqualTo(WorkflowConstants.WorkflowActivationScriptActions.SAVE);
assertThat(ctx.getInitialValues()).hasSize(4);
assertThat(ctx.getCurrentValues()).hasSize(4);
assertThat(ctx.getAttribute("ctxAttr1")).isEqualTo("ctxAttr1VAL");
assertThat(ctx.getAttribute("ctxAttr2")).isEqualTo("ctxAttr2VAL");
}
@Test
public void testCreateWorkflowTemplateActivationCtxForCreate() throws TypeNotFoundException
{
final DataType dataType = mockDataTypeWithAttributes("a", "b", "c", "d");
when(typeFacade.load(TEST_ITEM_TYPE)).thenReturn(dataType);
final ItemModelContext itemModelContext = mockItemModelCtxWithAttributes(Sets.newSet("a", "b"), Sets.newSet("c", "d"));
doReturn(itemModelContext).when(service).getItemModelContext(any(ItemModel.class));
doReturn(Boolean.TRUE).when(itemModelContext).isNew();
final Context invocationCtx = createFakeInvocationCtx("ctxAttr1", "ctxAttr2");
final ItemModel itemModel = mockItemModel();
final WorkflowTemplateActivationCtx ctx = service.prepareWorkflowTemplateActivationCtx(itemModel,
WorkflowTemplateActivationAction.CREATE, invocationCtx);
verify(service).prepareContextForCreate(itemModel, dataType, invocationCtx);
assertThat(ctx.getWorkflowOperationType()).isEqualTo(WorkflowConstants.WorkflowActivationScriptActions.CREATE);
assertThat(ctx.getInitialValues()).hasSize(4);
assertThat(ctx.getCurrentValues()).isEmpty();
assertThat(ctx.getAttribute("ctxAttr1")).isEqualTo("ctxAttr1VAL");
assertThat(ctx.getAttribute("ctxAttr2")).isEqualTo("ctxAttr2VAL");
}
@Test
public void testCreateWorkflowTemplateActivationCtxForRemove() throws TypeNotFoundException
{
final DataType dataType = mockDataTypeWithAttributes("a", "b", "c", "d");
when(typeFacade.load(TEST_ITEM_TYPE)).thenReturn(dataType);
final ItemModelContext itemModelContext = mockItemModelCtxWithAttributes(Sets.newSet("a", "b"), Sets.newSet("c", "d"));
doReturn(itemModelContext).when(service).getItemModelContext(any(ItemModel.class));
doReturn(Boolean.FALSE).when(itemModelContext).isNew();
final Context invocationCtx = createFakeInvocationCtx("ctxAttr1", "ctxAttr2");
final ItemModel itemModel = mockItemModel();
service.prepareWorkflowTemplateActivationCtx(itemModel, WorkflowTemplateActivationAction.REMOVE, invocationCtx);
verify(service).prepareContextForRemove(itemModel, dataType, invocationCtx);
}
@Test
public void testCollectCurrentValues()
{
final ItemModel itemModel = mockItemModel();
final Map<String, Set<Locale>> localizedAttributes = new HashMap<>();
localizedAttributes.put("c", Sets.newSet(Locale.CANADA, Locale.CHINA));
localizedAttributes.put("d", Sets.newSet(Locale.ENGLISH, Locale.GERMAN, Locale.ITALY));
final Map<String, Object> originalValues = service.collectCurrentValues(itemModel, Sets.newSet("a", "b"),
localizedAttributes);
assertThat(originalValues).hasSize(4);
assertThat(originalValues.get("a")).isEqualTo(getCurrentValue("a"));
assertThat(originalValues.get("b")).isEqualTo(getCurrentValue("b"));
assertThat(originalValues.get("c")).isInstanceOf(Map.class);
assertThat(((Map<String, Object>) originalValues.get("c")).get(Locale.CANADA.toLanguageTag()))
.isEqualTo(getCurrentValue("c", Locale.CANADA));
assertThat(((Map<String, Object>) originalValues.get("c")).get(Locale.CHINA.toLanguageTag()))
.isEqualTo(getCurrentValue("c", Locale.CHINA));
assertThat(originalValues.get("d")).isInstanceOf(Map.class);
assertThat(((Map<String, Object>) originalValues.get("d")).get(Locale.ENGLISH.toLanguageTag()))
.isEqualTo(getCurrentValue("d", Locale.ENGLISH));
assertThat(((Map<String, Object>) originalValues.get("d")).get(Locale.GERMAN.toLanguageTag()))
.isEqualTo(getCurrentValue("d", Locale.GERMAN));
// check if is case insensitive
assertThat(originalValues.get("a")).isEqualTo(originalValues.get("A"));
}
@Test
public void testCollectOriginalValues()
{
final ItemModelContext itemModelContext = mockItemModelCtxWithAttributes(Sets.newSet("a", "b"), Sets.newSet("c", "d"));
final Map<String, Set<Locale>> localizedAttributes = new HashMap<>();
localizedAttributes.put("c", Sets.newSet(Locale.CANADA, Locale.CHINA));
localizedAttributes.put("d", Sets.newSet(Locale.ENGLISH, Locale.GERMAN, Locale.ITALY));
final Map<String, Object> originalValues = service.collectOriginalValues(itemModelContext, Sets.newSet("a", "b"),
localizedAttributes);
assertThat(originalValues).hasSize(4);
assertThat(originalValues.get("a")).isEqualTo(getOriginalValue("a"));
assertThat(originalValues.get("b")).isEqualTo(getOriginalValue("b"));
assertThat(originalValues.get("c")).isInstanceOf(Map.class);
assertThat(((Map<String, Object>) originalValues.get("c")).get(Locale.CANADA.toLanguageTag()))
.isEqualTo(getOriginalValue("c", Locale.CANADA));
assertThat(((Map<String, Object>) originalValues.get("c")).get(Locale.CHINA.toLanguageTag()))
.isEqualTo(getOriginalValue("c", Locale.CHINA));
assertThat(originalValues.get("d")).isInstanceOf(Map.class);
assertThat(((Map<String, Object>) originalValues.get("d")).get(Locale.ENGLISH.toLanguageTag()))
.isEqualTo(getOriginalValue("d", Locale.ENGLISH));
assertThat(((Map<String, Object>) originalValues.get("d")).get(Locale.GERMAN.toLanguageTag()))
.isEqualTo(getOriginalValue("d", Locale.GERMAN));
// check if is case insensitive
assertThat(originalValues.get("a")).isEqualTo(originalValues.get("A"));
}
@Test
public void testCollectValues()
{
final Map<String, Object> values = service.collectValues(Sets.newSet("a", "b", "c"), "VAL"::concat);
assertThat(values).hasSize(3);
assertThat(values.get("a")).isEqualTo("VAL".concat("a"));
assertThat(values.get("b")).isEqualTo("VAL".concat("b"));
assertThat(values.get("c")).isEqualTo("VAL".concat("c"));
}
@Test
public void testCollectLocalizedValues()
{
final BiFunction<String, Locale, Object> localizedValueSupp = (attribute, locale) -> locale.toLanguageTag()
.concat(attribute);
final Map<String, Set<Locale>> localizedAttributes = new HashMap<>();
localizedAttributes.put("a", Sets.newSet(Locale.CANADA, Locale.CHINA));
localizedAttributes.put("b", Sets.newSet(Locale.ENGLISH, Locale.GERMAN, Locale.ITALY));
final Map<String, Object> localizedValues = service.collectLocalizedValues(localizedAttributes, localizedValueSupp);
assertThat(localizedValues.get("a")).isInstanceOf(Map.class);
assertThat(((Map) localizedValues.get("a"))).hasSize(2);
assertThat(((Map) localizedValues.get("a")).get(Locale.CANADA.toLanguageTag()))
.isEqualTo(Locale.CANADA.toLanguageTag().concat("a"));
assertThat(((Map) localizedValues.get("a")).get(Locale.CHINA.toLanguageTag()))
.isEqualTo(Locale.CHINA.toLanguageTag().concat("a"));
assertThat(localizedValues.get("b")).isInstanceOf(Map.class);
assertThat(((Map) localizedValues.get("b"))).hasSize(3);
assertThat(((Map) localizedValues.get("b")).get(Locale.ENGLISH.toLanguageTag()))
.isEqualTo(Locale.ENGLISH.toLanguageTag().concat("b"));
assertThat(((Map) localizedValues.get("b")).get(Locale.GERMAN.toLanguageTag()))
.isEqualTo(Locale.GERMAN.toLanguageTag().concat("b"));
assertThat(((Map) localizedValues.get("b")).get(Locale.ITALY.toLanguageTag()))
.isEqualTo(Locale.ITALY.toLanguageTag().concat("b"));
}
@Test
public void testGetLocalizedValuesForAttribute()
{
final BiFunction<String, Locale, Object> localizedValueSupp = (attribute, locale) -> locale.toLanguageTag()
.concat(attribute);
final Map<String, Object> localizedValue = service.getLocalizedValuesForAttribute("a",
Sets.newSet(Locale.CANADA, Locale.ENGLISH), localizedValueSupp);
assertThat(localizedValue).hasSize(2);
assertThat(localizedValue.get(Locale.ENGLISH.toLanguageTag())).isEqualTo(localizedValueSupp.apply("a", Locale.ENGLISH));
assertThat(localizedValue.get(Locale.CANADA.toLanguageTag())).isEqualTo(localizedValueSupp.apply("a", Locale.CANADA));
}
@Test
public void testCollectModifiedAttributes()
{
final DataType dataType = mockDataTypeWithAttributes("a", "b", "c");
final ItemModelContext itemModelContext = mockItemModelCtxWithAttributes(Sets.newSet("b", "c", "d"),
Collections.emptySet());
final Set<String> modified = service.collectModifiedAttributes(itemModelContext, dataType);
assertThat(modified).hasSize(2);
assertThat(modified).contains("b", "c");
}
@Test
public void testCollectModifiedLocalizedAttributes()
{
final DataType dataType = mockDataTypeWithAttributes("a", "b", "c");
final ItemModelContext itemModelContext = mockItemModelCtxWithAttributes(Collections.emptySet(),
Sets.newSet("b", "c", "d"));
final Map<String, Set<Locale>> modified = service.collectModifiedLocalizedAttributes(itemModelContext, dataType);
assertThat(modified).hasSize(2);
assertThat(modified.keySet()).contains("b", "c");
assertThat(modified.get("b")).hasSize(availableLocales.length);
assertThat(modified.get("c")).hasSize(availableLocales.length);
}
@Test
public void testIsSupportedType()
{
doReturn(Boolean.TRUE).when(typeService).isAssignableFrom("Product", "VariantProduct");
doReturn(Boolean.FALSE).when(typeService).isAssignableFrom("Product", "Catalog");
service.setWorkflowActivationSupportedTypes(Sets.newSet("Product", TEST_ITEM_TYPE));
assertThat(service.isSupportedType("VariantProduct")).isTrue();
assertThat(service.isSupportedType("Catalog")).isFalse();
}
protected ItemModelContext mockItemModelCtxWithAttributes(final Set<String> attributes, final Set<String> localizedAttributes)
{
final ItemModelContext itemModelContext = mock(ItemModelContext.class);
when(itemModelContext.getDirtyAttributes()).thenReturn(attributes);
when(itemModelContext.getDirtyLocalizedAttributes())
.thenReturn(Arrays.stream(availableLocales).collect(Collectors.toMap(loc -> loc, loc -> localizedAttributes)));
doAnswer(mock -> getOriginalValue((String) mock.getArguments()[0])).when(itemModelContext)
.getOriginalValue(any(String.class));
doAnswer(mock -> {
final Object[] args = mock.getArguments();
return getOriginalValue((String) args[0], (Locale) args[1]);
}).when(itemModelContext).getOriginalValue(any(String.class), any(Locale.class));
return itemModelContext;
}
protected ItemModel mockItemModel()
{
final ItemModel itemModel = mock(ItemModel.class);
doAnswer(mock -> getCurrentValue((String) mock.getArguments()[0])).when(itemModel).getProperty(any(String.class));
doAnswer(mock -> {
final Object[] args = mock.getArguments();
return getCurrentValue((String) args[0], (Locale) args[1]);
}).when(itemModel).getProperty(any(String.class), any(Locale.class));
when(itemModel.getItemtype()).thenReturn(TEST_ITEM_TYPE);
return itemModel;
}
protected String getOriginalValue(final String value)
{
return value.concat("ORIGINAL");
}
protected String getOriginalValue(final String value, final Locale locale)
{
return value.concat(locale.toLanguageTag()).concat("ORIGINAL");
}
protected String getCurrentValue(final String value)
{
return value.concat("CURRENT");
}
protected String getCurrentValue(final String value, final Locale locale)
{
return value.concat(locale.toLanguageTag()).concat("CURRENT");
}
protected DataType mockDataTypeWithAttributes(final String... attributes)
{
final DataType dataType = mock(DataType.class);
final List<DataAttribute> dataAttributes = new ArrayList<>();
for (final String attribute : attributes)
{
final DataAttribute dataAttribute = mock(DataAttribute.class);
dataAttributes.add(dataAttribute);
when(dataType.getAttribute(attribute)).thenReturn(dataAttribute);
when(dataAttribute.getQualifier()).thenReturn(attribute);
}
when(dataType.getAttributes()).thenReturn(dataAttributes);
return dataType;
}
protected Context createFakeInvocationCtx(final String... attributes)
{
final DefaultContext ctx = new DefaultContext();
for (final String attr : attributes)
{
ctx.addAttribute(attr, attr.concat("VAL"));
}
return ctx;
}
}
|
package com.example.homework.model;
import static java.lang.Math.*;
public class LineCalc {
public double lineLength(Line2D line){
double wynik1 = pow(line.getaX() - line.getbX(), 2.0);
double wynik2 = pow(line.getbX() - line.getbY(), 2.0);
double lenght = round(abs((sqrt(wynik1 + wynik2))));
return lenght;
}
}
|
package java_Thread;
public class Testinterrupt1 {
public static void main(String[] args) {
stopthread1 s = new stopthread1();
Thread t1 = new Thread(s);
Thread t2 = new Thread(s);
t1.setDaemon(true);
t2.setDaemon(true);
t1.start();
t2.start();
int num1 = 0;
System.out.println("程序开始.");
while(true){
System.out.println(Thread.currentThread().getName()+"---"+num1);
if(num1++ == 40 ){
System.out.println("准备结束.");
s.changeflag1();
t1.interrupt();
t2.interrupt();
System.out.println("over");
break;
}
}
}
}
class stopthread1 implements Runnable{
private boolean flag = true;
@Override
public synchronized void run() {
while(flag){
try {
this.wait();
} catch (InterruptedException e) {
System.out.println("捕获中断线程异常.");
flag = false;
}
System.out.println(Thread.currentThread().getName()+"is running");
}
}
public void changeflag1(){
this.flag = false;
}
}
|
import Library.Management.domain.Book;
import Library.Management.repository.BookRepository;
import Library.Management.service.BookService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.Arrays;
import java.util.List;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class BookServiceTest {
@InjectMocks
private BookService bookService;
@Mock
private BookRepository bookRepository;
@Test
public void shouldGetAllBookList() {
Book book1 = new Book();
book1.setId("1");
Book book2 = new Book();
book2.setId("2");
when(bookRepository.findAll()).thenReturn(Arrays.asList(book1, book2));
List<Book> bookList = bookService.readAll();
assertThat(bookList.size(), equalTo(2));
assertThat(bookList.get(0).getId(), equalTo("1"));
assertThat(bookList.get(1).getId(), equalTo("2"));
}
@Test
public void shouldSaveTest() {
Book book = new Book();
book.setBookName("test");
when(bookRepository.save(book)).thenReturn(book);
bookService.create(book);
assertThat(book.getBookName(), equalTo("test"));
assertNotNull(book.getId());
}
@Test
public void shouldUpdateBook() {
Book book = new Book();
book.getId();
book.setBookName("Test for mockito");
book.setAuthor("Test for mockito");
bookRepository.delete(book.getId());
bookService.update(book);
ArgumentCaptor<Book> bookCaptor = ArgumentCaptor.forClass(Book.class);
verify(bookRepository).save(bookCaptor.capture());
Book capturedBook = bookCaptor.getValue();
assertThat(capturedBook.getBookName(), equalTo("Test for mockito"));
assertThat(capturedBook.getAuthor(), equalTo("Test for mockito"));
}
@Test
public void shouldDeleteBook() {
Book book = new Book();
book.setBookName("kitap");
bookService.delete(book);
ArgumentCaptor<Book> bookCaptor = ArgumentCaptor.forClass(Book.class);
verify(bookRepository, times(1)).delete(bookCaptor.capture());
assertThat(bookCaptor.getValue().getBookName(), equalTo("kitap"));
}
}
|
package simpleFactory.entity;
import simpleFactory.interfaces.Cola;
/**
* @Author: lty
* @Date: 2020/12/3 09:26
*/
public class Cocacola implements Cola {
public String getCola() {
System.out.println("生产可口可乐");
return "可口可乐";
}
}
|
package com.tencent.mm.plugin.address.ui;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.mm.R;
import com.tencent.mm.bp.a;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
public class InvoiceEditView extends RelativeLayout implements OnFocusChangeListener {
private int background;
private OnFocusChangeListener eYB;
private TextView eYC;
EditText eYD;
private ImageView eYE;
private String eYF;
private String eYG;
private int eYH;
private int eYI;
public boolean eYJ;
private int eYK;
public boolean eYL;
private int eYM;
private int eYN;
private boolean eYO;
private OnClickListener eYP;
private String eYQ;
public boolean eYS;
private a eYT;
private c eYU;
private b eYV;
private int eYW;
public boolean eYX;
private int gravity;
private int imeOptions;
private int inputType;
public InvoiceEditView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet);
this.eYS = false;
this.eYF = "";
this.eYG = "";
this.inputType = 1;
this.eYW = 0;
this.gravity = 19;
this.eYH = -1;
this.background = -1;
this.eYI = -1;
this.eYJ = true;
this.eYX = true;
this.eYL = false;
this.eYM = 0;
this.eYN = 100;
this.eYO = true;
this.eYP = new OnClickListener() {
public final void onClick(View view) {
if (InvoiceEditView.this.eYE.getVisibility() == 0 && InvoiceEditView.this.eYJ && InvoiceEditView.this.eYH != 2 && !bi.oW(InvoiceEditView.this.getText())) {
InvoiceEditView.this.eYD.setText("");
InvoiceEditView.this.cp(InvoiceEditView.this.eYD.isFocused());
}
}
};
this.eYQ = null;
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.n.InvoiceEditView, i, 0);
int resourceId = obtainStyledAttributes.getResourceId(R.n.InvoiceEditView_invoice_hint, 0);
if (resourceId != 0) {
this.eYF = context.getString(resourceId);
}
resourceId = obtainStyledAttributes.getResourceId(R.n.InvoiceEditView_invoice_tipmsg, 0);
if (resourceId != 0) {
this.eYG = context.getString(resourceId);
}
this.inputType = obtainStyledAttributes.getInteger(R.n.InvoiceEditView_android_inputType, 1);
this.eYH = obtainStyledAttributes.getInteger(R.n.InvoiceEditView_invoice_editType, 0);
this.eYJ = obtainStyledAttributes.getBoolean(R.n.InvoiceEditView_invoice_editable, true);
this.gravity = obtainStyledAttributes.getInt(R.n.InvoiceEditView_android_gravity, 19);
this.imeOptions = obtainStyledAttributes.getInteger(R.n.InvoiceEditView_android_imeOptions, 5);
this.background = obtainStyledAttributes.getResourceId(R.n.InvoiceEditView_android_background, R.g.transparent_background);
this.eYK = obtainStyledAttributes.getResourceId(R.n.InvoiceEditView_invoice_infoBackground, -1);
this.eYI = obtainStyledAttributes.getResourceId(R.n.InvoiceEditView_invoice_hintTextBg, R.g.transparent_background);
this.eYO = obtainStyledAttributes.getBoolean(R.n.InvoiceEditView_invoice_singleLine, true);
obtainStyledAttributes.recycle();
View inflate = LayoutInflater.from(context).inflate(R.i.invoice_edit_view, this, true);
this.eYD = (EditText) inflate.findViewById(R.h.hint_et);
this.eYD.setTextSize(0, (float) a.ad(context, R.f.NormalTextSize));
this.eYC = (TextView) inflate.findViewById(R.h.tip_tv);
this.eYE = (ImageView) inflate.findViewById(R.h.info_iv);
this.eYE.setOnClickListener(this.eYP);
this.eYD.setImeOptions(this.imeOptions);
this.eYD.setInputType(this.inputType);
if (this.inputType == 2) {
this.eYD.setKeyListener(new 1(this));
} else if (this.inputType == 3) {
this.eYD.setKeyListener(new 2(this));
} else {
this.eYD.setInputType(this.inputType);
}
cp(this.eYD.isFocused());
this.eYD.addTextChangedListener(new 3(this));
this.eYD.setOnFocusChangeListener(this);
if (!bi.oW(this.eYF)) {
this.eYD.setHint(this.eYF);
}
if (!bi.oW(this.eYG)) {
this.eYC.setText(this.eYG);
}
Rect rect = new Rect();
b(this.eYD, rect);
if (this.eYJ) {
this.eYL = false;
this.eYD.setBackgroundResource(this.eYI);
setBackgroundResource(this.background);
} else {
this.eYD.setEnabled(false);
this.eYD.setTextColor(getResources().getColor(R.e.address_link_color));
this.eYD.setFocusable(false);
this.eYD.setClickable(false);
this.eYD.setBackgroundResource(R.g.transparent_background);
if (this.eYX) {
setBackgroundResource(R.g.comm_list_item_selector);
}
setPadding(a.fromDPToPix(getContext(), 8), getPaddingTop(), getPaddingRight(), getPaddingBottom());
}
c(this.eYD, rect);
if (this.eYK != -1) {
this.eYE.setImageResource(this.eYK);
}
if (!this.eYO) {
this.eYD.setSingleLine(false);
}
}
public InvoiceEditView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public void setOnInputValidChangeListener(c cVar) {
this.eYU = cVar;
}
public void setOnInputInvoiceTypeChangeListener(b bVar) {
this.eYV = bVar;
}
public String getText() {
return this.eYD.getText().toString();
}
public void setEllipsize(TruncateAt truncateAt) {
this.eYD.setEllipsize(truncateAt);
}
public void setEnabled(boolean z) {
super.setEnabled(z);
this.eYJ = z;
this.eYE.setEnabled(true);
}
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (!this.eYJ) {
boolean z = this.eYE.getVisibility() == 0 ? getValidRectOfInfoIv().contains((int) motionEvent.getX(), (int) motionEvent.getY()) : false;
if (!z) {
return true;
}
}
return false;
}
public void setOnClickListener(OnClickListener onClickListener) {
super.setOnClickListener(onClickListener);
}
public final boolean ZF() {
String obj = this.eYD.getText().toString();
switch (this.eYH) {
case 0:
if (obj.length() < this.eYM || obj.length() > this.eYN) {
return false;
}
return true;
case 1:
if (obj.length() == 0) {
return true;
}
if (obj.length() < this.eYM || obj.length() > this.eYN) {
return false;
}
return true;
case 4:
if (obj.length() > 100) {
return false;
}
return true;
case 5:
if (obj.length() > 48) {
return false;
}
return true;
default:
if (obj.length() < this.eYM || obj.length() > this.eYN) {
return false;
}
return true;
}
}
private void cp(boolean z) {
if (!this.eYJ || bi.oW(getText())) {
switch (this.eYH) {
case 0:
case 1:
case 4:
this.eYE.setVisibility(8);
return;
case 2:
this.eYE.setVisibility(0);
this.eYE.setContentDescription(getContext().getString(R.l.address_contact));
return;
case 3:
this.eYE.setVisibility(0);
this.eYE.setContentDescription(getContext().getString(R.l.address_location));
return;
default:
this.eYE.setVisibility(8);
return;
}
}
this.eYE.setImageResource(R.g.list_clear);
this.eYE.setContentDescription(getContext().getString(R.l.clear_btn));
switch (this.eYH) {
case 0:
case 1:
case 4:
case 5:
if (z) {
this.eYE.setVisibility(0);
return;
} else {
this.eYE.setVisibility(8);
return;
}
case 2:
this.eYE.setVisibility(0);
this.eYE.setContentDescription(getContext().getString(R.l.address_contact));
return;
case 3:
this.eYE.setVisibility(0);
this.eYE.setContentDescription(getContext().getString(R.l.address_location));
return;
default:
this.eYE.setVisibility(8);
return;
}
}
public void setOnFocusChangeListener(OnFocusChangeListener onFocusChangeListener) {
super.setOnFocusChangeListener(onFocusChangeListener);
this.eYB = onFocusChangeListener;
}
public void setInfoIvOnClickListener(a aVar) {
this.eYT = aVar;
}
public void onFocusChange(View view, boolean z) {
if (this.eYB != null) {
this.eYB.onFocusChange(this, z);
}
x.d("MicroMsg.InvoiceEditView", "View:" + this.eYG + ", editType:" + this.eYH + " onFocusChange to " + z);
if (this.eYU != null) {
this.eYU.ZC();
}
if (this.eYL) {
this.eYC.setEnabled(true);
} else {
this.eYC.setEnabled(false);
}
if (view == this.eYD) {
Rect rect = new Rect();
b(this, rect);
if (z) {
setBackgroundResource(R.g.input_bar_bg_active);
} else {
setBackgroundResource(R.g.input_bar_bg_normal);
}
c(this, rect);
}
cp(z);
}
public void setHintStr(String str) {
this.eYD.setHint(str);
}
public void setTipStr(String str) {
this.eYC.setText(str);
}
public void setValStr(String str) {
this.eYD.setText(str);
this.eYD.setSelection(this.eYD.getText().length());
this.eYQ = str;
}
public void setBankNumberValStr(String str) {
CharSequence str2;
int i = 0;
if (this.eYH == 5) {
String replace = str2.replace(" ", "");
if (replace.length() >= 4) {
StringBuilder stringBuilder = new StringBuilder();
if (replace.length() % 4 == 0) {
while (i < (replace.length() / 4) - 1) {
stringBuilder.append(replace.substring(i * 4, (i + 1) * 4)).append(" ");
i++;
}
} else {
while (i < replace.length() / 4) {
stringBuilder.append(replace.substring(i * 4, (i + 1) * 4)).append(" ");
i++;
}
str2 = stringBuilder.append(replace.substring((replace.length() / 4) * 4, replace.length())).toString();
}
}
}
this.eYD.setText(str2);
this.eYD.setSelection(this.eYD.getText().length());
}
public final boolean ZG() {
if (getText().equals(bi.oV(this.eYQ))) {
return false;
}
return true;
}
public void setEditBG(int i) {
if (this.eYD != null) {
Rect rect = new Rect();
b(this.eYD, rect);
this.eYD.setBackgroundResource(i);
c(this.eYD, rect);
}
}
public void setTipTextColor(int i) {
if (this.eYC != null) {
this.eYC.setTextColor(i);
}
}
public void setImeOptions(int i) {
this.eYD.setImeOptions(i);
}
public void setInfoIvVisible(int i) {
this.eYE.setVisibility(i);
}
private Rect getValidRectOfInfoIv() {
Rect rect = new Rect();
this.eYE.getHitRect(rect);
rect.left -= 50;
rect.right += 50;
rect.top -= 25;
rect.bottom += 25;
return rect;
}
private static void b(View view, Rect rect) {
rect.left = view.getPaddingLeft();
rect.right = view.getPaddingRight();
rect.top = view.getPaddingTop();
rect.bottom = view.getPaddingBottom();
}
private static void c(View view, Rect rect) {
view.setPadding(rect.left, rect.top, rect.right, rect.bottom);
}
}
|
package com.zw.springcloudserviceprovider;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
@SpringBootApplication
@EnableFeignClients
@Slf4j
public class SpringCloudServiceProviderApplication {
public static volatile boolean needRunTask = true;
@Autowired
private static Scheduler scheduler;
public static void main(String[] args) {
ConfigurableApplicationContext run = SpringApplication.run(SpringCloudServiceProviderApplication.class, args);
//程序结束钩子
Runtime.getRuntime().addShutdownHook(new Thread(){
@SneakyThrows
@Override
public void run() {
// 在JVM关闭之前执行收尾工作
// 注意事项:
// 1.在这里执行的动作不能耗时太久
// 2.不能在这里再执行注册,移除关闭钩子的操作
// 3 不能在这里调用System.exit()
log.info("Application ShutDown...");
needRunTask = false;
}
});
}
}
|
package com.selfridges.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import com.selfridges.util.Constants;
public class CheckoutOrderConfirmationTab {
@FindBy(xpath=Constants.orderConfirmationNumber)
WebElement orderConfirmationNumber;
@FindBy(css=Constants.emailSentConfirmationText)
WebElement emailSentConfirmationText;
@FindBy(xpath=Constants.printreceiptButton)
WebElement printreceiptButton;
@FindBy(xpath=Constants.continueShoppingButton)
WebElement continueShoppingButton;
@FindBy(xpath=Constants.thankYouForYourOrderText)
WebElement thankYouForYourOrderText;
WebDriver driver;
public CheckoutOrderConfirmationTab(WebDriver dr){
driver=dr;
}
public String getOrderConfirmationNumer(){
return orderConfirmationNumber.getText();
}
public boolean isConfirmationNumerGenerated(){
return orderConfirmationNumber.isDisplayed();
}
public boolean isThankYouMessageTextDispalyed(){
return thankYouForYourOrderText.isDisplayed();
}
public boolean isEmailConfirmationTextDispalyed(){
return emailSentConfirmationText.isDisplayed();
}
public void clickOnContinueShoppingButton(){
continueShoppingButton.click();
}
public void clickOnPrintReceiptButton(){
printreceiptButton.click();
}
}
|
/*
*
*/
// Imports and Packages
package TLTTC;
import java.util.*;
public class ScheduleViewModel
{
private CTCController _controller;
ScheduleViewModel (CTCController controller)
{
_controller = controller;
}
}
|
package edu.eci.cvds.patterns;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
if(args.length == 0)
{
System.out.println( "Hello World!" );
}
else
{
String sPrint = "";
for(String s: args)
{
sPrint = sPrint.concat(s).concat(" ");
}
System.out.println( sPrint );
}
}
}
|
package com.example.demo.core;
import com.example.demo.core.peripherals.Peripheral;
import com.example.demo.core.systems.KVM;
import com.example.demo.core.systems.Tower;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* This is the main class which having all the components for the pc builder
*/
public class PC {
private PC(Tower tower, KVM kvm, List<Peripheral> peripherals) {
this.tower = tower;
this.kvm = kvm;
this.peripherals = peripherals;
}
//KVM -> KVM stands for "keyboard, video, mouse," and
// allows you to control multiple computers from a single keyboard, mouse, and monitor.
KVM kvm;
// cabinet
Tower tower;
//peripherals
List<Peripheral> peripherals;
public static class Builder {
Tower tower;
List<Peripheral> peripherals;
KVM kvm;
public Builder() {
}
public Builder withTower(Tower tower) {
this.tower = tower;
return this;
}
public Builder withKVM(KVM kvm) {
this.kvm = kvm;
return this;
}
public Builder addPeripherals(Peripheral... peripherals) {
if (this.peripherals == null) {
this.peripherals = new ArrayList<>();
}
this.peripherals.addAll(Arrays.asList(peripherals));
return this;
}
public Builder clearPeripherals() {
if (this.peripherals != null) {
this.peripherals.clear();
}
return this;
}
public PC build() {
var pc = new PC(tower, kvm, peripherals);
// TODO: check cabinet exists
// TODO: check kvm exists
// TODO: cabinet has all ports that kvm needs
// TODO: caninet has ports required for the peripherls
return pc;
}
}
}
|
package babylanguage.babyapp.appscommon.interfaces;
public interface OnCompletedListener <T>{
public void onComplete(T data);
}
|
package com.im;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
public class RequestChannel {
private int numProcessors;
private int queueSize;
private ArrayBlockingQueue<String> requestQueue = new ArrayBlockingQueue<String>(queueSize);
private BlockingQueue<String>[] responseQueues = new BlockingQueue[numProcessors];
public RequestChannel(int numProcessors, int queueSize) {
this.numProcessors = numProcessors;
this.queueSize = queueSize;
for (int i = 0; i < this.numProcessors; i++)
responseQueues[i] = new LinkedBlockingQueue<String>();
}
}
|
package com.producerConsumer;
import java.util.Random;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
public class ProducerConsumer {
static int max = 5;
static BlockingQueue<Integer> q = new LinkedBlockingQueue<Integer>(max);
public static void main(String[] args) {
Producer producer = new Producer();
Consumer consumer = new Consumer();
producer.start();
consumer.start();
}
static class Producer extends Thread {
Random random = new Random();
public void run() {
while (true) {
Integer x = random.nextInt(max);
try {
q.put(x);
System.out.println("Produced: "+ x);
System.out.print("");
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
}
}
static class Consumer extends Thread {
public void run() {
while (true) {
try {
System.out.println("Consumed: " + q.take());
System.out.print("");
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
|
/*
* Copyright (C) 2022-2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hedera.mirror.importer.migration;
import static org.assertj.core.api.Assertions.assertThat;
import com.hedera.mirror.common.aggregator.LogsBloomAggregator;
import com.hedera.mirror.common.domain.contract.ContractResult;
import com.hedera.mirror.common.domain.transaction.RecordFile;
import com.hedera.mirror.common.domain.transaction.Transaction;
import com.hedera.mirror.common.domain.transaction.TransactionType;
import com.hedera.mirror.importer.EnabledIfV1;
import com.hedera.mirror.importer.IntegrationTest;
import com.hedera.mirror.importer.repository.RecordFileRepository;
import com.hedera.mirror.importer.repository.TransactionRepository;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@EnabledIfV1
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Tag("migration")
class BackfillBlockMigrationTest extends IntegrationTest {
private final BackfillBlockMigration backfillBlockMigration;
private final RecordFileRepository recordFileRepository;
private final TransactionRepository transactionRepository;
@Test
void empty() {
backfillBlockMigration.migrateAsync();
assertThat(recordFileRepository.findAll()).isEmpty();
assertThat(transactionRepository.findAll()).isEmpty();
}
@Test
void migrate() {
// given
var expectedRecordFiles = new ArrayList<RecordFile>();
var expectedTransactions = new ArrayList<Transaction>();
// record files in timestamp ascending order:
// a record file without gas / bloom filter and there is no contract result from the transactions
var recordFileIndex = 0;
var consensusStart = domainBuilder.timestamp();
var consensusEnd = consensusStart + 10L;
var recordFile = persistRecordFile(recordFileIndex, consensusStart, consensusEnd, -1L, null);
recordFile.setGasUsed(0L);
recordFile.setLogsBloom(new byte[0]);
expectedRecordFiles.add(recordFile);
var timestamp = consensusStart;
var transactionIndex = 0;
var transaction = domainBuilder
.transaction()
.customize(customizeTransaction(timestamp, null))
.persist();
transaction.setIndex(transactionIndex++);
expectedTransactions.add(transaction);
timestamp++;
transaction = domainBuilder
.transaction()
.customize(customizeTransaction(timestamp, null))
.persist();
transaction.setIndex(transactionIndex++);
expectedTransactions.add(transaction);
transaction = domainBuilder
.transaction()
.customize(customizeTransaction(consensusEnd, null))
.persist();
transaction.setIndex(transactionIndex);
expectedTransactions.add(transaction);
// a record file without gas / bloom filter and there are contract results from the transactions
// note there is a child contractcreate tx whose contract result has 3 gas_used and null bloom filter
recordFileIndex++;
consensusStart = consensusEnd + 1L;
consensusEnd = consensusStart + 10L;
recordFile = persistRecordFile(recordFileIndex, consensusStart, consensusEnd, -1L, null);
var logsBloom = domainBuilder.bloomFilter();
logsBloom[0] = (byte) 0xf8;
logsBloom[1] = (byte) 0x87;
recordFile.setGasUsed(30L);
recordFile.setLogsBloom(logsBloom);
expectedRecordFiles.add(recordFile);
timestamp = consensusStart;
transactionIndex = 0;
transaction = domainBuilder
.transaction()
.customize(customizeTransaction(timestamp, null))
.persist();
transaction.setIndex(transactionIndex++);
expectedTransactions.add(transaction);
timestamp++;
transaction = domainBuilder
.transaction()
.customize(customizeTransaction(timestamp, null))
.customize(this::setContractCall)
.persist();
transaction.setIndex(transactionIndex++);
expectedTransactions.add(transaction);
var bloom1 = new byte[LogsBloomAggregator.BYTE_SIZE];
bloom1[0] = (byte) 0xf0;
bloom1[1] = (byte) 0x07;
System.arraycopy(logsBloom, 2, bloom1, 2, LogsBloomAggregator.BYTE_SIZE / 2);
domainBuilder
.contractResult()
.customize(customizeContractResult(timestamp, bloom1, 10L))
.persist();
// child contract create
timestamp++;
var parent = transaction;
transaction = domainBuilder
.transaction()
.customize(customizeTransaction(timestamp, null))
.customize(t -> t.type(TransactionType.CONTRACTCREATEINSTANCE.getProtoId())
.payerAccountId(parent.getPayerAccountId())
.validStartNs(parent.getValidStartNs())
.nonce(1))
.persist();
transaction.setIndex(transactionIndex++);
expectedTransactions.add(transaction);
domainBuilder
.contractResult()
.customize(customizeContractResult(timestamp, null, 3L))
.persist();
timestamp++;
transaction = domainBuilder
.transaction()
.customize(customizeTransaction(timestamp, null))
.customize(this::setContractCall)
.persist();
transaction.setIndex(transactionIndex++);
expectedTransactions.add(transaction);
var bloom2 = new byte[LogsBloomAggregator.BYTE_SIZE];
bloom2[0] = (byte) 0x08;
bloom2[1] = (byte) 0x80;
var offset = LogsBloomAggregator.BYTE_SIZE / 2;
var length = LogsBloomAggregator.BYTE_SIZE - offset;
System.arraycopy(logsBloom, offset, bloom2, offset, length);
domainBuilder
.contractResult()
.customize(customizeContractResult(timestamp, bloom2, 20L))
.persist();
transaction = domainBuilder
.transaction()
.customize(customizeTransaction(consensusEnd, null))
.persist();
transaction.setIndex(transactionIndex);
expectedTransactions.add(transaction);
// a record file with gas and bloom filter populated
recordFileIndex++;
consensusStart = consensusEnd + 2L;
consensusEnd = consensusStart + 8L;
logsBloom = domainBuilder.bloomFilter();
recordFile = persistRecordFile(recordFileIndex, consensusStart, consensusEnd, 40L, logsBloom);
expectedRecordFiles.add(recordFile);
expectedTransactions.addAll(List.of(
domainBuilder
.transaction()
.customize(customizeTransaction(consensusStart, 0))
.persist(),
domainBuilder
.transaction()
.customize(customizeTransaction(consensusStart + 1, 1))
.customize(this::setContractCall)
.persist(),
domainBuilder
.transaction()
.customize(customizeTransaction(consensusEnd, 2))
.persist()));
domainBuilder
.contractResult()
.customize(customizeContractResult(consensusStart + 1, logsBloom, 40L))
.persist();
// when
backfillBlockMigration.migrateAsync();
// then
assertThat(recordFileRepository.findAll()).containsExactlyInAnyOrderElementsOf(expectedRecordFiles);
assertThat(transactionRepository.findAll())
.usingRecursiveFieldByFieldElementComparatorOnFields("consensusTimestamp", "index")
.containsExactlyInAnyOrderElementsOf(expectedTransactions);
}
private Consumer<ContractResult.ContractResultBuilder<?, ?>> customizeContractResult(
long consensusTimestamp, byte[] bloom, long gasUsed) {
return b -> b.consensusTimestamp(consensusTimestamp).bloom(bloom).gasUsed(gasUsed);
}
private Consumer<Transaction.TransactionBuilder> customizeTransaction(long consensusTimestamp, Integer index) {
return b -> b.consensusTimestamp(consensusTimestamp).index(index).itemizedTransfer(null);
}
private RecordFile persistRecordFile(
long index, long consensusStart, long consensusEnd, long gasUsed, byte[] logsBloom) {
return domainBuilder
.recordFile()
.customize(r -> r.index(index)
.consensusStart(consensusStart)
.consensusEnd(consensusEnd)
.gasUsed(gasUsed)
.logsBloom(logsBloom))
.persist();
}
private void setContractCall(Transaction.TransactionBuilder b) {
b.type(TransactionType.CONTRACTCALL.getProtoId());
}
}
|
package com.rx.mvvm.repository.datasource.local;
import com.rx.mvvm.repository.entity.User;
import com.rx.rxmvvmlib.repository.datasource.locate.L_GET;
import com.rx.rxmvvmlib.repository.datasource.locate.LocalType;
import com.rx.rxmvvmlib.repository.datasource.locate.L_POST;
/**
* Created by wuwei
* 2021/5/24
* 佛祖保佑 永无BUG
*/
public interface IUserLocalService {
@L_POST(type = LocalType.SP, key = {"uid", "token"})
void saveUserCache(int uid, String token);
@L_GET(type = LocalType.SP, key = {"uid"})
int getUid();
@L_GET(type = LocalType.SP, key = {"token"})
String getToken();
@L_POST(type = LocalType.DB)
void saveUser(User user);
@L_GET(type = LocalType.DB)
User getUser(long id);
}
|
package cz.sd2.cpdn.executor.utils;
public class SectionCrate {
public int wid;
public int widNode1;
public int widNode2;
public int widNode3;
public String wtype;
public boolean wstatus;
public double wr;
public double wx;
public double wc;
public double wy;
public double ws1;
public double ws2;
public double ws3;
public double wuk1;
public double wuk2;
public double wuk3;
public double wpk1;
public double wpk2;
public double wpk3;
public double wio;
public double wpo;
public double wup;
public double wus;
public double wut;
public double wunp;
public double wuns;
public double wunt;
public double wimax;
public double wvu1;
public double wvu2;
public double wvu3;
public double wvfu1;
public double wvfu2;
public double wvfu3;
public double wvi;
public double wvfi;
public double wvp1;
public double wvq1;
public double wvp2;
public double wvq2;
public double wvdp;
public double wvdq;
public SectionCrate() {
wid = 0;
widNode1 = 0;
widNode2 = 0;
widNode3 = 0;
wr = 0.0;
wx = 0.0;
wc = 0.0;
wy = 0.0;
wtype = "";
ws1 = 0.0;
ws2 = 0.0;
ws3 = 0.0;
wuk1 = 0.0;
wuk2 = 0.0;
wuk3 = 0.0;
wimax = 0.0;
wpo = 0.0;
wup = 0.0;
wus = 0.0;
wut = 0.0;
wunp = 0.0;
wuns = 0.0;
wunt = 0.0;
wstatus = true;
wio = 0.0;
wpk1 = 0.0;
wpk2 = 0.0;
wpk3 = 0.0;
wvi = 0.0;
wvfi = 0.0;
wvp1 = 0.0;
wvq1 = 0.0;
wvp2 = 0.0;
wvq2 = 0.0;
wvu1 = 0.0;
wvfu1 = 0.0;
wvu2 = 0.0;
wvfu2 = 0.0;
wvu3 = 0.0;
wvfu3 = 0.0;
}
public SectionCrate(int lid, int lNode1, int lNode2, int lNode3, String ltype, double lr, double lx, double lc,
double ly, double ls1, double ls2, double ls3, double luk1, double luk2, double luk3, double lpk1,
double lpk2, double lpk3, double lup, double lus, double lut, double lunp, double luns, double lunt,
double lio, double limax, boolean lstatus) {
wid = lid;
widNode1 = lNode1;
widNode2 = lNode2;
widNode3 = lNode3;
wtype = ltype;
wr = lr;
wx = lx;
wc = lc;
wy = ly;
ws1 = ls1;
ws2 = ls2;
ws3 = ls3;
wuk1 = luk1;
wuk2 = luk2;
wuk3 = luk3;
wio = lio;
wpk1 = lpk1;
wpk2 = lpk2;
wpk3 = lpk3;
wup = lup;
wus = lus;
wut = lut;
wunp = lunp;
wuns = luns;
wunt = lunt;
wstatus = lstatus;
wimax = limax;
wvi = 0.0;
wvfi = 0.0;
wvp1 = 0.0;
wvq1 = 0.0;
wvp2 = 0.0;
wvq2 = 0.0;
wvu1 = 0.0;
wvfu1 = 0.0;
wvu2 = 0.0;
wvfu2 = 0.0;
wvu3 = 0.0;
wvfu3 = 0.0;
}
}
|
package iks.pttrns.collections;
public class Application {
public static void main(String[] args) {
new Waitress(new PancakeHouseMenu(), new DinnerMenu()).printMenu();
}
}
|
package com.paytechnologies.cloudacar.AsynTask;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.HttpHostConnectException;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import com.paytechnologies.DTO.ValidateProfileDTO;
import com.paytechnologies.cloudacar.R;
import com.paytechnologies.cloudacar.UploadPic;
import com.paytechnologies.util.Constants;
import com.paytechnologies.util.SessionManager;
import com.paytechnologies.util.Utils;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class UploadPicTask extends AsyncTask<String, String, String>{
Activity _uploadPic;
ProgressDialog pd;
SessionManager session;
String jsonResponseString;
DisplayImageOptions options;
int responseCode;
private ImageLoadingListener animateFirstListener = new AnimateFirstDisplayListener();
public UploadPicTask(UploadPic uploadPic) {
_uploadPic = uploadPic;
options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.user1)
.showImageForEmptyUri(R.drawable.user1)
.showImageOnFail(R.drawable.user1)
.cacheInMemory(true)
.cacheOnDisc(true)
.considerExifParams(true)
.build();
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pd= new ProgressDialog(_uploadPic);
pd.setMessage("Please Wait..");
pd.setCancelable(false);
pd.show();
}
@Override
protected String doInBackground(String... params) {
session =new SessionManager(_uploadPic);
HashMap<String, String> user = session.getUserDetails();
String userId = user.get(SessionManager.KEY_USERID);
Log.d("cac", "userId:"+userId);
JSONObject obj = new JSONObject();
try {
obj.put("action","mGetPic");
obj.put("userId", userId);
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
JSONArray array = new JSONArray();
array.put(obj);
System.out.println("Array => "+ array);
HttpResponse response;
String responseString = null;
// Creating HTTP client
HttpClient httpClient = new DefaultHttpClient();
//Creating HttpPost
HttpPost httpPost = new HttpPost(Constants.SERVER_URL +"/urc2");
Log.d("Call to servlet", "Call servlet");
// Building post parameters, key and value pair
List<NameValuePair> nameValuePair = new ArrayList<NameValuePair>(2);
nameValuePair.add(new BasicNameValuePair("jsondata", array.toString()));
Log.d("cac", "NameValuePair"+nameValuePair);
// Url Encoding the POST parameters
try {
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair));
Log.d("cac", "HttpPost:"+httpPost.toString());
}
catch (UnsupportedEncodingException e) {
// writing error to Log
e.printStackTrace();
}
try {
System.out.println("Executing...");
response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
jsonResponseString = EntityUtils.toString(entity);
Log.d("Http Response:",jsonResponseString);
responseCode = response.getStatusLine().getStatusCode();
} catch (HttpHostConnectException e){
// TODO Auto-generated catch block
//e.printStackTrace();
responseCode = 1101;//LCH: Our custom error code...
} catch (UnknownHostException e){
// TODO Auto-generated catch block
//e.printStackTrace();
responseCode = 1101;//LCH: Our custom error code...
}catch (ClientProtocolException e) {
// writing exception to log
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return jsonResponseString;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
pd.dismiss();
if(responseCode==404 || responseCode==1101){
final Dialog dialog = new Dialog(_uploadPic);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
// Include dialog.xml file
dialog.setContentView(R.layout.custom_dialog);
TextView title = (TextView)dialog.findViewById(R.id.textTitleDialog);
TextView text = (TextView) dialog.findViewById(R.id.textViewDialog);
text.setText("Server not available try after some time");
title.setText("Warning");
dialog.show();
Button declineButton = (Button) dialog.findViewById(R.id.buttondialog);
declineButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.dismiss();
new Utils().HandleHTTPserverError(_uploadPic, 0);
/*
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
_cancelTrip.startActivity(intent);
*/
}
});
return;
}
if(jsonResponseString==null) return;
ImageLoader imageLoader = ImageLoader.getInstance();
ImageView mImageView = (ImageView)_uploadPic.findViewById(R.id.imageViewUserPhoto);
String response = jsonResponseString.replaceAll("\\s", "");
if(response.equalsIgnoreCase("null")){
mImageView.setImageResource(R.drawable.profilepic);
}
else{
imageLoader.displayImage("http://www.cloudacar.com/"+response,mImageView, options, animateFirstListener);
session.setProfilePic(jsonResponseString);
}
}
private static class AnimateFirstDisplayListener extends SimpleImageLoadingListener {
static final List<String> displayedImages = Collections.synchronizedList(new LinkedList<String>());
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (loadedImage != null) {
ImageView imageView = (ImageView) view;
boolean firstDisplay = !displayedImages.contains(imageUri);
if (firstDisplay) {
FadeInBitmapDisplayer.animate(imageView, 500);
displayedImages.add(imageUri);
}
}
}
}
} |
package coronavairusapi.models;
public enum Status {
Recuperado, Morto, Positivo;
}
|
package com.libedi.demo.domain;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import lombok.Getter;
import lombok.ToString;
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Getter
@ToString
public abstract class BaseAuditEntity {
@CreatedDate
@Column(nullable = false, updatable = false)
private LocalDateTime createdAt;
@LastModifiedDate
@Column(nullable = false)
private LocalDateTime updatedAt;
@CreatedBy
@Column(nullable = false, updatable = false)
private Long createdBy;
@LastModifiedBy
@Column(nullable = false)
private Long updatedBy;
}
|
package cn.bs.zjzc.presenter;
import cn.bs.zjzc.model.IVerificationInfoModel;
import cn.bs.zjzc.model.callback.HttpTaskCallback;
import cn.bs.zjzc.model.impl.VerificationInfoModel;
import cn.bs.zjzc.model.response.VerificationInfoResponse;
import cn.bs.zjzc.ui.view.IVerificationInfoView;
/**
* Created by Ming on 2016/6/14.
*/
public class VerificationInfoPresenter {
private IVerificationInfoView mVerificationInfoView;
private IVerificationInfoModel mVerificationInfoModel;
public VerificationInfoPresenter(IVerificationInfoView verificationInfoView) {
mVerificationInfoView = verificationInfoView;
mVerificationInfoModel = new VerificationInfoModel();
}
public void getVerificationInfo() {
mVerificationInfoModel.getVerificationInfo(new HttpTaskCallback<VerificationInfoResponse.DataBean>() {
@Override
public void onTaskFailed(String errorInfo) {
}
@Override
public void onTaskSuccess(VerificationInfoResponse.DataBean data) {
mVerificationInfoView.showVerificationInfo(data);
}
});
}
}
|
package primeirosProgramas;
public class MexendoComBoolean {
public static void main(String []agrs) {
boolean pagueiMinhasContas = true;
boolean fuiPassear = false;
boolean estouFeliz = pagueiMinhasContas || fuiPassear;
System.out.println(estouFeliz);
}
}
|
package Threads;
/*
* is this output 0 1 0 1 0 1 ...
* the only possible output?
*
*
*/
public class T_12 extends Thread {
private String info;
static Object o = new Object();
public T_12 (String info) {
this.info = info;
}
public void run () {
while ( true ) {
synchronized ( o ) {
o.notify();
System.out.println(info);
try {
sleep(300);
o.wait();
} catch ( Exception e ) { }
}
}
}
public static void main (String args []) {
new T_12("0").start();
new T_12("1").start();
}
} |
package com.tencent.mm.plugin.appbrand.launching;
import com.tencent.mm.plugin.appbrand.report.a;
import com.tencent.mm.plugin.report.service.h;
class AppBrandPrepareTask$3 implements Runnable {
final /* synthetic */ AppBrandPrepareTask geW;
AppBrandPrepareTask$3(AppBrandPrepareTask appBrandPrepareTask) {
this.geW = appBrandPrepareTask;
}
public final void run() {
int i = 369;
if (this.geW.geV) {
i = 777;
}
h.mEJ.a((long) i, 3, 1, false);
a.a(this.geW.geS.mAppId, 0, this.geW.geS.gfg, i, 3);
}
}
|
package org.kernelab.basis.io;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PushbackInputStream;
import java.nio.charset.Charset;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
public class ByteOrderMarkScanner
{
public static final int BOM_BYTES = 4;
public static final byte[] BOM_UTF_16LE = new byte[] { (byte) 0xFF, (byte) 0xFE };
public static final byte[] BOM_UTF_16BE = new byte[] { (byte) 0xFE, (byte) 0xFF };
public static final byte[] BOM_UTF_8 = new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF };
public static final byte[] BOM_UTF_1 = new byte[] { (byte) 0xF7, (byte) 0x64, (byte) 0x4C };
public static final byte[] BOM_SCSU = new byte[] { (byte) 0x0E, (byte) 0xFE, (byte) 0xFF };
public static final byte[] BOM_BOCU_1 = new byte[] { (byte) 0xFB, (byte) 0xEE, (byte) 0x28 };
public static final byte[] BOM_UTF_32LE = new byte[] { (byte) 0xFF, (byte) 0xFE, (byte) 0x00,
(byte) 0x00 };
public static final byte[] BOM_UTF_32BE = new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0xFE,
(byte) 0xFF };
public static final byte[] BOM_UTF_EBCDIC = new byte[] { (byte) 0xDD, (byte) 0x73, (byte) 0x66,
(byte) 0x73 };
public static final byte[] BOM_GB18030 = new byte[] { (byte) 0x84, (byte) 0x31, (byte) 0x95,
(byte) 0x33 };
public static final byte[] BOM_UTF_7 = new byte[] { (byte) 0x2B, (byte) 0x2F, (byte) 0x76,
(byte) 0x38 };
public static final Map<String, byte[]> BOMS = new LinkedHashMap<String, byte[]>();
static
{
BOMS.put("UTF-16LE", BOM_UTF_16LE);
BOMS.put("UTF-16BE", BOM_UTF_16BE);
BOMS.put("UTF-8", BOM_UTF_8);
BOMS.put("UTF-1", BOM_UTF_1);
BOMS.put("SCSU", BOM_SCSU);
BOMS.put("BOCU-1", BOM_BOCU_1);
BOMS.put("UTF-32LE", BOM_UTF_32LE);
BOMS.put("UTF-32BE", BOM_UTF_32BE);
BOMS.put("UTF-EBCDIC", BOM_UTF_EBCDIC);
BOMS.put("GB18030", BOM_GB18030);
BOMS.put("UTF-7", BOM_UTF_7);
BOMS.put("UTF-7|1", new byte[] { (byte) 0x2B, (byte) 0x2F, (byte) 0x76, (byte) 0x39 });
BOMS.put("UTF-7|2", new byte[] { (byte) 0x2B, (byte) 0x2F, (byte) 0x76, (byte) 0x2B });
BOMS.put("UTF-7|3", new byte[] { (byte) 0x2B, (byte) 0x2F, (byte) 0x76, (byte) 0x2F });
}
public static final byte[] getBOM(Charset charset)
{
return BOMS.get(charset.name());
}
public static final byte[] getBOM(String charsetName)
{
return getBOM(Charset.forName(charsetName));
}
public static final boolean samePrefix(byte[] a, byte[] b)
{
boolean is = false;
if (a != null && b != null)
{
int len = Math.min(a.length, b.length);
is = true;
for (byte i = 0; i < len; i++)
{
if (a[i] != b[i])
{
is = false;
break;
}
}
}
return is;
}
private Charset charset;
private InputStreamReader reader;
private boolean bommed;
public Charset getCharset()
{
return charset;
}
public InputStreamReader getReader()
{
return reader;
}
public boolean isBommed()
{
return bommed;
}
public ByteOrderMarkScanner scan(InputStream is) throws IOException
{
return scan(is, Charset.defaultCharset());
}
public ByteOrderMarkScanner scan(InputStream is, Charset defaultCharset) throws IOException
{
Charset charset = defaultCharset;
PushbackInputStream scanner = new PushbackInputStream(is, BOM_BYTES);
byte[] bytes = new byte[BOM_BYTES];
int reads = scanner.read(bytes);
String charsetName = null;
boolean bommed = false;
if (reads != -1)
{
for (Entry<String, byte[]> entry : BOMS.entrySet())
{
if (samePrefix(bytes, entry.getValue()))
{
bommed = true;
int len = entry.getValue().length;
scanner.unread(bytes, len, reads - len);
charsetName = entry.getKey().replaceFirst("^(.+?)(?:\\|.*)$", "$1");
break;
}
}
if (charsetName == null)
{
scanner.unread(bytes, 0, reads);
}
else
{
try
{
charset = Charset.forName(charsetName);
}
catch (Exception e)
{
charset = defaultCharset;
}
}
}
return this.setBommed(bommed).setCharset(charset).setReader(scanner);
}
public ByteOrderMarkScanner scan(InputStream is, String defaultCharsetName) throws IOException
{
return scan(is, Charset.forName(defaultCharsetName));
}
private ByteOrderMarkScanner setBommed(boolean bommed)
{
this.bommed = bommed;
return this;
}
private ByteOrderMarkScanner setCharset(Charset charset)
{
this.charset = charset;
return this;
}
private ByteOrderMarkScanner setReader(PushbackInputStream is)
{
this.reader = new InputStreamReader(is, charset);
return this;
}
}
|
package com.demo.service;
import com.demo.beans.Employee;
import com.demo.dao.DAOJDBCImpl;
public class ServiceDAOImpl implements ServiceDAO{
DAOJDBCImpl impl = new DAOJDBCImpl();
@Override
public boolean createEmployee(Employee emp) {
boolean b = impl.createEmployee(emp);
return b;
}
@Override
public Employee readEmployee(int id) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean updateEmployee(Employee emp) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean deleteEmployee(int id) {
// TODO Auto-generated method stub
return false;
}
}
|
package org.browsexml.timesheetjob.dao.hibernate;
import java.util.List;
import org.browsexml.timesheetjob.dao.WorkCodeDao;
import org.browsexml.timesheetjob.model.WorkCode;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
public class WorkCodeDaoHibernate extends HibernateDaoSupport implements WorkCodeDao {
public void removeWorkCode(Long id) {
Object workCode = getHibernateTemplate().load(WorkCode.class, id);
getHibernateTemplate().delete(workCode);
}
public void saveWorkCode(WorkCode workCode) {
getHibernateTemplate().saveOrUpdate(workCode);
}
public WorkCode getWorkCode(Long id) {
return (WorkCode) getHibernateTemplate().get(WorkCode.class, id);
}
public List<WorkCode> getWorkCodes(boolean isStudentWorker) {
if (isStudentWorker)
return getHibernateTemplate().find("from WorkCode where parttime = 1 ");
return getHibernateTemplate().find("from WorkCode ");
}
public WorkCode getWorkCode(String workCode) {
List<WorkCode> workCodes = getHibernateTemplate().find(
"from WorkCode where code = ?", workCode);
if (workCodes.size() > 0)
return workCodes.get(0);
return null;
}
}
|
package GUI;
import Parsing.SaxParser;
import java.awt.FlowLayout;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
//import java.time.Clock;
import java.util.logging.Handler;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author elshan_abdullayev
*/
public class OpenFile extends JInternalFrame{
String []options1 = {"Ətraflı yoxlamaya davam","Cancel"};
JPanel myPanel;
//SAXParser sParser;
Handler handler;
//String account_no;
static File file;
static File dir;
SaxParser sp;
boolean vld;
ZipEntry entry;
private static final String DEST_FOLDER = ".//Extract";
static final int BUFFER = 2048;
OpenFile() throws FileNotFoundException, IOException{
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("");
frame.setLayout(new FlowLayout());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JFileChooser fc = new JFileChooser();
if (dir!=null){
fc.setCurrentDirectory(dir);
}
String[] EXTENSION=new String[]{"xml","zip"};
FileFilter filterXml = new FileNameExtensionFilter("XML fayıllar",EXTENSION[0] );
FileFilter filterZip = new FileNameExtensionFilter("Zip fayıllar",EXTENSION[1] );
fc.addChoosableFileFilter(filterXml);
fc.addChoosableFileFilter(filterZip);
int ret = fc.showDialog(null, "Faylı Seç");
// int ret = fc.showSaveDialog(null);
if (ret == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFile();
dir=file.getParentFile();
//File file =fc.showSaveDialog();
//size=file.length();
String filename = file.getName();
String ext = filename.substring(filename.lastIndexOf(".") + 1, filename.length()).toUpperCase();
String xml="xml".toUpperCase();
String zip="zip".toUpperCase();
/**Swich begin**/
switch (ext) {
case "XML": System.out.println();
sp= new SaxParser();
//sp.setXmlfile(file.toString());
sp.setXmlInput(new FileInputStream(file));
System.out.println("Selected file : "+file);
sp.getSaxParser();
vld=sp.isValid();
if(vld!=false)
{
// JOptionPane.showMessageDialog(null, "İlkin yoxlama uğurla başa çatdı",
// "Faylın ilkin yoxlama mərhələsi", JOptionPane.INFORMATION_MESSAGE);
//
// sp = new SaxParser();
// sp.setXmlInput(new FileInputStream(file));
// sp.getSaxParser(vld);
myPanel = new JPanel();
myPanel.add(new JLabel("İlkin yoxlama uğurla başa çatdı"));
int res = JOptionPane.showOptionDialog(null, myPanel,"Faylın ilkin yoxlama mərhələsi",
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null,options1, null);
switch (res){
case 0: {//JOptionPane.showMessageDialog(null, "Şəxsiyyət Vəsiqəsi Seriya Nömrəsi(AZE) üzrə Sorğulama üçün faylın daxil edilməsi");
sp = new SaxParser();
sp.setXmlInput(new FileInputStream(file));
sp.getSaxParser(vld);
break;}
case 1: {JOptionPane.showMessageDialog(null, "Yoxlama sonlandırıldı");
break;}
default: System.out.println("NoSelected");
break;
}
}
break;
case "ZIP":
System.out.println(" Zip Part : begin");
File folder = new File(DEST_FOLDER);
if(!folder.exists()){
folder.mkdir();
}
BufferedOutputStream dest = null;
sp= new SaxParser();
//sp.setXmlfile(file.toString());
FileInputStream fis = new FileInputStream(file);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
while((entry = zis.getNextEntry()) != null) {
//entry =zis.getNextEntry();
int count;
byte data[] = new byte[BUFFER];
System.out.println(" entry Zip: "+entry.getName());
File newFile = new File(DEST_FOLDER + File.separator + entry.getName());
if(entry.isDirectory()){
if(!newFile.exists()){
newFile.mkdirs();
System.out.println(" Output of Zip is Directory");
}
}
else{
FileOutputStream fos = new FileOutputStream(newFile);
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER)) != -1) {
dest.write(data, 0, count);
}
dest.flush();
dest.close();
String destPath = DEST_FOLDER + File.separator + entry.getName();
File fileNew=new File(destPath);
sp.setXmlInput(new FileInputStream(fileNew));
//System.out.println("Selected file : "+destPath);
sp.getSaxParser();
vld=sp.isValid();
if(vld!=false)
{
myPanel = new JPanel();
myPanel.add(new JLabel("İlkin yoxlama uğurla başa çatdı"));
int res = JOptionPane.showOptionDialog(null, myPanel,"Faylın ilkin yoxlama mərhələsi",
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null,options1, null);
switch (res){
case 0: {//JOptionPane.showMessageDialog(null, "Şəxsiyyət Vəsiqəsi Seriya Nömrəsi(AZE) üzrə Sorğulama üçün faylın daxil edilməsi");
sp = new SaxParser();
sp.setXmlInput(new FileInputStream(fileNew));
sp.getSaxParser(vld);
break;}
case 1: {JOptionPane.showMessageDialog(null, "Yoxlama sonlandırıldı");
break;}
default: System.out.println("NoSelected");
break;
}
}
}
}
zis.closeEntry();
zis.close();
fis.close();
break;
default :
JOptionPane.showMessageDialog(null, "Düzgün fayl daxil edilməmişdir : Faylın uzantısı ["+ext+"] ", "Xəbərdarlıq", JOptionPane.WARNING_MESSAGE);
}
/**Swich end**/
}
// else
// {
// JOptionPane.showMessageDialog(null, "Fayıl seçilməmişdir", "Xəbərdarlıq", JOptionPane.WARNING_MESSAGE);
// }
}
// public void actionPerformed(ActionEvent ae) {
//
// ae.getSource().equals(ae);
// }
OpenFile(String account_no) throws FileNotFoundException
{
if(file!=null){
System.out.println(" Parametrizied " + account_no+ " File : "+file.getName());
try {
sp= new SaxParser();
sp.setXmlInput(new FileInputStream(file));
System.out.println("Selected file Table : "+file);
sp.getSaxParser();
}catch (NullPointerException io)
{
io.printStackTrace();
}
} else
{
System.out.println("File is null ");
JOptionPane.showMessageDialog(null, "Əvvəlcədən fayl emalı qeydə alınmamışdır", "Xəbərdarlıq", JOptionPane.WARNING_MESSAGE);
}
}
}
|
package com.designpattern.singleton;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
/**
* 测试单例模式,通过反射和序列化方式破解单例模式
* @author walkerwang
*
*/
public class SingletonCrack {
public static void main(String[] args) throws Exception {
char[] chs = {'a','b','c'};
char[] chs2 = new char[3];
char[] chs3 = new char[] {'a','b','c'};
System.out.println(chs3);
//通过反射破解单例模式
// throughReflect();
throughSerialize();
}
//通过反射的方式直接调用私有化构造器,创建多个实例
public static void throughReflect() throws Exception {
LazySingleton2 singleton1 = LazySingleton2.getInstance();
LazySingleton2 singleton2 = LazySingleton2.getInstance();
System.out.println(singleton1);
System.out.println(singleton2);
//反射1
Class<LazySingleton2> clazz = (Class<LazySingleton2>)Class.forName("com.designpattern.singleton.LazySingleton2");
//反射2
Class<LazySingleton2> clazz2 = (Class<LazySingleton2>)singleton1.getClass();
Constructor<LazySingleton2> c = clazz.getDeclaredConstructor(null);
c.setAccessible(true); //设置构造器为可访问的
LazySingleton2 singleton3 = c.newInstance();
LazySingleton2 singleton4 = c.newInstance();
System.out.println(singleton3);
System.out.println(singleton4);
}
//通过反序列化的方式创建多个对象
public static void throughSerialize() throws Exception {
LazySingleton2 singleton1 = LazySingleton2.getInstance();
System.out.println(singleton1);
//序列化
FileOutputStream fos = new FileOutputStream("d:/a.txt");
ObjectOutputStream oos =new ObjectOutputStream(fos);
oos.writeObject(singleton1);
oos.close();
fos.close();
//反序列化(反序列化一个新的实例对象出来了)
ObjectInputStream ois = new ObjectInputStream(
new FileInputStream("d:/a.txt"));
LazySingleton2 newSingleton = (LazySingleton2) ois.readObject();
System.out.println(newSingleton);
}
}
class LazySingleton2 implements Serializable {
private static LazySingleton2 instance = null;
private LazySingleton2() {
//防止反射破解
if (instance != null) {
try {
throw new RuntimeException();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static LazySingleton2 getInstance() {
//防止通过反射方式破解单例模式
if (instance == null) {
instance = new LazySingleton2();
}
return instance;
}
//防止通过序列化方式破解单例模式
//反序列化时直接调用instance对象,如果定义了readResolve方法则直接返回此方法指定的对象,
//而不需要单独再创建新对象
private Object readResolve() throws Exception {
return instance;
}
} |
package io.github.maiconandsilva.services;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.transaction.Transactional;
import org.eclipse.microprofile.graphql.GraphQLApi;
import org.eclipse.microprofile.graphql.Mutation;
import org.eclipse.microprofile.graphql.Query;
import io.github.maiconandsilva.entities.Avaliacao;
import io.github.maiconandsilva.entities.Estabelecimento;
@GraphQLApi
@ApplicationScoped
public class EstabelecimentoService {
@Mutation
@Transactional
public Long adicionarNovoEstabelecimento(Estabelecimento estabelecimento) {
estabelecimento.persist();
return estabelecimento.id;
}
@Query
public List<Estabelecimento> getTodosEstabelecimentos() {
return Estabelecimento.findAll().list();
}
@Query
public List<Avaliacao> getAvaliacoesPorEstabelecimento(
Integer estabelecimentoId) {
return Avaliacao.find("estabelecimento_id = ?1", estabelecimentoId).list();
}
}
|
package edu.weber;
import java.io.FileNotFoundException;
import java.net.URI;
import java.net.URISyntaxException;
public class ThrowExceptions {
private static void getArrayItem() throws ArrayIndexOutOfBoundsException
{
String[] strings = {"Welcome"};
System.out.println(strings[1]);
}
public static void main(String[] args) {
try {
getArrayItem();
URI uri = new URI("http:\\www.weber.edu");
System.out.println("Program is still running inside try block");
} catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Array item was out of bounds!");
}
catch(URISyntaxException u)
{
System.out.println("URI syntax error found!");
}
System.out.println("Program is still running after the catch block!");
}
}
|
package net.optifine.entity.model;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelIllager;
import net.minecraft.client.renderer.entity.RenderEvoker;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.monster.EntityEvoker;
public class ModelAdapterEvoker extends ModelAdapterIllager {
public ModelAdapterEvoker() {
super(EntityEvoker.class, "evocation_illager", 0.5F);
}
public ModelBase makeModel() {
return (ModelBase)new ModelIllager(0.0F, 0.0F, 64, 64);
}
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) {
RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
RenderEvoker renderevoker = new RenderEvoker(rendermanager);
renderevoker.mainModel = modelBase;
renderevoker.shadowSize = shadowSize;
return (IEntityRenderer)renderevoker;
}
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\optifine\entity\model\ModelAdapterEvoker.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
package com.mediacom.tools;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.mediacom.repo.MemberDaoImpl;
public class BasicConfigFile
{
public BasicConfigFile()
{
}
private final static Logger LOG = LoggerFactory.getLogger(BasicConfigFile.class);
private transient BufferedReader bfr;
private transient BufferedWriter bfw;
private transient String delim;
private transient boolean eof;
private transient String filename;
private transient FileReader fr;
private transient FileWriter fw;
private transient String line;
private transient String name;
private transient String newline;
private transient String value;
public BasicConfigFile(final String filenameIN,final String delimIN,final boolean appendIN) throws MediacomException
{
filename=filenameIN;
delim=delimIN;
name=null;
value=null;
fr=null;
fw=null;
openFileReader();
openFileWriter(appendIN);
eof=false;
newline=String.valueOf(Constants.NEW_LINE);
}
public static String readConfigValue(final String fileName,final String key,final String delimator)
{
String ln;
String temp=null;
boolean EndOfFile=false;
if ( fileName!=null&&key!=null&&delimator!=null )
{
try
{
BufferedReader r=new BufferedReader(new FileReader(fileName));
while ( !EndOfFile )
{
ln=r.readLine();
if ( ln!=null&&ln.indexOf(delimator)>0&&ln.substring(0,ln.indexOf(delimator)).trim().equalsIgnoreCase(key) )
{
temp=NullChecker.checkForNullTrim(ln.substring((ln.indexOf(delimator)+1),ln.length()));
}
if ( ln==null )
{
EndOfFile=true;
}
}
r.close();
r=null;
}
catch ( final Exception e )
{
temp=null;
}
}
if ( temp!=null )
{
temp=temp.trim();
}
ln=null;
return temp;
}
public static void writeConfigValue(final String FileName,final String nameIN,final String delim,final String valueIN,final String newln,final boolean appendIN) throws MediacomException
{
if ( FileName!=null&&nameIN!=null&&valueIN!=null&&delim!=null&&newln!=null )
{
try
{
final BufferedWriter w=new BufferedWriter(new FileWriter(FileName,appendIN));
w.write(nameIN);
w.write(delim);
w.write(valueIN);
w.write(newln);
w.flush();
w.close();
}
catch ( final Exception e )
{
throw new MediacomException(e);
}
}
}
public void cleanup() throws MediacomException
{
closeFile();
filename=null;
delim=null;
name=null;
value=null;
fr=null;
fw=null;
bfr=null;
bfw=null;
line=null;
newline=null;
}
public void closeFile() throws MediacomException
{
try
{
if ( bfr!=null )
{
bfr.close();
}
if ( bfw!=null )
{
bfw.flush();
bfw.close();
}
bfr=null;
bfw=null;
fr=null;
fw=null;
filename=null;
delim=null;
}
catch ( final Exception e )
{
throw new MediacomException(e);
}
}
public void getItem() throws MediacomException
{
try
{
if ( !eof )
{
line=bfr.readLine();
if ( line==null )
{
eof=true;
line=Constants.EMPTY_STRING;
name=Constants.EMPTY_STRING;
value=Constants.EMPTY_STRING;
}
else
{
parseItem();
}
}
}
catch ( final Exception e )
{
throw new MediacomException(e);
}
}
public void openFileReader() throws MediacomException
{
try
{
fr=new FileReader(filename);
bfr=new BufferedReader(fr);
}
catch ( final Exception e )
{
throw new MediacomException(e);
}
}
public void openFileWriter(final boolean append) throws MediacomException
{
try
{
fw=new FileWriter(filename,append);
bfw=new BufferedWriter(fw);
}
catch ( final Exception e )
{
throw new MediacomException(e);
}
}
public void setItem() throws MediacomException
{
try
{
if ( bfw!=null )
{
bfw.write(name);
bfw.write(delim);
bfw.write(value);
bfw.flush();
}
}
catch ( final Exception e )
{
throw new MediacomException(e);
}
}
public void setItem(final String nameIN,final String valueIN) throws MediacomException
{
name=nameIN;
value=valueIN;
try
{
if ( bfw!=null&&name!=null&&value!=null )
{
bfw.write(name);
bfw.write(delim);
bfw.write(value);
bfw.write(newline);
bfw.flush();
}
}
catch ( final Exception e )
{
throw new MediacomException(e);
}
}
private void parseItem()
{
if ( line!=null&&line.indexOf(delim)>0 )
{
name=line.substring(0,line.indexOf(delim));
value=line.substring((line.indexOf(delim)+1),line.length());
if ( name==null )
{
name=Constants.EMPTY_STRING;
}
if ( value==null )
{
value=Constants.EMPTY_STRING;
}
}
}
public String getLine()
{
return this.line;
}
public void setLine(String line)
{
this.line=line;
}
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name=name;
}
public String getValue()
{
return this.value;
}
public void setValue(String value)
{
this.value=value;
}
public boolean isEof()
{
return this.eof;
}
}
|
package zm.gov.moh.core.repository.database;
import androidx.annotation.NonNull;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;
public class Migrations {
public static Migration MIGRATION_2_3 = new Migration(2,3) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE entity_metadata ADD COLUMN last_modified TEXT");
}
};
public static Migration MIGRATION_3_4 = new Migration(3,4) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
//Drop person_identifier table because had no data initially
database.execSQL("DROP TABLE person_identifier");
//Recreate person_identifier table with new schema
database.execSQL("CREATE TABLE `person_identifier` (`identifier` TEXT NOT NULL,`remote_id` INTEGER, `local_id` INTEGER, `remote_uuid` TEXT, PRIMARY KEY(`identifier`))");
//insert local person identifiers
database.execSQL("INSERT INTO person_identifier(identifier,local_id) SELECT patient_identifier.identifier,person.person_id AS local_id FROM person JOIN patient_identifier ON person.person_id = patient_identifier.patient_id WHERE person.uuid IS NULL AND identifier_type=3");
}
};
public static Migration MIGRATION_4_5 = new Migration(4, 5) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
try {
//Add a voided column to person table
database.execSQL("ALTER TABLE person ADD COLUMN voided INTEGER DEFAULT 0");
database.execSQL("CREATE TABLE `person_attribute_type_temp` (`person_attribute_type_id` INTEGER NOT NULL, `name` TEXT, `description` TEXT, `format` TEXT, `foreign_key` INTEGER, `searchable` INTEGER NOT NULL, `creator` INTEGER NOT NULL, `date_created` TEXT, `changed_by` INTEGER, `date_changed` TEXT, `retired` INTEGER NOT NULL, `retired_by` INTEGER, `date_retired` TEXT, `retire_reason` TEXT, `edit_privilege` TEXT, `sort_weight` REAL NOT NULL, `uuid` TEXT, PRIMARY KEY(`person_attribute_type_id`) )");
database.execSQL("INSERT INTO person_attribute_type_temp SELECT * FROM person_attribute_type");
database.execSQL("DROP TABLE `person_attribute_type`");
database.execSQL("CREATE TABLE `person_attribute_type` (`person_attribute_type_id` INTEGER NOT NULL, `name` TEXT, `description` TEXT, `format` TEXT, `foreign_key` INTEGER, `searchable` INTEGER NOT NULL, `creator` INTEGER NOT NULL, `date_created` TEXT, `changed_by` INTEGER, `date_changed` TEXT, `retired` INTEGER NOT NULL, `retired_by` INTEGER, `date_retired` TEXT, `retire_reason` TEXT, `edit_privilege` TEXT, `sort_weight` REAL NOT NULL, `uuid` TEXT, PRIMARY KEY(`person_attribute_type_id`) )");
database.execSQL("INSERT INTO person_attribute_type SELECT * FROM person_attribute_type_temp");
database.execSQL("DROP TABLE `person_attribute_type_temp`");
database.execSQL("CREATE TABLE `person_attribute_temp` (`person_attribute_id` INTEGER NOT NULL, `person_id` INTEGER NOT NULL, `value` TEXT, `person_attribute_type_id` INTEGER NOT NULL, `creator` INTEGER NOT NULL, `date_created` TEXT, `changed_by` INTEGER, `date_changed` TEXT, `voided` INTEGER NOT NULL, `voided_by` INTEGER, `date_voided` TEXT, `void_reason` TEXT, `uuid` TEXT, PRIMARY KEY(`person_attribute_id`))");
database.execSQL("INSERT INTO person_attribute_temp SELECT * FROM person_attribute");
database.execSQL("DROP TABLE `person_attribute`");
database.execSQL("CREATE TABLE `person_attribute` (`person_attribute_id` INTEGER NOT NULL, `person_id` INTEGER NOT NULL, `value` TEXT, `person_attribute_type_id` INTEGER NOT NULL, `creator` INTEGER NOT NULL, `date_created` TEXT, `changed_by` INTEGER, `date_changed` TEXT, `voided` INTEGER NOT NULL, `voided_by` INTEGER, `date_voided` TEXT, `void_reason` TEXT, `uuid` TEXT, PRIMARY KEY(`person_attribute_id`))");
database.execSQL("INSERT INTO person_attribute SELECT * FROM person_attribute_temp");
database.execSQL("DROP TABLE `person_attribute_temp`");
} catch (Exception e) {
e.printStackTrace();
}
}
};
} |
package Graph;
import java.util.ArrayList;
import java.util.HashMap;
public class Graph {
private class Vertex {
HashMap<String, Integer> nghbrs = new HashMap<>();
}
HashMap<String, Vertex> vertices = new HashMap<>();
public int numVetex() {
return vertices.size();
}
public boolean containsVertex(String vname) {
return vertices.containsKey(vname);
}
public void addVertex(String vname) {
Vertex vtx = new Vertex();
vertices.put(vname, vtx);
}
public void removeVertex(String vname) {
Vertex vtx = vertices.get(vname);
ArrayList<String> nbrnames = new ArrayList<>(vtx.nghbrs.keySet());
for (String nbrname : nbrnames) {
Vertex vtxnbr = vertices.get(nbrname);
vtxnbr.nghbrs.remove(vname);
}
vertices.remove(vname);
}
public int numEdges() {
ArrayList<String> vnames = new ArrayList<>(vertices.keySet());
int ans = 0;
for (String vname : vnames) {
Vertex vtx = vertices.get(vname);
ans += vtx.nghbrs.size();
}
return ans / 2;
}
public boolean containsEdge(String vname1, String vname2) {
Vertex vtx1 = vertices.get(vname1);
Vertex vtx2 = vertices.get(vname2);
if (vtx1 == null || vtx2 == null || !vtx1.nghbrs.containsKey(vname2)) {
return false;
}
return true;
}
public void addEdge(String vname1, String vname2, int cost) {
Vertex vtx1 = vertices.get(vname1);
Vertex vtx2 = vertices.get(vname2);
if (vtx1 == null || vtx2 == null || vtx1.nghbrs.containsKey(vname2)) {
return;
}
vtx1.nghbrs.put(vname2, cost);
// vtx2.nghbrs.put(vname1, cost);
}
public void removeEdge(String vname1, String vname2) {
Vertex vtx1 = vertices.get(vname1);
Vertex vtx2 = vertices.get(vname2);
if (vtx1 == null || vtx2 == null || !vtx1.nghbrs.containsKey(vname2)) {
return;
}
vtx1.nghbrs.remove(vname2);
vtx2.nghbrs.remove(vname1);
}
public void display() {
System.out.println("------------------");
ArrayList<String> vnames = new ArrayList<>(vertices.keySet());
for (String vname : vnames) {
String str = vname + " => ";
Vertex vtx = vertices.get(vname);
str += vtx.nghbrs;
System.out.println(str);
}
System.out.println("------------------");
}
// prims -> minimum spanning tree
private class PrimsPair implements Comparable<PrimsPair> {
String vname;
String acqVertexName;
Vertex vtx;
int cost;
@Override
public int compareTo(PrimsPair other) {
return other.cost - this.cost;
}
}
public Graph prims() {
// create a mst
Graph mst = new Graph();
HeapGeneric<PrimsPair> heap = new HeapGeneric<>();
HashMap<String, PrimsPair> map = new HashMap<>();
HashMap<String, Boolean> processed = new HashMap<>();
ArrayList<String> keys = new ArrayList<>(this.vertices.keySet());
// make pairs and put in heap
for (String key : keys) {
PrimsPair np = new PrimsPair();
np.vname = key;
np.vtx = vertices.get(key);
np.cost = Integer.MAX_VALUE;
np.acqVertexName = null;
heap.add(np);
processed.put(np.vname, true);
map.put(key, np);
}
// til the heap is not empty keep on doing work
while (!heap.isEmpty()) {
// remove a pair
PrimsPair rp = heap.remove();
processed.remove(rp.vname);
// if acq vertex is null, add a vertx only
if (rp.acqVertexName == null) {
mst.addVertex(rp.vname);
} else {
mst.addVertex(rp.vname);
mst.addEdge(rp.vname, rp.acqVertexName, rp.cost);
}
// get nbrs
ArrayList<String> nbrs = new ArrayList<>(rp.vtx.nghbrs.keySet());
// loop on nbrs
for (String nbr : nbrs) {
// process only the one which are in heap
if (processed.containsKey(nbr)) {
PrimsPair nbrPair = map.get(nbr);
// get the old cost
int oc = nbrPair.cost;
int nc = rp.vtx.nghbrs.get(nbr);
// if new cost is smaller than old cost then update the cost
if (nc < oc) {
nbrPair.cost = nc;
nbrPair.acqVertexName = rp.vname;
// update the priority in heap
heap.updatePriority(nbrPair);
}
}
}
}
return mst;
}
// dijkstra -> single source shortest path, but can't work with -ve weight
// edges
public class DijkstraPair implements Comparable<DijkstraPair> {
String vname;
String psf;
Vertex vtx;
int cost;
@Override
public int compareTo(DijkstraPair other) {
return other.cost - this.cost;
}
@Override
public String toString() {
return this.cost + " via " + this.psf + "\n";
}
}
public HashMap<String, DijkstraPair> Dijkstra(String src) {
HashMap<String, DijkstraPair> map = new HashMap<>();
HeapGeneric<DijkstraPair> heap = new HeapGeneric<>();
// processed will keep track of vertex which are present in heap
HashMap<String, Boolean> processed = new HashMap<>();
// get all the vertex names present in graph
ArrayList<String> keys = new ArrayList<>(this.vertices.keySet());
// make pairs and put in heap, with the cost of src vertex as 0
for (String key : keys) {
DijkstraPair np = new DijkstraPair();
np.vname = key;
np.vtx = vertices.get(key);
np.psf = "";
np.cost = Integer.MAX_VALUE;
// if present key is src, cost of src vertex will be 0
if (key.equals(src)) {
np.psf = key;
np.cost = 0;
}
heap.add(np);
map.put(key, np);
// update the processed, bcz processed was keeping track of nodes which are
// present in heap
processed.put(key, true);
}
// till the heap is not empty keep on removing pairs
while (!heap.isEmpty()) {
// remove the pair from heap
DijkstraPair rp = heap.remove();
// update the processed hashmap
processed.remove(rp.vname);
// loop on nbrs
ArrayList<String> nbrs = new ArrayList<>(rp.vtx.nghbrs.keySet());
for (String nbr : nbrs) {
// process only those nbrs which are present in heap
if (processed.containsKey(nbr)) {
DijkstraPair nbrPair = map.get(nbr);
int oc = nbrPair.cost;
int nc = rp.cost + rp.vtx.nghbrs.get(nbr);
// if new cost is less than old cost then update the cost
if (nc < oc) {
nbrPair.cost = nc;
nbrPair.psf = rp.psf + nbr;
// update the priority of the updated node in heap
heap.updatePriority(nbrPair);
}
}
}
}
return map;
}
// bellman ford -> single source shortest path, can work with -ve weight edges,
// but can't work with cycle having -ve weights
public ArrayList<EdgePair> getAllEdges() {
ArrayList<EdgePair> ans = new ArrayList<>();
ArrayList<String> keys = new ArrayList<>(vertices.keySet());
for (String key : keys) {
Vertex vtx = vertices.get(key);
ArrayList<String> nbrs = new ArrayList<>(vtx.nghbrs.keySet());
for (String nbr : nbrs) {
EdgePair ep = new EdgePair();
ep.vname1 = key;
ep.vname2 = nbr;
ep.cost = vtx.nghbrs.get(nbr);
ans.add(ep);
}
}
return ans;
}
private class EdgePair {
String vname1;
String vname2;
int cost;
}
public HashMap<String, Integer> BellmanFord(String src) throws Exception {
HashMap<String, Integer> map = new HashMap<>();
ArrayList<String> keys = new ArrayList<>(this.vertices.keySet());
// put the src vertex with 0 cost, and other vertex with infinity cost
for (String key : keys) {
map.put(key, Integer.MAX_VALUE);
// if key equals src then cost will be 0
if (key.equals(src)) {
map.put(key, 0);
}
}
// get all the edges
ArrayList<EdgePair> alledges = getAllEdges();
// V is total no. of vertex in graph
int V = vertices.size();
// relax V-1 times bcz at max two vertex can be at V-1 distance
for (int i = 1; i <= V - 1; i++) {
// all the edges are relaxed
// relax : if we have discovered an edge from u->v then compare
// if cost(v) > cost(u) + edgecost(u,v) then update the cost of v
// cost(v) = cost(u) + edgecost(u,v)
for (EdgePair edge : alledges) {
int oc = map.get(edge.vname2);
int nc = map.get(edge.vname1) + edge.cost;
// update the cost of v, if cost(u) + edgecost(u,v) is less than prev cost of v
if (nc < oc) {
map.put(edge.vname2, nc);
}
}
}
// if the weights are further reduced after relaxing Vth time then it means -ve
// weight cycle was present
for (EdgePair edge : alledges) {
int oc = map.get(edge.vname2);
int nc = map.get(edge.vname1) + edge.cost;
System.out.println(map.get(edge.vname1) + " " + nc);
// if wt is further reduced then give an exception to user
if (nc < oc) {
throw new Exception("-ve weight cycle");
}
}
return map;
}
}
|
package com.cnk.travelogix.sapintegrations.processor.impl;
import javax.xml.bind.JAXBElement;
import com.cnk.travelogix.custom.zif.erp.ws.opportunity.ObjectFactory;
import com.cnk.travelogix.custom.zif.erp.ws.opportunity.ZifTerpOpportunity;
import com.cnk.travelogix.custom.zif.erp.ws.opportunity.ZifTerpOpportunityResponse;
import com.cnk.travelogix.custom.zif.erp.ws.opportunity.ZifstStatusOpp;
import com.cnk.travelogix.custom.zif.erp.ws.opportunity.ZttStatusOpp;
import com.cnk.travelogix.sapintegrations.message.RequestMessage;
import com.cnk.travelogix.sapintegrations.processor.OpportunityRequestProcessor;
public class DefaultOpportunityRequestProcessor extends AbstractRequestProcessor<ZifTerpOpportunity, ZifTerpOpportunityResponse>
implements OpportunityRequestProcessor
{
public ObjectFactory getObjectFactory()
{
return (ObjectFactory) getDtoObjectFactory();
}
@Override
protected RequestMessage translateRequest(final ZifTerpOpportunity request)
{
final RequestMessage requestMessage = new RequestMessage<ZifTerpOpportunity>();
requestMessage.setRequestObject(getObjectFactory().createZifTerpOpportunity(request));
requestMessage.setServiceInterface(OpportunityRequestProcessor.class);
requestMessage.setSoapAction(getSoapAction());
return requestMessage;
}
@Override
protected JAXBElement<ZifTerpOpportunityResponse> createErrorResponse()
{
final ZifTerpOpportunityResponse zifTerpOpportunityResponse = new ZifTerpOpportunityResponse();
final ZttStatusOpp zttStatusOpp = new ZttStatusOpp();
final ZifstStatusOpp zifstStatusOpp = new ZifstStatusOpp();
zifstStatusOpp.setStatus(getConfigurationService().getConfiguration().getString(getConnectionErrorStatus()));
zifstStatusOpp.setMessage(getConfigurationService().getConfiguration().getString(getConnectionErrorMessage()));
zttStatusOpp.getItem().add(zifstStatusOpp);
zifTerpOpportunityResponse.setStatus(zttStatusOpp);
return getObjectFactory().createZifTerpOpportunityResponse(zifTerpOpportunityResponse);
}
}
|
package webmail.managers.emailManagers;
import sun.misc.BASE64Decoder;
import webmail.entities.User;
import webmail.managers.Manager;
import webmail.managers.otherManagers.SQLManager;
import javax.mail.MessagingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
/**
* Created by JOKER on 11/28/14.
*/
public class CheckEmailManager extends Manager {
public CheckEmailManager(HttpServletRequest request, HttpServletResponse response) {
super(request, response);
}
@Override
public void run() {
try{
HttpSession session = request.getSession();
User su = (User)session.getAttribute("user");
String username = su.getUsername();
String account = (String)session.getAttribute("account");
String pwd = SQLManager.getEmailAccountPwdSQL(username,account);
pwd = new String(new BASE64Decoder().decodeBuffer(pwd));
POPDemo pop = new POPDemo(account,pwd);
pop.run();
response.sendRedirect("/inbox");
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
package com.example.eafor.clientserverapp.draw_view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import com.example.eafor.clientserverapp.MainActivity;
import com.example.eafor.clientserverapp.R;
public class DrawView extends View {
private Paint mPaintSquare;
Paint localPaint;
int[][] array = new int[MainActivity.FIELD_SIZE][MainActivity.FIELD_SIZE];
public final int COLOR_BLUE = getResources().getColor(R.color.colorBlue);
public final int COLOR_YELLOW = getResources().getColor(R.color.colorYellow);
public final int COLOR_RED = getResources().getColor(R.color.colorRed);
public final int COLOR_GREEN = getResources().getColor(R.color.colorGreen);
public final int COLOR_BROWN = getResources().getColor(R.color.colorBrown);
public final int COLOR_CYAN = getResources().getColor(R.color.colorCyan);
public final int COLOR_GRAY = getResources().getColor(R.color.colorGray);
public final int COLOR_ORANGE = getResources().getColor(R.color.colorOrange);
public final int COLOR_DARKPINK = getResources().getColor(R.color.colorWhite);
public final int COLOR_VINOUS = getResources().getColor(R.color.colorVinous);
public int rest = 0;
public DrawView(Context context) {
super(context);
init(null);
}
public DrawView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(attrs);
}
public DrawView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(attrs);
}
public DrawView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(attrs);
}
private void init(@Nullable AttributeSet set) {
mPaintSquare = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaintSquare.setColor(Color.GREEN);
localPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
localPaint.setColor(getResources().getColor(R.color.backgroundColor2));
}
public void swapColor(int color) {
mPaintSquare.setColor(color);
postInvalidate();
}
@Override
public void onDraw(Canvas canvas) {
int widthHeight = canvas.getWidth();
// Нахожу остаток чтобы убрать пробелы на всех устройствах
rest = widthHeight % MainActivity.FIELD_SIZE;
rest=rest/2;
int squareSize = widthHeight / MainActivity.FIELD_SIZE;
canvas.drawColor(getResources().getColor(R.color.backgroundColor));
/*Проходит по массиву, и проверяет, заполнен ли он цветом или нет, если заполнен-закрашивает
данный квадрат. */
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array.length; j++) {
if (checkArrayItemColor(i, j)) {
performPaint(canvas, i, j, squareSize);
}
}
}
makeDividers(canvas, widthHeight, squareSize);
}
private void makeDividers(Canvas canvas, int widthHeight, int squareSize) {
//old version
// //Горизонтальные разделители
// for (int i = 0; i < widthHeight; i += squareSize) {
// canvas.drawRect(new Rect(0, i, widthHeight, i + 1), localPaint);
// }
// //Вертикальные разделители
// for (int i = 0; i < widthHeight; i += squareSize) {
// canvas.drawRect(new Rect(i, 0, i + 1, widthHeight), localPaint);
// }
//Горизонтальные разделители
for (int i = 0+rest; i < widthHeight; i += squareSize) {
canvas.drawRect(new Rect(0+rest, i, widthHeight-rest, i + 1), localPaint);
}
//Вертикальные разделители
for (int i = 0+rest; i < widthHeight; i += squareSize) {
canvas.drawRect(new Rect(i, 0+rest, i + 1, widthHeight-rest), localPaint);
}
}
public void performPaintOld(Canvas canvas, int i, int j, int squareSize) {
int X_TOP = j * squareSize;
int Y_TOP = i * squareSize;
int X_BOT = j * squareSize + squareSize;
int Y_BOT = i * squareSize + squareSize;
canvas.drawRect(new Rect(X_TOP, Y_TOP, X_BOT, Y_BOT), mPaintSquare);
}
public void performPaint(Canvas canvas, int i, int j, int squareSize) {
int X_TOP = j * squareSize+rest;
int Y_TOP = i * squareSize+rest;
int X_BOT = j * squareSize + squareSize+rest;
int Y_BOT = i * squareSize + squareSize+rest;
canvas.drawRect(new Rect(X_TOP, Y_TOP, X_BOT, Y_BOT), mPaintSquare);
}
public boolean checkArrayItemColor(int first, int second) {
if (array[first][second] == COLOR_BLUE) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_YELLOW) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_RED) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_GREEN) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_BROWN) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_CYAN) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_GRAY) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_ORANGE) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_DARKPINK) {
mPaintSquare.setColor(array[first][second]);
return true;
} else if (array[first][second] == COLOR_VINOUS) {
mPaintSquare.setColor(array[first][second]);
return true;
} else {
return false;
}
}
public void fill(int i, int j, int color) {
array[i][j] = color;
postInvalidate();
}
} |
package com.micro.rest.endpoint.account;
import com.micro.db.DbOperation;
import com.micro.pojo.Message;
import lombok.extern.slf4j.Slf4j;
import org.jooq.Record;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.json.Json;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.sql.Connection;
import static com.micro.pojo.ResponseMessage.NO_RECORD;
import static org.jooq.h2.generated.tables.Accounts.ACCOUNTS;
@RequestScoped
@Path("/accounts")
@Slf4j
public class GetAccountResource {
@Inject
private DbOperation dbOperation;
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{accountId}")
public Response getAccount(@PathParam("accountId") long accountId) {
Record record = dbOperation.executeAndReturn(
context -> context.select()
.from(ACCOUNTS)
.where(ACCOUNTS.ID.equal(accountId))
.fetchAny()
);
log.info("record " + record);
if (record == null) {
return Response.status(Response.Status.NOT_FOUND)
.header("cause", NO_RECORD)
.entity(new Message(NO_RECORD, null))
.build();
}
return Response.ok(
Json.createObjectBuilder()
.add(ACCOUNTS.ID.getName(), record.getValue(ACCOUNTS.ID))
.add(ACCOUNTS.NAME.getName(), record.getValue(ACCOUNTS.NAME))
.add(ACCOUNTS.BALANCE.getName(), record.getValue(ACCOUNTS.BALANCE))
.build()
).build();
}
}
|
package com.goldgov.dygl.module.portal.webservice.examrecord.dao;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.goldgov.dygl.module.portal.webservice.examrecord.domain.ExamPercentageBean;
import com.goldgov.dygl.module.portal.webservice.examrecord.domain.Examrecord;
import com.goldgov.dygl.module.portal.webservice.examrecord.service.ExamrecordQuery;
import com.goldgov.gtiles.core.dao.mybatis.annotation.MybatisRepository;
@MybatisRepository("examrecordDao")
public interface IExamrecordDao {
public void addInfo(Examrecord examrecord);
public void updateInfo(Examrecord examrecord);
public void deleteInfo(@Param("ids") String[] entityIDs);
public Examrecord findInfoById(@Param("id") String entityID);
public List<Examrecord> findInfoListByPage(@Param("query") ExamrecordQuery query);
public Date findMaxTimeInfo();
public List<ExamPercentageBean> findPercentageList(@Param("query") ExamrecordQuery query);
}
|
package agha.digitalconverter;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
/**
* Created by User-Sai on 9/4/2017.
*/
public class Exponent extends Fragment {
EditText dec, sign, exp, fraction;
TextView delete;
public Exponent() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_exp, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
dec = (EditText) getView().findViewById(R.id.et_exp_dec);
sign = (EditText) getView().findViewById(R.id.et_exp_sign);
exp = (EditText) getView().findViewById(R.id.et_exp_exp);
fraction = (EditText) getView().findViewById(R.id.et_exp_bin);
delete = (TextView) getView().findViewById(R.id.exp_clear);
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dec.setText("");
sign.setText("");
exp.setText("");
fraction.setText("");
}
});
dec.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void afterTextChanged(Editable editable) {
if (dec.isFocused()) {
String Decimal = dec.getText().toString();
if (!hasPoint(Decimal)) Decimal = Decimal + ".0";
if (hasPoint(Decimal) && !Decimal.equalsIgnoreCase(".")) {
if (Double.parseDouble(Decimal) < 0) {
dec.setBackground(getResources().getDrawable(R.drawable.main_textview));
sign.setText(expDecToFractionSign(Double.parseDouble(Decimal)));
exp.setText(expDecToFractionExp(Double.parseDouble(Decimal)*-1));
fraction.setText(expDecToFractionSignificand(Double.parseDouble(Decimal)*-1));
} else {
dec.setBackground(getResources().getDrawable(R.drawable.main_textview));
sign.setText(expDecToFractionSign(Double.parseDouble(Decimal)));
exp.setText(expDecToFractionExp(Double.parseDouble(Decimal)));
fraction.setText(expDecToFractionSignificand(Double.parseDouble(Decimal)));
}
} else if (Decimal.equalsIgnoreCase(".") || Decimal.equalsIgnoreCase("-")) {
sign.setText("");
exp.setText("");
fraction.setText("");
} else {
if (!Decimal.isEmpty()) {
if (Long.parseLong(Decimal) > Long.parseLong("2147483647") || Long.parseLong(Decimal) < Long.parseLong("-2147483647")) {
changeDrawableDec();
dec.setError("Supports only 32-bit");
} else {
dec.setBackground(getResources().getDrawable(R.drawable.main_textview));
Log.e("DEC","HERE");
sign.setText(expDecToFractionSign(Double.parseDouble(Decimal)));
Log.e("s","HERE");
exp.setText(expDecToFractionExp(Long.parseLong(Decimal)));
Log.e("exp","HERE");
fraction.setText(expDecToFractionSignificand(Long.parseLong(Decimal)));
Log.e("frac","HERE");
Log.e("0","---------------------------");
}
} else {
dec.setBackground(getResources().getDrawable(R.drawable.main_textview));
sign.setText("");
exp.setText("");
fraction.setText("");
}
}
}
}
});
sign.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void afterTextChanged(Editable editable) {
if (sign.isFocused()) {
String Sign = sign.getText().toString();
if (!isIntBin(Sign)) {
changeDrawableSign();
sign.setError("Accepts only 0 or 1");
} else if (isIntBin(Sign) || Sign.isEmpty()) {
sign.setBackground(getResources().getDrawable(R.drawable.main_textview));
dec.setText("");
//fraction.setText("");
//exp.setText("");
}
if (!fraction.getText().toString().isEmpty() && !exp.getText().toString().isEmpty() &&
isIntBin(fraction.getText().toString()) && isIntBin(exp.getText().toString())) {
dec.setText(expFractionToDec(Sign, exp.getText().toString(), fraction.getText().toString()));
}
}
}
});
exp.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void afterTextChanged(Editable editable) {
if (exp.isFocused()) {
String Exp = exp.getText().toString();
if (!isIntBin(Exp)) {
changeDrawableExp();
exp.setError("Accepts only 0 or 1");
} else if (isIntBin(Exp) || Exp.isEmpty()) {
exp.setBackground(getResources().getDrawable(R.drawable.main_textview));
dec.setText("");
//fraction.setText("");
//sign.setText("");
}
if (!fraction.getText().toString().isEmpty() && !sign.getText().toString().isEmpty() &&
isIntBin(fraction.getText().toString()) && isIntBin(sign.getText().toString())) {
dec.setText(expFractionToDec(sign.getText().toString(), Exp, fraction.getText().toString()));
}
}
}
});
fraction.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
return;
}
@Override
public void afterTextChanged(Editable editable) {
if (fraction.isFocused()) {
String Fraction = fraction.getText().toString();
if (!isIntBin(Fraction)) {
changeDrawableFraction();
fraction.setError("Accepts only 0 or 1");
} else if (isIntBin(Fraction) || Fraction.isEmpty()) {
fraction.setBackground(getResources().getDrawable(R.drawable.main_textview));
dec.setText("");
//exp.setText("");
//sign.setText("");
}
if (!exp.getText().toString().isEmpty() && !sign.getText().toString().isEmpty() &&
isIntBin(exp.getText().toString()) && isIntBin(sign.getText().toString())) {
dec.setText(expFractionToDec(sign.getText().toString(), exp.getText().toString(), Fraction));
}
}
}
});
}
public boolean isIntBin(String bin) {
for (int i = 0; i < bin.length(); i++)
if (bin.charAt(i) != '0' && bin.charAt(i) != '1') return false;
return true;
}
public boolean hasPoint(String str) {
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == '.') return true;
}
return false;
}
private void changeDrawableDec() {
dec.setBackground(getResources().getDrawable(R.drawable.error_main_textview));
sign.setText("Error");
exp.setText("E");
fraction.setText("");
}
private void changeDrawableSign() {
sign.setBackground(getResources().getDrawable(R.drawable.error_main_textview));
dec.setText("Error");
exp.setText("E");
fraction.setText("");
}
private void changeDrawableExp() {
exp.setBackground(getResources().getDrawable(R.drawable.error_main_textview));
dec.setText("Error");
sign.setText("E");
fraction.setText("");
}
private void changeDrawableFraction() {
fraction.setBackground(getResources().getDrawable(R.drawable.error_main_textview));
dec.setText("Error");
exp.setText("Error");
sign.setText("Error");
}
// ** Exp. ** //
public String expFractionToDec(String sign, String exp, String fraction) {
if (exp.length() < 8) {
int zeros = 8 - exp.length();
for (int i = 0; i < zeros; i++) {
exp = exp + "0";
}
}
if (fraction.length() < 23) {
int zeros = 23 - exp.length();
for (int i = 0; i < zeros; i++) {
fraction = fraction + "0";
}
}
// zero
if (USBinToDec(exp) == 0 && USBinToDec(fraction) == 0) {
return "0";
}
// infinity
if (USBinToDec(exp) == 255 && USBinToDec(fraction) == 0) {
return "INFINITY";
}
// NaN
if (USBinToDec(exp) == 255 && USBinToDec(fraction) != 0) {
return "NaN";
}
// Denormalized
if (USBinToDec(exp) == 0 && USBinToDec(fraction) != 0) {
double significand = 0 + calcFraction(fraction);
double value = significand * Math.pow(2, -126);
if (sign.equals("1")) {
//return (value * -1 + "").substring(0, 8);
return (value * -1 + "");
} else {
//return (value + "").substring(0, 8);
return (value + "");
}
} else {
int E = (int) USBinToDec(exp) - 127;
double significand = 1 + calcFraction(fraction);
double value = significand * Math.pow(2, E);
if (sign.equals("1")) {
//return (value * -1 + "").substring(0, 8);
return (value * -1 + "");
} else {
//return (value + "").substring(0, 8);
return (value + "");
}
}
}
// From Binary To Dec
public long USBinToDec(String bin) {
return Long.parseLong(bin, 2);
}
public String expDecToFractionSign(double dec) {
if (dec < 0) {
return "1";
} else {
return "0";
}
}
public String expDecToFractionExp(double dec) {
String bin = fractionDecToBin((long)dec);
if (hasPoint(bin)) bin = bin.substring(bin.indexOf(".") + 1);
if (dec == 0) {
return "00000000";
}
int power = -1;
if (dec < 1) {
for (int i = 0; i < bin.length(); i++) {
if (bin.charAt(i) == '1') {
break;
} else {
power--;
}
}
} else {
String len = fractionDecToBin(dec);
power = len.substring(0, len.indexOf(".")).length() - 1;
}
String result = USDecToBin(127 + power);
if (result.length() < 8) {
int rem = 8 - result.length();
for (int i = 0; i < rem; i++) {
result = "0" + result;
}
}
return result ;
}
public String expDecToFractionSignificand(double dec) {
String bin = fractionDecToBin(dec);
if (dec < 1) {
if (hasPoint(bin)) bin = bin.substring(bin.indexOf(".") + 1);
for (int i = 0; i < bin.length(); i++) {
if (bin.charAt(i) == '1') {
bin = bin.substring(i + 1);
break;
}
}
} else {
bin = bin.replace(".", "");
bin = bin.substring(1);
}
if (bin.length() < 23) {
int rem = 23 - bin.length();
for (int i = 0; i < rem; i++) {
bin = bin + "0";
}
}
return bin;
}
public String fractionDecToBin(double dec) {
String decStr = String.format("%.14f",dec);;
String number = Long.toBinaryString((long) dec);
String fractionStr = "0" + decStr.substring(decStr.indexOf("."));
double fraction = Double.parseDouble(fractionStr);
String resFra = "";
String res = "";
while (fraction != 0) {
fraction = fraction * 2;
res += String.valueOf(fraction).substring(0, 1);
resFra += res;
if (res.equals("1")) {
fraction -= 1;
}
res = "";
}
return number + "." + resFra;
}
// From Decimal To Bin
public String USDecToBin(long dec) {
return Long.toBinaryString(dec);
}
public double calcFraction(String fractionStr) {
double fraction = 0;
int power = -1;
for (int i = 0; i < fractionStr.length(); i++) {
if (fractionStr.charAt(i) == '1') {
fraction += Math.pow(2, power);
}
power--;
}
return fraction;
}
}
|
package org.ecsoya.yamail;
import java.util.List;
import javax.annotation.PreDestroy;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.IWindowCloseHandler;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MenuDetectEvent;
import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tray;
import org.eclipse.swt.widgets.TrayItem;
import org.ecsoya.yamail.preferences.YamailPreferences;
import org.ecsoya.yamail.ui.resources.ImageFactory;
import org.osgi.service.event.Event;
@SuppressWarnings("restriction")
public class YamailLifeCycle {
private TrayItem trayItem;
private MApplication application;
private MWindow window;
private Display display;
@PostContextCreate
public void postContextCreate(IEclipseContext eclipseContext,
final IEventBroker eventBroker, IApplicationContext context,
Display display) {
this.display = display;
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE,
new org.osgi.service.event.EventHandler() {
@Override
public void handleEvent(Event event) {
application = (MApplication) event
.getProperty("org.eclipse.e4.data");
List<MWindow> children = application.getChildren();
EModelService service = eclipseContext
.get(EModelService.class);
window = service.getTopLevelWindowFor(children.get(0));
IEclipseContext winCtx = window.getContext();
winCtx.set(IWindowCloseHandler.class,
new IWindowCloseHandler() {
@Override
public boolean close(MWindow window) {
String option = YamailPreferences
.getPreferences()
.get(YamailPreferences.YAMAIL_GLOBALE_CLOSE_OPTION,
MessageDialogWithToggle.PROMPT);
Boolean close = null;
if (MessageDialogWithToggle.PROMPT
.equals(option)) {
MessageDialogWithToggle dlg = MessageDialogWithToggle
.openYesNoCancelQuestion(
getShell(),
"Close Yamail Window",
"Are you want to quit Yamail? Press 'No' just to hide it.",
"Never ask me again",
false,
YamailCore
.getPreferenceStore(),
YamailPreferences.YAMAIL_GLOBALE_CLOSE_OPTION);
int returnCode = dlg
.getReturnCode();
switch (returnCode) {
case IDialogConstants.YES_ID:
case IDialogConstants.YES_TO_ALL_ID:
case IDialogConstants.PROCEED_ID:
case IDialogConstants.OK_ID:
close = Boolean.TRUE;
break;
case IDialogConstants.NO_ID:
case IDialogConstants.NO_TO_ALL_ID:
close = Boolean.FALSE;
break;
}
}
if (MessageDialogWithToggle.ALWAYS
.equals(option)) {
close = Boolean.TRUE;
} else if (MessageDialogWithToggle.NEVER
.equals(option)) {
close = Boolean.FALSE;
}
if (Boolean.TRUE.equals(close)) {
((Shell) window.getWidget())
.dispose();
return true;
} else if (Boolean.FALSE.equals(close)) {
window.setVisible(false);
return false;
} else {
// Do nothing, Canceled.
return false;
}
}
});
}
});
Tray systemTray = display.getSystemTray();
if (systemTray != null) {
trayItem = new TrayItem(systemTray, SWT.NONE);
trayItem.setImage(ImageFactory.getImage("icons/yamail.png"));
trayItem.setToolTipText("Yamail");
trayItem.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(org.eclipse.swt.widgets.Event event) {
if (window != null) {
Object widget = window.getWidget();
if (!window.isVisible()) {
window.setVisible(true);
if (widget instanceof Shell) {
Shell shell = (Shell) widget;
shell.setVisible(true);
}
}
if (!window.isOnTop()) {
window.setOnTop(true);
if (widget instanceof Shell) {
Shell shell = (Shell) widget;
shell.moveAbove(null);
}
} else {
window.setOnTop(false);
if (widget instanceof Shell) {
Shell shell = (Shell) widget;
shell.moveBelow(null);
}
}
}
}
});
trayItem.addMenuDetectListener(new MenuDetectListener() {
@Override
public void menuDetected(MenuDetectEvent e) {
Shell shell = getShell();
Menu menu = new Menu(shell, SWT.POP_UP);
// creates a new menu item that terminates the program
MenuItem exit = new MenuItem(menu, SWT.NONE);
exit.setText("Quit");
exit.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (window != null) {
window.setVisible(false);
Object widget = window.getWidget();
if (widget instanceof Shell) {
((Shell) widget).dispose();
}
}
}
});
// make the menu visible
menu.setVisible(true);
}
});
}
}
private Shell getShell() {
Shell shell = display.getActiveShell();
if (window != null) {
shell = (Shell) window.getWidget();
}
return shell;
}
@PreDestroy
public void dispose() {
if (trayItem != null) {
trayItem.dispose();
}
}
}
|
package LeetCode;
/**
* Created by joetomjob on 2/26/18.
*/
public class AddTwoNosII {
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
l1 = this.reverseLinkedLst(l1);
l2 = this.reverseLinkedLst(l2);
ListNode res = new ListNode(0);
int carry = 0;
ListNode x = l1, y=l2, curr = res;
while(x!=null || y!=null){
int a = x!=null?x.val:0;
int b = y!=null?y.val:0;
int t = a+b+carry;
carry = t/10;
t = t%10;
curr.next = new ListNode(t);
curr = curr.next;
if(x!=null) x = x.next;
if(y!=null) y = y.next;
}
if(carry !=0){
curr.next = new ListNode(carry);
}
res = this.reverseLinkedLst(res.next);
return res;
}
public ListNode reverseLinkedLst(ListNode head){
ListNode curr = head;
ListNode prev = null;
while(curr!=null){
ListNode temp = curr.next;
curr.next = prev;
prev = curr;
curr = temp;
}
return prev;
}
public static void main(String[] args) {
AddTwoNosII a = new AddTwoNosII();
ListNode l1 = new ListNode(7);
l1.next = new ListNode(2);
l1.next.next = new ListNode(4);
l1.next.next.next = new ListNode(3);
ListNode l2 = new ListNode(5);
l2.next = new ListNode(6);
l2.next.next = new ListNode(4);
ListNode k = a.addTwoNumbers(l1,l2);
System.out.println(k);
}
}
|
package algorithm.APSS.dp;
/*
* 알고리즘 문제해결 전략 - 218p - 와일드카드 (완전탐색 + DP ver)
* - 교재참고! -
* [간단한 해법]
- 문자열을 잘라가며 그것을 파라미터로 재귀를 진행한다. '*'를 기준으로 패턴을 나누는 것이 핵심!
- 문자의 길이가 최대 100이므로 w,s는 각각 최대 101개 밖에 없다. 따라서 최대 경우는 101x101번의 호출이다. 여기서 발생할 수 있는 부분문제를 메모이제이션한다.
* [어떤 방식으로 접근했나?]
제한해둔 시간 (1시간30분)을 초과해서 교재를 참고했다
* [해법을 찾는 데 결정적인 깨달음]
- '*'을 기준으로 패턴을 나누는 것 자체를 생각하지 못했었다. 또, 재귀호출의 응용방법이 배웠던 부분에서만 생각이 가능했는데 이런식으로도 가능하다는 것을 깨달았다.
* [다른 해결 방법이 있다면?]
DP를 이용하면 더욱 효율적인 프로그램이 완성된다
*/
import java.util.*;
import java.io.*;
public class _218p_WildCard {
static String W, S;
static int strlen;
static String[] strs;
static List<String> answer;
static int[][] cache = new int[101][101];
static int findMatch(int w, int s) {
/*
* '*'이후에 몇개의 문자가 등장할 지 알 수 없으므로 '*'을 기준으로 진행한다. '*'을 발견하면 발견 전의 문자열을 잘라내어 나머지
* 문자열을 가지고 재귀를 진행한다.
*/
// 메모이제이션
if (cache[w][s] != -1)
return cache[w][s];
while (w < W.length() && s < S.length() && (W.charAt(w) == '?' || W.charAt(w) == S.charAt(s))) {
w++;
s++;
}
// 와일드카드의 문자(w) 끝에 도달했을때, 주어진 문자열(s)의 끝에도 도달한 것이라면 문자가 일치하는 것이므로 true
// 아니라면, w와 문자 수가 다른것이므로 false
if (w == W.length())
return s == S.length() ? 1 : 0;
// '*'를 만나서 반복문이 종료된 경우 : '*'에 몇 글자를 대응해야 할 지를 '재귀호출'을 통해 확인한다
if (W.charAt(w) == '*') {
for (int skip = 0; s + skip <= S.length(); skip++) {
if (findMatch(w + 1, s + skip) == 1) {
return cache[w][s] = 1;
}
}
}
return cache[w][s] = 0;
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(br.readLine());
for (int t = 0; t < tc; t++) {
W = br.readLine();
strlen = Integer.parseInt(br.readLine());
strs = new String[strlen];
for (int i = 0; i < strlen; i++) {
strs[i] = br.readLine();
}
// 매치되는 파일명 찾기
answer = new ArrayList<>();
for (int i = 0; i < strlen; i++) {
for (int[] row : cache) {
Arrays.fill(row, -1);
}
S = strs[i];
if (findMatch(0, 0) == 1)
answer.add(strs[i]);
}
Collections.sort(answer);
for (int i = 0; i < answer.size(); i++) {
System.out.println(answer.get(i));
}
}
}
}
|
package com.goldgov.dygl.module.partymember.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.goldgov.dygl.dynamicfield.DynamicField;
import com.goldgov.dygl.module.partymember.service.AssessmentScoreBean;
import com.goldgov.dygl.module.partymember.service.InfoAuditShowBean;
import com.goldgov.dygl.module.partymember.service.InfoOperateLog;
import com.goldgov.dygl.module.partymember.service.MemberInfoAudit;
import com.goldgov.dygl.module.partymember.service.PartyMemberQuery;
import com.goldgov.dygl.module.partymember.service.SynOperateLog;
import com.goldgov.dygl.module.partymember.service.UserBaseInfo;
import com.goldgov.dygl.module.partyorganization.partybranch.service.MeetingMemberBean;
import com.goldgov.gtiles.core.dao.mybatis.annotation.MybatisRepository;
import com.goldgov.gtiles.module.user.service.User;
@MybatisRepository("partyMemberDao_AA")
public interface IPartyMemberDao_AA {
public void addInfo(@Param("fields") DynamicField fields);
public void updateInfo(@Param("entityID") String entityID,@Param("fields") DynamicField fields);
public void deleteInfo(@Param("ids") String[] entityIDs);
public Map<String,Object> findInfoById(@Param("id") String entityID,@Param("fields") DynamicField fields);
public List<Map<String,Object>> findInfoListByPage(@Param("query") PartyMemberQuery aaQuery,@Param("fields") DynamicField fields);
public List<Map<String,Object>> findInfoAndPostListByPage(@Param("query") PartyMemberQuery aaQuery,@Param("fields") DynamicField fields);
public List<Map<String,Object>> findInfoAndPostList(@Param("query") PartyMemberQuery aaQuery,@Param("fields") DynamicField fields);
public void addInfoFromUser(@Param("userId")String userId,@Param("partyOrganizationID") String partyOrganizationID);
boolean hasMemberUser(@Param("userId")String userId);
public List<String> findUserOrgID(@Param("userId")String userId);
public List<String> findUserGroupID(@Param("userId")String userId);
List<Map<String,Object>> findInfoByUserIdsByPage(@Param("query")PartyMemberQuery query);
public List<Map<String, Object>> findInfoByUserId(@Param("userId")String entityID) throws Exception;
public Map<String, Object> findInfoByParams(@Param("tableName")String tableName,
@Param("markName")String markName, @Param("entityID")String entityID,@Param("pkName")String pkName, @Param("fields")DynamicField dynamicField) throws Exception;
public List<InfoAuditShowBean> findAuditListByPage(
@Param("query") PartyMemberQuery partyMemberQuery,
@Param("params") Map<String, List<String>> auditParam);
public void saveMemberInfoAudit(MemberInfoAudit memberInfoAudit) throws Exception;
public MemberInfoAudit getAuditByAAId(@Param("aaId")String aaId) throws Exception;
public void updateMemberInfoAudit(MemberInfoAudit memberInfoAudit) throws Exception;
public List<Map<String, Object>> getNotPassedListByPage(
@Param("query")PartyMemberQuery partyMemberQuery,@Param("fields") DynamicField dynamicField) throws Exception;
public List<MemberInfoAudit> getAuditListByOrgId(
@Param("orgId")String partyOrganizationID, @Param("auditState")Integer auditState) throws Exception;
public List<InfoAuditShowBean> findBeforeAuditListByPage(
@Param("query")PartyMemberQuery partyMemberQuery) throws Exception;
public String findUserIDByAaID(@Param("aaid")String aaid);
public String getOrgType(@Param("orgId")String partyOrganizationID);
public String getInnerDuty(@Param("aaid")String aaId);
public List<String> getOrgTypeList(@Param("aaid")String aaId, @Param("orgIds")String[] orgIds);
public List<String> getACDutyList(@Param("aaid")String aaId, @Param("orgIds")String[] orgIds);
public String[] getAaID(@Param("partyOrgId")String partyOrgId,@Param("userId")String userId);
public String getAAIDByLoginId(@Param("loginId")String loginId);
public List<UserBaseInfo> getUserInfo(@Param("aaid")String aaid);
public MeetingMemberBean fingMeetingMemberByParam(@Param("tableName")String tableName,
@Param("entityID")String entityID, @Param("pkName")String pkName);
public String getHasRole(@Param("loginId")String entityID, @Param("roleCode")String roleCode,@Param("partyOrgID")String partyOrgID);
public void updateInfoFromUser(@Param("userId")String userId, @Param("partyOrganizationID")String partyOrganizationID);
public boolean hasABInfo(@Param("userId")String userId);
public List<User> getInfoByAAID(@Param("aaIds")String[] entityIDs);
public List<UserBaseInfo> getUserInfos(@Param("aaIds")String[] aaIds);
public void saveOperateLog(@Param("deleteLog")InfoOperateLog deleteLog);
public void saveSynLog(@Param("synLog")SynOperateLog log);
public List<String> getAAIDByLoginIds(@Param("userIds")String[] userIds);
public List<String> getPmAaIdListByOrgIds(@Param("orgIds")String[] orgIds);
public void updateInfoUser(@Param("userId")String userId, @Param("partyOrganizationID")String partyOrganizationID);
public void updateGroupID(@Param("userIds")String[] userIds, @Param("groupID")String partyOrganizationID);
String getOrgIdByAAId(String aaId);
void updateMemberPartyOrgInfo(@Param("partyOrgId") String partyOrgId,@Param("partyMemberId") String partyMemberId);
void updateOrderNum(@Param("orderNum") Integer orderNum,@Param("partyMemberId") String partyMemberId);
public List<AssessmentScoreBean> findBeforeAssessmentListByPage(
@Param("query")PartyMemberQuery partyMemberQuery, @Param("ratedId")String ratedId) throws Exception;
public List<String> findUserIDByPoAaID(@Param("poaaid")String poaaid);
public String getOrgIdByloginId(@Param("loginID")String loginID);
public String getUserNameByAaid(@Param("aaId")String aaId,@Param("loginId")String loginId);
}
|
package com.damithnera.quartzscheduler.myscheduler;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.Date;
public class MyObject implements Job {
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
System.out.println("My schduler is running !!");
System.out.println("Time is :" + new Date());
}
}
|
package marathon;
import java.util.ArrayList;
import java.util.Scanner;
/**
* @author kangkang lou
*/
public class Main_2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
ArrayList<Integer> list = new ArrayList<>();
while (in.hasNext()) {
list.add(in.nextInt());
}
for (Integer i : list) {
System.out.println(count(i));
}
}
private static int count(int n) {
int index = 0;
for (int i = 1; i <= n / 2; i++) {
if (isPrime(i) && isPrime(n - i)) {
index++;
}
}
return index;
}
private static boolean isPrime(int n) {
if (n == 1) {
return false;
} else if (n == 2) {
return true;
} else if (n % 2 == 0) {
return false;
} else {
for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
if (n % i == 0) {
return false;
}
}
return true;
}
}
}
|
package com.ilearn.dao;
import com.ilearn.bean.CategoryEntity;
import com.ilearn.bean.ResourcesEntity;
import com.ilearn.page.Page;
import com.ilearn.page.PageHandler;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import javax.print.DocFlavor;
import java.util.ArrayList;
import java.util.List;
/**
* Created by sl on 16-4-2.
*/
@Repository("resourcesDao")
public class ResourcesDao extends BaseDao {
@Autowired
@Qualifier("categoryDao")
private CategoryDao categoryDao;
@Autowired
private PageHandler pageHandler;
public ResourcesEntity getById(int rid){
return get(ResourcesEntity.class, rid);
}
/**
* 获取叶子结点下的所有资源(分页查询)
*/
public Page<ResourcesEntity> getPageResourcesOfLeaf(int id , int pageNum){
if(this.HQuery("category1Id", id).size() !=0){
return this.PageQuery("category1Id", id, pageNum);
}else if(this.HQuery("category2Id", id).size() !=0){
return this.PageQuery("category2Id", id, pageNum);
}else if(this.HQuery("category3Id", id).size() !=0){
return this.PageQuery("category3Id", id, pageNum);
}else {
System.out.println("111111111111111111111111111111111111111111111111111111111");
return null;
}
}
public Page<ResourcesEntity> search(String keyword , int pageNum){
String hql = "from ResourcesEntity as res where res.rkey like '%"
+keyword+"%'";
Query query = query(hql);
return pageHandler.getPage(pageNum,20,
ResourcesEntity.class,query);
}
public Page<ResourcesEntity> queryByPage(int pageNum , int pageSize){
String hql = "from ResourcesEntity as resources";
Query query = query(hql);
return pageHandler.getPage(pageNum,pageSize,
ResourcesEntity.class,query);
}
public List<ResourcesEntity> getResourcesByCate(String category,int grade){
String hql = "";
if(grade==1){
hql = "from ResourcesEntity as resources ";
}
else if(grade==2){
hql = "from ResourcesEntity as resources where category1 = '"+category+"'";
}
else {
hql = "from ResourcesEntity as resources where category2 = '"+category+"'";
}
Query query = query(hql);
List<ResourcesEntity> resourcesEntities = query.list();
return resourcesEntities;
}
/**
* 查询
* @param colume
* @param value
* @return
*/
private List<ResourcesEntity> HQuery(String colume , int value){
String hql = "from ResourcesEntity as resources where resources."+colume+"=?";
Query query = query(hql);
query.setString(0, String.valueOf(value));
List<ResourcesEntity> results = query.list();
return results;
}
/**
* 分页查询
* @param colume
* @param value
* @param pageNum
* @return
*/
private Page<ResourcesEntity> PageQuery(String colume , int value , int pageNum){
String hql = "from ResourcesEntity as resources where resources."+colume+"=?";
Query query = query(hql);
query.setString(0, String.valueOf(value));
return pageHandler.getPage(pageNum,20,
ResourcesEntity.class,query);
}
}
|
package cpen221.mp3;
import cpen221.mp3.wikimediator.InvalidQueryException;
import cpen221.mp3.wikimediator.WikiMediator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import fastily.jwiki.core.Wiki;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
public class WikiMediatorTests {
@Test
public void simpleSearchTest1() {
String query = "Computer Engineering";
int limit = 5;
WikiMediator wm = new WikiMediator();
List<String> list = new ArrayList<String>();
list.add("Computer Science and Engineering");
list.add("Computer engineering");
list.add("Computer science");
list.add("Computer-aided engineering");
list.add("Outline of computer engineering");
List<String> listRes = wm.simpleSearch(query, limit);
assertEquals(list, listRes);
}
@Test
public void getPageTest1() {
String query = "Scarburgh";
int limit = 5;
WikiMediator wm = new WikiMediator();
String text = "'''Scarburgh''' is a surname. Notable people with the name include:\n" +
"*[[George Scarburgh]]\n" +
"*[[Charles Scarburgh]], English mathematician\n" +
"*[[John Scarburgh]], English Member of Parliament\n" +
"\n" +
"==See also==\n" +
"*[[Scarborough (disambiguation)]]\n" +
"\n" +
"{{surname}}";
String res = wm.getPage(query);
assertEquals(text, res);
}
@Test
public void getConnectedPageTest1() {
String query = "Scarburgh";
int hops = 1;
WikiMediator wm = new WikiMediator();
List<String> list = new ArrayList<>();
list.add("Wikipedia:Manual of Style/Linking");
list.add("Given name");
list.add("John Scarburgh");
list.add("Scarborough (disambiguation)");
list.add("Charles Scarburgh");
list.add("Scarburgh");
list.add("Surname");
list.add("Talk:Scarburgh");
list.add("George Scarburgh");
List<String> listRes = wm.getConnectedPages(query, hops);
assertEquals(list, listRes);
}
// @Test
// public void simpleSearchTest2() {
// String query = "Computer Engineering";
// int limit = 5;
//
// WikiMediator wm = new WikiMediator();
//
// List<String> list = new ArrayList<String>();
// list.add("Computer engineering");
// list.add("Computer Science and Engineering");
// list.add("Computer-aided engineering");
// list.add("Outline of computer engineering");
// list.add("Computer science");
//
// List<String> listRes = wm.simpleSearch(query, limit);
// List<String> listRes1 = wm.simpleSearch(query, limit);
//
// assertEquals(listRes1, listRes);
// assertEquals(listRes1, listRes);
// }
@Test
public void zeitgeistTest1() throws InterruptedException {
String query = "Computer Engineering";
int limit = 5;
WikiMediator wm = new WikiMediator();
List<String> list = new ArrayList<String>();
list.add("Computer Engineering");
list.add("Computer");
wm.simpleSearch(query, limit);
wm.simpleSearch(query, limit);
wm.simpleSearch(query, limit);
wm.simpleSearch(query, limit);
wm.getPage(query);
wm.getPage(query);
wm.getPage(query);
wm.getConnectedPages("value", 1);
wm.getPage("value");
wm.getPage("value");
wm.getConnectedPages("value", 1);
wm.getConnectedPages(query, 1);
wm.getConnectedPages(query, 1);
wm.simpleSearch("Number", 1);
wm.simpleSearch("Computer", 1);
wm.simpleSearch("Computer", 1);
wm.simpleSearch("Computer", 1);
List<String> zeitList = wm.zeitgeist(2);
assertEquals(list, zeitList);
}
@Test
public void trendingTest1() throws InterruptedException {
String query1 = "Computer Engineering";
String query2 = "Orange";
String query3 = "Holy Cow";
int limit = 3;
WikiMediator wm = new WikiMediator();
List<String> list = new ArrayList<String>();
list.add(query3);
wm.simpleSearch(query1, limit);
wm.getConnectedPages(query1, 1);
wm.getConnectedPages(query1, 1);
wm.simpleSearch(query1, limit);
wm.getPage(query2);
wm.getPage(query2);
wm.getPage(query2);
wm.getConnectedPages(query3, 1);
Thread.sleep(30000);
wm.simpleSearch(query3, limit);
wm.simpleSearch(query3, limit);
wm.simpleSearch(query3, limit);
wm.simpleSearch(query3, limit);
wm.simpleSearch(query3, limit);
wm.simpleSearch(query3, limit);
List<String> trending = wm.trending(limit);
assertEquals(trending, list);
}
@Test
public void peakLoadTest1() throws InterruptedException {
String query = "Computer Engineering";
int limit = 5;
WikiMediator wm = new WikiMediator();
wm.simpleSearch(query, limit);
wm.getConnectedPages(query, 1);
wm.simpleSearch(query, limit);
wm.getPage(query);
Thread.sleep(30000);
wm.simpleSearch(query, limit);
wm.getConnectedPages(query, 1);
wm.zeitgeist(limit);
wm.getConnectedPages(query, 1);
wm.getPage(query);
Thread.sleep(30000);
wm.trending(limit);
wm.simpleSearch(query, limit);
wm.zeitgeist(limit);
Thread.sleep(30000);
int count = wm.peakLoad30s();
assertEquals(5, count);
}
@Test
public void getPathTest1() {
String query = "Scarburgh";
WikiMediator wm = new WikiMediator();
List<String> list = new ArrayList<>();
list.add("Scarburgh");
list.add("Wikipedia:Manual of Style/Linking");
list.add("MOS:DL");
List<String> listRes = wm.getPath(query, "MOS:DL");
assertEquals(list, listRes);
}
@Test
public void getPathTest2() {
String query = "Lunari";
WikiMediator wm = new WikiMediator();
List<String> list = new ArrayList<>();
list.add("Lunari");
list.add("Luigi Lunari");
List<String> listRes = wm.getPath(query, "Luigi Lunari");
assertEquals(list, listRes);
}
@Test
public void getPathTest3() {
String startPage = "UBC";
String endPage = "Nuclear medicine";
WikiMediator wm = new WikiMediator();
List<String> listRes = wm.getPath(startPage, endPage);
List<String> list = new ArrayList<>();
list.add("UBC");
list.add("University of British Columbia");
list.add("Nuclear physics");
list.add("Nuclear medicine");
assertEquals(list, listRes);
}
@Test
public void getPathSameStartStopTest() {
String startPage = "UBC";
String endPage = "UBC";
WikiMediator wm = new WikiMediator();
List<String> listRes = wm.getPath(startPage, endPage);
List<String> list = new ArrayList<>();
list.add("UBC");
assertEquals(list, listRes);
}
@Test
public void getPathOvertimeTest() {
String startPage = "Barack Obama";
String endPage = "Metallurgy";
WikiMediator wm = new WikiMediator();
List<String> listRes = wm.getPath(startPage, endPage);
List<String> list = new ArrayList<>();
assertEquals(list, listRes);
}
@Test
public void getPathOvertimeTest2() {
String startPage = "Pterodactylus";
String endPage = "Johnson & Johnson";
WikiMediator wm = new WikiMediator();
List<String> listRes = wm.getPath(startPage, endPage);
List<String> list = new ArrayList<>();
assertEquals(list, listRes);
}
@Test
public void excuteQueryTest1() throws InvalidQueryException {
WikiMediator wm = new WikiMediator();
List<String> resList = wm.excuteQuery("get author where category is 'Illinois state senators'");
List<String> list = new ArrayList<>();
}
@Test
public void excuteQueryTest2() throws InvalidQueryException {
WikiMediator wm = new WikiMediator();
List<String> resList = wm.excuteQuery("get category where title is 'Duloxetine'");
List<String> list = new ArrayList<>();
}
@Test
public void excuteQueryTest3() throws InvalidQueryException {
WikiMediator wm = new WikiMediator();
List<String> resList = wm.excuteQuery("get category where (title is 'Duloxetine' and (title is 'Barack Obama' or author is 'Maborland'))");
List<String> list = new ArrayList<>();
list.add("Category:All articles to be expanded");
list.add("Category:Articles to be expanded from October 2009");
list.add("Category:Articles using small message boxes");
list.add("Category:Asian-American culture");
}
}
|
package hr.fer.tel.tihana;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
public class Json {
static String GetJSONResponse(String url){
try {
HttpClient client = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
httpget.addHeader("accept", "application/json");
HttpResponse response = client.execute(httpget);
HttpEntity entity = response.getEntity();
return EntityUtils.toString(entity);
} catch (ParseException e) {
e.printStackTrace();
return "Parse Exception occured.";
} catch (IOException e) {
e.printStackTrace();
return "IOException occured.";
}
}
}
|
package cn.cnmua.car.dao;
import cn.cnmua.car.domian.Parts;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @Author hjf
* @Date 2019/12/31
**/
public interface PartsMapper extends BaseMapper<Parts> {
//通过子写的sql查询出汽车配件数据
@Select("select * from parts")
public List<Parts> selectAll();
}
|
package view.defaultargumentcomponents;
import graphana.MainControl;
import scriptinterface.ScriptType;
import scriptinterface.execution.returnvalues.ExecutionReturn;
import view.VisualizingUserInterface;
import view.argumentcomponents.ArgumentComponent;
import view.argumentcomponents.ArgumentComponentManager;
import view.fileset.FileSetPopUp;
import view.guicomponents.GraphanaButton;
import view.guicomponents.OutputTextField;
import view.guicomponents.SubDialog;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ArgumentFiles extends ArgumentComponent implements ActionListener, ChangeListener {
private JPanel panel;
private GraphanaButton editButton;
private OutputTextField textField;
private JCheckBox useDefaultCheckBox;
private FileSetPopUp graphFilesPopUp;
private MainControl mainControl;
private VisualizingUserInterface userInterface;
@Override
public void init(MainControl mainControl, ScriptType scriptType, ArgumentComponentManager
argumentComponentManager) {
// useDefaultCheckBox = new JCheckBox("Use main file set");
// useDefaultCheckBox.addChangeListener(this);
// useDefaultCheckBox.setBackground(Color.WHITE);
this.mainControl = mainControl;
this.userInterface = (VisualizingUserInterface) mainControl.getUserInterface();
editButton = new GraphanaButton("Edit");
editButton.setPreferredSize(new Dimension(SubDialog.BUTTON_WIDTH, SubDialog.BUTTON_HEIGHT));
editButton.addActionListener(this);
textField = new OutputTextField();
JPanel editPanel = new JPanel();
editPanel.setLayout(new BorderLayout());
editPanel.add(editButton, BorderLayout.EAST);
editPanel.add(textField, BorderLayout.CENTER);
//editPanel.add(useDefaultCheckBox,BorderLayout.EAST);
panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(editPanel, BorderLayout.CENTER);
graphFilesPopUp = new FileSetPopUp(mainControl);
graphFilesPopUp.init();
refreshText();
}
public void setParameterName(String parameterName) {
graphFilesPopUp.setCaption(parameterName);
}
@Override
public Component getComponent() {
return panel;
}
@Override
public Component getInnerComponent() {
return textField;
}
@Override
public void setValue(ExecutionReturn value) {
//if(value==ExecutionReturn.VOID)
graphFilesPopUp.getGraphsPanel().setFiles(userInterface.getGraphFileSet());
//graphFilesPopUp.getGraphsPanel().setFiles((GFiles)value);
refreshText();
}
@Override
public ExecutionReturn evaluate() {
return graphFilesPopUp.getGraphsPanel().createGFiles();
}
@Override
public void setToolTip(String tooltip) {
panel.setToolTipText(tooltip);
}
public void refresh() {
//editButton.setEnabled(!useDefaultCheckBox.isSelected());
}
public void refreshText() {
textField.setText(graphFilesPopUp.getGraphsPanel().getGraphFiles().getFilesStringRepresentation());
}
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getSource() == editButton) {
graphFilesPopUp.start(editButton, getTopParent().getWidth());
refreshText();
}
refresh();
}
@Override
public void stateChanged(ChangeEvent ev) {
refresh();
}
}
|
package com.box.androidsdk.content.models;
import android.text.TextUtils;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import java.util.Locale;
import java.util.Map;
/**
* Represents an email address that can be used to upload files to a folder on Box.
*/
public class BoxUploadEmail extends BoxJsonObject {
private static final long serialVersionUID = -1707312180661448119L;
public static final String FIELD_ACCESS = "access";
public static final String FIELD_EMAIL = "email";
/**
* Constructs a BoxUploadEmail with default settings.
*/
public BoxUploadEmail() {
}
public BoxUploadEmail(JsonObject jsonObject) {
super(jsonObject);
}
public static BoxUploadEmail createFromAccess(Access access) {
JsonObject object = new JsonObject();
if (access == null){
object.add(FIELD_ACCESS, JsonValue.NULL);
} else {
object.add(FIELD_ACCESS, access.toString());
}
return new BoxUploadEmail(object);
}
/**
* Gets the access level of this upload email.
*
* @return the access level of this upload email.
*/
public Access getAccess() {
return Access.fromString(getPropertyAsString(FIELD_ACCESS));
}
/**
* Enumerates the possible access levels that can be set on an upload email.
*/
public enum Access {
/**
* Anyone can send an upload to this email address.
*/
OPEN("open"),
/**
* Only collaborators can send an upload to this email address.
*/
COLLABORATORS("collaborators");
private final String mValue;
public static Access fromString(String text) {
if (!TextUtils.isEmpty(text)) {
for (Access e : Access.values()) {
if (text.equalsIgnoreCase(e.toString())) {
return e;
}
}
}
throw new IllegalArgumentException(String.format(Locale.ENGLISH, "No enum with text %s found", text));
}
private Access(String value) {
this.mValue = value;
}
@Override
public String toString() {
return this.mValue;
}
}
}
|
package com.technology.share.service;
import com.technology.share.domain.BackService;
/**
* @description: 后台服务Service
* @author: 朱俊亮
* @time: 2021-03-26 11:54
*/
public interface BackServiceService extends BaseService<BackService> {
}
|
package android.support.v4.media;
import android.os.Bundle;
import android.support.v4.media.MediaBrowserServiceCompat.b;
import android.support.v4.media.MediaBrowserServiceCompat.d;
import android.support.v4.media.MediaBrowserServiceCompat.g;
class MediaBrowserServiceCompat$g$4 implements Runnable {
final /* synthetic */ Bundle rQ;
final /* synthetic */ d sf;
final /* synthetic */ g sj;
final /* synthetic */ String sk;
MediaBrowserServiceCompat$g$4(g gVar, d dVar, String str, Bundle bundle) {
this.sj = gVar;
this.sf = dVar;
this.sk = str;
this.rQ = bundle;
}
public final void run() {
b bVar = (b) MediaBrowserServiceCompat.b(this.sj.rR).get(this.sf.asBinder());
if (bVar == null) {
new StringBuilder("removeSubscription for callback that isn't registered id=").append(this.sk);
} else if (!MediaBrowserServiceCompat.a(this.sk, bVar, this.rQ)) {
new StringBuilder("removeSubscription called for ").append(this.sk).append(" which is not subscribed");
}
}
}
|
package Entities;
import Internals.Point;
/**
* @author Evan Tichenor (evan.tichenor@gmail.com)
* @version 1.0, 1/1/2017
*/
public class Blinky extends Ghost {
protected static Blinky instance;
public Blinky() {
super(255, 0, 0);
home = new Point(30, 0);
instance = this;
}
public void update() {
// get the distance from immediately in front of this to pacman
// starts initially a bit slower than pacman,
// and speeds up when there is only 20 left, (as fast as pacman)
// and speeds up again when only 10 left. (a bit faster than pacman)
// gets removed for rest of game when pacman dies
// eh do later...
if(dead)
dead();
else switch(mode) {
case Chase:
chase(pacman.getPosition());
break;
case Scatter:
scatter(home);
break;
case Frightened:
frightened();
break;
}
}
}
|
package gui;
import gui.IconProvider.IconType;
import javax.swing.*;
import javax.swing.plaf.basic.BasicButtonUI;
import state.Initialisable.TicketType;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
public class TakeMoveDialog extends JDialog implements ActionListener {
PlayerDisplayInfo playerInfo;
JPanel panel;
JButton taxiButton;
JButton busButton;
JButton undergroundButton;
JButton secretButton;
JButton doubleButton;
JButton cancelButton;
JLabel infoLabel;
private static final int DIALOG_WIDTH = 450;
TicketType answer;
@Override
public void actionPerformed(ActionEvent e) {
if(cancelButton == e.getSource()) answer = null;
else if(busButton == e.getSource()) answer = TicketType.Bus;
else if(taxiButton == e.getSource()) answer = TicketType.Taxi;
else if(undergroundButton == e.getSource()) answer = TicketType.Underground;
else if(secretButton == e.getSource()) answer = TicketType.SecretMove;
else if(doubleButton == e.getSource()) answer = TicketType.DoubleMove;
setVisible(false);
}
public TicketType answer()
{
return answer;
}
public static TicketType getMove(JFrame frame, PlayerDisplayInfo playerInfo, String info)
{
TakeMoveDialog dialog = new TakeMoveDialog(frame, playerInfo, info);
return dialog.answer();
}
public TakeMoveDialog(JFrame frame, PlayerDisplayInfo playerInfo, String info)
{
super(frame, true);
this.playerInfo = playerInfo;
int bigButtonDims = DIALOG_WIDTH / 3;
setPreferredSize(new Dimension(DIALOG_WIDTH+30, bigButtonDims+50+60+20));
// create the main panel of the dialog
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
add(panel);
infoLabel = new JLabel(info);
panel.add(infoLabel);
int t = playerInfo.getTickets(TicketType.Taxi);
int b = playerInfo.getTickets(TicketType.Bus);
int u = playerInfo.getTickets(TicketType.Underground);
int s = playerInfo.getTickets(TicketType.SecretMove);
int d = playerInfo.getTickets(TicketType.DoubleMove);
// create the three big buttons
JPanel bigButtonPanel = new JPanel();
bigButtonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
bigButtonPanel.setBackground(new Color(200,200,200));
bigButtonPanel.setLayout(new BoxLayout(bigButtonPanel, BoxLayout.X_AXIS));
taxiButton = new JButton(IconProvider.getIcon(IconType.Taxi, t));
busButton = new JButton(IconProvider.getIcon(IconType.Bus, b));
undergroundButton = new JButton(IconProvider.getIcon(IconType.Underground, u));
if(t == 0) taxiButton.setEnabled(false);
if(u == 0) undergroundButton.setEnabled(false);
if(b == 0) busButton.setEnabled(false);
taxiButton.setMaximumSize(new Dimension(bigButtonDims, bigButtonDims));
busButton.setMaximumSize(new Dimension(bigButtonDims, bigButtonDims));
undergroundButton.setMaximumSize(new Dimension(bigButtonDims, bigButtonDims));
taxiButton.addActionListener(this);
busButton.addActionListener(this);
undergroundButton.addActionListener(this);
bigButtonPanel.add(taxiButton);
bigButtonPanel.add(busButton);
bigButtonPanel.add(undergroundButton);
JPanel secretButtonPanel = new JPanel();
secretButtonPanel.setLayout(new BoxLayout(secretButtonPanel, BoxLayout.X_AXIS));
secretButtonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
secretButtonPanel.setBackground(new Color(150,150,150));
secretButton = new JButton("Secret Move", IconProvider.getIcon(IconType.Lock, 30, 30));
doubleButton = new JButton("Double Move", IconProvider.getIcon(IconType.Times2, 30, 30));
cancelButton = new JButton("Cancel");
if(s==0) secretButton.setEnabled(false);
if(d==0) doubleButton.setEnabled(false);
doubleButton.setFont( new Font(Font.SANS_SERIF, Font.BOLD, 12));
secretButton.setFont( new Font(Font.SANS_SERIF, Font.BOLD, 12));
cancelButton.setFont( new Font(Font.SANS_SERIF, Font.BOLD, 16));
secretButton.setMaximumSize(new Dimension(bigButtonDims, 50));
doubleButton.setMaximumSize(new Dimension(bigButtonDims, 50));
cancelButton.setMaximumSize(new Dimension(bigButtonDims, 50));
doubleButton.addActionListener(this);
secretButton.addActionListener(this);
cancelButton.addActionListener(this);
secretButtonPanel.add(secretButton);
secretButtonPanel.add(doubleButton);
secretButtonPanel.add(cancelButton);
panel.add(bigButtonPanel);
panel.add(secretButtonPanel);
pack();
setLocationRelativeTo(frame);
setVisible(true);
}
}
|
package moe.vergo.seasonalseiyuuapi.adapter.out.web;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.StreamUtils;
import java.io.IOException;
import java.nio.charset.Charset;
public class WebAdapterTestHelper {
private WebAdapterTestHelper() {}
public static String classpathFileToString(String filepath) throws IOException {
return StreamUtils.copyToString(new ClassPathResource(filepath).getInputStream(), Charset.defaultCharset());
}
}
|
package chatterby.network;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Logger;
import chatterby.messages.Message;
/**
* Manage transmission of messages.
*
* @author scoleman
* @version 1.0.0
* @since 1.0.0
*/
public class MessageManager extends Thread
{
public static final int CONNECT_PORT = 6689;
public static final String MULTICAST_ADDRESS = "224.0.66.89";
private static final Logger LOGGER = Logger.getLogger(MessageManager.class.getName());
private final LinkedBlockingQueue<Message> queue;
private final MulticastSocket socket;
private final InetAddress group;
/**
* @throws IOException when the socket cannot be established
*/
public MessageManager() throws IOException
{
this.queue = new LinkedBlockingQueue<Message>();
this.socket = new MulticastSocket(MessageManager.CONNECT_PORT);
this.group = InetAddress.getByName(MessageManager.MULTICAST_ADDRESS);
}
public void send(Message message) throws InterruptedException
{
this.queue.put(message);
}
@Override
public void run()
{
LOGGER.info("Starting up transmission thread.");
while (!Thread.interrupted())
{
try
{
Message next = this.queue.take();
LOGGER.info("Sending message.");
byte[] payload = Payloads.wrapPayload(next.payload(), PayloadType.MESSAGE);
DatagramPacket packet = new DatagramPacket(
payload, payload.length,
this.group, MessageManager.CONNECT_PORT);
try
{
this.socket.send(packet);
}
catch (IOException e)
{
LOGGER.severe("Could not send packet: " + e.getMessage());
}
}
catch (InterruptedException e)
{
break;
}
}
LOGGER.info("Halting transmission.");
this.socket.close();
}
} |
package cn.timebusker.web;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.timebusker.conf.DefinitionConfig;
import cn.timebusker.conf.DubboConfig;
@RestController
public class ConfController {
@Resource
DefinitionConfig conf;
@Resource
DubboConfig dubbo;
/**
* 测试自定义配置属性加载
* @return
*/
@RequestMapping("/conf")
public String getConfig() {
System.out.println(conf.toString());
return conf.toString();
}
/**
* 测试自定义的额外文件的配置信息
* @return
*/
@RequestMapping("/dubbo")
public String dubboConfig() {
System.out.println(dubbo.toString());
return dubbo.toString();
}
}
|
package kodlamaio.hrms.core.adapters.concretes;
import java.util.regex.Pattern;
import org.springframework.stereotype.Service;
import kodlamaio.hrms.core.adapters.abstracts.EmailValidationService;
@Service
public class EmailValidationManager implements EmailValidationService {
@Override
public boolean isEmailValid(String email) {
final Pattern EMAIL_REGEX = Pattern.compile("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.com", Pattern.CASE_INSENSITIVE);
return EMAIL_REGEX.matcher(email).matches();
}
@Override
public boolean isEmailValidonClick(String email) {
return true;
}
}
|
package com.lec.question;
import java.util.Scanner;
public class Q1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("정수를 입력하세요:");
int i = sc.nextInt();
System.out.println(i % 3 == 0 ? "3의 배수입니다" : "3의 배수가 아닙니다");
sc.close(); // sc 에 대한 warning error(노란 밑줄)이 사라짐 - 입력 안해도 실행은 됨
}
}
|
package cn.bs.zjzc.presenter;
import android.util.Log;
import cn.bs.zjzc.model.IMyEvaluationModel;
import cn.bs.zjzc.model.callback.HttpTaskCallback;
import cn.bs.zjzc.model.impl.MyEvaluationModel;
import cn.bs.zjzc.model.response.EvaluationListResponse;
import cn.bs.zjzc.fragment.IMyEvaluationView;
/**
* Created by Ming on 2016/7/5.
*/
public class MyEvaluationPresenter {
private IMyEvaluationView mMyEvaluationView;
private IMyEvaluationModel mMyEvaluationModel;
public MyEvaluationPresenter(IMyEvaluationView myEvaluationView) {
mMyEvaluationView = myEvaluationView;
mMyEvaluationModel = new MyEvaluationModel();
}
public void getEvaluationList(String type, String page) {
Log.i("getEvaluationList", "getEvaluationList: " + "");
mMyEvaluationModel.getEvaluationList(type, page, new HttpTaskCallback<EvaluationListResponse.DataBean>() {
@Override
public void onTaskFailed(String errorInfo) {
mMyEvaluationView.completeFresh();
mMyEvaluationView.showMsg(errorInfo);
}
@Override
public void onTaskSuccess(EvaluationListResponse.DataBean data) {
mMyEvaluationView.completeFresh();
mMyEvaluationView.showEvaluationList(data);
}
});
}
}
|
package com.tencent.mm.plugin.masssend.ui;
import android.view.View;
import com.tencent.mm.ui.base.MMPullDownView.d;
class MassSendHistoryUI$7 implements d {
final /* synthetic */ MassSendHistoryUI lbg;
MassSendHistoryUI$7(MassSendHistoryUI massSendHistoryUI) {
this.lbg = massSendHistoryUI;
}
public final boolean aCh() {
View childAt = MassSendHistoryUI.d(this.lbg).getChildAt(MassSendHistoryUI.d(this.lbg).getFirstVisiblePosition());
if (childAt == null || childAt.getTop() != 0) {
return false;
}
return true;
}
}
|
package com.pmobrien.rest.exceptions;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
@Provider
public class UncaughtExceptionMapper implements ExceptionMapper<Throwable> {
/**
* If it's a WebApplicationException (or any child class of), convert it to a JSON error message and retain the
* original error code. Otherwise, return a 500.
*
* @param t The uncaught exception.
*
* @return The uncaught WebApplicationException as JSON, or a 500.
*/
@Override
public Response toResponse(Throwable t) {
t.printStackTrace(System.out);
try {
throw t;
} catch(WebApplicationException ex) {
return Response.status(((WebApplicationException)ex).getResponse().getStatus())
.entity(new ErrorMessage(((WebApplicationException)ex).getMessage()))
.type(MediaType.APPLICATION_JSON)
.build();
} catch(Throwable ex) {
return Response.serverError()
.entity(new ErrorMessage("An unknown error occurred."))
.type(MediaType.APPLICATION_JSON)
.build();
}
}
private static class ErrorMessage {
private String message;
public ErrorMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
}
|
package online_2017;
/**
* @author kangkang lou
*/
import java.util.Scanner;
/**
* 网格路线
*/
public class Main_16 {
static void line(int m, int n) {
int[][] arr = new int[m + 1][n + 1];
for (int i = 0; i <= m; i++) {
arr[i][0] = 1;
}
for (int j = 0; j <= n; j++) {
arr[0][j] = 1;
}
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
arr[i][j] = arr[i - 1][j] + arr[i][j - 1];
}
}
System.out.println(arr[m][n]);
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int m = in.nextInt();
int n = in.nextInt();
line(m, n);
}
}
}
|
package com.example.hp.ournetwork;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
public class forgot extends AppCompatActivity {
private EditText inputEmail;
private Button btnreset;
private Button backbtn;
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forgot);
inputEmail = (EditText) findViewById(R.id.MAIL);
btnreset =(Button) findViewById(R.id.Sumbit);
backbtn =(Button) findViewById(R.id.BACK);
backbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(forgot.this,login.class));
finish();
}
});
mAuth=FirebaseAuth.getInstance();
btnreset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
resetPassword(inputEmail.getText().toString());
startActivity(new Intent(forgot.this,splash.class));
finish();
}
});
}
private void resetPassword(final String email) {
mAuth.sendPasswordResetEmail(email).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()) {
Toast snackbar=Toast.makeText(forgot.this,"We have sent password to email : "+ email,Toast.LENGTH_SHORT);
snackbar.show();
}else
{
Toast snackbar=Toast.makeText(forgot.this,"Failed to send password to email : "+ email,Toast.LENGTH_SHORT);
snackbar.show();
}
}
});
}
}
|
package tainiothiki;
import java.io.*;
public class markdownwriter implements writer {
private String path;
private String input;
public markdownwriter(String path, String in) {
this.path=path;
input=in;
}
public int writefile() {
BufferedWriter bw = null;
FileWriter fw = null;
try {
fw = new FileWriter(path);
bw = new BufferedWriter(fw);
bw.write("##"+input);
System.out.println("Done");
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bw != null)
bw.close();
if (fw != null)
fw.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
return 1;
}
}
|
package model.forms;
import java.util.Arrays;
public class InventarFormModel {
private long idLoc;
private long idPersoana;
private long tipIesire;
private long[] articole;
private String detalii;
public long getIdLoc() {
return idLoc;
}
public void setIdLoc(long idLoc) {
this.idLoc = idLoc;
}
public long getIdResurseUmane() {
return idPersoana;
}
public void setIdResurseUmane(long idPersoana) {
this.idPersoana = idPersoana;
}
public long getTipIesire() {
return tipIesire;
}
public void setTipIesire(long tipIesire) {
this.tipIesire = tipIesire;
}
public long[] getArticole() {
return articole;
}
public void setArticole(long[] articole) {
this.articole = articole;
}
public String getDetalii() {
return detalii;
}
public void setDetalii(String detalii) {
this.detalii = detalii;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof InventarFormModel)) return false;
InventarFormModel that = (InventarFormModel) o;
if (idLoc != that.idLoc) return false;
if (idPersoana != that.idPersoana) return false;
if (tipIesire != that.tipIesire) return false;
if (!Arrays.equals(articole, that.articole)) return false;
return !(detalii != null ? !detalii.equals(that.detalii) : that.detalii != null);
}
@Override
public int hashCode() {
int result = (int) (idLoc ^ (idLoc >>> 32));
result = 31 * result + (int) (idPersoana ^ (idPersoana >>> 32));
result = 31 * result + (int) (tipIesire ^ (tipIesire >>> 32));
result = 31 * result + (articole != null ? Arrays.hashCode(articole) : 0);
result = 31 * result + (detalii != null ? detalii.hashCode() : 0);
return result;
}
}
|
//----------------------------------------------------
// The following code was generated by CUP v0.11b beta 20140220
// Sat Jun 19 15:55:17 CEST 2021
//----------------------------------------------------
package tiny1.analizadorsintactico.asc;
import java_cup.runtime.*;
import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import tiny1.analizadorlexico.AnalizadorLexico;
import tiny1.analizadorlexico.UnidadLexica;
import tiny1.errors.GestionErrores;
import tiny1.asint.TinyASint;
import tiny1.asint.TinyASint.*;
import java_cup.runtime.ComplexSymbolFactory.Location;
/** CUP v0.11b beta 20140220 generated parser.
* @version Sat Jun 19 15:55:17 CEST 2021
*/
public class AnalizadorSintacticoAsc extends java_cup.runtime.lr_parser{
/** Default constructor. */
public AnalizadorSintacticoAsc() {super();}
/** Constructor which sets the default scanner. */
public AnalizadorSintacticoAsc(java_cup.runtime.Scanner s) {super(s);}
/** Constructor which sets the default scanner. */
public AnalizadorSintacticoAsc(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
/** Production table. */
protected static final short _production_table[][] =
unpackFromStrings(new String[] {
"\000\137\000\002\002\004\000\002\002\004\000\002\003" +
"\004\000\002\003\002\000\002\004\005\000\002\004\003" +
"\000\002\005\003\000\002\005\003\000\002\005\003\000" +
"\002\006\005\000\002\007\005\000\002\010\010\000\002" +
"\011\005\000\002\011\003\000\002\011\002\000\002\012" +
"\005\000\002\012\004\000\002\013\003\000\002\013\003" +
"\000\002\013\003\000\002\013\003\000\002\013\003\000" +
"\002\013\003\000\002\013\003\000\002\013\003\000\002" +
"\014\010\000\002\015\006\000\002\017\005\000\002\017" +
"\003\000\002\020\004\000\002\016\004\000\002\021\005" +
"\000\002\021\003\000\002\021\002\000\002\022\003\000" +
"\002\022\003\000\002\022\003\000\002\022\003\000\002" +
"\022\003\000\002\022\003\000\002\022\003\000\002\022" +
"\003\000\002\022\003\000\002\022\003\000\002\022\003" +
"\000\002\023\005\000\002\024\007\000\002\025\011\000" +
"\002\026\007\000\002\027\004\000\002\030\004\000\002" +
"\031\004\000\002\032\004\000\002\034\003\000\002\033" +
"\007\000\002\035\005\000\002\036\005\000\002\036\003" +
"\000\002\036\002\000\002\037\003\000\002\037\003\000" +
"\002\037\003\000\002\037\003\000\002\037\003\000\002" +
"\037\003\000\002\040\003\000\002\040\003\000\002\040" +
"\003\000\002\041\005\000\002\041\005\000\002\041\003" +
"\000\002\042\005\000\002\042\005\000\002\042\003\000" +
"\002\043\005\000\002\043\003\000\002\044\005\000\002" +
"\044\003\000\002\045\004\000\002\045\004\000\002\045" +
"\003\000\002\046\006\000\002\046\005\000\002\046\005" +
"\000\002\046\003\000\002\047\004\000\002\047\003\000" +
"\002\050\005\000\002\050\003\000\002\050\003\000\002" +
"\050\003\000\002\050\003\000\002\050\003\000\002\050" +
"\003\000\002\050\003" });
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
unpackFromStrings(new String[] {
"\000\236\000\064\002\ufffe\004\ufffe\005\ufffe\006\ufffe\007" +
"\ufffe\013\ufffe\014\ufffe\016\ufffe\021\ufffe\022\012\023\ufffe" +
"\027\ufffe\032\ufffe\033\013\040\ufffe\041\ufffe\042\ufffe\043" +
"\ufffe\044\011\045\ufffe\046\ufffe\050\ufffe\056\ufffe\063\ufffe" +
"\064\ufffe\001\002\000\006\056\ufff9\075\ufff9\001\002\000" +
"\006\056\ufffa\075\ufffa\001\002\000\006\056\ufffb\075\ufffb" +
"\001\002\000\006\056\ufffc\075\ufffc\001\002\000\006\056" +
"\237\075\236\001\002\000\022\004\172\010\166\011\175" +
"\012\170\015\177\034\174\035\165\037\176\001\002\000" +
"\004\004\220\001\002\000\022\004\172\010\166\011\175" +
"\012\170\015\177\034\174\035\165\037\176\001\002\000" +
"\060\002\uffe0\004\051\005\043\006\055\007\036\013\034" +
"\014\057\016\041\021\025\023\031\027\052\032\030\040" +
"\035\041\054\042\050\043\022\045\047\046\044\050\026" +
"\051\uffe0\056\uffe0\063\040\064\020\001\002\000\004\002" +
"\016\001\002\000\004\002\000\001\002\000\016\002\uffdf" +
"\025\uffdf\026\uffdf\031\uffdf\051\uffdf\056\uffdf\001\002\000" +
"\024\004\051\005\043\006\055\007\036\013\034\014\057" +
"\016\041\046\044\064\020\001\002\000\016\002\uffdc\025" +
"\uffdc\026\uffdc\031\uffdc\051\uffdc\056\uffdc\001\002\000\030" +
"\004\051\005\043\006\055\007\036\013\034\014\057\016" +
"\041\021\025\046\044\063\040\064\020\001\002\000\016" +
"\002\uffde\025\uffde\026\uffde\031\uffde\051\uffde\056\uffde\001" +
"\002\000\016\002\uffdb\025\uffdb\026\uffdb\031\uffdb\051\uffdb" +
"\056\uffdb\001\002\000\030\004\051\005\043\006\055\007" +
"\036\013\034\014\057\016\041\021\025\046\044\063\040" +
"\064\020\001\002\000\064\004\ufffe\005\ufffe\006\ufffe\007" +
"\ufffe\013\ufffe\014\ufffe\016\ufffe\021\ufffe\022\012\023\ufffe" +
"\027\ufffe\032\ufffe\033\013\040\ufffe\041\ufffe\042\ufffe\043" +
"\ufffe\044\011\045\ufffe\046\ufffe\050\ufffe\051\ufffe\056\ufffe" +
"\063\ufffe\064\ufffe\001\002\000\016\002\uffd8\025\uffd8\026" +
"\uffd8\031\uffd8\051\uffd8\056\uffd8\001\002\000\004\004\151" +
"\001\002\000\030\004\051\005\043\006\055\007\036\013" +
"\034\014\057\016\041\021\025\046\044\063\040\064\020" +
"\001\002\000\016\002\uffe1\025\uffe1\026\uffe1\031\uffe1\051" +
"\uffe1\056\uffe1\001\002\000\016\002\uffd5\025\uffd5\026\uffd5" +
"\031\uffd5\051\uffd5\056\uffd5\001\002\000\072\002\uffa7\017" +
"\uffa7\020\uffa7\024\uffa7\025\uffa7\026\uffa7\030\uffa7\031\uffa7" +
"\047\uffa7\051\uffa7\052\uffa7\053\uffa7\054\uffa7\055\uffa7\056" +
"\uffa7\057\uffa7\061\uffa7\062\uffa7\063\uffa7\064\uffa7\065\uffa7" +
"\066\uffa7\067\uffa7\070\uffa7\071\uffa7\072\uffa7\073\uffa7\074" +
"\uffa7\001\002\000\030\004\051\005\043\006\055\007\036" +
"\013\034\014\057\016\041\021\025\046\044\063\040\064" +
"\020\001\002\000\072\002\uffa5\017\uffa5\020\uffa5\024\uffa5" +
"\025\uffa5\026\uffa5\030\uffa5\031\uffa5\047\uffa5\051\uffa5\052" +
"\uffa5\053\uffa5\054\uffa5\055\uffa5\056\uffa5\057\uffa5\061\uffa5" +
"\062\uffa5\063\uffa5\064\uffa5\065\uffa5\066\uffa5\067\uffa5\070" +
"\uffa5\071\uffa5\072\uffa5\073\uffa5\074\uffa5\001\002\000\016" +
"\002\uffdd\025\uffdd\026\uffdd\031\uffdd\051\uffdd\056\uffdd\001" +
"\002\000\024\004\051\005\043\006\055\007\036\013\034" +
"\014\057\016\041\046\044\064\020\001\002\000\072\002" +
"\uffa3\017\uffa3\020\uffa3\024\uffa3\025\uffa3\026\uffa3\030\uffa3" +
"\031\uffa3\047\uffa3\051\uffa3\052\uffa3\053\uffa3\054\uffa3\055" +
"\uffa3\056\uffa3\057\uffa3\061\uffa3\062\uffa3\063\uffa3\064\uffa3" +
"\065\uffa3\066\uffa3\067\uffa3\070\uffa3\071\uffa3\072\uffa3\073" +
"\uffa3\074\uffa3\001\002\000\016\002\uffda\025\uffda\026\uffda" +
"\031\uffda\051\uffda\056\uffda\001\002\000\072\002\uffa9\017" +
"\uffa9\020\uffa9\024\uffa9\025\uffa9\026\uffa9\030\uffa9\031\uffa9" +
"\047\uffa9\051\uffa9\052\uffa9\053\uffa9\054\uffa9\055\uffa9\056" +
"\uffa9\057\uffa9\061\uffa9\062\uffa9\063\uffa9\064\uffa9\065\uffa9" +
"\066\uffa9\067\uffa9\070\uffa9\071\uffa9\072\uffa9\073\uffa9\074" +
"\uffa9\001\002\000\030\004\051\005\043\006\055\007\036" +
"\013\034\014\057\016\041\021\025\046\044\063\040\064" +
"\020\001\002\000\016\002\uffd9\025\uffd9\026\uffd9\031\uffd9" +
"\051\uffd9\056\uffd9\001\002\000\016\002\uffd6\025\uffd6\026" +
"\uffd6\031\uffd6\051\uffd6\056\uffd6\001\002\000\016\002\uffcc" +
"\025\uffcc\026\uffcc\031\uffcc\051\uffcc\056\uffcc\001\002\000" +
"\030\004\051\005\043\006\055\007\036\013\034\014\057" +
"\016\041\021\025\046\044\063\040\064\020\001\002\000" +
"\072\002\uffa4\017\uffa4\020\uffa4\024\uffa4\025\uffa4\026\uffa4" +
"\030\uffa4\031\uffa4\047\uffa4\051\uffa4\052\uffa4\053\uffa4\054" +
"\uffa4\055\uffa4\056\uffa4\057\uffa4\061\uffa4\062\uffa4\063\uffa4" +
"\064\uffa4\065\uffa4\066\uffa4\067\uffa4\070\uffa4\071\uffa4\072" +
"\uffa4\073\uffa4\074\uffa4\001\002\000\030\004\051\005\043" +
"\006\055\007\036\013\034\014\057\016\041\021\025\046" +
"\044\063\040\064\020\001\002\000\010\002\001\051\001" +
"\056\127\001\002\000\030\004\051\005\043\006\055\007" +
"\036\013\034\014\057\016\041\021\025\046\044\063\040" +
"\064\020\001\002\000\072\002\uffa8\017\uffa8\020\uffa8\024" +
"\uffa8\025\uffa8\026\uffa8\030\uffa8\031\uffa8\047\uffa8\051\uffa8" +
"\052\uffa8\053\uffa8\054\uffa8\055\uffa8\056\uffa8\057\uffa8\061" +
"\uffa8\062\uffa8\063\uffa8\064\uffa8\065\uffa8\066\uffa8\067\uffa8" +
"\070\uffa8\071\uffa8\072\uffa8\073\uffa8\074\uffa8\001\002\000" +
"\072\002\uffab\017\uffab\020\uffab\024\uffab\025\uffab\026\uffab" +
"\030\uffab\031\uffab\047\uffab\051\uffab\052\uffab\053\uffab\054" +
"\uffab\055\uffab\056\uffab\057\uffab\061\uffab\062\uffab\063\uffab" +
"\064\uffab\065\uffab\066\uffab\067\uffab\070\uffab\071\uffab\072" +
"\uffab\073\uffab\074\uffab\001\002\000\072\002\uffa6\017\uffa6" +
"\020\uffa6\024\uffa6\025\uffa6\026\uffa6\030\uffa6\031\uffa6\047" +
"\uffa6\051\uffa6\052\uffa6\053\uffa6\054\uffa6\055\uffa6\056\uffa6" +
"\057\uffa6\061\uffa6\062\uffa6\063\uffa6\064\uffa6\065\uffa6\066" +
"\uffa6\067\uffa6\070\uffa6\071\uffa6\072\uffa6\073\uffa6\074\uffa6" +
"\001\002\000\072\002\uffad\017\uffad\020\uffad\024\uffad\025" +
"\uffad\026\uffad\030\uffad\031\uffad\047\uffad\051\uffad\052\uffad" +
"\053\uffad\054\uffad\055\uffad\056\uffad\057\uffad\061\uffad\062" +
"\uffad\063\uffad\064\uffad\065\uffad\066\uffad\067\uffad\070\uffad" +
"\071\uffad\072\uffad\073\uffad\074\uffad\001\002\000\016\002" +
"\uffd7\025\uffd7\026\uffd7\031\uffd7\051\uffd7\056\uffd7\001\002" +
"\000\072\002\uffb1\017\uffb1\020\uffb1\024\uffb1\025\uffb1\026" +
"\uffb1\030\uffb1\031\uffb1\047\uffb1\051\uffb1\052\120\053\uffb1" +
"\054\uffb1\055\121\056\uffb1\057\117\061\uffb1\062\uffb1\063" +
"\uffb1\064\uffb1\065\uffb1\066\uffb1\067\uffb1\070\uffb1\071\uffb1" +
"\072\uffb1\073\uffb1\074\uffb1\001\002\000\064\002\uffb4\017" +
"\uffb4\020\uffb4\024\uffb4\025\uffb4\026\uffb4\030\uffb4\031\uffb4" +
"\047\uffb4\051\uffb4\053\uffb4\054\uffb4\056\uffb4\061\uffb4\062" +
"\uffb4\063\uffb4\064\115\065\114\066\112\067\uffb4\070\uffb4" +
"\071\uffb4\072\uffb4\073\uffb4\074\uffb4\001\002\000\056\002" +
"\uffb6\017\uffb6\020\uffb6\024\uffb6\025\uffb6\026\uffb6\030\uffb6" +
"\031\uffb6\047\uffb6\051\uffb6\053\uffb6\054\uffb6\056\uffb6\061" +
"\uffb6\062\uffb6\063\uffb6\067\uffb6\070\uffb6\071\uffb6\072\uffb6" +
"\073\uffb6\074\uffb6\001\002\000\056\002\uffb8\017\uffb8\020" +
"\uffb8\024\uffb8\025\uffb8\026\uffb8\030\uffb8\031\uffb8\047\uffb8" +
"\051\uffb8\053\uffb8\054\uffb8\056\uffb8\061\uffb8\062\uffb8\063" +
"\uffb8\067\102\070\104\071\077\072\103\073\100\074\105" +
"\001\002\000\042\002\uffbb\017\073\020\075\024\uffbb\025" +
"\uffbb\026\uffbb\030\uffbb\031\uffbb\047\uffbb\051\uffbb\053\uffbb" +
"\054\uffbb\056\uffbb\061\uffbb\062\072\063\074\001\002\000" +
"\004\061\070\001\002\000\030\004\051\005\043\006\055" +
"\007\036\013\034\014\057\016\041\021\025\046\044\063" +
"\040\064\020\001\002\000\016\002\uffd4\025\uffd4\026\uffd4" +
"\031\uffd4\051\uffd4\056\uffd4\001\002\000\030\004\051\005" +
"\043\006\055\007\036\013\034\014\057\016\041\021\025" +
"\046\044\063\040\064\020\001\002\000\030\004\051\005" +
"\043\006\055\007\036\013\034\014\057\016\041\021\025" +
"\046\044\063\040\064\020\001\002\000\030\004\051\005" +
"\043\006\055\007\036\013\034\014\057\016\041\021\025" +
"\046\044\063\040\064\020\001\002\000\030\004\051\005" +
"\043\006\055\007\036\013\034\014\057\016\041\021\025" +
"\046\044\063\040\064\020\001\002\000\056\002\uffb9\017" +
"\uffb9\020\uffb9\024\uffb9\025\uffb9\026\uffb9\030\uffb9\031\uffb9" +
"\047\uffb9\051\uffb9\053\uffb9\054\uffb9\056\uffb9\061\uffb9\062" +
"\uffb9\063\uffb9\067\102\070\104\071\077\072\103\073\100" +
"\074\105\001\002\000\030\004\uffc6\005\uffc6\006\uffc6\007" +
"\uffc6\013\uffc6\014\uffc6\016\uffc6\021\uffc6\046\uffc6\063\uffc6" +
"\064\uffc6\001\002\000\030\004\uffc2\005\uffc2\006\uffc2\007" +
"\uffc2\013\uffc2\014\uffc2\016\uffc2\021\uffc2\046\uffc2\063\uffc2" +
"\064\uffc2\001\002\000\030\004\051\005\043\006\055\007" +
"\036\013\034\014\057\016\041\021\025\046\044\063\040" +
"\064\020\001\002\000\030\004\uffc5\005\uffc5\006\uffc5\007" +
"\uffc5\013\uffc5\014\uffc5\016\uffc5\021\uffc5\046\uffc5\063\uffc5" +
"\064\uffc5\001\002\000\030\004\uffc3\005\uffc3\006\uffc3\007" +
"\uffc3\013\uffc3\014\uffc3\016\uffc3\021\uffc3\046\uffc3\063\uffc3" +
"\064\uffc3\001\002\000\030\004\uffc4\005\uffc4\006\uffc4\007" +
"\uffc4\013\uffc4\014\uffc4\016\uffc4\021\uffc4\046\uffc4\063\uffc4" +
"\064\uffc4\001\002\000\030\004\uffc1\005\uffc1\006\uffc1\007" +
"\uffc1\013\uffc1\014\uffc1\016\uffc1\021\uffc1\046\uffc1\063\uffc1" +
"\064\uffc1\001\002\000\056\002\uffb7\017\uffb7\020\uffb7\024" +
"\uffb7\025\uffb7\026\uffb7\030\uffb7\031\uffb7\047\uffb7\051\uffb7" +
"\053\uffb7\054\uffb7\056\uffb7\061\uffb7\062\uffb7\063\uffb7\067" +
"\uffb7\070\uffb7\071\uffb7\072\uffb7\073\uffb7\074\uffb7\001\002" +
"\000\036\002\uffbc\017\073\020\075\024\uffbc\025\uffbc\026" +
"\uffbc\030\uffbc\031\uffbc\047\uffbc\051\uffbc\053\uffbc\054\uffbc" +
"\056\uffbc\061\uffbc\001\002\000\056\002\uffba\017\uffba\020" +
"\uffba\024\uffba\025\uffba\026\uffba\030\uffba\031\uffba\047\uffba" +
"\051\uffba\053\uffba\054\uffba\056\uffba\061\uffba\062\uffba\063" +
"\uffba\067\102\070\104\071\077\072\103\073\100\074\105" +
"\001\002\000\032\002\uffbd\024\uffbd\025\uffbd\026\uffbd\030" +
"\uffbd\031\uffbd\047\uffbd\051\uffbd\053\uffbd\054\uffbd\056\uffbd" +
"\061\uffbd\001\002\000\030\004\uffbe\005\uffbe\006\uffbe\007" +
"\uffbe\013\uffbe\014\uffbe\016\uffbe\021\uffbe\046\uffbe\063\uffbe" +
"\064\uffbe\001\002\000\030\004\051\005\043\006\055\007" +
"\036\013\034\014\057\016\041\021\025\046\044\063\040" +
"\064\020\001\002\000\030\004\uffbf\005\uffbf\006\uffbf\007" +
"\uffbf\013\uffbf\014\uffbf\016\uffbf\021\uffbf\046\uffbf\063\uffbf" +
"\064\uffbf\001\002\000\030\004\uffc0\005\uffc0\006\uffc0\007" +
"\uffc0\013\uffc0\014\uffc0\016\uffc0\021\uffc0\046\uffc0\063\uffc0" +
"\064\uffc0\001\002\000\056\002\uffb5\017\uffb5\020\uffb5\024" +
"\uffb5\025\uffb5\026\uffb5\030\uffb5\031\uffb5\047\uffb5\051\uffb5" +
"\053\uffb5\054\uffb5\056\uffb5\061\uffb5\062\uffb5\063\uffb5\067" +
"\uffb5\070\uffb5\071\uffb5\072\uffb5\073\uffb5\074\uffb5\001\002" +
"\000\004\004\125\001\002\000\030\004\051\005\043\006" +
"\055\007\036\013\034\014\057\016\041\021\025\046\044" +
"\063\040\064\020\001\002\000\004\004\122\001\002\000" +
"\072\002\uffaf\017\uffaf\020\uffaf\024\uffaf\025\uffaf\026\uffaf" +
"\030\uffaf\031\uffaf\047\uffaf\051\uffaf\052\uffaf\053\uffaf\054" +
"\uffaf\055\uffaf\056\uffaf\057\uffaf\061\uffaf\062\uffaf\063\uffaf" +
"\064\uffaf\065\uffaf\066\uffaf\067\uffaf\070\uffaf\071\uffaf\072" +
"\uffaf\073\uffaf\074\uffaf\001\002\000\004\053\124\001\002" +
"\000\072\002\uffb0\017\uffb0\020\uffb0\024\uffb0\025\uffb0\026" +
"\uffb0\030\uffb0\031\uffb0\047\uffb0\051\uffb0\052\uffb0\053\uffb0" +
"\054\uffb0\055\uffb0\056\uffb0\057\uffb0\061\uffb0\062\uffb0\063" +
"\uffb0\064\uffb0\065\uffb0\066\uffb0\067\uffb0\070\uffb0\071\uffb0" +
"\072\uffb0\073\uffb0\074\uffb0\001\002\000\072\002\uffae\017" +
"\uffae\020\uffae\024\uffae\025\uffae\026\uffae\030\uffae\031\uffae" +
"\047\uffae\051\uffae\052\uffae\053\uffae\054\uffae\055\uffae\056" +
"\uffae\057\uffae\061\uffae\062\uffae\063\uffae\064\uffae\065\uffae" +
"\066\uffae\067\uffae\070\uffae\071\uffae\072\uffae\073\uffae\074" +
"\uffae\001\002\000\016\002\uffcd\025\uffcd\026\uffcd\031\uffcd" +
"\051\uffcd\056\uffcd\001\002\000\052\004\051\005\043\006" +
"\055\007\036\013\034\014\057\016\041\021\025\023\031" +
"\027\052\032\030\040\035\041\054\042\050\043\022\045" +
"\047\046\044\050\026\063\040\064\020\001\002\000\016" +
"\002\uffe2\025\uffe2\026\uffe2\031\uffe2\051\uffe2\056\uffe2\001" +
"\002\000\004\030\132\001\002\000\056\004\051\005\043" +
"\006\055\007\036\013\034\014\057\016\041\021\025\023" +
"\031\027\052\031\uffe0\032\030\040\035\041\054\042\050" +
"\043\022\045\047\046\044\050\026\056\uffe0\063\040\064" +
"\020\001\002\000\006\031\134\056\127\001\002\000\016" +
"\002\uffd1\025\uffd1\026\uffd1\031\uffd1\051\uffd1\056\uffd1\001" +
"\002\000\016\002\uffd0\025\uffd0\026\uffd0\031\uffd0\051\uffd0" +
"\056\uffd0\001\002\000\004\047\137\001\002\000\072\002" +
"\uffaa\017\uffaa\020\uffaa\024\uffaa\025\uffaa\026\uffaa\030\uffaa" +
"\031\uffaa\047\uffaa\051\uffaa\052\uffaa\053\uffaa\054\uffaa\055" +
"\uffaa\056\uffaa\057\uffaa\061\uffaa\062\uffaa\063\uffaa\064\uffaa" +
"\065\uffaa\066\uffaa\067\uffaa\070\uffaa\071\uffaa\072\uffaa\073" +
"\uffaa\074\uffaa\001\002\000\072\002\uffb2\017\uffb2\020\uffb2" +
"\024\uffb2\025\uffb2\026\uffb2\030\uffb2\031\uffb2\047\uffb2\051" +
"\uffb2\052\120\053\uffb2\054\uffb2\055\121\056\uffb2\057\117" +
"\061\uffb2\062\uffb2\063\uffb2\064\uffb2\065\uffb2\066\uffb2\067" +
"\uffb2\070\uffb2\071\uffb2\072\uffb2\073\uffb2\074\uffb2\001\002" +
"\000\016\002\uffce\025\uffce\026\uffce\031\uffce\051\uffce\056" +
"\uffce\001\002\000\004\024\143\001\002\000\060\004\051" +
"\005\043\006\055\007\036\013\034\014\057\016\041\021" +
"\025\023\031\025\uffe0\026\uffe0\027\052\032\030\040\035" +
"\041\054\042\050\043\022\045\047\046\044\050\026\056" +
"\uffe0\063\040\064\020\001\002\000\010\025\145\026\146" +
"\056\127\001\002\000\056\004\051\005\043\006\055\007" +
"\036\013\034\014\057\016\041\021\025\023\031\026\uffe0" +
"\027\052\032\030\040\035\041\054\042\050\043\022\045" +
"\047\046\044\050\026\056\uffe0\063\040\064\020\001\002" +
"\000\016\002\uffd3\025\uffd3\026\uffd3\031\uffd3\051\uffd3\056" +
"\uffd3\001\002\000\006\026\150\056\127\001\002\000\016" +
"\002\uffd2\025\uffd2\026\uffd2\031\uffd2\051\uffd2\056\uffd2\001" +
"\002\000\004\046\152\001\002\000\034\004\051\005\043" +
"\006\055\007\036\013\034\014\057\016\041\021\025\046" +
"\044\047\uffc7\054\uffc7\063\040\064\020\001\002\000\006" +
"\047\156\054\155\001\002\000\006\047\uffc8\054\uffc8\001" +
"\002\000\030\004\051\005\043\006\055\007\036\013\034" +
"\014\057\016\041\021\025\046\044\063\040\064\020\001" +
"\002\000\016\002\uffcb\025\uffcb\026\uffcb\031\uffcb\051\uffcb" +
"\056\uffcb\001\002\000\006\047\uffc9\054\uffc9\001\002\000" +
"\004\051\161\001\002\000\020\002\uffca\025\uffca\026\uffca" +
"\031\uffca\051\uffca\056\uffca\075\uffca\001\002\000\064\002" +
"\uffb3\017\uffb3\020\uffb3\024\uffb3\025\uffb3\026\uffb3\030\uffb3" +
"\031\uffb3\047\uffb3\051\uffb3\053\uffb3\054\uffb3\056\uffb3\061" +
"\uffb3\062\uffb3\063\uffb3\064\uffb3\065\uffb3\066\uffb3\067\uffb3" +
"\070\uffb3\071\uffb3\072\uffb3\073\uffb3\074\uffb3\001\002\000" +
"\016\002\uffcf\025\uffcf\026\uffcf\031\uffcf\051\uffcf\056\uffcf" +
"\001\002\000\072\002\uffac\017\uffac\020\uffac\024\uffac\025" +
"\uffac\026\uffac\030\uffac\031\uffac\047\uffac\051\uffac\052\uffac" +
"\053\uffac\054\uffac\055\uffac\056\uffac\057\uffac\061\uffac\062" +
"\uffac\063\uffac\064\uffac\065\uffac\066\uffac\067\uffac\070\uffac" +
"\071\uffac\072\uffac\073\uffac\074\uffac\001\002\000\004\052" +
"\213\001\002\000\006\004\ufff0\060\ufff0\001\002\000\004" +
"\004\212\001\002\000\006\004\uffee\060\uffee\001\002\000" +
"\006\004\uffea\060\uffea\001\002\000\006\004\uffec\060\uffec" +
"\001\002\000\006\004\uffeb\060\uffeb\001\002\000\004\050" +
"\202\001\002\000\006\004\uffed\060\uffed\001\002\000\022" +
"\004\172\010\166\011\175\012\170\015\177\034\174\035" +
"\165\037\176\001\002\000\006\004\uffef\060\uffef\001\002" +
"\000\006\004\uffe9\060\uffe9\001\002\000\006\004\uffe3\060" +
"\uffe3\001\002\000\022\004\172\010\166\011\175\012\170" +
"\015\177\034\174\035\165\037\176\001\002\000\004\004" +
"\211\001\002\000\006\051\206\056\207\001\002\000\006" +
"\051\uffe5\056\uffe5\001\002\000\006\004\uffe7\060\uffe7\001" +
"\002\000\022\004\172\010\166\011\175\012\170\015\177" +
"\034\174\035\165\037\176\001\002\000\006\051\uffe6\056" +
"\uffe6\001\002\000\006\051\uffe4\056\uffe4\001\002\000\006" +
"\056\ufff7\075\ufff7\001\002\000\004\005\214\001\002\000" +
"\004\053\215\001\002\000\004\036\216\001\002\000\022" +
"\004\172\010\166\011\175\012\170\015\177\034\174\035" +
"\165\037\176\001\002\000\006\004\uffe8\060\uffe8\001\002" +
"\000\004\046\221\001\002\000\026\004\172\010\166\011" +
"\175\012\170\015\177\034\174\035\165\037\176\047\ufff3" +
"\054\ufff3\001\002\000\006\004\232\060\231\001\002\000" +
"\006\047\226\054\225\001\002\000\006\047\ufff4\054\ufff4" +
"\001\002\000\022\004\172\010\166\011\175\012\170\015" +
"\177\034\174\035\165\037\176\001\002\000\004\050\026" +
"\001\002\000\006\056\ufff6\075\ufff6\001\002\000\006\047" +
"\ufff5\054\ufff5\001\002\000\004\004\233\001\002\000\006" +
"\047\ufff1\054\ufff1\001\002\000\006\047\ufff2\054\ufff2\001" +
"\002\000\004\004\235\001\002\000\006\056\ufff8\075\ufff8" +
"\001\002\000\060\002\uffff\004\uffff\005\uffff\006\uffff\007" +
"\uffff\013\uffff\014\uffff\016\uffff\021\uffff\023\uffff\027\uffff" +
"\032\uffff\040\uffff\041\uffff\042\uffff\043\uffff\045\uffff\046" +
"\uffff\050\uffff\051\uffff\056\uffff\063\uffff\064\uffff\001\002" +
"\000\010\022\012\033\013\044\011\001\002\000\006\056" +
"\ufffd\075\ufffd\001\002" });
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
"\000\236\000\020\002\014\003\013\004\007\005\006\006" +
"\005\007\004\010\003\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\012\013\233\014\172\015\170\016\177\001\001" +
"\000\002\001\001\000\012\013\166\014\172\015\170\016" +
"\177\001\001\000\054\021\052\022\031\023\016\024\022" +
"\025\036\026\020\027\023\030\041\031\044\032\026\033" +
"\060\034\032\035\045\041\066\042\065\043\064\044\063" +
"\045\062\046\061\047\057\050\055\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\006\047\163" +
"\050\055\001\001\000\002\001\001\000\022\041\162\042" +
"\065\043\064\044\063\045\062\046\061\047\057\050\055" +
"\001\001\000\002\001\001\000\002\001\001\000\012\045" +
"\161\046\061\047\057\050\055\001\001\000\020\002\157" +
"\003\013\004\007\005\006\006\005\007\004\010\003\001" +
"\001\000\002\001\001\000\002\001\001\000\022\041\141" +
"\042\065\043\064\044\063\045\062\046\061\047\057\050" +
"\055\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\022\041\140\042\065\043\064\044\063\045" +
"\062\046\061\047\057\050\055\001\001\000\002\001\001" +
"\000\002\001\001\000\010\046\137\047\057\050\055\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\022\041\135\042\065\043\064\044\063\045\062\046" +
"\061\047\057\050\055\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\022\041\134\042\065\043" +
"\064\044\063\045\062\046\061\047\057\050\055\001\001" +
"\000\002\001\001\000\022\041\130\042\065\043\064\044" +
"\063\045\062\046\061\047\057\050\055\001\001\000\002" +
"\001\001\000\022\041\125\042\065\043\064\044\063\045" +
"\062\046\061\047\057\050\055\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\004\040\112\001\001" +
"\000\002\001\001\000\004\037\100\001\001\000\002\001" +
"\001\000\002\001\001\000\022\041\070\042\065\043\064" +
"\044\063\045\062\046\061\047\057\050\055\001\001\000" +
"\002\001\001\000\022\041\110\042\065\043\064\044\063" +
"\045\062\046\061\047\057\050\055\001\001\000\016\043" +
"\107\044\063\045\062\046\061\047\057\050\055\001\001" +
"\000\020\042\106\043\064\044\063\045\062\046\061\047" +
"\057\050\055\001\001\000\016\043\075\044\063\045\062" +
"\046\061\047\057\050\055\001\001\000\004\037\100\001" +
"\001\000\002\001\001\000\002\001\001\000\014\044\105" +
"\045\062\046\061\047\057\050\055\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\004\037\100\001" +
"\001\000\002\001\001\000\002\001\001\000\012\045\115" +
"\046\061\047\057\050\055\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\022" +
"\041\122\042\065\043\064\044\063\045\062\046\061\047" +
"\057\050\055\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\052\022\127\023\016\024\022\025\036" +
"\026\020\027\023\030\041\031\044\032\026\033\060\034" +
"\032\035\045\041\066\042\065\043\064\044\063\045\062" +
"\046\061\047\057\050\055\001\001\000\002\001\001\000" +
"\002\001\001\000\054\021\132\022\031\023\016\024\022" +
"\025\036\026\020\027\023\030\041\031\044\032\026\033" +
"\060\034\032\035\045\041\066\042\065\043\064\044\063" +
"\045\062\046\061\047\057\050\055\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\054\021\143\022\031\023\016\024\022" +
"\025\036\026\020\027\023\030\041\031\044\032\026\033" +
"\060\034\032\035\045\041\066\042\065\043\064\044\063" +
"\045\062\046\061\047\057\050\055\001\001\000\002\001" +
"\001\000\054\021\146\022\031\023\016\024\022\025\036" +
"\026\020\027\023\030\041\031\044\032\026\033\060\034" +
"\032\035\045\041\066\042\065\043\064\044\063\045\062" +
"\046\061\047\057\050\055\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\024" +
"\036\152\041\153\042\065\043\064\044\063\045\062\046" +
"\061\047\057\050\055\001\001\000\002\001\001\000\002" +
"\001\001\000\022\041\156\042\065\043\064\044\063\045" +
"\062\046\061\047\057\050\055\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\012\013\200\014" +
"\172\015\170\016\177\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\016\013\202\014\172\015" +
"\170\016\177\017\203\020\204\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\014\013\202\014\172\015\170\016\177\020\207\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\012" +
"\013\216\014\172\015\170\016\177\001\001\000\002\001" +
"\001\000\002\001\001\000\016\011\222\012\223\013\221" +
"\014\172\015\170\016\177\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\014\012\227\013\221" +
"\014\172\015\170\016\177\001\001\000\004\035\226\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\012\005\237\006\005" +
"\007\004\010\003\001\001\000\002\001\001" });
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$AnalizadorSintacticoAsc$actions action_obj;
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$AnalizadorSintacticoAsc$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$AnalizadorSintacticoAsc$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
/** User initialization code. */
public void user_init() throws java.lang.Exception
{
errores = new GestionErrores();
AnalizadorLexico alex = (AnalizadorLexico) getScanner();
alex.fijaGestionErrores(errores);
}
/** Scan to get the next Symbol. */
public java_cup.runtime.Symbol scan()
throws java.lang.Exception
{
return getScanner().next_token();
}
private GestionErrores errores;
public void syntax_error(Symbol unidadLexica){
errores.errorSintactico((UnidadLexica) unidadLexica);
}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$AnalizadorSintacticoAsc$actions {
private TinyASint asint = new TinyASint();
private final AnalizadorSintacticoAsc parser;
/** Constructor */
CUP$AnalizadorSintacticoAsc$actions(AnalizadorSintacticoAsc parser) {
this.parser = parser;
}
/** Method 0 with the actual generated action code for actions 0 to 300. */
public final java_cup.runtime.Symbol CUP$AnalizadorSintacticoAsc$do_action_part00000000(
int CUP$AnalizadorSintacticoAsc$act_num,
java_cup.runtime.lr_parser CUP$AnalizadorSintacticoAsc$parser,
java.util.Stack CUP$AnalizadorSintacticoAsc$stack,
int CUP$AnalizadorSintacticoAsc$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$AnalizadorSintacticoAsc$result;
/* select the action based on the action number */
switch (CUP$AnalizadorSintacticoAsc$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // Prog ::= Decs Insts
{
Prog RESULT =null;
Decs decs = (Decs)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
Insts insts = (Insts)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.prog(decs, insts);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Prog",0, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= Prog EOF
{
Object RESULT =null;
Prog start_val = (Prog)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = start_val;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("$START",0, RESULT);
}
/* ACCEPT */
CUP$AnalizadorSintacticoAsc$parser.done_parsing();
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // Decs ::= LDec SEPSECCION
{
Decs RESULT =null;
Decs decs = (Decs)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.auxDecs(decs);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Decs",1, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // Decs ::=
{
Decs RESULT =null;
RESULT = asint.noDecs;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Decs",1, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // LDec ::= LDec PUNTOCOMA Dec
{
Decs RESULT =null;
Decs decs = (Decs)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Dec dec = (Dec)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.decComp(decs, dec);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("LDec",2, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // LDec ::= Dec
{
Decs RESULT =null;
Dec dec = (Dec)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.decSimp(dec);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("LDec",2, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // Dec ::= DVar
{
Dec RESULT =null;
Dec dec = (Dec)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = dec;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Dec",3, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // Dec ::= DTipo
{
Dec RESULT =null;
Dec dec = (Dec)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = dec;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Dec",3, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // Dec ::= DProc
{
Dec RESULT =null;
Dec dec = (Dec)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = dec;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Dec",3, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // DVar ::= VAR Tipo IDEN
{
Dec RESULT =null;
Tipo tipo = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.dVar(tipo, id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("DVar",4, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // DTipo ::= TYPE Tipo IDEN
{
Dec RESULT =null;
Tipo tipo = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.dTipo(tipo, id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("DTipo",5, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // DProc ::= PROC IDEN PAP Pars PCIE Bloque
{
Dec RESULT =null;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-4)).value;
Pars pars = (Pars)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Inst bloque = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.dProc(id, pars, bloque);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("DProc",6, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // Pars ::= Pars COMA Par
{
Pars RESULT =null;
Pars pars = (Pars)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Par par = (Par)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.parsComp(pars, par);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Pars",7, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 13: // Pars ::= Par
{
Pars RESULT =null;
Par par = (Par)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.parsSimp(par);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Pars",7, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 14: // Pars ::=
{
Pars RESULT =null;
RESULT=asint.noPars;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Pars",7, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 15: // Par ::= Tipo AMP IDEN
{
Par RESULT =null;
Tipo tipo = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.parRef(tipo, id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Par",8, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 16: // Par ::= Tipo IDEN
{
Par RESULT =null;
Tipo tipo = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.parSinRef(tipo, id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Par",8, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 17: // Tipo ::= INT
{
Tipo RESULT =null;
RESULT = asint.TypeInt;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 18: // Tipo ::= REAL
{
Tipo RESULT =null;
RESULT = asint.TypeReal;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 19: // Tipo ::= BOOL
{
Tipo RESULT =null;
RESULT = asint.TypeBool;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 20: // Tipo ::= STRING
{
Tipo RESULT =null;
RESULT = asint.TypeString;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 21: // Tipo ::= IDEN
{
Tipo RESULT =null;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.idenTipo(id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 22: // Tipo ::= Array
{
Tipo RESULT =null;
Tipo array = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = array;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 23: // Tipo ::= Registro
{
Tipo RESULT =null;
Tipo reg = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = reg;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 24: // Tipo ::= Pointer
{
Tipo RESULT =null;
Tipo ptr = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = ptr;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Tipo",9, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 25: // Array ::= ARR CAP ENT CCIE OF Tipo
{
Tipo RESULT =null;
StringLocalizado ent = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-3)).value;
Tipo tipo = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.array(ent, tipo);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Array",10, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 26: // Registro ::= RECORD LLAP Campos LLCIE
{
Tipo RESULT =null;
Campos campos = (Campos)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.registro(campos);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Registro",11, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 27: // Campos ::= Campos PUNTOCOMA Campo
{
Campos RESULT =null;
Campos campos = (Campos)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Campo campo = (Campo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.camposComp(campos, campo);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Campos",13, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 28: // Campos ::= Campo
{
Campos RESULT =null;
Campo campo = (Campo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.camposSimp(campo);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Campos",13, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 29: // Campo ::= Tipo IDEN
{
Campo RESULT =null;
Tipo tipo = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.campo(tipo, id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Campo",14, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 30: // Pointer ::= PTR Tipo
{
Tipo RESULT =null;
Tipo tipo = (Tipo)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.pointer(tipo);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Pointer",12, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 31: // Insts ::= Insts PUNTOCOMA Inst
{
Insts RESULT =null;
Insts insts = (Insts)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.instsComp(insts, inst);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Insts",15, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 32: // Insts ::= Inst
{
Insts RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.instsSimp(inst);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Insts",15, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 33: // Insts ::=
{
Insts RESULT =null;
RESULT = asint.noInsts;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Insts",15, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 34: // Inst ::= IAsig
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 35: // Inst ::= IIfThen
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 36: // Inst ::= IIfThenElse
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 37: // Inst ::= IWhile
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 38: // Inst ::= IRead
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 39: // Inst ::= IWrite
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 40: // Inst ::= INew
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 41: // Inst ::= IDelete
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 42: // Inst ::= ICall
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 43: // Inst ::= Bloque
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 44: // Inst ::= Inl
{
Inst RESULT =null;
Inst inst = (Inst)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = inst;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inst",16, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 45: // IAsig ::= E0 IGUAL E0
{
Inst RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.iAsig(e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("IAsig",17, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 46: // IIfThen ::= IF E0 THEN Insts ENDIF
{
Inst RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-3)).value;
Insts insts = (Insts)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.iIfThen(e, insts);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("IIfThen",18, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 47: // IIfThenElse ::= IF E0 THEN Insts ELSE Insts ENDIF
{
Inst RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-5)).value;
Insts insts1 = (Insts)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-3)).value;
Insts insts2 = (Insts)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.iIfThenElse(e, insts1, insts2);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("IIfThenElse",19, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 48: // IWhile ::= WHILE E0 DO Insts ENDWHILE
{
Inst RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-3)).value;
Insts insts = (Insts)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.iWhile(e, insts);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("IWhile",20, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 49: // IRead ::= READ E0
{
Inst RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.iRead(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("IRead",21, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 50: // IWrite ::= WRITE E0
{
Inst RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.iWrite(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("IWrite",22, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 51: // INew ::= NEW E0
{
Inst RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.iNew(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("INew",23, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 52: // IDelete ::= DEL E0
{
Inst RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.iDelete(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("IDelete",24, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 53: // Inl ::= NL
{
Inst RESULT =null;
RESULT = asint.iNl();
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Inl",26, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 54: // ICall ::= CALL IDEN PAP Exps PCIE
{
Inst RESULT =null;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-3)).value;
Exps exps = (Exps)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.iCall(id, exps);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("ICall",25, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 55: // Bloque ::= LLAP Prog LLCIE
{
Inst RESULT =null;
Prog prog = (Prog)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.bloque(prog);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Bloque",27, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 56: // Exps ::= Exps COMA E0
{
Exps RESULT =null;
Exps exps = (Exps)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Exp exp = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.exps1(exps, exp);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Exps",28, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 57: // Exps ::= E0
{
Exps RESULT =null;
Exp exp = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.exps0(exp);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Exps",28, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 58: // Exps ::=
{
Exps RESULT =null;
RESULT = asint.noExps;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Exps",28, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 59: // Cmp ::= LT
{
String RESULT =null;
RESULT = "<";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Cmp",29, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 60: // Cmp ::= GT
{
String RESULT =null;
RESULT = ">";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Cmp",29, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 61: // Cmp ::= GE
{
String RESULT =null;
RESULT = ">=";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Cmp",29, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 62: // Cmp ::= LE
{
String RESULT =null;
RESULT = "<=";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Cmp",29, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 63: // Cmp ::= EQ
{
String RESULT =null;
RESULT = "==";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Cmp",29, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 64: // Cmp ::= NE
{
String RESULT =null;
RESULT = "!=";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Cmp",29, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 65: // Op3NA ::= POR
{
String RESULT =null;
RESULT = "*";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Op3NA",30, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 66: // Op3NA ::= DIV
{
String RESULT =null;
RESULT = "/";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Op3NA",30, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 67: // Op3NA ::= MOD
{
String RESULT =null;
RESULT = "%";
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("Op3NA",30, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 68: // E0 ::= E1 MAS E0
{
Exp RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.suma(e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E0",31, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 69: // E0 ::= E1 MENOS E1
{
Exp RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.resta(e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E0",31, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 70: // E0 ::= E1
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = e;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E0",31, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 71: // E1 ::= E1 AND E2
{
Exp RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.and(e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E1",32, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 72: // E1 ::= E1 OR E2
{
Exp RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.or(e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E1",32, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 73: // E1 ::= E2
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = e;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E1",32, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 74: // E2 ::= E2 Cmp E3
{
Exp RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
String cmp = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.cmp(cmp, e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E2",33, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 75: // E2 ::= E3
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = e;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E2",33, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 76: // E3 ::= E4 Op3NA E4
{
Exp RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
String op = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.op3na(op, e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E3",34, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 77: // E3 ::= E4
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = e;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E3",34, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 78: // E4 ::= NOT E4
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.not(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E4",35, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 79: // E4 ::= MENOS E5
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.neg(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E4",35, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 80: // E4 ::= E5
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = e;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E4",35, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 81: // E5 ::= E5 CAP E0 CCIE
{
Exp RESULT =null;
Exp e0 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-3)).value;
Exp e1 = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.index(e0, e1);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E5",36, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 82: // E5 ::= E5 PUNTO IDEN
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.atr(e, id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E5",36, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 83: // E5 ::= E5 FLECHA IDEN
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-2)).value;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.ptr(e, id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E5",36, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 84: // E5 ::= E6
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = e;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E5",36, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 85: // E6 ::= POR E6
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.indir(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E6",37, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 86: // E6 ::= E7
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = e;
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E6",37, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 87: // E7 ::= PAP E0 PCIE
{
Exp RESULT =null;
Exp e = (Exp)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.elementAt(CUP$AnalizadorSintacticoAsc$top-1)).value;
RESULT = asint.parentesis(e);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 88: // E7 ::= ENT
{
Exp RESULT =null;
StringLocalizado ent = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.ent(ent);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 89: // E7 ::= LREAL
{
Exp RESULT =null;
StringLocalizado lreal = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.lreal(lreal);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 90: // E7 ::= TRUE
{
Exp RESULT =null;
StringLocalizado t = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.ttrue(t);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 91: // E7 ::= FALSE
{
Exp RESULT =null;
StringLocalizado f = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.ffalse(f);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 92: // E7 ::= CADENA
{
Exp RESULT =null;
StringLocalizado cad = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.cadena(cad);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 93: // E7 ::= IDEN
{
Exp RESULT =null;
StringLocalizado id = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.idenExp(id);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 94: // E7 ::= NULL
{
Exp RESULT =null;
StringLocalizado n = (StringLocalizado)((java_cup.runtime.Symbol) CUP$AnalizadorSintacticoAsc$stack.peek()).value;
RESULT = asint.nnull(n);
CUP$AnalizadorSintacticoAsc$result = parser.getSymbolFactory().newSymbol("E7",38, RESULT);
}
return CUP$AnalizadorSintacticoAsc$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number "+CUP$AnalizadorSintacticoAsc$act_num+"found in internal parse table");
}
} /* end of method */
/** Method splitting the generated action code into several parts. */
public final java_cup.runtime.Symbol CUP$AnalizadorSintacticoAsc$do_action(
int CUP$AnalizadorSintacticoAsc$act_num,
java_cup.runtime.lr_parser CUP$AnalizadorSintacticoAsc$parser,
java.util.Stack CUP$AnalizadorSintacticoAsc$stack,
int CUP$AnalizadorSintacticoAsc$top)
throws java.lang.Exception
{
return CUP$AnalizadorSintacticoAsc$do_action_part00000000(
CUP$AnalizadorSintacticoAsc$act_num,
CUP$AnalizadorSintacticoAsc$parser,
CUP$AnalizadorSintacticoAsc$stack,
CUP$AnalizadorSintacticoAsc$top);
}
}
|
package com.nastenkapusechka.validation.analyzers;
import com.nastenkapusechka.validation.annotaions.CardNumber;
import com.nastenkapusechka.validation.util.AnnotationName;
import com.nastenkapusechka.validation.util.exceptions.CardNumberException;
import java.lang.reflect.Field;
/**
* This analyzer checks the validity of the card
* (bank, insurance policy, it doesn't matter) using
* an algorithm Luna
* @see CardNumberAnalyzer#algorithmLuna(int[])
* @see CardNumber
*/
@AnnotationName(CardNumber.class)
public class CardNumberAnalyzer implements AnnotationAnalyzer{
private static int countIndex;
/**
*
* @param array is an array of digits from the card
* @return true if such a card exists, otherwise false
*/
private boolean algorithmLuna(int[] array) {
for (int i = 0; i < array.length - 1; i = i + 2) {
array[i] *= 2;
}
for (int i = 0; i < array.length - 1; i++) {
if (array[i] > 9) {
array[i] = array[i] - 9;
}
}
int sum = 0;
for (int j : array) {
sum += j;
}
return sum % 10 == 0;
}
/**
*
* @param field annotated field
* @param obj the object of the class that this field belongs to
* @return true, if field is valid, otherwise exception
* @see AnnotationAnalyzer#validate(Field, Object)
* @throws CardNumberException if cardNumber does not matches the annotation @CardNumber
* @throws NullPointerException if string is null
*/
@Override
public boolean validate(Field field, Object obj) throws CardNumberException {
countIndex = 1;
if (field == null || obj == null) throw new NullPointerException();
String msg = printPlace(field, obj) + "Doesn't match annotation @CardNumber";
String cardNumber;
field.setAccessible(true);
try {
if (field.get(obj) == null) throw new NullPointerException();
CardNumber annotation = field.getDeclaredAnnotation(CardNumber.class);
Object[] objects = convert(field, obj, annotation.mapTarget());
if (objects != null) {
recursive(objects, field.getName());
} else if (field.get(obj) instanceof String) {
cardNumber = (String) field.get(obj);
check(cardNumber, msg);
} else {
cardNumber = String.valueOf(field.get(obj));
check(cardNumber, msg);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
return false;
}
return true;
}
/**
*
* @param array an array of objects to be checked recursively
* according to the annotation (for example, array, list, set, or map)
* @param name the name of the field required to enter information
* about it and the number of its element in the exception message in case of failure.
*
* @see AnnotationAnalyzer#recursive(Object[], String)
* @throws CardNumberException if cardNumber does not matches the annotation @CardNumber
* @throws NullPointerException if string is null
*/
@Override
public void recursive(Object[] array, String name) throws CardNumberException{
String place = "Field: " + name + " element #" + countIndex;
String msg = "is not card number";
if (array.length == 0) return;
String cardNumber;
if (array[0] instanceof String) {
cardNumber = (String) array[0];
check(cardNumber, place + " " + msg);
} else if (array[0] instanceof Number) {
cardNumber = String.valueOf(array[0]);
check(cardNumber, place + " " + msg);
}
countIndex++;
Object[] temp = new Object[array.length - 1];
System.arraycopy(array, 1, temp, 0, temp.length);
recursive(temp, name);
}
/**
*
* @param cardNumber a verification string containing the card number
* @param msg a message for CardNumberException
* @throws CardNumberException if cardNumber not matches the annotation @CardNumber
* @throws NullPointerException if string is null
*
*/
private void check(String cardNumber, String msg) throws CardNumberException {
if (cardNumber == null) throw new NullPointerException(msg);
//remove all unnecessary
String[] digits = cardNumber.trim()
.replaceAll(" ", "")
.replaceAll("\\.", "")
.replaceAll(",", "")
.replaceAll("_", "")
.replaceAll("-", "")
.split("");
//No card numbers shorter than 13 digits or longer than 19
if (digits.length < 13 || digits.length > 19) throw new CardNumberException(msg);
//convert to numbers
int[] numbers = new int[digits.length];
for (int i = 0; i < digits.length; i++) {
numbers[i] = Integer.parseInt(digits[i]);
}
if (!algorithmLuna(numbers)) throw new CardNumberException(msg);
}
}
|
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.model.trasient.ged.tipos;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name="item")
public class ItemGED {
private List<Campo> campos;
private String PID;
private String link;
private boolean isPasta;
private String numeroVersao;
private String nomeItemType;
@XmlElementWrapper(name = "campos")
@XmlElement(name = "campo")
public List<Campo> getCampos() {
return campos;
}
public void setCampos(List<Campo> campos) {
this.campos = campos;
}
@XmlElement(name = "pid")
public String getPID() {
return PID;
}
public void setPID(String pID) {
PID = pID;
}
@XmlElement(name = "link")
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
@XmlElement(name = "pasta")
public boolean isPasta() {
return isPasta;
}
public void setPasta(boolean isPasta) {
this.isPasta = isPasta;
}
@XmlElement(name = "versao")
public String getNumeroVersao() {
return numeroVersao;
}
public void setNumeroVersao(String numeroVersao) {
this.numeroVersao = numeroVersao;
}
@XmlElement(name = "item-type")
public String getNomeItemType() {
return nomeItemType;
}
public void setNomeItemType(String nomeItemType) {
this.nomeItemType = nomeItemType;
}
}
|
package oop2;
import java.util.Scanner;
public class BankingDemo2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Banking[] bankings = new Banking[5];
int savePosition = 0;
while (true) {
System.out.println("=======================================================");
System.out.println("1.신규\t2.조회\t3.입금\t4.출금\t5.비밀번호 변경\t6.해지\t0.종료");
System.out.println("=======================================================");
System.out.print("메뉴를 선택하세요(0~6): ");
int menu = scanner.nextInt();
if (menu == 0) {
System.out.println("프로그램을 종료합니다.");
System.out.println("=======================================================");
break;
} else if (menu == 1) {
Banking bank = new Banking();
System.out.println("================== 신규 ==================");
System.out.print("이름을 입력하세요: ");
bank.name = scanner.next();
System.out.print("계좌 번호를 입력하세요: ");
bank.accountNo = scanner.next();
System.out.print("비밀번호를 입력하세요: ");
bank.password = scanner.nextInt();
System.out.print("잔액을 입력하세요: ");
bank.balance = scanner.nextLong();
bankings[bank.savePosition] = bank;
savePosition++;
} else if (menu == 2) {
Banking personalBank = new Banking(savePosition);
System.out.println("================== 조회 ==================");
System.out.print("계좌 번호를 입력하세요: ");
personalBank.findAccount = scanner.next();
personalBank.display(bankings, personalBank);
} else if (menu == 3) {
Banking personalBank = new Banking(savePosition);
System.out.println("================== 입금 ==================");
System.out.print("계좌 번호를 입력하세요: ");
personalBank.findAccount = scanner.next();
System.out.print("입금할 금액을 입력하세요: ");
long inputMoney = scanner.nextLong();
personalBank.deposit(bankings, personalBank,inputMoney);
} else if (menu == 4) {
Banking personalBank = new Banking(savePosition);
System.out.println("================== 출금 ==================");
System.out.print("계좌 번호를 입력하세요: ");
personalBank.findAccount = scanner.next();
System.out.print("출금할 금액을 입력하세요: ");
long outputMoney = scanner.nextLong();
System.out.print("비밀번호를 입력하세요: ");
int inputPassword = scanner.nextInt();
personalBank.withdraw(bankings, personalBank, outputMoney, inputPassword);
} else if (menu == 5) {
Banking personalBank = new Banking(savePosition);
System.out.println("================== 비밀번호 변경 ==================");
System.out.print("계좌 번호를 입력하세요: ");
personalBank.findAccount = scanner.next();
System.out.print("기존의 비밀번호를 입력하세요: ");
int oldPwd = scanner.nextInt();
System.out.print("새 비밀번호를 입력하세요: ");
int newPwd = scanner.nextInt();
personalBank.changePassword(bankings, personalBank, oldPwd, newPwd);
} else if (menu == 6) {
Banking personalBank = new Banking(savePosition);
System.out.println("================== 해지 ==================");
System.out.print("계좌 번호를 입력하세요: ");
personalBank.findAccount = scanner.next();
System.out.print("비밀번호를 입력하세요: ");
int inputPassword = scanner.nextInt();
personalBank.closeAccount(bankings, personalBank, inputPassword);
}
} // while end
scanner.close();
}// main ed
}
|
package smart.lib.session;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.time.Duration;
import java.util.Map;
/**
* session interface
*/
public interface BaseSession {
// 过期时间
public static Duration TIMEOUT = Duration.ofHours(48);
/**
* 生成 session id
*
* @return session id
*/
static String generalId() {
return new BigInteger(SecureRandom.getSeed(64)).abs().toString(36);
}
/**
* 销毁会话信息
*/
void destroy();
/**
* get value by ke
*
* @param key session key
* @return session value
*/
Object get(String key);
/**
* get all data
*
* @return all data
*/
Map<String, Object> getAll();
/**
* 获取session id
*
* @param canCreate create if not exist
* @return session
*/
String getId(boolean canCreate);
/**
* delete key
*
* @param keys keys
*/
void delete(String... keys);
/**
* set key value
*
* @param key session key
* @param value session value
*/
void set(String key, Object value);
}
|
package com.merkudzo.gunsinformations;
import android.app.Fragment;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.Nullable;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
public class DataBaseHelper extends SQLiteOpenHelper {
// özüm bilərəkdən handgun seçmişəm çünki "landscape" moda keçdikdə default olaraq handgun açılsın deyə
public static String typeFirearm="handgun"; // bunun vasitəsilə ümumi data-dan type-ın təyin edib məlumat çəkirəm həm də
// GunListLayoutda hansı səhifəyə girirəmsə title-da onun adı çıxır.
public static int[] handgun_picture_id={R.drawable.handgun_01, R.drawable.handgun_02, R.drawable.handgun_03, R.drawable.handgun_04,
R.drawable.handgun_05, R.drawable.handgun_06, R.drawable.handgun_07,R.drawable.handgun_08,R.drawable.handgun_09,
R.drawable.handgun_10,R.drawable.handgun_12,R.drawable.handgun_13,R.drawable.handgun_14,R.drawable.handgun_15,
R.drawable.handgun_16,R.drawable.handgun_17,R.drawable.handgun_18,R.drawable.handgun_19,R.drawable.handgun_20,
R.drawable.handgun_21,R.drawable.handgun_22,R.drawable.handgun_23,R.drawable.handgun_24};
public static int[] rifle_picture_id={R.drawable.rifle_45, R.drawable.rifle_46, R.drawable.rifle_47};
public static int[] assault_rifle_picture_id={R.drawable.assault_rifle_35, R.drawable.assault_rifle_36, R.drawable.assault_rifle_37,
R.drawable.assault_rifle_38, R.drawable.assault_rifle_39, R.drawable.assault_rifle_40, R.drawable.assault_rifle_41,
R.drawable.assault_rifle_42, R.drawable.assault_rifle_43, R.drawable.assault_rifle_44};
public static int[] sniper_rifle_picture_id={R.drawable.sniper_rifle_25, R.drawable.sniper_rifle_26, R.drawable.sniper_rifle_27,
R.drawable.sniper_rifle_28, R.drawable.sniper_rifle_29, R.drawable.sniper_rifle_30, R.drawable.sniper_rifle_31,
R.drawable.sniper_rifle_32, R.drawable.sniper_rifle_33, R.drawable.sniper_rifle_34, R.drawable.sniper_rifle_48};
public DataBaseHelper(@Nullable Context context){
super(context, "guns.db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
/* String createTableStatement="CREATE TABLE \"firearm\" (\"id\" INTEGER NOT NULL UNIQUE, \"gun_name\" TEXT NOT NULL, \"gun_type\" TEXT NOT NULL, "+
"\"gun_place_of_origin\" TEXT NOT NULL, \"gun_designer\" TEXT NOT NULL, \"gun_manufacturer\" TEXT NOT NULL, "+
"\"gun_produced\" TEXT NOT NULL, \"gun_weight\" TEXT NOT NULL, \"gun_length\" TEXT NOT NULL, \"gun_caliber\" TEXT NOT NULL, "+
"\"type_firearm\" TEXT NOT NULL, \"gun_more_info\" TEXT)";
db.execSQL(createTableStatement); */
//nə zaman ki, aktiv olaraq bazaya nəsə yazıb silmək lazım olacaq onda buranı aktiv etmək olar.
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
public Cursor show(String type_firearm){
SQLiteDatabase db=this.getReadableDatabase();
String read="SELECT * FROM firearm WHERE type_firearm='"+type_firearm+"'";
Cursor cursor=db.rawQuery(read, null);
return cursor;
}
}
|
package com.isystk.sample.common.validator.annotation;
import static com.isystk.sample.common.util.ValidateUtils.isEmpty;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import lombok.extern.slf4j.Slf4j;
/**
* 入力チェック(電話番号)
*/
@Slf4j
public class PhoneNumberValidator implements ConstraintValidator<PhoneNumber, String> {
private Pattern pattern;
@Override
public void initialize(PhoneNumber phoneNumber) {
try {
pattern = Pattern.compile(phoneNumber.regexp());
} catch (PatternSyntaxException e) {
log.error("invalid regular expression.", e);
throw e;
}
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
boolean isValid = false;
if (isEmpty(value)) {
isValid = true;
} else {
Matcher m = pattern.matcher(value);
if (m.matches()) {
isValid = true;
}
}
return isValid;
}
}
|
package XmlCsvApi;
//import XmlCsvApi.Main.initWorker;
import XmlCsvApi.model.FileQueue;
import XmlCsvApi.model.XmlCsvModel;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.control.*;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.List;
//import java.util.logging.Logger;
//import java.util.logging.Level;
/******
* DynamicBarChart.java
*****/
public class Controller implements Initializable {
public static boolean instanteParse = false;
public static boolean XMLon = false;
public static boolean JSONon = false;
public static boolean CSVon = false;
public static boolean XMLtoFile = false;
public static boolean JSONtoFile = false;
public static boolean CSVtoFile = false;
public XmlCsvJson xml;
public int[] wordCountArray = new int[21];
@FXML
public ToggleGroup ToggleRadioInput;
@FXML
public ToggleGroup outToggleGroup;
@FXML
public Label labelMainArea;
@FXML
public Button buttonLoadFrom;
@FXML
public Button buttonOpenFiles;
@FXML
public Button buttonOutputFile;
@FXML
public Button openWork;
@FXML
public Button BT1;
@FXML
public Button BT2;
@FXML
public Button BT3;
@FXML
public Button BT4;
@FXML
public Button BT5;
@FXML
public Button BT6;
@FXML
public Button BT7;
@FXML
public Button button3;
@FXML
public Button button4;
@FXML
public TextField textFieldOut;
@FXML
public TextField textFieldTop;
@FXML
public TextArea textAreaMain;
@FXML
public TextArea areaTEXT;
@FXML
public TextArea areaXML;
@FXML
public TextArea areaCSV;
@FXML
public TextArea areaJSON;
@FXML
public CheckBox checkboxJSON;
@FXML
public CheckBox checkboxCSV;
@FXML
public CheckBox checkboxXML;
@FXML
public VBox vboxJSON;
@FXML
public VBox vboxCSV;
@FXML
public VBox vboxXML;
TXTtoMODEL tomodel;
Boolean constantParing;
Main.PipesThreads runn;
private Main MA;
@FXML
private Label TEXT;
@FXML
private Label XML;
@FXML
private Label CSV;
@FXML
private Label JSON;
@FXML
private Label STATUS;
@FXML
private TableView<XmlCsvModel> dataTable;
@FXML
private TableColumn<XmlCsvModel, String> fileColumn;
@FXML
private TableColumn<XmlCsvModel, String> statusColumn;
private ObservableList<String> wordCounts = FXCollections.observableArrayList();
private XmlCsvModel xmlcsvmodel;
@FXML
private BarChart<String, Integer> barChart;
@FXML
private CategoryAxis xAxis;
private ObservableList<String> monthNames = FXCollections.observableArrayList();
private ObservableList<String> stringNumbers = FXCollections.observableArrayList();
// private ObservableList<FileQueue> FileQueueList = FXCollections.observableArrayList();
ThreadsRunner aaa;
runInputParserThread inputParser;
Parser parser;
Controller controller = this;
@FXML
private TableView<FileQueue> fileQueueTableView;
@FXML
private TableColumn<FileQueue, String> fileQueueColumn;
@FXML
private TableColumn<FileQueue, String> fileQueueColumn2;
// you want an InputStream that is a stream of bytes that represent your original string encoded as UTF-8.
// InputStream stream = new ByteArrayInputStream(exampleString.getBytes(StandardCharsets.UTF_8));
public Controller() {
}
public void setMain(Main MA) {
this.MA = MA;
}
public void toArea(String inputMessage) {
textAreaMain.appendText(inputMessage+"\n");
}
// ##########################################[ INIT PROCEDURE ]############################################# //
@Override
public void initialize(URL location, ResourceBundle resources) {
System.out.println("Initializing XmlCsvApi...");
textFieldTop.setVisible(false);
textFieldOut.setVisible(false);
buttonOpenFiles.setVisible(false);
buttonLoadFrom.setVisible(false);
buttonOutputFile.setVisible(false);
fileColumn.setCellValueFactory(cellData -> cellData.getValue().TEXTProperty());
statusColumn.setCellValueFactory(cellData -> cellData.getValue().STATUSProperty());
showDataDetails(null);
// Listen for selection changes and show the person details when changed.
dataTable.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> showDataDetails(newValue));
areaTEXT.setWrapText(true);
areaXML.setWrapText(true);
areaCSV.setWrapText(true);
areaJSON.setWrapText(true);
BT1.setDefaultButton(false);
fileQueueColumn.setCellValueFactory(cellData -> cellData.getValue().NAMEProperty());
// fileQueueTableView.getSelectionModel().selectedItemProperty().addListener(
// (observable, oldValue, newValue) -> showDataDetails(newValue));
String[] words = new String[21];
for (int i = 0; i < 21; i++) {
words[i] = String.valueOf(i);
}
stringNumbers.addAll(Arrays.asList(words));
xAxis.setCategories(stringNumbers);
}
//######################################################################################################################################
// public static void Keyboard() {
// String text;
// InputStreamReader isr = new InputStreamReader(System.in);
// BufferedReader br = new BufferedReader(isr);
// try {
// text = br.readLine(); //Reading String
// System.out.println(text);
// } catch (IOException e) {
// System.out.println("[-XmlCsvApi-]>ERROR");
// }
// }
// ##########################################[ SPLIT SENTENCES ]############################################# //
public void sentenceSplitter(String textInputKeys) {
try {
int charCount = textInputKeys.replaceAll("[^.]", "").length();
String[] sentenceArray = textInputKeys.split("\\. ");
int sortedLength = sentenceArray.length;
String[] sortedSentenceArray = new String[sortedLength];
XmlCsvJson xcj = new XmlCsvJson();
/*SORTED SENTENCES ARRAY*/
for (int i = 0; i < sentenceArray.length; i++) {
String sortedTemp = wordSorter(sentenceArray[i]);
int wordCount = sortedTemp.length();
/*WORDS IN SENTENECE COUNTER*/
if (wordCount < 20) {
wordCountArray[wordCount] = wordCountArray[wordCount] + 1;
} else {
wordCountArray[20] = wordCountArray[20] + 1;
}
if (wordCount > 0) {
sortedSentenceArray[i] = sortedTemp;
} else {
System.out.println("[-XmlCsvApi-]>[ERROR -> EMPTY SORTED LIST RESPONSE]");
}
}
xcj.toXML(sortedSentenceArray);
} catch (NullPointerException e) {
System.out.println("[-XmlCsvApi-]>[ERROR -> NULL EXCEPTION - SENTENCE SPLITTER]");
}
}
// ##########################################[ SENTENCE SORTER ]############################################# //
public String wordSorter(String input_text) {
if (input_text.contains(",")) {
input_text = input_text.replace(",", " ");
}
if (input_text.contains(".")) {
input_text = input_text.replace(".", "");
}
String sortedString = "";
if (input_text.contains(" ")) {
String[] words = input_text.split(" ");
List<String> wordList = new ArrayList<String>(words.length);
List<String> lst;
String[] trimedSentence = new String[words.length];
lst = new ArrayList<String>();
for (int i = 0; i < words.length; i++) {
String trimedWord = words[i].trim();
trimedSentence[i] = trimedWord;
}
Collections.addAll(lst, trimedSentence);
Collections.sort(lst);
Collections.sort(lst, new SortIgnoreCase());
for (String s : lst) {
if (sortedString.length() > 0)
sortedString += ",";
sortedString += s;
}
return sortedString;
} else {
System.out.println("[-XmlCsvApi-]>Sentence '" + input_text + "' does not contain any whitespace -> Parsed with warnings!");
return input_text.trim();
}
}
public void makeObject(List<String> lst) {
String textIn = new String();
String XMLIn = new String();
String CSVIn = new String();
String JSONIn = new String();
String STATUSIn = new String();
for (String Sentence : lst) {
textIn += Sentence;
XMLIn += Sentence;
CSVIn += Sentence;
JSONIn += Sentence;
STATUSIn += Sentence;
}
XmlCsvModel NEWxmlcsvmodel = new XmlCsvModel();
NEWxmlcsvmodel.setTEXT(textIn);
NEWxmlcsvmodel.setXML(XMLIn);
NEWxmlcsvmodel.setCSV(CSVIn);
NEWxmlcsvmodel.setJSON(JSONIn);
NEWxmlcsvmodel.setSTATUS(STATUSIn);
MA.getModelData().add(NEWxmlcsvmodel);
}
// ##########################################[ INPUT TOGGLE ]############################################# //
public void changedToggle() {
labelMainArea.setText("");
textAreaMain.appendText("[-XmlCsvApi-]>[CHANGING INPUT]\n");
if (ToggleRadioInput.getSelectedToggle() != null) {
textAreaMain.setDisable(true);
textAreaMain.setStyle("-fx-opacity: 1.0; ");
textFieldTop.setVisible(false);
buttonOpenFiles.setVisible(false);
buttonLoadFrom.setVisible(false);
/* OPEN FILES*/
if (ToggleRadioInput.getSelectedToggle().toString().contains("radioInput1")) {
buttonOpenFiles.setVisible(true);
buttonOpenFiles.setText("open file's");
textAreaMain.appendText("[-XmlCsvApi-]>[CLICK BUTTON ON THE LEFT SITE AND SELECT ONE ORE MORE FILES TO LOAD]\n");
labelMainArea.setText("SELECT FILE!");
}
/* TEXT AREA INPUT*/
if (ToggleRadioInput.getSelectedToggle().toString().contains("radioInput2")) {
textAreaMain.setText("");
textAreaMain.setDisable(false);
labelMainArea.setText("PASTE OR WRITE HERE SOME INPUT:");
}
/* REMOTE INPUT*/
if (ToggleRadioInput.getSelectedToggle().toString().contains("radioInput3")) {
buttonOpenFiles.setText("load");
buttonOpenFiles.setVisible(true);
textFieldTop.setVisible(true);
}
} else {
textAreaMain.appendText("[-XmlCsvApi-]>[NO INPUT SELECTED]\n");
}
}
/*This shows how to iterate over the lines in a stream, not how to read the entire stream into a string. – Andrew Mar 23 '12 at 15:11
InputStream in = *//* your InputStream *//*;
InputStreamReader is = new InputStreamReader(in);
StringBuilder sb=new StringBuilder();
BufferedReader br = new BufferedReader(is);
String read = br.readLine();
while(read != null) {
//System.out.println(read);
sb.append(read);
read =br.readLine();
}
return sb.toString();*/
// textfield.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(ActionEvent e) {
// try {
// String text = textfield.getText();
// InputStream is = new ByteArrayInputStream(text.getBytes("UTF-8"));
// // Here do something with your input stream (something non-blocking)
// System.err.println(text);
// } catch (UnsupportedEncodingException e1) {
// e1.printStackTrace();
// }
//
// }
// });
// System.out.println("Initializing XmlCsvApi...");
// labelTop.textProperty().bind(textFieldTop.textProperty());
// System.out.println("Initializing XmlCsvApi...");
// public void readfromkeyboard() {
// textFieldTop.textProperty()
//
// InputStream in = textFieldTop.textProperty().toString();
// InputStreamReader is = new InputStreamReader(in);
// StringBuilder sb=new StringBuilder();
// BufferedReader br = new BufferedReader(is);
// String read = br.readLine();
//
// while(read != null) {
// //System.out.println(read);
// sb.append(read);
// read =br.readLine();
//
// }
//
// }
public void outToggle() {
if (outToggleGroup.getSelectedToggle() != null) {
System.out.println(outToggleGroup.getSelectedToggle().toString());
if (outToggleGroup.getSelectedToggle().toString().contains("radioConstant")) {
textAreaMain.appendText("[-XmlCsvApi-]>[CONSTANT PARSING TURNED ON]\n");
constantParing = true;
} else {
textAreaMain.appendText("[-XmlCsvApi-]>[CONSTANT PARSING TURNED OFF]\n");
constantParing = false;
}
}
}
// ##########################################[ TEXT AREA INPUT ]############################################# //
public void keyboardInputTyped(KeyEvent keyEvent) {
System.out.println("[PARSING INPUT TEXT.....]");
String textInputKeys = textAreaMain.textProperty().getValue();
System.out.println(textInputKeys);
if (keyEvent.getCode() == KeyCode.ENTER) {
String text = textAreaMain.getText();
textAreaMain.setText("[-XmlCsvApi-]>[PARSING INPUT] ");
}
if (textInputKeys.contains(". ")) {
System.out.println("[HURRA....]");
sentenceSplitter(textInputKeys);
}
}
// ##########################################[ OPEN FILES ]############################################# //
public void handleButtonOpenFiles() {
System.out.println("[-XmlCsvApi-]>[OPEN FILE SELECTOR DIALOG BOX]\n");
textAreaMain.appendText("[-XmlCsvApi-]>[OPENING FILE SELECTOR DIALOG BOX]\n");
final Desktop desktop = Desktop.getDesktop();
Stage window = new Stage();
final FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("[-XmlCsvApi-]=>[OPEN FILE'S]\n");
List<File> list = fileChooser.showOpenMultipleDialog(window);
if (list != null) {
labelMainArea.setText("");
textAreaMain.appendText("[-XmlCsvApi-]>[OPENING SELECTED FILE'S]\n");
for (File file : list) {
textAreaMain.appendText("[-XmlCsvApi-]>[file: " + file + " ]");
labelMainArea.setText(file.getPath() + " ");
labelMainArea.setDisable(true);
MA.getFileQueueList().add(new FileQueue(file.getName(), file.getPath()));
try {
String textFile = readFile(file);
textAreaMain.appendText(textFile);
// sentenceSplitter(textFile);
} catch (IOException ex) {
textAreaMain.appendText("[-XmlCsvApi-]>[ERROR SPLITTING SENTENCES!!]");
}
}
}
buttonOpenFiles.setText("Open More...");
}
//
// // ##########################################[ OPEN FILES ]############################################# //
// public void handleButtonOpenFiles() {
// System.out.println("[-XmlCsvApi-]>[OPEN FILE SELECTOR DIALOG BOX]\n");
// textAreaMain.appendText("[-XmlCsvApi-]>[OPENING FILE SELECTOR DIALOG BOX]\n");
// final Desktop desktop = Desktop.getDesktop();
// Stage window = new Stage();
// final FileChooser fileChooser = new FileChooser();
// fileChooser.setTitle("[-XmlCsvApi-]=>[OPEN FILE'S]\n");
// List<File> list = fileChooser.showOpenMultipleDialog(window);
// if (list != null) {
// labelMainArea.setText("");
// textAreaMain.appendText("[-XmlCsvApi-]>[OPENING SELECTED FILE'S]\n");
// for (File file : list) {
// textAreaMain.appendText("[-XmlCsvApi-]>[file: " + file + " ]");
// labelMainArea.setText(file.getPath() + " ");
// labelMainArea.setDisable(true);
// try {
// String textFile = readFile(file);
// textAreaMain.appendText(textFile);
// sentenceSplitter(textFile);
// } catch (IOException ex) {
// textAreaMain.appendText("[-XmlCsvApi-]>[ERROR SPLITTING SENTENCES!!]");
// }
// }
// }
// buttonOpenFiles.setText("Open More...");
// }
// ##########################################[ BUTTONS ]############################################# //
public void handleLoadFrom() {
textAreaMain.appendText("[-XmlCsvApi-]>[LOADING FILE FROM..]\n");
buttonLoadFrom.setText("load more");
}
public void handleOutputFile() {
textAreaMain.appendText("[-XmlCsvApi-]>[SELECT OUTPUT]\n");
buttonLoadFrom.setText("load more");
}
public void onEnter() {
System.out.println("test");
System.out.println(textFieldTop.textProperty().getValue());
textAreaMain.appendText("[-XmlCsvApi-]=> Loading location: " + textFieldTop.textProperty().getValue());
}
/* public void handleButtonClick3() {
for (XYChart.Series<String, Integer> series : barChart.getData()) {
for (XYChart.Data<String, Integer> data : series.getData()) {
Double ddd = Math.random() * 20;
Integer iii2 =5;
data.setYValue(iii2);
}
} }
public void handleButtonClick4() {
System.out.println("Controlle44r");
for (XYChart.Series<String, Integer> series : barChart.getData()) {
for (XYChart.Data<String, Integer> data : series.getData()) {
Double ddd = Math.random() * 20;
Integer iii = ddd.intValue();
Integer iii2 = 22;
data.setYValue(iii2);
}
}
button4.setText("Stop touching me!!!44");
}*/
private String readFile(File file) throws IOException {
String content = new String(Files.readAllBytes(Paths.get(file.getAbsolutePath())));
System.out.println("RETURNING READED FILE CONTENT");
System.out.println(content);
return content;
}
public void CheckboxXMLCSVJSON() {
if (checkboxXML.isSelected()) {
vboxXML.setVisible(true);
} else {
vboxXML.setVisible(false);
vboxXML.maxWidth(0);
}
if (checkboxCSV.isSelected()) {
vboxCSV.setVisible(true);
} else {
vboxCSV.setVisible(false);
vboxCSV.maxWidth(0);
}
if (checkboxJSON.isSelected()) {
vboxJSON.setVisible(true);
} else {
vboxJSON.setVisible(false);
vboxJSON.maxWidth(0);
}
}
// ##########################################[ ADD OBJECTS TO VIEW ]######################################## //
public void setMA(Main MA) {
this.MA = MA;
dataTable.setItems(MA.getModelData());
fileQueueTableView.setItems(MA.getFileQueueList());
}
//----------------------------------------------------------------------------------------------------------------------------
// ##########################################[ REACT TO TABLE SELECTION ]######################################## //
private void showDataDetails(XmlCsvModel xmlcsvmodel) {
if (xmlcsvmodel != null) {
TEXT.setText(xmlcsvmodel.getTEXT());
XML.setText(xmlcsvmodel.getXML());
CSV.setText(xmlcsvmodel.getCSV());
JSON.setText(xmlcsvmodel.getJSON());
STATUS.setText(xmlcsvmodel.getSTATUS());
String[] ZZZ = TEXT.getText().split(" ");
areaXML.setText("");
for (int i = 0; i < ZZZ.length; i++) {
areaXML.appendText(ZZZ[i]);
areaXML.appendText("\n");
}
} else {
TEXT.setText("");
XML.setText("");
CSV.setText("");
JSON.setText("");
STATUS.setText("");
}
}
// ##########################################[ OBJECT EDIT HANDLER ]############################################# //
@FXML /* -NEW OBJECT DIALOG BOX- */
private void handleNewXmlCsvModel() {
XmlCsvModel tempXmlCsvModel = new XmlCsvModel();
boolean okClicked = MA.showDataEditDialog(tempXmlCsvModel);
if (okClicked) {
MA.getModelData().add(tempXmlCsvModel);
}
}
private void setParserNewXmlCsvModel() {
XmlCsvModel tempXmlCsvModel = new XmlCsvModel();
boolean okClicked = MA.showDataEditDialog(tempXmlCsvModel);
if (okClicked) {
MA.getModelData().add(tempXmlCsvModel);
}
}
@FXML /* -EDIT DIALOG BOX- */
private void handleXmlCsvModel() {
XmlCsvModel selectedXmlCsvModel = dataTable.getSelectionModel().getSelectedItem();
if (selectedXmlCsvModel != null) {
boolean okClicked = MA.showDataEditDialog(selectedXmlCsvModel);
if (okClicked) {
showDataDetails(selectedXmlCsvModel);
}
} else {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initOwner(MA.getPrimaryStage());
alert.setTitle("NO DATA RECORD");
alert.setHeaderText("NO DATA RECORD SELECTED");
alert.setContentText("Please select a DATA RECORD in the table.");
alert.showAndWait();
}
}
@FXML /* -DELETE SELECTED OBJECT- */
private void handleDeleteData() {
int selectedIndex = dataTable.getSelectionModel().getSelectedIndex();
if (selectedIndex >= 0) {
dataTable.getItems().remove(selectedIndex);
} else {
// Nothing selected.
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initOwner(MA.getPrimaryStage());
alert.setTitle("No Selection");
alert.setHeaderText("No Person Selected");
alert.setContentText("Please select a person in the table.");
alert.showAndWait();
}
}
@FXML /* -DELETE SELECTED QUEUE ITEM- */
private void handleDeleteQueueItem() {
int selectedIndex = fileQueueTableView.getSelectionModel().getSelectedIndex();
if (selectedIndex >= 0) {
fileQueueTableView.getItems().remove(selectedIndex);
} else {
// Nothing selected.
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initOwner(MA.getPrimaryStage());
alert.setTitle("No Selection");
alert.setHeaderText("No Object Selected");
alert.setContentText("Please select a Input Object in the table.");
alert.showAndWait();
}
}
// ##########################################[ TOP MENU ]############################################# //
@FXML /* -CREATE NEW EMPTY INSTANCE- */
private void handleNew() {
MA.getModelData().clear();
MA.setDataFilePath(null);
}
@FXML /* -FILECHOOSER- OPEN SAVED WORKSPACE- */
private void handleOpen() {
FileChooser fileChooser = new FileChooser();
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(
"XMLCSV files (*.XMLCSV)", "*.XMLCSV");
fileChooser.getExtensionFilters().add(extFilter);
File file = fileChooser.showOpenDialog(MA.getPrimaryStage());
if (file != null) {
MA.loadDataFromFile(file);
}
}
@FXML /* -SAVE OPEN WORKSPACE- */
private void handleSave() {
File dataFile = MA.getDataFilePath();
if (dataFile != null) {
MA.saveDataToFile(dataFile);
} else {
handleSaveAs();
}
}
@FXML /* -SAVE AS- */
private void handleSaveAs() {
FileChooser fileChooser = new FileChooser();
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(
"XMLCSV files (*.XMLCSV)", "*.XMLCSV");
fileChooser.getExtensionFilters().add(extFilter);
File file = fileChooser.showSaveDialog(MA.getPrimaryStage());
if (file != null) {
if (!file.getPath().endsWith(".XMLCSV")) {
file = new File(file.getPath() + ".XMLCSV");
}
MA.saveDataToFile(file);
}
}
@FXML /* -ABOUT- */
private void handleAbout() {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("XML CSV API");
alert.setHeaderText("About");
alert.setContentText("Author: Michal Frackowiak\ne-mail: michal.f@mail.com");
alert.showAndWait();
}
@FXML /* -FAST EXIT- */
private void handleExit() {
System.exit(0);
}
@FXML
private void handleShowBirthdayStatistics() {
MA.showBirthdayStatistics();
// setWordChartData(xmlcsvmodel);
}
public void handleButtonClick3() {
for (XYChart.Series<String, Integer> series : barChart.getData()) {
for (XYChart.Data<String, Integer> data : series.getData()) {
Double ddd = Math.random() * 20;
barChart.setAccessibleHelp("QQQQ");
Integer iii2 = 5;
data.setYValue(iii2);
}
}
}
public void handleButtonClick2() {
for (XYChart.Series<String, Integer> series : barChart.getData()) {
for (XYChart.Data<String, Integer> data : series.getData()) {
Double ddd = Math.random() * 20;
Integer iii2 = 0;
data.setYValue(iii2);
}
}
}
public void handleButtonClick4() {
System.out.println("Controlle44r");
for (XYChart.Series<String, Integer> series : barChart.getData()) {
for (XYChart.Data<String, Integer> data : series.getData()) {
Double ddd = Math.random() * 20;
Integer iii2 = ddd.intValue();
data.setYValue(iii2);
}
}
button4.setText("Stop touching me!!!44");
}
// ##########################################[ CHART CONTROLLER ]############################################# //
public void setWordChartData(List<XmlCsvModel> xmlcsvmodel) {
int[] countedWordsInt = new int[21];
for (int i = 0; i < 21; i++) {
Double ddd = Math.random() * 20;
Integer iii = ddd.intValue();
countedWordsInt[i] = iii;
}
XYChart.Series<String, Integer> series = createIntegerDataSeries(countedWordsInt);
barChart.getData().add(series);
}
private XYChart.Series<String, Integer> createIntegerDataSeries(int[] countedWordsInt) {
XYChart.Series<String, Integer> series = new XYChart.Series<String, Integer>();
for (int i = 0; i < countedWordsInt.length; i++) {
XYChart.Data<String, Integer> wordNumberData = new XYChart.Data<String, Integer>(stringNumbers.get(i), countedWordsInt[i]);
series.getData().add(wordNumberData);
}
return series;
}
public static class SortIgnoreCase implements Comparator<Object> {
public int compare(Object o1, Object o2) {
String s1 = (String) o1;
String s2 = (String) o2;
return s1.toLowerCase().compareTo(s2.toLowerCase());
}
}
// ThreadsRunner aaa= new ThreadsRunner();
public void runConsumer() {
aaa = new ThreadsRunner();
aaa.startWriter();
// aaa.ABCD=true;
System.out.println("testA");
// aaa.starrter();
}
public void stopConsumer() {
System.out.println("sss111");
aaa.R2.suspend();
aaa.R1.suspend();
System.out.println("sss2222");
// System.out.println("testX");
//// aaa.ABCD=false;
// System.out.println("testXX");
// ThreadsRunner aaa = new ThreadsRunner();
// aaa.stopper();
}
public void stopConsumer2() {
System.out.println("sss3333");
aaa.R2.resume();
aaa.R1.resume();
System.out.println("sss444");
// System.out.println("testX");
//// aaa.ABCD=false;
// System.out.println("testXX");
// ThreadsRunner aaa = new ThreadsRunner();
// aaa.stopper();
}
public void actionBT1() {
System.out.println("[BT1 ACTION START]");
boolean inProgress=false;
// PARSER ON //
if(BT1.isDefaultButton()){
System.out.println("[BT1 CONFIRMATION ...]");
boolean confirmStop = ConfirmBox.display("stop thread", "Are you sure to stop the running Input Parser Thread?");
if(confirmStop){
System.out.println("[BT1 CLOSING THREAD.. ...]");
inputParser.kill();
BT1.setDefaultButton(false);
BT1.setText("BT1 parser [OFF]");
}else{
System.out.println("[BT1 RESUMEING THREAD.. ...]");
}
System.out.println("[AFTER THREAD ...]");
// PARSER OFF //
} else {
System.out.println("[BT1 TURN ON ...]");
BT1.setDefaultButton(true);
BT1.setText("BT1 parser [ON]");
try{
boolean isEMPTY = fileQueueTableView.getItems().isEmpty();
if(isEMPTY){
System.out.println("[QUEUE IS EMPTY...]");
}else{
FileQueue queueItem;
System.out.println("[QUEUE NOT EMPTY. ...]");
queueItem = fileQueueTableView.getItems().get(0);
System.out.println(queueItem.getNAME());
System.out.println(queueItem.getPATH());
// inProgress = true;
XmlCsvApi.Main.initWorker inputParser2 = new XmlCsvApi.Main.initWorker()
// inputParser(queueItem.getNAME(),queueItem.getPATH());
}
// while(!isEMPTY){
// FileQueue queueItem;
// System.out.println("[BT12 TURN ON ...]");
// queueItem = fileQueueTableView.getItems().get(0);
// System.out.println(queueItem.getNAME());
// System.out.println(queueItem.getPATH());
// inProgress = true;
// System.out.println("[RUN THREAD ...]");
// Parser parser = new Parser(MA);
// inputParser = new runInputParserThread(queueItem.getNAME(),queueItem.getPATH(), inProgress, parser);
// BT1.setDefaultButton(true);
// inputParser.start();
// System.out.println("[AFTER THREAD ...]");
//
//
//
// fileQueueTableView.getItems().remove(queueItem);
// inProgress = false;
// }
} catch (IndexOutOfBoundsException e) {
if(inProgress){
System.out.println("[alert tjread...]");
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initOwner(MA.getPrimaryStage());
alert.setTitle("Queue Empty");
alert.setHeaderText("No Items to parse");
alert.setContentText("Please add or select some input data");
alert.showAndWait();
}else{
System.out.println("Parsing data...");
}
}
System.out.println("[AFTER THREAD ...]");
}
System.out.println("[BT1 ACTION END]");
}
// public void actionBT1() {
// System.out.println("[BT1 ACTION START]");
//// private void setParserNewXmlCsvModel() {
// XmlCsvModel tempXmlCsvModel = new XmlCsvModel();
//// boolean okClicked = MA.showDataEditDialog(tempXmlCsvModel);
//// if (okClicked) {
//// MA.getModelData().add(tempXmlCsvModel);
//// }
//// }
// boolean inProgress=false;
// if(BT1.isDefaultButton()){
// System.out.println("[BT1 CONFIRMATION ...]");
// boolean confirmStop = ConfirmBox.display("stop thread", "Are you sure to stop the running Input Parser Thread?");
// if(confirmStop){
// System.out.println("[BT1 CLOSING THREAD.. ...]");
// inputParser.kill();
// BT1.setDefaultButton(false);
// BT1.setText("BT1 parser [OFF]");
//
// }else{
// System.out.println("[BT1 RESUMEING THREAD.. ...]");
// }
// System.out.println("[AFTER THREAD ...]");
// } else {
// System.out.println("[BT1 TURN ON ...]");
// BT1.setDefaultButton(true);
// BT1.setText("BT1 parser [ON]");
// try{
// boolean isEMPTY = fileQueueTableView.getItems().isEmpty();
// if(isEMPTY){
// System.out.println("[QUEUE IS EMPTY...]");
// }else{
// System.out.println("[QUEUE NOT EMPTY. ...]");
// }
// while(!isEMPTY){
// FileQueue queueItem;
// System.out.println("[BT12 TURN ON ...]");
// queueItem = fileQueueTableView.getItems().get(0);
// System.out.println(queueItem.getNAME());
// System.out.println(queueItem.getPATH());
// inProgress = true;
// System.out.println("[RUN THREAD ...]");
// Parser parser = new Parser(MA);
// inputParser = new runInputParserThread(queueItem.getNAME(),queueItem.getPATH(), inProgress, parser);
// BT1.setDefaultButton(true);
// inputParser.start();
// System.out.println("[AFTER THREAD ...]");
//
//
//
// fileQueueTableView.getItems().remove(queueItem);
// inProgress = false;
// }
// } catch (IndexOutOfBoundsException e) {
// if(inProgress){
// System.out.println("[alert tjread...]");
// Alert alert = new Alert(Alert.AlertType.WARNING);
// alert.initOwner(MA.getPrimaryStage());
// alert.setTitle("Queue Empty");
// alert.setHeaderText("No Items to parse");
// alert.setContentText("Please add or select some input data");
// alert.showAndWait();
// }else{
// System.out.println("Parsing data...");
// }
// }
// System.out.println("[AFTER THREAD ...]");
// }
// System.out.println("[BT1 ACTION END]");
//
// }
//
public void actionBT2() {
System.out.println("[BT2 ACTION START]");
if(BT2.isDefaultButton()){
System.out.println("[BT2 TURN PAUSE OFF IN PROGRESS ...]");
inputParser.resume();
BT2.setDefaultButton(false);
BT2.setText("BT2 [Pause]");
}else {
System.out.println("[BT2 TURN ON suspending THREAD ...]");
BT2.setDefaultButton(true);
inputParser.suspend();
BT2.setText("BT2 [Resume]");
}
System.out.println("[BT1 ACTION END]");
}
// public void actionBT2() {
// System.out.println("[BT2 ACTION START]");
// if(BT2.isDefaultButton()){
// System.out.println("[BT2 TURN PAUSE OFF IN PROGRESS ...]");
// inputParser.resume();
// BT2.setDefaultButton(false);
// BT2.setText("BT2 [Pause]");
// }else {
// System.out.println("[BT2 TURN ON suspending THREAD ...]");
// BT2.setDefaultButton(true);
// inputParser.suspend();
// BT2.setText("BT2 [Resume]");
// }
// System.out.println("[BT1 ACTION END]");
// }
public void actionBT3() {
System.out.println("[BT3 ACTION START]");
if(BT3.isDefaultButton()){
System.out.println("[BT3 TURN OFF IN PROGRESS ...]");
BT3.setDefaultButton(false);
BT3.setText("BT3 [OFF]");
}else {
System.out.println("[BT3 TURN ON ...]");
BT3.setDefaultButton(true);
BT3.setText("BT3 [ON]");
}
System.out.println("[BT3 ACTION END]");
}
public void actionBT4() {
System.out.println("[BT4 ACTION START]");
if(BT4.isDefaultButton()){
System.out.println("[BT4 TURN OFF IN PROGRESS ...]");
BT4.setDefaultButton(false);
BT4.setText("BT4 [OFF]");
}else {
System.out.println("[BT4 TURN ON ...]");
BT4.setDefaultButton(true);
BT4.setText("BT4 [ON]");
}
System.out.println("[BT1 ACTION END]");
}
public void actionBT5() {
System.out.println("[BT5 ACTION START]");
if(BT5.isDefaultButton()){
System.out.println("[BT5 TURN OFF IN PROGRESS ...]");
BT5.setDefaultButton(false);
BT5.setText("BT5 [OFF]");
}else {
System.out.println("[BT5 TURN ON ...]");
BT5.setDefaultButton(true);
BT5.setText("BT5 [ON]");
}
System.out.println("[BT5 ACTION END]");
}
public void actionBT6() {
System.out.println("[BT6 ACTION START]");
int[] abc = {1, 2, 3};
MA.addModelData(new XmlCsvModel("TEXT ...... TEXT ...... ", "XML,XML,XML", "CSV,CSV,CSV", "JSON, JSON, JSON", "OK", abc, abc, abc));
System.out.println("[BT6 ACTION END]");
}
public void actionBT7() {
System.out.println("[BT7 ACTION START]");
try{
FileQueue queueItem;
queueItem = fileQueueTableView.getItems().get(0);
System.out.println(queueItem.getNAME());
System.out.println(queueItem.getPATH());
// String textFile = readFile(queueItem.getPATH());
// textAreaMain.appendText(textFile);
//
// import java.io.FileReader;
//
// public class Main {
// public static void main(String[] argv) throws Exception {
// FileReader fr = new FileReader("text.txt");
//
// int ch;
// do {
// ch = fr.read();
// if (ch != -1)
// System.out.println((char) ch);
// } while (ch != -1);
// fr.close();
// }
// }
fileQueueTableView.getItems().remove(queueItem);
} catch (IndexOutOfBoundsException e) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.initOwner(MA.getPrimaryStage());
alert.setTitle("Queue Empty");
alert.setHeaderText("No Items to parse");
alert.setContentText("Please add or select some input data");
alert.showAndWait();
}
}
}
|
package com.herz.ntree.model;
/**
* <b>NTree Class</b>
* <p>
* Data structure that models a tree with <i>n</i> amount of branches and leaves.
*
* @param <T> The type of data to store on this tree.
* @author LöwenHerz
* @since 7/11/2019
*/
public class NTree<T> {
// The main root of this tree
private NTreeNode<T> mRoot;
/**
* Main constructor for the tree, which takes some information and makes it the root.
*
* @param root The new root for this tree.
*/
public NTree(T root) {
this.mRoot = new NTreeNode<>(root);
}
/**
* Adds the data to this branch or tree, searching for a certain branch contained on this.
* If the branch couldn't be found, it will add the data to the root of the tree.
*
* @param data The data to add to the branch.
* @param branch The branch that we will need to add the data on.
*/
public void add(T data, T branch) {
NTreeNode<T> searchedBranch;
if (this.mRoot.hasNoLeaves()) {
this.mRoot.addLeaf(data);
} else if (this.mRoot.getData() == branch) {
this.mRoot.addLeaf(data);
} else {
searchedBranch = this.mRoot.searchBranch(branch, this.mRoot);
if (null == searchedBranch) {
this.mRoot.addLeaf(data);
} else {
searchedBranch.addLeaf(data);
}
}
}
/**
* Shows this tree or branch with a certain level.
*
* @param level The level of deepness or indentation of the tree for informative purposes.
*/
public void show(int level) {
this.mRoot.showTree(this.mRoot, level);
}
}
|
package com.farukcankaya.springcase.discount.entity;
import javax.validation.constraints.NotEmpty;
import java.util.List;
public class Cart {
@NotEmpty List<Product> items;
public Cart() {}
public Cart(List<Product> items) {
this.items = items;
}
public List<Product> getItems() {
return items;
}
public void setItems(List<Product> items) {
this.items = items;
}
}
|
import java.util.*;
class Solution {
public int solution(String skill, String[] skill_trees) {
int answer = 0;
Set<Character> set = new HashSet<>();
for (char c: skill.toCharArray()) {
set.add(c);
}
for (String skillTree: skill_trees) {
String str = "";
for (char c: skillTree.toCharArray()) {
if (set.contains(c)) {
str += String.valueOf(c);
}
}
if (skill.startsWith(str)) {
answer++;
}
}
return answer;
}
}
|
/**
*
*/
package pl.zezulka.game.rockpaperscissors.dao;
import java.util.Optional;
import pl.zezulka.game.rockpaperscissors.model.Game;
/**
* @author ania
*
*/
public interface IGameRepository {
Game save(Game game);
Optional<Game> findById(Long id);
}
|
package eu.rethink.globalregistry.configuration;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* Configuration class of the GlobalRegistry. Using singleton pattern.
*
* @author Sebastian Göndör
* @version 4
* @date 29.03.2017
*/
public class Config
{
private static Config _singleton = null;
private static final String versionName = "0.3.4";
private static final int versionNumber = 1597;
private static final String versionCode = "springified";
private static final String versionDate = "2017-04-06";
private static final String productName = "reTHINK Global Registry";
private static final String productNameShort = "gReg";
private static final int portDHT = 5001;
private static final int versionDatasetSchema = 2;
private static final int versionRESTAPI = 1;
private static final int versionDHTAPI = 1;
//private static final int reconnectIntervalDefault = 12;
private static final String networkInterfaceDefault = "eth0";
private static final String logPathDefault = "logs";
private static final String connectNodeDefault = "130.149.22.220";
private static final int portRESTDefault = 5002;
//private int reconnectInterval;
private String networkInterface;
private String logPath;
private String connectNode;
private int portREST;
private Config()
{
setDefaultValues();
}
public static Config getInstance()
{
if(_singleton == null)
{
_singleton = new Config();
}
return _singleton;
}
private void setDefaultValues()
{
//this.reconnectInterval = reconnectIntervalDefault;
this.networkInterface = networkInterfaceDefault;
this.connectNode = connectNodeDefault;
this.logPath = logPathDefault; // TODO check if this is working
this.portREST = portRESTDefault;
}
// public int getReconnectInterval()
// {
// return reconnectInterval;
// }
//
// public void setReconnectInterval(int reconnectInterval)
// {
// this.reconnectInterval = reconnectInterval;
// }
public String getNetworkInterface()
{
return networkInterface;
}
public void setNetworkInterface(String networkInterface)
{
this.networkInterface = networkInterface;
}
public String getLogPath()
{
return logPath;
}
public void setLogPath(String logPath)
{
this.logPath = logPath;
}
public String getConnectNode()
{
return connectNode;
}
public void setConnectNode(String connectNode)
{
this.connectNode = connectNode;
}
/**
* Set the connectNode via a URL, e.g., www.example.com/node
*
* @param connectNodeURL
*/
public void setConnectNodeViaURL(String connectNodeURL)
{
InetAddress address;
try
{
address = InetAddress.getByName(connectNodeURL);
}
catch(UnknownHostException e)
{
this.connectNode = connectNodeDefault;
return;
}
this.connectNode = address.getHostAddress();
}
public int getPortREST()
{
return portREST;
}
public void setPortREST(int portREST)
{
this.portREST = portREST;
}
public int getPortDHT()
{
return portDHT;
}
/**
* retrieves the product name as a String
*
* @return String
*/
public String getProductName()
{
return productName;
}
/**
* retrieves the product name short as a String
*
* @return String
*/
public String getProductNameShort()
{
return productNameShort;
}
/**
* retrieves the version number as a String, e.g. "0.1.2"
*
* @return String
*/
public String getVersionName()
{
return versionName;
}
/**
* retrieves the date of the build, e.g. 2014-08-22
*
* @return String
*/
public String getVersionDate()
{
return versionDate;
}
public int getVersionNumber()
{
return versionNumber;
}
public String getVersionCode()
{
return versionCode;
}
public int getVersaionDatasetSchema()
{
return versionDatasetSchema;
}
public int getVersionRESTAPI()
{
return versionRESTAPI;
}
public int getVersionDHTAPI()
{
return versionDHTAPI;
}
} |
package com.api.automation.pojo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.jackson.Jacksonized;
import java.util.List;
@Data
@EqualsAndHashCode
@Builder(toBuilder = true)
@AllArgsConstructor
@Jacksonized
public class Pet {
private Long id;
private Category category;
private String name;
private List<String> photoUrls;
private List<Tag> tags;
private Status status;
}
|
package com.cyberway.spring_boot_starter_cqrs.domain;
import java.util.List;
public class EventListenerHandle {
private Class<? extends Object> clazz;
public Class<? extends Object> getClazz() {
return clazz;
}
public void setClazz(Class<? extends Object> clazz) {
this.clazz = clazz;
}
List<EventHandleMethod> methods;
public List<EventHandleMethod> getMethods() {
return methods;
}
public void setMethods(List<EventHandleMethod> methods) {
this.methods = methods;
}
}
|
package com.filipcygan.controller;
import com.filipcygan.model.Training;
import com.filipcygan.repositories.TrainingRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class TrainingController {
@Autowired
TrainingRepository trainingRepository;
@RequestMapping("/")
public String index(Model model) {
model.addAttribute("trainings", trainingRepository.findAllByOrderByDateAsc());
model.addAttribute("training", new Training());
return "index";
}
@RequestMapping(value = "/delete/{id}")
public String deleteTraining(@PathVariable("id") Long id) {
trainingRepository.delete(id);
return "redirect:/";
}
@RequestMapping(value = "/training", method = RequestMethod.POST)
public String addTraining(@ModelAttribute("training") Training training, Model model) {
model.addAttribute("training", training);
trainingRepository.save(training);
return "redirect:/";
}
@RequestMapping(value = "/update/{id}")
public String updateTraining(@PathVariable("id") Long id, Model model) {
model.addAttribute("training", trainingRepository.findOne(id));
return "trainingEdit";
}
}
|
package com.joshbgold.ironmax;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.widget.TextView;
public class PercentagesActivity extends MainActivity {
private String exercise_name = "jumping jack";
private String personalRecordString = "";
private Integer personal_record = 100;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.percentages_layout);
final TextView exerciseName = (TextView) findViewById(R.id.exercise_name);
final TextView oneHundredTwoPercent = (TextView) findViewById(R.id.oneHundredTwoPercentValue);
final TextView oneHundredPercent = (TextView) findViewById(R.id.oneHundredPercentValue);
final TextView ninetyFivePercent = (TextView) findViewById(R.id.ninetyFivePercentValue);
final TextView ninetyPercent = (TextView) findViewById(R.id.ninetyPercentValue);
final TextView eightyFivePercent = (TextView) findViewById(R.id.eightyFivePercentValue);
final TextView eightyPercent = (TextView) findViewById(R.id.eightyPercentValue);
final TextView seventyFivePercent = (TextView) findViewById(R.id.seventyFivePercentValue);
final TextView seventyPercent = (TextView) findViewById(R.id.seventyPercentValue);
final TextView sixtyFivePercent = (TextView) findViewById(R.id.sixtyFivePercentValue);
final TextView sixtyPercent = (TextView) findViewById(R.id.sixtyPercentValue);
final TextView fiftyFivePercent = (TextView) findViewById(R.id.fiftyFivePercentValue);
final TextView fiftyPercent = (TextView) findViewById(R.id.fiftyPercentValue);
assert getSupportActionBar() != null;
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.mipmap.barbell);
actionBar.setTitle(" " + "Iron Max");
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
if (bundle != null) {
exercise_name = (String) bundle.get("exerciseName");
exerciseName.setText(exercise_name);
personalRecordString = (String) bundle.get("personalRecord");
personal_record = parseStringToInt(personalRecordString);
oneHundredTwoPercent.setText(((int) (personal_record * 1.02)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
oneHundredPercent.setText(personal_record + " lb / " + Math.round(personal_record / 2.2046) + "kg");
ninetyFivePercent.setText(((int) (personal_record * 0.95)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
ninetyPercent.setText(((int) (personal_record * 0.90)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
eightyFivePercent.setText(((int) (personal_record * 0.85)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
eightyPercent.setText(((int) (personal_record * 0.80)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
seventyFivePercent.setText(((int) (personal_record * 0.75)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
seventyPercent.setText(((int) (personal_record * 0.70)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
sixtyFivePercent.setText(((int) (personal_record * 0.65)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
sixtyPercent.setText(((int) (personal_record * 0.60)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
fiftyFivePercent.setText(((int) (personal_record * 0.55)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
fiftyPercent.setText(((int) (personal_record * 0.50)) + " lb / " + Math.round(personal_record / 2.2046) + "kg");
}
}
private Integer parseStringToInt(String personalRecordString) {
Integer result = 100;
result = Integer.valueOf((personalRecordString.replaceAll("[^\\d.]", ""))); //removes non-numeric chars, converts to int
return result;
}
}
|
package com.ana.utils;
import com.ana.models.Node;
import java.util.HashMap;
import java.util.List;
public class ChatConfig {
public String botImage;
public String botName = "Ria";
public String chatBgColor = "#ffffff";
public String botBubbleColor = "#ffb900";
public String userBubbleColor = "#FAFAFA";
public String chatTextColor = "#808080";
private List<Node> mChatDatamodel;
private HashMap<String,String> mUserData = new HashMap<>();
public void setChatData(List<Node> chatData){
mChatDatamodel = chatData;
}
public List<Node> getChatData(){
return mChatDatamodel;
}
public HashMap<String,String> getUserData(){
return mUserData;
}
}
|
package com.sietecerouno.atlantetransportador.manager;
import android.content.Context;
import com.google.firebase.firestore.FirebaseFirestore;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
/**
* Created by gio on 14/9/16.
*/
public class Manager
{
public static String myID = "";
public static String idToTrack = "";
public static String vehicleSelected = "";
public static int vehicleSelectedType = 0;
//public static FirebaseFirestore db = FirebaseFirestore.getInstance();
public static String user_email = "";
public static String user_photo = "";
public static String user_name = "";
public static String user_last_name = "";
public static String user_cel = "";
public static String goto_profile = "";
public static String photoTemp = "https://firebasestorage.googleapis.com/v0/b/atlante-d7f0b.appspot.com/o/171107101501111.jpeg?alt=media&token=5d1a320c-27a2-4bcf-bccd-ba8e61a78935";
public static String photoTemp_v_user_1 = "";
public static String photoTemp_v_cc_1 = "";
public static String photoTemp_v_cc_2 = "";
public static String photoTemp_v_id_1 = "";
public static String photoTemp_v_id_2 = "";
public static String photoTemp_v_rut_1 = "";
public static String photoTemp_v_tp_1 = "";
public static String photoTemp_v_tp_2 = "";
public static String photoTemp_v_soat_1 = "";
public static String photoTemp_v_tec_1 = "";
public static String photoTemp_v_img_1 = "";
public static String photoTemp_v_img_2 = "";
public static String photoTemp_v_img_3 = "";
public static String photoTemp_v_img_4 = "";
public static String id_client_temp = "";
public static Context actualContext = null;
public static String actualService = "";
public static Boolean isBlock = false;
public static String actualTokenPush = "";
public static String actualId_to_charge = "";
public static String actualId_to_chat = "";
public static String actualClientId_inmediato = "";
public static String actualClientCel_inmediato = "";
public static String actualClientToken_inmediato = "";
public static String actualClientToken = "";
public static String actualClientMail_inmediato = "";
public static String actualClientId_finish = "";
public static String idPersonalizado = "";
public static String idProgramadoDoc = "";
public static String idProgramado = "";
public static String idPersonalizadoDoc = "";
public static Boolean transporterActive = false;
public static SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy");
public static int eu_remove_temp = 0;
public static int eu_total_temp = 0;
public static ArrayList arrPhotoThumb = new ArrayList(){};
public static Boolean isFirstV = true;
public static Boolean isFinishInmediato = false;
public static int idTempVSelected;
public String URL_TPAGA_DEV = "https://sandbox.tpaga.co/api";
public String PRIVATE_BASIC_AUTH_DEV = "Basic dThsdmVnc2dhbGJtcHRuNjcwb3NubzZhaTJwY2g2OGE6";
public String PUBLIC_BASIC_AUTH_DEV = "Basic ZnA2cmwzbmxkcnQzcGRlbGozZzV0ZmI0Y2dycGswNjg6";
public String URL_TPAGA_PROD = "https://api.tpaga.co/api";
public String PRIVATE_BASIC_AUTH_PROD = "";
public String PUBLIC_BASIC_AUTH_PROD = "";
private static Manager _instance;
public synchronized static Manager getInstance()
{
if (_instance == null)
{
_instance = new Manager();
}
return _instance;
}
}
|
package com.slort.model;
import java.util.Date;
/**
* AbstractReserva generated by MyEclipse Persistence Tools
*/
public abstract class AbstractReserva implements java.io.Serializable {
// Fields
private Integer idReserva;
private Flota flota;
private Hotel hotel;
private Cliente cliente;
private Usuario usuario;
private Calculoubicacion calculoubicacion;
private Date fecha;
private Date hora;
private String estado;
private Integer idUsuario;
private String observaciones;
private String direccion;
private String telefono;
private String entreCalles;
private String localidad;
private Double latitud;
private Double longitud;
// Constructors
/** default constructor */
public AbstractReserva() {
}
/** minimal constructor */
public AbstractReserva(Integer idReserva) {
this.idReserva = idReserva;
}
/** full constructor */
public AbstractReserva(Integer idReserva, Flota flota, Hotel hotel,
Cliente cliente, Calculoubicacion calculoubicacion, Date fecha,
Date hora, String estado, Integer idUsuario, String observaciones,
String direccion, String telefono, String entreCalles,
String localidad, Double latitud, Double longitud) {
this.idReserva = idReserva;
this.flota = flota;
this.hotel = hotel;
this.cliente = cliente;
this.calculoubicacion = calculoubicacion;
this.fecha = fecha;
this.hora = hora;
this.estado = estado;
this.idUsuario = idUsuario;
this.observaciones = observaciones;
this.direccion = direccion;
this.telefono = telefono;
this.entreCalles = entreCalles;
this.localidad = localidad;
this.latitud = latitud;
this.longitud = longitud;
}
// Property accessors
public Integer getIdReserva() {
return this.idReserva;
}
public void setIdReserva(Integer idReserva) {
this.idReserva = idReserva;
}
public Flota getFlota() {
return this.flota;
}
public void setFlota(Flota flota) {
this.flota = flota;
}
public Hotel getHotel() {
return this.hotel;
}
public void setHotel(Hotel hotel) {
this.hotel = hotel;
}
public Cliente getCliente() {
return this.cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
public Calculoubicacion getCalculoubicacion() {
return this.calculoubicacion;
}
public void setCalculoubicacion(Calculoubicacion calculoubicacion) {
this.calculoubicacion = calculoubicacion;
}
public Date getFecha() {
return this.fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public Date getHora() {
return this.hora;
}
public void setHora(Date hora) {
this.hora = hora;
}
public String getEstado() {
return this.estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
public Integer getIdUsuario() {
return this.idUsuario;
}
public void setIdUsuario(Integer idUsuario) {
this.idUsuario = idUsuario;
}
public String getObservaciones() {
return this.observaciones;
}
public void setObservaciones(String observaciones) {
this.observaciones = observaciones;
}
public String getDireccion() {
return this.direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
public String getTelefono() {
return this.telefono;
}
public void setTelefono(String telefono) {
this.telefono = telefono;
}
public String getEntreCalles() {
return this.entreCalles;
}
public void setEntreCalles(String entreCalles) {
this.entreCalles = entreCalles;
}
public String getLocalidad() {
return this.localidad;
}
public void setLocalidad(String localidad) {
this.localidad = localidad;
}
public Double getLatitud() {
return this.latitud;
}
public void setLatitud(Double latitud) {
this.latitud = latitud;
}
public Double getLongitud() {
return this.longitud;
}
public void setLongitud(Double longitud) {
this.longitud = longitud;
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
} |
package dao;
import java.util.List;
import beans.Transistor;
public interface TransistorDao {
List<Transistor> list();
void add(Transistor transistor);
void update(Transistor transistor);
void delete(int id);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.