text
stringlengths
10
2.72M
package de.jmda.app.uml.shape.arrow; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import org.junit.Before; import org.junit.Test; import javafx.geometry.Point2D; public class JUTTail___Front_10_0 { private Tail tail; @Before public void before() { tail = new Tail(new Point2D(0, 0), new Point2D(0, 0)); tail.moveFrontTo(10, 0); } @Test public void frontXIs10() { assertThat(tail.getFront().getX(), is(10.0)); } @Test public void frontYIs0() { assertThat(tail.getFront().getY(), is(0.0)); } @Test public void backXIs10() { assertThat(tail.getBack().getX(), is(10.0)); } @Test public void backYIs0() { assertThat(tail.getBack().getY(), is(0.0)); } }
package com.ftd.schaepher.coursemanagement.db; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import com.ftd.schaepher.coursemanagement.pojo.TableCourseMultiline; import com.ftd.schaepher.coursemanagement.tools.Loger; import net.tsz.afinal.FinalDb; import java.util.ArrayList; import java.util.List; public class CourseDBHelper { private FinalDb finalDb; private SQLiteDatabase database; public CourseDBHelper(Context context) { finalDb = FinalDb.create(context, "teacher_class.db"); database = context.openOrCreateDatabase("teacher_class.db", Context.MODE_PRIVATE, null); } public void createNewCourseTable() { String createTableCourseMultiline = "CREATE TABLE TableCourseMultiline " + "( insertTime text primary key, " + "workNumber text, " + "grade text, " + "major text , " + "people text, " + "courseName text, " + "courseType text, " + "courseCredit text, " + "courseHour text, " + "practiceHour text, " + "onMachineHour text, " + "timePeriod text," + "teacherName text," + "remark text)"; database.execSQL(createTableCourseMultiline); } // 增 public void insert(Object entity) { finalDb.save(entity); } public void insertAll(List list) { for (Object obj : list) { insert(obj); } } public void insertOrUpdate(Object entity) { try { finalDb.save(entity); } catch (SQLiteException e) { finalDb.update(entity); } } // 删 public void deleteByID(Class<?> clazz, String id) { finalDb.deleteById(clazz, id); } public void deleteAll(Class<?> clazz) { finalDb.deleteByWhere(clazz, null); } // 改 public void update(Object entity) { finalDb.update(entity); } public void updateAll(List list) { for (Object obj : list) { finalDb.update(obj); } } // 查 public <T> T findById(String id, Class<T> clazz) { return finalDb.findById(id, clazz); } public <T> List<T> findAll(Class<T> clazz) { return finalDb.findAll(clazz); } public <T> List<T> findAllByWhere(Class<T> clazz, String where) { return finalDb.findAllByWhere(clazz, where); } public List<String> getSemesterList() { String[] columns = new String[]{ "year", "semester" }; String orderBy = "year DESC,semester DESC"; Cursor cursor = database .query(true, "TableTaskInfo", columns, null, null, null, null, orderBy, null); List<String> semester = new ArrayList<>(); while (cursor.moveToNext()) { semester.add(cursor.getString(0) + cursor.getString(1)); } cursor.close(); Loger.i("semester", semester.toString()); return semester; } public void changeTableName(String from, String to) { database.execSQL("ALTER TABLE " + from + " RENAME TO " + to); } public void dropTable(String tableName) { database.execSQL("Drop table if exists " + tableName); } public boolean hasCommitted(String workNumber) { List<TableCourseMultiline> list = finalDb.findAllByWhere(TableCourseMultiline.class, "workNumber = \"" + workNumber + "\""); // Loger.d("isfinish", String.valueOf(list.size())); if (list != null && list.size() > 1) { return true; } else { return false; } } public void close() { database.close(); } }
package Generics.GenericsCountMethodStrings;//package Generics.GenericsCountMethodStrings; // //import Generics.GenericSwapMethodStrings.Box; // //import java.util.ArrayList; //import java.util.List; //import java.util.Scanner; // //public class Employee.Main { // public static void main(String[] args) { // Scanner sc = new Scanner(System.in); // // int n = Integer.parseInt(sc.nextLine()); // // List<Box<String>> boxes = new ArrayList<>(); // // while (n-- > 0) { // String str = sc.nextLine(); // // Box<String> box = new Box<>(str); // // boxes.add(box); // } // // String element = sc.nextLine(); // // int count = countGreaterElements(boxes, element); // } // // private static <T extends Comparable<T>> int countGreaterElements(List<Box<T>> boxes, // T element) { // int count = 0; // for (Box<T> box : boxes) { // if (box.) // } // } //}
package primary.courseone.selfcode; public class MergeSort { public static void main(String[] args) { int[] arr = new int[]{1,5,3,7,12,2,44,12,1}; System.out.print("排序前:"); for(int ele:arr){ System.out.print(ele+" "); } /* System.out.println("=========================="); int arr1[] = new int[]{1,4,5,2,5,7}; merge(arr1,0,2,arr1.length-1); for(int ele:arr1){ System.out.print(ele+" "); } */ mergeSort(arr); System.out.print("排序后:"); for(int ele:arr){ System.out.print(ele+" "); } } public static void mergeSort(int[] arr){ if(arr == null || arr.length <2) return; mergeSort(arr,0, arr.length-1); } public static void mergeSort(int[] arr, int l,int r){ if(l==r){ return; } int mid = l + ((r-l)>>1); mergeSort(arr,l,mid); mergeSort(arr,mid+1,r); merge(arr,l,mid,r); //将merge好的左边和右边merge下 } public static void merge(int[] arr, int l,int m, int r){ int[] tmp = new int[r-l+1]; int i = l; int j = m +1 ; int k = 0; while(i<=m && j<=r){ /*tmp[k++] = arr[i] < arr[j]? arr[i++]:arr[j++];*/ if(arr[i] < arr[j]){ tmp[k++] = arr[i++]; }else{ tmp[k++] = arr[j++]; } } while(i <= m){ tmp[k++] = arr[i++]; } while(j <= r){ tmp[k++] = arr[j++]; } for(int e=0; e<tmp.length;e++){ arr[l+e] = tmp[e]; } } }
package valatava.lab.warehouse.service.mapper.impl; import java.util.List; import java.util.stream.Collectors; import org.springframework.stereotype.Service; import valatava.lab.warehouse.model.Category; import valatava.lab.warehouse.service.dto.CategoryDTO; import valatava.lab.warehouse.service.mapper.CategoryMapper; /** * Mapper for the entity {@link Category} and its DTO called {@link CategoryDTO}. * * @author Yuriy Govorushkin */ @Service public class CategoryMapperImpl implements CategoryMapper { @Override public List<CategoryDTO> toDTOs(List<Category> categories) { return categories.stream() .map(this::toDTO) .collect(Collectors.toList()); } @Override public CategoryDTO toDTO(Category category) { CategoryDTO categoryDTO = new CategoryDTO(); categoryDTO.setId(category.getId()); categoryDTO.setDescription(category.getDescription()); return categoryDTO; } @Override public Category toEntity(CategoryDTO categoryDTO) { Category category = new Category(); category.setId(categoryDTO.getId()); category.setDescription(categoryDTO.getDescription()); return category; } }
/* * Copyright 2011 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.drools.planner.examples.trailerrouting.domain; import com.thoughtworks.xstream.annotations.XStreamAlias; import org.apache.commons.lang.builder.CompareToBuilder; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.drools.planner.examples.common.domain.AbstractPersistable; @XStreamAlias("TrailerRoutingOrderAssignment") public class TrailerRoutingOrderAssignment extends AbstractPersistable implements Comparable<TrailerRoutingOrderAssignment> { private TrailerRoutingOrder order; // Changed by moves, between score calculations. private TrailerRoutingDriver driver; private TrailerRoutingTruck truck; private TrailerRoutingTrailer primaryTrailer; private TrailerRoutingTrailer secondaryTrailer; public TrailerRoutingOrder getOrder() { return order; } public void setOrder(TrailerRoutingOrder order) { this.order = order; } public TrailerRoutingDriver getDriver() { return driver; } public void setDriver(TrailerRoutingDriver driver) { this.driver = driver; } public TrailerRoutingTruck getTruck() { return truck; } public void setTruck(TrailerRoutingTruck truck) { this.truck = truck; } public TrailerRoutingTrailer getPrimaryTrailer() { return primaryTrailer; } public void setPrimaryTrailer(TrailerRoutingTrailer primaryTrailer) { this.primaryTrailer = primaryTrailer; } public TrailerRoutingTrailer getSecondaryTrailer() { return secondaryTrailer; } public void setSecondaryTrailer(TrailerRoutingTrailer secondaryTrailer) { this.secondaryTrailer = secondaryTrailer; } public int compareTo(TrailerRoutingOrderAssignment other) { return new CompareToBuilder() .append(order, other.order) .toComparison(); } public TrailerRoutingOrderAssignment clone() { TrailerRoutingOrderAssignment clone = new TrailerRoutingOrderAssignment(); clone.id = id; clone.order = order; clone.driver = driver; clone.truck = truck; clone.primaryTrailer = primaryTrailer; clone.secondaryTrailer = secondaryTrailer; return clone; } /** * The normal methods {@link #equals(Object)} and {@link #hashCode()} cannot be used because the rule engine already * requires them (for performance in their original state). * @see #solutionHashCode() */ public boolean solutionEquals(Object o) { if (this == o) { return true; } else if (o instanceof TrailerRoutingOrderAssignment) { TrailerRoutingOrderAssignment other = (TrailerRoutingOrderAssignment) o; return new EqualsBuilder() .append(id, other.id) .append(order, other.order) .append(driver, other.driver) .append(truck, other.truck) .append(primaryTrailer, other.primaryTrailer) .append(secondaryTrailer, other.secondaryTrailer) .isEquals(); } else { return false; } } /** * The normal methods {@link #equals(Object)} and {@link #hashCode()} cannot be used because the rule engine already * requires them (for performance in their original state). * @see #solutionEquals(Object) */ public int solutionHashCode() { return new HashCodeBuilder() .append(id) .append(order) .append(driver) .append(truck) .append(primaryTrailer) .append(secondaryTrailer) .toHashCode(); } @Override public String toString() { return order + " @ " + driver + " + " + truck + " + " + (secondaryTrailer == null ? primaryTrailer : primaryTrailer + " + " + secondaryTrailer); } }
/* * Copyright (c) 2014 Anthony Benavente * * 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.ambenavente.origins.tests; import com.ambenavente.origins.gameplay.managers.TileSheetManager; import com.ambenavente.origins.gameplay.world.json.MapDeserializer; import com.ambenavente.origins.gameplay.world.level.TiledMap; import com.ambenavente.origins.util.Camera; import org.lwjgl.LWJGLException; import org.newdawn.slick.*; import org.newdawn.slick.geom.Vector2f; /** * Created with IntelliJ IDEA. * * @author Anthony Benavente * @version 2/12/14 */ public class LevelDrawingTest extends BasicGame { private TileSheetManager manager; private MapDeserializer deserializer; private TiledMap map; private Camera camera; /** * Create a new basic game * * @param title The title for the game */ public LevelDrawingTest(String title) { super(title); } @Override public void init(GameContainer container) throws SlickException { manager = new TileSheetManager(); deserializer = new MapDeserializer(); map = deserializer.readFromJsonFile("res/json/test_map_2.json"); camera = new Camera(800, 480); camera.setMax(new Vector2f(map.getRealWidth(), map.getRealHeight())); camera.setMin(new Vector2f(0, 0)); } @Override public void update(GameContainer container, int delta) throws SlickException { Input input = container.getInput(); Vector2f amount = new Vector2f(0, 0); if (input.isKeyDown(Input.KEY_LEFT)) amount.x -= 5; if (input.isKeyDown(Input.KEY_RIGHT)) amount.x += 5; if (input.isKeyDown(Input.KEY_UP)) amount.y -= 5; if (input.isKeyDown(Input.KEY_DOWN)) amount.y += 5; camera.setX(camera.getPos().x + amount.x); camera.setY(camera.getPos().y + amount.y); } @Override public void render(GameContainer container, Graphics g) throws SlickException { g.pushTransform(); g.translate(-camera.getX(), -camera.getY()); map.render(camera, g); g.popTransform(); } public static void main(String[] args) throws LWJGLException { // LevelSerializeDeserializeTest.main(new String[] {}); try { LevelDrawingTest test = new LevelDrawingTest("Level Drawing Test"); AppGameContainer container = new AppGameContainer(test); container.setDisplayMode(800, 480, false); container.setTargetFrameRate(60); container.start(); } catch (SlickException e) { e.printStackTrace(); } } }
package com.rc.utils; import com.rc.panels.BasePanel; import java.util.HashMap; import java.util.Map; /** * @author song * @date 21-11-1 17:47 * @description * @since */ public class ContainerUtil { private static Map<Class, BasePanel> containers = new HashMap<>(); public static void addContainer(BasePanel panel) { containers.put(panel.getClass(), panel); } public static <T extends BasePanel> T getContainer(Class clazz) { return (T) containers.get(clazz); } }
package com.nvilla.house.entities; import java.util.Collection; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table ( name="house") public class House { @Id @GeneratedValue( strategy = GenerationType.AUTO) @Column( name="id_house") private String idHouse; private String nameHouse; private double size; private int nbrePiece ; @OneToMany(cascade={CascadeType.PERSIST, CascadeType.REMOVE}, fetch=FetchType.LAZY, mappedBy="house") private Collection<Room> rooms ; /** * */ public House() { super(); // TODO Auto-generated constructor stub } /** * @param idHouse * @param nameHouse * @param size * @param nbrePiece * @param rooms */ public House(String idHouse, String nameHouse, double size, int nbrePiece, Collection<Room> rooms) { super(); this.idHouse = idHouse; this.nameHouse = nameHouse; this.size = size; this.nbrePiece = nbrePiece; this.rooms = rooms; } /** * @return the idHouse */ public String getIdHouse() { return idHouse; } /** * @param idHouse the idHouse to set */ public void setIdHouse(String idHouse) { this.idHouse = idHouse; } /** * @return the nameHouse */ public String getNameHouse() { return nameHouse; } /** * @param nameHouse the nameHouse to set */ public void setNameHouse(String nameHouse) { this.nameHouse = nameHouse; } /** * @return the size */ public double getSize() { return size; } /** * @param size the size to set */ public void setSize(double size) { this.size = size; } /** * @return the nbrePiece */ public int getNbrePiece() { return nbrePiece; } /** * @param nbrePiece the nbrePiece to set */ public void setNbrePiece(int nbrePiece) { this.nbrePiece = nbrePiece; } /** * @return the rooms */ public Collection<Room> getRooms() { return rooms; } /** * @param rooms the rooms to set */ public void setRooms(Collection<Room> rooms) { this.rooms = rooms; } @Override public String toString() { return "House [idHouse=" + idHouse + ", nameHouse=" + nameHouse + ", size=" + size + ", nbrePiece=" + nbrePiece + ", rooms=" + rooms + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((idHouse == null) ? 0 : idHouse.hashCode()); result = prime * result + ((nameHouse == null) ? 0 : nameHouse.hashCode()); result = prime * result + nbrePiece; result = prime * result + ((rooms == null) ? 0 : rooms.hashCode()); long temp; temp = Double.doubleToLongBits(size); result = prime * result + (int) (temp ^ (temp >>> 32)); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } House other = (House) obj; if (idHouse == null) { if (other.idHouse != null) { return false; } } else if (!idHouse.equals(other.idHouse)) { return false; } if (nameHouse == null) { if (other.nameHouse != null) { return false; } } else if (!nameHouse.equals(other.nameHouse)) { return false; } if (nbrePiece != other.nbrePiece) { return false; } if (rooms == null) { if (other.rooms != null) { return false; } } else if (!rooms.equals(other.rooms)) { return false; } if (Double.doubleToLongBits(size) != Double.doubleToLongBits(other.size)) { return false; } return true; } }
/* * This file is part of SMG, a symbolic memory graph Java library * Originally developed as part of CPAChecker, the configurable software verification platform * * Copyright (C) 2011-2015 Petr Muller * Copyright (C) 2007-2014 Dirk Beyer * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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 cz.afri.smg.objects; import org.junit.Assert; import org.junit.Test; import cz.afri.smg.abstraction.SMGConcretisation; public class SMGRegionTest { private static final int SIZE8 = 8; private static final int SIZE10 = 10; private final SMGRegion region8 = new SMGRegion(8, "region"); @Test public final void testToString() { Assert.assertFalse(region8.toString().contains("@")); } @Test public final void testIsAbstract() { Assert.assertFalse(region8.isAbstract()); } @Test public final void testJoin() { SMGRegion regionSame = new SMGRegion(SIZE8, "region"); SMGObject objectJoint = region8.join(regionSame); Assert.assertTrue(objectJoint instanceof SMGRegion); SMGRegion regionJoint = (SMGRegion) objectJoint; Assert.assertEquals(SIZE8, regionJoint.getSize()); Assert.assertEquals("region", regionJoint.getLabel()); } @Test(expected = UnsupportedOperationException.class) public final void testJoinDiffSize() { SMGRegion regionDiff = new SMGRegion(SIZE10, "region"); region8.join(regionDiff); } @Test public final void testPropertiesEqual() { SMGRegion one = new SMGRegion(SIZE8, "region"); SMGRegion two = new SMGRegion(SIZE8, "region"); SMGRegion three = new SMGRegion(SIZE10, "region"); SMGRegion four = new SMGRegion(SIZE8, "REGION"); Assert.assertTrue(one.propertiesEqual(one)); Assert.assertTrue(one.propertiesEqual(two)); Assert.assertFalse(one.propertiesEqual(three)); Assert.assertFalse(one.propertiesEqual(four)); Assert.assertFalse(one.propertiesEqual(null)); } @Test public final void testObjectVisitor() { SMGObjectVisitor visitor = new SMGObjectVisitor() { @Override public void visit(final SMGRegion pObject) { Assert.assertTrue(true); } }; region8.accept(visitor); } static class MockAbstraction extends SMGAbstractObject { protected MockAbstraction(final SMGRegion pPrototype) { super(pPrototype); } @Override public boolean matchGenericShape(final SMGAbstractObject pOther) { // TODO Auto-generated method stub Assert.fail(); return false; } @Override public boolean matchSpecificShape(final SMGAbstractObject pOther) { // TODO Auto-generated method stub Assert.fail(); return false; } @Override protected SMGConcretisation createConcretisation() { Assert.fail(); return null; } @Override public SMGObject join(final SMGObject pOther) { return this; } @Override public void accept(final SMGObjectVisitor pVisitor) { pVisitor.visit(this); } @Override public boolean isMoreGeneral(final SMGObject pOther) { return false; } } @Test public final void testAbstractJoin() { SMGObject object = new MockAbstraction(region8); Assert.assertSame(object, region8.join(object)); } @Test public final void testIsMoreGeneral() { Assert.assertFalse(region8.isMoreGeneral(region8)); } }
package com.magit.animations; import com.magit.logic.visual.node.CommitNode; import javafx.animation.PathTransition; import javafx.scene.control.Label; import javafx.scene.shape.LineTo; import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.util.Duration; public class MagitPathTransition { public PathTransition pathTransition; public MagitPathTransition(CommitNode destination, final Label node) { if (null == node) return; double x = destination.getActiveBranchLabel().localToScene(destination.getActiveBranchLabel().getBoundsInLocal()).getMinX(); double y = destination.getActiveBranchLabel().localToScene(destination.getActiveBranchLabel().getBoundsInLocal()).getMinY(); pathTransition = getTransition(node, x, y); } public void play() { pathTransition.play(); } private static PathTransition getTransition(Label block, double toX, double toY) { double fromX = block.getParent().getBoundsInParent().getWidth() / 2; double fromY = block.getParent().getBoundsInParent().getHeight() / 2; toX -= block.getParent().getParent().getLayoutX() - block.getParent().getBoundsInParent().getWidth() / 2; toY -= block.getParent().getParent().getLayoutY() - block.getParent().getBoundsInParent().getHeight() / 2; Path path = new Path(); path.getElements().add(new MoveTo(fromX, fromY)); path.getElements().add(new LineTo(toX, toY)); PathTransition transition = new PathTransition(); transition.setPath(path); transition.setNode(block); transition.setDuration(Duration.seconds(0.5)); return transition; } }
package com.hasbrain.howfastareyou; import android.Manifest; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.SystemClock; import android.preference.PreferenceManager; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.text.format.DateFormat; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Chronometer; import android.widget.TextView; import java.io.File; import java.util.Calendar; import java.util.Date; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; public class TapCountActivity extends AppCompatActivity { public static int TIME_COUNT = 10000; //10s @Bind(R.id.bt_tap) Button btTap; @Bind(R.id.bt_start) Button btStart; @Bind(R.id.tv_time) Chronometer tvTime; @Bind(R.id.count) TextView count; private int tap_count = 0; public static final int DEFAULT_TIME_LIMIT = 10; public static final boolean DEFAULT_SAVE_DATA = true; private long startTime; private boolean start = false; private boolean change = false; private boolean saveData; private long timeAtPause = 0; TapCountResultFragment fragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_count); // PreferenceManager.setDefaultValues(this, R.xml.preference, false); ButterKnife.bind(this); if (savedInstanceState != null) { fragment = (TapCountResultFragment) getFragmentManager().findFragmentByTag("fragment_result"); start = savedInstanceState.getBoolean("last_start"); tap_count = savedInstanceState.getInt("last_score"); timeAtPause = savedInstanceState.getLong("last_timeAtPause"); saveData = savedInstanceState.getBoolean("save_data"); if(this.start){ btStart.setText("RESUME"); } count.setText("" + tap_count); long a = (SystemClock.elapsedRealtime() + timeAtPause); tvTime.setBase(a); // tvTime.setText("" + (SystemClock.elapsedRealtime() + timeAtPause)); } else{ fragment = new TapCountResultFragment(); fragment.setArguments(new Bundle()); getFragmentManager().beginTransaction().add(R.id.fl_result_fragment, fragment, "fragment_result").commit(); } tvTime.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() { @Override public void onChronometerTick(Chronometer chronometer) { if (SystemClock.elapsedRealtime() - startTime >= TIME_COUNT) { pauseTapping(); } // Log.i("timer", tvTime.getId() + " : " + tvTime.getText()); // Log.i("startTime", "Start Time: " + startTime); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.menu_settings) { Intent showSettingsActivity = new Intent(this, SettingsActivity.class); startActivity(showSettingsActivity); } return super.onOptionsItemSelected(item); } @OnClick(R.id.bt_start) public void onStartBtnClicked(View v) { startTapping(); } @OnClick(R.id.bt_tap) public void onTapBtnClicked(View v) { tap_count++; count.setText("" + tap_count); // Log.i("READING INPUT FILE", read_file(this, filename)); } private void startTapping() { if(!start){ start = true; change = false; tap_count = 0; timeAtPause = 0; startTime = SystemClock.elapsedRealtime(); tvTime.setBase(SystemClock.elapsedRealtime()); tvTime.start(); btTap.setEnabled(true); btStart.setEnabled(false); } else { change = false; btStart.setText("START"); startTime = SystemClock.elapsedRealtime() + timeAtPause; tvTime.setBase(SystemClock.elapsedRealtime() + timeAtPause); tvTime.start(); btStart.setEnabled(false); btTap.setEnabled(true); } } private void pauseTapping() { start = false; change = false; btTap.setEnabled(false); tvTime.stop(); btTap.setEnabled(false); btStart.setEnabled(true); passDataToFragment(); updateFragmentView(); fragment.saveDataToInternalStorage(); fragment.saveDataToExternalStorage(); } private void passDataToFragment(){ Date now = Calendar.getInstance().getTime(); String now_str = DateFormat.format("dd/MM/yyyy HH:mm:ss", now).toString(); fragment.getArguments().putString("time", now_str); fragment.getArguments().putInt("score", tap_count); } private void updateFragmentView(){ fragment.saveData(); fragment.updateView(); } @Override public void onPause() { super.onPause(); if (start && !change) { change = true; timeAtPause = tvTime.getBase() - SystemClock.elapsedRealtime(); tvTime.stop(); btTap.setEnabled(false); btStart.setEnabled(true); btStart.setText("RESUME"); } } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean("last_start", start); outState.putInt("last_score", tap_count); outState.putLong("last_timeAtPause", timeAtPause); } @Override public void onResume(){ super.onResume(); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); TIME_COUNT = pref.getInt("time_limit", DEFAULT_TIME_LIMIT) * 1000; // System.out.println("TIME COUNT: " + TIME_COUNT); saveData = pref.getBoolean("save_data", DEFAULT_SAVE_DATA); } public boolean isSaveData() { return saveData; } @OnClick(R.id.bt_reset) public void onResetBtnClicked(View v) { resetRecords(); } public void resetRecords(){ // get the path to sdcard File sdcard = Environment.getExternalStorageDirectory(); // to this path add a new directory path File dir = new File(sdcard.getAbsolutePath() + "/HowFastAreYou/"); // create this directory if not already created dir.mkdir(); // create the file in which we will write the contents File file_1 = new File(dir, "list_time.txt"); File file_2 = new File(dir, "list_score.txt"); file_1.delete(); file_2.delete(); fragment.clearData(); fragment.clearDatabase(); } }
package com.neo4j.genere; import java.util.HashMap; import java.util.Map; public class DatabaseFactory { // get an implementaion of database public String type=null; private Map<String,DatabaseInterface> databaseImpl; // list of immplementations @SuppressWarnings("unused") public DatabaseFactory() { databaseImpl = new HashMap<String,DatabaseInterface>(); } // search for immplementation public DatabaseInterface getDatabase(String method) { String name=method.substring(0, 1).toUpperCase()+method.substring(1); // if already exists, return it for ( Map.Entry<String, DatabaseInterface> entry : databaseImpl.entrySet()) { if ( name.equals(entry.getKey())) { return entry.getValue(); } } // non impl found, create a new if possible, each one in his package DatabaseInterface impl = null; String pack = this.getClass().getPackage().toString().substring(8)+"."+method.toLowerCase(); String implName = pack+"."+"DatabaseImpl"; // try to create try { impl = (DatabaseInterface)Class.forName(implName).newInstance(); } catch (Exception e) { System.out.println("Unable to load the class: "+implName); System.exit(2); } // put it in list if(impl!=null) { databaseImpl.put(name,impl); } //return implementation return impl; } }
package automation; public class Master { public static void main(String[] args) { Check mas = new Check(); mas.sample(); String[] StrArrarrval = mas.strArrvalues; for(String ele :StrArrarrval) { System.out.println("values of Array" +ele); } for(int i=0;i<StrArrarrval.length;i++) { System.out.println("Vaues in for loop" + StrArrarrval[i]); } } }
package task300; /** * @author igor */ public class Main300 { }
package com.epam.training.sportsbetting.web.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.epam.training.sportsbetting.web.service.WebServiceFacade; @Controller public class DefaultSportsBettingController { @Autowired private WebServiceFacade defaultWebService; public static final String STATUS_MESSAGE = "STATUS_MESSAGE"; @RequestMapping(value = "/events", method = RequestMethod.GET) public ModelAndView showEvents(ModelAndView model) { defaultWebService.getSportEvents(model); return model; } @RequestMapping(value = "/bets", method = { RequestMethod.GET }) public String bets() { return "bets"; } @RequestMapping(value = "/bets/{id}", method = { RequestMethod.GET }) public ModelAndView showBets(@PathVariable("id") int id, ModelAndView model) { defaultWebService.getBets(id, model); return model; } }
package com.jiuzhe.app.hotel.utils; import com.google.common.base.Splitter; import java.util.ArrayList; import java.util.List; import java.util.UUID; public class StringUtil { /** * 获取去掉横线的长度为32的UUID串. * * @return uuid. * @author WuShuicheng. */ public static String get32UUID() { return UUID.randomUUID().toString().replace("-", ""); } /** * @Description:判定String是否是null或者"" * @author:郑鹏宇 * @date:2018/3/30 */ public static boolean isEmptyOrNull(String str) { return null == str || str.isEmpty(); } public static String strArray2str(String[] strarray) { if (null == strarray) { return null; } String rs = ""; for (int i = 0; i < strarray.length; i++) { if (i == strarray.length - 1) { rs += strarray[i]; break; } rs += strarray[i] + ","; } return rs; } /** * @Description:将按照“,”切割的String转化为list * @author: 郑鹏宇 * @date 2018/8/11/011 */ public static List<String> stringToList(String str) { if (StringUtil.isEmptyOrNull(str)) { return new ArrayList<>(); } List<String> list = new ArrayList<>(); list = Splitter.on(',') .trimResults() .omitEmptyStrings() .splitToList(str); System.out.println(list); String a = list.get(0); return list; } /** * @Description:将["a","b","c"]变成('a','b') * @author: 郑鹏宇 * @date 2018/8/13/013 */ public static String ListToSqlStr(List<String> list) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size(); i++) { sb.append("'"+list.get(i)+"'").append(","); } String a = list.isEmpty()?"":sb.toString().substring(0, sb.toString().length() - 1); return "("+a+")"; } }
package tabuleiro; import java.util.ArrayList; import cartas.Baralho; import cartas.Carta; import jogador.Jogador; public class SorteReves extends Celula{ public static Baralho baralho; public Carta c; //armazena ultima carta retirada public SorteReves(int posicao, String tipo){ super(posicao, tipo); } public int jogada(Jogador j, ArrayList<Jogador> jogadores, Tabuleiro tabuleiro){ c = baralho.sortearCarta(); if(c.getTipo() == 0){ if(j.transacao(c.getValor()) == 1){ return 6; }else{ return 7; } }else if(c.getTipo() == 1){ j.setImune(1); baralho.setCartaPrisao(1); return 6; }else if(c.getTipo() == 2){ //caso tenha caído na celula vá para prisão if(j.getPosicao()<10){ j.andar(10 - j.getPosicao()); }else{ j.andar(50 - j.getPosicao()); } j.setIsPreso(1); return 8; }else if(c.getTipo() == 3){ //receba 50 de cada jogador int soma = 0; for (Jogador adversario : jogadores) { if(adversario != j) { if(adversario.transacao(-c.getValor()) == 1){ soma+=c.getValor(); } } } j.transacao(soma); return 6; }else if(c.getTipo() == 4){ j.andar( 40 - j.getPosicao()); j.transacao(this.c.getValor()); return 10; //j.transacao() } return -1; //TODO Controller.cartaReves } }
/* * Copyright 2006 Ameer Antar. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.antfarmer.ejce.util; import java.util.Arrays; /** * Utility useful for converting numbers to and from bytes. * @author Ameer Antar */ public final class ByteUtil { private static final long BYTE_BIT_MASK = 0xFF; private ByteUtil() { // static methods only } /** * Converts a long to its byte array representation. * @param number the long * @return the number's byte array representation */ public static byte[] toBytes(final long number) { final byte[] bytes = new byte[Long.SIZE / Byte.SIZE]; int b = 0; for (int i=bytes.length-1; i>=0; i--) { bytes[b++] = (byte) ((number >> (i * Byte.SIZE)) & BYTE_BIT_MASK); } return bytes; } /** * Converts a byte array to a long. * @param bytes the byte array * @return a long represented by the byte array */ public static long toLong(final byte[] bytes) { long num = 0; int b = 0; for (int i=bytes.length-1; i>=0; i--) { final long n = bytes[b++]; num |= ((n << (i * Byte.SIZE)) & (BYTE_BIT_MASK << (i * Byte.SIZE))); } return num; } /** * Converts an integer to its byte array representation. * @param number the integer * @return the number's byte array representation */ public static byte[] toBytes(final int number) { final byte[] bytes = new byte[Integer.SIZE / Byte.SIZE]; int b = 0; for (int i=bytes.length-1; i>=0; i--) { bytes[b++] = (byte) ((number >> (i * Byte.SIZE)) & BYTE_BIT_MASK); } return bytes; } /** * Converts a byte array to an integer. * @param bytes the byte array * @return an integer represented by the byte array */ public static int toInt(final byte[] bytes) { int num = 0; int b = 0; for (int i=bytes.length-1; i>=0; i--) { final int n = bytes[b++]; num |= ((n << (i * Byte.SIZE)) & ((int)(BYTE_BIT_MASK << (i * Byte.SIZE)))); } return num; } /** * Converts a short to its byte array representation. * @param number the short * @return the number's byte array representation */ public static byte[] toBytes(final short number) { final byte[] bytes = new byte[Short.SIZE / Byte.SIZE]; int b = 0; for (int i=bytes.length-1; i>=0; i--) { bytes[b++] = (byte) ((number >> (i * Byte.SIZE)) & BYTE_BIT_MASK); } return bytes; } /** * Converts a byte array to a short. * @param bytes the byte array * @return a short represented by the byte array */ public static short toShort(final byte[] bytes) { short num = 0; int b = 0; for (int i=bytes.length-1; i>=0; i--) { final short n = bytes[b++]; num |= ((n << (i * Byte.SIZE)) & ((short)(BYTE_BIT_MASK << (i * Byte.SIZE)))); } return num; } /** * Converts a double to its byte array representation. * @param number the double * @return the number's byte array representation */ public static byte[] toBytes(final double number) { return toBytes(Double.doubleToRawLongBits(number)); } /** * Converts a byte array to a double. * @param bytes the byte array * @return a double represented by the byte array */ public static double toDouble(final byte[] bytes) { return Double.longBitsToDouble(toLong(bytes)); } /** * Converts a float to its byte array representation. * @param number the float * @return the number's byte array representation */ public static byte[] toBytes(final float number) { return toBytes(Float.floatToRawIntBits(number)); } /** * Converts a byte array to a float. * @param bytes the byte array * @return a float represented by the byte array */ public static float toFloat(final byte[] bytes) { return Float.intBitsToFloat(toInt(bytes)); } /** * Returns a copy of the given byte array. * @param b the original byte array * @return a copy of the given byte array */ public static byte[] copy(final byte[] b) { if (b == null) { return null; } return copy(b, 0, b.length); } /** * Returns a copy of the given byte array using the given offset and length. * @param b the original byte array * @param offset the initial offset * @param length the length * @return a copy of the given byte array using the given offset and length */ public static byte[] copy(final byte[] b, final int offset, final int length) { if (b == null) { return null; } final byte[] copy = new byte[length]; if (length > 0) { System.arraycopy(b, offset, copy, 0, length); } return copy; } /** * Clears the values in the given byte array. * @param b the byte array */ public static void clear(final byte[] b) { if (b != null) { Arrays.fill(b, (byte) 0); } } /** * Clears the values in the given char array. * @param c the char array */ public static void clear(final char[] c) { if (c != null) { Arrays.fill(c, (char) 0); } } }
package es.coritel.codington.festival.interfaces.daos; import es.coritel.codington.festival.domain.Visitor; import es.coritel.codington.festival.exceptions.FERSGenericException;; public interface IVisitorDAO { public void insertData(Visitor visitor); public Visitor searchUserByUserName(String userName); }
package com.example.demo.dip.wrong; public class Game { public Game() { System.out.println("start game"); this.startInterface(); } private void startInterface() { System.out.println("IHM Text"); } public static void main(String[] args) { Game game = new Game(); } }
package com.example.demo.service; import java.util.List; import com.example.demo.model.Receipe; public interface ReceipeService { public List<Receipe> findAll(); public Receipe findById(Long theId); public void save(Receipe theReceipe); public void deleteById(Long theId); }
package net.fexcraft.app.fmt.wrappers; import java.util.ArrayList; import net.fexcraft.app.fmt.utils.RGB; public class TurboList extends ArrayList<PolygonWrapper> { private static final long serialVersionUID = -6386049255131269547L; public String id; private RGB color; private boolean rotXb, rotYb, rotZb; //private float rotX, rotY, rotZ, posX, posY, posZ;//FMR stuff public boolean visible = true, minimized; public int tempheight; public TurboList(String id){ this.id = id; } public void render(){ if(!visible) return; if(color != null) color.glColorApply(); this.forEach(elm -> elm.render(rotXb, rotYb, rotZb)); //for(int i = 0; i < size(); i++){ get(i).render(isSelected(i), rotXb, rotYb, rotZb); } if(color != null) RGB.glColorReset(); } /*private boolean isSelected(int elm){ for(Selection sel : FMTB.MODEL.getSelected()){ if(sel.group.equals(id) && sel.element == elm) return true; } return false; }*/ @Override public PolygonWrapper get(int id){ return id >= size() || id < 0 ? null : super.get(id); } }
/** * OpenKM, Open Document Management System (http://www.openkm.com) * Copyright (c) 2006-2015 Paco Avila & Josep Llort * * No bytes were intentionally harmed during the development of this application. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.openkm.webdav.resource; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.bradmcevoy.common.Path; import com.bradmcevoy.http.Resource; import com.openkm.api.OKMDocument; import com.openkm.api.OKMFolder; import com.openkm.api.OKMMail; import com.openkm.bean.Document; import com.openkm.bean.Folder; import com.openkm.bean.Mail; import com.openkm.bean.Repository; import com.openkm.core.AccessDeniedException; import com.openkm.core.Config; import com.openkm.core.DatabaseException; import com.openkm.core.PathNotFoundException; import com.openkm.core.RepositoryException; public class ResourceUtils { private static final Logger log = LoggerFactory.getLogger(ResourceUtils.class); /** * Resolve node resource (may be folder or document) */ public static Resource getNode(Path srcPath, String path) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException { log.debug("getNode({}, {})", srcPath, path); long begin = System.currentTimeMillis(); String fixedPath = ResourceUtils.fixRepositoryPath(path); Resource res = null; try { if (OKMFolder.getInstance().isValid(null, fixedPath)) { if (path.startsWith(fixRepositoryPath("/" + Repository.CATEGORIES))) { // Is from categories log.info("Path: {}", path); res = getCategory(srcPath, path); } else { res = getFolder(srcPath, path); } } else if (OKMDocument.getInstance().isValid(null, fixedPath)) { res = getDocument(path); } else if (OKMMail.getInstance().isValid(null, fixedPath)) { res = getMail(path); } } catch (PathNotFoundException e) { log.warn("PathNotFoundException: {}", e.getMessage()); } log.trace("getNode.Time: {}", System.currentTimeMillis() - begin); log.debug("getNode: {}", res); return res; } /** * Resolve folder resource. */ private static Resource getFolder(Path path, String fldPath) throws AccessDeniedException, PathNotFoundException, RepositoryException, DatabaseException { long begin = System.currentTimeMillis(); String fixedFldPath = fixRepositoryPath(fldPath); Folder fld = OKMFolder.getInstance().getProperties(null, fixedFldPath); List<Folder> fldChilds = OKMFolder.getInstance().getChildren(null, fixedFldPath); List<Document> docChilds = OKMDocument.getInstance().getChildren(null, fixedFldPath); List<Mail> mailChilds = OKMMail.getInstance().getChildren(null, fixedFldPath); Resource fldResource = new FolderResource(path, fld, fldChilds, docChilds, mailChilds); log.trace("getFolder.Time: {}", System.currentTimeMillis() - begin); return fldResource; } /** * Resolve document resource. */ private static Resource getDocument(String docPath) throws AccessDeniedException, PathNotFoundException, RepositoryException, DatabaseException { long begin = System.currentTimeMillis(); String fixedDocPath = fixRepositoryPath(docPath); Document doc = OKMDocument.getInstance().getProperties(null, fixedDocPath); Resource docResource = new DocumentResource(doc); log.trace("getDocument.Time: {}", System.currentTimeMillis() - begin); return docResource; } /** * Resolve mail resource. */ private static Resource getMail(String mailPath) throws AccessDeniedException, PathNotFoundException, RepositoryException, DatabaseException { long begin = System.currentTimeMillis(); String fixedMailPath = fixRepositoryPath(mailPath); Mail mail = OKMMail.getInstance().getProperties(null, fixedMailPath); Resource docResource = new MailResource(mail); log.trace("getMail.Time: {}", System.currentTimeMillis() - begin); return docResource; } /** * Resolve category resource. */ private static Resource getCategory(Path path, String catPath) throws AccessDeniedException, PathNotFoundException, RepositoryException, DatabaseException { long begin = System.currentTimeMillis(); String fixedFldPath = fixRepositoryPath(catPath); Folder cat = OKMFolder.getInstance().getProperties(null, fixedFldPath); List<Folder> catChilds = OKMFolder.getInstance().getChildren(null, fixedFldPath); //String uuid = OKMFolder.getInstance().getProperties(null, fixedFldPath).getUuid(); //List<Folder> fldChilds = OKMSearch.getInstance().getCategorizedFolders(null, uuid); //List<Document> docChilds = OKMSearch.getInstance().getCategorizedDocuments(null, uuid); //List<Mail> mailChilds = OKMSearch.getInstance().getCategorizedMails(null, uuid); // Fix node name //for (Folder fld : fldChilds) { //fld.setPath(fld.getPath() + "#" + fld.getUuid()); //} //catChilds.addAll(fldChilds); List<Document> docChilds = new ArrayList<Document>(); List<Mail> mailChilds = new ArrayList<Mail>(); Resource catResource = new CategoryResource(path, cat, catChilds, docChilds, mailChilds); log.trace("getCategory.Time: {}", System.currentTimeMillis() - begin); return catResource; } /** * Create HTML content. */ public static void createContent(OutputStream out, Path path, List<Folder> fldChilds, List<Document> docChilds, List<Mail> mailChilds) { log.debug("createContent({}, {}, {}, {}, {})", new Object[] { out, path, fldChilds, docChilds, mailChilds }); long begin = System.currentTimeMillis(); PrintWriter pw = new PrintWriter(out); pw.println("<html>"); pw.println("<header>"); pw.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"); pw.println("<link rel=\"Shortcut icon\" href=\"/" + path.getFirst() + "/favicon.ico\" />"); pw.println("<link rel=\"stylesheet\" href=\"/" + path.getFirst() + "/css/style.css\" type=\"text/css\" />"); pw.println("<title>OpenKM WebDAV</title>"); pw.println("</header>"); pw.println("<body>"); pw.println("<h1>OpenKM WebDAV</h1>"); pw.println("<table>"); if (!path.getStripFirst().getStripFirst().isRoot()) { String url = path.getParent().toPath(); pw.print("<tr>"); pw.print("<td><img src='/" + path.getFirst() + "/img/webdav/folder.png'/></td>"); pw.print("<td><a href='" + url + "'>..</a></td>"); pw.println("<tr>"); } if (fldChilds != null) { for (Folder fld : fldChilds) { Path fldPath = Path.path(fld.getPath()); String url = path.toPath().concat("/").concat(fldPath.getName()); pw.print("<tr>"); pw.print("<td><img src='/" + path.getFirst() + "/img/webdav/folder.png'/></td>"); pw.print("<td><a href='" + url + "'>" + fldPath.getName() + "</a></td>"); pw.println("<tr>"); } } if (docChilds != null) { for (Document doc : docChilds) { Path docPath = Path.path(doc.getPath()); String url = path.toPath().concat("/").concat(docPath.getName()); pw.print("<tr>"); pw.print("<td><img src='/" + path.getFirst() + "/mime/" + doc.getMimeType() + "'/></td>"); pw.print("<td><a href='" + url + "'>" + docPath.getName() + "</a></td>"); pw.println("<tr>"); } } if (mailChilds != null) { for (Mail mail : mailChilds) { Path mailPath = Path.path(mail.getPath()); String url = path.toPath().concat("/").concat(mailPath.getName()); pw.print("<tr>"); if (mail.getAttachments().isEmpty()) { pw.print("<td><img src='/" + path.getFirst() + "/img/webdav/email.png'/></td>"); } else { pw.print("<td><img src='/" + path.getFirst() + "/img/webdav/email_attach.png'/></td>"); } pw.print("<td><a href='" + url + "'>" + mailPath.getName() + "</a></td>"); pw.println("<tr>"); } } pw.println("</table>"); pw.println("</body>"); pw.println("</html>"); pw.flush(); pw.close(); log.trace("createContent.Time: {}", System.currentTimeMillis() - begin); } /** * Correct webdav folder path */ public static Folder fixResourcePath(Folder fld) { if (Config.SYSTEM_WEBDAV_FIX) { fld.setPath(fixResourcePath(fld.getPath())); } return fld; } /** * Correct webdav document path */ public static Document fixResourcePath(Document doc) { if (Config.SYSTEM_WEBDAV_FIX) { doc.setPath(fixResourcePath(doc.getPath())); } return doc; } /** * Correct webdav mail path */ public static Mail fixResourcePath(Mail mail) { if (Config.SYSTEM_WEBDAV_FIX) { mail.setPath(fixResourcePath(mail.getPath())); } return mail; } /** * */ private static String fixResourcePath(String path) { return path.replace("okm:", "okm_"); } /** * */ public static String fixRepositoryPath(String path) { if (Config.SYSTEM_WEBDAV_FIX) { return path.replace("okm_", "okm:"); } else { return path; } } }
package c.t.m.g; import android.bluetooth.BluetoothAdapter; import android.content.IntentFilter; import android.hardware.Sensor; import android.location.Location; import android.location.LocationManager; import android.net.wifi.ScanResult; import android.os.Build.VERSION; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; import android.os.Parcelable; import android.os.SystemClock; import android.telephony.CellLocation; import android.text.TextUtils; import android.util.SparseArray; import c.t.m.g.di.a; import c.t.m.g.dk.1; import com.tencent.map.geolocation.TencentLocationListener; import com.tencent.map.geolocation.TencentLocationManagerOptions; import com.tencent.map.geolocation.TencentLocationRequest; import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; import com.tencent.tencentmap.lbssdk.service.e; import java.lang.ref.WeakReference; 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.concurrent.CopyOnWriteArrayList; import org.eclipse.jdt.annotation.Nullable; public final class dg { public static final TencentLocationListener a = new 1(); private static SparseArray<String> n; private HandlerThread A; private dl B; private cv C; private dp D; private dt E; private dt F; private dq G; private final ct H; private WeakReference<TencentLocationListener> I; private volatile boolean J = false; private volatile double K = 0.0d; private long L; private final Object M = new Object(); private double N; private double O; private eb P; private long Q; private String R; private volatile boolean S = false; private cr T = null; private byte[] U = new byte[0]; public int b = 1; public dm c; public volatile int d = 0; public cu e; public List<WeakReference<TencentLocationListener>> f; public long g = 0; public volatile long h = 0; public volatile int i = 0; public final TencentLocationRequest j = TencentLocationRequest.create(); public eb k; public int l = 404; public volatile b m = b.d; private volatile HandlerThread o; private a p; private c q; private Handler r; private dc s; private di t; private boolean u; private df v; private de w; private da x; private dh y; private dk z; static /* synthetic */ dr m(dg dgVar) { dq dqVar; List list = null; dt dtVar = dgVar.E; dp dpVar = dgVar.D; dq dqVar2 = dgVar.G; if (dqVar2 == null || dgVar.g()) { dqVar = dqVar2; } else { dqVar = null; } if (dpVar == null) { ct ctVar = dgVar.H; dpVar = dp.a(ctVar, ec.b(ctVar), null); if (!ec.a(dpVar)) { dpVar = null; } } if (dtVar != null) { Object obj; if (System.currentTimeMillis() - dtVar.c < 60000) { obj = 1; } else { obj = null; } if (obj == null) { dtVar = null; } } if (!(dpVar == null || dqVar == null || VERSION.SDK_INT < 12)) { int i = dpVar.d; int i2 = dpVar.e; Parcelable parcelable = dqVar.a; Bundle bundle = new Bundle(); bundle.putString("cellkey", i + i2); bundle.putParcelable("location", parcelable); if (!dgVar.H.a(TencentLocationListener.CELL).b(bundle)) { new StringBuilder("getFromLastKnownInfo: discard bad cell(").append(i).append(",").append(i2).append(")"); dpVar = null; } } if (dgVar.x != null) { list = dgVar.x.a(); } return new dr(dtVar, dpVar, dqVar, list); } static { SparseArray sparseArray = new SparseArray(); n = sparseArray; sparseArray.put(0, "OK"); n.put(1, "ERROR_NETWORK"); n.put(2, "ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF"); n.put(4, "DEFLECT_FAILED"); n.put(404, "ERROR_SERVER_NOT_LOCATION"); HashMap hashMap = new HashMap(); hashMap.put("https", "true"); hashMap.put("up_apps", "true"); hashMap.put("up_wifis", "true"); hashMap.put("start_daemon", "true"); hashMap.put("up_daemon_delay", "300000"); hashMap.put("gps_kalman", "false"); hashMap.put("callback_wifis", "true"); hashMap.put("min_wifi_scan_interval", "8000"); hashMap.put("collect_bles", "false"); hashMap.put("start_event_track", "true"); hashMap.put("f_coll_item", "0"); cm.a(hashMap); } public dg(ct ctVar) { dc dcVar = null; this.H = ctVar; if (TencentLocationManagerOptions.isLoadLibraryEnabled()) { try { System.loadLibrary("tencentloc"); } catch (Throwable th) { this.d = 3; return; } } try { if (!TextUtils.isEmpty(TencentLocationManagerOptions.getKey())) { this.e.g = TencentLocationManagerOptions.getKey(); } } catch (Throwable th2) { th2.toString(); } this.e = this.H.b; String b = j.b(this.e.g); this.R = a(b); if (TextUtils.isEmpty(this.R)) { new StringBuilder("requestLocationUpdates: illegal key [").append(b).append("]"); this.d = 2; return; } this.H.a(this); this.C = cw.b(); this.B = new dl(); this.f = new CopyOnWriteArrayList(); this.y = new dh(this.H); this.z = new dk(this.H); this.w = de.a(ctVar.a); if (VERSION.SDK_INT >= 21) { this.x = new da(this.H.a); } this.u = VERSION.SDK_INT >= 18; Object[] objArr; df h; if (this.u) { di diVar; this.s = null; this.c = i(); if (this.H.b()) { diVar = new di(this.H); } else { diVar = null; } this.t = diVar; objArr = new Object[1]; h = h(); this.v = h; objArr[0] = h; } else { this.t = null; this.c = i(); if (this.H.b()) { dcVar = new dc(this.H); } this.s = dcVar; objArr = new Object[1]; h = h(); this.v = h; objArr[0] = h; } try { cm.a(this.H.a, "txsdk", this.H.b.d()); cm.a(this.R); cm.a().a = (cl) this.H.h; } catch (Throwable th3) { } } public final int a(TencentLocationRequest tencentLocationRequest, TencentLocationListener tencentLocationListener, Looper looper) { if (this.d != 0) { return this.d; } e(); if (this.e != null) { this.e.m = System.currentTimeMillis(); } this.l = 404; this.k = null; synchronized (this.M) { this.I = new WeakReference(tencentLocationListener); } if (this.e != null && "0123456789ABCDEF".equals(this.e.a())) { this.H.a(); } this.e.f = tencentLocationRequest.getQQ(); TencentLocationRequest.copy(this.j, tencentLocationRequest); if (TextUtils.isEmpty(j.b(this.e.d))) { this.e.d = tencentLocationRequest.getPhoneNumber(); } this.e.l = Math.max(cn.a().c("min_wifi_scan_interval"), tencentLocationRequest.getInterval()); this.h = tencentLocationRequest.getInterval(); this.m = b.a; if (this.A != null) { this.A.quit(); this.A = null; } a(looper); return 0; } private void a(Looper looper) { BluetoothAdapter bluetoothAdapter = null; synchronized (this.U) { Object obj; c cVar; Looper looper2; Object obj2; if (Looper.myLooper() == null) { Looper.prepare(); } if (this.q == null) { obj = 1; } else { obj = null; } if (!(obj == null && this.q.getLooper() == looper)) { this.q = new c(this, looper); } this.q.removeCallbacksAndMessages(null); if (this.r == null || this.r.getLooper() != Looper.getMainLooper()) { this.r = new Handler(Looper.getMainLooper()); } d(); if (this.o == null || !this.o.isAlive() || this.o.getLooper() == null) { this.o = new HandlerThread("loc_inner_thread"); this.o.start(); } if (this.p == null) { this.p = new a(this, this.o.getLooper()); } else { this.p.a(); } boolean z = this.j.getExtras().getBoolean("use_network", true); boolean z2 = b.b == this.m; a aVar = this.p; dk dkVar = this.z; if (!dkVar.g) { dkVar.g = true; dkVar.i = aVar; dkVar.h = z2; dkVar.b.c.execute(new 1(dkVar)); dkVar.f = SystemClock.elapsedRealtime(); } if (this.u) { if (z) { if (this.t != null) { obj = 1; } else { obj = null; } if (obj != null) { if (aVar != null) { obj = 1; } else { obj = null; } if (obj != null) { di diVar = this.t; if (!diVar.a) { diVar.g = aVar; if (diVar.h == null) { diVar.h = new ArrayList(); } diVar.d = new HandlerThread("new_cell_provider"); if (!(diVar.d == null || diVar.g == null)) { try { diVar.d.start(); diVar.e = new a(diVar, diVar.d.getLooper(), (byte) 0); } catch (Throwable th) { diVar.e = new a(diVar, diVar.g.getLooper(), (byte) 0); } diVar.e.post(diVar.f); if (!z2) { diVar.e.sendEmptyMessage(0); } } } } } } } else if (z) { if (this.s != null) { obj = 1; } else { obj = null; } if (obj != null) { if (aVar != null) { obj = 1; } else { obj = null; } if (obj != null) { dc dcVar = this.s; if (!dcVar.a) { dcVar.a = true; dcVar.h = new HandlerThread("CellProvider"); dcVar.h.start(); dcVar.i = new dc.a(dcVar, dcVar.h.getLooper(), (byte) 0); dcVar.i.sendEmptyMessageDelayed(0, 3000); CellLocation b = ec.b(dcVar.b); if (dcVar.a(b)) { dp a = dp.a(dcVar.b, b, null); if (a != null) { dcVar.d = b; dcVar.b.c(a); } } dcVar.a(273); } } } } if (z) { if (this.c != null) { obj = 1; } else { obj = null; } if (obj != null) { if (aVar != null) { obj = 1; } else { obj = null; } if (obj != null) { this.c.j = this.e.l; dm dmVar = this.c; cVar = this.q; synchronized (dmVar.k) { if (dmVar.a) { } else { dmVar.a = true; dm.d = z2; dmVar.e = aVar; if (dmVar.e == null) { looper2 = null; } else { looper2 = dmVar.e.getLooper(); } if (dmVar.f == null || dmVar.f.getLooper() != looper2) { if (dmVar.f != null) { dmVar.f.removeCallbacksAndMessages(null); } if (looper2 != null) { dmVar.f = new dm.a(dmVar, looper2); } } cVar.post(dmVar.h); if (!dm.d) { dmVar.a(0); } } } } } } if (this.v != null) { obj = 1; } else { obj = null; } if (obj != null && this.j.isAllowGPS()) { if (aVar != null) { obj = 1; } else { obj = null; } if (obj != null) { boolean z3; df dfVar = this.v; if (this.b == 1) { z3 = true; } else { z3 = false; } dfVar.l = z3; dfVar = this.v; cVar = this.q; if (!dfVar.k) { dfVar.k = true; dfVar.d = 0; dfVar.r = -1; looper2 = aVar == null ? null : aVar.getLooper(); if ((dfVar.n == null || dfVar.n.getLooper() != looper2) && looper2 != null) { dfVar.n = new df.a(dfVar, aVar.getLooper()); } if (z2) { aVar.post(dfVar.q); } else { aVar.post(dfVar.o); int i = VERSION.SDK_INT; cVar.post(dfVar.p); } if (dfVar.c()) { dfVar.b = 4; dfVar.d(); } } } } if (z2) { dk dkVar2 = this.z; String d = this.H.d(); try { if (!TextUtils.isEmpty(d)) { byte[] a2 = ei.a(d.getBytes("UTF-8")); e.o(a2, 2); a aVar2 = new a(2, a2, "http://ue.indoorloc.map.qq.com/", null); aVar2.b = d; dkVar2.a(aVar2); } } catch (Throwable th2) { } } else { if (!cn.a().d("collect_bles")) { this.x = null; } if (this.x != null) { obj = 1; } else { obj = null; } if (obj != null) { if (aVar != null) { obj = 1; } else { obj = null; } if (obj != null) { da daVar = this.x; synchronized (daVar.g) { try { if (daVar.a != null) { bluetoothAdapter = daVar.a.getAdapter(); } daVar.b = bluetoothAdapter; if (daVar.b != null) { daVar.c = daVar.b.getBluetoothLeScanner(); } } catch (Throwable th3) { th3.toString(); } daVar.f = new HandlerThread("ble_thread"); daVar.f.start(); daVar.e = new da.a(daVar, daVar.f.getLooper()); daVar.e.sendEmptyMessage(1000); } } } if (aVar != null) { obj2 = 1; } else { obj2 = null; } if (obj2 != null) { dh dhVar = this.y; if (!dhVar.b) { dhVar.b = true; if (aVar != null) { try { dhVar.a.a.registerReceiver(dhVar, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"), null, aVar); } catch (Exception e) { } } } } if (this.w != null) { obj2 = 1; } else { obj2 = null; } if (obj2 != null && this.j.isAllowDirection()) { if (aVar != null) { obj2 = 1; } else { obj2 = null; } if (obj2 != null) { de deVar = this.w; if (!(!deVar.b || deVar.c || aVar == null)) { try { Sensor defaultSensor = deVar.a.getDefaultSensor(11); if (defaultSensor != null) { deVar.a.registerListener(deVar, defaultSensor, 3, aVar); deVar.c = true; } } catch (Throwable th4) { } } } } } if (aVar != null) { obj2 = 1; } else { obj2 = null; } if (obj2 != null) { int b2 = cn.a().b("f_coll_item"); if ((b2 == 1 || b2 == 2) && this.T == null) { this.T = new cr(this.H); } if (this.T != null) { new StringBuilder("fc:dc.1.0.1_171109,set:").append(b2).append(",daemon:").append(z2); if (b2 == 2 || (b2 == 1 && !z2)) { cr crVar = this.T; if (!crVar.b) { crVar.a(); cs csVar; try { obj2 = crVar.a.a.getExternalFilesDir("data").getAbsolutePath(); if (!TextUtils.isEmpty(obj2)) { crVar.c = new cs(crVar.a, obj2); csVar = crVar.c; boolean z4 = csVar.b != null && (csVar.b.exists() || csVar.b.mkdirs()); csVar.c = z4; if (csVar.c) { csVar.d = new HandlerThread("data_c", 10); csVar.d.start(); csVar.e = new cs.a(csVar, csVar.d.getLooper()); csVar.i = System.currentTimeMillis() - 30000; } crVar.b = true; } } catch (Throwable th32) { th32.toString(); } } } } } } return; } public final void a(eb ebVar) { if (ebVar != null) { if (this.w != null && this.j.isAllowDirection()) { ebVar.getExtra().putDouble("direction", this.w.a()); } try { ebVar.getExtra().putAll(this.j.getExtras()); } catch (Exception e) { } } } public final void a() { Object obj; synchronized (this.U) { d(); try { if (this.p != null) { this.p.a(); this.p = null; } if (this.o != null) { this.o.quit(); this.o = null; } } catch (Throwable th) { } } synchronized (this.M) { if (this.I != null) { this.I.clear(); } this.I = null; if (this.f != null) { this.f.clear(); } } if (this.C != null) { obj = 1; } else { obj = null; } if (obj != null) { this.C.a(); } e(); if (cn.a().d("start_daemon")) { if (this.m == b.a && ej.c(this.H).equalsIgnoreCase("{}")) { this.A = new HandlerThread("daemon_thread"); this.A.start(); new Handler(this.A.getLooper()).postDelayed(new 2(this), 5000); this.Q = System.currentTimeMillis(); } else { new StringBuilder("daemon not start! is wifi or running status=").append(this.m); } } this.m = b.d; } private void d() { boolean z; ec.a = false; if (this.y != null) { z = true; } else { z = false; } if (z) { dh dhVar = this.y; if (dhVar.b) { dhVar.b = false; try { dhVar.a.a.unregisterReceiver(dhVar); } catch (Exception e) { } } } if (this.z != null) { z = true; } else { z = false; } if (z) { dk dkVar = this.z; if (dkVar.g) { dkVar.g = false; dkVar.a.clear(); dkVar.a.offer(a.d); dkVar.i = null; if (dkVar.f != 0) { long elapsedRealtime = SystemClock.elapsedRealtime() - dkVar.f; String.format(Locale.ENGLISH, "shutdown: duration=%ds, sent=%dB, recv=%dB, reqCount=%d", new Object[]{Long.valueOf(elapsedRealtime / 1000), Long.valueOf(dkVar.d), Long.valueOf(dkVar.e), Long.valueOf(dkVar.c)}); } dkVar.c = 0; dkVar.d = 0; dkVar.e = 0; dkVar.f = 0; } } if (this.B != null) { z = true; } else { z = false; } if (z) { this.B.a(); } if (this.c != null) { z = true; } else { z = false; } if (z) { dm dmVar = this.c; synchronized (dmVar.k) { if (dmVar.a) { dmVar.a = false; try { dmVar.b.a.unregisterReceiver(dmVar); } catch (Exception e2) { } dmVar.c = null; if (dmVar.g != null) { dmVar.g.clear(); } if (dmVar.c != null) { dmVar.c.clear(); } if (dmVar.f != null) { dmVar.f.removeCallbacksAndMessages(null); dmVar.f = null; } } } } if (this.u) { if (this.t != null) { z = true; } else { z = false; } if (z) { di diVar = this.t; if (diVar.a) { diVar.a = false; diVar.a(0); synchronized (diVar.b) { if (diVar.e != null) { diVar.e.a = true; diVar.e.removeCallbacksAndMessages(null); diVar.e = null; } if (diVar.d != null) { diVar.d.quit(); diVar.d = null; } diVar.c = null; if (diVar.h != null) { diVar.h = null; } } } } } else { if (this.s != null) { z = true; } else { z = false; } if (z) { dc dcVar = this.s; if (dcVar.a) { dcVar.a = false; dcVar.a(0); synchronized (dcVar.c) { if (dcVar.i != null) { dcVar.i.a = true; dcVar.i.removeCallbacksAndMessages(null); dcVar.i = null; } if (dcVar.h != null) { dcVar.h.quit(); dcVar.h = null; } dcVar.d = null; dcVar.e = null; dcVar.f = null; dcVar.g = 0; } } } } if (this.v != null) { z = true; } else { z = false; } if (z) { df dfVar = this.v; if (dfVar.k) { dfVar.k = false; dfVar.b = WXMediaMessage.DESCRIPTION_LENGTH_LIMIT; dfVar.e = false; dfVar.f = false; dfVar.i = 0; dfVar.h = 0; dfVar.g = 0; dfVar.j.clear(); dfVar.m = -1; dfVar.l = false; Arrays.fill(dfVar.s, 0.0d); dfVar.a.b(dfVar); LocationManager locationManager = dfVar.a.g; try { locationManager.removeGpsStatusListener(dfVar); } catch (Exception e3) { } try { locationManager.removeUpdates(dfVar); } catch (Exception e4) { } dfVar.n = null; dfVar.c = null; } } if (this.w != null) { z = true; } else { z = false; } if (z && this.j.isAllowDirection()) { de deVar = this.w; if (deVar.b && deVar.c) { deVar.c = false; deVar.d = Double.NaN; deVar.a.unregisterListener(deVar); } } if (this.x != null) { z = true; } else { z = false; } if (z) { da daVar = this.x; synchronized (daVar.g) { if (daVar.d && daVar.e != null && daVar.e.getLooper().getThread().isAlive()) { daVar.e.sendEmptyMessage(2000); daVar.e.postDelayed(new da.1(daVar.e, daVar.f), 50); daVar.e = null; daVar.f = null; } } } if (this.S) { cm.a().c(); this.S = false; } if (this.T != null) { cr crVar = this.T; if (crVar.b) { crVar.b = false; crVar.a(); if (crVar.c != null) { cs csVar = crVar.c; if (csVar.a()) { csVar.a(1005); csVar.a(1007); csVar.a(1006); csVar.a(true); HandlerThread handlerThread = csVar.d; csVar.e.postDelayed(new cs.1(csVar.e, handlerThread), 200); csVar.e = null; csVar.d = null; csVar.c = false; } crVar.c = null; } } } } private void e() { this.i = 0; this.E = null; this.D = null; this.G = null; this.L = 0; dr.a = 0; if (VERSION.SDK_INT >= 12) { this.H.a(TencentLocationListener.CELL).a(); } if (this.e != null) { this.e.p = ""; this.e.o = 0; this.e.n = 0; this.e.m = 0; } } private void a(int i, eb ebVar) { Object obj = 1; if (ebVar != null) { if (!(i != 0 || ebVar.getLatitude() == 0.0d || ebVar.getLongitude() == 0.0d)) { int i2 = 0; if (this.b == 1 && ed.a(ebVar.getLatitude(), ebVar.getLongitude())) { i2 = 1; } eb.a(ebVar, i2); } boolean z; if (f()) { if (ebVar.getAccuracy() < 5000.0f && ebVar.getAccuracy() > 0.0f) { this.B.a(ebVar); z = this.J; } this.N = ebVar.getLatitude(); this.O = ebVar.getLongitude(); if (j.a(this.I) && this.j.getInterval() > 0) { a(11999, this.j.getInterval()); } } else if (i == 0 && ebVar.getLatitude() != 0.0d && ebVar.getLongitude() != 0.0d && Math.abs(ebVar.getLatitude() - this.N) >= 1.0E-8d && Math.abs(ebVar.getLongitude() - this.O) >= 1.0E-8d) { if (this.B.a(ebVar, this.H, this.v.c())) { this.N = ebVar.getLatitude(); this.O = ebVar.getLongitude(); if (ebVar.getAccuracy() < 5000.0f && ebVar.getAccuracy() > 0.0f) { this.B.a(ebVar); this.B.a(ebVar); z = this.J; } } else { new StringBuilder("discard ").append(ebVar); return; } } if (this.l == 0 || i != 0) { obj = null; } this.l = i; this.k = ebVar; if (this.j.getInterval() == 0 && j.a(this.I) && TencentLocationListener.GPS != this.k.getProvider()) { a(11998); } else if (obj != null && j.a(this.I)) { a(11998); } } } private boolean f() { return this.l == 404; } private boolean g() { if (this.v != null && this.v.c() && this.v.b()) { return true; } return false; } public final void a(int i) { if (this.p != null) { this.p.sendEmptyMessage(i); } } private void a(int i, long j) { if (this.p != null) { this.p.removeMessages(i); this.p.sendEmptyMessageDelayed(i, j); } } public final void onCellInfoEvent(dp dpVar) { int i; Object obj = null; this.D = dpVar; long max = Math.max(this.j.getInterval(), 20000); List emptyList = Collections.emptyList(); if (this.c != null) { int i2; if (this.c.a()) { i2 = 0; } else { i2 = 1; } i = i2; } else { i = 1; } if (i != 0) { this.E = null; } List list; if (i == 1 || this.H == null) { list = emptyList; } else { list = ej.c(this.H.f); list.size(); } if (i == 1 || list.size() == 0 || this.L == -1 || (this.L > 0 && System.currentTimeMillis() - this.L > max)) { a(3999); } new StringBuilder("cell change run prepare json,because status:").append(i).append(",mLastWF:").append(this.L).append(",current:").append(System.currentTimeMillis()); if (this.T != null) { cr crVar = this.T; if (crVar.b && dpVar != null) { if (crVar.d == null || !(crVar.d == null || crVar.d.b().equals(dpVar.b()))) { obj = 1; } crVar.d = dpVar; crVar.e = ec.a(crVar.a); if (obj != null) { crVar.c(); } } } } public final void onWifiInfoEvent(dt dtVar) { Object obj = null; if (this.F != null) { dt dtVar2 = this.F; if (dtVar != null) { List list = dtVar.b; List list2 = dtVar2.b; if (!(list.size() == 0 || list2.size() == 0)) { boolean z; int size = list.size(); int size2 = list2.size(); if (size == 0 && size2 == 0) { z = true; } else if (size == 0 || size2 == 0) { z = false; } else { List list3; List list4; if (list.size() > list2.size()) { list3 = list2; list4 = list; } else { list3 = list; list4 = list2; } int i = 0; for (ScanResult scanResult : list3) { for (ScanResult scanResult2 : list4) { if (scanResult2.BSSID.equals(scanResult.BSSID)) { i++; break; } } } int i2 = size + size2; if (((double) (i << 1)) < ((double) i2) * 0.85d || i < 13) { z = true; } else { z = false; } new StringBuilder("isDiffrent:c=").append(size).append(",k=").append(i).append(",f=").append(i2).append(",r=0.85,s=").append(z); } if (!z) { int obj2 = 1; } } } } if (obj2 != null) { this.L = System.currentTimeMillis(); } if (this.E == null || this.i == 2 || dtVar == dt.a || this.L == -1 || Collections.unmodifiableList(dtVar.b).size() < 3 || obj2 == null) { a(3999); } this.E = dtVar; if (this.T != null) { cr crVar = this.T; if (crVar.b && dtVar != null) { crVar.f = dtVar; if (crVar.b() && crVar.f != null && crVar.c != null) { crVar.c.a(crVar.g, crVar.f, crVar.e); } } } } public final void onGpsInfoEvent(dq dqVar) { if (dqVar.a != dd.a) { double d; double d2; this.G = dqVar; int i = this.b; int requestLevel = this.j.getRequestLevel(); eb ebVar = this.P; Location location = new Location(dqVar.a); Bundle extras = location.getExtras(); if (extras != null) { double d3 = extras.getDouble("lat"); d = extras.getDouble("lng"); d2 = d3; } else { d = 0.0d; d2 = 0.0d; } eb.a aVar; eb a; if (ei.a(i)) { aVar = new eb.a(); aVar.b = ebVar; aVar.d = TencentLocationListener.GPS; aVar.c = requestLevel; a = aVar.a(new Location(dqVar.a)).a(); location.setLatitude(d2); location.setLongitude(d); a.a(location); a(0, a); } else { if (f()) { a(3999); } aVar = new eb.a(); aVar.b = ebVar; aVar.d = TencentLocationListener.GPS; aVar.c = requestLevel; a = aVar.a(new Location(dqVar.a)).a(); location.setLatitude(d2); location.setLongitude(d); a.a(location); a(0, a); } a(12004, 3); if (this.v != null) { this.v.b(); } } if (this.T != null) { cr crVar = this.T; if (crVar.b && dqVar != null) { crVar.g = dqVar; if (crVar.h == null || (crVar.g != null && crVar.g.a.distanceTo(crVar.h) >= 50.0f)) { crVar.c(); } } } } public final void onStatusEvent(Message message) { int i = message.what; a(message.arg1, message.arg2); } public final void onNetworkEvent(Integer num) { String str; int a = j.a(this.H.a); if (a != -1) { if (a == 0) { str = "mobile"; } else if (a == 1) { str = TencentLocationListener.WIFI; } switch (num.intValue()) { case 0: new StringBuilder("onNetworkEvent: ").append(str).append(" disconnected"); return; case 1: new StringBuilder("onNetworkEvent: ").append(str).append(" connected"); a(7999, 1000); if (this.T != null) { cr crVar = this.T; int intValue = num.intValue(); if (crVar.b && intValue == 1 && crVar.c != null) { crVar.c.a(false); return; } return; } return; default: return; } } str = "none"; switch (num.intValue()) { case 0: new StringBuilder("onNetworkEvent: ").append(str).append(" disconnected"); return; case 1: new StringBuilder("onNetworkEvent: ").append(str).append(" connected"); a(7999, 1000); if (this.T != null) { cr crVar2 = this.T; int intValue2 = num.intValue(); if (crVar2.b && intValue2 == 1 && crVar2.c != null) { crVar2.c.a(false); return; } return; } return; default: return; } } /* JADX WARNING: inconsistent code. */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void a(int r6, int r7) { /* r5 = this; r1 = 0; r3 = 2; switch(r6) { case 12001: goto L_0x0081; case 12002: goto L_0x003a; case 12003: goto L_0x0064; case 12004: goto L_0x004f; default: goto L_0x0005; }; L_0x0005: r0 = r1; r2 = r1; L_0x0007: r1 = r5.q; if (r1 == 0) goto L_0x0039; L_0x000b: r1 = r5.q; r3 = 3102; // 0xc1e float:4.347E-42 double:1.5326E-320; r3 = r1.obtainMessage(r3); r1 = r3.getData(); if (r1 != 0) goto L_0x001e; L_0x0019: r1 = new android.os.Bundle; r1.<init>(); L_0x001e: r1.clear(); r4 = "name"; r1.putString(r4, r2); r2 = "status"; r1.putInt(r2, r7); r2 = "desc"; r1.putString(r2, r0); r3.setData(r1); r3.sendToTarget(); L_0x0039: return; L_0x003a: r1 = "gps"; switch(r7) { case 0: goto L_0x004a; case 1: goto L_0x0045; default: goto L_0x0040; }; L_0x0040: r0 = "unknown"; r2 = r1; goto L_0x0007; L_0x0045: r0 = "gps enabled"; r2 = r1; goto L_0x0007; L_0x004a: r0 = "gps disabled"; r2 = r1; goto L_0x0007; L_0x004f: r1 = "gps"; switch(r7) { case 3: goto L_0x005a; case 4: goto L_0x005f; default: goto L_0x0055; }; L_0x0055: r0 = "unknown"; r2 = r1; goto L_0x0007; L_0x005a: r0 = "gps available"; r2 = r1; goto L_0x0007; L_0x005f: r0 = "gps unavailable"; r2 = r1; goto L_0x0007; L_0x0064: r1 = "cell"; r0 = 1; if (r7 != r0) goto L_0x0077; L_0x006a: r0 = "cell enabled"; L_0x006d: r2 = c.t.m.g.ec.a; if (r2 == 0) goto L_0x00a4; L_0x0071: r0 = "location permission denied"; r2 = r1; r7 = r3; goto L_0x0007; L_0x0077: if (r7 != 0) goto L_0x007d; L_0x0079: r0 = "cell disabled"; goto L_0x006d; L_0x007d: r0 = "unknown"; goto L_0x006d; L_0x0081: r1 = "wifi"; switch(r7) { case 0: goto L_0x0098; case 1: goto L_0x009c; case 2: goto L_0x0087; case 3: goto L_0x0087; case 4: goto L_0x0087; case 5: goto L_0x00a0; default: goto L_0x0087; }; L_0x0087: r0 = "unknown"; L_0x008a: r2 = 5; if (r7 == r2) goto L_0x00a4; L_0x008d: r2 = c.t.m.g.ej.a; if (r2 == 0) goto L_0x00a4; L_0x0091: r0 = "location permission denied"; r2 = r1; r7 = r3; goto L_0x0007; L_0x0098: r0 = "wifi disabled"; goto L_0x008a; L_0x009c: r0 = "wifi enabled"; goto L_0x008a; L_0x00a0: r0 = "location service switch is off"; goto L_0x008a; L_0x00a4: r2 = r1; goto L_0x0007; */ throw new UnsupportedOperationException("Method not decompiled: c.t.m.g.dg.a(int, int):void"); } public final void a(eb ebVar, int i, int i2) { if (ebVar != null && this.q != null) { Message obtainMessage = this.q.obtainMessage(i2); Bundle data = obtainMessage.getData(); if (data == null) { data = new Bundle(); } data.clear(); data.putInt("error_code", i); data.putParcelable("tx_location", ebVar); obtainMessage.setData(data); obtainMessage.sendToTarget(); } } @Nullable private df h() { Object obj; if (this.H.g != null) { obj = 1; } else { obj = null; } if (obj == null) { return null; } return new df(this.H); } @Nullable private dm i() { Object obj; if (this.H.f != null) { obj = 1; } else { obj = null; } if (obj == null) { return null; } return new dm(this.H); } private static String a(String str) { Object obj = 1; if (str.contains(",")) { try { String[] split = str.split(","); if (split == null || split.length <= 1 || split[0] == null || split[1] == null || e.w(split[0], split[1]) <= 0) { obj = null; } return obj != null ? split[0] : ""; } catch (UnsatisfiedLinkError e) { return null; } } int v = e.v(str); return v >= 0 ? Integer.toString(v) : ""; } }
package com.smxknife.java2.thread.completablefuture; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; /** * @author smxknife * 2020/8/21 */ public class Demo02 { public static void main(String[] args) { CompletableFuture[] completableFutures = Stream.iterate(0, idx -> idx + 1).limit(10).map(idx -> CompletableFuture.supplyAsync(() -> { try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } return "success"; }).whenComplete((val, th) -> { System.out.println(val); System.out.println(th); })).toArray(CompletableFuture[]::new); CompletableFuture.allOf(completableFutures).runAfterEither(CompletableFuture.runAsync(() -> { System.out.println("yyyy"); }), () -> { System.out.println("xxx"); }).join(); System.out.println("main"); } }
package jiwoo.servlet.roomBoard; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jiwoo.database.infoBoard.infoBoard; import jiwoo.database.roomBoard.roomBoard; @WebServlet("/roomInsert") public class roomInsert extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); String title = request.getParameter("title"); String content = request.getParameter("content"); String deposit = request.getParameter("deposit"); String rent = request.getParameter("rent"); String latitude = request.getParameter("latitude"); String longitude = request.getParameter("longitude"); String uid = request.getParameter("uid"); roomBoard rb = new roomBoard(); rb.insertRoom(title,content,uid,deposit,rent,latitude,longitude); response.sendRedirect("/index.html"); } }
package com.mobica.rnd.parking.parkingbe.controller; import com.mobica.rnd.parking.parkingbe.exception.CarException; import com.mobica.rnd.parking.parkingbe.model.Car; import com.mobica.rnd.parking.parkingbe.service.CarsManagementService; import com.mobica.rnd.parking.parkingbe.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController @RequestMapping("/car/") public class CarsManagementController { private CarsManagementService carsManagementService; private UserService userService; @Autowired public CarsManagementController(CarsManagementService carsManagementService,UserService userService) { this.carsManagementService = carsManagementService; this.userService = userService; } @PostMapping("/add") public Car addCar(@RequestBody @Valid Car car) { return carsManagementService.addCar(car); } @GetMapping("/list") public List<Car> showAllUserCars (@RequestParam("id") String userId) { return carsManagementService.findByUser(userId); } @PatchMapping("/active/{id}") public Car updateActiveState(@PathVariable String id, @RequestBody Car car) throws CarException { return carsManagementService.updateActiveState(id, car); } }
package com.ace.easyteacher.Adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.ace.easyteacher.DataBase.Check; import com.ace.easyteacher.R; import java.util.ArrayList; import java.util.List; public class CheckAdapter extends RecyclerView.Adapter<CheckAdapter.ViewHolder> { private List<Check> mList = new ArrayList<>(); private Context mContext; public CheckAdapter(Context context, List<Check> list) { this.mContext = context; this.mList = list; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.check_item, parent,false)); } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.bindView(mList.get(position)); } @Override public int getItemCount() { return mList.size(); } public class ViewHolder extends RecyclerView.ViewHolder { private TextView mTextTime, mText; public ViewHolder(View view) { super(view); mTextTime = (TextView) view.findViewById(R.id.item_time); mText = (TextView) view.findViewById(R.id.item_text); } void bindView(Check check) { mTextTime.setText(check.getTime()); mText.setText(check.getContent()); } } }
package com.smartup.manageorderapplication.repositories; import java.time.LocalDateTime; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.smartup.manageorderapplication.entities.Order; public interface OrderRepository extends JpaRepository<Order, Long>{ public List<Order> findByClientIdOrderByOrderDate (Long idClient); public List<Order> findByClientIdAndOrderDateBetweenOrderByOrderDate (Long idCliente, LocalDateTime dateOne, LocalDateTime dateTwo); }
package com.xworkz.rental.controller; import javax.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.xworkz.rental.dto.CompanyGadgetsDTO; import com.xworkz.rental.dto.CompanyRegistrationDTO; import com.xworkz.rental.service.CompanyGadgetsService; import com.xworkz.rental.utility.response.Response; @RestController @RequestMapping("/api") @CrossOrigin(origins = {"http://localhost:4200", "http://localhost:4201","https://x-workzdev.github.io" }) public class CompanyGadgetListController { @Autowired private CompanyGadgetsService companyGadgetsService; private Logger logger = LoggerFactory.getLogger(getClass()); public CompanyGadgetListController() { logger.info("invoking ---------" + this.getClass().getSimpleName()); } @PostMapping("/AddGadgets") public ResponseEntity<Response> AddGadgets(@Valid @RequestBody CompanyGadgetsDTO gadgetsDTO) { logger.info("invoking registrationController.clientRegistration() "); Response response = null; try { if (gadgetsDTO != null) { logger.info("registrationDto not null" + gadgetsDTO); response = companyGadgetsService.addGadgets(gadgetsDTO); logger.info("Returning respone " + response); } } catch (Exception e) { logger.error(e.getMessage(), e); } return new ResponseEntity<Response>(response, HttpStatus.OK); } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.jakc.payment.db.controller; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import org.openswing.swing.domains.java.Domain; /** * * @author wahhid */ public class JenisTransaksiController { private Connection conn; private PreparedStatement pstmt; private ResultSet rst ; private int ErrStatus=0; private String ErrMsg; public JenisTransaksiController(Connection conn){ this.conn = conn; } public Domain getCB(){ Domain d = new Domain("JENISTRANSAKSI"); d.addDomainPair(0, "Langganan Baru"); d.addDomainPair(1, "Perpanjang Langganan"); d.addDomainPair(2, "Stop Langganan"); return d; } }
package br.com.bhl.superfid.view; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.gson.Gson; import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult; import com.journeyapps.barcodescanner.CaptureActivity; import java.io.IOException; import br.com.bhl.superfid.R; import br.com.bhl.superfid.model.Usuario; import br.com.bhl.superfid.util.WebClient; public class MainActivity extends ComumActivity { private Toolbar toolbar; private FirebaseAuth firebaseAuth; private FirebaseUser firebaseUser; private Usuario usuario; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initViews(); firebaseAuth = FirebaseAuth.getInstance(); firebaseUser = firebaseAuth.getCurrentUser(); initUser(); } /* *************************************************************************** * METODOS DE CICLO DE VIDA DO ANDROID * *************************************************************************** */ @Override protected void initViews() { progressBar = (ProgressBar) findViewById(R.id.main_progressbar); toolbar = (Toolbar) findViewById(R.id.toolbar); } @Override protected void initUser() { GetUsuarioService getUsuarioService = new GetUsuarioService(); getUsuarioService.execute(firebaseUser.getUid()); } /* *************************************************************************** * METODOS DE CICLO DE VIDA DO ANDROID * *************************************************************************** */ @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_sign_out) { firebaseAuth.signOut(); startActivity(new Intent(this, LoginActivity.class)); finish(); } return super.onOptionsItemSelected(item); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (result != null) { if (result.getContents() == null) { Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show(); } else { Intent it = new Intent(this, MainBluetoothActivity.class); it.putExtra("qrResult", result.getContents()); it.putExtra("usuario",usuario); startActivity(it); finish(); } } else { super.onActivityResult(requestCode, resultCode, data); } } @Override protected void onDestroy() { super.onDestroy(); } /* *************************************************************************** * METODOS DE CICLO DE VIDA DO ANDROID * *************************************************************************** */ public void scanQrCode(View view) { IntentIntegrator integrator = new IntentIntegrator(this); integrator.setOrientationLocked(true); integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES); integrator.setPrompt("Aproxime do QRCode do Carrinho"); integrator.setTimeout(8000); integrator.setBeepEnabled(true); integrator.setCaptureActivity(CaptureActivity.class); integrator.initiateScan(); } private class GetUsuarioService extends AsyncTask<String, Void, Usuario> { @Override protected void onPreExecute() { super.onPreExecute(); openProgressBar(); } @Override protected Usuario doInBackground(String... strings) { Usuario user = null; String json = ""; Gson gson = new Gson(); try { json = WebClient.get("/usuario/parseJson?codigoAutenticacao=", strings[0]); } catch (IOException e) { e.printStackTrace(); } user = gson.fromJson(json, Usuario.class); return user; } @Override protected void onPostExecute(Usuario usuario) { super.onPostExecute(usuario); closeProgressBar(); setUsuario(usuario); toolbar.setTitle("Seja bem-vindo " + getUsuario().getNome()); setSupportActionBar(toolbar); } } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class Rover extends Actor { public boolean crashed = false; protected Rover gNachfolger; /** * Konstruktor der Klasse Rover. Hier wird das Objekt erzeugt und mit sinnvollen Startwerten initialisiert. * Normalfall: Hier muss nichts verändert werden. */ public Rover() { } /** * Der Rover bewegt sich ein Feld in Fahrtrichtung weiter. * Sollte sich in Fahrtrichtung ein Objekt der Klasse Tree befinden oder er sich an der Grenze der Welt befinden, * dann erscheint eine entsprechende Meldung auf dem Display. */ public void move() { if(TreeVorhanden("forward") || RaupeVorhanden()) { crashed = true; } else { move(1); // Greenfoot.delay(1); } } public void erkenneRaupe(Rover pNachfolger) { gNachfolger=pNachfolger; } public void fahreInKette() { int rot = getRotation(); move(); if(gNachfolger!=null) { gNachfolger.fahreInKette(); gNachfolger.setRotation(rot); } } // && Greenfoot.getKey()=="space" public void neueRaupe() { if(gNachfolger!=null ) gNachfolger.neueRaupe(); else { int rot = this.getRotation(); int x = getX(); int y = getY(); Raupe lRaupe = new Raupe(); switch(rot) { case 0: getWorld().addObject(lRaupe, x-1, y); break; case 180: getWorld().addObject(lRaupe, x+1, y); break; case 90: getWorld().addObject(lRaupe, x, y-1); break; case 270: getWorld().addObject(lRaupe, x, y+1); break; } erkenneRaupe(lRaupe); gNachfolger.setRotation(getRotation()); } } /** * Der Rover überprüft, ob sich in richtung ("right", "left", oder "forward") ein Objekt der Klasse Raupenkopf befindet. * Das Ergebnis wird auf dem Display angezeigt. * Sollte ein anderer Text (String) als "right", "left" oder "forward" übergeben werden, dann erscheint eine entsprechende Meldung auf dem Display. */ public boolean RaupeVorhanden() { int rot = getRotation(); if(getOneObjectAtOffset(1,0,Raupe.class)!=null && rot==0) { return true; } if(getOneObjectAtOffset(-1,0,Raupe.class)!=null && rot==180) { return true; } if(getOneObjectAtOffset(0,1,Raupe.class)!=null && rot==90) { return true; } if(getOneObjectAtOffset(0,-1,Raupe.class)!=null && rot==270) { return true; } return false; } /** * Der Rover überprüft, ob sich in richtung ("right", "left", oder "forward") ein Objekt der Klasse Tree befindet. * Das Ergebnis wird auf dem Display angezeigt. * Sollte ein anderer Text (String) als "right", "left" oder "forward" übergeben werden, dann erscheint eine entsprechende Meldung auf dem Display. */ public boolean TreeVorhanden(String richtung) { int rot = getRotation(); if (richtung == "forward" && rot == 0 || richtung == "right" && rot == 270 || richtung == "left" && rot == 90 || richtung == "back" && rot == 180) { if(getOneObjectAtOffset(1,0,Tree.class)!=null && ((Tree)getOneObjectAtOffset(1,0,Tree.class)).getSteigung() >30) { return true; } } if (richtung == "forward" && rot == 180 || richtung == "right" && rot == 90 || richtung == "left" && rot == 270 || richtung == "back" && rot == 0) { if(getOneObjectAtOffset(-1,0,Tree.class)!=null && ((Tree)getOneObjectAtOffset(-1,0,Tree.class)).getSteigung() >30) { return true; } } if (richtung == "forward" && rot == 90 || richtung == "right" && rot == 0 || richtung == "left" && rot == 180 || richtung == "back" && rot == 270) { if(getOneObjectAtOffset(0,1,Tree.class)!=null && ((Tree)getOneObjectAtOffset(0,1,Tree.class)).getSteigung() >30) { return true; } } if (richtung == "forward" && rot==270 || richtung == "right" && rot == 180 || richtung == "left" && rot == 0 || richtung == "back" && rot == 90) { if(getOneObjectAtOffset(0,-1,Tree.class)!=null && ((Tree)getOneObjectAtOffset(0,-1,Tree.class)).getSteigung() >30) { return true; } } if(richtung != "forward" && richtung != "left" && richtung != "right" && richtung == "back") { // nachricht("Befehl nicht korrekt!"); } return false; } protected void addedToWorld(World world) { world = getWorld(); } }
package android.support.v7.view.menu; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnDismissListener; import android.content.DialogInterface.OnKeyListener; import android.support.v7.app.c; import android.support.v7.view.menu.l.a; import android.view.KeyEvent; import android.view.KeyEvent.DispatcherState; import android.view.View; import android.view.Window; final class g implements OnClickListener, OnDismissListener, OnKeyListener, a { e IA; private a IB; c Iz; f bq; public g(f fVar) { this.bq = fVar; } public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { if (i == 82 || i == 4) { Window window; View decorView; DispatcherState keyDispatcherState; if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) { window = this.Iz.getWindow(); if (window != null) { decorView = window.getDecorView(); if (decorView != null) { keyDispatcherState = decorView.getKeyDispatcherState(); if (keyDispatcherState != null) { keyDispatcherState.startTracking(keyEvent, this); return true; } } } } else if (keyEvent.getAction() == 1 && !keyEvent.isCanceled()) { window = this.Iz.getWindow(); if (window != null) { decorView = window.getDecorView(); if (decorView != null) { keyDispatcherState = decorView.getKeyDispatcherState(); if (keyDispatcherState != null && keyDispatcherState.isTracking(keyEvent)) { this.bq.J(true); dialogInterface.dismiss(); return true; } } } } } return this.bq.performShortcut(i, keyEvent, 0); } public final void onDismiss(DialogInterface dialogInterface) { this.IA.a(this.bq, true); } public final void a(f fVar, boolean z) { if ((z || fVar == this.bq) && this.Iz != null) { this.Iz.dismiss(); } if (this.IB != null) { this.IB.a(fVar, z); } } public final boolean d(f fVar) { if (this.IB != null) { return this.IB.d(fVar); } return false; } public final void onClick(DialogInterface dialogInterface, int i) { this.bq.a((h) this.IA.getAdapter().getItem(i), null, 0); } }
package com.gtfs.service.impl; import java.io.Serializable; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.gtfs.bean.LicReqBocMapping; import com.gtfs.dao.interfaces.LicReqBocMappingDao; import com.gtfs.service.interfaces.LicReqBocMappingService; @Service public class LicReqBocMappingServiceImpl implements LicReqBocMappingService,Serializable { @Autowired private LicReqBocMappingDao licReqBocMappingDao; @Override public List<LicReqBocMapping> findReqBocMappingByApplication(Long id) { return licReqBocMappingDao.findReqBocMappingByApplication(id); } }
/* * 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 jpaModel; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Fallou */ @Entity @Table(name = "render_vous_web") @XmlRootElement @NamedQueries({ @NamedQuery(name = "RenderVousWeb.findAll", query = "SELECT r FROM RenderVousWeb r") , @NamedQuery(name = "RenderVousWeb.findById", query = "SELECT r FROM RenderVousWeb r WHERE r.id = :id") , @NamedQuery(name = "RenderVousWeb.findByConsultation", query = "SELECT r FROM RenderVousWeb r WHERE r.consultation = :consultation") , @NamedQuery(name = "RenderVousWeb.findByDaterv", query = "SELECT r FROM RenderVousWeb r WHERE r.daterv = :daterv") , @NamedQuery(name = "RenderVousWeb.findByDocteur", query = "SELECT r FROM RenderVousWeb r WHERE r.docteur = :docteur") , @NamedQuery(name = "RenderVousWeb.findByMatricule", query = "SELECT r FROM RenderVousWeb r WHERE r.matricule = :matricule") , @NamedQuery(name = "RenderVousWeb.findByNom", query = "SELECT r FROM RenderVousWeb r WHERE r.nom = :nom") , @NamedQuery(name = "RenderVousWeb.findByPrenom", query = "SELECT r FROM RenderVousWeb r WHERE r.prenom = :prenom")}) public class RenderVousWeb implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "id") private Long id; @Column(name = "consultation") @Temporal(TemporalType.DATE) private Date consultation; @Column(name = "daterv") @Temporal(TemporalType.DATE) private Date daterv; @Column(name = "docteur") private String docteur; @Column(name = "matricule") private String matricule; @Column(name = "nom") private String nom; @Column(name = "prenom") private String prenom; public RenderVousWeb() { } public RenderVousWeb(Long id) { this.id = id; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Date getConsultation() { return consultation; } public void setConsultation(Date consultation) { this.consultation = consultation; } public Date getDaterv() { return daterv; } public void setDaterv(Date daterv) { this.daterv = daterv; } public String getDocteur() { return docteur; } public void setDocteur(String docteur) { this.docteur = docteur; } public String getMatricule() { return matricule; } public void setMatricule(String matricule) { this.matricule = matricule; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public String getPrenom() { return prenom; } public void setPrenom(String prenom) { this.prenom = prenom; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof RenderVousWeb)) { return false; } RenderVousWeb other = (RenderVousWeb) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "jpaModel.RenderVousWeb[ id=" + id + " ]"; } }
package com.gepengjun.learn.service.menu.impl; import com.gepengjun.learn.dao.MenuMapper; import com.gepengjun.learn.model.Menu; import com.gepengjun.learn.service.menu.MenuService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("menuService") public class MenuServiceImpl implements MenuService { @Autowired private MenuMapper menuMapper; @Override public Menu selectById(Long menuId) { return menuMapper.selectByPrimaryKey(menuId); } }
import textio.TextIO; /* This program will perform 10000 experiments per possible dice total. It will record the average number of rolls, the standard deviation, and the maximum number of rolls. */ public class RollTheDice4 { final static int EXPERIMENTS = 10000; static double averageNumber; static double standardDeviation; static double maximumRolls; /* The main method will create an object for each potential dice total using the PairOfDice class. It will call the rollExperiment method to perform this experiment repeatedly. It will then use the StatCalc class to calculate the average number of rolls, standard deviation, and max rolls. It will then create a table to display all of this information. */ public static void main (String [] args) { int i; double [][] table; table = new double [13][3]; System.out.println ("This program will create a table and display the average number of rolls, maximum number of rolls, and standard deviation per possible dice total for 10000 experiments."); System.out.println (); System.out.println ("Total On Dice Average Max Rolls Standard Deviation"); System.out.println ("------------- ------- --------- ------------------"); for (i = 2; i < 13; i ++) { rollExperiment (i); table [i] [0] = averageNumber; table [i] [1] = maximumRolls; table [i] [2] = standardDeviation; System.out.println (" " + i + " " + table [i] [0] + " " + table [i] [1] + " " + table [i] [2]); } } /* This method will experiment each possible total 10000 times. It will call the computeRoll function. It will */ private static void rollExperiment (int currentPossibleTotal) { StatCalc calculator; PairOfDice dice; int i; double currentAttempts; calculator = new StatCalc (); dice = new PairOfDice (); for (i = 1; i < EXPERIMENTS; i ++) { currentAttempts = computeRoll (currentPossibleTotal, dice); calculator.enter (currentAttempts); } averageNumber = calculator.getMean (); maximumRolls = calculator.getMax (); standardDeviation = calculator.getStandardDeviation (); return; } /* This method will call the PairOfDice class to roll the dice and return the value of the roll. It will do this until the established goal is reached and then will return the number of attempts to rollExperiment. */ private static double computeRoll (int goal, PairOfDice roll) { double attempts; attempts = 0.0; do { roll.computeRoll (); roll.computeTotal (); attempts ++; } while (roll.getTotal () != goal); return attempts; } }
package br.edu.ifam.saf.requisitarreserva; import br.edu.ifam.saf.api.dto.ItemAluguelDTO; import br.edu.ifam.saf.mvp.BasePresenter; import br.edu.ifam.saf.mvp.LoadingView; public class ReservaContract { interface View extends LoadingView { void mostrarDetalhesItem(ItemAluguelDTO item); void fechar(); void atualizarTotal(double valorTotal); } interface Presenter extends BasePresenter { void carregarItem(int itemId); void onTempoChanged(int tempoEmMinutos); void salvarReserva(int tempoEmMinutos); } }
package com.prashanth.sunvalley.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.annotations.GenericGenerator; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Data @Entity @AllArgsConstructor @NoArgsConstructor public class StudentIdKeeper { @Id @GenericGenerator(name="student_id", strategy = "com.prashanth.sunvalley.util.StudentIdGenerator") @GeneratedValue(generator = "student_id") private String studentId; }
package com.mainmethod.test; import org.openqa.selenium.WebDriver; import com.utility.test.BrowserConfig; public class BusinessMethod extends BrowserConfig { private static WebDriver driver; public static void browsersetup() { driver=browsername("gecko"); } public static WebDriver getobject() { return driver; } }
package userAcc1; public class driver { @SuppressWarnings("unused") public static void main(String[] args) { UserAccount user1 = new UserAccount("one", "p1"); UserAccount user2 = new UserAccount("two", "p2"); boolean expectFalse = user1.checkPassword("P1"); boolean expectTrue = user1.checkPassword("p1"); boolean expectFalseWithNull = user1.checkPassword(null); user1.deactivateAccount(); boolean expectFalseUserAccount = user1.equals(user2); } }
public class ShapeManagement { private final int MAXSHAPES = 20; private Shape[] listshape = new Shape[MAXSHAPES]; private int count = 0; // metodo para adicionar shapes public void addShape(Shape shape) { if (count < MAXSHAPES) { listshape[count] = shape; count += 1; } else { System.out.println("MAX Shapes"); } } /* // metodo para adicionar shapes de forma + correta (so deixa adicionar se a area e o perimetro forem diferentes) public void addShape2(Shape shape) { boolean duplicated = false; Shape[] temp = new Shape[this.listshape.length + 1]; for (int i = 0; i < this.count; i++) { if (shape.getArea() == this.listshape[i].getArea() || shape.getPerimeter() == this.listshape[i].getPerimeter()) { duplicated = true; } } if (this.count >= 0 && find(shape) == null && duplicated == false) { this.listshape[this.count] = shape; this.count++; } } */ // metodo para encontrar shapes public Shape find(Shape shape) { Shape resp = null; for (int i = 0; i < this.count; i++) { if (shape.equals(this.listshape[i].toString())) { resp = this.listshape[i]; } } return resp; } // metodo para remover um objeto (shape) public Shape removeObject(int position) { if (position < listshape.length && position != -1) { if (listshape[position] == null) { System.out.println("Objeto não existe"); return null; } else { Object delete = listshape[position]; listshape[position] = null; for (int i = position; i < (count - 1); i++) { listshape[i] = listshape[i + 1]; } count -= 1; listshape[count] = null; return (Shape) delete; } } else { System.out.println("Posição Inexistente"); return null; } } /** * Metodo que substitui um objeto no array por um novo recebido Retorna true * se a operação foi um sucesso/false se falhou * @param position * @param shape * @return shape */ protected boolean setObject(int position, Shape shape) { if (position < listshape.length) { if (listshape[position] == null) { System.out.println("Não existe nenhum objeto nesta postição."); return false; } else { listshape[position] = shape; return true; } } else { System.out.println("Posição Inexistente"); return false; } } public String imprimir() { String resp = ""; for (int i = 0; i < this.count; i++) { if (this.listshape[i] instanceof Circle) { Circle circle = (Circle) this.listshape[i]; resp += circle.printCircle(); // imprime circulos } else if (this.listshape[i] instanceof Square) { Square square = (Square) this.listshape[i]; resp += square.printSquare(); // imprime quadrados } else if (this.listshape[i] instanceof Rectangle) { Rectangle rectangle = (Rectangle) this.listshape[i]; resp += rectangle.printRectangle(); // imprime retangulos } else { resp += this.listshape[i].toString(); // imprime default (shape normal) } resp += "\n"; } return resp; } // imprime circulos public String imprimirCircle() { String resp = ""; for (int i = 0; i < this.count; i++) { if (this.listshape[i] instanceof Circle) { Circle circle = (Circle) this.listshape[i]; resp += circle.printCircle(); } } return resp; } // imprime quadrados public String imprimirSquare() { String resp = ""; for (int i = 0; i < this.count; i++) { if (this.listshape[i] instanceof Square) { Square square = (Square) this.listshape[i]; resp += square.printSquare(); } } return resp; } // imprime retangulos public String imprimirRectangle() { String resp = ""; for (int i = 0; i < this.count; i++) { if (this.listshape[i] instanceof Rectangle) { Rectangle rectangle = (Rectangle) this.listshape[i]; resp += rectangle.printRectangle(); } } return resp; } @Override public String toString() { String text = ""; for (int i = 0; i < count; i++) { text += "Figura " + (i + 1) + " : " + "\n" + listshape[i].toString() + "\n"; } return text; } }
package it.unical.asd.group6.computerSparePartsCompany.controller; import it.unical.asd.group6.computerSparePartsCompany.core.services.implemented.ErrorMessageServiceImpl; import it.unical.asd.group6.computerSparePartsCompany.data.dto.ErrorMessageDTO; import it.unical.asd.group6.computerSparePartsCompany.data.entities.ErrorMessage; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/error-message") @CrossOrigin(origins = "*", allowedHeaders = "*") public class ErrorMessageController { @Autowired private ErrorMessageServiceImpl errorMessageService; @GetMapping("/get-all") public ResponseEntity<List<ErrorMessageDTO>> getAll() { return ResponseEntity.ok(errorMessageService.getAll()); } @GetMapping("/get-by-username") public ResponseEntity<ErrorMessageDTO>getByUsername(@RequestParam String username) { return ResponseEntity.ok(errorMessageService.getByUsername(username)); } @PostMapping("/insert") public ResponseEntity<Boolean>insert(@RequestParam String title,@RequestParam String description,@RequestParam String email,@RequestParam String username) { errorMessageService.insert(title, description, email, username); return ResponseEntity.ok(true); } @DeleteMapping("/delete") public ResponseEntity<Boolean>delete(@RequestParam String username) { errorMessageService.remove(username); return ResponseEntity.ok(true); } }
import java.util.ArrayList; //public class search { // public static int linearSearch(int searchedContestant,int[] contestants){ // for (int i = 0; i<contestants.length; i++){ // if (contestants[i] == searchedContestant){ // return(i); // } // } // return(-1); // } //} public class Search { public static int linearSearch(ContestantInformation x,ContestantInformation[] contestants){ for (int i = 0; i<contestants.length; i++){ if (contestants[i] == x){ return(i); } } return(-1); } //____________________________________________________________________============_ public static int linearSearch(double x,double[] array){ for (int n = 0; n<array.length; n++){ if (array[n] == x){ return(n); } } return(-1); } //____________________________________________________________________============_ public static int linearSearch(String x,String[] array){ for (int n = 0; n<array.length; n++){ if (array[n].equalsIgnoreCase(x)){ return(n); } } return(-1); } public static int linearSearch(ContestantInformation x,ArrayList<ContestantInformation> contestants){ for (int n = 0; n < contestants.size(); n++){ if (contestants.get(n).equalsIgnoreCase(x)){ return(n); } } return(-1); } //____________________________________________________________________============_ //____________________________________________________________________============_ //_________________________________________________________________===========_ //public static int binarySearch(ContestantInformation x, ArrayList <ContestantInformation> contestants){ // int begIndex = 0; // int endIndex =contestants.size() - 1; // // while(begIndex <= endIndex){ // int midIndex = (begIndex + endIndex)/2; // if (x.compareToIgnoreCase(contestants.get(midIndex)) > 0){ // begIndex = midIndex+1; // } // // else if (x.compareToIgnoreCase(contestants.get(midIndex))< 0){ // endIndex = midIndex-1; // } // else if(x.compareToIgnoreCase(contestants.get(midIndex))==0){ // return(midIndex); // } // } // return(-1); //} public static int binarySearch(ContestantInformation x, ArrayList <ContestantInformation> contestants){ int begIndex = 0; int endIndex =contestants.size() - 1; int result = binarySearch(x, contestants, begIndex, endIndex); return result; } private static int binarySearch(ContestantInformation x, ArrayList <ContestantInformation> contestants,int begIndex,int endIndex){ if (begIndex>endIndex){ return - 1; } int mid = (begIndex + endIndex) /2; if (contestants.get(mid).compareToIgnoreCase(x) == 0){ return mid; } else if (contestants.get(mid).compareToIgnoreCase(x) <= 0){ return binarySearch(x,contestants,mid+1,endIndex); } else // (contestants.get(mid).compareToIgnoreCase(x) >= 0) { return binarySearch(x,contestants, begIndex, mid-1); } } public static int binarySearch(int x, int[] array){ int begIndex = 0; int endIndex = array.length - 1; while(begIndex <= endIndex){ int midIndex = (begIndex + endIndex)/2; if (x > array[midIndex]){ begIndex = midIndex+1; } else if (x < array[midIndex]){ endIndex = midIndex-1; } else if(x == array[midIndex]){ return(midIndex); } } return(-1); } //____________________________________________________________________============_ public static int binarySearch(double x, double[] array){ int begIndex = 0; int endIndex = array.length - 1; while(begIndex <= endIndex){ int midIndex = (begIndex + endIndex)/2; if (x > array[midIndex]){ begIndex = midIndex+1; } else if (x < array[midIndex]){ endIndex = midIndex-1; } else if(x == array[midIndex]){ return(midIndex); } } return(-1); } //____________________________________________________________________============_ public static int binarySearch(String x, String[] array){ int begIndex = 0; int endIndex = array.length - 1; while(begIndex <= endIndex){ int midIndex = (begIndex + endIndex)/2; if (x.compareToIgnoreCase(array[midIndex]) > 0){ begIndex = midIndex+1; } else if (x.compareToIgnoreCase(array[midIndex])<0){ endIndex = midIndex-1; } else if(x.compareToIgnoreCase(array[midIndex])==0){ return(midIndex); } } return(-1); } }
package br.com.rogerio.gerenics; import java.util.List; import java.util.ArrayList; public class AppBuffer { /** * @param args */ public static void main(String[] args) { //Aqui instancio dizendo que tipo vai ser meu Buffer que no caso String //Ficando assim minha classe de Buffer Generica. Buffer<String> buffer = new Buffer<String>(); buffer.adicionar("ABC"); buffer.adicionar("DEF"); buffer.adicionar("GHI"); List<String> lista = new ArrayList<String>(); lista = buffer.getBuffer(); for (String s : lista) { System.out.println(s); } } }
package com.sixmac.dao; import com.sixmac.entity.City; import com.sixmac.entity.Province; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; /** * Created by Administrator on 2016/5/31 0031 下午 6:00. */ public interface ProvinceDao extends JpaRepository<Province, Long> { @Query("select a from Province a where a.provinceId = ?1 ") public Province getByProvinceId(Long provinceId); }
package com.tencent.mm.plugin.wallet.pwd; import com.tencent.mm.ab.l; import com.tencent.mm.plugin.wallet.pwd.a.f; import com.tencent.mm.plugin.wallet_core.model.Authen; import com.tencent.mm.ui.MMActivity; import com.tencent.mm.wallet_core.d.g; import com.tencent.mm.wallet_core.d.i; class a$2 extends g { final /* synthetic */ a phb; a$2(a aVar, MMActivity mMActivity, i iVar) { this.phb = aVar; super(mMActivity, iVar); } public final boolean d(int i, int i2, String str, l lVar) { if (i != 0 || i2 != 0 || !(lVar instanceof f)) { return false; } a.a(this.phb).putString("kreq_token", ((f) lVar).token); this.phb.a(this.fEY, 0, a.b(this.phb)); return true; } public final boolean m(Object... objArr) { int i; Authen authen = (Authen) objArr[0]; if (this.phb.bQH()) { authen.bWA = 4; } else { authen.bWA = 1; } if (a.c(this.phb).getBoolean("key_is_paymanager")) { i = 1; } else { i = 0; } this.uXK.a(new f(authen, a.d(this.phb).getBoolean("key_is_reset_with_new_card", false), i), true, 1); return true; } }
package july; public class FibonachiNum { public static void main(String[] args) { fib(8); fiboSeries(20); } public static void fib(int num) { int num1 = 0; int num2 = 1; for (int i = 0; i < num; i++) { System.out.print(num1 + " "); int sum = num1 + num2; num1 = num2; num2 = sum; } } public static void fiboSeries(int limit) { int a = 0; int b = 1; int count = 0; int c = 0; while (count < limit) { c = a + b; a = b; b = c; System.out.print(c + ", "); count++; } } }
public class Ex16 { public static void main(String[] args) { String[] str = new String[3]; str[0] = "a"; str[1] = "b"; str[2] = "c"; String[] str2 = {"a", "b", "c"}; for (int i=0; i<str.length; i++) { System.out.println(str[i]); } for (int i=0; i<str2.length; i++) { System.out.println(str2[i]); } } }
package nl.rug.oop.flaps.simulation.model.trips; import lombok.Getter; import lombok.SneakyThrows; import nl.rug.oop.flaps.aircraft_editor.model.config_models.InfoPanelModel; import nl.rug.oop.flaps.aircraft_editor.view.panels.aircraft_info.interaction_panels.InteractionPanel; import nl.rug.oop.flaps.simulation.model.aircraft.Aircraft; import nl.rug.oop.flaps.simulation.model.aircraft.FuelTank; import nl.rug.oop.flaps.simulation.model.airport.Airport; import nl.rug.oop.flaps.simulation.model.map.coordinates.GeographicCoordinates; import nl.rug.oop.flaps.simulation.model.map.coordinates.PointProvider; import nl.rug.oop.flaps.simulation.model.map.coordinates.ProjectionMapping; import nl.rug.oop.flaps.simulation.model.world.World; import nl.rug.oop.flaps.simulation.model.world.WorldSelectionModel; import nl.rug.oop.flaps.simulation.view.panels.WorldPanel; import nl.rug.oop.flaps.simulation.view.panels.trip.TripsInfo; import javax.imageio.ImageIO; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; import java.util.Random; @Getter public class Trip { private static final double INDICATOR_SIZE = 8; private final Point2D.Double originAirportLocation; private final Point2D.Double destinationAirportLocation; @Getter private final static int revenue = (int) InfoPanelModel.getInfoPanelModel().getRevenue(); private final String flightsId; private Image bannerInAir; private BufferedImage icon; private final Airport originAirport; private final Airport destAirport; private final Aircraft aircraft; private final Point2D.Double currentPosition; boolean reachedDestination = false; private final WorldSelectionModel sm; private static final double VELOCITY = 0.3; private String distanceLeft; private double slope; private double beginNumber; private double rotationAngle; private final Map<FuelTank, Double> fuelTankFillStatuses; /** * creates a new instance of the Trip after departure * */ public Trip(WorldSelectionModel sm) { this.sm = sm; originAirport = sm.getSelectedAirport(); destAirport = sm.getSelectedDestinationAirport(); aircraft = sm.getSelectedAircraft(); originAirportLocation = getAirportAsPoint(originAirport); currentPosition = originAirportLocation; destinationAirportLocation = getAirportAsPoint(destAirport); this.fuelTankFillStatuses = new HashMap<>(aircraft.getFuelTankFillStatuses()); this.flightsId = generateId(); setBannerImage(); WorldPanel.getWorldPanel().addTrip(this); calcLineEquation(); rotateCw(); } /** * rotates the icon image depending on angle between the origin airport and the destination airport * */ @SneakyThrows private void rotateCw() { double newAngle = calcRotationAngle(); if(newAngle != rotationAngle) { rotationAngle = newAngle; icon = ImageIO.read(Path.of("data/flying_airplanes/flying_airplane_u.png").toFile()); AffineTransform tr = AffineTransform.getRotateInstance(rotationAngle, (double) icon.getWidth()/2, (double) icon.getHeight()/2); AffineTransformOp op = new AffineTransformOp(tr, AffineTransformOp.TYPE_BILINEAR); icon = op.filter(icon, null); } } /** * calculates the rotation angle required from current position * */ private double calcRotationAngle() { return Math.toRadians(Math.toDegrees(Math.atan2( (destinationAirportLocation.y-currentPosition.y), (destinationAirportLocation.x - currentPosition.x) )) + 90 ); } /** * calculates the formula of the line crossing both origin and destination airport points * */ private void calcLineEquation() { slope = ( (destinationAirportLocation.y - originAirportLocation.y) / (destinationAirportLocation.x - originAirportLocation.x) ); beginNumber = ( destinationAirportLocation.y - (slope * destinationAirportLocation.x)); } /** * Moves the plane forward * */ public void cruise () { // update position double xDistance = currentPosition.x; if (currentPosition.x < destinationAirportLocation.x) { xDistance += VELOCITY; } else if (currentPosition.x > destinationAirportLocation.x) { xDistance -= VELOCITY; } currentPosition.setLocation(xDistance, y(xDistance)); // update of checked destination (trip arrived when in range of the airport ) reachedDestination = (int) currentPosition.distance(destinationAirportLocation) < icon.getWidth(null)/6; GeographicCoordinates end = getGeoPosition(currentPosition); setDistanceLeft(end); removedAndUpdateFuel(end); // repaint rotateCw(); WorldPanel.getWorldPanel().repaint(); if(reachedDestination) aircraftArrived(); } /** * @param x the x coordinate that we need to get the y coordinate of * @return the y coordinate of the line crossing the dest airport and origin airport * */ private double y (double x) { return slope * x + beginNumber; } /** * sets the banner image of the aircraft flying according to the type * */ @SneakyThrows private void setBannerImage() { String aircraftType = aircraft.getType().getName(); int nr = (int) (Math.random() * (4 - 1 + 1) + 1); switch (aircraftType) { case "Boeing 747-400F": bannerInAir = ImageIO.read(Path.of("data/aircraft_types/jets/747", "clouds747_" + nr + ".jpg").toFile()); break; case "Boeing 737-800BCF Freighter": bannerInAir = ImageIO.read(Path.of("data/aircraft_types/jets/737", "clouds737_" + nr + ".jpg").toFile()); break; case "Boeing 767-300F": bannerInAir = ImageIO.read(Path.of("data/aircraft_types/jets/767", "clouds767_" + nr + ".jpg").toFile()); break; case "Lockheed C-5 Galaxy": bannerInAir = ImageIO.read(Path.of("data/aircraft_types/jets/C5_galaxy", "cloudsC5galaxy_" + nr + ".jpg").toFile()); break; case "Airbus A330-200F": bannerInAir = ImageIO.read(Path.of("data/aircraft_types/jets/a330", "cloudsA330_" + nr + ".jpg").toFile()); break; default: bannerInAir = ImageIO.read(Path.of("data/aircraft_types/general_aviation/grand_caravan", "cloudsGrandCarvan.jpg").toFile()); break; } } /** * sets and loads the distance left in the progress bar * */ private void setDistanceLeft(GeographicCoordinates end) { StringBuilder stringBuilder = new StringBuilder(); int percentage = (int) (Math.round(50.0 * originAirport.getGeographicCoordinates().distanceTo(end) / originAirport.getGeographicCoordinates().distanceTo(destAirport.getGeographicCoordinates()))); stringBuilder.append("Progress: 🏢"); stringBuilder.append("-".repeat(Math.max(0,percentage - 1))); if (percentage > 0) { stringBuilder.append("✈"); } stringBuilder.append("-".repeat(Math.max(0, 50 - percentage - 1))); stringBuilder.append("📌"); if(reachedDestination) stringBuilder.append(" Arrived 🛬 ✅"); distanceLeft = String.valueOf(stringBuilder); } /** * removes the fuel from the aircraft and updates the trip's info panel * */ private void removedAndUpdateFuel(GeographicCoordinates end) { for (FuelTank fuelTank : fuelTankFillStatuses.keySet()) { aircraft.setFuelAmountForFuelTank(fuelTank, fuelTankFillStatuses.get(fuelTank)); } aircraft.removeFuel(aircraft.getFuelConsumption(originAirport, end)); if (TripsInfo.getTripsInfo() != null) { TripsInfo.getTripsInfo().updateFuelLabel(); TripsInfo.getTripsInfo().updateDistanceMeter(); } } /** * @return the the geo position of a point drawn on the world map * */ public GeographicCoordinates getGeoPosition(Point2D.Double currentPosition) { var geo = ProjectionMapping.worldToMercator(World.getStaticDimensions()). map(PointProvider.ofPoint(currentPosition)); return new GeographicCoordinates(geo.getPointX(),geo.getPointY()); } /** * The trip has arrived, remove cargo, fuel consumed and passengers. * Also removed the trip from the trip list * */ private void aircraftArrived() { destAirport.addAircraft(aircraft); aircraft.emptyCargo(); /* escort passengers if any were added */ if(InteractionPanel.getPassengersConfigPanel() != null) { InteractionPanel.getPassengersConfigPanel().getModel().escortPassengers(this); } if(sm.getSelectedAirport() != null && sm.getSelectedAirport() == destAirport) { sm.setSelectedAirport(destAirport); } WorldPanel.getWorldPanel().removeTrip(this); } /** * generates a random ID * */ private String generateId() { Random r = new Random(); StringBuilder id = new StringBuilder(); for (int i = 0; i < 7; i++) { id.append((char) (r.nextInt(26) + 'a')); } for (int i = 0; i < 3; i++) { id.append((int) Math.floor(Math.random()*(10 +1)+0)); } return id.toString().toUpperCase(); } /** * gets the mapped airport * @param airport the airport to map on the world map * @return the airport as a 2D point mapped on the world map * */ private Point2D.Double getAirportAsPoint(Airport airport) { var point = ProjectionMapping.mercatorToWorld(World.getStaticDimensions()) .map(airport.getLocation()); return new Point2D.Double(point.getPointX(), point.getPointY()); } }
package com.smxknife.rabbitmq.cluster; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import java.io.IOException; import java.util.Optional; /** * @author smxknife * 2020/5/7 */ public abstract class AbstractMQActuator implements Runnable { @Override public final void run() { Optional<Channel> optional = channel(); optional.ifPresent(channel -> { actuate(channel); }); optional.orElseThrow(() -> new RuntimeException("Channel is not exist")); } protected abstract void actuate(Channel channel); private Optional<Channel> channel() { Connection connection = RabbitmqConnectionFactory.getConnection(); Channel channel = null; try { channel = connection.createChannel(); } catch (IOException e) { e.printStackTrace(); } return Optional.ofNullable(channel); } }
package com.sporsimdi.action.facade; import java.util.Date; import java.util.List; import java.util.Map; import javax.ejb.Local; import org.primefaces.model.SortOrder; import com.sporsimdi.model.entity.Defter; import com.sporsimdi.model.entity.Isletme; import com.sporsimdi.model.entity.Kasa; import com.sporsimdi.model.type.Status; @Local public interface DefterFacade { public Defter findById(long id); public Defter findLatest(Defter defter); public Defter findFirst(Kasa kasa); public List<Defter> listAll(); public Long getCount(); public void persist(Defter defter); public List<Defter> getByStatus(Status status); public void remove(long id); public List<Defter> listDefter(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters); public Defter findByIdEditMode(long id); public List<Defter> listAllByIsletme(Isletme isletme); public List<Defter> listAllByKasa(Kasa kasa); public List<Defter> listAllByTarih(Date tarih, Kasa kasa); public void updateAllBakiyeAfter(Defter defter); }
package com.dks.andapp.tools.phonesaver; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.support.v4.app.NotificationCompat; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageView; import android.widget.Spinner; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.ads.AdView; public class MainActivity extends Activity implements android.widget.AdapterView.OnItemSelectedListener{ private static final String TAG = "MainActivity"; private static final String PREFS_NAME = "battBoostSettings"; private static final String GLOBAL_DATA = "globalData"; private Context locContext; private SharedPreferences settings; private SharedPreferences globalData; private Spinner spinner; private RegularAlarm alarm; private Editor settingEditor; private UtilityWorkMethods utilityWM; private void enableDisableContent(boolean enabled){ ImageView imgWifi = (ImageView)findViewById(R.id.ic_wifi); Switch switchWifi = (Switch)findViewById(R.id.wifi_switch); ImageView imgMobData = (ImageView)findViewById(R.id.ic_mobile_data); Switch switchMobData = (Switch)findViewById(R.id.mobile_data_switch); ImageView imgCacheCleaner = (ImageView)findViewById(R.id.ic_cache_cleaner); Switch switchCacheCleaner = (Switch)findViewById(R.id.cache_cleaner_switch); Spinner selectorMins = (Spinner)findViewById(R.id.minsSpinner); imgWifi.setEnabled(enabled); switchWifi.setEnabled(enabled); imgMobData.setEnabled(enabled); switchMobData.setEnabled(enabled); imgCacheCleaner.setEnabled(enabled); switchCacheCleaner.setEnabled(enabled); selectorMins.setEnabled(enabled); } private void getDefaults() { } private void initialise() { settings = getSharedPreferences(PREFS_NAME, 0); settingEditor = settings.edit(); if (!isMyServiceRunning(OnOffEventHandler.class)) { settingEditor.clear(); settingEditor.commit(); } spinner = (Spinner)findViewById(R.id.minsSpinner); alarm = new RegularAlarm(); locContext = getApplicationContext(); utilityWM = new UtilityWorkMethods(locContext); Switch switchWifi = (Switch)findViewById(R.id.wifi_switch); Switch switchMobData = (Switch)findViewById(R.id.mobile_data_switch); Switch switchCacheCleaner = (Switch)findViewById(R.id.cache_cleaner_switch); switchWifi.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked){ onWifiSwitchClick(compoundbutton); } }); switchMobData.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked){ onMobileDataSwitchClick(compoundbutton); } }); switchCacheCleaner.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundbutton, boolean isChecked){ onCacheCleanerSwitchClick(compoundbutton); } }); spinner.setOnItemSelectedListener(this); } public void onButtonClick(View view) { //Log.i(TAG, "Entering onButtonClick"); boolean isServiceOnFlg = settings.getBoolean("IS_SERVICE_ON", false); settingEditor = settings.edit(); Button startStopBtn = (Button)findViewById(R.id.startStopButton); if (isServiceOnFlg) { stopService(view); settingEditor.putBoolean("IS_SERVICE_ON", false); startStopBtn.setText(R.string.btn_start); startStopBtn.setBackgroundResource(R.drawable.start_button_bg); enableDisableContent(true); } else { startService(view); settingEditor.putBoolean("IS_SERVICE_ON", true); startStopBtn.setText(R.string.btn_stop_service); startStopBtn.setBackgroundResource(R.drawable.stop_button_bg); enableDisableContent(false); } settingEditor.commit(); //Log.i(TAG, "Exiting onButtonClick"); } public void startService(View view) { //Log.i(TAG, "Entering startService"); settingEditor = settings.edit(); settingEditor.putBoolean("ORIG_WIFI_STATE", utilityWM.isWifiEnabled()); settingEditor.putBoolean("ORIG_MOBILE_DATA_STATE", utilityWM.isMobDataEnabled()); settingEditor.putInt("TIMER_FREQ", Integer.parseInt((String)spinner.getSelectedItem())); settingEditor.commit(); Intent intent; if (alarm != null) { alarm.SetAlarm(locContext); } else { Toast.makeText(locContext, "Alarm is null", Toast.LENGTH_SHORT).show(); } intent = new Intent(this, OnOffEventHandler.class); intent.putExtra("screen_state", true); startService(intent); addNotification(); //Log.i(TAG, "Exiting startService"); } private void addNotification() { //Log.i(TAG, "Entering addNotification"); NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("Phone Saver") .setContentText("Phone Saver is still running") .setOngoing(true); Intent notificationIntent = new Intent(this,MainActivity.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify("PhoneSaverNotification", 100,builder.build()); //Log.i(TAG, "Entering addNotification"); } private void removeNotification() { NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel("PhoneSaverNotification", 100); } public void stopService(View view) { //Log.i(TAG, "Entering stopService"); Context context = getApplicationContext(); if (alarm != null) { alarm.CancelAlarm(context); } else { Toast.makeText(context, "Alarm is null", Toast.LENGTH_SHORT).show(); } context.stopService(new Intent(context, OnOffEventHandler.class)); removeNotification(); settingEditor.clear(); settingEditor.commit(); globalData = getSharedPreferences(GLOBAL_DATA, 0); if ((globalData.getInt("NUM_OF_TIME", 0) > 100) && (globalData.getInt("NUM_OF_CYCLE", 0) > 1000)) { AppRating apprater = new AppRating(MainActivity.this); apprater.showRateDialog(); Editor glbDataEditor = globalData.edit(); glbDataEditor.clear(); glbDataEditor.commit(); } //Log.i(TAG, "Exiting stopService"); } public void onWifiSwitchClick(View view) { //Log.i(TAG, "Entering onWifiSwitchClick"); Switch wifiSwitch = (Switch)findViewById(R.id.wifi_switch); ImageView wifiImg = (ImageView)findViewById(R.id.ic_wifi); TextView wifiText = (TextView)findViewById(R.id.wifi_text); settingEditor = settings.edit(); if (wifiSwitch.isChecked()) { settingEditor.putBoolean("WIFI_SWITCH", true); wifiImg.setImageResource(R.drawable.wifi_on); wifiText.setTextAppearance(this, R.style.enabledText); } else { settingEditor.putBoolean("WIFI_SWITCH", false); wifiImg.setImageResource(R.drawable.wifi_off); wifiText.setTextAppearance(this, R.style.disabledText); } settingEditor.commit(); //Log.i(TAG, "Exiting onWifiSwitchClick"); } public void onMobDataImgClick(View view) { //Log.i(TAG, "Entering onMobDataImgClick"); Switch mobSwitch = (Switch)findViewById(R.id.mobile_data_switch); ImageView mobImg = (ImageView)findViewById(R.id.ic_mobile_data); settingEditor = settings.edit(); TextView mobText = (TextView)findViewById(R.id.mobile_data_text); if (!mobSwitch.isChecked()) { mobImg.setImageResource(R.drawable.mobile_data_on); mobSwitch.setChecked(true); mobText.setTextAppearance(this, R.style.enabledText); settingEditor.putBoolean("MOBILE_DATA_SWITCH", true); } else { mobImg.setImageResource(R.drawable.mobile_data_off); mobText.setTextAppearance(this, R.style.disabledText); mobSwitch.setChecked(false); settingEditor.putBoolean("MOBILE_DATA_SWITCH", false); } settingEditor.commit(); //Log.i(TAG, "Exiting onMobDataImgClick"); } public void onCacheCleanerImgClick(View view) { //Log.i(TAG, "Entering onCacheCleanerImgClick"); Switch cacheSwitch = (Switch)findViewById(R.id.cache_cleaner_switch); ImageView cacheImg = (ImageView)findViewById(R.id.ic_cache_cleaner); TextView cacheText = (TextView)findViewById(R.id.cache_cleaner_text); settingEditor = settings.edit(); if (!cacheSwitch.isChecked()){ cacheImg.setImageResource(R.drawable.cache_cleaner_on); cacheText.setTextAppearance(this, R.style.enabledText); cacheSwitch.setChecked(true); settingEditor.putBoolean("CACHE_SWITCH", true); } else { cacheImg.setImageResource(R.drawable.cache_cleaner_off); cacheText.setTextAppearance(this, R.style.disabledText); cacheSwitch.setChecked(false); settingEditor.putBoolean("CACHE_SWITCH", false); } settingEditor.commit(); //Log.i(TAG, "Exiting onCacheCleanerImgClick"); } public void onCacheCleanerSwitchClick(View view) { //Log.i(TAG, "Entering onCacheCleanerSwitchClick"); Switch cacheSwitch = (Switch)findViewById(R.id.cache_cleaner_switch); ImageView cacheImg = (ImageView)findViewById(R.id.ic_cache_cleaner); TextView cacheText = (TextView)findViewById(R.id.cache_cleaner_text); settingEditor = settings.edit(); if (cacheSwitch.isChecked()){ cacheImg.setImageResource(R.drawable.cache_cleaner_on); cacheText.setTextAppearance(this, R.style.enabledText); settingEditor.putBoolean("CACHE_SWITCH", true); } else{ cacheImg.setImageResource(R.drawable.cache_cleaner_off); cacheText.setTextAppearance(this, R.style.disabledText); settingEditor.putBoolean("CACHE_SWITCH", false); } settingEditor.commit(); //Log.i(TAG, "Exiting onCacheCleanerSwitchClick"); } public void onMobileDataSwitchClick(View view) { //Log.i(TAG, "Entering onMobileDataSwitchClick"); Switch mobSwitch = (Switch)findViewById(R.id.mobile_data_switch); ImageView mobImg = (ImageView)findViewById(R.id.ic_mobile_data); TextView mobText = (TextView)findViewById(R.id.mobile_data_text); settingEditor = settings.edit(); if (mobSwitch.isChecked()) { mobImg.setImageResource(R.drawable.mobile_data_on); settingEditor.putBoolean("MOBILE_DATA_SWITCH", true); mobText.setTextAppearance(this, R.style.enabledText); } else { settingEditor.putBoolean("MOBILE_DATA_SWITCH", false); mobImg.setImageResource(R.drawable.mobile_data_off); mobText.setTextAppearance(this, R.style.disabledText); } settingEditor.commit(); //Log.i(TAG, "Exiting onMobileDataSwitchClick"); } public void onWifiImgClick(View view) { //Log.i(TAG, "Entering onWifiImgClick"); Switch wifiSwitch = (Switch)findViewById(R.id.wifi_switch); ImageView wifiImg = (ImageView)findViewById(R.id.ic_wifi); settingEditor = settings.edit(); TextView wifiText = (TextView)findViewById(R.id.wifi_text); if (!wifiSwitch.isChecked()) { wifiImg.setImageResource(R.drawable.wifi_on); wifiSwitch.setChecked(true); wifiText.setTextAppearance(this, R.style.enabledText); settingEditor.putBoolean("WIFI_SWITCH", true); } else{ wifiImg.setImageResource(R.drawable.wifi_off); wifiSwitch.setChecked(false); wifiText.setTextAppearance(this, R.style.disabledText); settingEditor.putBoolean("WIFI_SWITCH", false); } settingEditor.commit(); //Log.i(TAG, "Exiting onWifiImgClick"); } public void onInstCacheCleanerImgClick(View view) { //Log.i(TAG, "Entering onInstMobDataImgClick"); utilityWM.clearCache(); Toast.makeText(this, "Cache Cleared", Toast.LENGTH_SHORT).show(); //Log.i(TAG, "Exiting onInstMobDataImgClick"); } public void onInstMobDataImgClick(View view) { //Log.i(TAG, "Entering onInstMobDataImgClick"); ImageView instMobImg = (ImageView)findViewById(R.id.ic_inst_mobile_data); //Log.i(TAG, (new StringBuilder(String.valueOf(utilityWM.isMobDataEnabled()))).toString()); if (utilityWM.isMobDataEnabled()){ UtilityWorkMethods utilityworkmethods1 = utilityWM; boolean isModEnabledFlg = utilityWM.isMobDataEnabled(); boolean enableDisableFlg = false; if (!isModEnabledFlg) { enableDisableFlg = true; } utilityworkmethods1.enableDisableDataComm(enableDisableFlg); instMobImg.setImageResource(R.drawable.mobile_data_off); } else{ UtilityWorkMethods utilityworkmethods = utilityWM; boolean isModEnabledFlg = utilityWM.isMobDataEnabled(); boolean enableDisableFlg = false; if (!isModEnabledFlg) { enableDisableFlg = true; } utilityworkmethods.enableDisableDataComm(enableDisableFlg); instMobImg.setImageResource(R.drawable.mobile_data_on); } //Log.i(TAG, "Exiting onInstMobDataImgClick"); } public void onInstWifiImgClick(View view) { //Log.i(TAG, "Entering onInstWifiImgClick"); ImageView wifiInstImg = (ImageView)findViewById(R.id.ic_instant_wifi); //Log.i(TAG, (new StringBuilder(String.valueOf(utilityWM.isWifiEnabled()))).toString()); if (utilityWM.isWifiEnabled()) { UtilityWorkMethods utilityworkmethods1 = utilityWM; boolean isWifiEnabledFlg = utilityWM.isWifiEnabled(); boolean enableDisableFlg = false; if (!isWifiEnabledFlg) { enableDisableFlg = true; } utilityworkmethods1.enableDisableWifi(enableDisableFlg); wifiInstImg.setImageResource(R.drawable.wifi_off); } else{ UtilityWorkMethods utilityworkmethods = utilityWM; boolean isWifiEnabledFlg = utilityWM.isWifiEnabled(); boolean enableDisableFlg = false; if (!isWifiEnabledFlg) { enableDisableFlg = true; } utilityworkmethods.enableDisableWifi(enableDisableFlg); wifiInstImg.setImageResource(R.drawable.wifi_on); } //Log.i(TAG, "Exiting onInstWifiImgClick"); } public void onItemSelected(AdapterView adapterview, View view, int i, long l) { //Log.i(TAG, "Entering onItemSelected with mins as:"+i); Spinner minsSpinner = (Spinner)findViewById(R.id.minsSpinner); minsSpinner.setSelection(i); Toast.makeText(this, (String)minsSpinner.getSelectedItem(), Toast.LENGTH_SHORT).show(); // settingEditor = settings.edit(); // settingEditor.putInt("TIMER_FREQ", Integer.parseInt((String)minsSpinner.getSelectedItem())); // settingEditor.commit(); //Log.i(TAG, "Exiting onItemSelected"); } public void onNothingSelected(AdapterView adapterview) { } private void populateSpinner(int mins){ //Log.i(TAG, "Entering populateSpinner with mins:"+mins); List<String> list = new ArrayList<String>(); for (int i=1;i<=60;i++){ list.add(i+""); } ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, R.layout.my_spinner, list); dataAdapter.setDropDownViewResource(R.layout.my_spinner); spinner.setAdapter(dataAdapter); spinner.setSelection(dataAdapter.getPosition(mins+"")); // Log.i(TAG, "Exiting populateSpinner"); } private void setDefaults() { settingEditor = settings.edit(); // Log.i(TAG, "Getting value of timer freq: "+ settings.getInt("TIMER_FREQ", 15)); settingEditor.putInt("TIMER_FREQ", settings.getInt("TIMER_FREQ", 15)); settingEditor.commit(); populateSpinner(settings.getInt("TIMER_FREQ", 15)); if (settings.getBoolean("IS_SERVICE_ON", false)) { boolean wifiSwitchFlg = settings.getBoolean("WIFI_SWITCH", false); boolean mobSwitchFlg = settings.getBoolean("MOBILE_DATA_SWITCH", false); boolean cacheSwitchFlg = settings.getBoolean("CACHE_SWITCH", false); ImageView wifiImg = (ImageView)findViewById(R.id.ic_wifi); Switch wifiSwitch = (Switch)findViewById(R.id.wifi_switch); ImageView mobImg = (ImageView)findViewById(R.id.ic_mobile_data); Switch mobSwitch = (Switch)findViewById(R.id.mobile_data_switch); ImageView cacheImg = (ImageView)findViewById(R.id.ic_cache_cleaner); Switch cacheSwitch = (Switch)findViewById(R.id.cache_cleaner_switch); Button startStopBtn = (Button)findViewById(R.id.startStopButton); startStopBtn.setText(R.string.btn_stop_service); startStopBtn.setBackgroundResource(R.drawable.stop_button_bg); if (wifiSwitchFlg) { wifiImg.setImageResource(R.drawable.wifi_on); wifiSwitch.setChecked(true); } else { wifiImg.setImageResource(R.drawable.wifi_off); wifiSwitch.setChecked(false); } if (mobSwitchFlg) { mobImg.setImageResource(R.drawable.mobile_data_on); mobSwitch.setChecked(true); } else { mobImg.setImageResource(R.drawable.mobile_data_off); mobSwitch.setChecked(false); } if (cacheSwitchFlg) { cacheImg.setImageResource(R.drawable.cache_cleaner_on); cacheSwitch.setChecked(true); } else { cacheImg.setImageResource(R.drawable.cache_cleaner_off); cacheSwitch.setChecked(false); } enableDisableContent(false); } else { ImageView wifiImg = (ImageView)findViewById(R.id.ic_wifi); Switch wifiSwitch = (Switch)findViewById(R.id.wifi_switch); ImageView mobImg = (ImageView)findViewById(R.id.ic_mobile_data); Switch mobSwitch = (Switch)findViewById(R.id.mobile_data_switch); ImageView cacheImg = (ImageView)findViewById(R.id.ic_cache_cleaner); Switch cacheSwitch = (Switch)findViewById(R.id.cache_cleaner_switch); Button startStopBtn = (Button)findViewById(R.id.startStopButton); TextView textview = (TextView)findViewById(R.id.wifi_text); TextView textview1 = (TextView)findViewById(R.id.mobile_data_text); TextView textview2 = (TextView)findViewById(R.id.cache_cleaner_text); textview.setTextAppearance(this, R.style.disabledText); textview1.setTextAppearance(this, R.style.disabledText); textview2.setTextAppearance(this, R.style.disabledText); startStopBtn.setText(R.string.btn_start); startStopBtn.setBackgroundResource(R.drawable.start_button_bg); wifiImg.setImageResource(R.drawable.wifi_off); wifiSwitch.setChecked(false); mobImg.setImageResource(R.drawable.mobile_data_off); mobSwitch.setChecked(false); cacheImg.setImageResource(R.drawable.cache_cleaner_off); cacheSwitch.setChecked(false); enableDisableContent(true); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initialise(); getDefaults(); setDefaults(); AdView adview = (AdView)findViewById(R.id.ad); com.google.android.gms.ads.AdRequest adrequest = (new com.google.android.gms.ads.AdRequest.Builder()).build(); //Log.i(TAG, "Before load of Ad"); adview.loadAd(adrequest); utilityWM.displayInterstitialAd(); //Log.i(TAG, "After load of Ad"); } @Override protected void onStop() { //Log.i(TAG, "Entering onStop"); super.onDestroy(); utilityWM.displayInterstitialAd(); settings = getSharedPreferences(PREFS_NAME, 0); settingEditor = settings.edit(); if (!isMyServiceRunning(OnOffEventHandler.class)) { settingEditor.clear(); settingEditor.commit(); } //Log.i(TAG, "Exiting onStop"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. // Log.i(TAG, "Entering onOptionsItemSelected"); int id = item.getItemId(); if (id == R.id.action_settings) { return true; } // Log.i(TAG, "Exiting onOptionsItemSelected"); return super.onOptionsItemSelected(item); } private boolean isMyServiceRunning(Class<?> serviceClass) { ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass.getName().equals(service.service.getClassName())) { return true; } } return false; } }
package com.tencent.mm.ui.chatting; import com.tencent.mm.hardcoder.HardCoderJNI; import com.tencent.mm.kernel.g; import com.tencent.mm.sdk.platformtools.x; import com.tencent.smtt.sdk.TbsListener$ErrorCode; class e$10 implements Runnable { final /* synthetic */ e tHE; e$10(e eVar) { this.tHE = eVar; } public final void run() { int i = 0; x.i("MicroMsg.BaseChattingUIFragment", "[onExitBegin] activity:%s isPreLoaded:%b", new Object[]{this.tHE.tHx, Boolean.valueOf(this.tHE.tHA)}); e eVar = this.tHE; boolean z = HardCoderJNI.hcQuitChattingEnable; int i2 = HardCoderJNI.hcQuitChattingDelay; int i3 = HardCoderJNI.hcQuitChattingCPU; int i4 = HardCoderJNI.hcQuitChattingIO; if (HardCoderJNI.hcQuitChattingThr) { i = g.Em().cij(); } eVar.tHD = HardCoderJNI.startPerformance(z, i2, i3, i4, i, HardCoderJNI.hcQuitChattingTimeout, TbsListener$ErrorCode.ERROR_UNMATCH_TBSCORE_VER_THIRDPARTY, HardCoderJNI.hcQuitChattingAction, "ChattingUIFragment"); e.a(this.tHE).cpK(); } }
package com.erp; public class erpSystem_App { }
/**************************************************** * $Project: DinoAge $ * $Date:: Jan 29, 2008 9:32:44 PM $ * $Revision: $ * $Author:: khoanguyen $ * $Comment:: $ **************************************************/ package org.ddth.dinoage.core; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.io.OutputStream; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public final class Workspace { private static final Log logger = LogFactory.getLog(Workspace.class); private static final String LOCK_FILE = ".lock"; private static final String PROFILE_FILE_NAME = ".profile"; private Map<String, Profile> map = new HashMap<String, Profile>(); private File workspaceFolder; private FileLock lock; private ProfileFactory profileLoader; private List<WorkspaceChangeListener> listeners = new ArrayList<WorkspaceChangeListener>(); public static final int WORKSPACE_IS_AVAILABLE = 0; public static final int WORKSPACE_IS_INVALID = 1; public static final int WORKSPACE_IS_BEING_USED = 2; public Workspace(File workspaceFolder, ProfileFactory loader) { this.workspaceFolder = workspaceFolder; this.profileLoader = loader; } /** * Check if the given workspace by its path is available for using * * @param workspacePath * @return */ public static int checkWorkspace(String workspacePath) { File workspaceFolder = new File(workspacePath); if (!workspaceFolder.exists() || !workspaceFolder.isDirectory()) { return WORKSPACE_IS_INVALID; } File lockFile = new File(workspaceFolder, LOCK_FILE); if (!lockFile.exists() || lockFile.delete()) { return WORKSPACE_IS_AVAILABLE; } return WORKSPACE_IS_BEING_USED; } public void closeWorkspace() { for (Profile profile : map.values()) { saveProfile(profile); } releaseExclusiveAccess(workspaceFolder); } private void releaseExclusiveAccess(File workspaceFolder) { try { lock.release(); lock.channel().close(); new File(workspaceFolder, LOCK_FILE).delete(); } catch (IOException e) { logger.error(e); } } private FileLock aqquireExclusiveAccess(File workspaceFolder) { FileLock lock = null; try { File lockFile = new File(workspaceFolder, LOCK_FILE); lockFile.deleteOnExit(); RandomAccessFile workspaceFile = new RandomAccessFile(lockFile, "rw"); FileChannel channel = workspaceFile.getChannel(); lock = channel.tryLock(); } catch (IOException e) { logger.error(e); } return lock; } public String getWorkspaceLocation() { return workspaceFolder.getAbsolutePath(); } public void loadWorkspace() throws IOException { lock = aqquireExclusiveAccess(workspaceFolder); if (lock == null) { throw new IOException("Workspace is in used."); } File[] children = workspaceFolder.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory(); } }); for (File directory : children) { try { File profileFile = new File(directory, Workspace.PROFILE_FILE_NAME); Profile profile = profileLoader.loadProfile(profileFile); // Override the name in profile profile.setProfileName(directory.getName()); map.put(profile.getProfileName().toLowerCase(), profile); } catch (Exception e) { logger.debug("'" + directory.getName() + "' directory doesn't appear as a valid profile storage"); } } fireWorkspaceReloaded(); } public boolean saveProfile(Profile profile) { boolean success = false; OutputStream outputStream = null; try { File profileFolder = getProfileFolder(profile); profileFolder.mkdirs(); File resumeFile = new File(profileFolder, Workspace.PROFILE_FILE_NAME); boolean exists = resumeFile.exists(); outputStream = profile.store(resumeFile); map.put(profile.getProfileName().toLowerCase(), profile); if (!exists) { profile.load(resumeFile); fireProfileAdded(profile); } success = true; } catch (IOException e) { logger.error("Can not save profile '" + profile.getProfileName() + "'", e); } finally { try { if (outputStream != null) { outputStream.close(); } } catch (IOException e) { logger.error(e); } } return success; } public File getProfileFolder(Profile profile) { return new File(workspaceFolder, profile.getProfileName()); } public Profile removeProfile(Profile profile) { File profileFile = new File(new File(workspaceFolder, profile.getProfileName()), Workspace.PROFILE_FILE_NAME); profileFile.delete(); Profile success = map.remove(profile.getProfileName().toLowerCase()); if (success != null) { fireProfileRemoved(profile); } return success; } public Profile getProfile(String profileName) { return map.get(profileName.toLowerCase()); } public Collection<Profile> getProfiles() { return map.values(); } public ProfileFactory getProfileLoader() { return profileLoader; } public Profile createEmptyProfile() { return profileLoader.createProfile(); } public void addWorkspaceChangeListener(WorkspaceChangeListener listener) { listeners.add(listener); } public boolean removeWorkspaceChangeListener(WorkspaceChangeListener listener) { return listeners.remove(listener); } private void fireWorkspaceChanged(WorkspaceChangeEvent event) { for (WorkspaceChangeListener listener : listeners) { listener.workspaceChanged(event); } } private void fireProfileAdded(Profile profile) { WorkspaceChangeEvent event = new WorkspaceChangeEvent(this, profile, WorkspaceChangeEvent.PROFILE_ADDED_CHANGE); fireWorkspaceChanged(event); } private void fireProfileRemoved(Profile profile) { WorkspaceChangeEvent event = new WorkspaceChangeEvent(this, profile, WorkspaceChangeEvent.PROFILE_REMOVED_CHANGE); fireWorkspaceChanged(event); } private void fireWorkspaceReloaded() { WorkspaceChangeEvent event = new WorkspaceChangeEvent(this, null, WorkspaceChangeEvent.WORKSPACE_RELOADED_CHANGE); fireWorkspaceChanged(event); } }
package com.pkjiao.friends.mm.adapter; import java.util.ArrayList; import com.pkjiao.friends.mm.view.DragImageView; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageView; public class PhotoPagerAdapter extends PagerAdapter { private Context mContext; private ArrayList<ImageView> mPhotoViews; private PhotoClickListener mPhotoClickListener; public interface PhotoClickListener { public void onPhotoClicked(); } public void setPhotoClickListener(PhotoClickListener listener) { mPhotoClickListener = listener; } public PhotoPagerAdapter(Context context, ArrayList<ImageView> photos) { mContext = context; mPhotoViews = photos; } @Override public int getCount() { return mPhotoViews.size(); } @Override public Object instantiateItem(ViewGroup container, int position) { View view = mPhotoViews.get(position); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mPhotoClickListener.onPhotoClicked(); } }); ((ViewPager) container).addView(view); return mPhotoViews.get(position); } @Override public void destroyItem(ViewGroup container, int position, Object object) { ((ViewPager) container).removeView((View) object); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public int getItemPosition(Object object) { return super.getItemPosition(object); } }
package instaApi; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.Charset; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.google.android.gcm.server.Message; import com.google.android.gcm.server.Result; import com.google.android.gcm.server.Sender; import instaApi.User; import instaApi.dbConexion; import java.util.Date; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class ApiInstagramSearch { final static String searchURL = "https://api.instagram.com/v1/users/"; //final static String apiKey="/media/recent/?access_token=6394138.1677ed0.d1802576372c463bb3444075643c70d2";//api del mes de mayo final static String apiKey="/media/recent/?access_token=6394138.1677ed0.d1802576372c463bb3444075643c70d2"; // 6394138.1677ed0.d1802576372c463bb3444075643c70d2 // CODIGO INTAGRAM = 3 public static void main(String[] args) throws Exception { final ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); service.scheduleWithFixedDelay(new Runnable() { @Override public void run() { System.out.println(" ************************************************* "); System.out.println(" *********** Inicio Motor Instagram ************ "); System.out.println(new Date()); System.out.println(" ************************************************* "); //llamo al flujo central try { orquestador(); } catch (NumberFormatException | UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println(" ** problema ocurrido en el orquestador **"); } } }, 0, 2, TimeUnit.MINUTES); } public static void orquestador() throws NumberFormatException, UnsupportedEncodingException { System.out.println(" ************************************************* "); System.out.println(" Lista de Usuarios "); int existeIn=0; //int count=0; List<User> listUser=new ArrayList<User>(); //List<User> listUserIns=new ArrayList<User>(); ResultSet rs,rs3; String sql; boolean existe; try{ Connection c= dbConexion.getConnection(); PreparedStatement st,st2; //saco usuarios de la ]BD st=c.prepareStatement("Select id_usuario,nom1,apell1,keyMovil from usuario"); rs=st.executeQuery(); while(rs.next()){ User u=new User(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getString(4)); listUser.add(u); System.out.println("usuario: "+u.getNombre()); } System.out.println(" ************************************************* "); //saco id red social de instagram usuario for(int i=0;i<listUser.size();i++){ st=c.prepareStatement("Select id_usuario_red from rs_usuario where n_usuario_red<>'sin_info' and id_red_social=3 and id_usuario="+listUser.get(i).getId()); rs=st.executeQuery(); existeIn=0; while(rs.next()){ String url = buildSearchString(rs.getString(1)); //BUSCO! String result = search(url); System.out.println(""); //TRABAJO SOBRE EL JSON try { JSONObject resultj = new JSONObject(result); JSONArray datosResult = new JSONArray(resultj.getString("data")); for (int j = 0; j < datosResult.length(); j++) { JSONObject objetoDato = new JSONObject(datosResult.getJSONObject(j).getString("comments")); if(objetoDato.getInt("count")>0){ JSONArray Arraycomentarios = new JSONArray(objetoDato.getString("data")); System.out.println(Arraycomentarios); //rescata palabras malas de 4fimi sql = ("select palabra from palabras_fimi where tipo_palabra=1"); st2=c.prepareStatement(sql); rs3=st2.executeQuery(); while(rs3.next()){ for (int k = 0; k < Arraycomentarios.length(); k++) { existe=Arraycomentarios.getJSONObject(k).getString("text").contains(rs3.getString(1)); System.out.println("existe la palabra " + rs3.getString(1)+" en el comentario?: "+existe); System.out.println(""); if(existe){ JSONObject user =new JSONObject(Arraycomentarios.getJSONObject(k).getString("from")); existeIn=inserta(Arraycomentarios.getJSONObject(k),user.getString("username") ,Integer.parseInt(rs.getString(1))); existe=false; } } } } } } catch (JSONException e) { System.out.println(e.getMessage()); } } //si se realizó algún insert al usuario if(existeIn==1){ System.out.println("inserto, llama push" ); String result=push(listUser.get(i).getKeyMovil()); System.out.println("iresultado push:"+result ); } } }catch( SQLException ex){ ex.getMessage(); } } public static int inserta(JSONObject jsonObj,String quien, int id) throws UnsupportedEncodingException{ int i=0; Connection c= dbConexion.getConnection(); PreparedStatement st; String sql,comentario; try{ comentario=jsonObj.getString("text").replace("'", ""); System.out.println("v2 comentario entrada"+comentario); byte[] byteText = comentario.getBytes(Charset.forName("UTF-8")); String comentario_aux= new String(byteText , "UTF-8"); comentario=comentario_aux; System.out.println("v2 comentario salida"+comentario); sql = ("Insert into historial_usuario(id_usuario_red,id_red_social,comentario,tipo_comentario,fecha,id_onombre_quien_comenta,is_falso_positivo) values("+id+",3,'"+comentario+"','negativo',SYSDATE(),'"+quien+"',1 )"); st=c.prepareStatement(sql); st.executeUpdate(); System.out.println(""); System.out.println("Comentario Insertado"); System.out.print("Fecha de Insersion: "); System.out.print(new Date()); System.out.println(""); i=1; } catch (JSONException e) { System.out.println(e.getMessage()); }catch( SQLException ex){ System.out.println(""); System.out.println("Insercion Duplicada: comentario ya existente"); System.out.print("Fecha de Insersion Duplicada: "); System.out.print(new Date()); System.out.println(""); } return i; } public static void CalPush(String id){ Sender sender = new Sender("AIzaSyAe_zNh_S3HkeeTV37Cd1NCoR8tTYqYT34"); Message message = new Message.Builder() .addData("title","1") .addData("message", "Nuevo Mensaje") .addData("body","Nuevo mensaje desde Instagram") .build(); try { Result result = sender.send(message, id, 1); System.out.println("Message Result: "+result.toString()); JSONObject jo =new JSONObject(message); } catch (IOException e) { System.out.println(e.getMessage()); } } public static String push(String key){ //String url = "http://192.168.30.206:7010/fimi_v0/webapi/u/SPush;id="+key+";cod=1;contenido=desde Instagram"; String url = "http://localhost:8080/fimi_v0/webapi/u/SPush;id="+key+";cod=1;contenido=desde%20Instagram"; String result = search(url); return result; } //SEARCH public static String search(String pUrl) { try { URL url = new URL(pUrl); HttpURLConnection connection2 = (HttpURLConnection) url.openConnection(); connection2.setRequestMethod("GET"); int responseCode = connection2.getResponseCode(); BufferedReader in = new BufferedReader(new InputStreamReader(connection2.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); return response.toString(); } catch (Exception e) { e.printStackTrace(); System.out.println("Excepcion capturada"); } return null; } private static String buildSearchString(String searchString) { String toSearch = searchURL + searchString + apiKey; System.out.println("Construction Search URL: " + toSearch); return toSearch; } }
/* * This file is part of jGui API, licensed under the MIT License (MIT). * * Copyright (c) 2016 johni0702 <https://github.com/johni0702> * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package de.johni0702.minecraft.gui.layout; import de.johni0702.minecraft.gui.container.GuiContainer; import de.johni0702.minecraft.gui.element.GuiElement; import de.johni0702.minecraft.gui.utils.lwjgl.Dimension; import de.johni0702.minecraft.gui.utils.lwjgl.Point; import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension; import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint; import org.apache.commons.lang3.tuple.Pair; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; public abstract class CustomLayout<T extends GuiContainer<T>> implements Layout { private final Layout parent; private final Map<GuiElement, Pair<Point, Dimension>> result = new LinkedHashMap<>(); public CustomLayout() { this(null); } public CustomLayout(Layout parent) { this.parent = parent; } @Override @SuppressWarnings("unchecked") public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer container, ReadableDimension size) { result.clear(); if (parent == null) { Collection<GuiElement> elements = container.getChildren(); for (GuiElement element : elements) { result.put(element, Pair.of(new Point(0, 0), new Dimension(element.getMinSize()))); } } else { Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> elements = parent.layOut(container, size); for (Map.Entry<GuiElement, Pair<ReadablePoint, ReadableDimension>> entry : elements.entrySet()) { Pair<ReadablePoint, ReadableDimension> pair = entry.getValue(); result.put(entry.getKey(), Pair.of(new Point(pair.getLeft()), new Dimension(pair.getRight()))); } } layout((T) container, size.getWidth(), size.getHeight()); return (Map) result; } private Pair<Point, Dimension> entry(GuiElement element) { return result.get(element); } protected void set(GuiElement element, int x, int y, int width, int height) { Pair<Point, Dimension> entry = entry(element); entry.getLeft().setLocation(x, y); entry.getRight().setSize(width, height); } protected void pos(GuiElement element, int x, int y) { entry(element).getLeft().setLocation(x, y); } protected void size(GuiElement element, ReadableDimension size) { size.getSize(entry(element).getRight()); } protected void size(GuiElement element, int width, int height) { entry(element).getRight().setSize(width, height); } protected void x(GuiElement element, int x) { entry(element).getLeft().setX(x); } protected void y(GuiElement element, int y) { entry(element).getLeft().setY(y); } protected void width(GuiElement element, int width) { entry(element).getRight().setWidth(width); } protected void height(GuiElement element, int height) { entry(element).getRight().setHeight(height); } protected int x(GuiElement element) { return entry(element).getLeft().getX(); } protected int y(GuiElement element) { return entry(element).getLeft().getY(); } protected int width(GuiElement element) { return entry(element).getRight().getWidth(); } protected int height(GuiElement element) { return entry(element).getRight().getHeight(); } protected abstract void layout(T container, int width, int height); @Override public ReadableDimension calcMinSize(GuiContainer<?> container) { return new Dimension(0, 0); } }
package com.dzz.policy.service.service.observer; import com.dzz.policy.api.service.PolicyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; /** * 发送核心 * * @author dzz * @version 1.0.0 * @since 2019年08月14 16:57 */ @Slf4j @Component public class SendToCentralObserverImpl extends AbstractObserver { private PolicyService policyService; @Autowired public void setPolicyService(PolicyService policyService) { this.policyService = policyService; } @Async("asyncExecutor") @Override public void apply(String proposalNo) { log.info("发送核心接收到发送通知,投保单号为:{}", proposalNo); } }
package common; public class GarbageValueExample { public static void main(String[] args) { int var1 = 125; byte var2 = 125; for (int i = 0; i < 5; i++ ) { var1 = var1 + i; var2 = (byte) (var2 + 1); System.out.println("var1 : " + var1 + ", " + "var2 : " + var2); } } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.webbeans.test.decorators.tests; import jakarta.annotation.Priority; import jakarta.decorator.Decorator; import jakarta.decorator.Delegate; import jakarta.enterprise.inject.Any; import jakarta.enterprise.inject.Decorated; import jakarta.enterprise.inject.spi.Bean; import jakarta.inject.Inject; import org.junit.Assert; import org.apache.webbeans.test.AbstractUnitTest; import org.junit.Test; /** * Test to reproduce OWB-992 */ public class ExtendedGenericDecoratorTest extends AbstractUnitTest { @Test public void testExtendedGenericDecorator() throws Exception { addDecorator(ExtendedInterfaceDecorator.class); startContainer(Interface.class, ExtendedInterface.class, LongService.class, IntegerService.class, StringService.class); Assert.assertFalse(LongService.testMethodCalled); Assert.assertFalse(LongService.anotherMethodCalled); Assert.assertFalse(IntegerService.testMethodCalled); Assert.assertFalse(IntegerService.anotherMethodCalled); Assert.assertFalse(ExtendedInterfaceDecorator.anotherMethodDecoratedWithLong); Assert.assertFalse(ExtendedInterfaceDecorator.anotherMethodDecoratedWithInteger); Assert.assertFalse(StringService.testMethodCalled); // LongService ExtendedInterface<Long> service = getInstance(LongService.class); service.anotherMethod(2L); // call method from interface - shall be decorated service.test(1L); // call method from super interface - shall not be decorated // StringService shall not be decorated StringService stringService = getInstance(StringService.class); stringService.test("test"); // IntegerService IntegerService integerService = getInstance(IntegerService.class); integerService.anotherMethod(3); // call method from interface - shall be decorated integerService.test(4); // call method from super interface - shall not be decorated Assert.assertTrue(LongService.anotherMethodCalled); Assert.assertTrue(LongService.testMethodCalled); Assert.assertTrue(ExtendedInterfaceDecorator.anotherMethodDecoratedWithLong); Assert.assertTrue(IntegerService.anotherMethodCalled); Assert.assertTrue(IntegerService.testMethodCalled); Assert.assertTrue(ExtendedInterfaceDecorator.anotherMethodDecoratedWithInteger); Assert.assertTrue(StringService.testMethodCalled); shutDownContainer(); } public static interface Interface<T> { void test(T input); } public static interface ExtendedInterface<T extends Number> extends Interface<T> { void anotherMethod(T input); } public static class LongService implements ExtendedInterface<Long> { public static boolean anotherMethodCalled = false; public static boolean testMethodCalled = false; @Override public void anotherMethod(Long input) { anotherMethodCalled = true; } @Override public void test(Long input) { testMethodCalled = true; } } public static class IntegerService implements ExtendedInterface<Integer> { public static boolean anotherMethodCalled = false; public static boolean testMethodCalled = false; @Override public void anotherMethod(Integer input) { anotherMethodCalled = true; } @Override public void test(Integer input) { testMethodCalled = true; } } public static class StringService implements Interface<String> { public static boolean testMethodCalled = false; @Override public void test(String input) { testMethodCalled = true; } } @Decorator @Priority(value = 10) public abstract static class ExtendedInterfaceDecorator<T extends Number> implements ExtendedInterface<T> { public static boolean anotherMethodDecoratedWithLong = false; public static boolean anotherMethodDecoratedWithInteger = false; public static boolean unexpectedDecorated = false; @Delegate @Inject @Any private ExtendedInterface<T> delegate; @Inject @Decorated private Bean<Interface<T>> decorated; @Override public void anotherMethod(T input) { Class<?> beanClass = decorated.getBeanClass(); if (beanClass.equals(LongService.class)) { anotherMethodDecoratedWithLong = true; } else if (beanClass.equals(IntegerService.class)) { anotherMethodDecoratedWithInteger = true; } else { unexpectedDecorated = true; } delegate.anotherMethod(input); } } }
package com.yt.s_server.home; import android.content.Context; import android.graphics.Color; import android.graphics.Paint; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.yt.s_server.R; import java.util.ArrayList; public class AttendanceAdapter extends ArrayAdapter<Attendance> { private int resourceId; public AttendanceAdapter(Context context, int textViewResourceId, final ArrayList<Attendance> objects, boolean dm) { super(context, textViewResourceId, objects); resourceId = textViewResourceId; } @Override public View getView(int position, View convertView, ViewGroup parent) { final Attendance attendance = getItem(position); View view; if (convertView == null) { view = LayoutInflater.from(getContext()).inflate(resourceId, parent, false); } else { view = convertView; } TextView time = view.findViewById(R.id.tv_attendanceTime); TextView type = view.findViewById(R.id.tv_attendanceType); TextView course = view.findViewById(R.id.tv_attendanceCourse); switch (attendance.getType()) { case "1": type.setText("旷课"); type.setBackgroundColor(Color.rgb(220,53,69)); break; case "2": type.setText("迟到"); type.setBackgroundColor(Color.rgb(255,193,7)); break; case "3": type.setText("早退"); type.setBackgroundColor(Color.rgb(255,193,7)); break; case "4": type.setText("调课"); type.setBackgroundColor(Color.rgb(84,91,98)); break; default: type.setText("未知"); type.setBackgroundColor(Color.rgb(255,255,255)); } time.setText("第" + attendance.getWeek() + "周 星期" + attendance.getDayOfWeek() + "\n" + attendance.getStartSection() + "-" + (attendance.getStartSection()+attendance.getTotalSection())+ "节"); course.setText(attendance.getCourse() + "【" + attendance.getCourseItem() + "】" + attendance.getTeacher()); if(attendance.getStudentLeaveFormId() != null || attendance.getFreeListenFormId() != null){ time.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); course.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); type.setBackgroundColor(Color.rgb(84,91,98)); } return view; } }
package com.freejavaman; import android.app.Activity; import android.content.ContentResolver; import android.os.Bundle; import android.provider.MediaStore.Images.Media; import android.util.Log; public class ImgDelete extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { ContentResolver cResolver = this.getContentResolver(); //根據指定的顯示名字執行刪除 String where = Media.DISPLAY_NAME + "=?"; String[] selectionArgs = {"view"}; //執行刪除 cResolver.delete(Media.EXTERNAL_CONTENT_URI, where, selectionArgs); Log.v("content", "delete done"); } catch (Exception e) { Log.e("content", "err when delete:" + e); } } }
package com.hogetvedt.crawler.spider; import com.google.gson.Gson; import com.hogetvedt.crawler.models.EntryPoint; import com.hogetvedt.crawler.models.WebLink; import com.hogetvedt.crawler.util.JsonReader; import lombok.Data; import org.json.JSONException; import org.json.JSONObject; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import org.springframework.scheduling.annotation.Async; import java.io.IOException; import java.net.MalformedURLException; import java.util.*; import java.util.logging.Logger; @Data public class Spider { private volatile Set<String> vistedLinks = Collections.synchronizedSet(new HashSet<>()); private volatile Queue<WebLink> links = new LinkedList<>(); private Integer httpRequests; private Integer successfulRequests; private Integer failedRequests; private static final Logger LOGGER = Logger.getLogger(Spider.class.getSimpleName()); public Spider() { this.httpRequests = 0; this.successfulRequests = 0; this.failedRequests = 0; } /* Initiates the crawl by taking in an entry point, parses them as initial URL links, and then begins the crawl. */ public void initiateCrawl(String entryEndpoint) throws Exception { // check initial URL for validity if(null == entryEndpoint || entryEndpoint.equals("")) { throw new Exception("Invalid Entry Endpoint"); } // parse initial endpoints parseEntryEndpoint(entryEndpoint); // crawl all items while queue is not empty while(!links.isEmpty()) { WebLink link = links.poll(); //String link = links.poll(); // take first url from queue if(link != null) { if(!vistedLinks.contains(link.getUrl())) { crawl(link); vistedLinks.add(link.getUrl()); } } } printResults(); // displays the final results to the chat log } /* Main crawl method that visits a given link, and scrapes for any other links found on the page */ @Async public void crawl(WebLink link) throws SpiderException { if(link != null && (link.getUrl() == null || link.getUrl().equals(""))) { throw new SpiderException("Invalid URL"); } httpRequests++; try { // make a connection then fetch the status code link.setResponseCode(Jsoup.connect(link.getUrl()).execute().statusCode()); if(link.isSuccessfulResponse()) { LOGGER.info("Crawled [STATUS: " + link.getResponseCode() + "] ~ " + link.getUrl()); successfulRequests++; Document document = Jsoup.connect(link.getUrl()).get(); Elements parsedLinks = document.select("a[href]"); parsedLinks.forEach(element -> { enqueueIfUnique(element.absUrl("href")); }); } else { LOGGER.warning("Crawled [STATUS: " + link.getResponseCode() + "] ~ " + link.getUrl()); failedRequests++; } } catch(IOException e) { LOGGER.warning("Failed to crawl: " + link.getUrl()); failedRequests++; } } /* Enqueues a new web link for the spider to crawl on */ private void enqueueIfUnique(String url) { if(!vistedLinks.contains(url)) { // if the url has not yet been seen WebLink link = new WebLink(url); links.add(link); } } /* Parses the inital entry point links */ private void parseEntryEndpoint(String entryEndpoint) throws SpiderException { JSONObject json = null; try { json = JsonReader.readJsonFromUrl(entryEndpoint); } catch (MalformedURLException e) { throw new SpiderException("Invalid entry point URL", e); } catch (IOException e) { // update me throw new SpiderException("Error reading JSON from URL", e); } catch (JSONException e) { throw new SpiderException("Invalid or Malformed JSON", e); } if (json != null) { Gson gson = new Gson(); EntryPoint endpoint = gson.fromJson(json.toString(), EntryPoint.class); List<String> linksList = endpoint.getLinks(); linksList.forEach(link -> { enqueueIfUnique(link); }); vistedLinks.clear(); } } private void printResults() { LOGGER.info("Results: "); LOGGER.info("HTTP Requests: " + httpRequests); LOGGER.info("Successful Requests : " + successfulRequests); LOGGER.info("Failed Requests : " + failedRequests); } }
package com.funlib.http; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.NameValuePair; import org.apache.http.StatusLine; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntity; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.InputStreamBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.protocol.HTTP; import org.apache.http.util.EntityUtils; import android.content.Context; import com.funlib.http.upload.CountMultipartEntity; import com.funlib.http.upload.CountMultipartEntity.ProgressListener; import com.funlib.log.Log; import com.funlib.utily.FlowController; /** * httpclient请求。 * 1.支持get,post两种请求方式 * 2.支持普通请求响应字符串数据,上传文件、流,下载文件 * 3.支持向请求头和url中追加sessionid信息,如果sessionid被缓存存在的情况下 * * 注意:在处理文件下载时,在使用完流对象后要注意调用HttpEntity.consumeEntity()方法,否则请求被阻塞 * * @author zoubangyue * @version [版本号, 2012-2-14] */ public class HttpRequestImpl implements HttpRequest { private static String TAG = "HttpRequest"; private static DefaultHttpClient httpClient; private HttpEntity httpEntity; private HttpResponse httpResp; private HttpGet httpGet; private HttpPost httpPost; private StatusLine status; private Context ctx; private ReturnData data = new ReturnData();; static { httpClient = HttpClientFactory.getHttpClient(); } public HttpRequestImpl(Context ctx) { this.ctx = ctx; } /** * get请求,获取字符串数据。 * * @param url * 地址 * @param params * 请求参数 * @return */ @Override public ReturnData doGetRequest(String url, Map<String, String> params) { try { //url = SessionCenter.addSessionToUrl(url); httpGet = new HttpGet(url + "?" + HttpUtils.getParamData(params)); SessionCenter.putSessionToHeader(url, httpGet); httpResp = httpClient.execute(httpGet); status = httpResp.getStatusLine(); data.httpStatus = status.getStatusCode(); data.cacheHeader = SessionCenter.parserCacheHeader(httpResp); int sc = status.getStatusCode(); if (sc == HttpStatus.SC_OK) { httpEntity = httpResp.getEntity(); String charSet = EntityUtils.getContentCharSet(httpEntity); data.content = EntityUtils.toString(httpEntity, charSet); data.status = ReturnData.SC_OK; data.contentLength = httpEntity.getContentLength(); SessionCenter.parserJSESSIONID(httpResp); Log.d(TAG, "200状态,status=" + sc); } else if (sc >= 300 && sc < 400) { data.status = ReturnData.FAIL; Log.e(TAG, "300状态,status=" + sc); } else if (sc >= 400 && sc < 500) { data.status = ReturnData.SC_CLIENT_ERROR; Log.e(TAG, "400状态,status=" + sc); } else if (sc >= 500) { data.status = ReturnData.SC_SERVER_ERROR; Log.e(TAG, "500状态,status=" + sc); } else { data.status = ReturnData.FAIL; Log.e(TAG, "其他状态,status" + sc); } } catch (Exception e) { Log.e(TAG, "请求数据失败," + url, e); data.status = ReturnData.FAIL; } finally { if (data.status == ReturnData.SC_OK) FlowController.count(FlowController.FLOW_UP, data.contentLength); } return data; } /** * post请求,获取字符串数据。 * * @param url * 地址 * @param params * 请求参数 * @return */ @Override public ReturnData doPostRequest(String url, Map<String, String> params) { try { Log.d(TAG, "url= " + url + " --- params=" + params); //url = SessionCenter.addSessionToUrl(url); List<NameValuePair> vp = HttpUtils.getNameValuePair(params); SessionCenter.putSessionToHeader(url, httpPost); httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(vp, HTTP.UTF_8)); httpResp = httpClient.execute(httpPost); status = httpResp.getStatusLine(); data.httpStatus = status.getStatusCode(); data.cacheHeader = SessionCenter.parserCacheHeader(httpResp); int sc = status.getStatusCode(); if (sc == HttpStatus.SC_OK) { httpEntity = httpResp.getEntity(); String charSet = EntityUtils.getContentCharSet(httpEntity); data.content = EntityUtils.toString(httpEntity, charSet); data.status = ReturnData.SC_OK; data.contentLength = httpEntity.getContentLength(); httpEntity.consumeContent(); SessionCenter.parserJSESSIONID(httpResp); Log.d(TAG, "200状态,status=" + sc); } else if (sc >= 300 && sc < 400) { data.status = ReturnData.FAIL; Log.e(TAG, "300状态,status=" + sc); } else if (sc >= 400 && sc < 500) { data.status = ReturnData.SC_CLIENT_ERROR; Log.e(TAG, "400状态,status=" + sc); } else if (sc >= 500) { data.status = ReturnData.SC_SERVER_ERROR; Log.e(TAG, "500状态,status=" + sc); } else { data.status = ReturnData.FAIL; Log.e(TAG, "其他状态,status" + sc); } } catch (Exception e) { Log.e(TAG, "请求数据失败," + url, e); data.status = ReturnData.FAIL; } finally { if (data.status == ReturnData.SC_OK) FlowController.count(FlowController.FLOW_UP, data.contentLength); try { //请求后立即释放资源 httpPost.abort(); } catch (Exception e) { e.printStackTrace(); } } return data; } /** * post请求,上传文件列表,并获取字符串数据。 * * @param url * 地址 * @param map * 请求参数 * @return */ @Override public ReturnData doPostUploadFileRequest(String url, Map<String, String> params, ProgressListener listener, File[] files, String[] fileNames) { try { //url = SessionCenter.addSessionToUrl(url); httpPost = new HttpPost(url); SessionCenter.putSessionToHeader(url, httpPost); CountMultipartEntity entity = new CountMultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE, "*****", Charset.forName(HTTP.UTF_8), listener); Set<String> keys = params.keySet(); for (String key : keys) { StringBody paramValue = new StringBody(params.get(key), Charset.forName(HTTP.UTF_8)); entity.addPart(key, paramValue); } int size = 0; for (File file : files) { FileBody fileValue = new FileBody(file); if (size < 1) { entity.addPart("file", fileValue); } else entity.addPart("file" + size, fileValue); size++; } httpPost.setEntity(entity); httpResp = httpClient.execute(httpPost); status = httpResp.getStatusLine(); data.httpStatus = status.getStatusCode(); data.cacheHeader = SessionCenter.parserCacheHeader(httpResp); int sc = status.getStatusCode(); if (sc == HttpStatus.SC_OK) { httpEntity = httpResp.getEntity(); String charSet = EntityUtils.getContentCharSet(httpEntity); data.content = EntityUtils.toString(httpEntity, charSet); data.status = ReturnData.SC_OK; data.contentLength = httpEntity.getContentLength(); SessionCenter.parserJSESSIONID(httpResp); httpEntity.consumeContent(); Log.d(TAG, "200状态,status=" + sc); } else if (sc >= 300 && sc < 400) { data.status = ReturnData.FAIL; Log.e(TAG, "300状态,status=" + sc); } else if (sc >= 400 && sc < 500) { data.status = ReturnData.SC_CLIENT_ERROR; Log.e(TAG, "400状态,status=" + sc); } else if (sc >= 500) { data.status = ReturnData.SC_SERVER_ERROR; Log.e(TAG, "500状态,status=" + sc); } else { data.status = ReturnData.FAIL; Log.e(TAG, "其他状态,status" + sc); } } catch (Exception e) { data.status = ReturnData.FAIL; Log.e(TAG, "请求数据失败," + url, e); //e.printStackTrace(); } finally { if (data.status == ReturnData.SC_OK) FlowController.count(FlowController.FLOW_UP, data.contentLength); } return data; } /** * post请求,上传流列表,并获取字符串数据。 * * @param url * 地址 * @param map * 请求参数 * @return */ @Override public ReturnData doPostUploadStreamRequest(String url, Map<String, String> params, ProgressListener listener, InputStream[] iss, String[] fileNames) { try { url = SessionCenter.addSessionToUrl(url); httpPost = new HttpPost(url); SessionCenter.putSessionToHeader(url, httpPost); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE, "*****", Charset.forName(HTTP.UTF_8)); Set<String> keys = params.keySet(); for (String key : keys) { StringBody paramValue = new StringBody(params.get(key), Charset.forName(HTTP.UTF_8)); entity.addPart(key, paramValue); } int size = 0; for (InputStream is : iss) { InputStreamBody isb = new InputStreamBody(is, fileNames[size]); if (size < 1) { entity.addPart("file", isb); } else entity.addPart("file" + size, isb); size++; } httpPost.setEntity(entity); httpResp = httpClient.execute(httpPost); status = httpResp.getStatusLine(); data.httpStatus = status.getStatusCode(); data.cacheHeader = SessionCenter.parserCacheHeader(httpResp); int sc = status.getStatusCode(); if (sc == HttpStatus.SC_OK) { httpEntity = httpResp.getEntity(); String charSet = EntityUtils.getContentCharSet(httpEntity); data.content = EntityUtils.toString(httpEntity, charSet); data.status = ReturnData.SC_OK; data.contentLength = httpEntity.getContentLength(); SessionCenter.parserJSESSIONID(httpResp); httpEntity.consumeContent(); Log.d(TAG, "200状态,status=" + sc); } else if (sc >= 300 && sc < 400) { data.status = ReturnData.FAIL; Log.e(TAG, "300状态,status=" + sc); } else if (sc >= 400 && sc < 500) { data.status = ReturnData.SC_CLIENT_ERROR; Log.e(TAG, "400状态,status=" + sc); } else if (sc >= 500) { data.status = ReturnData.SC_SERVER_ERROR; Log.e(TAG, "500状态,status=" + sc); } else { data.status = ReturnData.FAIL; Log.e(TAG, "其他状态,status" + sc); } } catch (Exception e) { data.status = ReturnData.FAIL; Log.e(TAG, "请求数据失败," + url, e); //e.printStackTrace(); } finally { if (data.status == ReturnData.SC_OK) FlowController.count(FlowController.FLOW_UP, data.contentLength); } return data; } /** * post请求,下载文件流。 * 注意流处理完毕之后必须要调用consumeResponse方法。 * @param url * 地址 * @param params * 请求参数 * @param dataType * 需要的响应数据类型 * @return */ @Override public ReturnData doDownloadRequest(String url, Map<String, String> params, int dataType) { try { //url = SessionCenter.addSessionToUrl(url); //List<NameValuePair> vp = HttpUtils.getNameValuePair(params); httpPost = new HttpPost(url); //httpPost.setEntity(new UrlEncodedFormEntity(vp, HTTP.UTF_8)); //SessionCenter.putSessionToHeader(url, httpPost); httpResp = httpClient.execute(httpPost); httpEntity = httpResp.getEntity(); status = httpResp.getStatusLine(); data.httpStatus = status.getStatusCode(); data.cacheHeader = SessionCenter.parserCacheHeader(httpResp); data.dataType = dataType; int sc = status.getStatusCode(); if (sc == HttpStatus.SC_OK) { httpEntity = httpResp.getEntity(); data.status = ReturnData.SC_OK; data.contentLength = httpEntity.getContentLength(); data.entity = httpEntity; if (dataType == ReturnData.STRING) { String charSet = EntityUtils.getContentCharSet(httpEntity); data.content = EntityUtils.toString(httpEntity, charSet); httpEntity.consumeContent(); } else if (dataType == ReturnData.STREAM) { data.is = httpEntity.getContent(); data.entity = httpEntity; } else if (dataType == ReturnData.BYTEARRAY) { data.bytes = EntityUtils.toByteArray(httpEntity); httpEntity.consumeContent(); } else { httpEntity.consumeContent(); throw new RuntimeException("传入数据类型不支持"); } SessionCenter.parserJSESSIONID(httpResp); Log.d(TAG, "200状态,status=" + sc); } else if (sc >= 300 && sc < 400) { data.status = ReturnData.FAIL; Log.e(TAG, "300状态,status=" + sc); } else if (sc >= 400 && sc < 500) { data.status = ReturnData.SC_CLIENT_ERROR; Log.e(TAG, "400状态,status=" + sc); } else if (sc >= 500) { data.status = ReturnData.SC_SERVER_ERROR; Log.e(TAG, "500状态,status=" + sc); } else { data.status = ReturnData.FAIL; Log.e(TAG, "其他状态,status" + sc); } } catch (Exception e) { data.status = ReturnData.FAIL; Log.e(TAG, "请求数据失败," + url, e); //e.printStackTrace(); } finally { if (data.status == ReturnData.SC_OK) FlowController.count(FlowController.FLOW_UP, data.contentLength); } return data; } /** * get请求,下载文件流。 * 注意流处理完毕之后必须要调用consumeResponse方法。 * @param url * 地址 * @param params * 请求参数 * @param dataType * 需要的响应数据类型 * @return */ @Override public ReturnData doGetDownloadRequest(String url, Map<String, String> params, int dataType) { try { //url = SessionCenter.addSessionToUrl(url); //List<NameValuePair> vp = HttpUtils.getNameValuePair(params); httpGet = new HttpGet(url); //httpPost.setEntity(new UrlEncodedFormEntity(vp, HTTP.UTF_8)); //SessionCenter.putSessionToHeader(url, httpPost); httpResp = httpClient.execute(httpGet); httpEntity = httpResp.getEntity(); status = httpResp.getStatusLine(); data.httpStatus = status.getStatusCode(); data.cacheHeader = SessionCenter.parserCacheHeader(httpResp); data.dataType = dataType; int sc = status.getStatusCode(); if (sc == HttpStatus.SC_OK) { httpEntity = httpResp.getEntity(); data.status = ReturnData.SC_OK; data.contentLength = httpEntity.getContentLength(); data.entity = httpEntity; if (dataType == ReturnData.STRING) { String charSet = EntityUtils.getContentCharSet(httpEntity); data.content = EntityUtils.toString(httpEntity, charSet); httpEntity.consumeContent(); } else if (dataType == ReturnData.STREAM) { data.is = httpEntity.getContent(); data.entity = httpEntity; } else if (dataType == ReturnData.BYTEARRAY) { data.bytes = EntityUtils.toByteArray(httpEntity); httpEntity.consumeContent(); } else { httpEntity.consumeContent(); throw new RuntimeException("传入数据类型不支持"); } SessionCenter.parserJSESSIONID(httpResp); Log.d(TAG, "200状态,status=" + sc); } else if (sc >= 300 && sc < 400) { data.status = ReturnData.FAIL; Log.e(TAG, "300状态,status=" + sc); } else if (sc >= 400 && sc < 500) { data.status = ReturnData.SC_CLIENT_ERROR; Log.e(TAG, "400状态,status=" + sc); } else if (sc >= 500) { data.status = ReturnData.SC_SERVER_ERROR; Log.e(TAG, "500状态,status=" + sc); } else { data.status = ReturnData.FAIL; Log.e(TAG, "其他状态,status" + sc); } } catch (Exception e) { data.status = ReturnData.FAIL; Log.e(TAG, "请求数据失败," + url, e); //e.printStackTrace(); } finally { if (data.status == ReturnData.SC_OK) FlowController.count(FlowController.FLOW_UP, data.contentLength); } return data; } @Override public void cancel() { if (httpPost != null) { httpPost.abort(); } if (httpGet != null) { httpGet.abort(); } } public void addHeader(String name, String value) { if (httpPost != null) { httpPost.addHeader(name, value); } if (httpGet != null) { httpPost.addHeader(name, value); } } public void consumeContent() { if (httpEntity != null) { try { httpEntity.consumeContent(); } catch (IOException e) { e.printStackTrace(); } } } }
package io.bigboss.config; import io.bigboss.service.MessagePublisher; import io.bigboss.service.RedisMessagePublisher; import io.bigboss.service.RedisMessageSubscriber; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.listener.ChannelTopic; import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; import org.springframework.data.redis.serializer.StringRedisSerializer; @Configuration public class RedisConfig { @Bean public RedisConnectionFactory redisConnectionFactory() { return new LettuceConnectionFactory(); } @Bean public RedisTemplate<String, Object> redisTemplate() { final RedisTemplate<String, Object> template = new RedisTemplate<>(); template.setKeySerializer(new StringRedisSerializer()); template.setValueSerializer(new StringRedisSerializer()); template.setConnectionFactory(redisConnectionFactory()); return template; } @Bean public MessageListenerAdapter messageListener() { return new MessageListenerAdapter(new RedisMessageSubscriber()); } @Bean public RedisMessageListenerContainer redisContainer() { RedisMessageListenerContainer container = new RedisMessageListenerContainer(); container.setConnectionFactory(redisConnectionFactory()); container.addMessageListener(messageListener(), topic()); return container; } @Bean public MessagePublisher redisPublisher() { return new RedisMessagePublisher(redisTemplate(), topic()); } @Bean public ChannelTopic topic() { return new ChannelTopic("pubsub:queue"); } }
package com.example.magazine_irailson.activity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.example.magazine_irailson.R; import com.example.magazine_irailson.adapter.ProdutoRecyclerAdapter; import com.example.magazine_irailson.config.ConfiguracaoFirebase; import com.example.magazine_irailson.model.Produto; import com.example.magazine_irailson.util.Util; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.Query; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.Objects; public class ProdutoFragment extends Fragment { private RecyclerView mRecyclerView; private ProdutoRecyclerAdapter adapter; private SwipeRefreshLayout mSwipeRefreshLayout; private ConstraintLayout contentEmpty; private ArrayList<Produto> produtos; private boolean hasConnection; private Query firebase; private ValueEventListener valueEventListenerProdutos; public ProdutoFragment() { } @Override public void onStart() { super.onStart(); firebase.addValueEventListener(valueEventListenerProdutos); } @Override public void onStop() { super.onStop(); firebase.removeEventListener(valueEventListenerProdutos); } @Override public void onResume() { super.onResume(); carregarProdutos(); } @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_produto, container, false); mRecyclerView = view.findViewById(R.id.recycleViewProduto); mSwipeRefreshLayout = view.findViewById(R.id.srlProduto); contentEmpty = view.findViewById(R.id.content_empty); hasConnection = Util.verifyConnection(Objects.requireNonNull(getActivity())); produtos = new ArrayList<>(); firebase = ConfiguracaoFirebase.getFirebase() .child("produtos"); carregarProdutos(); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(layoutManager); adapter = new ProdutoRecyclerAdapter(produtos, getContext()); mRecyclerView.setAdapter(adapter); mSwipeRefreshLayout.setOnRefreshListener(this::carregarProdutos); return view; } private void carregarProdutos() { if (hasConnection) { mSwipeRefreshLayout.setRefreshing(true); valueEventListenerProdutos = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { //Limpar lista produtos.clear(); //Listar produtos for (DataSnapshot dados : dataSnapshot.getChildren()) { Produto produto = dados.getValue(Produto.class); produtos.add(produto); } //Se não possui produtos, o conteudo some if (produtos.size() > 0) { contentEmpty.setVisibility(View.GONE); mRecyclerView.setVisibility(View.VISIBLE); adapter = new ProdutoRecyclerAdapter(produtos, getContext()); mRecyclerView.setAdapter(adapter); adapter.notifyDataSetChanged(); mSwipeRefreshLayout.setRefreshing(false); } else { contentEmpty.setVisibility(View.VISIBLE); mRecyclerView.setVisibility(View.GONE); mSwipeRefreshLayout.setRefreshing(false); } adapter.notifyDataSetChanged(); mSwipeRefreshLayout.setRefreshing(false); } @Override public void onCancelled(DatabaseError databaseError) { contentEmpty.setVisibility(View.VISIBLE); mRecyclerView.setVisibility(View.GONE); mSwipeRefreshLayout.setRefreshing(false); } }; } else { mSwipeRefreshLayout.setRefreshing(false); mRecyclerView.setVisibility(View.GONE); Util.mostrarMensagen(getContext(), "Sem internet"); } mSwipeRefreshLayout.setRefreshing(false); } }
package cs455.nfs.shared.structure.node; import cs455.nfs.shared.structure.Filesystem; import cs455.nfs.shared.structure.IVisitor; public interface INode { DirectoryNode getParent(); String getName(); void accept(IVisitor visitor); Filesystem getFilesystem(); String getFullPath(); }
package ru.otus.hw12; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.eclipse.jetty.security.LoginService; import org.hibernate.SessionFactory; import ru.otus.hw12.dao.UserDao; import ru.otus.hw12.hibernate.HibernateUtils; import ru.otus.hw12.hibernate.dao.UserDaoHibernate; import ru.otus.hw12.hibernate.sessionmanager.SessionManagerHibernate; import ru.otus.hw12.jetty.server.UsersWebServer; import ru.otus.hw12.jetty.server.UsersWebServerImpl; import ru.otus.hw12.jetty.services.*; import ru.otus.hw12.hibernate.dbservice.DbServiceUser; import ru.otus.hw12.hibernate.dbservice.DbServiceUserImpl; import ru.otus.hw12.model.User; import static ru.otus.hw12.jetty.server.SecurityType.FILTER_BASED; /* Полезные для демо ссылки // Стартовая страница http://localhost:8080 // Страница администратора http://localhost:8080/admin */ public class StartServer { private static final int WEB_SERVER_PORT = 8080; private static final String TEMPLATES_DIR = "/templates/"; private static Class[] annotateClasses = {User.class}; private static void createUsers(DbServiceUser dbServiceUser) { User admin = new User(); admin.setLogin("admin"); admin.setUsername("Admin"); admin.setPassword("admin"); dbServiceUser.saveUser(admin); } public static void main(String[] args) throws Exception { SessionFactory sessionFactory = HibernateUtils.buildSessionFactory("cfg/hibernate.cfg.xml", annotateClasses); SessionManagerHibernate sessionManager = new SessionManagerHibernate(sessionFactory); UserDao userDaoHibernate = new UserDaoHibernate(sessionManager); DbServiceUser dbServiceUser = new DbServiceUserImpl(userDaoHibernate); createUsers(dbServiceUser); UserAuthService userAuthServiceForFilterBasedSecurity = new UserAuthServiceImpl(dbServiceUser); LoginService loginServiceForBasicSecurity = new HibernateLoginServiceImpl(dbServiceUser); Gson gson = new GsonBuilder().serializeNulls() .excludeFieldsWithoutExposeAnnotation() .setPrettyPrinting() .create(); TemplateProcessor templateProcessor = new TemplateProcessorImpl(TEMPLATES_DIR); UsersWebServer usersWebServer = new UsersWebServerImpl(WEB_SERVER_PORT, FILTER_BASED, userAuthServiceForFilterBasedSecurity, loginServiceForBasicSecurity, dbServiceUser, gson, templateProcessor); usersWebServer.start(); usersWebServer.join(); } }
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class Main { static int[] energy = new int[100]; public static void main (String [] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); List<Integer> e = new ArrayList<>(); List<Integer> g = new ArrayList<>(); StringTokenizer st = new StringTokenizer(br.readLine()); StringTokenizer st2 = new StringTokenizer(br.readLine()); for (int i = 0; i < n; i++) { e.add(Integer.parseInt(st.nextToken())); g.add(Integer.parseInt(st2.nextToken())); } for (int i = 0; i < n; i++) { for (int j = 99; j >= 0; j--) { int index = e.get(i) + j; if (index < 100) { energy[index] = Math.max(energy[index], energy[j] + g.get(i)); } } } int max = 0; for (int i = 0; i < energy.length; i++) { max = Math.max(max, energy[i]); } System.out.println(max); } }
/** */ package EpkDSL.impl; import EpkDSL.Connector; import EpkDSL.DefaultConnection; import EpkDSL.EConToFuConnection; import EpkDSL.EConnector; import EpkDSL.Edge; import EpkDSL.EndEvent; import EpkDSL.Epk; import EpkDSL.EpkDSLFactory; import EpkDSL.EpkDSLPackage; import EpkDSL.EvToEConConnection; import EpkDSL.EvToFuConnection; import EpkDSL.Event; import EpkDSL.FConToEndEvConnection; import EpkDSL.FConToEvConnection; import EpkDSL.FConnector; import EpkDSL.FuToEndEvConnection; import EpkDSL.FuToEvConnection; import EpkDSL.FuToFConConnection; import EpkDSL.Function; import EpkDSL.InOutput; import EpkDSL.IoToFuConnection; import EpkDSL.NamedElement; import EpkDSL.Node; import EpkDSL.NodeToPpConnection; import EpkDSL.OrgUnit; import EpkDSL.OuToFuConnection; import EpkDSL.PpToNodeConnection; import EpkDSL.ProcPath; import EpkDSL.StartEvToEConConnection; import EpkDSL.StartEvToFuConnection; import EpkDSL.StartEvent; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; /** * <!-- begin-user-doc --> * An implementation of the model <b>Package</b>. * <!-- end-user-doc --> * @generated */ public class EpkDSLPackageImpl extends EPackageImpl implements EpkDSLPackage { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass namedElementEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass epkEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass edgeEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass nodeEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass eventEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass functionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass inOutputEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass orgUnitEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass procPathEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass connectorEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass eConnectorEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass fConnectorEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass defaultConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass evToFuConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass fuToEvConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass evToEConConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass eConToFuConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass fuToFConConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass fConToEvConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass ouToFuConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass ioToFuConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass nodeToPpConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass ppToNodeConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass startEventEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass endEventEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass startEvToFuConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass startEvToEConConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass fuToEndEvConnectionEClass = null; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private EClass fConToEndEvConnectionEClass = null; /** * Creates an instance of the model <b>Package</b>, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package * package URI value. * <p>Note: the correct way to create the package is via the static * factory method {@link #init init()}, which also performs * initialization of the package, or returns the registered package, * if one already exists. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.eclipse.emf.ecore.EPackage.Registry * @see EpkDSL.EpkDSLPackage#eNS_URI * @see #init() * @generated */ private EpkDSLPackageImpl() { super(eNS_URI, EpkDSLFactory.eINSTANCE); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static boolean isInited = false; /** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. * * <p>This method is used to initialize {@link EpkDSLPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */ public static EpkDSLPackage init() { if (isInited) return (EpkDSLPackage)EPackage.Registry.INSTANCE.getEPackage(EpkDSLPackage.eNS_URI); // Obtain or create and register package EpkDSLPackageImpl theEpkDSLPackage = (EpkDSLPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EpkDSLPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new EpkDSLPackageImpl()); isInited = true; // Create package meta-data objects theEpkDSLPackage.createPackageContents(); // Initialize created meta-data theEpkDSLPackage.initializePackageContents(); // Mark meta-data to indicate it can't be changed theEpkDSLPackage.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(EpkDSLPackage.eNS_URI, theEpkDSLPackage); return theEpkDSLPackage; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getNamedElement() { return namedElementEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EAttribute getNamedElement_Name() { return (EAttribute)namedElementEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEpk() { return epkEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEpk_Nodes() { return (EReference)epkEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEpk_Edges() { return (EReference)epkEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEpk_Connections() { return (EReference)epkEClass.getEStructuralFeatures().get(2); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEdge() { return edgeEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getNode() { return nodeEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEvent() { return eventEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getFunction() { return functionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getInOutput() { return inOutputEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getOrgUnit() { return orgUnitEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getProcPath() { return procPathEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getConnector() { return connectorEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEConnector() { return eConnectorEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getFConnector() { return fConnectorEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getDefaultConnection() { return defaultConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEvToFuConnection() { return evToFuConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEvToFuConnection_Start() { return (EReference)evToFuConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEvToFuConnection_End() { return (EReference)evToFuConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getFuToEvConnection() { return fuToEvConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFuToEvConnection_Start() { return (EReference)fuToEvConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFuToEvConnection_End() { return (EReference)fuToEvConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEvToEConConnection() { return evToEConConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEvToEConConnection_Start() { return (EReference)evToEConConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEvToEConConnection_End() { return (EReference)evToEConConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEConToFuConnection() { return eConToFuConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEConToFuConnection_Start() { return (EReference)eConToFuConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getEConToFuConnection_End() { return (EReference)eConToFuConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getFuToFConConnection() { return fuToFConConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFuToFConConnection_Start() { return (EReference)fuToFConConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFuToFConConnection_End() { return (EReference)fuToFConConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getFConToEvConnection() { return fConToEvConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFConToEvConnection_Start() { return (EReference)fConToEvConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFConToEvConnection_End() { return (EReference)fConToEvConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getOuToFuConnection() { return ouToFuConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getOuToFuConnection_Start() { return (EReference)ouToFuConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getOuToFuConnection_End() { return (EReference)ouToFuConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getIoToFuConnection() { return ioToFuConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getIoToFuConnection_Start() { return (EReference)ioToFuConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getIoToFuConnection_End() { return (EReference)ioToFuConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getNodeToPpConnection() { return nodeToPpConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getNodeToPpConnection_Start() { return (EReference)nodeToPpConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getNodeToPpConnection_End() { return (EReference)nodeToPpConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getPpToNodeConnection() { return ppToNodeConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getPpToNodeConnection_Start() { return (EReference)ppToNodeConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getPpToNodeConnection_End() { return (EReference)ppToNodeConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getStartEvent() { return startEventEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getEndEvent() { return endEventEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getStartEvToFuConnection() { return startEvToFuConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getStartEvToFuConnection_Start() { return (EReference)startEvToFuConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getStartEvToFuConnection_End() { return (EReference)startEvToFuConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getStartEvToEConConnection() { return startEvToEConConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getStartEvToEConConnection_Start() { return (EReference)startEvToEConConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getStartEvToEConConnection_End() { return (EReference)startEvToEConConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getFuToEndEvConnection() { return fuToEndEvConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFuToEndEvConnection_Start() { return (EReference)fuToEndEvConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFuToEndEvConnection_End() { return (EReference)fuToEndEvConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EClass getFConToEndEvConnection() { return fConToEndEvConnectionEClass; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFConToEndEvConnection_Start() { return (EReference)fConToEndEvConnectionEClass.getEStructuralFeatures().get(0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EReference getFConToEndEvConnection_End() { return (EReference)fConToEndEvConnectionEClass.getEStructuralFeatures().get(1); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EpkDSLFactory getEpkDSLFactory() { return (EpkDSLFactory)getEFactoryInstance(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private boolean isCreated = false; /** * Creates the meta-model objects for the package. This method is * guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void createPackageContents() { if (isCreated) return; isCreated = true; // Create classes and their features namedElementEClass = createEClass(NAMED_ELEMENT); createEAttribute(namedElementEClass, NAMED_ELEMENT__NAME); epkEClass = createEClass(EPK); createEReference(epkEClass, EPK__NODES); createEReference(epkEClass, EPK__EDGES); createEReference(epkEClass, EPK__CONNECTIONS); edgeEClass = createEClass(EDGE); nodeEClass = createEClass(NODE); eventEClass = createEClass(EVENT); functionEClass = createEClass(FUNCTION); inOutputEClass = createEClass(IN_OUTPUT); orgUnitEClass = createEClass(ORG_UNIT); procPathEClass = createEClass(PROC_PATH); connectorEClass = createEClass(CONNECTOR); eConnectorEClass = createEClass(ECONNECTOR); fConnectorEClass = createEClass(FCONNECTOR); defaultConnectionEClass = createEClass(DEFAULT_CONNECTION); evToFuConnectionEClass = createEClass(EV_TO_FU_CONNECTION); createEReference(evToFuConnectionEClass, EV_TO_FU_CONNECTION__START); createEReference(evToFuConnectionEClass, EV_TO_FU_CONNECTION__END); fuToEvConnectionEClass = createEClass(FU_TO_EV_CONNECTION); createEReference(fuToEvConnectionEClass, FU_TO_EV_CONNECTION__START); createEReference(fuToEvConnectionEClass, FU_TO_EV_CONNECTION__END); evToEConConnectionEClass = createEClass(EV_TO_ECON_CONNECTION); createEReference(evToEConConnectionEClass, EV_TO_ECON_CONNECTION__START); createEReference(evToEConConnectionEClass, EV_TO_ECON_CONNECTION__END); eConToFuConnectionEClass = createEClass(ECON_TO_FU_CONNECTION); createEReference(eConToFuConnectionEClass, ECON_TO_FU_CONNECTION__START); createEReference(eConToFuConnectionEClass, ECON_TO_FU_CONNECTION__END); fuToFConConnectionEClass = createEClass(FU_TO_FCON_CONNECTION); createEReference(fuToFConConnectionEClass, FU_TO_FCON_CONNECTION__START); createEReference(fuToFConConnectionEClass, FU_TO_FCON_CONNECTION__END); fConToEvConnectionEClass = createEClass(FCON_TO_EV_CONNECTION); createEReference(fConToEvConnectionEClass, FCON_TO_EV_CONNECTION__START); createEReference(fConToEvConnectionEClass, FCON_TO_EV_CONNECTION__END); ouToFuConnectionEClass = createEClass(OU_TO_FU_CONNECTION); createEReference(ouToFuConnectionEClass, OU_TO_FU_CONNECTION__START); createEReference(ouToFuConnectionEClass, OU_TO_FU_CONNECTION__END); ioToFuConnectionEClass = createEClass(IO_TO_FU_CONNECTION); createEReference(ioToFuConnectionEClass, IO_TO_FU_CONNECTION__START); createEReference(ioToFuConnectionEClass, IO_TO_FU_CONNECTION__END); nodeToPpConnectionEClass = createEClass(NODE_TO_PP_CONNECTION); createEReference(nodeToPpConnectionEClass, NODE_TO_PP_CONNECTION__START); createEReference(nodeToPpConnectionEClass, NODE_TO_PP_CONNECTION__END); ppToNodeConnectionEClass = createEClass(PP_TO_NODE_CONNECTION); createEReference(ppToNodeConnectionEClass, PP_TO_NODE_CONNECTION__START); createEReference(ppToNodeConnectionEClass, PP_TO_NODE_CONNECTION__END); startEventEClass = createEClass(START_EVENT); endEventEClass = createEClass(END_EVENT); startEvToFuConnectionEClass = createEClass(START_EV_TO_FU_CONNECTION); createEReference(startEvToFuConnectionEClass, START_EV_TO_FU_CONNECTION__START); createEReference(startEvToFuConnectionEClass, START_EV_TO_FU_CONNECTION__END); startEvToEConConnectionEClass = createEClass(START_EV_TO_ECON_CONNECTION); createEReference(startEvToEConConnectionEClass, START_EV_TO_ECON_CONNECTION__START); createEReference(startEvToEConConnectionEClass, START_EV_TO_ECON_CONNECTION__END); fuToEndEvConnectionEClass = createEClass(FU_TO_END_EV_CONNECTION); createEReference(fuToEndEvConnectionEClass, FU_TO_END_EV_CONNECTION__START); createEReference(fuToEndEvConnectionEClass, FU_TO_END_EV_CONNECTION__END); fConToEndEvConnectionEClass = createEClass(FCON_TO_END_EV_CONNECTION); createEReference(fConToEndEvConnectionEClass, FCON_TO_END_EV_CONNECTION__START); createEReference(fConToEndEvConnectionEClass, FCON_TO_END_EV_CONNECTION__END); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private boolean isInitialized = false; /** * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void initializePackageContents() { if (isInitialized) return; isInitialized = true; // Initialize package setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); // Create type parameters // Set bounds for type parameters // Add supertypes to classes epkEClass.getESuperTypes().add(this.getNamedElement()); edgeEClass.getESuperTypes().add(this.getEpk()); nodeEClass.getESuperTypes().add(this.getEpk()); eventEClass.getESuperTypes().add(this.getNode()); functionEClass.getESuperTypes().add(this.getNode()); inOutputEClass.getESuperTypes().add(this.getNode()); orgUnitEClass.getESuperTypes().add(this.getNode()); procPathEClass.getESuperTypes().add(this.getNode()); connectorEClass.getESuperTypes().add(this.getNode()); eConnectorEClass.getESuperTypes().add(this.getConnector()); fConnectorEClass.getESuperTypes().add(this.getConnector()); evToFuConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); fuToEvConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); evToEConConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); eConToFuConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); fuToFConConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); fConToEvConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); ouToFuConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); ioToFuConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); nodeToPpConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); ppToNodeConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); startEventEClass.getESuperTypes().add(this.getNode()); endEventEClass.getESuperTypes().add(this.getNode()); startEvToFuConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); startEvToEConConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); fuToEndEvConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); fConToEndEvConnectionEClass.getESuperTypes().add(this.getDefaultConnection()); // Initialize classes and features; add operations and parameters initEClass(namedElementEClass, NamedElement.class, "NamedElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getNamedElement_Name(), ecorePackage.getEString(), "name", null, 1, 1, NamedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(epkEClass, Epk.class, "Epk", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getEpk_Nodes(), this.getNode(), null, "nodes", null, 0, -1, Epk.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getEpk_Edges(), this.getEdge(), null, "edges", null, 0, -1, Epk.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getEpk_Connections(), this.getDefaultConnection(), null, "connections", null, 0, -1, Epk.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(edgeEClass, Edge.class, "Edge", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(nodeEClass, Node.class, "Node", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(eventEClass, Event.class, "Event", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(functionEClass, Function.class, "Function", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(inOutputEClass, InOutput.class, "InOutput", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(orgUnitEClass, OrgUnit.class, "OrgUnit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(procPathEClass, ProcPath.class, "ProcPath", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(connectorEClass, Connector.class, "Connector", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(eConnectorEClass, EConnector.class, "EConnector", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(fConnectorEClass, FConnector.class, "FConnector", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(defaultConnectionEClass, DefaultConnection.class, "DefaultConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(evToFuConnectionEClass, EvToFuConnection.class, "EvToFuConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getEvToFuConnection_Start(), this.getEvent(), null, "start", null, 1, 1, EvToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getEvToFuConnection_End(), this.getFunction(), null, "end", null, 1, 1, EvToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(fuToEvConnectionEClass, FuToEvConnection.class, "FuToEvConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getFuToEvConnection_Start(), this.getFunction(), null, "start", null, 1, 1, FuToEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getFuToEvConnection_End(), this.getEvent(), null, "end", null, 1, 1, FuToEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(evToEConConnectionEClass, EvToEConConnection.class, "EvToEConConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getEvToEConConnection_Start(), this.getEvent(), null, "start", null, 1, 1, EvToEConConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getEvToEConConnection_End(), this.getEConnector(), null, "end", null, 1, 1, EvToEConConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(eConToFuConnectionEClass, EConToFuConnection.class, "EConToFuConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getEConToFuConnection_Start(), this.getEConnector(), null, "start", null, 1, 1, EConToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getEConToFuConnection_End(), this.getFunction(), null, "end", null, 1, 1, EConToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(fuToFConConnectionEClass, FuToFConConnection.class, "FuToFConConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getFuToFConConnection_Start(), this.getFunction(), null, "start", null, 1, 1, FuToFConConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getFuToFConConnection_End(), this.getFConnector(), null, "end", null, 1, 1, FuToFConConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(fConToEvConnectionEClass, FConToEvConnection.class, "FConToEvConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getFConToEvConnection_Start(), this.getFConnector(), null, "start", null, 1, 1, FConToEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getFConToEvConnection_End(), this.getEvent(), null, "end", null, 1, 1, FConToEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(ouToFuConnectionEClass, OuToFuConnection.class, "OuToFuConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getOuToFuConnection_Start(), this.getOrgUnit(), null, "start", null, 1, 1, OuToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getOuToFuConnection_End(), this.getFunction(), null, "end", null, 1, 1, OuToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(ioToFuConnectionEClass, IoToFuConnection.class, "IoToFuConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getIoToFuConnection_Start(), this.getInOutput(), null, "start", null, 1, 1, IoToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getIoToFuConnection_End(), this.getFunction(), null, "end", null, 1, 1, IoToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(nodeToPpConnectionEClass, NodeToPpConnection.class, "NodeToPpConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getNodeToPpConnection_Start(), this.getNode(), null, "start", null, 1, 1, NodeToPpConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getNodeToPpConnection_End(), this.getProcPath(), null, "end", null, 1, 1, NodeToPpConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(ppToNodeConnectionEClass, PpToNodeConnection.class, "PpToNodeConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getPpToNodeConnection_Start(), this.getProcPath(), null, "start", null, 1, 1, PpToNodeConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getPpToNodeConnection_End(), this.getNode(), null, "end", null, 1, 1, PpToNodeConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(startEventEClass, StartEvent.class, "StartEvent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(endEventEClass, EndEvent.class, "EndEvent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(startEvToFuConnectionEClass, StartEvToFuConnection.class, "StartEvToFuConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getStartEvToFuConnection_Start(), this.getStartEvent(), null, "start", null, 1, 1, StartEvToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getStartEvToFuConnection_End(), this.getFunction(), null, "end", null, 1, 1, StartEvToFuConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(startEvToEConConnectionEClass, StartEvToEConConnection.class, "StartEvToEConConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getStartEvToEConConnection_Start(), this.getStartEvent(), null, "start", null, 1, 1, StartEvToEConConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getStartEvToEConConnection_End(), this.getEConnector(), null, "end", null, 1, 1, StartEvToEConConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(fuToEndEvConnectionEClass, FuToEndEvConnection.class, "FuToEndEvConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getFuToEndEvConnection_Start(), this.getFunction(), null, "start", null, 1, 1, FuToEndEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getFuToEndEvConnection_End(), this.getEndEvent(), null, "end", null, 1, 1, FuToEndEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(fConToEndEvConnectionEClass, FConToEndEvConnection.class, "FConToEndEvConnection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getFConToEndEvConnection_Start(), this.getFConnector(), null, "start", null, 1, 1, FConToEndEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getFConToEndEvConnection_End(), this.getEndEvent(), null, "end", null, 1, 1, FConToEndEvConnection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); // Create resource createResource(eNS_URI); } } //EpkDSLPackageImpl
package com.quizcore.quizapp.model.network.response.partner; import java.util.UUID; public class PartnerResponse { private UUID partnerkey; private String message; private String mobile; private String email; private String description; private String title; public UUID getPartnerkey() { return partnerkey; } public void setPartnerkey(UUID partnerkey) { this.partnerkey = partnerkey; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }
// Devon Keen // // CS 113-002 // // Homework 1 //#2.5 import java.util.Scanner; public class Converter{ public static void main (String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter inches as a digit with or without decimals"); double inches = scan.nextDouble(); double feet = inches / 12; System.out.println(feet + " feet"); } } //#2.6 public class Converter2{ public static void main (String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter grams as a digit with or without decimals"); double grams = scan.nextDouble(); double pounds = grams / 456.592; System.out.println(pounds + " pounds"); } } //#2.8 public class Converter3{ public static void main (String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter kilograms as a digit with or without decimals"); double kilograms = scan.nextDouble(); Scanner scan2 = new Scanner(System.in); System.out.println("Enter grams as a digit with or without decimals"); double grams = scan2.nextDouble(); Scanner scan3 = new Scanner(System.in); System.out.println("Enter milligrams as a digit with or without decimals"); double milligrams = scan3.nextDouble(); double total = kilograms *1000000 + grams *1000 + milligrams; System.out.println(total + " total milligrams"); } } //#2.9 public class Converter4{ public static void main (String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter milligrams as a digit without decimals"); int milligrams = scan.nextInt(); int kilograms = milligrams / 1000000; int next = milligrams - kilograms * 1000000; int grams = next / 1000; int milligrams2 = next - grams * 1000; System.out.println(kilograms + " kilograms"); System.out.println(grams + " grams"); System.out.println(milligrams2 + " milligrams"); } }
package cn.e3mall.pojo; import java.util.ArrayList; import java.util.Date; import java.util.List; public class TbFileExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public TbFileExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * * * @author wcyong * * @date 2020-03-27 */ protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andFileNameIsNull() { addCriterion("file_name is null"); return (Criteria) this; } public Criteria andFileNameIsNotNull() { addCriterion("file_name is not null"); return (Criteria) this; } public Criteria andFileNameEqualTo(String value) { addCriterion("file_name =", value, "fileName"); return (Criteria) this; } public Criteria andFileNameNotEqualTo(String value) { addCriterion("file_name <>", value, "fileName"); return (Criteria) this; } public Criteria andFileNameGreaterThan(String value) { addCriterion("file_name >", value, "fileName"); return (Criteria) this; } public Criteria andFileNameGreaterThanOrEqualTo(String value) { addCriterion("file_name >=", value, "fileName"); return (Criteria) this; } public Criteria andFileNameLessThan(String value) { addCriterion("file_name <", value, "fileName"); return (Criteria) this; } public Criteria andFileNameLessThanOrEqualTo(String value) { addCriterion("file_name <=", value, "fileName"); return (Criteria) this; } public Criteria andFileNameLike(String value) { addCriterion("file_name like", value, "fileName"); return (Criteria) this; } public Criteria andFileNameNotLike(String value) { addCriterion("file_name not like", value, "fileName"); return (Criteria) this; } public Criteria andFileNameIn(List<String> values) { addCriterion("file_name in", values, "fileName"); return (Criteria) this; } public Criteria andFileNameNotIn(List<String> values) { addCriterion("file_name not in", values, "fileName"); return (Criteria) this; } public Criteria andFileNameBetween(String value1, String value2) { addCriterion("file_name between", value1, value2, "fileName"); return (Criteria) this; } public Criteria andFileNameNotBetween(String value1, String value2) { addCriterion("file_name not between", value1, value2, "fileName"); return (Criteria) this; } public Criteria andSaveNameIsNull() { addCriterion("save_name is null"); return (Criteria) this; } public Criteria andSaveNameIsNotNull() { addCriterion("save_name is not null"); return (Criteria) this; } public Criteria andSaveNameEqualTo(String value) { addCriterion("save_name =", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameNotEqualTo(String value) { addCriterion("save_name <>", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameGreaterThan(String value) { addCriterion("save_name >", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameGreaterThanOrEqualTo(String value) { addCriterion("save_name >=", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameLessThan(String value) { addCriterion("save_name <", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameLessThanOrEqualTo(String value) { addCriterion("save_name <=", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameLike(String value) { addCriterion("save_name like", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameNotLike(String value) { addCriterion("save_name not like", value, "saveName"); return (Criteria) this; } public Criteria andSaveNameIn(List<String> values) { addCriterion("save_name in", values, "saveName"); return (Criteria) this; } public Criteria andSaveNameNotIn(List<String> values) { addCriterion("save_name not in", values, "saveName"); return (Criteria) this; } public Criteria andSaveNameBetween(String value1, String value2) { addCriterion("save_name between", value1, value2, "saveName"); return (Criteria) this; } public Criteria andSaveNameNotBetween(String value1, String value2) { addCriterion("save_name not between", value1, value2, "saveName"); return (Criteria) this; } public Criteria andSavePathIsNull() { addCriterion("save_path is null"); return (Criteria) this; } public Criteria andSavePathIsNotNull() { addCriterion("save_path is not null"); return (Criteria) this; } public Criteria andSavePathEqualTo(String value) { addCriterion("save_path =", value, "savePath"); return (Criteria) this; } public Criteria andSavePathNotEqualTo(String value) { addCriterion("save_path <>", value, "savePath"); return (Criteria) this; } public Criteria andSavePathGreaterThan(String value) { addCriterion("save_path >", value, "savePath"); return (Criteria) this; } public Criteria andSavePathGreaterThanOrEqualTo(String value) { addCriterion("save_path >=", value, "savePath"); return (Criteria) this; } public Criteria andSavePathLessThan(String value) { addCriterion("save_path <", value, "savePath"); return (Criteria) this; } public Criteria andSavePathLessThanOrEqualTo(String value) { addCriterion("save_path <=", value, "savePath"); return (Criteria) this; } public Criteria andSavePathLike(String value) { addCriterion("save_path like", value, "savePath"); return (Criteria) this; } public Criteria andSavePathNotLike(String value) { addCriterion("save_path not like", value, "savePath"); return (Criteria) this; } public Criteria andSavePathIn(List<String> values) { addCriterion("save_path in", values, "savePath"); return (Criteria) this; } public Criteria andSavePathNotIn(List<String> values) { addCriterion("save_path not in", values, "savePath"); return (Criteria) this; } public Criteria andSavePathBetween(String value1, String value2) { addCriterion("save_path between", value1, value2, "savePath"); return (Criteria) this; } public Criteria andSavePathNotBetween(String value1, String value2) { addCriterion("save_path not between", value1, value2, "savePath"); return (Criteria) this; } public Criteria andFileSizeIsNull() { addCriterion("file_size is null"); return (Criteria) this; } public Criteria andFileSizeIsNotNull() { addCriterion("file_size is not null"); return (Criteria) this; } public Criteria andFileSizeEqualTo(Long value) { addCriterion("file_size =", value, "fileSize"); return (Criteria) this; } public Criteria andFileSizeNotEqualTo(Long value) { addCriterion("file_size <>", value, "fileSize"); return (Criteria) this; } public Criteria andFileSizeGreaterThan(Long value) { addCriterion("file_size >", value, "fileSize"); return (Criteria) this; } public Criteria andFileSizeGreaterThanOrEqualTo(Long value) { addCriterion("file_size >=", value, "fileSize"); return (Criteria) this; } public Criteria andFileSizeLessThan(Long value) { addCriterion("file_size <", value, "fileSize"); return (Criteria) this; } public Criteria andFileSizeLessThanOrEqualTo(Long value) { addCriterion("file_size <=", value, "fileSize"); return (Criteria) this; } public Criteria andFileSizeIn(List<Long> values) { addCriterion("file_size in", values, "fileSize"); return (Criteria) this; } public Criteria andFileSizeNotIn(List<Long> values) { addCriterion("file_size not in", values, "fileSize"); return (Criteria) this; } public Criteria andFileSizeBetween(Long value1, Long value2) { addCriterion("file_size between", value1, value2, "fileSize"); return (Criteria) this; } public Criteria andFileSizeNotBetween(Long value1, Long value2) { addCriterion("file_size not between", value1, value2, "fileSize"); return (Criteria) this; } public Criteria andFileTypeIsNull() { addCriterion("file_type is null"); return (Criteria) this; } public Criteria andFileTypeIsNotNull() { addCriterion("file_type is not null"); return (Criteria) this; } public Criteria andFileTypeEqualTo(String value) { addCriterion("file_type =", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeNotEqualTo(String value) { addCriterion("file_type <>", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeGreaterThan(String value) { addCriterion("file_type >", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeGreaterThanOrEqualTo(String value) { addCriterion("file_type >=", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeLessThan(String value) { addCriterion("file_type <", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeLessThanOrEqualTo(String value) { addCriterion("file_type <=", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeLike(String value) { addCriterion("file_type like", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeNotLike(String value) { addCriterion("file_type not like", value, "fileType"); return (Criteria) this; } public Criteria andFileTypeIn(List<String> values) { addCriterion("file_type in", values, "fileType"); return (Criteria) this; } public Criteria andFileTypeNotIn(List<String> values) { addCriterion("file_type not in", values, "fileType"); return (Criteria) this; } public Criteria andFileTypeBetween(String value1, String value2) { addCriterion("file_type between", value1, value2, "fileType"); return (Criteria) this; } public Criteria andFileTypeNotBetween(String value1, String value2) { addCriterion("file_type not between", value1, value2, "fileType"); return (Criteria) this; } public Criteria andUploadTimeIsNull() { addCriterion("upload_time is null"); return (Criteria) this; } public Criteria andUploadTimeIsNotNull() { addCriterion("upload_time is not null"); return (Criteria) this; } public Criteria andUploadTimeEqualTo(Date value) { addCriterion("upload_time =", value, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeNotEqualTo(Date value) { addCriterion("upload_time <>", value, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeGreaterThan(Date value) { addCriterion("upload_time >", value, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeGreaterThanOrEqualTo(Date value) { addCriterion("upload_time >=", value, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeLessThan(Date value) { addCriterion("upload_time <", value, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeLessThanOrEqualTo(Date value) { addCriterion("upload_time <=", value, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeIn(List<Date> values) { addCriterion("upload_time in", values, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeNotIn(List<Date> values) { addCriterion("upload_time not in", values, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeBetween(Date value1, Date value2) { addCriterion("upload_time between", value1, value2, "uploadTime"); return (Criteria) this; } public Criteria andUploadTimeNotBetween(Date value1, Date value2) { addCriterion("upload_time not between", value1, value2, "uploadTime"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * * * @author wcyong * * @date 2020-03-27 */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
package exemplo01; //Class: Molde public class Pessoas { //Atributos: Caracterirsticas String nome; double altura, peso; //Métodsos: Ações void mensagem() { System.out.println("Olá meu nome é "+nome); } double imc() { return peso/ (altura*altura); } }
package com.google.android.gms.analytics; import com.google.android.gms.analytics.internal.ah; import com.google.android.gms.analytics.internal.f; import com.google.android.gms.analytics.internal.q; class AnalyticsService$1 implements ah { final /* synthetic */ q aEA; final /* synthetic */ f aEB; final /* synthetic */ AnalyticsService aEC; final /* synthetic */ int aEz; AnalyticsService$1(AnalyticsService analyticsService, int i, q qVar, f fVar) { this.aEC = analyticsService; this.aEz = i; this.aEA = qVar; this.aEB = fVar; } public final void mB() { AnalyticsService.a(this.aEC).post(new 1(this)); } }
package com.example.mynovel; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import java.util.List; public class society_message extends AppCompatActivity { private ListView society_messages; private ArrayList<userMessage> allUserMessages; private myAdapter myadapter; private static final int COMPLETED=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_society_message); society_messages = (ListView)findViewById(R.id.societyMessage_listview); allUserMessages = new ArrayList<userMessage>(); getAllUserMessages(); } private Handler displayHandler = new Handler(){ @Override public void handleMessage(Message msg) { if (msg.what==COMPLETED){ myadapter = new myAdapter(society_message.this); society_messages.setAdapter(myadapter); society_messages.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //跳转到回复页面并传送当前的username过去 Intent reply_intent = new Intent(society_message.this,reply_activity.class); reply_intent.putExtra("relpy_username",allUserMessages.get(position).getUsername()); reply_intent.putExtra("reply_content",allUserMessages.get(position).getMessage()); startActivity(reply_intent); } }); } } }; public void getAllUserMessages(){ new Thread(new Runnable() { @Override public void run() { allUserMessages = messageImple.getMessageImple().getUserMessagedata(); Message msg = new Message(); msg.what=COMPLETED; displayHandler.sendMessage(msg); } }).start(); } public class myAdapter extends BaseAdapter { private LayoutInflater mInflater; public myAdapter(Context context){ this.mInflater = LayoutInflater.from(context); } @Override public Object getItem(int position) { return null; } @Override public int getCount() { if(allUserMessages.size()==0){ return 0; }else { return allUserMessages.size(); } } @Override public long getItemId(int position) { return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { viewholder holder; if (convertView == null) { holder=new viewholder(); convertView = mInflater.inflate(R.layout.message_listview,null); holder.username = (TextView)convertView.findViewById(R.id.message_username); holder.content = (TextView)convertView.findViewById(R.id.message_usercontent); convertView.setTag(holder); }else { holder = (society_message.viewholder)convertView.getTag(); } if (allUserMessages.get(position).getTouser().equals("")) { holder.username.setText(allUserMessages.get(position).getUsername()); }else { holder.username.setText(allUserMessages.get(position).getUsername()+" 回复" +allUserMessages.get(position).getTouser()); } holder.content.setText(allUserMessages.get(position).getMessage()); return convertView; } } public final class viewholder{ private TextView username; private TextView content; } }
package com.hxzy.service.impl; import com.hxzy.entity.Follow; import com.hxzy.mapper.FollowMapper; import com.hxzy.service.FollowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @Transactional @Service public class FollowServiceImpl implements FollowService{ @Autowired private FollowMapper followMapper; @Override public boolean deleteByPrimaryKey(Integer id) { return this.followMapper.deleteByPrimaryKey(id)>0; } @Override public boolean insert(Follow record) { return this.followMapper.insert(record)>0; } @Transactional(propagation = Propagation.SUPPORTS) @Override public int searchFollowMeFans(int studentId) { return this.followMapper.searchFollowMeFans(studentId); } }
package tech.adrianohrl.stile.control.bean.personnel; import tech.adrianohrl.stile.control.bean.DataSource; import tech.adrianohrl.stile.control.bean.personnel.services.ManagerService; import tech.adrianohrl.stile.control.dao.personnel.ManagerDAO; import tech.adrianohrl.stile.model.personnel.Manager; import tech.adrianohrl.stile.model.personnel.Supervisor; import java.io.Serializable; import java.util.Arrays; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; import javax.persistence.EntityExistsException; import javax.persistence.EntityManager; /** * * @author Adriano Henrique Rossette Leite (contact@adrianohrl.tech) */ @ManagedBean @ViewScoped public class ManagerRegisterBean implements Serializable { @ManagedProperty(value = "#{managerService}") private ManagerService service; private final Manager manager = new Manager(); private Supervisor[] selectedSupervisors; public String register() { String next = ""; FacesContext context = FacesContext.getCurrentInstance(); FacesMessage message; EntityManager em = DataSource.createEntityManager(); try { manager.setSupervisor(Arrays.asList(selectedSupervisors)); ManagerDAO managerDAO = new ManagerDAO(em); managerDAO.create(manager); message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Sucesso no cadastro", manager + " foi cadastrado com sucesso!!!"); next = "/index"; update(); } catch (EntityExistsException e) { message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Erro no cadastro", manager + " já foi cadastrado!!!"); } em.close(); context.addMessage(null, message); return next; } public void update() { service.update(); } public void setService(ManagerService service) { this.service = service; } public Manager getManager() { return manager; } public Supervisor[] getSelectedSupervisors() { return selectedSupervisors; } public void setSelectedSupervisors(Supervisor[] selectedSupervisors) { this.selectedSupervisors = selectedSupervisors; } }
import javax.swing.*; public class MyFrame extends JFrame { public static final String TITLE = "Java图形绘制"; public static final int WIDTH = 250; public static final int HEIGHT = 300; public MyFrame() { super(); initFrame(); } private void initFrame() { // 设置 窗口标题 和 窗口大小 setTitle(TITLE); setSize(WIDTH, HEIGHT); // 设置窗口关闭按钮的默认操作(点击关闭时退出进程) setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // 把窗口位置设置到屏幕的中心 setLocationRelativeTo(null); // 设置窗口的内容面板 MyPanel panel = new MyPanel(this); setContentPane(panel); } }
package com.zzidc.service.Impl; import com.zzidc.bean.RoleBean; import com.zzidc.bean.UserBean; import com.zzidc.dao.RoleMapper; import com.zzidc.dao.UserMapper; import com.zzidc.service.UserServcie; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @ClassName UserServiceImpl * @Author chenxue * @Description TODO * @Date 2019/4/2 11:28 **/ @Service public class UserServiceImpl implements UserServcie { @Autowired UserMapper mapper; @Autowired RoleMapper userRoleMapper; @Override public UserBean getUserInfo(UserBean userBean) { return mapper.getUserInfo(userBean); } @Override public List<RoleBean> getRoleInfo(Integer id) { return userRoleMapper.getRoleInfo(id); } }
package sec.project.repository; import org.springframework.data.jpa.repository.JpaRepository; import sec.project.domain.Siteuser; /** * * @author iisti */ public interface SiteuserRepository extends JpaRepository<Siteuser, Long> { Siteuser findByUsername(String username); }
package com.yy.common.hostinfo.bean; import com.yy.common.hostinfo.enums.IspType; import java.util.Objects; /** * 服务器IP信息,包含ip地址和ISP信息 * * @author weiyukai 20190312 */ public class IpInfo implements Comparable<IpInfo> { private String ip; private IspType isp; public IspType getIsp() { return isp; } public void setIsp(IspType isp) { this.isp = isp; } public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } @Override public String toString() { return "ip:" + ip + ",isp:" + isp.getIspName() + ",level:" + isp.getLevel() + ",ispid:" + isp.getIspid(); } @Override public int compareTo(IpInfo o) { if (this.isp.getLevel() > o.getIsp().getLevel()) { return 1; } else if (this.isp.getLevel() == o.getIsp().getLevel()) { return 0; } return -1; } }
package edu.kit.pse.osip.core.opcua; import edu.kit.pse.osip.core.opcua.client.BooleanReceivedListener; import edu.kit.pse.osip.core.opcua.client.FloatReceivedListener; import edu.kit.pse.osip.core.opcua.client.IntReceivedListener; import edu.kit.pse.osip.core.opcua.client.UAClientException; import edu.kit.pse.osip.core.opcua.client.UAClientWrapper; /** * For test purposes, makes protected methods public. * * @author Hans-Peter Lehmann * @version 1.0 */ public class TestUaClientWrapper extends UAClientWrapper { /** * Allows public access to the connection timeout. */ protected static final int CONNECTION_TIMEOUT_TEST = UAClientWrapper.CONNECTION_TIMEOUT; /** * Allows public access to UAClientWrapper. * * @param url Same as for UAClientWrapper. * @param namespace Same as for UAClientWrapper. */ public TestUaClientWrapper(String url, String namespace) { super(url, namespace); } /** * Allows public access to subscribeInt. * * @param nodeName Same as for subscribeInt. * @param interval Same as for subscribeInt. * @param listener Same as for subscribeInt. * @throws UAClientException Same as for subscribeInt. */ protected final void subscribeIntTest(String nodeName, int interval, IntReceivedListener listener) throws UAClientException { super.subscribeInt(nodeName, interval, listener); } /** * Allows public access to subscribeBoolean. * * @param nodeName Same as for subscribeBoolean. * @param interval Same as for subscribeBoolean. * @param listener Same as for subscribeBoolean. * @throws UAClientException Same as for subscribeBoolean. */ protected final void subscribeBooleanTest(String nodeName, int interval, BooleanReceivedListener listener) throws UAClientException { super.subscribeBoolean(nodeName, interval, listener); } /** * Allows public access to subscribeFloat. * * @param nodeName Same as for subscribeFloat. * @param interval Same as for subscribeFloat. * @param listener Same as for subscribeFloat. * @throws UAClientException Same as for subscribeFloat. */ protected final void subscribeFloatTest(String nodeName, int interval, FloatReceivedListener listener) throws UAClientException { super.subscribeFloat(nodeName, interval, listener); } }
//animacion por teclado package application; import javafx.application.Application; import javafx.event.EventHandler; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.shape.Circle; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) { Circle circle=new Circle(150,150,3); Group root = new Group(); Scene scene = new Scene(root, 600, 650); scene.setOnKeyPressed(new EventHandler<KeyEvent>() { int x=0,y=0; public void handle(KeyEvent ke) { if (ke.getCode() == KeyCode.RIGHT) { /// Circle circle=new Circle(150+x,150+y,3); System.out.println("derecha"); root.getChildren().add( circle); primaryStage.show(); x=x+5; } if (ke.getCode() == KeyCode.UP) { /// Circle circle=new Circle(150+x,150+y,3); System.out.println("derecha"); root.getChildren().add( circle); primaryStage.show(); y=y-5; } if (ke.getCode() == KeyCode.LEFT) { Circle circle=new Circle(150+x,150+y,3); System.out.println("derecha"); root.getChildren().add( circle); primaryStage.show(); x=x-5; } if (ke.getCode() == KeyCode.DOWN) { /// Circle circle=new Circle(150+x,150+y,3); System.out.println("derecha"); root.getChildren().add( circle); primaryStage.show(); y=y+5; } root.getChildren().add( circle); primaryStage.show(); } }); scene.setOnKeyReleased(new EventHandler<KeyEvent>() { public void handle(KeyEvent ke) { System.out.println("Key Released: " + ke.getText()); } }); root.getChildren().add(circle); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
package com.cpe.mysql.webblog.services; import com.cpe.mysql.webblog.entity.Comment; import com.cpe.mysql.webblog.entity.User; import com.cpe.mysql.webblog.model.CommentModel; import com.cpe.mysql.webblog.repository.CommentRepository; import com.cpe.mysql.webblog.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import java.util.Optional; @Service public class CommentService { @Autowired private CommentRepository commentRepository; @Autowired private UserRepository userRepository; // add comment to post public ResponseEntity<Object> addCommentToPost(CommentModel model) { Comment cm = new Comment(); cm.setMsg(model.getMsg()); cm.setCommentDate(model.getCommentDate()); cm.setUser(model.getUser()); cm.setPost(model.getPost()); cm.setUserName(model.getUserName()); Comment saveCM = commentRepository.save(cm); return ResponseEntity.ok("Comment is added."); } // delete a comment public ResponseEntity<Object> deleteComment(Long id) { if(commentRepository.findById(id).isPresent()) { commentRepository.deleteById(id); if(commentRepository.findById(id).isPresent()) { return ResponseEntity.unprocessableEntity().body("Failed to delete(comment) the specified record."); } else { return ResponseEntity.ok().body("Successfully deleted(comment) specified record."); } } else { return ResponseEntity.unprocessableEntity().body("No Records Found."); } } }
package controllers; import java.util.Date; import java.util.List; import models.Calendar; import models.Database; import models.Event; import models.User; import play.mvc.Controller; import play.mvc.With; @With(Secure.class) public class Application extends Controller { @Check("isAdmin") public static void delete(Long id) { } public static void index() { User user = Database.getUser(Security.connected()); List users = Database.getAllUsers(); // Remove the current connected user users.remove(user); List calendars = user.getCalendarList(); render(calendars, user, users); } public static void showCalendars(String email) { User user = Database.getUser(email); List calendars = user.getCalendarList(); render(user, calendars); } public static void showEvents(String email, String calendarname) { User user = Database.getUser(email); User connectedUser = Database.getUser(Security.connected()); Calendar calendar = user.getCalendarByName(calendarname); List events = connectedUser.getEventsAllowedToSee(calendar, new Date()); render(user, calendar, events, connectedUser); } public static void addEvent(String eventName, String calendarname, String email, String startsAt, String endsAt, String isPublic) { User user = Database.getUser(email); Calendar calendar = user.getCalendarByName(calendarname); // Wenn es nicht der gleiche User ist, kann er keine Events adden. if (email.equals(Security.connected())) { boolean fuerAlleSichtbar = true; if (isPublic == null) fuerAlleSichtbar = false; calendar.addEvent(new Event(eventName, startsAt, endsAt, fuerAlleSichtbar)); } showEvents(user.getUserMail(), calendar.name); } }
package com.ricex.cartracker.common.util; import java.lang.reflect.Type; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.ricex.cartracker.common.entity.TripStatus; public class JsonTripStatusSerializer implements JsonSerializer<TripStatus>, JsonDeserializer<TripStatus> { @Override public TripStatus deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return TripStatus.fromId(json.getAsInt()); } @Override public JsonElement serialize(TripStatus src, Type typeOfSrc, JsonSerializationContext context) { return new JsonPrimitive(src.getId()); } }
package com.techakram.signuplogin; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class HomeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Button btn=findViewById(R.id.logout); btn.setOnClickListener(new View.OnClickListener( ) { @Override public void onClick(View view) { SharedPrefManager sf=new SharedPrefManager(HomeActivity.this); sf.logout(); startActivity(new Intent(HomeActivity.this,LoginActivity.class)); Toast.makeText(HomeActivity.this, "Logout", Toast.LENGTH_SHORT).show( ); } }); } }
package evolution.MLP; import evolution.interfaces.Evolvable; import evolution.interfaces.Input; import evolution.interfaces.Output; import search.core.Duple; public class PerceptronES implements Evolvable { private double[][] weights, deltas; //single layer private double[] outputs, errors; private int trainingRounds = 500, numInputs, numOutputs; private double learningRate = 0.02; public PerceptronES(int numInputs, int numOutputs){ weights = new double[numInputs][numOutputs]; this.numInputs = numInputs; this.numOutputs = numOutputs; for (int i = 0; i < numInputs + 1; ++i){ for (int j = 0; j < numOutputs; ++j){ weights[i][j] = Math.random(); deltas[i][j] = 0.0; } } for (int i = 0; i < numOutputs; ++i){ outputs[i] = 0.0; errors[i] = 0.0; weights[numInputs][i] = 0.0; } } public PerceptronES(PerceptronES other){ numInputs = other.numInputs; numOutputs = other.numOutputs; for (int i = 0; i < numInputs + 1; ++i){ for (int j = 0; j < numOutputs; ++j){ weights[i][j] = Math.random(); deltas[i][j] = 0.0; } } for (int j = 0; j < numInputs; ++j) { for (int i = 0; i < numOutputs; ++i) { weights[j][i] = other.weights[j][i]; deltas[j][i] = 0.0; } } for (int i = 0; i < numOutputs; ++i) { outputs[i] = 0.0; errors[i] = 0.0; weights[numInputs][i] = 0.0; } } private void initMemebrs(){ weights = new double[numInputs][numOutputs]; deltas = new double[numInputs][numOutputs]; outputs = new double[numOutputs]; errors = new double[numOutputs]; } private MLPOut compute(double[] input){ //todo: Check Compute for (int out = 0; out < outputs.length; ++out){ for (int in = 0; in < input.length; ++in){ double weight = weights[in][out]; outputs[out] = weight * input[in]; } double sum = outputs[out]; sum -= weights[this.numInputs][out]; outputs[out] = sigmoid(sum); } int[] data = new int[outputs.length]; for (int i = 0; i < outputs.length; ++i){ data[i] = (int) outputs[i]; } return new MLPOut(data); } public void addToWeightDeltas(double[] inputs, double rate) { compute(inputs); for (int out = 0; out < outputs.length; ++out){ double output = outputs[out]; double error = errors[out]; double gradient = gradient(output); for (int in = 0; in < inputs.length; ++in){ double input = inputs[in]; deltas[in][out] += input * error * rate * gradient; } deltas[this.numInputs][out] -= error * rate * gradient; } } public static double sigmoid(double x) { return 1.0 / (1.0 + Math.exp(-x)); } @Override public Output classify(Input in) { double[] values = (double[])in.get(); return compute(values); } @Override public Evolvable crossover() { return this; } @Override public Evolvable mutate() { return this; } @Override public void train(Duple<Input, Output>[] data) { //todo: add support for progress reporting for (int i = 0; i < trainingRounds; ++i){ for (int j = 0; j < data.length; ++j){ //forced cast is OK becase of internal classify method MLPOut output = (MLPOut) classify(data[j].getFirst()); MLPIn input = (MLPIn) data[j].getFirst(); errors = output.distances(data[j].getSecond(), 8); addToWeightDeltas(input.get(), learningRate); } } } public void updateWeights() { for (int j = 0; j < numInputs; ++j) { for (int i = 0; i < numOutputs; ++i) { weights[j][i] += deltas[j][i]; deltas[j][i] = 0.0; } } } public static double gradient(double fOfX) { return fOfX * (1.0 - fOfX); } }
import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JButton; import javax.swing.JLabel; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Color; import java.awt.Point; import java.awt.Frame; /** * This is the main frame which is connected with all of the frames included in the application. */ public class StartFrame extends JFrame { private JPanel contentPane; static DBCarConnector dbcc; public static void main(String[] args) { dbcc = new DBCarConnector( "dbinstance.c1neuj5ak0x9.us-west-2.rds.amazonaws.com", "3306", "dbcar", "cardbadmin", "GUGroup12"); EventQueue.invokeLater(new Runnable() { public void run() { try { StartFrame frame = new StartFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public StartFrame() { setBackground(Color.GRAY); setResizable(false); setTitle("My New Wheels"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 1265, 683); contentPane = new JPanel(); contentPane.setForeground(Color.WHITE); contentPane.setBackground(Color.WHITE); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JButton btnAdmin = new JButton("Admin"); //Admin button btnAdmin.setBackground(Color.WHITE); btnAdmin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); AdminLoginFrame adm = new AdminLoginFrame(); adm.setVisible(true); } }); btnAdmin.setBounds(1107, 590, 117, 33); contentPane.add(btnAdmin); JButton btnSearch = new JButton("Search"); //Search button btnSearch.setBackground(Color.WHITE); btnSearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ea) { dispose(); new UserFrame("Search", dbcc); } }); btnSearch.setBounds(980, 590, 117, 33); contentPane.add(btnSearch); JButton helpbtn = new JButton("Help"); //Help button helpbtn.setBackground(Color.WHITE); helpbtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); HelpFrame hfrm = new HelpFrame(); hfrm.setVisible(true); } }); helpbtn.setBounds(59, 595, 89, 23); contentPane.add(helpbtn); JLabel lbl = new JLabel(""); lbl.setBounds(0, 0, 1264, 662); lbl.setIcon(new ImageIcon("img/Welcome.png")); contentPane.add(lbl); setLocationRelativeTo(null); } }
package com.fb.graph; import java.util.ArrayList; import java.util.List; import com.yahoo.algos.MyQueue; /** * Count all possible walks from a source to a destination with exactly k edges * Given a directed graph and two vertices �u� and �v� in it, count all possible walks from �u� to �v� with exactly k edges on the walk. */ public class SourceToDestInKPaths<T> { DirectedGraph<T> graph; MyQueue<QueueNode<T>> queue = null; List<T> visited = new ArrayList<T>(); public SourceToDestInKPaths(DirectedGraph<T> dg) { this.graph = dg; queue = new MyQueue<QueueNode<T>>(dg.size()); } private int path( T source, T dest, int k) { queue.enqueue(new QueueNode<T>(source, 0)); return bfs(dest, k); } private int bfs( T destNode, int k){ int count = 0; while(!queue.isEmpty()){ QueueNode<T> qnode = queue.dequeue(); int dist = qnode.dist; T node = qnode.node; //if dest is reached? if(node.equals(destNode) && (dist == k )){ count ++; } for(T leaf : graph.getAdjacentNodes(node)){ if(!visited.contains(leaf)){ if(!leaf.equals(destNode)) visited.add(leaf); queue.enqueue(new QueueNode<T>(leaf, dist+1)); } } } return count; } public static void main(String[] args) { DirectedGraph<GraphNode> dg = new DirectedGraph<GraphNode>(); GraphNode zero = new GraphNode("0");GraphNode one = new GraphNode("1");GraphNode two = new GraphNode("2");GraphNode three = new GraphNode("3"); dg.addNode(zero);dg.addNode(one);dg.addNode(two);dg.addNode(three) ; dg.addEdge(zero,one);dg.addEdge( one,three); dg.addEdge(zero,three);dg.addEdge(zero,two); dg.addEdge(two,three); // GraphNode four = new GraphNode("4"); // dg.addNode(four); // dg.addEdge(two,four);dg.addEdge( four,three); /* * 0-----1----- * |\ | * | \ | * 3--2 | * | | * |-----------| */ SourceToDestInKPaths<GraphNode> sourceToDestInKPaths = new SourceToDestInKPaths<GraphNode>(dg); System.out.println(sourceToDestInKPaths.path(zero, three, 2)); } private class QueueNode<K>{ int dist; K node; public QueueNode(K node, int dist){ this.node = node; this.dist = dist; } } }
package arduinosketch; import arduinosketch.ArduinoNetGag; /** * Created by troy on 07.10.2016. */ public class ArduinoNetGagMain { public static void main(String[] args) throws InterruptedException { new ArduinoNetGag(); } }
import java.time.LocalDate; public class Schueler extends Person { private int katalognummer; private boolean eigenberechtigt; private LocalDate eintrittsdatum; public Schueler(long svnr, String vorname, String nachname, LocalDate geburtsdatumm, String email, int katalognummer, LocalDate eintritsdatum){ super(svnr,vorname,nachname,geburtsdatumm,email); this.katalognummer = katalognummer; this.eintrittsdatum = eintrittsdatum; } public int getKatalognummer() { return katalognummer; } public boolean isEigenberechtigt() { return eigenberechtigt; } public LocalDate getEintrittsdatum() { return eintrittsdatum; } }
package br.edu.ifam.saf.modelo; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "cidade") public class Cidade extends EntidadeBase { @Column(nullable = false) private String nome; @Column(nullable = false) private String estado; public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; Cidade cidade = (Cidade) o; if (nome != null ? !nome.equals(cidade.nome) : cidade.nome != null) return false; return estado != null ? estado.equals(cidade.estado) : cidade.estado == null; } @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (nome != null ? nome.hashCode() : 0); result = 31 * result + (estado != null ? estado.hashCode() : 0); return result; } @Override public String toString() { return "Cidade{" + "nome='" + nome + '\'' + ", estado='" + estado + '\'' + '}'; } }
package Concurrency.Exception;/** * Created by pc on 2018/2/23. */ /** * describe: * * @author xxx * @date4 {YEAR}/02/23 */ public class ExceptionThread implements Runnable { public void run() { Thread t = Thread.currentThread(); System.out.print("run() by"+t); System.out.print("en = "+t.getUncaughtExceptionHandler()); throw new RuntimeException(); } }
package com.ood.rsp.dao; import java.util.List; import com.ood.rsp.util.DBUtil; public class LoadMailingList { public List loadMailingList(String sendMailQuery) throws Exception { return DBUtil.query(sendMailQuery); } }