blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7f2e6002be3344465b31451a5567c09202e0df5a | 3bee6e4f4a48132b9e3b56872feae12f09db72fa | /TextTrade/app/src/main/java/com/squad/afro/texttrade/SellingFragment.java | d7c98a9d6cede2d1852c5ab7b9ce4673df8b271f | [] | no_license | BrukeM/LUApps17 | 71893fd6ba527ff5c33a49c43e8289fd84b1e8a8 | f5b8d8d9324d354cbfaf847fba3f7fd5d4877834 | refs/heads/master | 2021-08-24T05:18:55.927435 | 2017-12-06T22:01:04 | 2017-12-06T22:01:04 | 110,014,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package com.squad.afro.texttrade;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import java.util.ArrayList;
/**
* Created by romeo on 11/24/2017.
*/
public class SellingFragment extends Fragment {
private static final String TAG = "SellingFragment";
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.selling_fragment, container, false);
ListView listView = view.findViewById(R.id.listview);
ArrayList<Book> mBooks = new ArrayList<Book>();
return view;
}
}
| [
"bbb219@lehigh.edu"
] | bbb219@lehigh.edu |
ab91c03b59ea022112d15c5663152bcde3771f9a | 66bb9a0dc88cef7f395f39d670576139022a2516 | /src/com/nfit/yaoliusan/myblog/web/CommentDelServlet.java | 0776b4cd9f165bc1cf92080745c7c50c887e955d | [] | no_license | yaoliuyao/14-posts-ajax | 8fbc54954f917bf854bdf6db9b352381ea8ce892 | 34cf025ba154ff8760469920143cb4e607f97b8d | refs/heads/master | 2022-12-26T19:10:02.168816 | 2020-10-09T03:18:51 | 2020-10-10T00:26:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | package com.nfit.yaoliusan.myblog.web;
import com.nfit.yaoliusan.myblog.dao.CommentDAO;
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 java.io.IOException;
@WebServlet("/comment/del")
public class CommentDelServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String id = req.getParameter("id");
try {
new CommentDAO().delete(id);
resp.getWriter().print(id);
} catch (Exception exception) {
exception.printStackTrace();
resp.getWriter().print("-1");
}
}
}
| [
"yaoliusan@gmail.com"
] | yaoliusan@gmail.com |
a15e41c0720694b94be16e6817a4fec69f4d17ee | 07b10e4e8e0b1d95c43daece16faebd128b9a9a9 | /src/main/java/PagesElements/BlockReturnElements.java | c607d1261ece6fd233bbdf600d81c9808a3e9068 | [] | no_license | eugene-kurilenko-porsche/autotest-porshe | 30cdf06143ca55026a9b6264aae764a732c7daee | 7bc99c39fde94f940e85399c0d32365af0dafbeb | refs/heads/master | 2023-08-30T07:40:20.567202 | 2021-10-04T08:07:04 | 2021-10-04T08:07:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,497 | java | package PagesElements;
import com.codeborne.selenide.SelenideElement;
import static com.codeborne.selenide.Selenide.$x;
public class BlockReturnElements {
public SelenideElement pickupListItem = $x("//*[contains(@class, 'pickup-list-item pickup-status2')]");
public SelenideElement carKeyButton = $x("//*[contains(@class, 'return-btn-small return-btn-key')]");
public SelenideElement scanObjectButtonOnReturnBlock = $x("//*[contains(@class, 'btn-block return-btn')]");
public SelenideElement finalReturnButton = $x("//*[contains(@id, 'nextbutton')]");
public SelenideElement popupWithInfoParking = $x("//*[contains(text(), 'Ist der angezeigte Stellplatz korrekt?')]");
public SelenideElement confirmLocationButtonInPopup = $x("//*[@id=\"exampleModal3\"]/div/div/div[2]/button[2]");
public SelenideElement pickupDetailsBox = $x("//*[contains(@class, 'pickup-detail-box')]");
public SelenideElement returnDetailsBox = $x("//*[contains(@id, 'returndetails')]");
public SelenideElement saveButton = $x("//*[contains(@class, 'footer-block-right')]");
public SelenideElement disabledSaveButton = $x("//*[contains(@class, 'btn btn-primary btn-lg mb-4 disabled')]");
public SelenideElement enabledSaveButton = $x("//*[contains(@class, 'btn btn-primary btn-lg mb-4')]");
public SelenideElement fullstandButtonWithValue50 = $x("//*[contains(@id, '50')]");
public SelenideElement uniqueDepotAfterClickOnSaveButton = $x("//*[@id=\"depotMessage\"]/b");
}
| [
"dennismikheye@gmail.com"
] | dennismikheye@gmail.com |
4d26a5a75d2bc346970e03557c46cba5a5f45b8e | 75f4432cff52c29767a2fe10de5462e7eb458598 | /sepa-pain-lib/src/main/java/iso/std/iso/_20022/tech/xsd/pain_008_003_02/RestrictedPersonIdentificationSEPA.java | 1c22fabf92f2dfcbf8a6efbbdb356ac2be379aaa | [
"Apache-2.0"
] | permissive | germamix/sepa-pain-lib | 893d0a238cf6d2e843f95b80716f72382ed310fe | 1c5ea9edc0bbda8b00287611dd3e78e834357852 | refs/heads/master | 2016-09-06T15:03:25.832970 | 2015-03-22T09:04:01 | 2015-03-22T09:04:01 | 32,666,740 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,839 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.12.03 at 08:07:19 AM CET
//
package iso.std.iso._20022.tech.xsd.pain_008_003_02;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for RestrictedPersonIdentificationSEPA complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="RestrictedPersonIdentificationSEPA">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Id" type="{urn:iso:std:iso:20022:tech:xsd:pain.008.003.02}RestrictedPersonIdentifierSEPA"/>
* <element name="SchmeNm" type="{urn:iso:std:iso:20022:tech:xsd:pain.008.003.02}RestrictedPersonIdentificationSchemeNameSEPA"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RestrictedPersonIdentificationSEPA", propOrder = {
"id",
"schmeNm"
})
public class RestrictedPersonIdentificationSEPA {
@XmlElement(name = "Id", required = true)
protected String id;
@XmlElement(name = "SchmeNm", required = true)
protected RestrictedPersonIdentificationSchemeNameSEPA schmeNm;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the schmeNm property.
*
* @return
* possible object is
* {@link RestrictedPersonIdentificationSchemeNameSEPA }
*
*/
public RestrictedPersonIdentificationSchemeNameSEPA getSchmeNm() {
return schmeNm;
}
/**
* Sets the value of the schmeNm property.
*
* @param value
* allowed object is
* {@link RestrictedPersonIdentificationSchemeNameSEPA }
*
*/
public void setSchmeNm(RestrictedPersonIdentificationSchemeNameSEPA value) {
this.schmeNm = value;
}
}
| [
"mamix.ger@googlemail.com"
] | mamix.ger@googlemail.com |
b74a084932d06e9786a34b75ff4b64f7551e643a | 04e2ab2298235c8b5ce7b6cdb8a2c6f872bc2d63 | /baseutils/src/main/java/com/personal/baseutils/widget/wheelview/WheelScroller.java | 1d17fcb6c137af98492118e48c811c534527dcfc | [] | no_license | mengmengxuan/YiShanGou | e2ff4e6da95144bc0db6d78cbd9abb4a00485737 | dc4857756933bdcc62623294b5fb6a2149172215 | refs/heads/main | 2023-03-14T08:15:13.088499 | 2021-03-02T12:26:16 | 2021-03-02T12:26:16 | 343,764,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,313 | java | /*
* Android Wheel Control.
* https://code.google.com/p/android-wheel/
*
* Copyright 2011 Yuri Kanivets
*
* 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.personal.baseutils.widget.wheelview;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.animation.Interpolator;
import android.widget.Scroller;
/**
* Scroller class handles scrolling events and updates the
*/
public class WheelScroller {
/**
* Scrolling listener interface
*/
public interface ScrollingListener {
/**
* Scrolling callback called when scrolling is performed.
* @param distance the distance to scroll
*/
void onScroll(int distance);
/**
* Starting callback called when scrolling is started
*/
void onStarted();
/**
* Finishing callback called after justifying
*/
void onFinished();
/**
* Justifying callback called to justify a view when scrolling is ended
*/
void onJustify();
}
/** Scrolling duration */
private static final int SCROLLING_DURATION = 400;
/** Minimum delta for scrolling */
public static final int MIN_DELTA_FOR_SCROLLING = 1;
// Listener
private ScrollingListener listener;
// Context
private Context context;
// Scrolling
private GestureDetector gestureDetector;
private Scroller scroller;
private int lastScrollY;
private float lastTouchedY;
private boolean isScrollingPerformed;
/**
* Constructor
* @param context the current context
* @param listener the scrolling listener
*/
public WheelScroller(Context context, ScrollingListener listener) {
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context);
this.listener = listener;
this.context = context;
}
/**
* Set the the specified scrolling interpolator
* @param interpolator the interpolator
*/
public void setInterpolator(Interpolator interpolator) {
scroller.forceFinished(true);
scroller = new Scroller(context, interpolator);
}
/**
* Scroll the wheel
* @param distance the scrolling distance
* @param time the scrolling duration
*/
public void scroll(int distance, int time) {
scroller.forceFinished(true);
lastScrollY = 0;
scroller.startScroll(0, 0, 0, distance, time != 0 ? time : SCROLLING_DURATION);
setNextMessage(MESSAGE_SCROLL);
startScrolling();
}
/**
* Stops scrolling
*/
public void stopScrolling() {
scroller.forceFinished(true);
}
/**
* Handles Touch event
* @param event the motion event
* @return
*/
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
lastTouchedY = event.getY();
scroller.forceFinished(true);
clearMessages();
break;
case MotionEvent.ACTION_MOVE:
// perform scrolling
int distanceY = (int)(event.getY() - lastTouchedY);
if (distanceY != 0) {
startScrolling();
listener.onScroll(distanceY);
lastTouchedY = event.getY();
}
break;
}
if (!gestureDetector.onTouchEvent(event) && event.getAction() == MotionEvent.ACTION_UP) {
justify();
}
return true;
}
// gesture listener
private SimpleOnGestureListener gestureListener = new SimpleOnGestureListener() {
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
// Do scrolling in onTouchEvent() since onScroll() are not call immediately
// when user touch and move the wheel
return true;
}
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
lastScrollY = 0;
final int maxY = 0x7FFFFFFF;
final int minY = -maxY;
scroller.fling(0, lastScrollY, 0, (int) -velocityY, 0, 0, minY, maxY);
setNextMessage(MESSAGE_SCROLL);
return true;
}
};
// Messages
private final int MESSAGE_SCROLL = 0;
private final int MESSAGE_JUSTIFY = 1;
/**
* Set next message to queue. Clears queue before.
*
* @param message the message to set
*/
private void setNextMessage(int message) {
clearMessages();
animationHandler.sendEmptyMessage(message);
}
/**
* Clears messages from queue
*/
private void clearMessages() {
animationHandler.removeMessages(MESSAGE_SCROLL);
animationHandler.removeMessages(MESSAGE_JUSTIFY);
}
// animation handler
private Handler animationHandler = new Handler() {
public void handleMessage(Message msg) {
scroller.computeScrollOffset();
int currY = scroller.getCurrY();
int delta = lastScrollY - currY;
lastScrollY = currY;
if (delta != 0) {
listener.onScroll(delta);
}
// scrolling is not finished when it comes to final Y
// so, finish it manually
if (Math.abs(currY - scroller.getFinalY()) < MIN_DELTA_FOR_SCROLLING) {
currY = scroller.getFinalY();
scroller.forceFinished(true);
}
if (!scroller.isFinished()) {
animationHandler.sendEmptyMessage(msg.what);
} else if (msg.what == MESSAGE_SCROLL) {
justify();
} else {
finishScrolling();
}
}
};
/**
* Justifies wheel
*/
private void justify() {
listener.onJustify();
setNextMessage(MESSAGE_JUSTIFY);
}
/**
* Starts scrolling
*/
private void startScrolling() {
if (!isScrollingPerformed) {
isScrollingPerformed = true;
listener.onStarted();
}
}
/**
* Finishes scrolling
*/
void finishScrolling() {
if (isScrollingPerformed) {
listener.onFinished();
isScrollingPerformed = false;
}
}
}
| [
"xuanmengmeng@yxj.org.cn"
] | xuanmengmeng@yxj.org.cn |
660a5d59a267bafed56358af3070fbf8b9a44eb3 | 8e13c338dec36021668e46798ff40c7ea9b6b065 | /Mage.Sets/src/mage/cards/p/PretendersClaim.java | 40bbfa3abd0ac93743303df7fe72740d4a087f8d | [
"MIT"
] | permissive | ninthworld/mage | c38aeeaa65a2a0afa908779b7c63ef2e1b1e413a | ba558f9a18032148a2936eedf874d90c97c7d46c | refs/heads/master | 2022-07-29T23:17:30.439762 | 2022-07-02T22:20:41 | 2022-07-02T22:20:41 | 140,520,040 | 1 | 0 | MIT | 2018-07-11T04:08:35 | 2018-07-11T04:08:35 | null | UTF-8 | Java | false | false | 2,892 | java | package mage.cards.p;
import java.util.List;
import java.util.UUID;
import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedAttachedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author jeffwadsworth
*/
public final class PretendersClaim extends CardImpl {
public PretendersClaim(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Whenever enchanted creature becomes blocked, tap all lands defending player controls.
this.addAbility(new BecomesBlockedAttachedTriggeredAbility(new TapDefendingPlayerLandEffect(), false));
}
private PretendersClaim(final PretendersClaim card) {
super(card);
}
@Override
public PretendersClaim copy() {
return new PretendersClaim(this);
}
}
class TapDefendingPlayerLandEffect extends OneShotEffect {
public TapDefendingPlayerLandEffect() {
super(Outcome.Tap);
staticText = "tap all lands defending player controls";
}
public TapDefendingPlayerLandEffect(final TapDefendingPlayerLandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent aura = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (aura != null
&& aura.getAttachedTo() != null) {
Player defendingPlayer = game.getPlayer(game.getCombat().getDefendingPlayerId(aura.getAttachedTo(), game));
if (defendingPlayer != null) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, defendingPlayer.getId(), game);
for (Permanent land : permanents) {
land.tap(source, game);
}
return true;
}
}
return false;
}
@Override
public TapDefendingPlayerLandEffect copy() {
return new TapDefendingPlayerLandEffect(this);
}
}
| [
"theelk801@gmail.com"
] | theelk801@gmail.com |
2e994505a53634407a6c74a60b580cef371780c6 | bcfb7ef4972fea223c8313432a37a16529d6ef49 | /A.M.Spring.Bank/src/test/java/pl/air/hr/ApplicationTests.java | 06287ce20a106b22ad5ff3d2b89423954c193c28 | [] | no_license | AlMarcysiak/Human-Resources-System-Spring | 2d6801d4983fd0a108ca3c593a38e3d56787ee0b | 9c0212b1df534561947909a1eac7432fad41c6bc | refs/heads/master | 2020-06-04T01:20:04.999131 | 2019-09-23T13:10:59 | 2019-09-23T13:10:59 | 191,812,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package pl.air.hr;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"alek.marcysiak@gmail.com"
] | alek.marcysiak@gmail.com |
5d9816ef0c2607491a136617633a24977de8987d | 7498d21c11cf47f6ab6bb73b21385729839a7244 | /src/main/java/com/example/task/dao/GradeDao.java | 9b4d4bbdaf07c777d5d0f932f06730170f3e9278 | [] | no_license | eutaqwa/springbootjsonjpa | 419d6f51e8a0db439aaeb3a222601af1c8183cf1 | 4ae03ecc6c4d4bedc41118d011f2631afa156202 | refs/heads/master | 2020-06-03T07:16:15.716815 | 2019-06-12T03:40:03 | 2019-06-12T03:40:03 | 191,491,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 209 | java | package com.example.task.dao;
import org.springframework.data.repository.CrudRepository;
import com.example.task.model.GradeModel;
public interface GradeDao extends CrudRepository<GradeModel, Integer> {
}
| [
"eutaqwa@gmail.com"
] | eutaqwa@gmail.com |
d0877c9e13725df0b0db0f94533056e77c94c1c6 | a422de59c29d077c512d66b538ff17d179cc077a | /hsxt/hsxt-common/src/main/java/com/gy/hsxt/common/exception/HsException.java | 58a24be99666ff69d2d3d48e844e4d81c3b57ee0 | [] | no_license | liveqmock/hsxt | c554e4ebfd891e4cc3d57e920d8a79ecc020b4dd | 40bb7a1fe5c22cb5b4f1d700e5d16371a3a74c04 | refs/heads/master | 2020-03-28T14:09:31.939168 | 2018-09-12T10:20:46 | 2018-09-12T10:20:46 | 148,461,898 | 0 | 0 | null | 2018-09-12T10:19:11 | 2018-09-12T10:19:10 | null | UTF-8 | Java | false | false | 3,783 | java | /***************************************************************************
* This document contains confidential and proprietary information
* subject to non-disclosure agreements with GUIYI Technology, Ltd.
* This information shall not be distributed or copied without written
* permission from GUIYI technology, Ltd.
***************************************************************************/
package com.gy.hsxt.common.exception;
import org.apache.commons.lang3.StringUtils;
import com.gy.hsxt.common.constant.IRespCode;
import com.gy.hsxt.common.constant.RespCode;
/***************************************************************************
* <PRE>
* Project Name : hsxt-common
* <p/>
* Package Name : com.gy.hsxt
* <p/>
* File Name : HsException.java
* <p/>
* Creation Date : 2015-7-8
* <p/>
* Author : yangjianguo
* <p/>
* Purpose : 通用异常类
* <p/>
* <p/>
* History : TODO
* <p/>
* </PRE>
***************************************************************************/
public class HsException extends RuntimeException {
private static final long serialVersionUID = -6465404826204357739L;
/**
* 错误代码
*/
private Integer errorCode;
/**
* 错误代码接口
*/
private IRespCode respCode;
public HsException() {
super();
errorCode = RespCode.UNKNOWN.getCode();
respCode = RespCode.UNKNOWN;
}
/**
* 该构造方法已经被遗弃
*
* @param errorCode
* 错误代码
* @deprecated Please use {@link HsException#HsException(IRespCode)}
* instead.
*/
@Deprecated
public HsException(int errorCode) {
super();
this.errorCode = errorCode;
}
/**
* 该构造方法已被遗弃
*
* @param errorCode
* 错误代码
* @param message
* 消息
*/
public HsException(int errorCode, String message) {
super(message);
this.errorCode = errorCode;
}
/**
* 添加构造方法
*
* @param respCode
* 错误代码枚举类型
* @author LiZhi Peter
* @see 2015-12-21
*/
public HsException(IRespCode respCode) {
super(respCode.getDesc());
this.errorCode = respCode.getCode();
this.respCode = respCode;
}
/**
* 构造方法
*
* @param respCode
* 错误代码
* @param message
* 默认消息
*/
public HsException(IRespCode respCode, String message) {
super(StringUtils.isNotBlank(message) ? message : respCode.getDesc());
this.respCode = respCode;
this.errorCode = respCode.getCode();
}
public Integer getErrorCode() {
if (respCode != null)
{
return respCode.getCode();
}
return errorCode;
}
public void setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
}
public IRespCode getRespCode() {
return respCode;
}
public void setRespCode(IRespCode respCode) {
this.respCode = respCode;
}
@Override
public String toString() {
StringBuilder messageBuilder = new StringBuilder(getClass().getName());
messageBuilder.append(":");
if (respCode == null)
{
messageBuilder.append(this.errorCode);
}
else
{
messageBuilder.append(respCode.getCode()).append(":").append(respCode.name());
}
String message = getLocalizedMessage();
return StringUtils.isNotBlank(message) ? messageBuilder.append(":").append(message).toString() : messageBuilder
.toString();
}
}
| [
"864201042@qq.com"
] | 864201042@qq.com |
6dd2530da5a2d3e3b44708590bfca74d52e612d6 | d9b19cf58d8c4c7ab1dc934fa4d73d17411a04cd | /src/main/java/org/omg/IOP/TAG_POLICIES.java | 0efc783cb9ffe483dec73f891b387b00e7e727a5 | [] | no_license | wttch96/jdk | 2548da98a4dca59ccc205ca1c0e51084bd9de31c | 9be728e4d278bff3b4c8f45b4a0f2529ea807e16 | refs/heads/master | 2023-03-27T04:24:52.098700 | 2019-05-31T08:59:14 | 2019-05-31T08:59:14 | 286,370,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package org.omg.IOP;
/**
* org/omg/IOP/TAG_POLICIES.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /build/openjdk-8-gyaYyR/openjdk-8-8u212-b03/src/corba/src/share/classes/org/omg/PortableInterceptor/IOP.idl
* Friday, April 26, 2019 2:05:49 AM UTC
*/
public interface TAG_POLICIES
{
/**
* A profile component containing the sequence of QoS policies exported
* with the object reference by an object adapter.
*/
public static final int value = (int)(2L);
}
| [
"admin@wattsch.cn"
] | admin@wattsch.cn |
b01971d199e70c003b11d608bca3908698b749a5 | da0efa8ffd08b86713aad007f10794c4b04d8267 | /com/telkom/mwallet/coupon/C1462e.java | 7e4b55b8725bafa975e26bb02969bf5895a05cb6 | [] | no_license | ibeae/tcash | e200c209c63fdfe63928b94846824d7091533f8a | 4bd25deb63ea7605202514f6a405961a14ef2553 | refs/heads/master | 2020-05-05T13:09:34.582260 | 2017-09-07T06:19:19 | 2017-09-07T06:19:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,601 | java | package com.telkom.mwallet.coupon;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.telkom.mwallet.R;
import com.telkom.mwallet.dialog.p063a.C1326f;
import com.telkom.mwallet.tcash.fragment.C1386e;
public class C1462e extends C1386e {
private static final String f3435a = C1462e.class.getSimpleName();
private Button f3436b;
private String f3437c = null;
private CouponRedeemNFCActivity f3438j;
private OnClickListener f3439k = new C14601(this);
private C1326f f3440l = new C14612(this);
class C14601 implements OnClickListener {
final /* synthetic */ C1462e f3433a;
C14601(C1462e c1462e) {
this.f3433a = c1462e;
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.coupon_redeem_topin_button:
this.f3433a.f3438j.startActivityForResult(new Intent(this.f3433a.f3438j, CouponRedeemPINActivity.class), 3);
return;
default:
return;
}
}
}
class C14612 implements C1326f {
final /* synthetic */ C1462e f3434a;
C14612(C1462e c1462e) {
this.f3434a = c1462e;
}
public void mo1485a() {
if (this.f3434a.f != null) {
this.f3434a.f.dismiss();
}
}
public void mo1486b() {
}
}
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.activity_coupon_redeem_nfc, null);
m5208c(R.string.title_couponlist);
this.f3438j = (CouponRedeemNFCActivity) getActivity();
String stringExtra = this.f3438j.getIntent().getStringExtra("PIN_REDEEM");
this.f3436b = (Button) inflate.findViewById(R.id.coupon_redeem_topin_button);
View view = (TextView) inflate.findViewById(R.id.coupon_redeem_topin_text);
if ("N".equalsIgnoreCase(stringExtra)) {
this.f3436b.setVisibility(8);
view.setVisibility(8);
} else {
this.f3436b.setOnClickListener(this.f3439k);
}
this.h.m4932a(this.f3438j, (TextView) inflate.findViewById(R.id.coupon_code_text), 2);
this.h.m4932a(this.f3438j, this.f3436b, 2);
this.h.m4932a(this.f3438j, view, 2);
return inflate;
}
}
| [
"igedetirtanata@gmail.com"
] | igedetirtanata@gmail.com |
cfee952c8d6944b0f1c2c4594e79e0b1523e629c | 2918eeaa8de3e0d4a1178da42b06fd8b20378a7f | /app/src/main/java/com/zanrite/groomme/HistoryData/Tabs_past_future_ride.java | f163fd2a95e4c54d2637fb65bd2f55c1a49ced52 | [] | no_license | Bbox12/groomme | 0564a0bf65144b9cc201165ce79a8f47e4c4cc72 | 11befa5d8aa992dd0cf75e2cf586d9f2f05909d9 | refs/heads/master | 2023-06-17T18:54:02.559055 | 2021-07-11T14:26:38 | 2021-07-11T14:26:38 | 339,601,213 | 0 | 0 | null | 2021-07-11T14:26:38 | 2021-02-17T03:31:09 | Java | UTF-8 | Java | false | false | 5,517 | java | package com.zanrite.groomme.HistoryData;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.zanrite.groomme.Activities.SalonHomePage;
import com.zanrite.groomme.R;
import com.zanrite.groomme.UserPart.UserHomeScreen;
import com.zanrite.groomme.helpers.PrefManager;
import java.util.ArrayList;
import java.util.List;
public class Tabs_past_future_ride extends AppCompatActivity {
private Toolbar toolbar;
private TabLayout tabLayout;
private ViewPager viewPager;
private double My_lat=0,My_long=0;
private Bundle bundle;
private int Pager=0;
private PrefManager pref;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ride_later_tab);
pref = new PrefManager(getApplicationContext());
toolbar = findViewById(R.id.toolbar_later_tabs);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
viewPager = findViewById(R.id.viewpager_tabs);
tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
setupViewPager(viewPager,bundle);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(pref.getResposibility()==1) {
Intent i = new Intent(Tabs_past_future_ride.this, UserHomeScreen.class);
i.putExtra("my_lat", My_lat);
i.putExtra("my_long", My_long);
startActivity(i);
finish();
overridePendingTransition(R.anim.slide_up1, R.anim.rbounce);
}else if(pref.getResposibility()==2) {
Intent i = new Intent(Tabs_past_future_ride.this, SalonHomePage.class);
i.putExtra("my_lat", My_lat);
i.putExtra("my_long", My_long);
startActivity(i);
finish();
overridePendingTransition(R.anim.slide_up1, R.anim.rbounce);
}
}
});
}
private void setupViewPager(ViewPager viewPager, Bundle bundle) {
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
Present_fragment fragObj2 = new Present_fragment();
fragObj2.setArguments(bundle);
adapter.addFragment(fragObj2,"Accepted");
Future_fragment fragObj1 = new Future_fragment();
fragObj1.setArguments(bundle);
adapter.addFragment(fragObj1,"Requested");
PastFragment fragobj = new PastFragment();
fragobj.setArguments(bundle);
adapter.addFragment(fragobj, "History");
adapter.notifyDataSetChanged();
viewPager.setAdapter(adapter);
}
class ViewPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public ViewPagerAdapter(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
//replaces the default 'Back' button action
if(keyCode== KeyEvent.KEYCODE_BACK) {
if(pref.getResposibility()==1) {
Intent i = new Intent(Tabs_past_future_ride.this, UserHomeScreen.class);
i.putExtra("my_lat", My_lat);
i.putExtra("my_long", My_long);
startActivity(i);
finish();
overridePendingTransition(R.anim.slide_up1, R.anim.rbounce);
}else if(pref.getResposibility()==2) {
Intent i = new Intent(Tabs_past_future_ride.this, SalonHomePage.class);
i.putExtra("my_lat", My_lat);
i.putExtra("my_long", My_long);
startActivity(i);
finish();
overridePendingTransition(R.anim.slide_up1, R.anim.rbounce);
}
}
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_black, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
}
| [
"inow.ani@gmail.com"
] | inow.ani@gmail.com |
50f1be69dd8f09e6d9ff8c032183dd492f3dad53 | 3baad985f6c1a5322e325ea679bda0a45711c6ff | /list2xml/dao/EmployeeImplementation.java | 8f7a4d10c375bc96a9ad66214ea3997d25722dcc | [] | no_license | MichkaDaCoder/list2xml | c2e452eaca0e16bc27f180d1cd8578db2268a6c6 | 96b1b3d5af1f44396b98907f6ab57a92d51b5421 | refs/heads/master | 2021-06-30T19:23:29.096140 | 2019-02-11T22:25:34 | 2019-02-11T22:25:34 | 170,211,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 916 | java | package list2xml.dao;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import list2xml.model.Employee;
/**
* EmployeeImplementation.java: implements <b>IEmployeeDAO</b> to initialize a List of employee
*
* @author MichkaDaCoder
*/
public class EmployeeImplementation implements Serializable, IEmployeeDAO{
/**
* This method initialize an Employee List
* @return List of Employees
*/
@Override
public List<Employee> InitEmployees() {
List<Employee> l=new ArrayList<>();
l.add(new Employee("EMP-022019", "Jane", "ADAMS", "jane.adams@acme.com"));
l.add(new Employee("EMP-072016", "John", "ADAMS", "john.adams@acme.com"));
l.add(new Employee("EMP-112011", "Alex", "DANIELS", "alex.daniels@acme.com"));
l.add(new Employee("EMP-122009", "Alexandra", "GOMEZ", "alexandra.gomez@acme.com"));
return l;
}
}
| [
"michkadacoder@gmail.com"
] | michkadacoder@gmail.com |
083d4f0e7fb8d1444bb4826b980838941c48df68 | 968a55a6da332de5868614d8be11175aff718ecb | /src/main/java/org/arhan/Main.java | a025085948b0efc3313ee2439a7f69842ec3f0b8 | [] | no_license | antonarhipov/attach-and-transform-with-mbeans | 55b719a7653dc7fbd4c34b464f40410d90ff7619 | ee8f0fa5433d993ee0cea81e712ae9f744526fb8 | refs/heads/master | 2021-01-10T13:49:54.228395 | 2015-11-05T10:02:26 | 2015-11-05T10:02:26 | 45,566,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,899 | java | package org.arhan;
import com.sun.tools.attach.VirtualMachine;
import javax.management.ObjectName;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.management.ManagementFactory;
import java.util.concurrent.atomic.AtomicReference;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
public class Main {
/**
* The created agent jar file name
*/
protected static final AtomicReference<String> agentJar = new AtomicReference<String>(null);
/**
* Self installs the agent, then runs a person sayHello in a loop
*
* @param args None
*/
public static void main(String[] args) {
try {
// Get this JVM's PID
String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
// Attach (to ourselves)
VirtualMachine vm = VirtualMachine.attach(pid);
// Create an agent jar (since we're in DEV mode)
String fileName = createAgent();
// Load the agent into this JVM
vm.loadAgent(fileName);
System.out.println("Agent Loaded");
ObjectName on = new ObjectName("transformer:service=DemoTransformer");
System.out.println("Instrumentation Deployed:" + ManagementFactory.getPlatformMBeanServer().isRegistered(on));
// Run sayHello in a loop
Bean person = new Bean();
for (int i = 0; i < 1000; i++) {
person.sayHello(i);
person.sayHello("String: " + (i * -1));
Thread.sleep(3000);
}
} catch (Exception ex) {
System.err.println("Agent Installation Failed. Stack trace follows...");
ex.printStackTrace(System.err);
}
}
/**
* Creates the temporary agent jar file if it has not been created
*
* @return The created agent file name
*/
public static String createAgent() {
if (agentJar.get() == null) {
synchronized (agentJar) {
if (agentJar.get() == null) {
FileOutputStream fos = null;
try {
File tmpFile = File.createTempFile(Agent.class.getName(), ".jar");
System.out.println("Temp File:" + tmpFile.getAbsolutePath());
tmpFile.deleteOnExit();
String manifest = ("Manifest-Version: 1.0\nAgent-Class: " + Agent.class.getName() + "\n") +
"Can-Redefine-Classes: true\n" +
"Can-Retransform-Classes: true\n" +
"Premain-Class: " + Agent.class.getName() + "\n";
ByteArrayInputStream bais = new ByteArrayInputStream(manifest.getBytes());
Manifest mf = new Manifest(bais);
fos = new FileOutputStream(tmpFile, false);
JarOutputStream jos = new JarOutputStream(fos, mf);
addClassesToJar(jos, Agent.class, DemoTransformer.class, ModifyMethodTest.class, TransformerService.class, TransformerServiceMBean.class);
jos.flush();
jos.close();
fos.flush();
fos.close();
agentJar.set(tmpFile.getAbsolutePath());
} catch (Exception e) {
throw new RuntimeException("Failed to write Agent installer Jar", e);
} finally {
if (fos != null) try {
fos.close();
} catch (Exception ignored) {
}
}
}
}
}
return agentJar.get();
}
/**
* Writes the passed classes to the passed JarOutputStream
*
* @param jos the JarOutputStream
* @param clazzes The classes to write
* @throws IOException on an IOException
*/
protected static void addClassesToJar(JarOutputStream jos, Class<?>... clazzes) throws IOException {
for (Class<?> clazz : clazzes) {
jos.putNextEntry(new ZipEntry(clazz.getName().replace('.', '/') + ".class"));
jos.write(getClassBytes(clazz));
jos.flush();
jos.closeEntry();
}
}
/**
* Returns the bytecode bytes for the passed class
*
* @param clazz The class to get the bytecode for
* @return a byte array of bytecode for the passed class
*/
public static byte[] getClassBytes(Class<?> clazz) {
InputStream is = null;
try {
is = clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + ".class");
ByteArrayOutputStream baos = new ByteArrayOutputStream(is.available());
byte[] buffer = new byte[8092];
int bytesRead;
while ((bytesRead = is.read(buffer)) != -1) {
baos.write(buffer, 0, bytesRead);
}
baos.flush();
return baos.toByteArray();
} catch (Exception e) {
throw new RuntimeException("Failed to read class bytes for [" + clazz.getName() + "]", e);
} finally {
if (is != null) {
try {
is.close();
} catch (Exception ignored) {
}
}
}
}
}
| [
"ant.arhipov@gmail.com"
] | ant.arhipov@gmail.com |
01991f40b42a52fd1c28217e667cc7f365e3ad23 | de3a3b121bb58900134eec13c702509109015843 | /src/main/java/com/xnjr/mall/api/impl/XN808265.java | 03151d2622fbd6c4a48a66945546697a3a6f3802 | [] | no_license | yiwocao2017/cswstdmall | 8d422afef6ba338fe5db34683c115b30c03336ff | ad2c10994e7d844429cd74131e903e7b326000e9 | refs/heads/master | 2022-06-27T13:59:26.488189 | 2019-07-01T06:30:05 | 2019-07-01T06:30:05 | 194,613,061 | 0 | 0 | null | 2022-06-17T02:17:53 | 2019-07-01T06:30:04 | Java | UTF-8 | Java | false | false | 2,047 | java | /**
* @Title XN808228.java
* @Package com.xnjr.mall.api.impl
* @Description
* @author haiqingzheng
* @date 2016年12月18日 下午11:28:37
* @version V1.0
*/
package com.xnjr.mall.api.impl;
import org.apache.commons.lang3.StringUtils;
import com.xnjr.mall.ao.IUserTicketAO;
import com.xnjr.mall.api.AProcessor;
import com.xnjr.mall.common.JsonUtil;
import com.xnjr.mall.core.StringValidater;
import com.xnjr.mall.domain.UserTicket;
import com.xnjr.mall.dto.req.XN808265Req;
import com.xnjr.mall.exception.BizException;
import com.xnjr.mall.exception.ParaException;
import com.xnjr.mall.spring.SpringContextHolder;
/**
* 我的折扣券分页查询
* @author: haiqingzheng
* @since: 2016年12月18日 下午11:28:37
* @history:
*/
public class XN808265 extends AProcessor {
private IUserTicketAO userTicketAO = SpringContextHolder
.getBean(IUserTicketAO.class);
private XN808265Req req = null;
/**
* @see com.xnjr.mall.api.IProcessor#doBusiness()
*/
@Override
public Object doBusiness() throws BizException {
UserTicket condition = new UserTicket();
condition.setUserId(req.getUserId());
condition.setStoreCode(req.getStoreCode());
condition.setStatus(req.getStatus());
String orderColumn = req.getOrderColumn();
if (StringUtils.isBlank(orderColumn)) {
orderColumn = IUserTicketAO.DEFAULT_ORDER_COLUMN;
}
condition.setOrder(orderColumn, req.getOrderDir());
int start = StringValidater.toInteger(req.getStart());
int limit = StringValidater.toInteger(req.getLimit());
return userTicketAO.queryUserTicketPage(start, limit, condition);
}
/**
* @see com.xnjr.mall.api.IProcessor#doCheck(java.lang.String)
*/
@Override
public void doCheck(String inputparams) throws ParaException {
req = JsonUtil.json2Bean(inputparams, XN808265Req.class);
StringValidater.validateBlank(req.getUserId(), req.getStart(),
req.getLimit());
}
}
| [
"admin@yiwocao.com"
] | admin@yiwocao.com |
4650102acb7300228e4e4af7dbc47fa4d99ad7d0 | 4b6c1a2ae07e374d34a526fa11d765622ab8769d | /app/src/main/java/br/com/bandtec/saude/Models/Temperatura.java | a51435265d4518e3b8c81be0f9b0a3f6c33f0989 | [] | no_license | enzotiezzi/Saude | 9aa8a9cfab64315d8b2300a0eb6d916aec440eb7 | 02696208af02bfb451203451d29954fa692e7ce6 | refs/heads/master | 2021-01-15T15:31:03.186685 | 2016-08-09T18:40:46 | 2016-08-09T18:40:46 | 43,250,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package br.com.bandtec.saude.Models;
/**
* Created by enzo on 26/09/2015.
*/
public class Temperatura extends Entidade
{
private float Grau;
public float getGrau()
{
return Grau;
}
public void setGrau(float grau)
{
Grau = grau;
}
}
| [
"enzo_tiezzi@hotmail.com"
] | enzo_tiezzi@hotmail.com |
36bdf8133c2c2661fdccb672667ada2e8f307ac3 | 16a4c6df8a5e7af4bb6218ee5fc23e6a692196dd | /Test/src/test/java/Pages/DefaultPages.java | 08c7df19f9d9a27e16c98e1e6e8180ed14136386 | [] | no_license | KateSurta/AutomationTesting | 4163dd6b645810ffa2d2963ed8a33801a3159178 | 8d29e32714abac5bda2fdffe84b3b6cef4d54722 | refs/heads/master | 2021-08-24T07:21:20.393602 | 2017-12-08T16:03:57 | 2017-12-08T16:03:57 | 113,552,063 | 0 | 0 | null | 2017-12-08T16:03:58 | 2017-12-08T08:41:13 | HTML | UTF-8 | Java | false | false | 2,806 | java | package Pages;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.support.FindBy;
import java.util.logging.Level;
import static org.openqa.selenium.firefox.FirefoxOptions.FIREFOX_OPTIONS;
public class DefaultPages extends FactoryPages {
@FindBy (css= "input[test-id ='login-input']")
private WebElement loginField;
@FindBy (css= "input[test-id ='pass-input']")
private WebElement passwordField;
@FindBy (css= "button.btn.btn-lg.btn-default.center-block")
public WebElement singInButton;
@FindBy(css = "div[test-id ='login-validation']")
private WebElement errorLoginMessage;
@FindBy(css = "div[test-id ='pass-validation']")
private WebElement errorPasswordMessage;
@FindBy(css = "div[test-id ='custom-auth-message']")
public WebElement errorCustomMessage;
public DefaultPages(WebDriver driver) {
super(driver);
}
public void Refresh() {
driver.navigate().refresh();
}
/*----------------------------------------------------------------------------*/
// methods for login field
public boolean isLoginFieldDisplayed(){
return loginField.isDisplayed();
}
public String getLoginMessage() {
String messageLoginTitle = errorLoginMessage.getText();
return messageLoginTitle;
}
public void inputLogin(String login){
loginField.sendKeys(login);
}
public void clickLoginField(){
loginField.click();
}
/*----------------------------------------------------------------------------*/
// methods for password field
public boolean isPasswordFieldDisplayed(){
return passwordField.isDisplayed();
}
public void inputPassword(String pass){
passwordField.sendKeys(pass);
}
public String getPasswordMessage() {
String messagePasswordTitle = errorPasswordMessage.getText();
return messagePasswordTitle;
}
public void clearPasswordField(){
loginField.sendKeys(Keys.BACK_SPACE);
}
public void clickPasswordField(){
passwordField.click();
}
/*----------------------------------------------------------------------------*/
// methods for Sing In button
public boolean isButtonSingInDisplayed(){
return singInButton.isDisplayed();
}
public void clickButtonSingIn() {
singInButton.click();
}
public boolean isAuthCustomMessageDisplayed(){
return errorCustomMessage.isDisplayed();
}
public String getAuthCustomMessage() {
String messageCustomAuthTitle = errorCustomMessage.getText();
return messageCustomAuthTitle;
}
}
| [
"ekaterina.surta@gmail.com"
] | ekaterina.surta@gmail.com |
620269536db52acddf276f1061bc40aa97b60a53 | cbd3ee6e3b947ac83521e34335a5ff3bc19cc255 | /src/main/java/com/ricardo/cursomc/repositories/ClienteRepository.java | 356958a7bef6ddeff2c29ace4839434d1e22dfa9 | [] | no_license | Ricardo2507/crusomc | 1918f823f1ca092d23575b3af5852bc04105b850 | 890b1afca0178b13d7045bb1dcdaffef545d19c1 | refs/heads/master | 2020-09-15T23:11:49.696447 | 2019-12-11T23:39:12 | 2019-12-11T23:39:12 | 223,579,229 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package com.ricardo.cursomc.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.ricardo.cursomc.domain.Cliente;
/** no Repository não será class, será interface extendendo JpaRepository **/
/** faz parte da camada de acesso a dados **/
@Repository
public interface ClienteRepository extends JpaRepository<Cliente, Integer> {
}
| [
"rscarvalho@hotmail.com"
] | rscarvalho@hotmail.com |
ee963e904043e836d8d19950692d44e8279b59dc | 9f1fb4f7d5d8939af74a015ab9a1c118ed7c15c7 | /mentoringsession/ReplaceB.java | 3e84c38a5ff0e4089f8b7909e8502633554477d0 | [] | no_license | kutmanai/add-day_9_conditionals3- | 814f0d872005928187541d064820aa280dc96a8c | c0ba1b40b7504ef86523475f98fcd42672cc44bd | refs/heads/master | 2020-04-09T03:54:32.951404 | 2018-12-02T00:59:01 | 2018-12-02T00:59:01 | 160,002,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package mentoringsession;
public class ReplaceB {
public static void main(String[] args) {
String words[]= { "Bananas","Blueberries", "Cherries",
"Brocolli", "Butternet", "Squash", "Green bean", "Peanut"
};
for (int i =0; i <words.length; i++) {
words[i]= words[i].replace("B", "V").replaceFirst("b", "v");
//words[i]= words[i].replace("b,","v");
}
for(String word: words){
System.out.print(word + " ,");
}
}
}
| [
"kutmanaizhumalieva@MacBook-Air-Kutmanai.local"
] | kutmanaizhumalieva@MacBook-Air-Kutmanai.local |
d315610bb9840610e9ed9b610b3e367f20a59c22 | bd7f909b20535294d3c55dcc8b2397d63e01f5d4 | /miu-session-spring/src/main/java/com/example/miu/session/repository/MovieRepository.java | 2ccd9722e0e8ec22f85b9fa2522a426750d5e6a4 | [] | no_license | Oddadmix/miu-senior-session | f10720b70477de40354a2d5149d372643daff419 | 1cd52f811bdd8380e785f43529a87d42996a67fe | refs/heads/master | 2021-07-10T10:55:43.250246 | 2017-10-10T12:48:45 | 2017-10-10T12:48:45 | 105,296,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.example.miu.session.repository;
import org.springframework.data.repository.CrudRepository;
import com.example.miu.session.entity.Movie;
public interface MovieRepository extends CrudRepository<Movie, Long> {
}
| [
"oddadmix"
] | oddadmix |
4fb748a7a2a2348ad8f93b12e922fe36eb9ccb40 | 927268625a21d96e0dd057568bc309e463d3b444 | /src/md/tekwill/demo/inheritance/Employee.java | 488c48ae995c078b7f19864e34ccd9b37c6af5db | [
"MIT"
] | permissive | theFaustus/demo-oca | 7975631f2f39d6900ed3b99b2449b51c732ac9de | 826801bfd9e234b17f728786003047279e8b7930 | refs/heads/master | 2020-06-30T03:24:44.559951 | 2019-10-11T17:27:48 | 2019-10-11T17:27:48 | 200,707,815 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 700 | java | package md.tekwill.demo.inheritance;
class Employee {
protected String name;
protected String address;
public Employee(String name, String address) {
this.name = name;
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "Employee{" +
"name='" + name + '\'' +
", address='" + address + '\'' +
'}';
}
}
| [
"”ipascari@isd-soft.com”"
] | ”ipascari@isd-soft.com” |
7935bf064478a074a1b5da9c1fad2c7db5812e30 | 6ed7822b278ff2c5d3b566409a985fcc3ddf6ba7 | /src/Matango.java | a78569f6817bd43c0f2fa8f281156dac316728ff | [] | no_license | monqcq/JavaIntroduction | a1848642f23b3fe0ee9f0d1ad2c8eef3c586c33e | a007603cdadb5f7fc9e834966658383ef46c528d | refs/heads/master | 2023-07-20T21:05:33.541208 | 2021-09-08T12:26:30 | 2021-09-08T12:26:30 | 382,824,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java |
public class Matango {
int hp;
final int LEVEL = 10;
char suffix;
public void run() {
System.out.println("お化けキノコ" + this.suffix + "は逃げ出した!");
}
}
| [
"takuyaaaan23@gmail.com"
] | takuyaaaan23@gmail.com |
0c4fe9abfa4d588ac771d11fc0adf14222b03368 | cf18c1d3e78706b95120a37f5c30a802e39efde7 | /syh_mall/src/main/java/com/visionet/syh_mall/repository/cart/ShopCartRepository.java | c6e4628e99cb725c9e80e937eee06bc43f996fc5 | [] | no_license | JavaLeeLi/shscce_syh | c31447ebc4aa5b1a555a7e99567ffe8459664e87 | 2ccc815aabfe23051a305964170310a1e8a9f4c1 | refs/heads/master | 2021-04-15T09:47:24.389650 | 2018-03-27T03:07:08 | 2018-03-27T03:07:08 | 126,915,503 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package com.visionet.syh_mall.repository.cart;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import com.visionet.syh_mall.entity.cart.ShopCart;
import com.visionet.syh_mall.repository.BaseRepository;
/**
* 购物车Dao层
* @author mulongfei
* @date 2017年8月31日上午10:16:50
*/
public interface ShopCartRepository extends BaseRepository<ShopCart, String> {
@Query(value="FROM ShopCart s WHERE s.userId=?1 AND s.goodsId=?2 AND s.isDeleted=0")
List<ShopCart> findOne(String UserId,String GoodId);
@Query(value="FROM ShopCart s WHERE s.userId=?1 AND s.isDeleted=0")
List<ShopCart> findAll(String UserId);
@Query(value="FROM ShopCart s WHERE s.userId=?1 AND s.goodsId=?2 AND s.isDeleted=0")
ShopCart findByUserIdAndGoodId(String userId,String goodId);
@Query(value="SELECT COUNT(1) FROM ShopCart s WHERE s.userId=?1 AND s.isDeleted=0")
int findByUserId(String userId);
}
| [
"liym@visionet.com.cn"
] | liym@visionet.com.cn |
d3e0337dcdbf549150149b272b90161aa31bc498 | 8f8541fc7b4ad1aef261ba12483545a9fcf27ed8 | /src/main/java/com/backend/shop/config/SwaggerConfig.java | b15b52038e6c3ae0733d105a7abec6fcfb56be1b | [] | no_license | Azphire/parking | a68db453677cb8b784fa1629214d7372405689a7 | 4549a60c4d2bc89bdd92e595647bc38078602edc | refs/heads/main | 2023-02-16T12:59:12.149054 | 2021-01-10T10:53:13 | 2021-01-10T10:53:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,233 | java | package com.backend.shop.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static springfox.documentation.builders.PathSelectors.regex;
@Configuration
@EnableSwagger2
@Import(BeanValidatorPluginsConfiguration.class)
public class SwaggerConfig extends WebMvcConfigurationSupport {
private ApiInfo metaData() {
return new ApiInfoBuilder()
.title("Spring Boot REST API")
.version("1.0.0")
.build();
}
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.backend.shop.controller"))
.paths(regex("/.*"))
.build()
.apiInfo(metaData());
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("*").allowedMethods("GET", "POST", "PUT", "DELETE").allowedOrigins("*")
.allowedHeaders("*");
}
} | [
"azphire@163.com"
] | azphire@163.com |
54f7aee845daf0719e7473442989d86a31a7ba85 | 4763e7c6e12c03dc9ddd538dc9d2fc17c80af762 | /src/main/java/com/ggkttd/kolmakov/testSystem/controllers/ResourceController.java | d2c8b2aa5e82684f2834b8100eff85479e341c5f | [] | no_license | NKolmakov/TestSystem | 858b59bd78ea794ea7a6c86eb70e608ab59f5774 | c5c5b7298e96eb47031c2516d2bdd7fc86733e81 | refs/heads/master | 2020-06-25T00:47:04.762722 | 2019-10-02T18:11:03 | 2019-10-02T18:11:03 | 199,144,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,962 | java | package com.ggkttd.kolmakov.testSystem.controllers;
import com.ggkttd.kolmakov.testSystem.domain.Resource;
import com.ggkttd.kolmakov.testSystem.services.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping(value = "/resources")
public class ResourceController {
@Autowired
private ResourceService resourceService;
@Value("${chunk.length:1048576}")
private int chunkLength;
@GetMapping(value = "{id}")
@ResponseBody
public byte[] getResourceStream(@PathVariable("id") Long id, HttpServletRequest request, HttpServletResponse response) {
String strRange = request.getHeader("Range");
Resource resource = resourceService.getOne(id);
byte[] chunk = null;
int startPosition = 0;
int status = 200;
if (strRange != null) {
strRange = strRange.replaceAll(".*bytes.*=\\s*", "");
//range looks like Range: 0-1024
if (strRange.matches("\\d+-\\d+")) {
String[] ranges = strRange.split("-");
startPosition = Integer.parseInt(ranges[0]);
int endPosition = Integer.parseInt(ranges[1]);
chunk = resourceService.getVideoStream(resource, endPosition, startPosition);
//range looks like Range: 0-
} else if (strRange.matches("\\d+-")) {
startPosition = Integer.parseInt(strRange.replaceAll("-", ""));
chunk = resourceService.getVideoStream(resource, startPosition);
//range looks like Range: -152
} else if (strRange.matches("-\\d+")) {
startPosition = Integer.parseInt(strRange.replaceAll("-", ""));
chunk = resourceService.getVideoStream(resource, -startPosition);
}
status = 206;
} else {
//give all file
chunk = resourceService.getVideoStream(resource);
}
response.setStatus(status);
response.setHeader("Content-Type", resource.getType());
response.setContentLength(chunk.length);
response.setHeader("Accept-Range", "bytes");
response.setHeader("Content-Range", "bytes " + startPosition + "-" + (startPosition + chunk.length - 1) + "/" + resource.getFileLength());
response.setHeader("Content-Transfer-Encoding", "binary");
response.setHeader("Cache-Control", "");
response.setHeader("Connection", "close");
return chunk;
}
}
| [
"colmakov.nikita@mail.ru"
] | colmakov.nikita@mail.ru |
668bebab4a92967f391f09581b90843eca95a89a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_41f1b482e8e914054fc35db32c4ae8e4b7b8e6eb/ContainerShapeEditPart/3_41f1b482e8e914054fc35db32c4ae8e4b7b8e6eb_ContainerShapeEditPart_t.java | 6cf61c04d889fc1edd9644c645d1962ac66a9f35 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 8,956 | java | /*******************************************************************************
* <copyright>
*
* Copyright (c) 2005, 2012 SAP AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* SAP AG - initial API, implementation and documentation
* mgorning - Bug 379836 - StackOverflow when parent GA is the root GA of an inactive shape
*
* </copyright>
*
*******************************************************************************/
package org.eclipse.graphiti.ui.internal.parts;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LayoutManager;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.gef.CompoundSnapToHelper;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.SnapToGeometry;
import org.eclipse.gef.SnapToGrid;
import org.eclipse.gef.SnapToGuides;
import org.eclipse.gef.SnapToHelper;
import org.eclipse.gef.rulers.RulerProvider;
import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.mm.pictograms.Shape;
import org.eclipse.graphiti.platform.ga.IGraphicsAlgorithmRenderer;
import org.eclipse.graphiti.tb.IToolBehaviorProvider;
import org.eclipse.graphiti.ui.internal.config.IConfigurationProvider;
import org.eclipse.graphiti.ui.internal.util.ui.sfx.GFSnapFeedbackPolicy;
/**
* A GraphicalEditPart, which model is of the type ContainerShape.
*
* @noinstantiate This class is not intended to be instantiated by clients.
* @noextend This class is not intended to be subclassed by clients.
*/
public class ContainerShapeEditPart extends ShapeEditPart implements IContainerShapeEditPart {
private IFigure contentPaneFigureCache;
private Integer contentPaneChilds = 0;
/**
* Creates a new ContainerShapeEditPart.
*
* @param configurationProvider
* the configuration provider
* @param containerShape
* the container shape
*/
public ContainerShapeEditPart(IConfigurationProvider configurationProvider, ContainerShape containerShape) {
super(configurationProvider, containerShape);
}
// ======================= overwriteable behaviour ========================
/**
* Creates the EditPolicies of this EditPart. Subclasses often overwrite
* this method to change the behaviour of the editpart. This implementation
* adds the layout-specific EditPolicy to the super-implementation.
*
* @see ShapeEditPart
*/
@Override
protected void createEditPolicies() {
super.createEditPolicies();
installEditPolicy(EditPolicy.LAYOUT_ROLE, getConfigurationProvider().getEditPolicyFactory()
.createShapeXYLayoutEditPolicy());
// installEditPolicy(EditPolicy.CONTAINER_ROLE,
// getConfigurationProvider().getEditPolicyFactory().createShapeXYLayoutEditPolicy());
installEditPolicy("Snap Feedback", new GFSnapFeedbackPolicy()); //$NON-NLS-1$
}
/**
* Creates the Figure of this editpart. This determines how the editpart
* will be displayed. The actual data for this figure should be provided in
* refreshVisuals().
*
* @return the i figure
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
if (getPictogramElement().getGraphicsAlgorithm() == null) {
throw new IllegalStateException(
"The ContainerShape must have a valid GraphicsAlgorithm: " + getPictogramElement().toString()); //$NON-NLS-1$
}
resetContentPaneFigureCache();
IFigure figure = super.createFigure();
if (figure != null) {
if (figure.getBackgroundColor() == null && !(figure instanceof IGraphicsAlgorithmRenderer))
figure.setBackgroundColor(ColorConstants.lightGray);
figure.setOpaque(true);
}
setFigure(figure);
contentPaneChilds = getContentPane().getChildren().size(); // initialize
// contentPaneChilds
return figure;
}
// ========================= standard behaviour ===========================
/**
* Returns the children of this EditPart.
*
* @return the model children
*
* @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
*/
@Override
public List<PictogramElement> getModelChildren() {
List<PictogramElement> result = new ArrayList<PictogramElement>();
if (getPictogramElementDelegate().isValid()) {
ContainerShape containerShape = (ContainerShape) getPictogramElement();
List<PictogramElement> activeChildren = collectActiveChildrenRecursively(containerShape);
result.addAll(activeChildren);
result.addAll(super.getModelChildren());
}
return result;
}
/**
* @param containerShape
* @return
*/
private List<PictogramElement> collectActiveChildrenRecursively(ContainerShape containerShape) {
Collection<? extends Shape> coll = containerShape.getChildren();
List<PictogramElement> activeChildren = new ArrayList<PictogramElement>();
for (Iterator<? extends Shape> iter = coll.iterator(); iter.hasNext();) {
Object obj = iter.next();
if (obj != null && obj instanceof PictogramElement) {
PictogramElement pe = (PictogramElement) obj;
if (pe.isActive()) {
activeChildren.add(pe);
} else if (pe instanceof ContainerShape) {
activeChildren.addAll(collectActiveChildrenRecursively((ContainerShape) pe));
}
}
}
return activeChildren;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.gef.editparts.AbstractGraphicalEditPart#addChildVisual(org
* .eclipse.gef.EditPart, int)
*/
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
resetContentPaneFigureCache();
int realIndex = index + getContentPaneChildCount();
super.addChildVisual(childEditPart, realIndex);
}
private void resetContentPaneFigureCache() {
contentPaneFigureCache = null;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.graphiti.ui.internal.parts.ShapeEditPart#getAdapter(java.
* lang.Class)
*/
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
if (adapter == SnapToHelper.class) {
List<SnapToHelper> snapStrategies = new ArrayList<SnapToHelper>();
Boolean val = (Boolean) getViewer().getProperty(RulerProvider.PROPERTY_RULER_VISIBILITY);
if (val != null && val.booleanValue())
snapStrategies.add(new SnapToGuides(this));
val = (Boolean) getViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED);
if (val != null && val.booleanValue())
snapStrategies.add(new SnapToGeometry(this));
val = (Boolean) getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED);
if (val != null && val.booleanValue())
snapStrategies.add(new SnapToGrid(this));
if (snapStrategies.size() == 0)
return null;
if (snapStrategies.size() == 1)
return snapStrategies.get(0);
SnapToHelper ss[] = new SnapToHelper[snapStrategies.size()];
for (int i = 0; i < snapStrategies.size(); i++)
ss[i] = snapStrategies.get(i);
return new CompoundSnapToHelper(ss);
}
return super.getAdapter(adapter);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getContentPane()
*/
@Override
public IFigure getContentPane() {
if (getContentPaneFigureCache() != null) {
return getContentPaneFigureCache();
}
IToolBehaviorProvider tbp = getConfigurationProvider().getDiagramTypeProvider()
.getCurrentToolBehaviorProvider();
PictogramElement pe = getPictogramElement();
if (pe instanceof ContainerShape && !(this instanceof DiagramEditPart)) {
ContainerShape cs = (ContainerShape) pe;
GraphicsAlgorithm contentGa = tbp.getContentArea(cs);
if (contentGa != null) {
setConentPaneFigureCache(getPictogramElementDelegate().getFigureForGraphicsAlgorithm(contentGa));
if (getContentPaneFigureCache() != null) {
LayoutManager lm = getContentPaneFigureCache().getLayoutManager();
if (!(lm instanceof XYLayout)) {
getContentPaneFigureCache().setLayoutManager(new XYLayout());
}
return getContentPaneFigureCache();
}
}
}
IFigure ret = super.getContentPane();
return ret;
}
private void setConentPaneFigureCache(IFigure figure) {
contentPaneFigureCache = figure;
}
private IFigure getContentPaneFigureCache() {
return contentPaneFigureCache;
}
private Integer getContentPaneChildCount() {
return contentPaneChilds;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
ba2ba0e59e3c575d9a0ed01552898aeac8236c24 | ec98872943c0a6a791668d6dc432ae7937905673 | /designer/src/com/android/tools/idea/uibuilder/handlers/constraint/targets/BaseLineActionTarget.java | fb142adb8a7dc9ef5df41e54e5e6469ec35a7148 | [] | no_license | zjw-swun/android | cabd8c172346467494af4fba4c17062161570ded | 3761afcc07ebbd4f86c1e7469c2c828f8b0eab5f | refs/heads/master | 2020-05-15T22:09:43.221694 | 2019-04-18T21:58:51 | 2019-04-18T22:01:08 | 182,518,753 | 1 | 0 | null | 2019-04-21T10:19:22 | 2019-04-21T10:19:21 | null | UTF-8 | Java | false | false | 2,517 | java | /*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.idea.uibuilder.handlers.constraint.targets;
import static com.android.tools.idea.uibuilder.handlers.constraint.ConstraintLayoutHandler.EDIT_BASELINE_ACTION_TOOLTIP;
import com.android.tools.idea.common.model.AndroidDpCoordinate;
import com.android.tools.idea.common.scene.SceneComponent;
import com.android.tools.idea.common.scene.target.ActionTarget;
import com.android.tools.idea.common.scene.target.AnchorTarget;
import com.android.tools.idea.common.scene.target.Target;
import com.android.tools.idea.uibuilder.graphics.NlIcon;
import com.google.common.collect.ImmutableList;
import icons.StudioIcons;
public class BaseLineActionTarget extends ActionTarget {
private static final NlIcon BASELINE_ICON =
new NlIcon(StudioIcons.LayoutEditor.Toolbar.BASELINE_ALIGNED, StudioIcons.LayoutEditor.Toolbar.BASELINE_ALIGNED_CONSTRAINT);
public BaseLineActionTarget() {
super(BASELINE_ICON, (SceneComponent c) -> c.setShowBaseline(!c.canShowBaseline()));
}
@Override
public void mouseDown(@AndroidDpCoordinate int x, @AndroidDpCoordinate int y) {
SceneComponent c = this.getComponent();
boolean baseline = !myComponent.canShowBaseline();
myComponent.setShowBaseline(baseline);
if (baseline) {
ImmutableList<Target> targets = myComponent.getTargets();
for (Target t : targets) {
if (t instanceof AnchorTarget) {
AnchorTarget at = (AnchorTarget)t;
if (at.getType() == AnchorTarget.Type.BASELINE) {
myComponent.getScene().setHitTarget(at);
at.mouseDown((int)at.getCenterX(), (int)at.getCenterY());
at.mouseDrag(x, y, myComponent.getTargets());
}
}
}
}
myComponent.getScene().needsRebuildList();
myComponent.getScene().repaint();
}
@Override
public String getToolTipText() {
return EDIT_BASELINE_ACTION_TOOLTIP;
}
}
| [
"treehugger-gerrit@google.com"
] | treehugger-gerrit@google.com |
eb1d71c9d5fae5be1cfa01e6b9d213b95f3d87b6 | 2e05a9bc728f488a210056653988492f02457f66 | /src/main/java/com/tabrizguliyev/app/ws/MobileAppWsApplication.java | 51970db35584a83a81dea5b5faba0759357cbea6 | [] | no_license | TabrizGuliyev/mobile-app-ws | 6d67043aafad5e448761a2bd8e7655609d2e40a1 | ee32be11260b47d58524184f3a1a877268e97485 | refs/heads/master | 2020-12-28T09:36:25.134492 | 2020-02-04T18:28:23 | 2020-02-04T18:28:28 | 238,270,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.tabrizguliyev.app.ws;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MobileAppWsApplication {
public static void main(String[] args) {
SpringApplication.run(MobileAppWsApplication.class, args);
}
}
| [
"tabrizguliyev@hotmail.com"
] | tabrizguliyev@hotmail.com |
1277e25bd1b6e37eec158601f6519de4b6aa48c0 | bfeb6ec0d47bf64bd95a2922b07d7ca192b9ad1f | /app/src/main/java/vn/com/canhtoan/Database/Entity/User_CauDocEntity.java | 1ebefa4144e26417a6fa9678ed5e8b29c5f09385 | [] | no_license | hntxuanit15spkt/PhanXa | a88bbc68cfe4d56c8ecafbe814b1639f1ddd65f5 | 77f07aac947fda72874dc64f34acf89046735b7d | refs/heads/master | 2020-03-12T11:07:09.078124 | 2018-05-27T05:02:33 | 2018-05-27T05:02:33 | 130,589,131 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | package vn.com.canhtoan.Database.Entity;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.ForeignKey;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
@Entity(foreignKeys = {@ForeignKey(entity = UserEntity.class, parentColumns = "id", childColumns = "id_user"),
@ForeignKey(entity = CauDocEntity.class, parentColumns = "id", childColumns = "id_caudoc")})
public class User_CauDocEntity {
@PrimaryKey
@NonNull
public int id;
@NonNull
public int id_user;
@NonNull
public int id_caudoc;
public double read_time_user;
public int sound_user;
public Boolean is_restudy;
}
| [
"hntxuanit15spkt@gmail.com"
] | hntxuanit15spkt@gmail.com |
b703df0a9bc492a8ebb6841e258d59d9489b5025 | a3fe8d989e8d0fb37e4661f7613da42d8ea90381 | /src/main/java/com/schoolofnet/RestAPI/services/ProductService.java | 2da982fd0f019ff2c3635a9d5e00308d292a7799 | [] | no_license | snifferchess/spring-boot-intermediario-rev-2 | b04429bc8cef1d3e1773c77d0318d3935cf20240 | 5fe67b0f3dda92df4aa158c57a63797e00daf7bf | refs/heads/master | 2021-10-09T01:30:53.766741 | 2018-12-19T22:13:56 | 2018-12-19T22:13:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.schoolofnet.RestAPI.services;
import java.util.List;
import com.schoolofnet.RestAPI.models.Product;
public interface ProductService {
public List<Product> findAll();
public Product find(Long id);
public Product create(Product product);
public Product update(Long id, Product product);
public void delete(Long id);
}
| [
"leonan.luppi@gmail.com"
] | leonan.luppi@gmail.com |
39ea80e29b071fd6cd5acf36b1de2e68660569c9 | a05d991577c44d2878fca9ae300c84076c26f76b | /semi_eclips14/src/model/Dao/DiaryDao.java | 5e36110129545c85bc92fd424ff60e24f7d499ab | [] | no_license | kimo9561/ATOPIDIA | ec704645289fd5d342971f40dca561b74aeaba4d | cded3e74b414e1c25e00fc9e85727e88c38a752f | refs/heads/master | 2023-02-13T14:39:37.003174 | 2021-01-17T05:43:27 | 2021-01-17T05:43:27 | 330,321,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,184 | java | package model.Dao;
import java.sql.Connection;
import java.util.List;
import model.Dto.DiaryDto;
public interface DiaryDao {
String InsertDiarySql = " INSERT INTO DIARY VALUES(DIARY_SEQ.NEXTVAL,?, ?, ?, ?, ?, ?,SYSDATE, ?, ?, ?) ";
String DeleteDiarySql = "DELETE FROM DIARY WHERE DIARY_NO=?";
String SelectAllSql = "SELECT * FROM DIARY WHERE MEMBER_NO=?";
String SelectOneSql = "SELECT * FROM DIARY WHERE DIARY_NO=?";
String UpdateSql = " UPDATE DIARY SET DIARY_TITLE=?, DIARY_CONTENT_MORNING=?, DIARY_CONTENT_LUNCH=?, DIARY_CONTENT_DINNER=?, DIARY_CONTENT_RECIPE=?, DIARY_IMAGE_FILENAME=?, DIARY_IMAGE_FILEREALNAME=?, DIARY_IMAGE_UPLOADPATH=? WHERE DIARY_NO=? ";
String diaryno = "SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME= UPPER('DIARY_SEQ')";
public List<DiaryDto> selectAllDiary(Connection con, int member_No);
public DiaryDto selectOneDiary(Connection con, int diary_No);
public int deleteAllDiary(Connection con, String[] chksdiary);
public int deleteOneDiary(Connection con, int diary_No);
public int insertDiary(Connection con, DiaryDto dto);
public int updateDiary(Connection con, DiaryDto dto);
public int selectdiaryno(Connection con);
}
| [
"kimo9561@naver.com"
] | kimo9561@naver.com |
c67c02815ce54fccaf0deb3bd54cbb99d5c0f93b | 338b25b3acd02a28679bb5e4d924860a6b179f9d | /src/benho/fragmentproblem/FragmentRightC.java | 3f91428d3f0af561c9dbe7ab66c302f2d3b706d1 | [] | no_license | Ben-Ho/fragmentProblem | b25ab2ae177ec1ccca0893a0e923ff69065cd869 | f08192098be7187d5f4bf08e8119ce58e60fbecc | refs/heads/master | 2020-05-20T11:14:02.896433 | 2014-07-07T07:49:58 | 2014-07-07T07:49:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package benho.fragmentproblem;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class FragmentRightC extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
TextView textView = new TextView(getActivity());
textView.setText("This is Fragment C");
return textView;
}
}
| [
"bh@vivid-planet.com"
] | bh@vivid-planet.com |
1192a1d82884fe94f4891a484e6a8e363a2547eb | 979bfc766cf2b73db2fc714667b8652a2d6dcacf | /Projects/Timbergrove/Petro-link/timbergrove_petrolink-tree_cep_engine_hg-700cbb5333f4/PetrolinkStructures/src/main/java/Energistics/Datatypes/ErrorCodes.java | 7b22f66c091b95648004cd9ef9f6a07543c3d046 | [
"MIT"
] | permissive | messaoudi-mounir/AvanticaPC | 936536c00fd287638fb43bdce9a67c039aa8e68c | 1c1ab806d63ecca0ce898676a273d4f951608239 | refs/heads/master | 2020-06-17T07:45:46.092223 | 2017-07-27T19:46:22 | 2017-07-27T19:46:22 | 195,850,038 | 1 | 0 | null | 2019-07-08T16:32:45 | 2019-07-08T16:32:44 | null | UTF-8 | Java | false | false | 697 | java | /**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package Energistics.Datatypes;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public enum ErrorCodes {
ENOROLE, ENOSUPPORTEDPROTOCOLS, EINVALID_MESSAGETYPE, EUNSUPPORTED_PROTOCOL ;
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"ErrorCodes\",\"namespace\":\"Energistics.Datatypes\",\"symbols\":[\"ENOROLE\",\"ENOSUPPORTEDPROTOCOLS\",\"EINVALID_MESSAGETYPE\",\"EUNSUPPORTED_PROTOCOL\"],\"fullName\":\"Energistics.Datatypes.ErrorCodes\",\"depends\":[]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
}
| [
"aquesada.vega11@gmail.com"
] | aquesada.vega11@gmail.com |
66c6cfc001c718a503ba6551453f99a56b9d8484 | b0e572ebc3cb93145b57ca7f272ee8bb32effedc | /android/app/src/main/java/com/rnapp/MainActivity.java | baf23a8113663202e1c65b737c9f48963974f6ca | [] | no_license | RookieDouby/RNapp | 0a1d832c447dcf4e4893f262aacf7b101456473a | 5571d59a6581029994d7be82bc079e98d3e42839 | refs/heads/master | 2020-03-19T09:32:02.922739 | 2018-06-06T08:32:02 | 2018-06-06T08:32:02 | 136,297,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.rnapp;
import com.facebook.react.ReactActivity;
import com.oblador.vectoricons.VectorIconsPackage;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "RNapp";
}
}
| [
"zhanghongdou756@pingan.com.cn"
] | zhanghongdou756@pingan.com.cn |
2f628d7bdfda63bd731acf47c00816712db70d6e | 5949bbdf00032a259444067fc68aa2256cd4e131 | /src/main/java/com/caglarb/issuemanagement/entity/User.java | fb54cbae2c98f99efe4d9a652d321cb379d6a3be | [] | no_license | caglarbilgin/issue-management-java-spring-boot-and-angular | e9b92fa0031532c12e4735106b6dc4b6f913f5e0 | 5c1922e4c9950cc455dec5b4f6c94888cd228fba | refs/heads/master | 2020-04-29T03:40:30.150702 | 2019-04-08T12:11:06 | 2019-04-08T12:11:06 | 175,819,253 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package com.caglarb.issuemanagement.entity;
import lombok.*;
import javax.persistence.*;
import javax.print.attribute.standard.MediaSize;
import java.util.List;
@Entity //jpa'den gelen bir database tablosu olduğunu belirtiyoruz.
@Table(name = "users") // burada tablo özelliklerini veriyoruz tabloya bir isim veriyoruz.
// (kullanmak zorunlu değil kullanmadığımız zaman tablonun ismi class ismiyle aynı olur)
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@EqualsAndHashCode
public class User extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "uname",length = 100, unique = true)
private String username;
@Column(name = "pwd",length = 200)
private String password;
@Column(name = "name_surname", length = 100)
private String nameSurname;
@Column(name = "email", length = 100)
private String email;
@JoinColumn(name = "assignee_user_id")
@OneToMany(fetch = FetchType.LAZY)
private List<Issue> issues;
}
| [
"caglar.bilgin@sahabt.com"
] | caglar.bilgin@sahabt.com |
5643520bafc68cdeb6c684bb4845f8cb1d9913d6 | 465769250c8aebae663a78d3ce88c097ec7ca57d | /src/main/java/com/ajax/brain/utils/sorts/BubbleSort.java | 9943cf94254764862827c5764fdec3ff56063e6d | [] | no_license | Xerogeiger/Brain | a018323e70d682227025a9085a0ca45834ad7734 | 8e325ce9132d080cd6265f176e375e97003363d1 | refs/heads/master | 2022-12-16T01:03:28.536547 | 2020-09-16T21:02:44 | 2020-09-16T21:02:44 | 294,256,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,011 | java | package com.ajax.brain.utils.sorts;
/**
* Implementation of a BubbleSort algorithm
*
* Code <del>stolen</del> borrowed from <a href="https://www.geeksforgeeks.org/">https://www.geeksforgeeks.org/</a>
* The page it was borrowed form is <a href="https://www.geeksforgeeks.org/bubble-sort/">https://www.geeksforgeeks.org/bubble-sort/</a>
*
*/
public final class BubbleSort<T> extends Sort<T>{
/**
* Creates a new {@code BubbleSort} with the {@code Representor}
*
* @param representor the {@code Representor} for converting objects to integers
* @throws NullPointerException if the representor is null
*/
private BubbleSort(Representor<T> representor) {
super(representor);
}
/**
* Sorts the provided array with a BubbleSort
*
* @param arr the array to sort
*/
@Override
public void sort(T[] arr) {
int n = arr.length;
for (int i = 0; i < n-1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (representor.convert(arr[j]) > representor.convert(arr[j + 1])) {
T temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
/**
* Sorts the provided array by constructing a new {@code BubbleSort} object then using it
*
* @param arr the array to sort
* @param representor the {@code Representor} the the provided object type
* @param <T> the object type of the array
*/
public static <T> void sort(T[] arr, Representor<T> representor) {
new BubbleSort<T>(representor).sort(arr);
}
/**
* Returns a new {@code BubbleSort} object to be used multiple times
*
* @param representor the {@code Representor} for the provided object type
* @param <T> the object type of the array
*/
public static <T> BubbleSort<T> getInstance(Representor<T> representor) {
return new BubbleSort<>(representor);
}
}
| [
"gamegenuity@gmail.com"
] | gamegenuity@gmail.com |
ccbe42968f6348bdbc909012312ea815516d3d62 | 2dcb93edebdf2d5c45539f4ed794b1116f30f8f9 | /app/src/main/java/com/bw/movie/bean/syBean/HotBean.java | d276f1142a82acfbb928334392eebba5a9f5de74 | [] | no_license | JK823/movie | 2a2634836676e0172799e43cb02907280b21db27 | c8bd9425d5434b9b87a36f8d3b63c7dc3c997156 | refs/heads/master | 2022-07-14T16:27:16.151622 | 2020-05-19T04:15:16 | 2020-05-19T04:15:16 | 265,142,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,048 | java | package com.bw.movie.bean.syBean;
import java.util.List;
public class HotBean {
/**
* result : [{"director":"\r\n刘伟强","horizontalImage":"http://mobile.bwstudent.com/images/movie/stills/zgjz/zgjz1_h.jpg","imageUrl":"http://mobile.bwstudent.com/images/movie/stills/zgjz/zgjz1.jpg","movieId":24,"name":"中国机长","score":9.4,"starring":"张涵予,欧豪,袁泉,张天爱,李沁"},{"director":"曾国祥","horizontalImage":"http://mobile.bwstudent.com/images/movie/stills/sndn/sndn1_h.jpg","imageUrl":"http://mobile.bwstudent.com/images/movie/stills/sndn/sndn1.jpg","movieId":22,"name":"少年的你","score":9.5,"starring":"周冬雨,易烊千玺,张耀,周也,尹昉"},{"director":"陈凯歌","horizontalImage":"http://mobile.bwstudent.com/images/movie/stills/whwdzg/whwdzg1_h.jpg","imageUrl":"http://mobile.bwstudent.com/images/movie/stills/whwdzg/whwdzg1.jpg","movieId":23,"name":"我和我的祖国","score":9.7,"starring":"黄渤,张译,杜江,葛优,刘昊然,吴京"},{"director":"吕乐","horizontalImage":"http://mobile.bwstudent.com/images/movie/stills/zdn/zdn1_h.jpg","imageUrl":"http://mobile.bwstudent.com/images/movie/stills/zdn/zdn1.jpg","movieId":21,"name":"找到你","score":8.5,"starring":"姚晨,马伊琍,袁文康,吴昊宸"},{"director":"庄文强","horizontalImage":"http://mobile.bwstudent.com/images/movie/stills/ws/ws1_h.jpg","imageUrl":"http://mobile.bwstudent.com/images/movie/stills/ws/ws1.jpg","movieId":20,"name":"无双","score":8.6,"starring":"周润发,郭富城,张静初,冯文娟,廖启智"}]
* message : 查询成功
* status : 0000
*/
private String message;
private String status;
private List<ResultBean> result;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public List<ResultBean> getResult() {
return result;
}
public void setResult(List<ResultBean> result) {
this.result = result;
}
public static class ResultBean {
/**
* director :
刘伟强
* horizontalImage : http://mobile.bwstudent.com/images/movie/stills/zgjz/zgjz1_h.jpg
* imageUrl : http://mobile.bwstudent.com/images/movie/stills/zgjz/zgjz1.jpg
* movieId : 24
* name : 中国机长
* score : 9.4
* starring : 张涵予,欧豪,袁泉,张天爱,李沁
*/
private String director;
private String horizontalImage;
private String imageUrl;
private int movieId;
private String name;
private double score;
private String starring;
public String getDirector() {
return director;
}
public void setDirector(String director) {
this.director = director;
}
public String getHorizontalImage() {
return horizontalImage;
}
public void setHorizontalImage(String horizontalImage) {
this.horizontalImage = horizontalImage;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public int getMovieId() {
return movieId;
}
public void setMovieId(int movieId) {
this.movieId = movieId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
public String getStarring() {
return starring;
}
public void setStarring(String starring) {
this.starring = starring;
}
}
}
| [
"133671668951@163.com"
] | 133671668951@163.com |
6077a14790e59100ebcc747d5755dd64a153ee4b | 76bf98f9ca19979db01b624a5edc7ca9f6e3fa57 | /src/main/java/com/example/demo/application/port/in/model/ResponseFindAllPersonajes.java | c2652443987412835e889955548414ecad867e25 | [] | no_license | srkapi/test1 | ca00120a72f3ce3d057fc8bb1cbea76156a3f9e3 | ebbc4be31a0e032458f34ad546a70dd7b046d064 | refs/heads/master | 2022-10-20T17:35:37.113135 | 2020-05-22T09:59:03 | 2020-05-22T09:59:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.example.demo.application.port.in.model;
import com.example.demo.application.domain.Personaje;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Builder
@Data
public class ResponseFindAllPersonajes implements Serializable {
private List<Personaje> responsePersonajeList;
}
| [
"pricila.albero@gmail.com"
] | pricila.albero@gmail.com |
b23854fd33510b46f9a5016984566b753dda3d8a | f9a9fd3f1e18c2f2cabcc2f0ebc225b1b25de60e | /app/src/main/java/com/ming/sjll/my/fragment/CollectionProjectFragemt.java | 889163dd1cc898ce4b60dbf91a9ec25c69afd5cd | [] | no_license | 15307388990/SJLL | 273541dfa40f8a3a92e88890941ed68a5cd129d5 | e4dd377d6408b6c28e6683843cc4f39c11f2442b | refs/heads/master | 2020-08-03T04:27:46.225903 | 2019-11-23T02:41:32 | 2019-11-23T02:41:32 | 211,624,684 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,398 | java | package com.ming.sjll.my.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ming.sjll.R;
import com.ming.sjll.base.fragment.MvpFragment;
import com.ming.sjll.base.widget.ToastShow;
import com.ming.sjll.my.adapter.CollectionGoodsAdapter;
import com.ming.sjll.my.bean.ColletionGoodsBean;
import com.ming.sjll.my.presenter.ColletionGoodsPresenter;
import com.ming.sjll.my.presenter.ColletionProjectPresenter;
import com.ming.sjll.my.view.ColletionGoodslView;
import com.ming.sjll.my.view.ColletionProjectlView;
import com.ming.sjll.supplier.adapter.Comprehendapter;
import com.ming.sjll.supplier.bean.ComprehenBean;
import butterknife.BindView;
/**
* @author luoming
* created at 2019-10-14 10:32
* 收藏 项目
*/
public class CollectionProjectFragemt extends MvpFragment<ColletionProjectlView, ColletionProjectPresenter> implements ColletionProjectlView {
@BindView(R.id.recyclerview)
RecyclerView recyclerview;
public static CollectionProjectFragemt newInstance() {
CollectionProjectFragemt projectManagementFragemt = new CollectionProjectFragemt();
return projectManagementFragemt;
}
@Override
protected void onCreateView(Bundle savedInstanceState) {
super.onCreateView(savedInstanceState);
setContentView(R.layout.fragemt_recycle);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
protected ColletionProjectPresenter createPresenter() {
return new ColletionProjectPresenter();
}
@Override
public void showLoading(String msg) {
}
@Override
public void hideLoading() {
}
@Override
public void showError(String msg) {
ToastShow.s(msg);
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
@Override
public void ShowData(ComprehenBean pBean) {
recyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
Comprehendapter comprehendapter=new Comprehendapter(pBean.getData().getData());
recyclerview.setAdapter(comprehendapter);
}
}
| [
"lan.sha@163.com"
] | lan.sha@163.com |
ada9208709667e286188713e8b9e5bcf50a1acd5 | 447520f40e82a060368a0802a391697bc00be96f | /apks/malware/app98/source/com/a/a/a/e/c/a.java | eca45f44e6fda98029550a22d5d08131d72515ff | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 10,454 | java | package com.a.a.a.e.c;
import com.a.a.a.b.i;
import com.a.a.a.d.d;
import com.a.a.a.e.n.b;
import com.a.a.a.e.p;
public class a
extends p
{
private static int D = 1;
private static int E = 2;
private static int F = 3;
private static int G = 4;
private static int H = 1;
private static int I = 2;
private static int J = 3;
private static int K = 4;
protected static int L = 6;
protected static int M = 103;
protected static int N = 104;
protected static int O = 105;
protected static int P = 101;
protected static int Q = 100;
protected static int R = 99;
protected static int S = 98;
protected static int T = 102;
protected static int U = 4096;
protected static int V = 4097;
protected static int[] W = { E, H, D, K, D, I };
protected static int[] X = { E, H, D, I, D, K };
protected static int[] Y = { E, H, D, I, F, I };
protected static int[] Z = { E, J, F, H, D, H, E };
protected static int[][] ab;
public static boolean bb;
static
{
int[] arrayOfInt1 = { E, H, E, I, E, I };
int[] arrayOfInt2 = { E, I, E, H, E, I };
int[] arrayOfInt3 = { E, I, E, I, E, H };
int[] arrayOfInt4 = { D, I, D, I, E, J };
int[] arrayOfInt5 = { D, I, D, J, E, I };
int[] arrayOfInt6 = { D, J, D, I, E, I };
int[] arrayOfInt7 = { D, I, E, I, D, J };
int[] arrayOfInt8 = { D, I, E, J, D, I };
int[] arrayOfInt9 = { D, J, E, I, D, I };
int[] arrayOfInt10 = { E, I, D, I, D, J };
int[] arrayOfInt11 = { E, I, D, J, D, I };
int[] arrayOfInt12 = { E, J, D, I, D, I };
int[] arrayOfInt13 = { D, H, E, I, F, I };
int[] arrayOfInt14 = { D, I, E, H, F, I };
int i = D;
int j = I;
int k = E;
int m = I;
int n = F;
int i1 = H;
int[] arrayOfInt15 = { D, H, F, I, E, I };
int[] arrayOfInt16 = { D, I, F, H, E, I };
int[] arrayOfInt17 = { D, I, F, I, E, H };
int[] arrayOfInt18 = { E, I, F, I, D, H };
int[] arrayOfInt19 = { E, I, D, H, F, I };
int[] arrayOfInt20 = { E, I, D, I, F, H };
int[] arrayOfInt21 = { E, H, F, I, D, I };
int[] arrayOfInt22 = { E, I, F, H, D, I };
int[] arrayOfInt23 = { F, H, E, H, F, H };
int[] arrayOfInt24 = { F, H, D, I, E, I };
int[] arrayOfInt25 = { F, I, D, H, E, I };
int[] arrayOfInt26 = { F, I, D, I, E, H };
int[] arrayOfInt27 = { F, H, E, I, D, I };
int[] arrayOfInt28 = { F, I, E, H, D, I };
int[] arrayOfInt29 = { F, I, E, I, D, H };
int[] arrayOfInt30 = { E, H, E, H, E, J };
int i2 = E;
int i3 = H;
int i4 = E;
int i5 = J;
int i6 = E;
int i7 = H;
int[] arrayOfInt31 = { E, J, E, H, E, H };
int[] arrayOfInt32 = { D, H, D, J, E, J };
int[] arrayOfInt33 = { D, J, D, H, E, J };
int[] arrayOfInt34 = { D, J, D, J, E, H };
int[] arrayOfInt35 = { D, H, E, J, D, J };
int[] arrayOfInt36 = { D, J, E, H, D, J };
int[] arrayOfInt37 = { D, J, E, J, D, H };
int[] arrayOfInt38 = { E, H, D, J, D, J };
int[] arrayOfInt39 = { E, J, D, H, D, J };
int[] arrayOfInt40 = { E, J, D, J, D, H };
int[] arrayOfInt41 = { D, H, E, H, F, J };
int[] arrayOfInt42 = { D, H, E, J, F, H };
int[] arrayOfInt43 = { D, J, E, H, F, H };
int[] arrayOfInt44 = { D, H, F, H, E, J };
int[] arrayOfInt45 = { D, H, F, J, E, H };
int[] arrayOfInt46 = { D, J, F, H, E, H };
int[] arrayOfInt47 = { F, H, F, H, E, H };
int[] arrayOfInt48 = { E, H, D, J, F, H };
int[] arrayOfInt49 = { E, J, D, H, F, H };
int[] arrayOfInt50 = { E, H, F, H, D, J };
int[] arrayOfInt51 = { E, H, F, J, D, H };
int[] arrayOfInt52 = { E, H, F, H, F, H };
int[] arrayOfInt53 = { F, H, D, H, E, J };
int[] arrayOfInt54 = { F, H, D, J, E, H };
int[] arrayOfInt55 = { F, J, D, H, E, H };
int[] arrayOfInt56 = { F, H, E, H, D, J };
int[] arrayOfInt57 = { F, H, E, J, D, H };
int[] arrayOfInt58 = { F, J, E, H, D, H };
int[] arrayOfInt59 = { F, H, G, H, D, H };
int[] arrayOfInt60 = { E, I, D, K, D, H };
int[] arrayOfInt61 = { G, J, D, H, D, H };
int[] arrayOfInt62 = { D, H, D, I, E, K };
int[] arrayOfInt63 = { D, H, D, K, E, I };
int[] arrayOfInt64 = { D, I, D, H, E, K };
int[] arrayOfInt65 = { D, I, D, K, E, H };
int[] arrayOfInt66 = { D, K, D, H, E, I };
int[] arrayOfInt67 = { D, K, D, I, E, H };
int[] arrayOfInt68 = { D, H, E, I, D, K };
int[] arrayOfInt69 = { D, H, E, K, D, I };
int[] arrayOfInt70 = { D, I, E, H, D, K };
int i8 = D;
int i9 = I;
int i10 = E;
int i11 = K;
int i12 = D;
int i13 = H;
int[] arrayOfInt71 = { D, K, E, H, D, I };
int[] arrayOfInt72 = { D, K, E, I, D, H };
int[] arrayOfInt73 = { E, K, D, I, D, H };
int[] arrayOfInt74 = { E, I, D, H, D, K };
int[] arrayOfInt75 = { G, H, F, H, D, H };
int[] arrayOfInt76 = { E, K, D, H, D, I };
int[] arrayOfInt77 = { D, J, G, H, D, H };
int i14 = D;
int i15 = H;
int i16 = D;
int i17 = I;
int i18 = G;
int i19 = I;
int i20 = D;
int i21 = I;
int i22 = D;
int i23 = H;
int i24 = G;
int i25 = I;
int[] arrayOfInt78 = { D, I, D, I, G, H };
int[] arrayOfInt79 = { D, H, G, I, D, I };
int[] arrayOfInt80 = { D, I, G, H, D, I };
int[] arrayOfInt81 = { D, I, G, I, D, H };
int[] arrayOfInt82 = { G, H, D, I, D, I };
int[] arrayOfInt83 = { G, I, D, H, D, I };
int[] arrayOfInt84 = { G, I, D, I, D, H };
int[] arrayOfInt85 = { E, H, E, H, G, H };
int[] arrayOfInt86 = { E, H, G, H, E, H };
int[] arrayOfInt87 = { G, H, E, H, E, H };
int i26 = D;
int i27 = H;
int i28 = D;
int i29 = H;
int i30 = G;
int i31 = J;
int[] arrayOfInt88 = { D, H, D, J, G, H };
int[] arrayOfInt89 = { D, J, D, H, G, H };
int[] arrayOfInt90 = { D, H, G, H, D, J };
int[] arrayOfInt91 = { D, H, G, J, D, H };
int[] arrayOfInt92 = { G, H, D, H, D, J };
int[] arrayOfInt93 = { G, H, D, J, D, H };
int[] arrayOfInt94 = { D, H, F, H, G, H };
int[] arrayOfInt95 = { D, H, G, H, F, H };
int[] arrayOfInt96 = { F, H, D, H, G, H };
int[] arrayOfInt97 = { G, H, D, H, F, H };
ab = new int[][] { arrayOfInt1, arrayOfInt2, arrayOfInt3, arrayOfInt4, arrayOfInt5, arrayOfInt6, arrayOfInt7, arrayOfInt8, arrayOfInt9, arrayOfInt10, arrayOfInt11, arrayOfInt12, arrayOfInt13, arrayOfInt14, { i, j, k, m, n, i1 }, arrayOfInt15, arrayOfInt16, arrayOfInt17, arrayOfInt18, arrayOfInt19, arrayOfInt20, arrayOfInt21, arrayOfInt22, arrayOfInt23, arrayOfInt24, arrayOfInt25, arrayOfInt26, arrayOfInt27, arrayOfInt28, arrayOfInt29, arrayOfInt30, { i2, i3, i4, i5, i6, i7 }, arrayOfInt31, arrayOfInt32, arrayOfInt33, arrayOfInt34, arrayOfInt35, arrayOfInt36, arrayOfInt37, arrayOfInt38, arrayOfInt39, arrayOfInt40, arrayOfInt41, arrayOfInt42, arrayOfInt43, arrayOfInt44, arrayOfInt45, arrayOfInt46, arrayOfInt47, arrayOfInt48, arrayOfInt49, arrayOfInt50, arrayOfInt51, arrayOfInt52, arrayOfInt53, arrayOfInt54, arrayOfInt55, arrayOfInt56, arrayOfInt57, arrayOfInt58, arrayOfInt59, arrayOfInt60, arrayOfInt61, arrayOfInt62, arrayOfInt63, arrayOfInt64, arrayOfInt65, arrayOfInt66, arrayOfInt67, arrayOfInt68, arrayOfInt69, arrayOfInt70, { i8, i9, i10, i11, i12, i13 }, arrayOfInt71, arrayOfInt72, arrayOfInt73, arrayOfInt74, arrayOfInt75, arrayOfInt76, arrayOfInt77, { i14, i15, i16, i17, i18, i19 }, { i20, i21, i22, i23, i24, i25 }, arrayOfInt78, arrayOfInt79, arrayOfInt80, arrayOfInt81, arrayOfInt82, arrayOfInt83, arrayOfInt84, arrayOfInt85, arrayOfInt86, arrayOfInt87, { i26, i27, i28, i29, i30, i31 }, arrayOfInt88, arrayOfInt89, arrayOfInt90, arrayOfInt91, arrayOfInt92, arrayOfInt93, arrayOfInt94, arrayOfInt95, arrayOfInt96, arrayOfInt97 };
}
public a()
{
this.e = 22;
this.m = false;
this.u = d;
this.v = c;
this.w = c;
this.x = c;
this.y = 2;
this.z = 0;
}
private int a(int[] paramArrayOfInt)
{
return paramArrayOfInt.length * L + Z.length;
}
protected int a(com.a.a.a.b.a[] paramArrayOfA, int paramInt, int[] paramArrayOfInt, boolean paramBoolean)
{
paramBoolean = bb;
int i = 0;
int j;
do
{
j = paramInt;
if (i >= paramArrayOfInt.length) {
break;
}
if (i % 2 == 0)
{
paramArrayOfA[paramInt].a(0);
if (!paramBoolean) {}
}
else
{
paramArrayOfA[paramInt].a(1);
}
paramArrayOfA[paramInt].d(paramArrayOfInt[i]);
paramArrayOfA[paramInt].a(false);
j = paramInt + 1;
i += 1;
paramInt = j;
} while (!paramBoolean);
return j;
}
protected boolean a(int paramInt)
{
return (paramInt >= 0) && (paramInt <= 127);
}
public int[] a(int[] paramArrayOfInt)
{
return d.a(paramArrayOfInt);
}
public i[] a(int[] paramArrayOfInt, boolean paramBoolean)
{
i[] arrayOfI = new i[1];
arrayOfI[0] = new i();
arrayOfI[0].q = b.a(paramArrayOfInt);
arrayOfI[0].w = this.s;
return arrayOfI;
}
public int[] b(int[] paramArrayOfInt)
{
boolean bool = bb;
int i = paramArrayOfInt[0];
int j = 1;
int k;
do
{
k = i;
if (j >= paramArrayOfInt.length) {
break;
}
k = i + paramArrayOfInt[j] * j;
j += 1;
i = k;
} while (!bool);
return b.a(paramArrayOfInt, k % 103);
}
public int[] c(d paramD)
{
return f.a(paramD.a(true));
}
public com.a.a.a.b.a[] c(int[] paramArrayOfInt)
{
boolean bool = bb;
com.a.a.a.b.a[] arrayOfA = new com.a.a.a.b.a[a(paramArrayOfInt)];
int i = 0;
do
{
if (i >= arrayOfA.length) {
break;
}
arrayOfA[i] = new com.a.a.a.b.a();
i += 1;
} while (!bool);
int j;
if (paramArrayOfInt[0] == M)
{
j = a(arrayOfA, 0, W, false);
i = j;
if (!bool) {}
}
for (i = j;; i = 0)
{
j = i;
if (paramArrayOfInt[0] == N)
{
j = a(arrayOfA, i, X, false);
i = j;
if (!bool) {}
}
else
{
i = j;
if (paramArrayOfInt[0] == O) {
i = a(arrayOfA, j, Y, false);
}
}
j = 1;
int k;
do
{
k = i;
if (j >= paramArrayOfInt.length) {
break;
}
k = a(arrayOfA, i, ab[paramArrayOfInt[j]], false);
j += 1;
i = k;
} while (!bool);
a(arrayOfA, k, Z, true);
return arrayOfA;
}
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
633352fcb73c027c7de47ac5a5da72812d76f4fa | 11825967f0656b0347da8755f526c2b2e696812b | /app/src/androidTest/java/edu/tamu/geoinnovation/fpx/ApplicationTest.java | 7e573c9f387787d4911649bd371facc106e4b3d1 | [] | no_license | antoniotexas/FitTrack | a20ad6ddedef8db4d89094c9ea7254d54668ac65 | f4cea5cb4310edf09351ac6a086b2f3f0b0b24f9 | refs/heads/master | 2020-03-17T23:58:33.533259 | 2018-05-19T14:58:28 | 2018-05-19T14:58:28 | 134,070,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package edu.tamu.geoinnovation.fpx;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"joseramos@joses-mbp.attlocal.net"
] | joseramos@joses-mbp.attlocal.net |
56a1dbb9eddaca8b9ba37c328578e564dd6681a1 | 3c6ea244c21d9655926be9f280a0b2e81c24369a | /AddressBookApplication/src/address/UnitTest/NoteTest.java | 5ec57bb4657101d10bfa45f10834601115f67483 | [] | no_license | smahankali/AddressBookApplication | 9bad026ef3f481740481830668908c3c276eb070 | 7a7160508ac071a0a2bf23db29a2efb86737d2e3 | refs/heads/master | 2021-01-21T07:14:07.677718 | 2016-05-17T14:50:53 | 2016-05-17T14:50:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,328 | java | /**
*
*/
package address.UnitTest;
import static org.junit.Assert.*;
import org.junit.Test;
import address.data.note.Note;
/**
* The NoteTest class performs unit testing on all methods inside the Note class
* @author Shravya Mahankali
* @version 1.0
* @since 15 April 2016 */
public class NoteTest {
/**
* Test method for {@link address.data.note.Note#Note(int, java.lang.String)}.
*/
@Test
public void testNote() {
Note n=new Note(12,"This is a new note");
assertEquals(12,n.getId());
assertEquals("This is a new note",n.getComments());
n=new Note(13,"This is another note");
assertEquals(13,n.getId());
assertEquals("This is another note",n.getComments());
}
/**
* Test method for {@link address.data.note.Note#getId()}.
*/
@Test
public void testGetId() {
Note n=new Note(12,"This is a new note");
assertEquals(12,n.getId());
n=new Note(13,"This is another note");
assertEquals(13,n.getId());
}
/**
* Test method for {@link address.data.note.Note#getComments()}.
*/
@Test
public void testGetComments() {
Note n=new Note(12,"This is a new note");
assertEquals("This is a new note",n.getComments());
n=new Note(13,"This is another note");
assertEquals("This is another note",n.getComments());
}
}
| [
"shrav@DESKTOP-AOAE4I1"
] | shrav@DESKTOP-AOAE4I1 |
60768516f2f45393a9bcf7daed55fe3aaa4691da | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_9c936a6575e678b50d0a6c77de99474e97dabab9/JavaFXCompletionEnvironment/13_9c936a6575e678b50d0a6c77de99474e97dabab9_JavaFXCompletionEnvironment_t.java | f0aac3e861275f804a7c566b62dd3c7ab9412016 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 86,901 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Contributor(s):
*
* The Original Software is NetBeans. The Initial Developer of the Original
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
* Microsystems, Inc. All Rights Reserved.
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*/
package org.netbeans.modules.javafx.editor.completion;
import com.sun.javafx.api.tree.*;
import com.sun.javafx.api.tree.Tree.JavaFXKind;
import com.sun.tools.javac.code.Scope;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javafx.api.JavafxcScope;
import com.sun.tools.javafx.api.JavafxcTrees;
import com.sun.tools.javafx.code.JavafxTypes;
import com.sun.tools.javafx.tree.JFXClassDeclaration;
import com.sun.tools.javafx.tree.JFXFunctionDefinition;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.javafx.lexer.JFXTokenId;
import org.netbeans.api.javafx.source.ClassIndex.NameKind;
import org.netbeans.api.javafx.source.ClassIndex.SearchScope;
import org.netbeans.api.javafx.source.*;
import org.netbeans.api.javafx.source.ClasspathInfo.PathKind;
import org.netbeans.api.javafx.source.CompilationController;
import org.netbeans.api.javafx.source.JavaFXParserResult;
import org.netbeans.api.javafx.source.JavaFXSource.Phase;
import org.netbeans.api.lexer.TokenHierarchy;
import org.netbeans.api.lexer.TokenSequence;
import static org.netbeans.modules.javafx.editor.completion.JavaFXCompletionQuery.*;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import javax.lang.model.element.*;
import static javax.lang.model.element.Modifier.*;
import javax.lang.model.type.*;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.api.javafx.editor.Cancellable;
import org.netbeans.api.javafx.editor.FXSourceUtils;
import org.netbeans.api.javafx.editor.SafeTokenSequence;
import org.netbeans.modules.parsing.api.Source;
import org.netbeans.modules.parsing.spi.ParseException;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
/**
* @author David Strupl, Anton Chechel
*/
public class JavaFXCompletionEnvironment<T extends Tree> {
private static final Logger logger = Logger.getLogger(JavaFXCompletionEnvironment.class.getName());
private static final boolean LOGGABLE = logger.isLoggable(Level.FINE);
private static final String[] PSEUDO_VARS = new String[] {
"__DIR__", "__FILE__", "__PROFILE__" // NOI18N
};
private static int usingSanitizedSource = 0;
protected int offset;
protected String prefix;
protected boolean isCamelCasePrefix;
protected CompilationController controller;
protected JavaFXTreePath path;
protected SourcePositions sourcePositions;
protected boolean insideForEachExpressiion = false;
protected UnitTree root;
protected JavaFXCompletionQuery query;
protected Cancellable cancellable;
protected JavaFXCompletionEnvironment() {
}
/*
* Thies method must be called after constructor before a call to resolveCompletion
*/
void init(int offset, String prefix, CompilationController controller, JavaFXTreePath path, SourcePositions sourcePositions, final JavaFXCompletionQuery query) {
this.offset = offset;
this.prefix = prefix;
this.isCamelCasePrefix = prefix != null && prefix.length() > 1 && JavaFXCompletionQuery.camelCasePattern.matcher(prefix).matches();
this.controller = controller;
this.path = path;
this.sourcePositions = sourcePositions;
this.query = query;
this.root = path.getCompilationUnit();
this.cancellable = new Cancellable() {
public boolean isCancelled() {
return query.isTaskCancelled0();
}
public void cancell() {
// do nothing for now
}
};
}
/**
* This method should be overriden in subclasses
*/
protected void inside(T t) throws IOException {
if (LOGGABLE) log(NbBundle.getBundle("org/netbeans/modules/javafx/editor/completion/Bundle").getString("NOT_IMPLEMENTED_") + t.getJavaFXKind() + " inside " + t); // NOI18N
}
protected void insideFunctionBlock(List<ExpressionTree> statements) throws IOException {
ExpressionTree last = null;
for (ExpressionTree stat : statements) {
int pos = (int) sourcePositions.getStartPosition(root, stat);
if (pos == Diagnostic.NOPOS || offset <= pos) {
break;
}
last = stat;
}
if (last != null && last.getJavaFXKind() == Tree.JavaFXKind.TRY) {
if (((TryTree) last).getFinallyBlock() == null) {
addKeyword(CATCH_KEYWORD, null, false);
addKeyword(FINALLY_KEYWORD, null, false);
if (((TryTree) last).getCatches().size() == 0) {
return;
}
}
}
localResult(null);
addKeywordsForStatement();
}
public int getOffset() {
return offset;
}
public String getPrefix() {
return prefix;
}
public boolean isCamelCasePrefix() {
return isCamelCasePrefix;
}
public CompilationController getController() {
return controller;
}
public UnitTree getRoot() {
return root;
}
public JavaFXTreePath getPath() {
return path;
}
public SourcePositions getSourcePositions() {
return sourcePositions;
}
public void insideForEachExpressiion() {
this.insideForEachExpressiion = true;
}
public boolean isInsideForEachExpressiion() {
return insideForEachExpressiion;
}
/**
* If the tree is broken we are in fact not in the compilation unit.
* @param env
* @return
*/
protected boolean isTreeBroken() {
int start = (int) sourcePositions.getStartPosition(root, root);
int end = (int) sourcePositions.getEndPosition(root, root);
if (LOGGABLE) log("isTreeBroken start: " + start + " end: " + end); // NOI18N
return start == -1 || end == -1;
}
protected String fullName(Tree tree) {
switch (tree.getJavaFXKind()) {
case IDENTIFIER:
return ((IdentifierTree) tree).getName().toString();
case MEMBER_SELECT:
String sname = fullName(((MemberSelectTree) tree).getExpression());
return sname == null ? null : sname + '.' + ((MemberSelectTree) tree).getIdentifier(); // NOI18N
default:
return null;
}
}
void insideTypeCheck() throws IOException {
InstanceOfTree iot = (InstanceOfTree) getPath().getLeaf();
SafeTokenSequence<JFXTokenId> ts = findLastNonWhitespaceToken(iot, getOffset());
}
protected void insideExpression(JavaFXTreePath exPath) throws IOException {
if (LOGGABLE) log("insideExpression " + exPath.getLeaf()); // NOI18N
Tree et = exPath.getLeaf();
Tree parent = exPath.getParentPath().getLeaf();
int endPos = (int) getSourcePositions().getEndPosition(root, et);
if (endPos != Diagnostic.NOPOS && endPos < offset) {
SafeTokenSequence<JFXTokenId> last = findLastNonWhitespaceToken(endPos, offset);
if (LOGGABLE) log(" last: " + last); // NOI18N
if (last != null) {
return;
}
}
if (LOGGABLE) log(NbBundle.getBundle("org/netbeans/modules/javafx/editor/completion/Bundle").getString("NOT_IMPLEMENTED:_insideExpression_") + exPath.getLeaf()); // NOI18N
}
protected void addResult(JavaFXCompletionItem i) {
query.results.add(i);
}
protected void addMembers(final TypeMirror type, final boolean methods, final boolean fields) {
JavafxcScope sc = controller.getTreeUtilities().getScope(path);
if (LOGGABLE) log(" addMembers scope was computed from path == " + path.getLeaf()); // NOI18N
boolean isStatic = controller.getTreeUtilities().isStaticContext(sc);
if (path.getLeaf() != null && path.getLeaf().toString().startsWith("variable initialization for static script only (default) var")) { // NOI18N
isStatic = true;
}
if (LOGGABLE) log(" isStatic == " + isStatic); // NOI18N
addMembers(type, methods, fields, null,sc, true, !isStatic);
}
protected void addMembers(final TypeMirror type,
final boolean methods, final boolean fields,
final String textToAdd, JavafxcScope scope,boolean statics, boolean instance) {
if (LOGGABLE) log("addMembers: " + type); // NOI18N
if (type == null || type.getKind() != TypeKind.DECLARED) {
if (LOGGABLE) log("RETURNING: type.getKind() == " + (type != null ? type.getKind() : " type is null")); // NOI18N
return;
}
DeclaredType dt = (DeclaredType) type;
if (LOGGABLE) log(" elementKind == " + dt.asElement().getKind()); // NOI18N
final ElementKind kind = dt.asElement().getKind();
if (kind != ElementKind.CLASS && kind != ElementKind.ENUM) {
return;
}
Elements elements = controller.getElements();
final TypeElement te = (TypeElement) dt.asElement();
for (Element member : te.getEnclosedElements()) {
if (LOGGABLE) log(" member1 = " + member + " member1.getKind() " + member.getKind()); // NOI18N
String s = member.getSimpleName().toString();
if ("<error>".equals(s)) { // NOI18N
continue;
}
// #164909 - prevent internal SDK vars "VCNT$" and "VOFF$"
if (s != null && s.indexOf('$') != -1) {
continue;
}
boolean isStatic = member.getModifiers().contains(STATIC);
if (!controller.getTreeUtilities().isAccessible(scope, member, dt)) {
if (LOGGABLE) log(" not accessible " + s); // NOI18N
continue;
}
if (isStatic && !statics) {
if (LOGGABLE) log(" is static and we don't want them " + s); // NOI18N
continue;
}
if (!isStatic && !instance) {
if (LOGGABLE) log(" is instance and we don't want them " + s); // NOI18N
continue;
}
// Once source code uses either __FILE__ or __DIR__ pseudo
// variables, compiler will generate their definitions in the
// current block expression. When the source code does not contain
// them they are not generated and since would not be offered by
// code completion. Thus we provide pseudo variables explicitly, so
// skip them here.
if (isPseudoVariable(s)) {
continue;
}
String tta = textToAdd;
if (fields && (member.getKind() == ElementKind.FIELD || member.getKind() == ElementKind.ENUM_CONSTANT)) {
if (JavaFXCompletionProvider.startsWith(s, getPrefix())) {
if (":".equals(textToAdd)) { // NOI18N
JavafxTypes types = controller.getJavafxTypes();
TypeMirror tm = member.asType();
if (types.isSequence((Type) tm)) {
tta += " []"; // NOI18N
}
}
ElementHandle eh = null;
try {
eh = ElementHandle.create(member);
} catch (Exception ex) {
// cannot convert --> ignore
}
if (eh != null) {
addResult(JavaFXCompletionItem.createVariableItem(eh, member.asType(), s, query.anchorOffset, tta, true));
}
}
}
boolean classes = true;
if (classes && (member.getKind() == ElementKind.CLASS)) {
if (JavaFXCompletionProvider.startsWith(s, getPrefix())) {
ElementHandle eh = null;
try {
eh = ElementHandle.create(member);
} catch (Exception ex) {
// cannot convert --> ignore
}
TypeMirror mtm = member.asType();
DeclaredType mdt = (DeclaredType) mtm;
TypeElement mte = (TypeElement) mdt.asElement();
if (eh != null) {
addResult(JavaFXCompletionItem.createTypeItem(s, offset, false, false, false));
}
}
}
}
for (Element member : FXSourceUtils.getAllMembers(elements, te)) {
if (LOGGABLE) log(" member2 == " + member + " member2.getKind() " + member.getKind()); // NOI18N
String s = member.getSimpleName().toString();
if ("<error>".equals(s)) { // NOI18N
continue;
}
// #164909 - prevent internal SDK vars "VCNT$" and "VOFF$"
if (s != null && s.indexOf('$') != -1) {
continue;
}
if (!controller.getTreeUtilities().isAccessible(scope, member, dt)) {
if (LOGGABLE) log(" not accessible " + s); // NOI18N
continue;
}
boolean isStatic = member.getModifiers().contains(STATIC);
if (isStatic && !statics) {
if (LOGGABLE) log(" is static and we don't want them " + s); // NOI18N
continue;
}
if (!isStatic && !instance) {
if (LOGGABLE) log(" is instance and we don't want them " + s); // NOI18N
continue;
}
// Once source code uses either __FILE__ or __DIR__ pseudo
// variables, compiler will generate their definitions in the
// current block expression. When the source code does not contain
// them they are not generated and since would not be offered by
// code completion. Thus we provide pseudo variables explicitly, so
// skip them here.
if (isPseudoVariable(s)) {
continue;
}
if (methods && member.getKind() == ElementKind.METHOD) {
if (s.contains("$")) { // NOI18N
continue;
}
if (JavaFXCompletionProvider.startsWith(s, getPrefix())) {
boolean isInherited = !te.equals(((Symbol) member.getEnclosingElement()).enclClass());
boolean isDeprecated = elements.isDeprecated(member);
addResult(
JavaFXCompletionItem.createExecutableItem(
(ExecutableElement) member,
(ExecutableType) member.asType(),
query.anchorOffset, isInherited, isDeprecated, false, false));
}
} else if (fields && member.getKind() == ElementKind.FIELD) {
String tta = textToAdd;
if (JavaFXCompletionProvider.startsWith(s, getPrefix())) {
if (":".equals(textToAdd)) { // NOI18N
JavafxTypes types = controller.getJavafxTypes();
TypeMirror tm = member.asType();
if (types.isSequence((Type) tm)) {
tta += " []"; // NOI18N
}
}
ElementHandle eh = null;
try {
eh = ElementHandle.create(member);
} catch (Exception ex) {
// cannot convert --> ignore
}
if (eh != null) {
addResult(JavaFXCompletionItem.createVariableItem(eh, member.asType(), s, query.anchorOffset, tta, false));
}
}
}
}
TypeMirror parent = te.getSuperclass();
if (parent != null) {
addMembers(parent, false, true, textToAdd, scope, statics, instance);
}
for (TypeMirror intf : te.getInterfaces()) {
addMembers(intf, false, true, textToAdd, scope, statics, instance);
}
}
protected void localResult(TypeMirror smart) {
addLocalMembersAndVars(smart);
addLocalAndImportedTypes(null, null, null, false, smart);
addLocalAndImportedFunctions();
}
protected void addMemberConstantsAndTypes(final TypeMirror type, final Element elem) throws IOException {
if (LOGGABLE) log("addMemberConstantsAndTypes: " + type + " elem: " + elem); // NOI18N
}
protected void addLocalMembersAndVars(TypeMirror smart) {
if (LOGGABLE) log("addLocalMembersAndVars: " + prefix); // NOI18N
final JavafxcTrees trees = controller.getTrees();
if (smart != null && smart.getKind() == TypeKind.DECLARED) {
if (LOGGABLE) log("adding declared type + subtypes: " + smart); // NOI18N
DeclaredType dt = (DeclaredType) smart;
TypeElement elem = (TypeElement) dt.asElement();
addResult(JavaFXCompletionItem.createTypeItem(elem, dt, query.anchorOffset, false, false, true, false));
for (DeclaredType subtype : getSubtypesOf((DeclaredType) smart)) {
TypeElement subElem = (TypeElement) subtype.asElement();
addResult(JavaFXCompletionItem.createTypeItem(subElem, subtype, query.anchorOffset, false, false, true, false));
}
}
for (JavaFXTreePath tp = getPath(); tp != null; tp = tp.getParentPath()) {
Tree t = tp.getLeaf();
if (LOGGABLE) log(" tree kind: " + t.getJavaFXKind()); // NOI18N
if (t instanceof UnitTree) {
UnitTree cut = (UnitTree) t;
for (Tree tt : cut.getTypeDecls()) {
if (LOGGABLE) log(" tt: " + tt); // NOI18N
JavaFXKind kk = tt.getJavaFXKind();
if (kk == JavaFXKind.CLASS_DECLARATION) {
JFXClassDeclaration cd = (JFXClassDeclaration) tt;
for (Tree jct : cd.getClassMembers()) {
if (LOGGABLE) log(" jct == " + jct); // NOI18N
JavaFXKind k = jct.getJavaFXKind();
if (LOGGABLE) log(" kind of jct = " + k); // NOI18N
if (k == JavaFXKind.FUNCTION_DEFINITION) {
JFXFunctionDefinition fdt = (JFXFunctionDefinition) jct;
if (LOGGABLE) log(" fdt == " + fdt.name.toString()); // NOI18N
if ("javafx$run$".equals(fdt.name.toString())) { // NOI18N
addBlockExpressionLocals(fdt.getBodyExpression(), tp, smart);
JavaFXTreePath mp = JavaFXTreePath.getPath(cut, tt);
TypeMirror tm = trees.getTypeMirror(mp);
if (LOGGABLE) log(" javafx$run$ tm == " + tm + " ---- tm.getKind() == " + (tm == null ? "null" : tm.getKind())); // NOI18N
JavaFXTreePath mp2 = JavaFXTreePath.getPath(cut, fdt);
addMembers(tm, true, true,
null, controller.getTreeUtilities().getScope(mp2),
true, false);
}
}
}
}
}
}
JavaFXKind k = t.getJavaFXKind();
if (LOGGABLE) log(" fx kind: " + k); // NOI18N
if (k == JavaFXKind.CLASS_DECLARATION) {
TypeMirror tm = trees.getTypeMirror(tp);
if (LOGGABLE) log(" tm == " + tm + " ---- tm.getKind() == " + (tm == null ? "null" : tm.getKind())); // NOI18N
addMembers(tm, true, true);
}
if (k == JavaFXKind.BLOCK_EXPRESSION) {
addBlockExpressionLocals((BlockExpressionTree) t, tp, smart);
}
if (k == JavaFXKind.FOR_EXPRESSION_FOR) {
ForExpressionTree fet = (ForExpressionTree) t;
if (LOGGABLE) log(" for expression: " + fet + "\n"); // NOI18N
for (ForExpressionInClauseTree fetic : fet.getInClauses()) {
if (LOGGABLE) log(" fetic: " + fetic + "\n"); // NOI18N
String s = fetic.getVariable().getName().toString();
if (LOGGABLE) log(" adding(2) " + s + " with prefix " + prefix); // NOI18N
TypeMirror tm = trees.getTypeMirror(new JavaFXTreePath(tp, fetic));
if (smart != null && tm != null && tm.getKind() == smart.getKind()) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s, query.anchorOffset, true));
}
if (JavaFXCompletionProvider.startsWith(s, prefix)) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s, query.anchorOffset, false));
}
}
}
if (k == JavaFXKind.FUNCTION_VALUE) {
FunctionValueTree fvt = (FunctionValueTree) t;
for (VariableTree var : fvt.getParameters()) {
if (LOGGABLE) log(" var: " + var + "\n"); // NOI18N
String s = var.getName().toString();
if (s.contains("$")) { // NOI18N
continue;
}
if (LOGGABLE) log(" adding(3) " + s + " with prefix " + prefix); // NOI18N
TypeMirror tm = trees.getTypeMirror(new JavaFXTreePath(tp, var));
if (smart != null && tm.getKind() == smart.getKind()) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s, query.anchorOffset, true));
}
if (JavaFXCompletionProvider.startsWith(s, prefix)) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s, query.anchorOffset, false));
}
}
}
if (k == JavaFXKind.ON_REPLACE) {
OnReplaceTree ort = (OnReplaceTree) t;
// commented out log because of JFXC-1205
// if (LOGGABLE) log(" OnReplaceTree: " + ort + "\n");
VariableTree varTree = ort.getNewElements();
if (varTree != null) {
String s1 = varTree.getName().toString();
if (LOGGABLE) log(" adyding(4) " + s1 + " with prefix " + prefix); // NOI18N
TypeMirror tm = trees.getTypeMirror(new JavaFXTreePath(tp, varTree));
if (smart != null && tm.getKind() == smart.getKind()) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s1, query.anchorOffset, true));
}
if (JavaFXCompletionProvider.startsWith(s1, prefix)) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s1, query.anchorOffset, false));
}
}
VariableTree varTree2 = ort.getOldValue();
if (varTree2 != null) {
String s2 = varTree2.getName().toString();
if (LOGGABLE) log(" adding(5) " + s2 + " with prefix " + prefix); // NOI18N
TypeMirror tm = trees.getTypeMirror(new JavaFXTreePath(tp, varTree2));
if (smart != null && tm.getKind() == smart.getKind()) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s2, query.anchorOffset, true));
}
if (JavaFXCompletionProvider.startsWith(s2, prefix)) {
addResult(JavaFXCompletionItem.createVariableItem(tm, s2, query.anchorOffset, false));
}
}
}
}
addPseudoVariables();
}
private void addBlockExpressionLocals(BlockExpressionTree bet, JavaFXTreePath tp, TypeMirror smart) {
if (LOGGABLE) log(" block expression: " + bet + "\n"); // NOI18N
for (ExpressionTree st : bet.getStatements()) {
addLocal(st, tp, smart);
}
addLocal(bet.getValue(), tp, smart);
}
private void addLocal(ExpressionTree st, JavaFXTreePath tp, TypeMirror smart) {
if (st == null) {
return;
}
JavaFXTreePath expPath = new JavaFXTreePath(tp, st);
if (LOGGABLE) log(" expPath == " + expPath.getLeaf()); // NOI18N
JavafxcTrees trees = controller.getTrees();
Element type = trees.getElement(expPath);
if (type == null) {
return;
}
if (LOGGABLE) log(" type.getKind() == " + type.getKind()); // NOI18N
if (type.getKind() == ElementKind.LOCAL_VARIABLE || type.getKind() == ElementKind.FIELD) {
final Name simpleName = type.getSimpleName();
if (simpleName == null) {
return;
}
String s = simpleName.toString();
// Once source code uses either __FILE__ or __DIR__ pseudo
// variables, compiler will generate their definitions in the
// current block expression. When the source code does not contain
// them they are not generated and since would not be offered by
// code completion. Thus we provide pseudo variables explicitly, so
// skip them here.
if (isPseudoVariable(s)) {
return;
}
if (LOGGABLE) log(" adding(1) " + s + " with prefix " + prefix); // NOI18N
TypeMirror tm = trees.getTypeMirror(expPath);
if (smart != null && tm != null && tm.getKind() == smart.getKind()) {
addResult(JavaFXCompletionItem.createVariableItem(tm,
s, query.anchorOffset, true));
}
if (JavaFXCompletionProvider.startsWith(s, getPrefix())) {
addResult(JavaFXCompletionItem.createVariableItem(tm,
s, query.anchorOffset, false));
}
}
}
private boolean isPseudoVariable(final String s) {
return Arrays.binarySearch(PSEUDO_VARS, s) >= 0;
}
protected void addPackages(String fqnPrefix) {
if (LOGGABLE) log("addPackages " + fqnPrefix); // NOI18N
if (fqnPrefix == null) {
fqnPrefix = ""; // NOI18N
}
ClasspathInfo info = controller.getClasspathInfo();
ArrayList<FileObject> fos = new ArrayList<FileObject>();
ClassPath cp = info.getClassPath(PathKind.SOURCE);
fos.addAll(Arrays.asList(cp.getRoots()));
cp = info.getClassPath(PathKind.COMPILE);
fos.addAll(Arrays.asList(cp.getRoots()));
cp = info.getClassPath(PathKind.BOOT);
fos.addAll(Arrays.asList(cp.getRoots()));
String pr = ""; // NOI18N
if (fqnPrefix.lastIndexOf('.') >= 0) { // NOI18N
pr = fqnPrefix.substring(0, fqnPrefix.lastIndexOf('.')); // NOI18N
}
if (LOGGABLE) log(" pr == " + pr); // NOI18N
for (String name : pr.split("\\.")) { // NOI18N
ArrayList<FileObject> newFos = new ArrayList<FileObject>();
if (LOGGABLE) log(" traversing to " + name); // NOI18N
for (FileObject f : fos) {
if (f.isFolder()) {
FileObject child = f.getFileObject(name);
if (child != null) {
newFos.add(child);
}
}
}
if (LOGGABLE) log(" replacing " + fos + "\n with " + newFos); // NOI18N
fos = newFos;
}
for (FileObject fo : fos) {
if (fo.isFolder()) {
for (FileObject child : fo.getChildren()) {
if (child.isFolder()) {
if (LOGGABLE) log(" found : " + child); // NOI18N
if (("META-INF".equals(child.getName())) || // NOI18N
("doc-files".equals(child.getName()))) { // NOI18N
continue;
}
String s = child.getPath().replace('/', '.'); // NOI18N
if (s.startsWith(fqnPrefix)) {
addResult(JavaFXCompletionItem.createPackageItem(s, query.anchorOffset, false));
}
}
}
}
}
}
protected List<DeclaredType> getSubtypesOf(DeclaredType baseType) {
if (LOGGABLE) log(NbBundle.getBundle("org/netbeans/modules/javafx/editor/completion/Bundle").getString("NOT_IMPLEMENTED:_getSubtypesOf_") + baseType); // NOI18N
return Collections.emptyList();
}
void resolveToolTip(final CompilationController controller) throws IOException {
Phase resPhase = controller.toPhase(Phase.ANALYZED);
if ((resPhase.lessThan(Phase.ANALYZED)) || (isTreeBroken())) {
if (LOGGABLE) log("resolveToolTip: phase: " + resPhase); // NOI18N
return;
}
if (LOGGABLE) {
log(" resolveToolTip start"); // NOI18N
}
Tree lastTree = null;
while (path != null) {
Tree tree = path.getLeaf();
if (LOGGABLE) log(" resolveToolTip on " + tree.getJavaFXKind()); // NOI18N
if (tree.getJavaFXKind() == Tree.JavaFXKind.METHOD_INVOCATION) {
FunctionInvocationTree mi = (FunctionInvocationTree) tree;
int startPos = lastTree != null ? (int) sourcePositions.getStartPosition(root, lastTree) : offset;
if (LOGGABLE) log(" startPos == " + startPos); // NOI18N
List<Tree> argTypes = getArgumentsUpToPos(mi.getArguments(), (int) sourcePositions.getEndPosition(root, mi.getMethodSelect()), startPos);
if (LOGGABLE) log(" argTypes = " + argTypes); // NOI18N
if (argTypes != null) {
TypeMirror[] types = new TypeMirror[argTypes.size()];
int j = 0;
for (Tree t : argTypes) {
types[j++] = controller.getTrees().getTypeMirror(JavaFXTreePath.getPath(root, t));
if (LOGGABLE) {
log(" types[j-1] == " + types[j-1]); // NOI18N
}
}
List<List<String>> params = null;
Tree mid = mi.getMethodSelect();
if (LOGGABLE) log(" mid == " + mid.getJavaFXKind() + mid); // NOI18N
if (LOGGABLE) {
log(" path " + path); // NOI18N
if (path != null) {
log(" path.getLeaf() == " + path.getLeaf()); // NOI18N
}
}
path = new JavaFXTreePath(path, mid);
switch (mid.getJavaFXKind()) {
case MEMBER_SELECT: {
ExpressionTree exp = ((MemberSelectTree) mid).getExpression();
path = new JavaFXTreePath(path, exp);
if (LOGGABLE) log(" path == " + path.getLeaf()); // NOI18N
JavafxcTrees trees = controller.getTrees();
final TypeMirror type = trees.getTypeMirror(path);
if (LOGGABLE) log(" type == " + type); // NOI18N
final Element element = trees.getElement(path);
if (LOGGABLE) log(" element == " + element); // NOI18N
final boolean isStatic = element != null && (element.getKind().isClass() || element.getKind().isInterface());
if (LOGGABLE) log(" isStatic == " + isStatic); // NOI18N
final boolean isSuperCall = element != null && element.getKind().isField() && element.getSimpleName().contentEquals(SUPER_KEYWORD);
final JavafxcScope scope = controller.getTreeUtilities().getScope(path);
if (LOGGABLE) log(" scope == " + scope); // NOI18N
final TreeUtilities tu = controller.getTreeUtilities();
TypeElement enclClass = scope.getEnclosingClass();
final TypeMirror enclType = enclClass != null ? enclClass.asType() : null;
ElementUtilities.ElementAcceptor acceptor = new ElementUtilities.ElementAcceptor() {
public boolean accept(Element e, TypeMirror t) {
boolean res = (!isStatic || e.getModifiers().contains(STATIC)) && tu.isAccessible(scope, e, isSuperCall && enclType != null ? enclType : t);
if (LOGGABLE) {
log(" accept for " + e + " on " + t); // NOI18N
log(" returning " + res); // NOI18N
}
return res;
}
};
params = getMatchingParams(type, controller.getElementUtilities().getMembers(type, acceptor), ((MemberSelectTree) mid).getIdentifier().toString(), types, controller.getTypes());
if (LOGGABLE) log(" params == " + params); // NOI18N
break;
}
case IDENTIFIER: {
final JavafxcScope scope = controller.getTreeUtilities().getScope(path);
if (LOGGABLE) log(" scope (2) == " + scope); // NOI18N
final TreeUtilities tu = controller.getTreeUtilities();
final TypeElement enclClass = scope.getEnclosingClass();
final boolean isStatic = enclClass != null ? (tu.isStaticContext(scope) || (path.getLeaf().getJavaFXKind() == Tree.JavaFXKind.BLOCK_EXPRESSION && ((BlockExpressionTree) path.getLeaf()).isStatic())) : false;
final ExecutableElement method = scope.getEnclosingMethod();
ElementUtilities.ElementAcceptor acceptor = new ElementUtilities.ElementAcceptor() {
public boolean accept(Element e, TypeMirror t) {
switch (e.getKind()) {
case CONSTRUCTOR:
return !e.getModifiers().contains(PRIVATE);
case METHOD:
return (!isStatic || e.getModifiers().contains(STATIC)) && tu.isAccessible(scope, e, t);
default:
return false;
}
}
};
String name = ((IdentifierTree) mid).getName().toString();
params = getMatchingParams(enclClass != null ? enclClass.asType() : null, controller.getElementUtilities().getLocalMembersAndVars(scope, acceptor), name, types, controller.getTypes());
if (LOGGABLE) log(" params (2) == " + params); // NOI18N
break;
}
}
if (LOGGABLE) log(" params (3) == " + params); // NOI18N
if (params != null) {
query.toolTip = new MethodParamsTipPaintComponent(params, types.length, query.component);
}
startPos = (int) sourcePositions.getEndPosition(root, mi.getMethodSelect());
String text = controller.getText().subSequence(startPos, offset).toString();
query.anchorOffset = startPos + text.indexOf('('); //NOI18N
query.toolTipOffset = startPos + text.lastIndexOf(','); //NOI18N
if (query.toolTipOffset < query.anchorOffset) {
query.toolTipOffset = query.anchorOffset;
}
return;
}
}
lastTree = tree;
path = path.getParentPath();
}
}
protected void addMethodArguments(FunctionInvocationTree mit) throws IOException {
if (LOGGABLE) log("addMethodArguments " + mit); // NOI18N
List<Tree> argTypes = getArgumentsUpToPos(mit.getArguments(), (int)sourcePositions.getEndPosition(root, mit.getMethodSelect()), offset);
JavafxcTrees trees = controller.getTrees();
if (argTypes != null) {
TypeMirror[] types = new TypeMirror[argTypes.size()];
int j = 0;
for (Tree t : argTypes) {
JavaFXTreePath jfxtp = new JavaFXTreePath(path, t);
if (LOGGABLE) log(" jfxtp == " + jfxtp.getLeaf()); // NOI18N
types[j++] = controller.getTrees().getTypeMirror(jfxtp);
if (LOGGABLE) log(" types[j-1] == " + types[j-1]); // NOI18N
}
List<Pair<ExecutableElement, ExecutableType>> methods = null;
String name = null;
Tree mid = mit.getMethodSelect();
if (LOGGABLE) {
log(" path " + path); // NOI18N
if (path != null) {
log(" path.getLeaf() == " + path.getLeaf()); // NOI18N
}
}
path = new JavaFXTreePath(path, mid);
switch (mid.getJavaFXKind()) {
case MEMBER_SELECT: {
ExpressionTree exp = ((MemberSelectTree)mid).getExpression();
path = new JavaFXTreePath(path, exp);
final TypeMirror type = trees.getTypeMirror(path);
final Element element = trees.getElement(path);
final boolean isStatic = element != null && (element.getKind().isClass() || element.getKind().isInterface());
final boolean isSuperCall = element != null && element.getKind().isField() && element.getSimpleName().contentEquals(SUPER_KEYWORD);
final TreeUtilities tu = controller.getTreeUtilities();
final JavafxcScope scope = tu.getScope(path);
TypeElement enclClass = scope.getEnclosingClass();
final TypeMirror enclType = enclClass != null ? enclClass.asType() : null;
ElementUtilities.ElementAcceptor acceptor = new ElementUtilities.ElementAcceptor() {
public boolean accept(Element e, TypeMirror t) {
return (!isStatic || e.getModifiers().contains(STATIC) ) && tu.isAccessible(scope, e, isSuperCall && enclType != null ? enclType : t);
}
};
methods = getMatchingExecutables(type, controller.getElementUtilities().getMembers(type, acceptor), ((MemberSelectTree)mid).getIdentifier().toString(), types, controller.getTypes());
break;
}
case IDENTIFIER: {
final TreeUtilities tu = controller.getTreeUtilities();
final JavafxcScope scope = tu.getScope(path);
final TypeElement enclClass = scope.getEnclosingClass();
final boolean isStatic = enclClass != null ? (tu.isStaticContext(scope) || (path.getLeaf().getJavaFXKind() == JavaFXKind.BLOCK_EXPRESSION && ((BlockExpressionTree)path.getLeaf()).isStatic())) : false;
final ExecutableElement method = scope.getEnclosingMethod();
ElementUtilities.ElementAcceptor acceptor = new ElementUtilities.ElementAcceptor() {
public boolean accept(Element e, TypeMirror t) {
switch (e.getKind()) {
case LOCAL_VARIABLE:
case EXCEPTION_PARAMETER:
case PARAMETER:
return (method == e.getEnclosingElement() || e.getModifiers().contains(FINAL));
case FIELD:
if (e.getSimpleName().contentEquals(THIS_KEYWORD) || e.getSimpleName().contentEquals(SUPER_KEYWORD))
return !isStatic;
}
return (!isStatic || e.getModifiers().contains(STATIC)) && tu.isAccessible(scope, e, t);
}
};
name = ((IdentifierTree)mid).getName().toString();
if (SUPER_KEYWORD.equals(name) && enclClass != null) {
TypeMirror superclass = enclClass.getSuperclass();
methods = getMatchingExecutables(superclass, controller.getElementUtilities().getMembers(superclass, acceptor), INIT, types, controller.getTypes());
} else if (THIS_KEYWORD.equals(name) && enclClass != null) {
TypeMirror thisclass = enclClass.asType();
methods = getMatchingExecutables(thisclass, controller.getElementUtilities().getMembers(thisclass, acceptor), INIT, types, controller.getTypes());
} else {
Iterable<? extends Element> locals = controller.getElementUtilities().getLocalMembersAndVars(scope, acceptor);
methods = getMatchingExecutables(enclClass != null ? enclClass.asType() : null, locals, name, types, controller.getTypes());
name = null;
}
break;
}
}
if (methods != null) {
Elements elements = controller.getElements();
for (Pair<ExecutableElement, ExecutableType> method : methods)
addResult(JavaFXCompletionItem.createParametersItem(method.a, method.b, query.anchorOffset, elements.isDeprecated(method.a), types.length, name));
}
}
}
private List<Tree> getArgumentsUpToPos(Iterable<? extends ExpressionTree> args, int startPos, int position) {
List<Tree> ret = new ArrayList<Tree>();
for (ExpressionTree e : args) {
int pos = (int)sourcePositions.getEndPosition(root, e);
if (pos != Diagnostic.NOPOS && position > pos) {
startPos = pos;
ret.add(e);
}
}
if (startPos < 0)
return ret;
if (position > startPos) {
SafeTokenSequence<JFXTokenId> last = findLastNonWhitespaceToken(startPos, position);
if (last != null && (last.token().id() == JFXTokenId.LPAREN || last.token().id() == JFXTokenId.COMMA))
return ret;
}
return null;
}
private List<Pair<ExecutableElement, ExecutableType>> getMatchingExecutables(TypeMirror type, Iterable<? extends Element> elements, String name, TypeMirror[] argTypes, Types types) {
List<Pair<ExecutableElement, ExecutableType>> ret = new ArrayList<Pair<ExecutableElement, ExecutableType>>();
for (Element e : elements) {
if ((e.getKind() == ElementKind.CONSTRUCTOR || e.getKind() == ElementKind.METHOD) && name.contentEquals(e.getSimpleName())) {
List<? extends VariableElement> params = ((ExecutableElement)e).getParameters();
int parSize = params.size();
boolean varArgs = ((ExecutableElement)e).isVarArgs();
if (!varArgs && (parSize < argTypes.length)) {
continue;
}
ExecutableType eType = (ExecutableType)asMemberOf(e, type, types);
if (parSize == 0) {
ret.add(new Pair<ExecutableElement,ExecutableType>((ExecutableElement)e, eType));
} else {
Iterator<? extends TypeMirror> parIt = eType.getParameterTypes().iterator();
TypeMirror param = null;
for (int i = 0; i <= argTypes.length; i++) {
if (parIt.hasNext()) {
param = parIt.next();
// if (!parIt.hasNext() && param.getKind() == TypeKind.ARRAY)
// param = ((ArrayType)param).getComponentType();
} else if (!varArgs) {
break;
}
if (i == argTypes.length) {
ret.add(new Pair<ExecutableElement, ExecutableType>((ExecutableElement)e, eType));
break;
}
if (argTypes[i] == null || !types.isAssignable(argTypes[i], param))
break;
}
}
}
}
return ret;
}
private List<List<String>> getMatchingParams(TypeMirror type, Iterable<? extends Element> elements, String name, TypeMirror[] argTypes, Types types) {
if (LOGGABLE) log("getMatchingParams type == " + type + " name == " + name); // NOI18N
List<List<String>> ret = new ArrayList<List<String>>();
for (Element e : elements) {
if (LOGGABLE) log(" e == " + e); // NOI18N
if ((e.getKind() == ElementKind.CONSTRUCTOR || e.getKind() == ElementKind.METHOD) && name.contentEquals(e.getSimpleName())) {
List<? extends VariableElement> params = ((ExecutableElement)e).getParameters();
int parSize = params.size();
if (LOGGABLE) log(" parSize == " + parSize); // NOI18N
boolean varArgs = ((ExecutableElement)e).isVarArgs();
if (!varArgs && (parSize < argTypes.length)) {
continue;
}
if (parSize == 0) {
ret.add(Collections.<String>singletonList(NbBundle.getMessage(JavaFXCompletionProvider.class, "JCP-no-parameters"))); // NOI18N
} else {
TypeMirror tm = asMemberOf(e, type, types);
if (!(tm instanceof ExecutableType)) continue; // error type, #173250
ExecutableType eType = (ExecutableType)tm;
if (LOGGABLE) log(" eType == " + eType); // NOI18N
Iterator<? extends TypeMirror> parIt = eType.getParameterTypes().iterator();
TypeMirror param = null;
for (int i = 0; i <= argTypes.length; i++) {
log(" i == " + i); // NOI18N
if (parIt.hasNext()) {
param = parIt.next();
if (LOGGABLE) log(" param == " + param); // NOI18N
if (!parIt.hasNext() && param.getKind() == TypeKind.ARRAY)
param = ((ArrayType)param).getComponentType();
} else if (!varArgs) {
break;
}
if (i == argTypes.length) {
if (LOGGABLE) log(" i == argTypes.length"); // NOI18N
List<String> paramStrings = new ArrayList<String>(parSize);
Iterator<? extends TypeMirror> tIt = eType.getParameterTypes().iterator();
for (Iterator<? extends VariableElement> it = params.iterator(); it.hasNext();) {
VariableElement ve = it.next();
StringBuffer sb = new StringBuffer();
sb.append(tIt.next());
if (varArgs && !tIt.hasNext())
sb.delete(sb.length() - 2, sb.length()).append("..."); //NOI18N
CharSequence veName = ve.getSimpleName();
if (veName != null && veName.length() > 0) {
sb.append(" "); // NOI18N
sb.append(veName);
}
if (it.hasNext()) {
sb.append(", "); // NOI18N
}
paramStrings.add(sb.toString());
}
ret.add(paramStrings);
break;
}
if (LOGGABLE) log(" will check " + argTypes[i] + " " + param); // NOI18N
if (argTypes[i] != null && !types.isAssignable(argTypes[i], param)) {
break;
}
}
}
} else {
if (LOGGABLE) log(" e.getKind() == " + e.getKind()); // NOI18N
}
}
return ret.isEmpty() ? null : ret;
}
// private Set<TypeMirror> getMatchingArgumentTypes(TypeMirror type, Iterable<? extends Element> elements, String name, TypeMirror[] argTypes, TypeMirror[] typeArgTypes, Types types, TypeUtilities tu) {
// Set<TypeMirror> ret = new HashSet<TypeMirror>();
// for (Element e : elements) {
// if ((e.getKind() == CONSTRUCTOR || e.getKind() == METHOD) && name.contentEquals(e.getSimpleName())) {
// List<? extends VariableElement> params = ((ExecutableElement)e).getParameters();
// int parSize = params.size();
// boolean varArgs = ((ExecutableElement)e).isVarArgs();
// if (!varArgs && (parSize <= argTypes.length))
// continue;
// ExecutableType meth = (ExecutableType)asMemberOf(e, type, types);
// Iterator<? extends TypeMirror> parIt = meth.getParameterTypes().iterator();
// TypeMirror param = null;
// for (int i = 0; i <= argTypes.length; i++) {
// if (parIt.hasNext())
// param = parIt.next();
// else if (!varArgs)
// break;
// if (i == argTypes.length) {
// if (typeArgTypes != null && param.getKind() == TypeKind.DECLARED && typeArgTypes.length == meth.getTypeVariables().size())
// param = tu.substitute(param, meth.getTypeVariables(), Arrays.asList(typeArgTypes));
// TypeMirror toAdd = null;
// if (i < parSize)
// toAdd = param;
// if (varArgs && !parIt.hasNext() && param.getKind() == TypeKind.ARRAY)
// toAdd = ((ArrayType)param).getComponentType();
// if (toAdd != null && ret.add(toAdd)) {
// TypeMirror toRemove = null;
// for (TypeMirror tm : ret) {
// if (tm != toAdd) {
// TypeMirror tmErasure = types.erasure(tm);
// TypeMirror toAddErasure = types.erasure(toAdd);
// if (types.isSubtype(toAddErasure, tmErasure)) {
// toRemove = toAdd;
// break;
// } else if (types.isSubtype(tmErasure, toAddErasure)) {
// toRemove = tm;
// break;
// }
// }
// }
// if (toRemove != null)
// ret.remove(toRemove);
// }
// break;
// }
// if (argTypes[i] == null)
// break;
// if (varArgs && !parIt.hasNext() && param.getKind() == TypeKind.ARRAY) {
// if (types.isAssignable(argTypes[i], param))
// varArgs = false;
// else if (!types.isAssignable(argTypes[i], ((ArrayType)param).getComponentType()))
// break;
// } else if (!types.isAssignable(argTypes[i], param))
// break;
// }
// }
// }
// return ret.isEmpty() ? null : ret;
// }
protected void addKeyword(String kw, String postfix, boolean smartType) {
if (JavaFXCompletionProvider.startsWith(kw, prefix)) {
addResult(JavaFXCompletionItem.createKeywordItem(kw, postfix, query.anchorOffset, smartType));
}
}
protected void addKeywordsForClassBody() {
if (LOGGABLE) log("addKeywordsForClassBody"); // NOI18N
addKeyword(ABSTRACT_KEYWORD, SPACE, false);
addKeyword(OVERRIDE_KEYWORD, SPACE, false);
addAccessModifiers(null);
addVarAccessModifiers(null, false);
addKeyword(INIT_KEYWORD, SPACE, false);
addKeyword(POSTINIT_KEYWORD, SPACE, false);
addKeyword(VAR_KEYWORD, SPACE, false);
addKeyword(DEF_KEYWORD, SPACE, false);
addKeyword(FUNCTION_KEYWORD, SPACE, false);
}
@SuppressWarnings("fallthrough")
protected void addKeywordsForStatement() {
if (LOGGABLE) log("addKeywordsForStatement"); // NOI18N
addKeyword(FOR_KEYWORD, " (", false); // NOI18N
addKeyword(IF_KEYWORD, " (", false); // NOI18N
addKeyword(WHILE_KEYWORD, " (", false); // NOI18N
addKeyword(TRY_KEYWORD, " {", false); // NOI18N
addKeyword(INSERT_KEYWORD, SPACE, false);
addKeyword(DELETE_KEYWORD, SPACE, false);
addKeyword(NEW_KEYWORD, SPACE, false);
addKeyword(REVERSE_KEYWORD, SPACE, false);
addKeyword(THROW_KEYWORD, SPACE, false);
addKeyword(VAR_KEYWORD, SPACE, false);
if (JavaFXCompletionProvider.startsWith(RETURN_KEYWORD, prefix)) {
JavaFXTreePath mth = JavaFXCompletionProvider.getPathElementOfKind(Tree.JavaFXKind.FUNCTION_DEFINITION, path);
if (LOGGABLE) log(" mth == " + mth); // NOI18N
String postfix = SPACE;
if (mth != null) {
Tree rt = ((FunctionDefinitionTree) mth.getLeaf()).getFunctionValue().getType();
if (LOGGABLE) log(" rt == " + rt + " kind == " + (rt == null?"":rt.getJavaFXKind())); // NOI18N
if ((rt == null) || (rt.getJavaFXKind() == JavaFXKind.TYPE_UNKNOWN)) {
postfix = SEMI;
}
// TODO: handle Void return type ...
}
addResult(JavaFXCompletionItem.createKeywordItem(RETURN_KEYWORD, postfix, query.anchorOffset, false));
}
JavaFXTreePath tp = getPath();
while (tp != null) {
switch (tp.getLeaf().getJavaFXKind()) {
case FOR_EXPRESSION_IN_CLAUSE:
case FOR_EXPRESSION_FOR:
case WHILE_LOOP:
addKeyword(BREAK_KEYWORD, SEMI, false);
addKeyword(CONTINUE_KEYWORD, SEMI, false);
break;
/* case SWITCH:
addKeyword(BREAK_KEYWORD, SEMI, false);
break;*/
}
tp = tp.getParentPath();
}
}
protected void addValueKeywords() {
if (LOGGABLE) log("addValueKeywords"); // NOI18N
// TODO: add conditions when each of these can occur
addKeyword(FALSE_KEYWORD, null, false);
addKeyword(TRUE_KEYWORD, null, false);
addKeyword(NULL_KEYWORD, null, false);
addKeyword(NEW_KEYWORD, SPACE, false);
addKeyword(BIND_KEYWORD, SPACE, false);
addKeyword(FUNCTION_KEYWORD, SPACE, false);
}
protected void addAccessModifiers(Set<Modifier> modifiers) {
if (LOGGABLE) log("addAccessModifiers"); // NOI18N
if (modifiers == null || (
!modifiers.contains(PUBLIC) &&
!modifiers.contains(PRIVATE) &&
//!modifiers.contains(PACKAGE) &&
//TODO: 'package' keyword would be difficult to find since it's not in modifiers
!modifiers.contains(PROTECTED))) {
addKeyword(PUBLIC_KEYWORD, SPACE, false);
addKeyword(PACKAGE_KEYWORD, SPACE, false);
addKeyword(PROTECTED_KEYWORD, SPACE, false);
}
}
protected void addVarAccessModifiers(Set<Modifier> modifiers, boolean isOnScriptLevel) {
if (LOGGABLE) log("addVarAccessModifiers"); // NOI18N
if (modifiers == null || (
//!modifiers.contains(PUBLIC_READ) &&
//!modifiers.contains(PUBLIC_INIT) &&
//TODO: 'public-read' and 'public-init' keywords are not in modifiers
true)) {
addKeyword(PUBLIC_READ_KEYWORD, SPACE, false);
if (!isOnScriptLevel) {
addKeyword(PUBLIC_INIT_KEYWORD, SPACE, false);
}
}
}
protected void addFunctionModifiers(Set<Modifier> modifiers) {
if (LOGGABLE) log("addFunctionAccessModifiers"); // NOI18N
if (modifiers == null || (
!modifiers.contains(FINAL) && !modifiers.contains(ABSTRACT))) {
addKeyword(ABSTRACT_KEYWORD, SPACE, false);
}
addKeyword(BOUND_KEYWORD, SPACE, false);
addKeyword(OVERRIDE_KEYWORD, SPACE, false);
}
protected void addClassModifiers(Set<Modifier> modifiers) {
if (LOGGABLE) log("addClassModifiers"); // NOI18N
addAccessModifiers(modifiers);
if (modifiers == null || (
//!modifiers.contains(MIXIN) &&
//TODO: 'mixin' keywords are not in modifiers
!modifiers.contains(FINAL) &&
!modifiers.contains(ABSTRACT))) {
addKeyword(MIXIN_KEYWORD, SPACE, false);
addKeyword(ABSTRACT_KEYWORD, SPACE, false);
}
}
/**
* This methods hacks over issue #135926. To prevent NPE we first complete
* all symbols that are classes and not inner classes in a package.
* @param pe
* @return pe.getEnclosedElements() but without the NPE
*/
private List<? extends Element> getEnclosedElements(PackageElement pe) {
Symbol s = (Symbol)pe;
for (Scope.Entry e = s.members().elems; e != null; e = e.sibling) {
if (e.sym != null) {
try {
e.sym.complete();
} catch (RuntimeException x) {
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST,"Let's see whether we survive this: ",x); // NOI18N
}
}
}
}
return pe.getEnclosedElements();
}
protected void addPackageContent(PackageElement pe, EnumSet<ElementKind> kinds, DeclaredType baseType, boolean insideNew) {
if (LOGGABLE) log("addPackageContent " + pe); // NOI18N
Elements elements = controller.getElements();
JavafxTypes types = controller.getJavafxTypes();
JavafxcScope scope = controller.getTreeUtilities().getScope(path);
for (Element e : getEnclosedElements(pe)) {
if (e.getKind().isClass() || e.getKind() == ElementKind.INTERFACE) {
String name = e.getSimpleName().toString();
if (! controller.getTreeUtilities().isAccessible(scope, e)) {
if (LOGGABLE) log(" not accessible " + name); // NOI18N
continue;
}
if (JavaFXCompletionProvider.startsWith(name, prefix) &&
!name.contains("$")) { // NOI18N
addResult(JavaFXCompletionItem.createTypeItem((TypeElement) e, (DeclaredType) e.asType(), query.anchorOffset, elements.isDeprecated(e), insideNew, false, false));
}
for (Element ee : e.getEnclosedElements()) {
if (ee.getKind().isClass() || ee.getKind() == ElementKind.INTERFACE) {
String ename = ee.getSimpleName().toString();
if (!controller.getTreeUtilities().isAccessible(scope, ee)) {
if (LOGGABLE) log(" not accessible " + ename); // NOI18N
continue;
}
log(ename + " isJFXClass " + types.isJFXClass((Symbol) ee)); // NOI18N
if (JavaFXCompletionProvider.startsWith(ename, prefix) &&
types.isJFXClass((Symbol) ee)) {
addResult(JavaFXCompletionItem.createTypeItem((TypeElement) ee, (DeclaredType) ee.asType(), query.anchorOffset, elements.isDeprecated(ee), insideNew, false, false));
}
}
}
}
}
String pkgName = pe.getQualifiedName() + "."; //NOI18N
if (prefix != null && prefix.length() > 0) {
pkgName += prefix;
}
addPackages(pkgName);
}
protected void addBasicTypes() {
if (LOGGABLE) log("addBasicTypes "); // NOI18N
addBasicType("Boolean", "boolean"); // NOI18N
addBasicType("Integer", "int"); // NOI18N
addBasicType("Number", "float"); // NOI18N
addBasicType("String", "String"); // NOI18N
// new ones in 1.1:
addBasicType("Long", "long"); // NOI18N
addBasicType("Short", "short"); // NOI18N
addBasicType("Byte", "byte"); // NOI18N
addBasicType("Float", "float"); // NOI18N
addBasicType("Double", "double"); // NOI18N
addBasicType("Character", "char"); // NOI18N
}
private void addBasicType(String name1, String name2) {
if (LOGGABLE) log(" addBasicType " + name1 + " : " + name2); // NOI18N
JavafxcScope scope = controller.getTreeUtilities().getScope(path);
while (scope != null) {
if (LOGGABLE) log(" scope == " + scope); // NOI18N
for (Element local : scope.getLocalElements()) {
if (LOGGABLE) log(" local == " + local.getSimpleName() + " kind: " + local.getKind() + " class: " + local.getClass().getName() + " asType: " + local.asType()); // NOI18N
if (local.getKind().isClass() || local.getKind() == ElementKind.INTERFACE) {
if (! (local instanceof TypeElement)) {
if (LOGGABLE) log(" " + local.getSimpleName() + " not TypeElement"); // NOI18N
continue;
}
TypeElement te = (TypeElement) local;
String name = local.getSimpleName().toString();
if (name.equals(name2)) {
if (JavaFXCompletionProvider.startsWith(name1, prefix)) {
if (LOGGABLE) log(" found " + name1); // NOI18N
if (local.asType() == null || local.asType().getKind() != TypeKind.DECLARED) {
addResult(JavaFXCompletionItem.createTypeItem(name1, query.anchorOffset, false, false, true));
} else {
DeclaredType dt = (DeclaredType) local.asType();
addResult(JavaFXCompletionItem.createTypeItem(te, dt, query.anchorOffset, false, false, true, false));
}
return;
}
}
}
}
scope = scope.getEnclosingScope();
}
}
protected void addLocalAndImportedTypes(final EnumSet<ElementKind> kinds, final DeclaredType baseType, final Set<? extends Element> toExclude, boolean insideNew, TypeMirror smart) {
if (LOGGABLE) log("addLocalAndImportedTypes"); // NOI18N
JavafxcTrees trees = controller.getTrees();
JavafxcScope scope = controller.getTreeUtilities().getScope(path);
JavafxcScope originalScope = scope;
while (scope != null) {
if (LOGGABLE) log(" scope == " + scope); // NOI18N
addLocalAndImportedTypes(scope.getLocalElements(), kinds, baseType, toExclude, insideNew, smart, originalScope, null,false);
scope = scope.getEnclosingScope();
}
Element e = trees.getElement(path);
while (e != null && e.getKind() != ElementKind.PACKAGE) {
e = e.getEnclosingElement();
}
if (e != null) {
if (LOGGABLE) log("will scan package " + e.getSimpleName()); // NOI18N
PackageElement pkge = (PackageElement)e;
addLocalAndImportedTypes(getEnclosedElements(pkge), kinds, baseType, toExclude, insideNew, smart, originalScope, pkge,false);
}
addPackages(prefix);
if (query.queryType == JavaFXCompletionProvider.COMPLETION_ALL_QUERY_TYPE) {
addAllTypes(kinds, insideNew, prefix);
} else {
query.hasAdditionalItems = true;
}
}
private void addLocalAndImportedTypes(Iterable<? extends Element> from,
final EnumSet<ElementKind> kinds, final DeclaredType baseType,
final Set<? extends Element> toExclude,
boolean insideNew, TypeMirror smart, JavafxcScope originalScope,
PackageElement myPackage,boolean simpleNameOnly) {
final Elements elements = controller.getElements();
for (Element local : from) {
if (LOGGABLE) log(" local == " + local); // NOI18N
String name = local.getSimpleName().toString();
if (name.contains("$")) { // NOI18N
continue;
}
if (local.getKind().isClass() || local.getKind() == ElementKind.INTERFACE) {
if (local.asType() == null || local.asType().getKind() != TypeKind.DECLARED) {
continue;
}
DeclaredType dt = (DeclaredType) local.asType();
TypeElement te = (TypeElement) local;
if (!controller.getTreeUtilities().isAccessible(originalScope, te)) {
if (LOGGABLE) log(" not accessible " + name); // NOI18N
continue;
}
Element parent = te.getEnclosingElement();
if (parent.getKind() == ElementKind.CLASS) {
if (!controller.getTreeUtilities().isAccessible(originalScope, parent)) {
if (LOGGABLE) log(" parent not accessible " + name); // NOI18N
continue;
}
}
if (smart != null && local.asType() == smart) {
addResult(JavaFXCompletionItem.createTypeItem(te, dt, query.anchorOffset, elements.isDeprecated(local), insideNew, true, false));
}
if (JavaFXCompletionProvider.startsWith(name, prefix) && !name.contains("$")) { // NOI18N
if (simpleNameOnly) {
addResult(JavaFXCompletionItem.createTypeItem(local.getSimpleName().toString(), query.anchorOffset, elements.isDeprecated(local), insideNew, false));
} else {
addResult(JavaFXCompletionItem.createTypeItem(te, dt, query.anchorOffset, elements.isDeprecated(local), insideNew, false, false));
}
}
if (parent == myPackage) {
if (LOGGABLE) log(" will check inner classes of: " + local); // NOI18N
if (local.getEnclosedElements() != null) {
addLocalAndImportedTypes(local.getEnclosedElements(), kinds, baseType, toExclude, insideNew, smart, originalScope, null,true);
}
}
}
}
}
protected void addLocalAndImportedFunctions() {
if (LOGGABLE) log("addLocalAndImportedFunctions"); // NOI18N
JavafxcScope scope = controller.getTreeUtilities().getScope(path);
while (scope != null) {
if (LOGGABLE) log(" scope == " + scope); // NOI18N
for (Element local : scope.getLocalElements()) {
if (LOGGABLE) log(" local == " + local); // NOI18N
String name = local.getSimpleName().toString();
if (name.contains("$")) { // NOI18N
continue;
}
if (local.getKind() == ElementKind.METHOD) {
if (JavaFXCompletionProvider.startsWith(name, prefix) && !name.contains("$")) { // NOI18N
addResult(JavaFXCompletionItem.createExecutableItem(
(ExecutableElement) local,
(ExecutableType) local.asType(),
query.anchorOffset, false, false, false, false));
}
}
}
scope = scope.getEnclosingScope();
}
}
private void addPseudoVariables() {
for (String pVar : PSEUDO_VARS) {
if (JavaFXCompletionProvider.startsWith(pVar, getPrefix())) {
addResult(JavaFXCompletionItem.createPseudoVariable(pVar, query.anchorOffset));
}
}
}
/**
* @param simpleName name of a class or fully qualified name of a class
* @return TypeElement or null if the passed in String does not denote a class
*/
protected TypeElement findTypeElement(String simpleName) {
if (LOGGABLE) log("findTypeElement: " + simpleName); // NOI18N
JavafxcTrees trees = controller.getTrees();
JavaFXTreePath p = new JavaFXTreePath(root);
JavafxcScope scope = controller.getTreeUtilities().getScope(path);
while (scope != null) {
if (LOGGABLE) log(" scope == " + scope); // NOI18N
TypeElement res = findTypeElement(scope.getLocalElements(), simpleName,null);
if (res != null) {
return res;
}
scope = scope.getEnclosingScope();
}
Element e = trees.getElement(p);
while (e != null && e.getKind() != ElementKind.PACKAGE) {
e = e.getEnclosingElement();
}
if (e != null) {
PackageElement pkge = (PackageElement)e;
return findTypeElement(getEnclosedElements(pkge), simpleName,pkge);
}
return null;
}
/**
* @param simpleName name of a class or fully qualified name of a class
* @param myPackage can be null - if not null the inner classes of classes from this package will be checked
* @return TypeElement or null if the passed in String does not denote a class
*/
private TypeElement findTypeElement(Iterable<? extends Element> from, String simpleName,PackageElement myPackage) {
if (LOGGABLE) log(" private findTypeElement " + simpleName + " in package " + myPackage); // NOI18N
Elements elements = controller.getElements();
for (Element local : from) {
if (LOGGABLE) log(" local == " + local.getSimpleName() + " kind: " + local.getKind() + " class: " + local.getClass().getName() + " asType: " + local.asType()); // NOI18N
if (local.getKind().isClass() || local.getKind() == ElementKind.INTERFACE) {
if (local.asType() == null || local.asType().getKind() != TypeKind.DECLARED) {
if (LOGGABLE) log(" is not TypeKind.DECLARED -- ignoring"); // NOI18N
continue;
}
if (local instanceof TypeElement) {
String name = local.getSimpleName().toString();
if (name.equals(simpleName)) {
return (TypeElement) local;
}
PackageElement pe = elements.getPackageOf(local);
String fullName = pe.getQualifiedName().toString() + '.' + name; // NOI18N
if (fullName.equals(simpleName)) {
return (TypeElement) local;
}
if (pe == myPackage) {
if (LOGGABLE) log(" will check inner classes of: " + local); // NOI18N
TypeElement res = findTypeElement(local.getEnclosedElements(), simpleName,null);
if (res != null) {
return res;
}
}
}
}
}
return null;
}
protected void addAllTypes(EnumSet<ElementKind> kinds, boolean insideNew, String myPrefix) {
if (LOGGABLE) log(" addAllTypes "); // NOI18N
for (ElementHandle<TypeElement> name :
controller.getClasspathInfo().getClassIndex().getDeclaredTypes(
myPrefix != null ? myPrefix : EMPTY,
NameKind.PREFIX,
EnumSet.allOf(SearchScope.class))) {
String[] sigs = name.getSignatures();
if ((sigs == null) || (sigs.length == 0)) {
continue;
}
String sig = sigs[0];
int firstDollar = sig.indexOf('$'); // NOI18N
if (firstDollar >= 0) {
int secondDollar = sig.indexOf('$', firstDollar); // NOI18N
if (secondDollar >= 0) {
// we don't want to show second level inner classes
continue;
}
}
if (!name.getQualifiedName().startsWith("com.sun.") && // NOI18N
(!name.getQualifiedName().startsWith("sun.")) // NOI18N
) {
LazyTypeCompletionItem item = LazyTypeCompletionItem.create(
name, kinds,
query.anchorOffset,
controller, insideNew);
addResult(item);
}
}
}
protected SafeTokenSequence<JFXTokenId> findLastNonWhitespaceToken(Tree tree, int position) {
int startPos = (int) getSourcePositions().getStartPosition(root, tree);
return findLastNonWhitespaceToken(startPos, position);
}
protected SafeTokenSequence<JFXTokenId> findLastNonWhitespaceToken(int startPos, int endPos) {
TokenSequence<JFXTokenId> ts_ = ((TokenHierarchy<?>) controller.getTokenHierarchy()).tokenSequence(JFXTokenId.language());
SafeTokenSequence<JFXTokenId> ts = new SafeTokenSequence<JFXTokenId>(ts_, controller.getDocument(), cancellable);
ts.move(endPos);
ts = previousNonWhitespaceToken(ts);
if (ts == null || ts.offset() < startPos) {
return null;
}
return ts;
}
private SafeTokenSequence<JFXTokenId> findFirstNonWhitespaceToken(Tree tree, int position) {
int startPos = (int) getSourcePositions().getStartPosition(root, tree);
return findFirstNonWhitespaceToken(startPos, position);
}
protected SafeTokenSequence<JFXTokenId> findFirstNonWhitespaceToken(int startPos, int endPos) {
TokenSequence<JFXTokenId> ts_ = ((TokenHierarchy<?>) controller.getTokenHierarchy()).tokenSequence(JFXTokenId.language());
SafeTokenSequence<JFXTokenId> ts = new SafeTokenSequence<JFXTokenId>(ts_, controller.getDocument(), cancellable);
ts.move(startPos);
ts = nextNonWhitespaceToken(ts);
if (ts == null || ts.offset() >= endPos) {
return null;
}
return ts;
}
protected Tree getArgumentUpToPos(Iterable<? extends ExpressionTree> args, int startPos, int cursorPos) {
for (ExpressionTree e : args) {
int argStart = (int) sourcePositions.getStartPosition(root, e);
int argEnd = (int) sourcePositions.getEndPosition(root, e);
if (argStart == Diagnostic.NOPOS || argEnd == Diagnostic.NOPOS) {
continue;
}
if (cursorPos >= argStart && cursorPos < argEnd) {
return e;
} else {
SafeTokenSequence<JFXTokenId> last = findLastNonWhitespaceToken(startPos, cursorPos);
if (last == null) {
continue;
}
if (last.token().id() == JFXTokenId.LPAREN) {
return e;
}
if (last.token().id() == JFXTokenId.COMMA && cursorPos - 1 == argEnd) {
return e;
}
}
}
return null;
}
/**
* XXX
*/
protected void useSanitizedSource(String source, final int pos) {
if (LOGGABLE) log("useSanitizedSource" + source + " pos == " + pos); // NOI18N
if (usingSanitizedSource > 1) {
// allow to recurse only twice ;-)
return;
}
try {
usingSanitizedSource++;
FileSystem fs = FileUtil.createMemoryFileSystem();
final FileObject fo = fs.getRoot().createData("tmp" + (new Random().nextLong()) + ".fx"); // NOI18N
Writer w = new OutputStreamWriter(fo.getOutputStream());
w.write(source);
w.close();
if (LOGGABLE) log(" source written to " + fo); // NOI18N
ClasspathInfo info = ClasspathInfo.create(controller.getFileObject());
JavaFXParserResult parserResult = JavaFXParserResult.create(Source.create(fo), info);
if (LOGGABLE) log(" JavaFXParserResult obtained " + parserResult); // NOI18N
CompilationController.create(parserResult).runWhenScanFinished(new Task<CompilationController>() {
public void run(CompilationController sanitizedController) throws Exception {
if (LOGGABLE) log(" scan finished"); // NOI18N
JavaFXCompletionEnvironment env = query.getCompletionEnvironment(sanitizedController, pos,true);
if (LOGGABLE) log(" env == " + env); // NOI18N
if (sanitizedController.toPhase(Phase.ANALYZED).lessThan(Phase.ANALYZED)) {
if (LOGGABLE) log(" sanitized failed to analyze -- returning"); // NOI18N
return;
}
if (LOGGABLE) log(" sanitized analyzed"); // NOI18N
if (! env.isTreeBroken()) {
if (LOGGABLE) log(" sanitized non-broken tree"); // NOI18N
final Tree leaf = env.getPath().getLeaf();
env.inside(leaf);
// try to remove sanitized entries:
String sanitizedName = fo.getName();
Set<JavaFXCompletionItem> toRemove = new TreeSet<JavaFXCompletionItem>();
for (JavaFXCompletionItem r : query.results) {
if (LOGGABLE) log(" checking " + r.getLeftHtmlText()); // NOI18N
if (r.getLeftHtmlText().contains(sanitizedName)) {
if (LOGGABLE) log(" will remove " + r); // NOI18N
toRemove.add(r);
}
}
query.results.removeAll(toRemove);
}
}
});
} catch (IOException ex) {
if (LOGGABLE) {
logger.log(Level.FINE,"useSanitizedSource failed: ",ex); // NOI18N
}
} catch (ParseException e) {
Exceptions.printStackTrace(e);
} finally {
usingSanitizedSource--;
}
}
protected static SafeTokenSequence<JFXTokenId> nextNonWhitespaceToken(SafeTokenSequence<JFXTokenId> ts) {
while (ts.moveNext()) {
switch (ts.token().id()) {
case WS:
case LINE_COMMENT:
case COMMENT:
case DOC_COMMENT:
break;
default:
return ts;
}
}
return null;
}
static SafeTokenSequence<JFXTokenId> previousNonWhitespaceToken(SafeTokenSequence<JFXTokenId> ts) {
while (ts.movePrevious()) {
switch (ts.token().id()) {
case WS:
case LINE_COMMENT:
case COMMENT:
case DOC_COMMENT:
break;
default:
return ts;
}
}
return null;
}
protected static TypeMirror asMemberOf(Element element, TypeMirror type, Types types) {
TypeMirror ret = element.asType();
TypeMirror enclType = element.getEnclosingElement().asType();
if (enclType.getKind() == TypeKind.DECLARED) {
enclType = types.erasure(enclType);
}
while (type != null && type.getKind() == TypeKind.DECLARED) {
if (types.isSubtype(type, enclType)) {
ret = types.asMemberOf((DeclaredType) type, element);
break;
}
type = ((DeclaredType) type).getEnclosingType();
}
return ret;
}
private static void log(String s) {
if (LOGGABLE) {
logger.fine(s);
}
}
private static class Pair<A, B> {
private A a;
private B b;
private Pair(A a, B b) {
this.a = a;
this.b = b;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f4db956958c8838edb115e26fdbaa0d03634d779 | 3ac1ef18c3224da928f46dff33076d91291b0377 | /source/exoneon/concurrency/safe/locking/Counter.java | 5fa38379b605d2b003e967187cbb1069c0b21b8b | [] | no_license | aeonviper/exoneon | 09c6b8828de02b330019a6dc90720e4c8a41f0af | 13d0cd0ebdcdcd632e2e6ee93e80ab419d559791 | refs/heads/main | 2023-09-02T00:17:50.675917 | 2021-11-17T18:58:32 | 2021-11-17T18:58:32 | 374,353,249 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 122 | java | package exoneon.concurrency.safe.locking;
public interface Counter {
public int incrementGet();
public int get();
}
| [
"viperblaster@gmail.com"
] | viperblaster@gmail.com |
43cc1a058abbc5c91d9556dd4bc641d61c340da5 | 870db8c055dc4fb2355b9b5eceec8824465f8256 | /android crowd-sourcing app/ProjectSpartan/app/src/main/java/com/example/atlantic8/projectspartan/PictureInfo.java | e3b4a1a0117dffd203baefff5f3607c94c0ed97e | [] | no_license | Atlantic8/Project | bfd6d4144913bf1ecf135c3a28c1dd79992b6381 | dc67ab60096fd7bd2d19d5410439636240dbbfe2 | refs/heads/master | 2021-01-20T19:30:38.574480 | 2018-12-13T12:39:28 | 2018-12-13T12:39:28 | 60,657,764 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,630 | java | package com.example.atlantic8.projectspartan;
/**
* Created by Atlantic8 on 2016/2/26 0026.
*/
public class PictureInfo {
public String title;
public String user_name;
public String time;
public String picture_path;
public String value;
public String extra;
/**
*
* @param pname : name of picture
* @param uname : username
* @param times : unix timestamp
* @param ppath : path in server
* @param values
* @param extras
*/
public PictureInfo (String title, String username, String times,
String picture_path, String values, String extras) {
this.title = title;
this.picture_path = picture_path;
this.value = values;
this.time = this.TimeStamp2Date(times);
this.user_name = username;
this.extra = extras;
}
public PictureInfo (String title, String username, String times,
String picture_path, String values) {
this.title = title;
this.picture_path = picture_path;
this.value = values;
this.time = this.TimeStamp2Date(times);
this.user_name = username;
}
/**Convert Unix timestamp to normal date style
*
* @param timestampString : timestamp in string format
* @return normal date in "dd/MM/yyyy HH:mm:ss" format
*/
private String TimeStamp2Date(String timestampString){
Long timestamp = Long.parseLong(timestampString)*1000;
String date = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date(timestamp));
return date;
}
}
| [
"cwq1713321614@gmail.com"
] | cwq1713321614@gmail.com |
0b91c646808486652b3022c0438cf0858f2fd7a5 | 5433fb2dda7fbffcffd16fa0ad56ff9c58bbf0ad | /JVMDebugTest/src/TestEnum.java | 26031c52843880c7d8a06be4be15f7268616b50f | [] | no_license | picpromusic/jvmdebug | fc93950625716b44f07723f5b6ef361d28536316 | 1e1c1253f4b93afa0559f046e4e45fd47fd2fe9b | refs/heads/master | 2016-09-03T07:32:37.464937 | 2013-05-25T16:02:55 | 2013-05-25T16:02:55 | 4,027,671 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | public enum TestEnum {
A, B;
public String getName() {
if (this == A) {
return "Huch";
}
return "Haha";
}
}
| [
"sickelcoding@googlemail.com"
] | sickelcoding@googlemail.com |
cd4ceda4a268e43bc1a9ee8a7a8f5ec8d1aa0481 | bd5d5a8d8d4af620f4861e96aa9dcf48a3955487 | /src/main/java/com/election/action/PartyLAAction.java | 00976caeb3cae59c2c150dd61ef8a41672d2ccc8 | [] | no_license | prathibhasathyajith/ElectionSurvey | c6cd00f80c7d4dcb789d90a3eb4fb8699e72baf4 | ffc20ff180408558e6085854da9cd327bb342e4b | refs/heads/master | 2021-09-08T12:12:12.241037 | 2018-03-09T13:57:18 | 2018-03-09T13:57:18 | 114,732,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,684 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.election.action;
import com.election.bean.PartyLABean;
import com.election.bean.PartyLAInputBean;
import com.election.bean.Type;
import com.election.dao.PartyLADAO;
import com.election.mapping.PartyLa;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author prathibha_s
*/
public class PartyLAAction extends ActionSupport implements ModelDriven<Object> {
PartyLAInputBean inputBean = new PartyLAInputBean();
@Override
public Object getModel() {
return inputBean;
}
public String execute() {
System.out.println("called PartyLAAction : execute");
return SUCCESS;
}
public String view() {
System.out.println("called PartyLAAction : view");
String msg = "view";
try {
PartyLADAO dao = new PartyLADAO();
List<Type> statusList = new ArrayList<Type>();
Type status = new Type();
status.setCode("ACT");
status.setDescription("Active");
statusList.add(status);
status = new Type();
status.setCode("DEAT");
status.setDescription("Deactive");
statusList.add(status);
inputBean.setStatusList(statusList);
dao.getPartyList(inputBean);
dao.getLAList(inputBean);
} catch (Exception e) {
addActionError("PartyLA error occurred while processing");
Logger.getLogger(PartyLAAction.class.getName()).log(Level.SEVERE, null, e);
}
return msg;
}
public String list() {
System.out.println("called PartyLAAction: List");
try {
int rows = inputBean.getRows();
int page = inputBean.getPage();
int to = (rows * page);
int from = to - rows;
long records = 0;
String orderBy = "";
if (!inputBean.getSidx().isEmpty()) {
orderBy = " order by " + inputBean.getSidx() + " " + inputBean.getSord();
}
PartyLADAO dao = new PartyLADAO();
List<PartyLABean> dataList = dao.getSearchList(inputBean, rows, from, orderBy);
if (!dataList.isEmpty()) {
records = dataList.get(0).getFullCount();
inputBean.setRecords(records);
inputBean.setGridModel(dataList);
int total = (int) Math.ceil((double) records / (double) rows);
inputBean.setTotal(total);
} else {
inputBean.setRecords(0L);
inputBean.setTotal(0);
}
} catch (Exception e) {
addActionError("PartyLA list error occurred while processing");
Logger.getLogger(PartyLAAction.class.getName()).log(Level.SEVERE, null, e);
}
return "list";
}
public String add() {
System.out.println("called CandidateAction : add");
String result = "message";
try {
PartyLADAO dao = new PartyLADAO();
String message = this.validateInputs();
if (message.isEmpty()) {
message = dao.insertPartyLA(inputBean);
if (message.isEmpty()) {
addActionMessage("Parties of local authority assigned successfully");
} else {
addActionError(message);
}
} else {
addActionError(message);
}
} catch (Exception e) {
addActionError("PartyLA add error occurred while processing");
Logger.getLogger(PartyLAAction.class.getName()).log(Level.SEVERE, null, e);
}
return result;
}
public String update() {
System.out.println("called PartyLAAction : update");
String result = "message";
try {
PartyLADAO dao = new PartyLADAO();
String message = this.validateInputs();
if (message.isEmpty()) {
message = dao.updatePartyLA(inputBean);
if (message.isEmpty()) {
addActionMessage("Parties of local authority updated successfully");
} else {
addActionError(message);
}
} else {
addActionError(message);
}
} catch (Exception ex) {
addActionError("PartyLA update error occurred while processing");
Logger.getLogger(PartyLAAction.class.getName()).log(Level.SEVERE, null, ex);
}
return result;
}
public String find() {
System.out.println("called PartyLAAction: find");
PartyLa partyLa = null;
try {
System.out.println("id " + inputBean.getId());
if (inputBean.getId() != null && !inputBean.getId().isEmpty()) {
PartyLADAO dao = new PartyLADAO();
partyLa = dao.findPartyLaById(inputBean.getId());
inputBean.setLa(partyLa.getLocalAuthority().getCode());
inputBean.setParty(partyLa.getPartyCode());
inputBean.setContactNo(partyLa.getContactNo());
inputBean.setAddress(partyLa.getAddress());
inputBean.setStatus(partyLa.getStatus());
} else {
inputBean.setMessage("Empty detail");
}
} catch (Exception ex) {
addActionError("PartyLA find error occurred while processing");
Logger.getLogger(PartyLAAction.class.getName()).log(Level.SEVERE, null, ex);
}
return "find";
}
public String delete() {
System.out.println("called PartyLAAction : Delete");
String message = null;
String retType = "delete";
try {
PartyLADAO dao = new PartyLADAO();
message = dao.deletePartyLA(inputBean);
if (message.isEmpty()) {
message = "Deleted successfully";
}
inputBean.setMessage(message);
} catch (Exception e) {
addActionError("PartyLA delete error occurred while processing");
Logger.getLogger(PartyLAAction.class.getName()).log(Level.SEVERE, null, e);
}
return retType;
}
private String validateInputs() {
String message = "";
if (inputBean.getLa()== null || inputBean.getLa().trim().isEmpty()) {
message = "Local authority cannot be empty";
} else if (inputBean.getParty()== null || inputBean.getParty().trim().isEmpty()) {
message = "Party cannot be empty";
} else if (inputBean.getContactNo()== null || inputBean.getContactNo().trim().isEmpty()) {
message = "Contact no cannot be empty";
} else if (inputBean.getAddress()== null || inputBean.getAddress().trim().isEmpty()) {
message = "Address cannot be empty";
} else if (inputBean.getStatus()== null || inputBean.getStatus().trim().isEmpty()) {
message = "Status cannot be empty";
}
return message;
}
}
| [
"prathibha4you@gmail.com"
] | prathibha4you@gmail.com |
5bbebaed14a79487d7ddbbead0e2336af362f8b8 | b4c0e46b2b7282fa4000425357b1ff2cfe945608 | /platform-framework/platform-restful/src/main/java/com/platform/dao/ApiCardMapper.java | d7e1a34f95399c113be7ab121ba0807744823aff | [
"Apache-2.0"
] | permissive | haolingjie/backgroManaSys | e0c9846f765c9dbd5e33b358a364dfcd9910f155 | c5f182c47f071d1ba485b6400c628df90b0e0ea8 | refs/heads/master | 2022-12-23T09:47:48.983410 | 2019-07-13T18:10:31 | 2019-07-13T18:10:31 | 184,963,339 | 0 | 0 | null | 2022-12-16T11:34:11 | 2019-05-05T01:42:03 | JavaScript | UTF-8 | Java | false | false | 440 | java | package com.platform.dao;
import com.platform.entity.TokenEntity;
import com.platform.model.page.BusiReservationCardPage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户Token
*
* @author lipengjun
* @date 2017年11月20日 下午3:29:40
*/
public interface ApiCardMapper extends BaseDao<BusiReservationCardPage> {
List<BusiReservationCardPage> queryObjectByPage(BusiReservationCardPage page);
}
| [
"haoljsh@sinosoft.com.cn"
] | haoljsh@sinosoft.com.cn |
39e031c3d07a00f4813c03a60f8050f293a98291 | 9ce4ccdea825037580d62166437437dbb5673e66 | /CCC/ccc13j2.java | 871ea7f08d9689272fc8de00f7a99a4008e7b564 | [] | no_license | makeren/competitive-programming | 7e2c0d8daf9441e1ca02b6137618f03ce977b8c9 | f5c5e4b96f32c34c0c2bdb0b6a4053b56dff7cef | refs/heads/master | 2022-03-15T13:39:56.916956 | 2019-11-03T03:21:53 | 2019-11-03T03:21:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | import java.util.Scanner;
public class ccc13j2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String S = sc.nextLine();
S = S.replaceAll("I", "");
S = S.replaceAll("O", "");
S = S.replaceAll("S", "");
S = S.replaceAll("H", "");
S = S.replaceAll("Z", "");
S = S.replaceAll("X", "");
S = S.replaceAll("N", "");
if(S.length()==0) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
| [
"49121271+makeren@users.noreply.github.com"
] | 49121271+makeren@users.noreply.github.com |
70d6b82b0c476527c66fb3a40dd13ab126de7a8e | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/geometer_FBReaderJ/third-party/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/io/localfile/LocalFile.java | 6ddb96f27718bde526b24a62bd491d180597ff92 | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,974 | java | // isComment
package group.pals.android.lib.ui.filechooser.io.localfile;
import group.pals.android.lib.ui.filechooser.io.IFile;
import group.pals.android.lib.ui.filechooser.utils.history.History;
import java.io.File;
import java.util.List;
import android.os.Parcel;
import android.os.Parcelable;
/**
* isComment
*/
public class isClassOrIsInterface extends File implements IFile {
/**
* isComment
*/
private static final long isVariable = isStringConstant;
public isConstructor(String isParameter) {
super(isNameExpr);
}
public isConstructor(File isParameter) {
this(isNameExpr.isMethod());
}
// isComment
@Override
public IFile isMethod() {
return isMethod() == null ? null : new ParentFile(isMethod());
}
// isComment
public String isMethod() {
return isMethod();
}
// isComment
/**
* isComment
*/
@Override
public boolean isMethod(Object isParameter) {
return this == isNameExpr;
}
@Override
public boolean isMethod(IFile isParameter) {
return isNameExpr == null ? true : isMethod().isMethod(isNameExpr.isMethod());
}
// isComment
@Override
public IFile isMethod() {
return new LocalFile(isMethod());
}
/*isComment*/
@Override
public int isMethod() {
// isComment
return isIntegerConstant;
}
@Override
public void isMethod(Parcel isParameter, int isParameter) {
isNameExpr.isMethod(isMethod());
}
public static final Parcelable.Creator<LocalFile> isVariable = new Parcelable.Creator<LocalFile>() {
public LocalFile isMethod(Parcel isParameter) {
return new LocalFile(isNameExpr);
}
public LocalFile[] isMethod(int isParameter) {
return new LocalFile[isNameExpr];
}
};
private isConstructor(Parcel isParameter) {
this(isNameExpr.isMethod());
}
}
| [
"matheus@melsolucoes.net"
] | matheus@melsolucoes.net |
bc88d883d4cf846db56dd75c36aa532d2cecf4d4 | f7de455b8aafa23378d264d00c70ba2dcbb3b6a2 | /src/main/java/pl/oncode/glass/web/dto/addMaterial/AddMaterialDto.java | 1503d8bd5a10e1ff5a5ab6886f6cd410369be08f | [] | no_license | proartz/glass-backend | 5b95b572f313f0fcef6d1b842cd98d62b03a25de | 67e3ab3510f2e657e909710528996513131ee941 | refs/heads/master | 2020-09-12T21:25:40.829503 | 2019-12-09T23:36:23 | 2019-12-09T23:36:23 | 222,561,421 | 0 | 0 | null | 2019-12-01T20:02:04 | 2019-11-18T22:59:19 | null | UTF-8 | Java | false | false | 1,578 | java | package pl.oncode.glass.web.dto.addMaterial;
import pl.oncode.glass.model.Material;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
public class AddMaterialDto {
@Size(max = 30, message = "Name can have maximum 30 characters")
@NotEmpty(message = "Name cannot be null nor empty")
private String name;
@Size(max = 100, message = "Description can have maximum 100 characters")
private String description;
public AddMaterialDto() {
}
public AddMaterialDto(String name, String description) {
this.name = name;
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public static class AddMaterialDtoBuilder {
private String name;
private String description;
public AddMaterialDtoBuilder setName(String name) {
this.name = name;
return this;
}
public AddMaterialDtoBuilder setDescription(String description) {
this.description = description;
return this;
}
public AddMaterialDto createAddMaterialDto() {
return new AddMaterialDto(name, description);
}
}
public Material createMaterial() {
return new Material(null, this.name, this.description);
}
}
| [
"proartz.devon@gmail.com"
] | proartz.devon@gmail.com |
1d46d71537221ba72bc964f12108b09bfd9c8cd1 | 8dfe6d86df134e93303ce81824dcacc129cef4a7 | /challenges/challenge1/Subliminal-SS/Java/src/IntegerCalculator.java | 527a8e20f6992da113bd6beeae3a53f7d2b160b2 | [] | no_license | ddarkeh/CodingClub | 987585fdd3e020e6c9761d71db601a4dc66d612f | 44cf436e78efc812938262e278620ad296c4b3cf | refs/heads/master | 2021-01-12T03:22:28.210392 | 2017-01-12T09:00:55 | 2017-01-12T09:00:55 | 78,203,635 | 1 | 2 | null | 2017-01-12T09:00:55 | 2017-01-06T12:14:10 | Java | UTF-8 | Java | false | false | 1,326 | java | import java.util.*;
import java.lang.String;
public class IntegerCalculator {
public static void main(String[] args) {
System.out.println("Welcome to the Integer calculator!\nPlease specify an Integer value between 0 and 10000");
Scanner userInput = new Scanner(System.in);
int intToCalculate = -1;
int successFlag = 0;
while (successFlag == 0) {
try {
intToCalculate = userInput.nextInt();
userInput.nextLine();
if (intToCalculate > 0 && intToCalculate < 10000) {
successFlag = 1;
} else {
System.out.print("Data supplied is outside of scottstephers spec, please enter an Integer between 0 and 10000 exclusive.\n");
}
} catch (InputMismatchException errorOutput) {
userInput.nextLine();
System.out.print("Data supplied is outside of scottstephers spec, please enter an Integer between 0 and 10000 exclusive.\n");
}
}
System.out.println("Calculating the Sum total of " + intToCalculate);
String stringToCalculate = Integer.toString(intToCalculate);
String theArray[] = stringToCalculate.split("");
int totalResult = 0;
for (String s : theArray) {
totalResult = totalResult + Integer.parseInt(s);
}
System.out.print(totalResult + " " + "(" + String.join(" + ", theArray) + ")");
userInput.close();
}
} | [
"Jonathan.Turnock@outlook.com"
] | Jonathan.Turnock@outlook.com |
76d744adc3049f69510ffd9ed2d7424f4cdbfd10 | ea52903ebad5600573539dc824361f5ef410cd63 | /src/Event.java | 3eb8fe9be34dee23b7416339a81d1a4ae48c38f0 | [] | no_license | tansu95/Validation_of_read_events | b531567f577a658b60260948a371c22544baeaa9 | e54b5fb330365e0547461c42cadf690d0db4a9a4 | refs/heads/main | 2023-07-04T05:33:21.003996 | 2021-08-01T10:25:35 | 2021-08-01T10:25:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | public abstract class Event {
private String title;
private int releaseYear;
private int age;
@Override
public String toString() {
return "Event{" +
"title='" + title + '\'' +
", releaseYear=" + releaseYear +
", age=" + age +
'}';
}
public Event(String title, int releaseYear, int age) {
this.title = title;
this.releaseYear = releaseYear;
this.age = age;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getReleaseYear() {
return releaseYear;
}
public void setReleaseYear(int releaseYear) {
this.releaseYear = releaseYear;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
} | [
"2201bgu@bk.ru"
] | 2201bgu@bk.ru |
29a2f7ce8f384aa4113a522d903391783ce8fe22 | 26d2b32330f22cd58f4430ceb62732153d2c4ae6 | /persistence/src/java/main/com/medigy/persist/model/insurance/InsurancePlanCoverage.java | 76df300370c0a5d5fcc0940215fe39df6953ed22 | [] | no_license | netspective/medigy-java | 0df8a94bf4e8af7748412c2f85ae767524bd2e40 | a30bf19138ed5b2594e9b6dfaf32b44836ac694d | refs/heads/master | 2016-09-16T07:15:30.322251 | 2005-11-11T03:06:21 | 2005-11-11T03:06:21 | 255,324 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,436 | java | /*
* Copyright (c) 2005 Your Corporation. All Rights Reserved.
*/
package com.medigy.persist.model.insurance;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratorType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Entity
public class InsurancePlanCoverage extends CoverageRelationship
{
public static final String PK_COLUMN_NAME = "ins_plan_coverage_id";
private Long insurancePlanCoverageId;
private InsurancePlan insurancePlan;
private Coverage coverage;
@Id(generate = GeneratorType.AUTO)
@Column(name = PK_COLUMN_NAME)
public Long getInsurancePlanCoverageId()
{
return insurancePlanCoverageId;
}
public void setInsurancePlanCoverageId(final Long insurancePlanCoverageId)
{
this.insurancePlanCoverageId = insurancePlanCoverageId;
}
@ManyToOne
@JoinColumn(name = InsurancePlan.PK_COLUMN_NAME)
public InsurancePlan getInsurancePlan()
{
return insurancePlan;
}
public void setInsurancePlan(final InsurancePlan insurancePlan)
{
this.insurancePlan = insurancePlan;
}
@ManyToOne
@JoinColumn(name = Coverage.PK_COLUMN_NAME)
public Coverage getCoverage()
{
return coverage;
}
public void setCoverage(final Coverage coverage)
{
this.coverage = coverage;
}
}
| [
"aye.thu"
] | aye.thu |
d7746ff772f75c2bb72a66df1c980436f210ab6e | 021d38058a0f97e703b1a2891ae9e4c413a7a386 | /Week1/AddingValuesLoop.java | c9880eb9931d088e13fb6d50407058a0f8a38e64 | [] | no_license | nhunguyen76/BE_Novahub_Internship_Nhu | f48db0674ceb31d08b093046dc2398adc8a3ef6d | dbe0054be4d835756b2e3e7604ac18b3d71a33d6 | refs/heads/master | 2021-09-02T12:20:31.025978 | 2018-01-02T15:05:14 | 2018-01-02T15:05:14 | 113,452,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | import java.util.Scanner;
public class AddingValuesLoop{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("I will add up the numbers you give me.");
System.out.print("Number: ");
int num=in.nextInt();
int sum=0;
while(num!=0){
sum+=num;
System.out.println("The total so far is "+sum);
System.out.print("Number: ");
num=in.nextInt();
}
System.out.print("\nThe total is "+sum);
}
} | [
"ntqn960607@gmail.com"
] | ntqn960607@gmail.com |
982a9a42550245c9982f6bacd6632196cfc9564d | 0b457fce08eb4cf18fbf5f7e64f38a9ed3f593ff | /jgnash-swing/src/main/java/jgnash/ui/account/AccountPanel.java | c8f3e3feaf9c45dbcc58cfa68fe22bfc95a997b3 | [] | no_license | gitter-badger/jgnash | 60a28cca12f4ea600ac288c50f9a098bceffc6a8 | 135a04b6acd036dc05f4a9e756083b2ba8a78fba | refs/heads/master | 2021-01-18T16:23:26.570670 | 2015-05-27T16:52:18 | 2015-05-27T16:52:18 | 36,392,439 | 0 | 0 | null | 2015-05-27T20:03:03 | 2015-05-27T20:03:03 | null | UTF-8 | Java | false | false | 11,632 | java | /*
* jGnash, a personal finance application
* Copyright (C) 2001-2015 Craig Cavanaugh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package jgnash.ui.account;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.FormLayout;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import jgnash.engine.Account;
import jgnash.engine.AccountType;
import jgnash.engine.CurrencyNode;
import jgnash.engine.SecurityNode;
import jgnash.ui.components.CurrencyComboBox;
import jgnash.ui.components.JIntegerField;
import jgnash.ui.components.JTextFieldEx;
import jgnash.util.Resource;
/**
* Panel for entering / modifying account information.
*
* @author Craig Cavanaugh
*/
final class AccountPanel extends JPanel implements ActionListener {
private final transient Resource rb = Resource.get();
private Account parentAccount;
private Set<SecurityNode> commodityList = new TreeSet<>();
private CurrencyComboBox currencyCombo;
private JTextFieldEx accountNumberField;
JCheckBox placeholderCheckBox;
private JTextFieldEx nameField;
private JCheckBox lockedCheckBox;
private JButton parentButton;
private JTextFieldEx descriptionField;
private JButton securityButton;
private JTextArea notesArea;
private JTextField bankIdField;
private JIntegerField accountCodeField;
private JCheckBox hideCheckBox;
private JCheckBox excludeBudgetCheckBox;
private JComboBox<AccountType> accountTypeCombo;
private DefaultComboBoxModel<AccountType> accountTypeModel;
private Account modifyingAccount;
public AccountPanel() {
layoutMainPanel();
setAccountType(AccountType.BANK);
}
private void initComponents() {
accountNumberField = new JTextFieldEx();
accountCodeField = new JIntegerField();
nameField = new JTextFieldEx();
bankIdField = new JTextFieldEx();
nameField.setText(rb.getString("Word.Name"));
descriptionField = new JTextFieldEx();
descriptionField.setText(rb.getString("Word.Description"));
currencyCombo = new CurrencyComboBox();
securityButton = new JButton(rb.getString("Word.None"));
// for preferred width so button does not force a wide layout
securityButton.setPreferredSize(new Dimension(20, securityButton.getPreferredSize().height));
accountTypeModel = new DefaultComboBoxModel<>(AccountType.values());
accountTypeModel.removeElement(AccountType.ROOT);
accountTypeCombo = new JComboBox<>(accountTypeModel);
lockedCheckBox = new JCheckBox(rb.getString("Button.Locked"));
placeholderCheckBox = new JCheckBox(rb.getString("Button.PlaceHolder"));
hideCheckBox = new JCheckBox(rb.getString("Button.HideAccount"));
excludeBudgetCheckBox = new JCheckBox(rb.getString("Button.ExcludeFromBudget"));
parentButton = new JButton("Root");
notesArea = new javax.swing.JTextArea();
notesArea.setLineWrap(true);
notesArea.setAutoscrolls(false);
notesArea.setPreferredSize(new java.awt.Dimension(100, 80));
accountTypeCombo.addActionListener(this);
securityButton.addActionListener(this);
parentButton.addActionListener(this);
}
private void layoutMainPanel() {
initComponents();
FormLayout layout = new FormLayout("right:max(20dlu;pref), $lcgap, d, $lcgap, d:g", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout, this);
builder.appendSeparator(rb.getString("Title.AccountInfo"));
builder.rowGroupingEnabled(true);
builder.append(rb.getString("Label.Name"), nameField, 3);
builder.nextLine();
builder.append(rb.getString("Label.Description"), descriptionField, 3);
builder.nextLine();
builder.append(rb.getString("Label.AccountNumber"), accountNumberField, 3);
builder.nextLine();
builder.append(rb.getString("Label.AccountCode"), accountCodeField, 3);
builder.nextLine();
builder.append(rb.getString("Label.BankID"), bankIdField, 3);
builder.nextLine();
builder.append(rb.getString("Label.Currency"), currencyCombo, 3);
builder.nextLine();
builder.append(rb.getString("Label.Securities"), securityButton, 3);
builder.nextLine();
builder.append(rb.getString("Label.AccountType"), accountTypeCombo, 3);
builder.nextLine();
builder.append(rb.getString("Label.AccountOptions"), lockedCheckBox, hideCheckBox);
builder.nextLine();
builder.append("", placeholderCheckBox, excludeBudgetCheckBox);
builder.rowGroupingEnabled(false);
builder.appendSeparator(rb.getString("Title.ParentAccount"));
builder.append(parentButton, 5);
builder.appendSeparator(rb.getString("Title.Notes"));
JScrollPane pane = new JScrollPane(notesArea);
pane.setAutoscrolls(true);
builder.appendRow("f:60dlu:g(1.0)");
builder.append(pane, 5);
}
private void showAccountListDialog() {
AccountListDialog dlg = new AccountListDialog(parentAccount);
dlg.setLocationRelativeTo(this);
dlg.setVisible(true);
if (dlg.getReturnStatus()) {
setParentAccount(dlg.getAccount());
}
}
private void accountAction() {
updateCommodityButton();
}
public void setParentAccount(final Account parentAccount) {
this.parentAccount = parentAccount;
parentButton.setText(parentAccount.getName());
setAccountCurrency(parentAccount.getCurrencyNode());
}
public Account getParentAccount() {
return parentAccount;
}
public String getAccountName() {
return nameField.getText();
}
public void setAccountName(final String name) {
nameField.setText(name);
}
public void setBankId(final String id) {
bankIdField.setText(id);
}
public void setAccountHidden(final boolean hide) {
hideCheckBox.setSelected(hide);
}
public String getAccountNumber() {
return accountNumberField.getText();
}
public void setAccountNumber(final String accountNumber) {
accountNumberField.setText(accountNumber);
}
public int getAccountCode() {
return accountCodeField.intValue();
}
public void setAccountCode(final int accountCode) {
accountCodeField.setIntValue(accountCode);
}
public String getBankId() {
return bankIdField.getText();
}
public void setAccountDescription(final String description) {
descriptionField.setText(description);
}
public String getAccountDescription() {
return descriptionField.getText();
}
public void setAccountCurrency(final CurrencyNode node) {
currencyCombo.setSelectedNode(node);
}
public CurrencyNode getAccountCurrency() {
return currencyCombo.getSelectedNode();
}
void disableAccountCurrency() {
currencyCombo.setEnabled(false);
}
public void setAccountNotes(String notes) {
notesArea.setText(notes);
}
public String getAccountNotes() {
return notesArea.getText();
}
public void setAccountLocked(final boolean locked) {
lockedCheckBox.setSelected(locked);
}
public boolean isAccountLocked() {
return lockedCheckBox.isSelected();
}
public void setPlaceholder(final boolean selected) {
placeholderCheckBox.setSelected(selected);
}
public boolean isPlaceholder() {
return placeholderCheckBox.isSelected();
}
public void setAccountType(final AccountType type) {
accountTypeCombo.setSelectedItem(type);
updateCommodityButton();
}
public void setModifyingAccount(final Account account) {
modifyingAccount = account;
}
public AccountType getAccountType() {
return (AccountType) accountTypeCombo.getSelectedItem();
}
public boolean isAccountHidden() {
return hideCheckBox.isSelected();
}
public void setExcludedFromBudget(final boolean excludeBudget) {
excludeBudgetCheckBox.setSelected(excludeBudget);
}
public boolean isExcludedFromBudget() {
return excludeBudgetCheckBox.isSelected();
}
public void setAccountSecurities(final Set<SecurityNode> list) {
commodityList.clear();
commodityList.addAll(list);
}
public Set<SecurityNode> getAccountSecurities() {
return commodityList;
}
private void showSecuritiesDialog() {
AccountSecuritiesDialog dlg = new AccountSecuritiesDialog(modifyingAccount, commodityList, this);
dlg.setVisible(true);
if (dlg.getReturnValue()) {
commodityList = dlg.getSecuritiesList();
}
updateCommodityText();
}
private void updateCommodityButton() {
AccountType type = getAccountType();
if (type == AccountType.INVEST || type == AccountType.MUTUAL) {
securityButton.setEnabled(true);
updateCommodityText();
} else {
securityButton.setEnabled(false);
}
}
private void updateCommodityText() {
if (!commodityList.isEmpty()) {
StringBuilder buf = new StringBuilder();
Iterator<SecurityNode> it = commodityList.iterator();
SecurityNode node = it.next();
buf.append(node.getSymbol());
while (it.hasNext()) {
buf.append(", ");
node = it.next();
buf.append(node.getSymbol());
}
securityButton.setText(buf.toString());
securityButton.setToolTipText(buf.toString());
} else {
securityButton.setText(rb.getString("Word.None"));
}
}
void disableAccountType(final AccountType type) {
if (type.isMutable()) {
for (AccountType t : AccountType.values()) {
if (!t.isMutable()) {
accountTypeModel.removeElement(t);
}
}
} else {
accountTypeCombo.setSelectedItem(type);
accountTypeCombo.setEnabled(false);
}
}
@Override
public void actionPerformed(final ActionEvent e) {
if (e.getSource() == accountTypeCombo) {
accountAction();
} else if (e.getSource() == securityButton) {
showSecuritiesDialog();
} else if (e.getSource() == parentButton) {
showAccountListDialog();
}
}
} | [
"jgnash.devel@gmail.com"
] | jgnash.devel@gmail.com |
aeb61810bb001b5b9d4be67fedc006cb35de13c9 | c53cbbffaf6840cea1f7620a8f9317a8b9308126 | /src/main/java/com/apptium/customer/web/rest/CustSecurityCharResource.java | 487bffc046a2de691b02ec7e9e477a9094191731 | [] | no_license | ravi7mech/customer-management | 285a63eee314b813576b9522bc4e79d30bfb0211 | af36e96bf74ce1a947cb36a89e97f71dc34f3d63 | refs/heads/main | 2023-06-06T22:41:01.803877 | 2021-07-14T07:21:39 | 2021-07-14T07:21:39 | 385,848,609 | 0 | 0 | null | 2021-07-14T07:21:40 | 2021-07-14T07:14:19 | Java | UTF-8 | Java | false | false | 9,797 | java | package com.apptium.customer.web.rest;
import com.apptium.customer.repository.CustSecurityCharRepository;
import com.apptium.customer.service.CustSecurityCharQueryService;
import com.apptium.customer.service.CustSecurityCharService;
import com.apptium.customer.service.criteria.CustSecurityCharCriteria;
import com.apptium.customer.service.dto.CustSecurityCharDTO;
import com.apptium.customer.web.rest.errors.BadRequestAlertException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import tech.jhipster.web.util.HeaderUtil;
import tech.jhipster.web.util.ResponseUtil;
/**
* REST controller for managing {@link com.apptium.customer.domain.CustSecurityChar}.
*/
@RestController
@RequestMapping("/api")
public class CustSecurityCharResource {
private final Logger log = LoggerFactory.getLogger(CustSecurityCharResource.class);
private static final String ENTITY_NAME = "customerManagementCustSecurityChar";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final CustSecurityCharService custSecurityCharService;
private final CustSecurityCharRepository custSecurityCharRepository;
private final CustSecurityCharQueryService custSecurityCharQueryService;
public CustSecurityCharResource(
CustSecurityCharService custSecurityCharService,
CustSecurityCharRepository custSecurityCharRepository,
CustSecurityCharQueryService custSecurityCharQueryService
) {
this.custSecurityCharService = custSecurityCharService;
this.custSecurityCharRepository = custSecurityCharRepository;
this.custSecurityCharQueryService = custSecurityCharQueryService;
}
/**
* {@code POST /cust-security-chars} : Create a new custSecurityChar.
*
* @param custSecurityCharDTO the custSecurityCharDTO to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new custSecurityCharDTO, or with status {@code 400 (Bad Request)} if the custSecurityChar has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/cust-security-chars")
public ResponseEntity<CustSecurityCharDTO> createCustSecurityChar(@Valid @RequestBody CustSecurityCharDTO custSecurityCharDTO)
throws URISyntaxException {
log.debug("REST request to save CustSecurityChar : {}", custSecurityCharDTO);
if (custSecurityCharDTO.getId() != null) {
throw new BadRequestAlertException("A new custSecurityChar cannot already have an ID", ENTITY_NAME, "idexists");
}
CustSecurityCharDTO result = custSecurityCharService.save(custSecurityCharDTO);
return ResponseEntity
.created(new URI("/api/cust-security-chars/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, false, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /cust-security-chars/:id} : Updates an existing custSecurityChar.
*
* @param id the id of the custSecurityCharDTO to save.
* @param custSecurityCharDTO the custSecurityCharDTO to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated custSecurityCharDTO,
* or with status {@code 400 (Bad Request)} if the custSecurityCharDTO is not valid,
* or with status {@code 500 (Internal Server Error)} if the custSecurityCharDTO couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/cust-security-chars/{id}")
public ResponseEntity<CustSecurityCharDTO> updateCustSecurityChar(
@PathVariable(value = "id", required = false) final Long id,
@Valid @RequestBody CustSecurityCharDTO custSecurityCharDTO
) throws URISyntaxException {
log.debug("REST request to update CustSecurityChar : {}, {}", id, custSecurityCharDTO);
if (custSecurityCharDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, custSecurityCharDTO.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!custSecurityCharRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
CustSecurityCharDTO result = custSecurityCharService.save(custSecurityCharDTO);
return ResponseEntity
.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, custSecurityCharDTO.getId().toString()))
.body(result);
}
/**
* {@code PATCH /cust-security-chars/:id} : Partial updates given fields of an existing custSecurityChar, field will ignore if it is null
*
* @param id the id of the custSecurityCharDTO to save.
* @param custSecurityCharDTO the custSecurityCharDTO to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated custSecurityCharDTO,
* or with status {@code 400 (Bad Request)} if the custSecurityCharDTO is not valid,
* or with status {@code 404 (Not Found)} if the custSecurityCharDTO is not found,
* or with status {@code 500 (Internal Server Error)} if the custSecurityCharDTO couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PatchMapping(value = "/cust-security-chars/{id}", consumes = "application/merge-patch+json")
public ResponseEntity<CustSecurityCharDTO> partialUpdateCustSecurityChar(
@PathVariable(value = "id", required = false) final Long id,
@NotNull @RequestBody CustSecurityCharDTO custSecurityCharDTO
) throws URISyntaxException {
log.debug("REST request to partial update CustSecurityChar partially : {}, {}", id, custSecurityCharDTO);
if (custSecurityCharDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
if (!Objects.equals(id, custSecurityCharDTO.getId())) {
throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid");
}
if (!custSecurityCharRepository.existsById(id)) {
throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound");
}
Optional<CustSecurityCharDTO> result = custSecurityCharService.partialUpdate(custSecurityCharDTO);
return ResponseUtil.wrapOrNotFound(
result,
HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, custSecurityCharDTO.getId().toString())
);
}
/**
* {@code GET /cust-security-chars} : get all the custSecurityChars.
*
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of custSecurityChars in body.
*/
@GetMapping("/cust-security-chars")
public ResponseEntity<List<CustSecurityCharDTO>> getAllCustSecurityChars(CustSecurityCharCriteria criteria) {
log.debug("REST request to get CustSecurityChars by criteria: {}", criteria);
List<CustSecurityCharDTO> entityList = custSecurityCharQueryService.findByCriteria(criteria);
return ResponseEntity.ok().body(entityList);
}
/**
* {@code GET /cust-security-chars/count} : count all the custSecurityChars.
*
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body.
*/
@GetMapping("/cust-security-chars/count")
public ResponseEntity<Long> countCustSecurityChars(CustSecurityCharCriteria criteria) {
log.debug("REST request to count CustSecurityChars by criteria: {}", criteria);
return ResponseEntity.ok().body(custSecurityCharQueryService.countByCriteria(criteria));
}
/**
* {@code GET /cust-security-chars/:id} : get the "id" custSecurityChar.
*
* @param id the id of the custSecurityCharDTO to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the custSecurityCharDTO, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/cust-security-chars/{id}")
public ResponseEntity<CustSecurityCharDTO> getCustSecurityChar(@PathVariable Long id) {
log.debug("REST request to get CustSecurityChar : {}", id);
Optional<CustSecurityCharDTO> custSecurityCharDTO = custSecurityCharService.findOne(id);
return ResponseUtil.wrapOrNotFound(custSecurityCharDTO);
}
/**
* {@code DELETE /cust-security-chars/:id} : delete the "id" custSecurityChar.
*
* @param id the id of the custSecurityCharDTO to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/cust-security-chars/{id}")
public ResponseEntity<Void> deleteCustSecurityChar(@PathVariable Long id) {
log.debug("REST request to delete CustSecurityChar : {}", id);
custSecurityCharService.delete(id);
return ResponseEntity
.noContent()
.headers(HeaderUtil.createEntityDeletionAlert(applicationName, false, ENTITY_NAME, id.toString()))
.build();
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
1a08a2d59f37bc06b9614db7a6a2d5c1da5f6098 | e868e19c4149d826a9a0d59a883191b1471fad72 | /src/main/java/com/softlink/minilib/client/rpc/SystemServiceAsync.java | 7c13cfa408ec5ab24730f3f71195160c8ddb824f | [] | no_license | TranAn90/Mini-Lib | 32903ec8eca4178b51427e3a50a8ee9edc94abe5 | 2fc52a92a3782b67ea32911300897d4fe9ec3233 | refs/heads/master | 2020-04-17T04:05:11.552172 | 2014-12-29T03:34:28 | 2014-12-29T03:34:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,293 | java | package com.softlink.minilib.client.rpc;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.softlink.minilib.shared.Invite_Token;
import com.softlink.minilib.shared.System_Account;
import com.softlink.minilib.shared.System_Organization;
public interface SystemServiceAsync {
void insertOrganization(System_Organization organization, AsyncCallback<System_Organization> callback);
void updateOrganization(System_Organization organization, AsyncCallback<Boolean> callback);
void retrieveOrganization(Long id, AsyncCallback<System_Organization> callback);
void insertAccount(System_Account account, AsyncCallback<Boolean> callback);
// void updateAccount(System_Account account, AsyncCallback<Boolean> callback);
void retrieveAccount(String email, AsyncCallback<System_Account> callback);
void goToOrganization(System_Organization organization, AsyncCallback<Boolean> callback);
void insertInviteToken(String userEmail, System_Organization organization, AsyncCallback<Boolean> callback);
void retrieveInviteTokens(String email, AsyncCallback<List<Invite_Token>> callback);
void inviteTokenAccepted(Invite_Token token, AsyncCallback<System_Organization> callback);
void inviteTokenDenied(Invite_Token token, AsyncCallback<Void> callback);
}
| [
"antp@itpro.vn"
] | antp@itpro.vn |
c6757dc8dbbd4669e6c28e726807e4571ef6781b | b932b35dea7566a3c5b9ee0046df8f4a943bb416 | /structural/decorator/src/main/java/decorator/AddOn.java | 3b099ccb626cd2584f333d3c42470f44c282b561 | [] | no_license | cesar88/all-design-patterns-for-java | fbe48a7a297b7f52bd607c2e285d25fe0de9025b | 6dbb207c3a404501703bba9fdfd37733bf2395a6 | refs/heads/master | 2023-01-23T07:11:00.859513 | 2020-11-23T20:26:49 | 2020-11-23T20:26:49 | 315,078,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package decorator;
//Abstract Decorator
public abstract class AddOn extends Beverage {
protected Beverage bev;
public AddOn(Beverage bev) {
super("Add on");
this.bev=bev;
}
}
| [
"fatih.goken@logo.com.tr"
] | fatih.goken@logo.com.tr |
55ae99aaa9aa947e9555b2714489739b40082eeb | b96b2faa9e0ab0100cf60296595e1f0fe70bd4fa | /android/src/main/java/com/ijzerenhein/sharedelement/RNSharedElementView.java | 42dc8ffa0631548c8627544e2b7f7fe43b7cf04b | [
"MIT"
] | permissive | bcalik/react-native-shared-element | a9118f5d3e82d4af3db727276f9ca0596901b645 | 267fc708f5e27f34c0af61030bf65b1479362e03 | refs/heads/master | 2020-11-27T14:30:43.751977 | 2019-12-10T09:41:55 | 2019-12-10T09:41:55 | 229,489,006 | 0 | 0 | MIT | 2019-12-21T22:11:06 | 2019-12-21T22:11:06 | null | UTF-8 | Java | false | false | 4,247 | java | package com.ijzerenhein.sharedelement;
import android.util.Log;
import android.view.View;
import android.graphics.Rect;
import android.graphics.RectF;
import com.facebook.react.uimanager.ThemedReactContext;
class RNSharedElementView extends View {
static private String LOG_TAG = "RNSharedElementView";
private RNSharedElementDrawable mDrawable;
private RNSharedElementDrawable.ViewType mViewType;
RNSharedElementView(ThemedReactContext context) {
super(context);
mViewType = RNSharedElementDrawable.ViewType.NONE;
mDrawable = new RNSharedElementDrawable();
setBackground(mDrawable);
}
@Override
public boolean hasOverlappingRendering() {
return mViewType == RNSharedElementDrawable.ViewType.GENERIC;
}
void reset() {
setAlpha(0.0f);
}
void updateViewAndDrawable(
RectF layout,
RectF parentLayout,
Rect originalLayout,
Rect originalFrame,
RNSharedElementContent content,
RNSharedElementStyle style,
float alpha,
RNSharedElementResize resize,
RNSharedElementAlign align,
float position) {
// Update drawable
RNSharedElementDrawable.ViewType viewType = mDrawable.update(content, style, position);
boolean useGPUScaling = (resize != RNSharedElementResize.CLIP) &&
((viewType == RNSharedElementDrawable.ViewType.GENERIC) ||
(viewType == RNSharedElementDrawable.ViewType.PLAIN));
// Update layer type
if (mViewType != viewType) {
mViewType = viewType;
setLayerType(useGPUScaling ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE, null);
}
// Update view size/position/scale
float width = layout.width();
float height = layout.height();
if (useGPUScaling) {
int originalWidth = originalFrame.width();
int originalHeight = originalFrame.height();
// Update view
layout(0, 0, originalWidth, originalHeight);
setTranslationX(layout.left - parentLayout.left);
setTranslationY(layout.top - parentLayout.top);
// Update scale
float scaleX = width / (float) originalWidth;
float scaleY = height / (float) originalHeight;
if (!Float.isInfinite(scaleX) && !Float.isNaN(scaleX) && !Float.isInfinite(scaleY) && !Float.isNaN(scaleY)) {
// Determine si
switch (resize) {
case AUTO:
case STRETCH:
break;
case CLIP:
case NONE:
scaleX = (float) originalWidth / (float) originalLayout.width();
scaleY = (float) originalHeight / (float) originalLayout.height();
break;
}
/*switch (align) {
case LEFT_TOP:
break;
case LEFT_CENTER:
break;
case LEFT_BOTTOM:
break;
case RIGHT_TOP:
break;
case RIGHT_CENTER:
break;
case RIGHT_BOTTOM:
break;
case CENTER_TOP:
break;
case CENTER_CENTER:
break;
case CENTER_BOTTOM:
break;
}*/
setScaleX(scaleX);
setScaleY(scaleY);
}
setPivotX(0);
setPivotY(0);
} else {
// Update view
layout(0, 0, (int)Math.ceil(width), (int)Math.ceil(height));
setTranslationX(layout.left - parentLayout.left);
setTranslationY(layout.top - parentLayout.top);
}
// Update view opacity and elevation
setAlpha(alpha);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
setElevation(style.elevation);
}
}
}
| [
"hrutjes@gmail.com"
] | hrutjes@gmail.com |
d86761eb14aba10cf8f62acfab0c54c2ba54ffbf | 5f24f88c3d51345451065a7ed0dba2aa7627b69a | /java大作业/大作业2/src/work1/Checkuploadsong.java | 5dffcf9679c6a73e0e3d64eb899c30fba6d4b5ac | [] | no_license | Haohao-555/java_code | 22666744ab3053b149a1d2e82f31d5f81cfe72f3 | 5bf4c462c6357ffba784ca851b23c15866a245a4 | refs/heads/main | 2023-07-05T23:51:26.189684 | 2021-08-14T08:55:33 | 2021-08-14T08:55:33 | 395,930,433 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 9,433 | java | /*
* Checkuploadsong.java
*
* Created on __DATE__, __TIME__
*/
package work1;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JOptionPane;
/**
*
* @author __USER__
*/
public class Checkuploadsong extends javax.swing.JFrame {
/** Creates new form Checkuploadsong */
public void update() {
try {
FileReader fr = new FileReader("file3.txt");
FileReader fs = new FileReader("file4.txt");
FileReader fd = new FileReader("file5.txt");
BufferedReader r = new BufferedReader(fr);
BufferedReader d = new BufferedReader(fs);
BufferedReader f = new BufferedReader(fd);
String s;
String h;
String k;
for (s = r.readLine(); s != null; s = r.readLine())
this.jTextField2.setText(s);
jTextField2.setEditable(false);
r.close();
for (h = d.readLine(); h != null; h = d.readLine())
this.jTextField3.setText(h);
jTextField3.setEditable(false);
d.close();
for (k = f.readLine(); k != null; k = f.readLine())
this.jTextField1.setText(k);
jTextField1.setEditable(false);
d.close();
} catch (IOException e) {
System.err.println("发生异常:" + e);
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
public Checkuploadsong() {
initComponents();
update();
this.setLocationRelativeTo(null);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("黑体", 0, 24));
jLabel1.setText("\u4e0a\u4f20\u6b4c\u66f2");
jLabel2.setText("\u4e0a\u4f20\u4eba\uff1a");
jLabel3.setText("\u6b4c\u66f2\uff1a");
jTextField2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField2ActionPerformed(evt);
}
});
jLabel4.setText("\u6b4c\u624b\uff1a");
jTextField3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3ActionPerformed(evt);
}
});
jButton1.setText("\u786e\u5b9a");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("\u53d6\u6d88");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
getContentPane());
getContentPane().setLayout(layout);
layout
.setHorizontalGroup(layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout
.createSequentialGroup()
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout
.createSequentialGroup()
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING,
false)
.addGroup(
layout
.createSequentialGroup()
.addGap(
167,
167,
167)
.addComponent(
jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
112,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(
layout
.createSequentialGroup()
.addComponent(
jLabel2)
.addGap(
18,
18,
18)
.addComponent(
jTextField1,
javax.swing.GroupLayout.PREFERRED_SIZE,
84,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(
jLabel3)))
.addGap(
24,
24,
24)
.addComponent(
jTextField2,
javax.swing.GroupLayout.PREFERRED_SIZE,
84,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(
81,
81,
81)
.addComponent(
jLabel4)
.addGap(
18,
18,
18)
.addComponent(
jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE,
84,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(
layout
.createSequentialGroup()
.addGap(
138,
138,
138)
.addComponent(
jButton1)
.addGap(
158,
158,
158)
.addComponent(
jButton2)))
.addContainerGap(97, Short.MAX_VALUE)));
layout
.setVerticalGroup(layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout
.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(
jTextField1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(
jTextField2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(
jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED,
32, Short.MAX_VALUE)
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addGap(26, 26, 26)));
pack();
}// </editor-fold>
//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(this, "不同意上传");
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(this, "同意上传");
}
private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Checkuploadsong().setVisible(true);
}
});
}
//GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration//GEN-END:variables
} | [
"3283627490@qq.com"
] | 3283627490@qq.com |
ae8f7c0416ff76af1936cd16212bbd7328be3b25 | 6da25b97a75534c548c0f08942d7c7440d129d96 | /src/main/java/com/cs/ums/SecurityConfig.java | ef88959369a4d131f435c4b81b4966b6df6d8c3f | [
"MIT"
] | permissive | microservicescloud/user-manage-service | def65b003bc386331e2a04dffb1d5b2cab05bc48 | dd31e539e4b7691656d7931de01ee944baac3351 | refs/heads/main | 2023-02-07T12:16:16.100733 | 2020-12-24T06:43:09 | 2020-12-26T10:24:46 | 324,065,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,380 | java | package com.cs.ums;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
// @Override
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// auth.inMemoryAuthentication().withUser("admin").password("{noop}admin").authorities("ADMIN", "USER")
// .and().withUser("user").password("{noop}user").authorities("USER");
// }
@Override
public void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/Intranet/Bokning").authenticated() // Block this
.antMatchers("/**", "/Intranet**").permitAll() // Allow this for all
.anyRequest().authenticated()
.and().logout().logoutSuccessUrl("/").permitAll()
.and()
.oauth2Login();
}
// @Bean
// public UserDetailsService userDetailsService() {
// PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
// InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
// manager.createUser(User.withUsername("user")
// .password(encoder.encode("user"))
// .roles("USER").build());
// manager.createUser(User.withUsername("admin")
// .password(encoder.encode("admin"))
// .roles("USER", "ADMIN").build());
// return manager;
// }
}
| [
"nhamchithanh@gmail.com"
] | nhamchithanh@gmail.com |
a06ba6235204493afcb234134c343b8b35e74ea2 | e9ff244089c37377d553e5d6df5c16c0549fbd55 | /MyMaven1Project/src/main/java/com/training/step/Steps4B.java | 11db8dcd12ddfd270eae7b4ba79303e447539e08 | [] | no_license | swetha-telukutla/homepage | ec498d88681ccae39b7bd2101e4280dab667e65a | 1ee327d09aded64298c791a0339c68926f00a1dd | refs/heads/master | 2020-05-01T07:23:42.519136 | 2019-03-25T19:42:19 | 2019-03-25T19:42:19 | 177,351,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 59 | java | package com.training.step;
public class Steps4B {
}
| [
"SankarA@Sloka-Reddy.fios-router.home"
] | SankarA@Sloka-Reddy.fios-router.home |
0e7d238c974256bbf43700f3a3ba6ab6ba0ea7bc | db5f0e59688168a594e1e1aa2adbda5dba6ed2d4 | /app/src/main/java/com/example/serverutveckling/labb4/ListOfPeopleActivity.java | 335dcf6362a05c9697406d67ad5ea75bca9910e0 | [] | no_license | juthu/labb4 | 02ae96245451a54c9f4a6392d3654ea37bf623ef | ca3dc3b0cafb5971ca78893560454d50c472b915 | refs/heads/master | 2021-01-10T09:31:50.709187 | 2016-01-19T13:50:06 | 2016-01-19T13:50:06 | 49,822,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,235 | java | package com.example.serverutveckling.labb4;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.database.DataSetObserver;
import android.os.AsyncTask;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.util.ArrayList;
public class ListOfPeopleActivity extends FragmentActivity {
ListView list_of_people;
public Activity a = this;
String id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_of_people);
list_of_people = (ListView) findViewById(R.id.list_of_people);
Bundle extras = getIntent().getExtras();
id = extras.getString("id");
new WebServiceCall().execute();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_list_of_people, 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.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public static HttpResponse makeRequest(String uri) {
try {
HttpGet httpGet = new HttpGet(uri);
HttpParams httpParameters = new BasicHttpParams();
int timeoutConnection = 3000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
int timeoutSocket = 3000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
httpGet.setParams(httpParameters);
httpGet.setHeader("Accept", "application/json");
httpGet.setHeader("Content-type", "application/json");
return new DefaultHttpClient().execute(httpGet);
} catch (UnsupportedEncodingException e) {
Log.e("ERROR", e.getMessage() + "");
} catch (ClientProtocolException e) {
Log.e("ERROR", e.getMessage() + "");
} catch (IOException e) {
Log.e("ERROR", e.getMessage() + "");
}
return null;
}
private class WebServiceCall extends AsyncTask<ArrayList<String>, String, ArrayList<Login_id>> {
@Override
protected ArrayList<Login_id> doInBackground(ArrayList<String>... params) {
try {
HttpResponse response = makeRequest("http://130.237.84.10:8081/starter/rest/getpeople");
HttpEntity entity = response.getEntity();
String content = null;
content = EntityUtils.toString(entity);
Gson gson1 = new Gson();
ResultGson rg_result = gson1.fromJson(content, ResultGson.class);
Type type = new TypeToken<ArrayList<Login_id>>() {
}.getType();
ArrayList<Login_id> li_arr = gson1.fromJson(rg_result.Json, type);
return li_arr;
} catch (Exception e) {
Log.e("ERROR", e.getMessage() + "");
return null;
}
}
@Override
protected void onPostExecute(ArrayList<Login_id> result) {
try {
ArrayList<User> users = new ArrayList<>();
for (int i = 0; i < result.size(); i++) {
users.add(new User(result.get(i).password, result.get(i).username));
}
ListViewAdapter adapter = new ListViewAdapter(a, users, id);
list_of_people.setAdapter(adapter);
adapter.notifyDataSetChanged();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
@Override
protected void onPreExecute() {
}
}
public class ResultGson {
public String Json;
}
public class Login_id {
public String username;
public String password;
}
}
| [
"thunjulia@gmail.com"
] | thunjulia@gmail.com |
94dc1de7767ecdb39d486d2ac6ffde970463b96f | b7cb2545893017f30276e514e45632b70edde6fd | /src/main/java/net/coding/codingftp/controller/DownloadController.java | 2cc3edfc94d3ab72abf1654bc5c2ed08393ebd6d | [] | no_license | chenhorin/downup | 0014e81741403a1ecd63758e6567a996b1d151e7 | 871992496f0320d4b9c34550829295bd7b0143e1 | refs/heads/master | 2020-04-02T05:23:31.831061 | 2018-11-01T08:25:46 | 2018-11-01T08:25:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,668 | java | package net.coding.codingftp.controller;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import lombok.extern.slf4j.Slf4j;
import net.coding.codingftp.DTO.PhoneUserJsonDTO;
import net.coding.codingftp.DTO.PicCountByUserDTO;
import net.coding.codingftp.VO.PhonePicListAndThemeVO;
import net.coding.codingftp.VO.PhoneURLVO;
import net.coding.codingftp.common.ServerResponse;
import net.coding.codingftp.pojo.UserTitleInfo;
import net.coding.codingftp.service.IFileService;
import net.coding.codingftp.util.PropertiesUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.IOUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
public class DownloadController {
@Autowired
private IFileService iFileService;
public static String TOMCAT_PATH = null;
@Value("${static.json.file}")
private Resource jsonFile;
private static List<PicCountByUserDTO> picCountByUserDTOS = new ArrayList<>();
@PostMapping("/upload")
// @RequestParam(value = "upload_file",required = false) 对应的是表单提交的name
public ServerResponse upload(HttpSession session, @RequestParam(value = "file", required = false) MultipartFile file,
@RequestParam(value = "UserName") String userName,
@RequestParam(value = "Number") Integer number,
@RequestParam(value = "Type", required = false) Integer type,
HttpServletRequest request) {
if (0 == type) {
return ServerResponse.createBySuccess();
}
String path = request.getSession().getServletContext().getRealPath(userName);
TOMCAT_PATH = path;
// 判断是否已经存在当前用户,根据结果来进行Number的保存
for (PicCountByUserDTO userDTO : picCountByUserDTOS) {
if (StringUtils.equals(userDTO.getName(), userName)) {
userDTO.setNumber(number);
String targetFileName = iFileService.upload(file, path);
String url = PropertiesUtil.getProperty("ftp.server.http.prefix") + userName + "/" + targetFileName;
Map fileMap = Maps.newHashMap();
fileMap.put("uri", targetFileName);
fileMap.put("url", url);
return ServerResponse.createBySuccess(fileMap);
}
}
PicCountByUserDTO userDTO = new PicCountByUserDTO();
userDTO.setName(userName);
userDTO.setNumber(number);
picCountByUserDTOS.add(userDTO);
String targetFileName = iFileService.upload(file, path);
String url = PropertiesUtil.getProperty("ftp.server.http.prefix") + userName + "/" + targetFileName;
Map fileMap = Maps.newHashMap();
fileMap.put("uri", targetFileName);
fileMap.put("url", url);
return ServerResponse.createBySuccess(fileMap);
}
// PC客户端获取照片数量
@GetMapping("/DownPhone")
public Integer getPicNum(HttpSession session, @RequestParam(value = "UserName", required = false) String userName) {
for (PicCountByUserDTO userDTO : picCountByUserDTOS) {
if (StringUtils.equals(userDTO.getName(), userName)) {
return userDTO.getNumber();
}
}
return 0;
}
// 手机获取图片列表
@GetMapping("/DownForPhone")
public ServerResponse getPicList(HttpSession session, @RequestParam(value = "UserName", required = false) String userName,
@RequestParam(value = "Number", defaultValue = "0") Integer number) {
PhonePicListAndThemeVO voData = new PhonePicListAndThemeVO();
List<String> picList = new ArrayList<>();
if (StringUtils.isBlank(userName)) {
picList.add("img/admin/1.png");
picList.add("img/admin/12.png");
picList.add("img/admin/mid.png");
picList.add("img/admin/mid-75.png");
voData.setThemePics(picList);
voData.setTitle("魔幻照相馆");
return ServerResponse.createBySuccess(voData);
}
PhonePicListAndThemeVO tempData = iFileService.getPicList(userName).getData();
if (null != tempData) {
voData = tempData;
}
//组装主题和标题
String json = null;
Gson gson = new Gson();
List<UserTitleInfo> data = new ArrayList<>();
// 读取json配置文件,并且转化为java对象
try {
json = new String(IOUtils.readFully(jsonFile.getInputStream(), -1, true));
PhoneUserJsonDTO phoneUserJsonDTO = gson.fromJson(json,
new TypeToken<PhoneUserJsonDTO>() {
}.getType());
if (null == phoneUserJsonDTO) {
return ServerResponse.createByErrorMessage("配置文件没有添加用户");
}
data = phoneUserJsonDTO.getData();
} catch (IOException e) {
log.info("静态json文件读取错误");
}
if (data.size() == 0) {
return ServerResponse.createByErrorMessage("Json数据转换失败,数据未获取");
} else {
for (UserTitleInfo datum : data) {
if (StringUtils.equals(userName, datum.getUsername())) {
picList.add("img/" + userName + "/1.png");
picList.add("img/" + userName + "/12.png");
picList.add("img/" + userName + "/mid.png");
picList.add("img/" + userName + "/mid-75.png");
voData.setTitle(datum.getTitle());
voData.setThemePics(picList);
return ServerResponse.createBySuccess(voData);
}
}
picList.add("img/admin/1.png");
picList.add("img/admin/12.png");
picList.add("img/admin/mid.png");
picList.add("img/admin/mid-75.png");
voData.setThemePics(picList);
voData.setTitle("魔幻照相馆");
return ServerResponse.createBySuccess(voData);
}
}
// U3D转到手机端
@GetMapping("/Login")
public PhoneURLVO<String> getPicList(HttpSession session, @RequestParam(value = "UserName", required = false) String userName) {
for (PicCountByUserDTO userDTO : picCountByUserDTOS) {
if (StringUtils.equals(userDTO.getName(), userName)) {
PhoneURLVO URL = new PhoneURLVO();
URL.setData(PropertiesUtil.getProperty("phone.http.prefix") + "?u=" + userName);
return URL;
}
}
PhoneURLVO URL = new PhoneURLVO();
URL.setData(PropertiesUtil.getProperty("phone.http.prefix"));
return URL;
}
}
| [
"chenhorin@163.com"
] | chenhorin@163.com |
bfeb889f3d50ec319d7148219a59428ecea71a42 | 089bd286cf2438b7998e9b6792b8f1b6dcc10ad2 | /src/com/code/services/UserService.java | b97da0d9bc733e6983d6c314fa115b104fc3be40 | [] | no_license | mohamed-nageh/Ejada-Temp | 10ceb39b388b0d28812de7ba89dc7eb2f5ee07b2 | 4401b60080057049dbd2ae201c6a245f89ed552b | refs/heads/master | 2021-06-01T07:07:30.432031 | 2016-08-18T10:37:20 | 2016-08-18T10:37:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,220 | java | package com.code.services;
import com.code.dal.orm.User;
import com.code.dal.orm.UserRole;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class UserService {
public static final String SCHEMA_NAME = "TEST";
public static final String UNIQUE_USERNAME_CONSTRAINT_NAME = SCHEMA_NAME + "." + "SYS_C0046515";
private static UserService singleton = null;
private SessionFactory sessionFactory = null;
private UserService() {
sessionFactory = SessionFactorySingleton.getSingleton().getSessionFactory();
}
public static UserService getSingleton() {
if (singleton == null)
singleton = new UserService();
return singleton;
}
public User getUserById(Long id) {
User user = null;
Session session = sessionFactory.openSession();
session.beginTransaction();
Query query = session.getNamedQuery("User.byId");
query.setLong("id", id);
List list = query.list();
if (list.size() == 1)
user = (User) list.get(0);
session.getTransaction().commit();
session.close();
return user;
}
public User getUserByUsernameAndPassword(String username, String password) {
User user = null;
Session session = sessionFactory.openSession();
session.beginTransaction();
Query query = session.getNamedQuery("User.byUsernameAndPassword");
query.setString("username", username);
query.setString("password", password);
List list = query.list();
if (list.size() == 1)
user = (User) list.get(0);
session.getTransaction().commit();
session.close();
return user;
}
public Collection<User> getAllUsers() {
Collection<User> users = new ArrayList<User>();
Session session = sessionFactory.openSession();
session.beginTransaction();
Query query = session.getNamedQuery("User.all");
List list = query.list();
for (Object o : list)
users.add((User) o);
session.getTransaction().commit();
session.close();
return users;
}
public void saveUser(User user) {
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
session.close();
}
public void updateUser(User user) {
Session session = sessionFactory.openSession();
session.beginTransaction();
session.update(user);
session.getTransaction().commit();
session.close();
}
public User getUserByUsername(String username) {
return getUserByUsernameAndPassword(username, null);
}
public User authenticateUser(String username, String password) {
return getUserByUsernameAndPassword(username, password);
}
public String getUserRole(Long userId) {
String userRole = null;
Session session = sessionFactory.openSession();
session.beginTransaction();
Query query = session.getNamedQuery("UserRole.byUserId");
query.setLong("userId", userId);
List list = query.list();
if (list.size() > 0) // TODO handle multiple roles
userRole = ((UserRole) list.get(0)).getRoleName();
session.getTransaction().commit();
session.close();
if (userRole == null)
userRole = UserRole.NORMAL;
return userRole;
}
}
| [
"n1amr1@gmail.com"
] | n1amr1@gmail.com |
4a7b86ccc30a60ec4f3bee7045a8013a58ed31cf | e19d9ae43ee1f977276e148e669d864e5dc2dd12 | /app/src/main/java/com/example/sd_storage/MainActivity.java | 9e96cb660060e1db25e0a65c4e68e5dd83f3afb3 | [] | no_license | alvssantos-21/SD_storage | 6ab6dd07289cce5ac85718b698611f3af593151a | cc832ba856f9ed8e97b98bbb84643dc35e49796e | refs/heads/master | 2020-08-28T02:39:46.116133 | 2019-10-25T15:36:04 | 2019-10-25T15:36:04 | 217,564,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,188 | java | package com.example.sd_storage;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
String[] verNames, dates;
ListView lstversions;
int[] logo = {R.drawable.cupcake, R.drawable.donut, R.drawable.eclair, R.drawable.froyo, R.drawable.ginger, R.drawable.honeycomb, R.drawable.ice};
ArrayList<AndroidVersion> versions = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setTitle("Android Version");
verNames = getResources().getStringArray(R.array.verName);
dates = getResources().getStringArray(R.array.rDate);
for(int i = 0; i < verNames.length; i++){
versions.add(new AndroidVersion(logo[i], verNames[i], dates[i]));
}
AndroidAdapter adapter = new AndroidAdapter(this, R.layout.item, versions);
lstversions = findViewById(R.id.lvAndroid);
lstversions.setAdapter(adapter);
lstversions.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> parent, View view,final int i, long id) {
//Toast.makeText(this, verNames[i], Toast.LENGTH_LONG).show();
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setIcon(logo[i]);
dialog.setTitle(verNames[i]);
dialog.setMessage(dates[i]);
dialog.setNeutralButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Toast.makeText(MainActivity.this, verNames[i], Toast.LENGTH_LONG).show();
}
});
dialog.create().show();
}
}
| [
"alvinjeff.santos.iics@ust.edu.ph"
] | alvinjeff.santos.iics@ust.edu.ph |
e79f7a781f2260d2503299e74d57383a5c0941f5 | 2907303477ff0533c5e616fe4a663dbae3a16d24 | /src/test/java/fi/csc/chipster/rest/AdminResourceStatParsingTest.java | 156a8b794b94f9cff3ccaf31d6986b80fdcdb686 | [
"MIT"
] | permissive | edwardtao/chipster-web-server | ce2778a01f9da9b0bc373bbf1dae1f1d08ee38a0 | 90a82dfecc71a9f49ea5142ea5c69911a062f48e | refs/heads/master | 2023-05-22T05:34:45.781330 | 2021-06-02T06:45:29 | 2021-06-02T06:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,697 | java | package fi.csc.chipster.rest;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import org.junit.Test;
public class AdminResourceStatParsingTest {
@Test
public void parseContainerCpuStats() {
String stats = "user 12799096\n" +
"system 952552\n";
HashMap<String, Object> status = new HashMap<>();
AdminResource.parseContainerCpuStats(stats, status);
assertEquals(Long.valueOf(12799096), status.get("cpu.user"));
// for (String key : status.keySet()) {
// System.out.println(key + ": " + status.get(key));
// }
}
@Test
public void parseContainerMemoryStats() {
String memoryString = "cache 33280602112\n" +
"rss 1157156864\n" +
"rss_huge 566231040\n" +
"mapped_file 1527808\n" +
"swap 0\n" +
"pgpgin 910350605\n" +
"pgpgout 905237877\n" +
"pgfault 1858278414\n" +
"pgmajfault 5048\n" +
"inactive_anon 0\n" +
"active_anon 1157124096\n" +
"inactive_file 930308096\n" +
"active_file 32350294016\n" +
"unevictable 0\n" +
"hierarchical_memory_limit 41875931136\n" +
"hierarchical_memsw_limit 41875931136\n" +
"total_cache 33280602112\n" +
"total_rss 1157156864\n" +
"total_rss_huge 566231040\n" +
"total_mapped_file 1527808\n" +
"total_swap 0\n" +
"total_pgpgin 910350605\n" +
"total_pgpgout 905237877\n" +
"total_pgfault 1858278414\n" +
"total_pgmajfault 5048\n" +
"total_inactive_anon 0\n" +
"total_active_anon 1157124096\n" +
"total_inactive_file 930308096\n" +
"total_active_file 32350294016\n" +
"total_unevictable 0\n";
HashMap<String, Object> mem = new HashMap<>();
AdminResource.parseContainerMemoryStats(memoryString, mem);
assertEquals(Long.valueOf(1157156864), mem.get("mem.rss"));
// for (String key : mem.keySet()) {
// System.out.println(key + ": " + mem.get(key));
// }
}
@Test
public void parseContainerDiskStats() {
String diskString = "253:0 Read 113679659008\n" +
"253:0 Write 22238393344\n" +
"253:0 Sync 21107835904\n" +
"253:0 Async 114810216448\n" +
"253:0 Total 135918052352\n" +
"8:16 Read 113687285760\n" +
"8:16 Write 22844026880\n" +
"8:16 Sync 21713420288\n" +
"8:16 Async 114817892352\n" +
"8:16 Total 136531312640\n" +
"253:1 Read 7168000\n" +
"253:1 Write 676328448\n" +
"253:1 Sync 676279296\n" +
"253:1 Async 7217152\n" +
"253:1 Total 683496448\n" +
"Total 273132861440\n";
HashMap<String, Object> disk = new HashMap<>();
AdminResource.parseContainerDiskStats(diskString, disk);
assertEquals(Long.valueOf(113679659008l), disk.get("disk.read,dev=253:0"));
// for (String key : disk.keySet()) {
// System.out.println(key + ": " + disk.get(key));
// }
}
@Test
public void parseContainerNetStats() {
String netString = "Inter-| Receive | Transmit\n" +
" face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed\n" +
" eth0: 210692602135 21770865 0 0 0 0 0 0 41905777974 17418185 0 0 0 0 0 0\n" +
" lo: 10061358324 729772 0 0 0 0 0 0 10061358324 729772 0 0 0 0 0 0\n";
HashMap<String, Object> net = new HashMap<>();
AdminResource.parseContainerNetStats(netString, net);
assertEquals(Long.valueOf(210692602135l), net.get("net.receive.bytes,interface=eth0"));
// for (String key : net.keySet()) {
// System.out.println(key + ": " + net.get(key));
// }
}
}
| [
"petri.klemela@csc.fi"
] | petri.klemela@csc.fi |
3daadf1e6a12ca401d0092d78eb5f78c5178df0e | adc551b6fa2267532b1732b8d9738e8d99cb3ca9 | /app/src/main/java/com/example/bouchef/tubolsillo/LocationActivityAmigable.java | a09a94fd2446644d399fd95dadc0a9fadc84eab9 | [] | no_license | bouchef/TuBolsilloApp | 7fe6cf487ae2943e2a97816e8618f40b285c2489 | 8a47b262d9c002813a3a5f9d3eb6a8327510ed25 | refs/heads/master | 2020-08-04T02:26:16.739047 | 2019-09-30T23:17:47 | 2019-09-30T23:17:47 | 211,970,583 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,951 | java | package com.example.bouchef.tubolsillo;
import android.graphics.Point;
import android.os.Bundle;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
/**
* Created by World of UI/UX on 01/04/2019.
*/
public class LocationActivityAmigable extends AppCompatActivity implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location_amigable);
// Google map code is here.
ImageView imgProfile=(ImageView)findViewById(R.id.imgprofile);
Glide.with(this)
.load(R.drawable.restaurant)
.apply(RequestOptions.circleCropTransform())
.into(imgProfile);
MapFragment mapFragment = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map2);
mapFragment.getMapAsync((OnMapReadyCallback) this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
LatLng origin = new LatLng(-0.1550, 51.5207);
LatLng destination = new LatLng(-0.1550, 51.5207);
LatLngBounds bounds = new LatLngBounds.Builder()
.include(origin)
.include(destination).build();
Point displaySize = new Point();
getWindowManager().getDefaultDisplay().getSize(displaySize);
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, displaySize.x, 250, 30));
}
}
| [
"lmauro@ergorenova.com"
] | lmauro@ergorenova.com |
7c3cb3c5db24fa8f0e6268bd0b4bf79139883119 | 9a6ea6087367965359d644665b8d244982d1b8b6 | /src/main/java/X/C12920jJ.java | 63438761f4312e3a740f27827262216e2a8c7ba0 | [] | no_license | technocode/com.wa_2.21.2 | a3dd842758ff54f207f1640531374d3da132b1d2 | 3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9 | refs/heads/master | 2023-02-12T11:20:28.666116 | 2021-01-14T10:22:21 | 2021-01-14T10:22:21 | 329,578,591 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,644 | java | package X;
import android.content.Context;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import java.lang.ref.WeakReference;
/* renamed from: X.0jJ reason: invalid class name and case insensitive filesystem */
public class C12920jJ extends ActionMode {
public final Context A00;
public final AbstractC06110Rt A01;
public C12920jJ(Context context, AbstractC06110Rt r2) {
this.A00 = context;
this.A01 = r2;
}
public void finish() {
this.A01.A00();
}
public View getCustomView() {
AbstractC06110Rt r1 = this.A01;
if (!(r1 instanceof AnonymousClass1ZM)) {
WeakReference weakReference = ((AnonymousClass0V6) r1).A01;
if (weakReference != null) {
return (View) weakReference.get();
}
return null;
}
WeakReference weakReference2 = ((AnonymousClass1ZM) r1).A04;
if (weakReference2 != null) {
return (View) weakReference2.get();
}
return null;
}
public Menu getMenu() {
AnonymousClass0T8 r1;
Context context = this.A00;
AbstractC06110Rt r12 = this.A01;
if (!(r12 instanceof AnonymousClass1ZM)) {
r1 = ((AnonymousClass0V6) r12).A03;
} else {
r1 = ((AnonymousClass1ZM) r12).A02;
}
return new AnonymousClass1ZY(context, r1);
}
public MenuInflater getMenuInflater() {
AbstractC06110Rt r1 = this.A01;
if (!(r1 instanceof AnonymousClass1ZM)) {
return new C12950jM(((AnonymousClass0V6) r1).A02);
}
return new C12950jM(((AnonymousClass1ZM) r1).A03.getContext());
}
public CharSequence getSubtitle() {
AbstractC06110Rt r1 = this.A01;
if (!(r1 instanceof AnonymousClass1ZM)) {
return ((AnonymousClass0V6) r1).A04.A09.A08;
}
return ((AnonymousClass1ZM) r1).A03.A08;
}
public Object getTag() {
return this.A01.A00;
}
public CharSequence getTitle() {
AbstractC06110Rt r1 = this.A01;
if (!(r1 instanceof AnonymousClass1ZM)) {
return ((AnonymousClass0V6) r1).A04.A09.A09;
}
return ((AnonymousClass1ZM) r1).A03.A09;
}
public boolean getTitleOptionalHint() {
return this.A01.A01;
}
public void invalidate() {
this.A01.A01();
}
public boolean isTitleOptional() {
AbstractC06110Rt r1 = this.A01;
if (r1 instanceof AnonymousClass1ZM) {
return ((AnonymousClass1ZM) r1).A03.A0A;
}
if (!(r1 instanceof AnonymousClass0V6)) {
return false;
}
return ((AnonymousClass0V6) r1).A04.A09.A0A;
}
public void setCustomView(View view) {
this.A01.A02(view);
}
@Override // android.view.ActionMode
public void setSubtitle(int i) {
AbstractC06110Rt r2 = this.A01;
if (!(r2 instanceof AnonymousClass1ZM)) {
AnonymousClass0V6 r22 = (AnonymousClass0V6) r2;
r22.A03(r22.A04.A01.getResources().getString(i));
return;
}
AnonymousClass1ZM r23 = (AnonymousClass1ZM) r2;
r23.A03.setSubtitle(r23.A00.getString(i));
}
@Override // android.view.ActionMode
public void setSubtitle(CharSequence charSequence) {
this.A01.A03(charSequence);
}
public void setTag(Object obj) {
this.A01.A00 = obj;
}
@Override // android.view.ActionMode
public void setTitle(int i) {
AbstractC06110Rt r2 = this.A01;
if (!(r2 instanceof AnonymousClass1ZM)) {
AnonymousClass0V6 r22 = (AnonymousClass0V6) r2;
r22.A04(r22.A04.A01.getResources().getString(i));
return;
}
AnonymousClass1ZM r23 = (AnonymousClass1ZM) r2;
r23.A03.setTitle(r23.A00.getString(i));
}
@Override // android.view.ActionMode
public void setTitle(CharSequence charSequence) {
this.A01.A04(charSequence);
}
public void setTitleOptionalHint(boolean z) {
AbstractC06110Rt r1 = this.A01;
if (r1 instanceof AnonymousClass1ZM) {
AnonymousClass1ZM r12 = (AnonymousClass1ZM) r1;
((AbstractC06110Rt) r12).A01 = z;
r12.A03.setTitleOptional(z);
} else if (!(r1 instanceof AnonymousClass0V6)) {
r1.A01 = z;
} else {
AnonymousClass0V6 r13 = (AnonymousClass0V6) r1;
((AbstractC06110Rt) r13).A01 = z;
r13.A04.A09.setTitleOptional(z);
}
}
}
| [
"madeinborneo@gmail.com"
] | madeinborneo@gmail.com |
a6041878abbebee083d89db6b5a5555771e813a8 | c49369238323ac21f10665c45067f46d86368cff | /src/main/java/com/askrindo/repository/SequenceIdReleaseRepository.java | ad0302f08593e6ee852363877b10e4cc588a4bf9 | [] | no_license | pratamaV/monitoring_project_BE | 8f8981ade18b3e166d9e766aec72a5646f7a9668 | f97c02077b52a09f8c07a79aa475bb92deaaf9ab | refs/heads/master | 2023-05-07T08:35:46.756221 | 2021-03-14T13:44:33 | 2021-03-14T13:44:33 | 343,460,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.askrindo.repository;
import com.askrindo.entity.sequence.SequenceIdRelease;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface SequenceIdReleaseRepository extends JpaRepository<SequenceIdRelease, String> {
}
| [
"tripurwanti05@gmail.com"
] | tripurwanti05@gmail.com |
0ebda44cf9160a1ba198a6d371b08eb35087d5f1 | ae71ea77eb13d0962b863ee68ef0fc33b65ecb75 | /app/src/main/java/com/slb/factory/weight/hellocharts/listener/PieChartOnValueSelectListener.java | ebb8a4493480aad3f7195df22c3db03b36939f6b | [] | no_license | 154336119/factory | 7174ce842c8007d86aaa08403b9f169f6e1d9548 | 2f88ffd52e995f33db5a908aa2e165b8668c3671 | refs/heads/master | 2020-05-26T20:15:16.552551 | 2019-09-24T08:13:52 | 2019-09-24T08:13:52 | 188,358,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | package com.slb.factory.weight.hellocharts.listener;
import com.slb.factory.weight.hellocharts.model.SliceValue;
public interface PieChartOnValueSelectListener extends OnValueDeselectListener {
public void onValueSelected(int arcIndex, SliceValue value);
}
| [
"154336@qq.com"
] | 154336@qq.com |
a224e7233230de68e5053f75a8cd08d893ed5742 | 5d5c2688698a2d6689c1d635724b550b31224c86 | /extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/component/dojo/form/UIDojoRangeBoundTextBox.java | e26e034ba68486a287e4a92d0fe7fd3160a92d6f | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-other-permissive",
"MIT",
"CDDL-1.1",
"LicenseRef-scancode-public-domain"
] | permissive | OpenNTF/XPagesExtensionLibrary | 6bffba4bd5eab5b148a3b4d700da244aab053743 | 25b3b1df7fafb7ceb131e07ade93de5c9ff733d5 | refs/heads/master | 2020-04-15T16:12:15.910509 | 2020-03-11T11:49:17 | 2020-03-11T11:49:17 | 26,643,618 | 21 | 35 | Apache-2.0 | 2019-03-25T12:55:44 | 2014-11-14T15:08:35 | Java | WINDOWS-1252 | Java | false | false | 1,719 | java | /*
* © Copyright IBM Corp. 2010
*
* 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.ibm.xsp.extlib.component.dojo.form;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
public class UIDojoRangeBoundTextBox extends UIDojoMappedTextBox {
// RangeBoundTextBox
private String rangeMessage;
public UIDojoRangeBoundTextBox() {
}
public String getRangeMessage() {
if (null != this.rangeMessage) {
return this.rangeMessage;
}
ValueBinding _vb = getValueBinding("rangeMessage"); //$NON-NLS-1$
if (_vb != null) {
return (java.lang.String) _vb.getValue(FacesContext.getCurrentInstance());
} else {
return null;
}
}
public void setRangeMessage(String rangeMessage) {
this.rangeMessage = rangeMessage;
}
// State management
@Override
public void restoreState(FacesContext _context, Object _state) {
Object _values[] = (Object[]) _state;
super.restoreState(_context, _values[0]);
this.rangeMessage = (String)_values[1];
}
@Override
public Object saveState(FacesContext _context) {
Object _values[] = new Object[2];
_values[0] = super.saveState(_context);
_values[1] = rangeMessage;
return _values;
}
}
| [
"padraic.edwards@ie.ibm.com"
] | padraic.edwards@ie.ibm.com |
37fcb12d81b8463a02b4999fc29111838f5d94c4 | e7d8749047683227ae5253e43b4681dc18c91c80 | /agent-module/agent-backend/src/main/java/com/megatravel/agentbackend/ws/CategorySoap.java | eca66d2bed2feee783524d1af165504de2b96348 | [] | no_license | ZeljkovicIgor/mega-travel | 46bae902915f623bd30df57239b62631f75c42b9 | 5fd484f187bd00df7726852f7f6485aebdefeee0 | refs/heads/master | 2022-01-22T06:23:50.991152 | 2019-06-30T08:29:28 | 2019-06-30T08:29:28 | 194,932,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,962 | java |
package com.megatravel.agentbackend.ws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for categorySoap complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="categorySoap">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="category_id" type="{http://www.w3.org/2001/XMLSchema}long"/>
* <element name="category_name" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "categorySoap", propOrder = {
"categoryId",
"categoryName"
})
public class CategorySoap {
@XmlElement(name = "category_id")
protected long categoryId;
@XmlElement(name = "category_name", required = true)
protected String categoryName;
/**
* Gets the value of the categoryId property.
*
*/
public long getCategoryId() {
return categoryId;
}
/**
* Sets the value of the categoryId property.
*
*/
public void setCategoryId(long value) {
this.categoryId = value;
}
/**
* Gets the value of the categoryName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCategoryName() {
return categoryName;
}
/**
* Sets the value of the categoryName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCategoryName(String value) {
this.categoryName = value;
}
}
| [
"gemovics@gmail.com"
] | gemovics@gmail.com |
bb48f3fde36bd61230822062b1c0a118e0c80003 | 3125139655dcd5bb157bdced714056b4f55a99ec | /src/com/mishiranu/dashchan/content/service/AudioPlayerService.java | 59490d5c31640505355ac6a924596af179439e01 | [
"Apache-2.0"
] | permissive | CesPaul/Dashchan | 1b9a6efabb82e6a9c364e471e3f696e6ae225736 | 91900751710290f2a276024a514c0404881197fe | refs/heads/master | 2020-06-16T02:58:02.270115 | 2020-03-13T09:53:52 | 2020-03-13T09:53:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,509 | java | /*
* Copyright 2014-2016 Fukurou Mishiranu
*
* 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.mishiranu.dashchan.content.service;
import java.io.File;
import android.annotation.TargetApi;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.PowerManager;
import android.support.v4.content.LocalBroadcastManager;
import android.view.ContextThemeWrapper;
import com.mishiranu.dashchan.C;
import com.mishiranu.dashchan.R;
import com.mishiranu.dashchan.content.CacheManager;
import com.mishiranu.dashchan.content.async.ReadFileTask;
import com.mishiranu.dashchan.content.model.ErrorItem;
import com.mishiranu.dashchan.preference.Preferences;
import com.mishiranu.dashchan.util.ResourceUtils;
import com.mishiranu.dashchan.util.ToastUtils;
import com.mishiranu.dashchan.util.ViewUtils;
public class AudioPlayerService extends Service implements AudioManager.OnAudioFocusChangeListener,
MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, ReadFileTask.Callback {
private static final String ACTION_START = "com.mishiranu.dashchan.action.START";
public static final String ACTION_CANCEL = "com.mishiranu.dashchan.action.CANCEL";
public static final String ACTION_TOGGLE = "com.mishiranu.dashchan.action.TOGGLE";
private static final String EXTRA_CHAN_NAME = "com.mishiranu.dashchan.extra.CHAN_NAME";
private static final String EXTRA_FILE_NAME = "com.mishiranu.dashchan.extra.FILE_NAME";
private AudioManager audioManager;
private NotificationManager notificationManager;
private int notificationColor;
private PowerManager.WakeLock wakeLock;
private Notification.Builder builder;
private ReadFileTask readFileTask;
private MediaPlayer mediaPlayer;
private String chanName;
private String fileName;
private File audioFile;
private Context context;
private boolean pausedByTransientLossOfFocus = false;
private static Intent obtainIntent(Context context, String action) {
return new Intent(context, AudioPlayerService.class).setAction(action);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onCreate() {
super.onCreate();
audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
int notificationColor = 0;
if (C.API_LOLLIPOP) {
Context themedContext = new ContextThemeWrapper(this, Preferences.getThemeResource());
notificationColor = ResourceUtils.getColor(themedContext, android.R.attr.colorAccent);
}
this.notificationColor = notificationColor;
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AudioPlayerWakeLock");
wakeLock.setReferenceCounted(false);
context = new ContextThemeWrapper(this, R.style.Theme_Special_Notification);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
String action = intent.getAction();
if (ACTION_START.equals(action)) {
cleanup();
CacheManager cacheManager = CacheManager.getInstance();
if (!cacheManager.isCacheAvailable()) {
ToastUtils.show(this, R.string.message_cache_unavailable);
stopSelf();
sendToActivity(ACTION_CANCEL);
} else {
Uri uri = intent.getData();
chanName = intent.getStringExtra(EXTRA_CHAN_NAME);
fileName = intent.getStringExtra(EXTRA_FILE_NAME);
File cachedFile = cacheManager.getMediaFile(uri, true);
if (cachedFile == null) {
ToastUtils.show(this, R.string.message_cache_unavailable);
cleanup();
stopSelf();
sendToActivity(ACTION_CANCEL);
} else {
wakeLock.acquire();
if (cachedFile.exists()) {
initAndPlayAudio(cachedFile);
} else {
readFileTask = new ReadFileTask(this, chanName, uri, cachedFile, true, this);
readFileTask.executeOnExecutor(ReadFileTask.THREAD_POOL_EXECUTOR);
}
}
}
} else if (ACTION_CANCEL.equals(action)) {
cleanup();
stopSelf();
sendToActivity(ACTION_CANCEL);
} else if (ACTION_TOGGLE.equals(action)) {
togglePlayback();
}
}
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
cleanup();
super.onDestroy();
}
private void sendToActivity(String action) {
LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(action));
}
private void cleanup() {
if (readFileTask != null) {
readFileTask.cancel();
readFileTask = null;
}
audioManager.abandonAudioFocus(this);
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.release();
mediaPlayer = null;
}
wakeLock.release();
stopForeground(true);
sendToActivity(ACTION_CANCEL);
}
private void togglePlayback() {
boolean success;
if (mediaPlayer.isPlaying()) {
success = pause(true);
} else {
success = play(true);
}
if (success) {
refreshPlaybackNotification(true);
sendToActivity(ACTION_TOGGLE);
} else {
ToastUtils.show(context, R.string.message_playback_error);
cleanup();
stopSelf();
sendToActivity(ACTION_CANCEL);
}
}
public class Binder extends android.os.Binder {
public void togglePlayback() {
if (mediaPlayer != null) {
AudioPlayerService.this.togglePlayback();
}
}
public void stop() {
cleanup();
stopSelf();
}
public boolean isPlaying() {
return mediaPlayer != null ? mediaPlayer.isPlaying() : false;
}
public String getFileName() {
return fileName;
}
public int getPosition() {
return mediaPlayer != null ? mediaPlayer.getCurrentPosition() : -1;
}
public int getDuration() {
return mediaPlayer != null ? mediaPlayer.getDuration() : -1;
}
public void seekTo(int msec) {
if (mediaPlayer != null) {
mediaPlayer.seekTo(msec);
}
}
}
@Override
public Binder onBind(Intent intent) {
return new Binder();
}
@Override
public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_LOSS: {
pause(true);
break;
}
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: {
boolean playing = mediaPlayer.isPlaying();
pause(false);
if (playing) {
pausedByTransientLossOfFocus = true;
}
break;
}
case AudioManager.AUDIOFOCUS_GAIN: {
if (pausedByTransientLossOfFocus) {
play(false);
}
break;
}
}
}
@Override
public void onCompletion(MediaPlayer mp) {
pause(true);
mediaPlayer.stop();
mediaPlayer.release();
initAndPlayAudio(audioFile);
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
ToastUtils.show(context, R.string.message_playback_error);
if (audioFile != null) {
audioFile.delete();
}
cleanup();
stopSelf();
sendToActivity(ACTION_CANCEL);
return true;
}
private boolean pause(boolean resetFocus) {
if (resetFocus) {
audioManager.abandonAudioFocus(this);
}
mediaPlayer.pause();
wakeLock.acquire(15000);
return true;
}
private boolean play(boolean resetFocus) {
if (resetFocus && audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN)
!= AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
return false;
}
mediaPlayer.start();
wakeLock.acquire();
return true;
}
private void initAndPlayAudio(File file) {
audioFile = file;
pausedByTransientLossOfFocus = false;
mediaPlayer = new MediaPlayer();
mediaPlayer.setLooping(false);
mediaPlayer.setOnCompletionListener(this);
mediaPlayer.setOnErrorListener(this);
try {
mediaPlayer.setDataSource(file.getPath());
mediaPlayer.prepare();
} catch (Exception e) {
audioFile.delete();
CacheManager.getInstance().handleDownloadedFile(audioFile, false);
ToastUtils.show(context, R.string.message_playback_error);
cleanup();
stopSelf();
sendToActivity(ACTION_CANCEL);
return;
}
play(true);
refreshPlaybackNotification(true);
}
private int progress, progressMax;
private long lastUpdate;
private static final int[] ICON_ATTRS = {R.attr.notificationRefresh, R.attr.notificationCancel,
R.attr.notificationPlay, R.attr.notificationPause};
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void refreshPlaybackNotification(boolean recreate) {
Notification.Builder builder = this.builder;
if (builder == null || recreate) {
builder = new Notification.Builder(this);
builder.setSmallIcon(R.drawable.ic_audiotrack_white_24dp);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(this, AudioPlayerActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(contentIntent);
TypedArray typedArray = context.obtainStyledAttributes(ICON_ATTRS);
PendingIntent toggleIntent = PendingIntent.getService(context, 0,
obtainIntent(this, ACTION_TOGGLE), PendingIntent.FLAG_UPDATE_CURRENT);
boolean playing = mediaPlayer.isPlaying();
ViewUtils.addNotificationAction(builder, context, typedArray, playing ? 3 : 2,
playing ? R.string.action_pause : R.string.action_play, toggleIntent);
PendingIntent cancelIntent = PendingIntent.getService(context, 0,
obtainIntent(this, ACTION_CANCEL), PendingIntent.FLAG_UPDATE_CURRENT);
ViewUtils.addNotificationAction(builder, context, typedArray, 1, R.string.action_stop, cancelIntent);
typedArray.recycle();
if (C.API_LOLLIPOP) {
builder.setColor(notificationColor);
}
this.builder = builder;
builder.setContentTitle(getString(R.string.message_file_playback));
builder.setContentText(getString(R.string.message_download_name_format, fileName));
}
startForeground(C.NOTIFICATION_ID_AUDIO_PLAYER, builder.build());
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void refreshDownloadingNotification(boolean recreate, boolean error, Uri uri) {
Notification.Builder builder = this.builder;
if (builder == null || recreate) {
builder = new Notification.Builder(this);
builder.setSmallIcon(error ? android.R.drawable.stat_sys_download_done
: android.R.drawable.stat_sys_download);
builder.setDeleteIntent(PendingIntent.getService(context, 0, obtainIntent(this, ACTION_CANCEL),
PendingIntent.FLAG_UPDATE_CURRENT));
TypedArray typedArray = context.obtainStyledAttributes(ICON_ATTRS);
if (error) {
PendingIntent retryIntent = PendingIntent.getService(context, 0, obtainIntent(this, ACTION_START)
.setData(uri).putExtra(EXTRA_CHAN_NAME, chanName).putExtra(EXTRA_FILE_NAME, fileName),
PendingIntent.FLAG_UPDATE_CURRENT);
ViewUtils.addNotificationAction(builder, context, typedArray, 0,
R.string.action_retry, retryIntent);
} else {
PendingIntent cancelIntent = PendingIntent.getService(context, 0, obtainIntent(this, ACTION_CANCEL),
PendingIntent.FLAG_UPDATE_CURRENT);
ViewUtils.addNotificationAction(builder, context, typedArray, 1,
android.R.string.cancel, cancelIntent);
}
typedArray.recycle();
if (C.API_LOLLIPOP) {
builder.setColor(notificationColor);
}
this.builder = builder;
}
if (error) {
builder.setContentTitle(getString(R.string.message_download_completed));
builder.setContentText(getString(R.string.message_download_result_format, 0, 1));
notificationManager.notify(C.NOTIFICATION_ID_AUDIO_PLAYER, builder.build());
} else {
builder.setContentTitle(getString(R.string.message_download_audio));
builder.setContentText(getString(R.string.message_download_name_format, fileName));
builder.setProgress(progressMax, progress, progressMax == 0 ||
progress > progressMax || progress < 0);
startForeground(C.NOTIFICATION_ID_AUDIO_PLAYER, builder.build());
}
}
@Override
public void onFileExists(Uri uri, File file) {
readFileTask = null;
initAndPlayAudio(file);
}
@Override
public void onStartDownloading(Uri uri, File file) {
lastUpdate = 0L;
refreshDownloadingNotification(true, false, null);
}
@Override
public void onFinishDownloading(boolean success, Uri uri, File file, ErrorItem errorItem) {
wakeLock.acquire(15000);
readFileTask = null;
stopForeground(true);
if (success) {
initAndPlayAudio(file);
} else {
refreshDownloadingNotification(true, true, uri);
}
}
@Override
public void onUpdateProgress(long progress, long progressMax) {
this.progress = (int) progress;
this.progressMax = (int) progressMax;
long t = System.currentTimeMillis();
if (t - lastUpdate >= 1000L) {
lastUpdate = t;
refreshDownloadingNotification(false, false, null);
}
}
public static void start(Context context, String chanName, Uri uri, String fileName) {
context.startService(obtainIntent(context, ACTION_START).setData(uri).putExtra(EXTRA_CHAN_NAME, chanName)
.putExtra(EXTRA_FILE_NAME, fileName));
}
} | [
"fukurou.mishiranu@gmail.com"
] | fukurou.mishiranu@gmail.com |
535ddccd95f1c10c8cb9b10cfa2b28d1f0409a94 | 1c7c1759264b0e9c9a2215476225dc5c5e697e26 | /src/test/resources/features/glue/unit/JournalStepdefs.java | a18a6a945fcaccdc4fe4689a41f7e3785e7596ae | [] | no_license | joris77/admin-api | cebc3cce3cf9e57dca8d7db91c7bdb210a3af7e1 | d105a0bd77e2ba316de38e5dbc260925958ebe0e | refs/heads/master | 2020-04-06T03:53:00.705961 | 2017-07-04T21:23:17 | 2017-07-04T21:23:17 | 59,432,071 | 0 | 1 | null | 2016-07-13T15:11:49 | 2016-05-22T20:10:13 | Java | UTF-8 | Java | false | false | 1,312 | java | package features.glue.unit;
import java.math.BigDecimal;
import org.springframework.beans.factory.annotation.Autowired;
import cucumber.api.java.en.And;
import nl.smartworkx.admin.FinancialFactTestHelper;
import nl.smartworkx.admin.FinancialFactServiceTestHelper;
import nl.smartworkx.admin.JournalEntryServiceTestHelper;
import features.glue.integration.AbstractIntegrationStepdefs;
import nl.smartworkx.admin.model.Amount;
import nl.smartworkx.admin.model.financialfact.FinancialFact;
/**
* @author Joris Wijlens
* @version 1.0
* @since 1.0
*/
public class JournalStepdefs extends AbstractIntegrationStepdefs {
@Autowired
private FinancialFactServiceTestHelper financialFactServiceTestHelper;
@Autowired
private JournalEntryServiceTestHelper journalEntryServiceTestHelper;
@And("^there is a journal entry for an outgoing invoice with an amount of (\\d+) ex VAT of (\\d+)%$")
public void thereIsAnOutgoingInvoiceWithAnAmountOfExVATOf(BigDecimal amount, int taxRate) throws Throwable {
Amount amountExVat = new Amount(amount, "EUR");
FinancialFact financialFact = financialFactServiceTestHelper.createFinancialFact(FinancialFactTestHelper.create().amount(amountExVat).build());
journalEntryServiceTestHelper
.createOutgoingInvoiceJournalEntry(financialFact.getId(), amountExVat);
}
}
| [
"joris@smartworkx.nl"
] | joris@smartworkx.nl |
1d5b6b29cf92929d91c778d7c2f8a7c7a708af2f | 47dd7721aa666613f1add2e4c5aa48cc62c82bf6 | /yoink-core-bootstrap/src/main/java/org/wallerlab/yoink/pdbml/v42/generated/PdbxNmrChemShiftExperimentType.java | d2873507db350a45ca6c736207f96f2571ae080a | [] | no_license | ChristianOT/yoink | 0edf95485baba749722e47bf15831d28442b50ae | bd2eebfc42f4cc26dbf439965868fa9ffe817180 | refs/heads/master | 2020-05-29T08:40:27.658171 | 2016-12-06T17:10:51 | 2016-12-06T17:10:51 | 69,651,847 | 0 | 0 | null | 2016-09-30T09:07:05 | 2016-09-30T09:07:04 | null | UTF-8 | Java | false | false | 10,527 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.05.06 at 06:37:17 PM CEST
//
package org.wallerlab.yoink.pdbml.v42.generated;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* Items in the chem_shift_experiment category provide pointers to the NMR experiments and samples used to collect the data for a set of reported assigned chemical shifts.
*
*
*
* <p>Java class for pdbx_nmr_chem_shift_experimentType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="pdbx_nmr_chem_shift_experimentType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="pdbx_nmr_chem_shift_experiment" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="experiment_name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="sample_state" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="isotropic"/>
* <enumeration value="anisotropic"/>
* </restriction>
* </simpleType>
* </element>
* <element name="solution_id" type="{http://www.w3.org/2001/XMLSchema}integer" minOccurs="0"/>
* </all>
* <attribute name="assigned_chem_shift_list_id" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="entry_id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="experiment_id" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "pdbx_nmr_chem_shift_experimentType", propOrder = {
"pdbxNmrChemShiftExperiment"
})
public class PdbxNmrChemShiftExperimentType {
@XmlElement(name = "pdbx_nmr_chem_shift_experiment")
protected List<PdbxNmrChemShiftExperimentType.PdbxNmrChemShiftExperiment> pdbxNmrChemShiftExperiment;
/**
* Gets the value of the pdbxNmrChemShiftExperiment property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the pdbxNmrChemShiftExperiment property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPdbxNmrChemShiftExperiment().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PdbxNmrChemShiftExperimentType.PdbxNmrChemShiftExperiment }
*
*
*/
public List<PdbxNmrChemShiftExperimentType.PdbxNmrChemShiftExperiment> getPdbxNmrChemShiftExperiment() {
if (pdbxNmrChemShiftExperiment == null) {
pdbxNmrChemShiftExperiment = new ArrayList<PdbxNmrChemShiftExperimentType.PdbxNmrChemShiftExperiment>();
}
return this.pdbxNmrChemShiftExperiment;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <all>
* <element name="experiment_name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="sample_state" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="isotropic"/>
* <enumeration value="anisotropic"/>
* </restriction>
* </simpleType>
* </element>
* <element name="solution_id" type="{http://www.w3.org/2001/XMLSchema}integer" minOccurs="0"/>
* </all>
* <attribute name="assigned_chem_shift_list_id" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="entry_id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="experiment_id" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
})
public static class PdbxNmrChemShiftExperiment {
@XmlElementRef(name = "experiment_name", namespace = "http://pdbml.pdb.org/schema/pdbx-v42.xsd", type = JAXBElement.class, required = false)
protected JAXBElement<String> experimentName;
@XmlElementRef(name = "sample_state", namespace = "http://pdbml.pdb.org/schema/pdbx-v42.xsd", type = JAXBElement.class, required = false)
protected JAXBElement<String> sampleState;
@XmlElementRef(name = "solution_id", namespace = "http://pdbml.pdb.org/schema/pdbx-v42.xsd", type = JAXBElement.class, required = false)
protected JAXBElement<BigInteger> solutionId;
@XmlAttribute(name = "assigned_chem_shift_list_id", required = true)
protected BigInteger assignedChemShiftListId;
@XmlAttribute(name = "entry_id", required = true)
protected String entryId;
@XmlAttribute(name = "experiment_id", required = true)
protected BigInteger experimentId;
/**
* Gets the value of the experimentName property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getExperimentName() {
return experimentName;
}
/**
* Sets the value of the experimentName property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public void setExperimentName(JAXBElement<String> value) {
this.experimentName = value;
}
/**
* Gets the value of the sampleState property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getSampleState() {
return sampleState;
}
/**
* Sets the value of the sampleState property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public void setSampleState(JAXBElement<String> value) {
this.sampleState = value;
}
/**
* Gets the value of the solutionId property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link BigInteger }{@code >}
*
*/
public JAXBElement<BigInteger> getSolutionId() {
return solutionId;
}
/**
* Sets the value of the solutionId property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link BigInteger }{@code >}
*
*/
public void setSolutionId(JAXBElement<BigInteger> value) {
this.solutionId = value;
}
/**
* Gets the value of the assignedChemShiftListId property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAssignedChemShiftListId() {
return assignedChemShiftListId;
}
/**
* Sets the value of the assignedChemShiftListId property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAssignedChemShiftListId(BigInteger value) {
this.assignedChemShiftListId = value;
}
/**
* Gets the value of the entryId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEntryId() {
return entryId;
}
/**
* Sets the value of the entryId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEntryId(String value) {
this.entryId = value;
}
/**
* Gets the value of the experimentId property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getExperimentId() {
return experimentId;
}
/**
* Sets the value of the experimentId property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setExperimentId(BigInteger value) {
this.experimentId = value;
}
}
}
| [
"c_oual01@uni-muenster.de"
] | c_oual01@uni-muenster.de |
da803260275d7948c2b6e08d537f905547883c8f | 235e5efd8e22ebc25ced3d1328e9117f107ce549 | /src/test/java/sis/studentinfo/CourseTest.java | 1941a7b78e466e60b629acb5647eab68ca510420 | [] | no_license | biglong/AgileJava | 35eefc0115e4911e2f94b5bfcbe04b139d0938df | d06dd06129dfdec89ee2e30fd9a5785c0170c61b | refs/heads/master | 2020-05-27T05:06:38.404619 | 2014-12-26T10:08:15 | 2014-12-26T10:08:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package sis.studentinfo;
import junit.framework.TestCase;
public class CourseTest extends TestCase {
public void testCreate(){
Course course = new Course("CMSC","120");
assertEquals("CMSC",course.getDepartment());
assertEquals("120",course.getNumber());
}
} | [
"hsl9798@163.com"
] | hsl9798@163.com |
8dfbfe49aa4eb9f2ab27d264d8f961f9e856b322 | 208ba847cec642cdf7b77cff26bdc4f30a97e795 | /fg/fc/src/main/java/org.wp.fc/util/GravatarUtils.java | 2d9beae719a7a6a0d9910cb6503b8420d77b3c27 | [] | no_license | kageiit/perf-android-large | ec7c291de9cde2f813ed6573f706a8593be7ac88 | 2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8 | refs/heads/master | 2021-01-12T14:00:19.468063 | 2016-09-27T13:10:42 | 2016-09-27T13:10:42 | 69,685,305 | 0 | 0 | null | 2016-09-30T16:59:49 | 2016-09-30T16:59:48 | null | UTF-8 | Java | false | false | 3,025 | java | package org.wp.fc.util;
import android.text.TextUtils;
/**
* see https://en.gravatar.com/site/implement/images/
*/
public class GravatarUtils {
// by default tell gravatar to respond to non-existent images with a 404 - this means
// it's up to the caller to catch the 404 and provide a suitable default image
private static final DefaultImage DEFAULT_GRAVATAR = DefaultImage.STATUS_404;
public static enum DefaultImage {
MYSTERY_MAN,
STATUS_404,
IDENTICON,
MONSTER,
WAVATAR,
RETRO,
BLANK;
@Override
public String toString() {
switch (this) {
case MYSTERY_MAN:
return "mm";
case STATUS_404:
return "404";
case IDENTICON:
return "identicon";
case MONSTER:
return "monsterid";
case WAVATAR:
return "wavatar";
case RETRO:
return "retro";
default:
return "blank";
}
}
}
/*
* gravatars often contain the ?s= parameter which determines their size - detect this and
* replace it with a new ?s= parameter which requests the avatar at the exact size needed
*/
public static String fixGravatarUrl(final String imageUrl, int avatarSz) {
return fixGravatarUrl(imageUrl, avatarSz, DEFAULT_GRAVATAR);
}
public static String fixGravatarUrl(final String imageUrl, int avatarSz, DefaultImage defaultImage) {
if (TextUtils.isEmpty(imageUrl)) {
return "";
}
// if this isn't a gravatar image, return as resized photon image url
if (!imageUrl.contains("gravatar.com")) {
return PhotonUtils.getPhotonImageUrl(imageUrl, avatarSz, avatarSz);
}
// remove all other params, then add query string for size and default image
return UrlUtils.removeQuery(imageUrl) + "?s=" + avatarSz + "&d=" + defaultImage.toString();
}
public static String gravatarFromEmail(final String email, int size) {
return gravatarFromEmail(email, size, DEFAULT_GRAVATAR);
}
public static String gravatarFromEmail(final String email, int size, DefaultImage defaultImage) {
return "http://gravatar.com/avatar/"
+ StringUtils.getMd5Hash(StringUtils.notNullStr(email))
+ "?d=" + defaultImage.toString()
+ "&size=" + Integer.toString(size);
}
public static String blavatarFromUrl(final String url, int size) {
return blavatarFromUrl(url, size, DEFAULT_GRAVATAR);
}
public static String blavatarFromUrl(final String url, int size, DefaultImage defaultImage) {
return "http://gravatar.com/blavatar/"
+ StringUtils.getMd5Hash(UrlUtils.getHost(url))
+ "?d=" + defaultImage.toString()
+ "&size=" + Integer.toString(size);
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
80890bdebb29b3d1eba62e97b1b62bd2e8124a5c | 397c346d4010ccc80d6c450bff198364f7328601 | /Multiplus/src/panel/jogo/PainelJogoPigrabbit.java | 6583fcd10d946949609599ffbcc499950c433cc0 | [] | no_license | SallyGM/mathplay-game | 0fadc5bc3e58b158c3a10939101ecadee63c39c2 | 7d2002f3eeec7f6a02d56b8c93a25ec3974142ee | refs/heads/master | 2020-08-13T03:39:02.974343 | 2019-10-13T22:36:58 | 2019-10-13T22:36:58 | 214,898,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,270 | java | package panel.jogo;
import java.awt.Color;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.KeyStroke;
import javax.swing.Timer;
import label.jogoInfo.LabelJogoInfoPigrabbit;
import label.jogoPigrabbit.LabelBonus;
import label.jogoPigrabbit.LabelNave;
import label.jogoPigrabbit.LabelTiro;
import label.personagem.LabelPersonagemPigrabbit;
import usefulTools.ImageTools;
@SuppressWarnings("serial")
public class PainelJogoPigrabbit extends PainelJogo {
// ///////////////////////////////////////////////////////////////
// DECLARACAO DE VARIAVEIS
private LabelPersonagemPigrabbit pigrabbit;
private ArrayList<LabelNave> naves;
private ArrayList<LabelTiro> tiros;
private ArrayList<LabelBonus> bonuses;
private JLabel expressao;
private int codigoResultado;
private ActionListener tempoLimite, tempoAdd, tempoTiro;
private Action inTiro, outTiro;
private Timer tLimite, tAdd, tTiro;
private Thread colisaoTiro, colisaoLimites, colisaoNave;
// ///////////////////////////////////////////////////////////////
// INICIALIZACAO DO PAINEL JOGOPIGRABBIT
public PainelJogoPigrabbit() {
config(ImageTools.JOGOPIGRABBIT_BACKGROUND, 9);
}
// ///////////////////////////////////////////////////////////////
// METODOS POLIMORFICOS (CONCRETOS)
@Override
protected void configLabels() {
info = new LabelJogoInfoPigrabbit();
pigrabbit = new LabelPersonagemPigrabbit();
tiros = new ArrayList<>();
naves = new ArrayList<>();
bonuses = new ArrayList<>();
expressao = new JLabel();
Font f = new Font("impact", Font.BOLD, 100);
expressao.setFont(f);
expressao.setForeground(Color.WHITE);
add(pigrabbit);
add(expressao);
}
@Override
protected void setActionsThreads() {
tempoLimite = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setNovaExpressao();
}
};
tempoAdd = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Random r = new Random();
int categoria = r.nextInt(5);
if (categoria != 0) {
LabelNave n = new LabelNave();
naves.add(n);
add(n);
} else {
LabelBonus b = new LabelBonus();
bonuses.add(b);
add(b);
}
}
};
tempoTiro = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
LabelTiro t = new LabelTiro(pigrabbit.getX() + 25,
pigrabbit.getY());
tiros.add(t);
add(t);
}
};
inTiro = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
setTiro(true);
}
};
outTiro = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
setTiro(false);
}
};
colisaoTiro = new Thread() {
@Override
public void run() {
while (!fimJogo) {
for (int i = 0; i < tiros.size(); i++) {
LabelTiro t = tiros.get(i);
Rectangle tRectangle = t.getBounds();
for (int j = 0; j < naves.size(); j++) {
LabelNave n = naves.get(j);
Rectangle nRectangle = n.getBounds();
if (tRectangle.intersects(nRectangle)) {
if (codigoResultado == n.getCodigo())
info.addNumErros();
else
info.addNumAcertos();
removerComponente(n);
removerComponente(t);
naves.remove(n);
tiros.remove(t);
}
}
for (int j = 0; j < bonuses.size(); j++) {
LabelBonus b = bonuses.get(j);
Rectangle bRectangle = b.getBounds();
if (tRectangle.intersects(bRectangle)) {
removerComponente(b);
removerComponente(t);
bonuses.remove(b);
tiros.remove(t);
}
}
}
try {
Thread.sleep(17);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
colisaoLimites = new Thread() {
@Override
public void run() {
while (!fimJogo) {
for (int i = 0; i < tiros.size(); i++) {
LabelTiro t = tiros.get(i);
if (t.getY() <= 150) {
removerComponente(t);
tiros.remove(t);
}
}
for (int i = 0; i < naves.size(); i++) {
LabelNave n = naves.get(i);
if (n.getY() >= 739 - n.getHeight()) {
if (codigoResultado == n.getCodigo())
info.addNumAcertos();
else
info.addNumErros();
removerComponente(n);
naves.remove(n);
}
}
for (int i = 0; i < bonuses.size(); i++) {
LabelBonus b = bonuses.get(i);
if (b.getY() >= 739 - b.getHeight()) {
removerComponente(b);
bonuses.remove(b);
}
}
try {
Thread.sleep(17);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
colisaoNave = new Thread() {
@Override
public void run() {
while (!fimJogo) {
Rectangle prRectangle = pigrabbit.getBounds();
for (int i = 0; i < naves.size(); i++) {
LabelNave n = naves.get(i);
Rectangle nRectangle = n.getBounds();
if (prRectangle.intersects(nRectangle)) {
if (codigoResultado == n.getCodigo())
info.addNumAcertos();
else
info.addNumErros();
removerComponente(n);
naves.remove(n);
}
}
for (int i = 0; i < bonuses.size(); i++) {
LabelBonus b = bonuses.get(i);
Rectangle bRectangle = b.getBounds();
if (prRectangle.intersects(bRectangle)) {
if (b.getCodigo() == 0)
info.addNumAcertos();
else
counter += 5;
removerComponente(b);
bonuses.remove(b);
}
}
try {
Thread.sleep(17);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
}
@Override
protected void initTimersThreads() {
tAdd = new Timer(1000, tempoAdd);
tLimite = new Timer(10000, tempoLimite);
tTiro = new Timer(300, tempoTiro);
tAdd.setInitialDelay(0);
tTiro.setInitialDelay(0);
t.start();
tAdd.start();
tLimite.start();
colisaoLimites.start();
colisaoTiro.start();
colisaoNave.start();
}
@Override
protected void initMetodos() {
setNovaExpressao();
setKeyBindings();
}
@Override
protected void stopTimers() {
t.stop();
tAdd.stop();
}
// ///////////////////////////////////////////////////////////////
// CONFIGURANDO ENTRADAS DO TECLADO
private void setKeyBindings() {
InputMap inMap = this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
ActionMap actMap = this.getActionMap();
inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false),
"PressedSpace");
inMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true),
"ReleasedSpace");
actMap.put("PressedSpace", inTiro);
actMap.put("ReleasedSpace", outTiro);
}
// ///////////////////////////////////////////////////////////////
// METODOS PROPRIOS DO JOGO
private void setNovaExpressao() {
gerarExpressao();
validate();
repaint();
}
// ///////////////////////////////////////////////////////////////
// METODOS AUXILIARES
private void gerarExpressao() {
Random r = new Random();
int codigo = r.nextInt(4);
int num1 = 0;
int num2 = 0;
int resultado = 0;
// ////////////////////////////////////////
switch (codigo) {
case 0:
num1 = r.nextInt(10) + 1;
num2 = r.nextInt(10) + 1;
resultado = num1 + num2;
break;
case 1:
num1 = r.nextInt(10) + 1;
num2 = r.nextInt(10) + 1;
resultado = num1 - num2;
break;
case 2:
num1 = r.nextInt(10) + 1;
num2 = r.nextInt(10) + 1;
resultado = num1 * num2;
break;
case 3:
num2 = r.nextInt(10) + 1;
num1 = num2 * (r.nextInt(5) + 1);
resultado = num1 / num2;
break;
}
expressao.setText(num1 + " ? " + num2 + " = " + resultado);
expressao.setSize(expressao.getPreferredSize());
expressao.setLocation((1020 - expressao.getWidth()) / 2, 0);
codigoResultado = codigo;
}
private void setTiro(boolean tiro) {
if (tiro)
tTiro.start();
else
tTiro.stop();
}
}
| [
"sahgmnakajima@gmail.com"
] | sahgmnakajima@gmail.com |
5001d9931eb38a46e2e0aea93a77157da2b3ec85 | 9a6ea6087367965359d644665b8d244982d1b8b6 | /src/main/java/X/AbstractC05020Mv.java | e9e1b7825aed4b37a82bb46b45647190444a5a5f | [] | no_license | technocode/com.wa_2.21.2 | a3dd842758ff54f207f1640531374d3da132b1d2 | 3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9 | refs/heads/master | 2023-02-12T11:20:28.666116 | 2021-01-14T10:22:21 | 2021-01-14T10:22:21 | 329,578,591 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package X;
/* renamed from: X.0Mv reason: invalid class name and case insensitive filesystem */
public interface AbstractC05020Mv {
byte[] A39(byte[] bArr, int i, int i2);
}
| [
"madeinborneo@gmail.com"
] | madeinborneo@gmail.com |
7ad783ca44da0a7b920599a4b4a95fc5b47bad4a | 71d44620231292f3d86fb3289d08768d7bc8d5e1 | /tb-service-user/src/main/java/cn/gg3083/tb/mapper/MenuMapper.java | 04fdce6a3390b9edb28f276cb1abf6a33d2d6ed3 | [] | no_license | gg3083/TB | 0775302117059ca397a7091a4131345bb3eca16f | fdff3c09fc06e39aa589a73d12ea19a6fb956966 | refs/heads/master | 2020-03-23T07:50:41.453890 | 2018-09-15T09:49:27 | 2018-09-15T09:49:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package cn.gg3083.tb.mapper;
import cn.gg3083.tb.domain.Menu;
import tk.mybatis.mapper.common.BaseMapper;
public interface MenuMapper extends BaseMapper<Menu> {
} | [
"g@1998.ws"
] | g@1998.ws |
12056c83fe8e9b2d17f39e90e76376d49fa606a0 | be2cb98b7faca3f01aaf16a2858a00f47c757987 | /lib/glm_modified to serialaze/src/main/java/glm/vec/_3/Vec3.java | 327224745d6ca3643d0d14a911a0b1b51ed42a8e | [
"MIT"
] | permissive | ibfernandes/narvaljava2d | c9781fb56e1529e3eafca30704b214ebcc6f0015 | 99c83211ecfd5793c96e6c2f203670fdabeba5a2 | refs/heads/master | 2020-12-10T02:56:13.504195 | 2020-01-13T01:38:30 | 2020-01-13T01:38:30 | 233,486,033 | 0 | 0 | MIT | 2020-10-13T18:48:23 | 2020-01-13T01:22:08 | Java | UTF-8 | Java | false | false | 4,041 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package glm.vec._3;
import glm.vec._4.Vec4;
import glm.Glm;
import java.io.PrintStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
/**
*
* @author GBarbieri
*/
public class Vec3 extends funcRelational {
public Vec3() {
x = 0f;
y = 0f;
z = 0f;
}
public Vec3(Vec3 v) {
x = v.x;
y = v.y;
z = v.z;
}
public Vec3(Vec4 v) {
x = v.x;
y = v.y;
z = v.z;
}
public Vec3(float f) {
x = f;
y = f;
z = f;
}
public Vec3(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vec3(float[] fa) {
this(fa, 0);
}
public Vec3(float[] fa, int i) {
x = fa[i + 0];
y = fa[i + 1];
z = fa[i + 2];
}
public Vec3(double x, double y, double z) {
this.x = (float) x;
this.y = (float) y;
this.z = (float) z;
}
public Vec3 set(Vec3 v) {
return set(v.x, v.y, v.z);
}
public Vec3 set(float f) {
x = f;
y = f;
z = f;
return this;
}
public Vec3 set(double x, double y, double z) {
return set((float) x, (float) y, (float) z);
}
public Vec3 set(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
public Vec3 set(float[] fa) {
x = fa[0];
y = fa[1];
z = fa[2];
return this;
}
public static Vec3 linearRand_(Vec3 min, Vec3 max) {
return linearRand(min, max, new Vec3());
}
public static Vec3 linearRand(Vec3 min, Vec3 max, Vec3 res) {
res.x = (float) Glm.linearRand(min.x, max.x);
res.y = (float) Glm.linearRand(min.y, max.y);
res.z = (float) Glm.linearRand(min.z, max.z);
return res;
}
public Vec3 negate() {
return negate(this);
}
public Vec3 negate_() {
return negate(new Vec3());
}
public Vec3 negate(Vec3 res) {
res.x = -x;
res.y = -y;
res.z = -z;
return res;
}
public float length() {
return (float) Math.sqrt(x * x + y * y + z * z);
}
public Vec4 toVec4_() {
return toVec4(new Vec4());
}
public Vec4 toVec4(Vec4 res) {
return res.set(x, y, z, 1.0f);
}
public float[] toFa_() {
return toFa(new float[3]);
}
public float[] toFa(float[] fa) {
fa[0] = x;
fa[1] = y;
fa[2] = z;
return fa;
}
public FloatBuffer toDfb_() {
return toDfb(ByteBuffer.allocateDirect(SIZE).order(ByteOrder.nativeOrder()).asFloatBuffer());
}
public FloatBuffer toDfb(FloatBuffer fb) {
return toDfb(fb, 0);
}
public FloatBuffer toDfb(FloatBuffer fb, int index) {
return fb
.put(index + 0, x)
.put(index + 1, y)
.put(index + 2, z);
}
public ByteBuffer toDbb_() {
return toDbb(ByteBuffer.allocateDirect(SIZE).order(ByteOrder.nativeOrder()));
}
public ByteBuffer toDbb(ByteBuffer bb) {
return toDbb(bb, 0);
}
public ByteBuffer toDbb(ByteBuffer bb, int index) {
return bb
.putFloat(index + 0 * Float.BYTES, x)
.putFloat(index + 1 * Float.BYTES, y)
.putFloat(index + 2 * Float.BYTES, z);
}
@Override
public String toString() {
return "(" + x + ", " + y + ", " + z + ")";
}
public void print() {
print("", System.out);
}
public void print(String title) {
print(title, System.out);
}
public void print(String title, PrintStream printStream) {
printStream.println(title + "\n(" + x + ", " + y + ", " + z + ")");
}
}
| [
"contasbrasil@hotmail.com"
] | contasbrasil@hotmail.com |
b0cc7df458875c0224e02824ca41ed5f208f66a4 | 928cac8c43150e8740234d135e6c2663a816222e | /android/MobildCloudChattingApp/app/src/test/java/kr/ac/kookmin/embedded/mobilecloudchattingapp/AdderTest.java | c1733d8b20b0bb76d02608576765c9c2038f81c2 | [] | no_license | eyeballss/161KMUMobileCloudClass | 4af89e590062596dc4a011d997de6b920eaba0a5 | 2d52a2b5a7c04c7c312e56c38443efca378b90d8 | refs/heads/master | 2021-01-22T02:04:34.429644 | 2016-06-16T10:39:03 | 2016-06-16T10:39:03 | 53,376,829 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,268 | java | package kr.ac.kookmin.embedded.mobilecloudchattingapp;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.when;
/**
* Created by kesl on 2016-05-30.
*/
@RunWith(MockitoJUnitRunner.class)
public class AdderTest {
@Mock
private Adder adder;
@Before //Test 시작 전에 수행해야 할 것을 구현한 Method
public void setUp() throws Exception {
MockitoAnnotations.initMocks(adder);
}
@After //Test 후에 수행해야 할 것을 구현한 Method
public void tearDown() throws Exception {
}
@Test //@Test는 실제 Test를 구현한 Test Method
public void testAdd() throws Exception {
when(adder.add(anyInt(), anyInt())).thenCallRealMethod();
assertThat(adder.add(1, 2), is(3));
}
@Test
public void testMultiply() throws Exception {
when(adder.multiply(2, 3)).thenReturn(6);
assertThat(adder.multiply(2, 3), is(6));
}
} | [
"kkvv1111@gmail.com"
] | kkvv1111@gmail.com |
48ef1cb0aca68d19f2621bd9703e2496c36ff782 | c5661e22b4903626d77417ad15068be5c2ddd50f | /core-lang/src/main/java/bingo/lang/resource/Resource.java | 866590a4a2cf2e5cdf9816de7078827cb8393c51 | [
"Apache-2.0"
] | permissive | bingo-open-source/bingo-core | 01e70ce12f90ca5fd933903f94e22ba20b17ca69 | 3eb5512e905a7e158a5f51d9c62e9831d734da7b | refs/heads/master | 2020-04-08T08:33:42.282004 | 2013-09-06T06:30:53 | 2013-09-06T06:30:53 | 4,103,949 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 4,555 | java | /*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package bingo.lang.resource;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
/**
* Interface for a resource descriptor that abstracts from the actual
* type of underlying resource, such as a file or class path resource.
*
* <p>An InputStream can be opened for every resource if it exists in
* physical form, but a URL or File handle can just be returned for
* certain resources. The actual behavior is implementation-specific.
*
* @author Juergen Hoeller
* @see #getInputStream()
* @see #getURL()
* @see #getURI()
* @see #getFile()
* @see WritableResource
* @see ContextResource
* @see FileSystemResource
* @see ClassPathResource
* @see UrlResource
* @see ByteArrayResource
* @see InputStreamResource
*/
public interface Resource extends InputStreamSource {
/**
* Return whether this resource actually exists in physical form.
* <p>This method performs a definitive existence check, whereas the
* existence of a <code>Resource</code> handle only guarantees a
* valid descriptor handle.
*/
boolean exists();
/**
* Return whether the contents of this resource can be read,
* e.g. via {@link #getInputStream()} or {@link #getFile()}.
* <p>Will be <code>true</code> for typical resource descriptors;
* note that actual content reading may still fail when attempted.
* However, a value of <code>false</code> is a definitive indication
* that the resource content cannot be read.
* @see #getInputStream()
*/
boolean isReadable();
/**
* Return whether this resource represents a handle with an open
* stream. If true, the InputStream cannot be read multiple times,
* and must be read and closed to avoid resource leaks.
* <p>Will be <code>false</code> for typical resource descriptors.
*/
boolean isOpen();
/**
* Return a URL handle for this resource.
* @throws IOException if the resource cannot be resolved as URL,
* i.e. if the resource is not available as descriptor
*/
URL getURL() throws IOException;
/**
* Return a URI handle for this resource.
* @throws IOException if the resource cannot be resolved as URI,
* i.e. if the resource is not available as descriptor
*/
URI getURI() throws IOException;
/**
* Return a File handle for this resource.
* @throws IOException if the resource cannot be resolved as absolute
* file path, i.e. if the resource is not available in a file system
*/
File getFile() throws IOException;
/**
* Determine the content length for this resource.
* @throws IOException if the resource cannot be resolved
* (in the file system or as some other known physical resource type)
*/
long contentLength() throws IOException;
/**
* Determine the last-modified timestamp for this resource.
* @throws IOException if the resource cannot be resolved
* (in the file system or as some other known physical resource type)
*/
long lastModified() throws IOException;
/**
* Create a resource relative to this resource.
* @param relativePath the relative path (relative to this resource)
* @return the resource handle for the relative resource
* @throws IOException if the relative resource cannot be determined
*/
Resource createRelative(String relativePath) throws IOException;
/**
* Determine a filename for this resource, i.e. typically the last
* part of the path: for example, "myfile.txt".
* <p>Returns <code>null</code> if this type of resource does not
* have a filename.
*/
String getFilename();
/**
* Return a description for this resource,
* to be used for error output when working with the resource.
* <p>Implementations are also encouraged to return this value
* from their <code>toString</code> method.
* @see java.lang.Object#toString()
*/
String getDescription();
}
| [
"live.fenghm@gmail.com"
] | live.fenghm@gmail.com |
374139f2be6024ff40f01d37008e0b3333a23d8b | 9a9fcafa9bbc28c9f1930e01c46af8f023955aea | /JavaEE就业班面向对象IO阶段/day12/code/day12/src/cn/itcast04/print/PrintDemo.java | 3f3b4bdbbff44c86339643c89298b4a52a64b6c5 | [] | no_license | zhengbingyanbj/JavaSE | 84cd450ef5525050809c78a8b6660b9495c072db | 671ac02dcafe81d425c3c191c313b6040e8ae557 | refs/heads/master | 2021-09-01T18:20:49.082475 | 2017-12-28T07:13:30 | 2017-12-28T07:13:30 | 115,139,599 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 875 | java | package cn.itcast04.print;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
/*
*
* PrintStream 字节打印流
* System.out 是一个通道 从程序 通向 控制台的 一个通道
* PrintWriter 字符打印流 也是一个字符输出流
*
* print() 直接输出 println()输出后换行
*
* write() 输出
*
* print println可以写任何类型
* write写的范围小
*
*
*/
public class PrintDemo {
public static void main(String[] args) throws IOException {
// System.out.println();
//创建字符输出流对象
PrintWriter pw = new PrintWriter("nba.txt");//通向哪里 数据就到哪里
//写数据
pw.write("凯文杜软特");
pw.println(new Object());
pw.print(true);
//释放资源
pw.close();
}
}
| [
"zhengbingyanbj@163.com"
] | zhengbingyanbj@163.com |
fa3dd28c34674819d0122a1ce3a20f1983887179 | b8f421e141860d21a1fd9568e81730ca815f0c65 | /graph-api/src/main/java/atharvai/GraphService.java | 84e8344fa0171fa5a9cd8275c38f83d085b98cb3 | [] | no_license | atharvai/data-ontology | ae4d3f9d519c64b8a787c01c6ed8dd8a9869b216 | ec272c00a78e582f03ffbee4373be667786cf19c | refs/heads/master | 2021-01-18T23:40:50.048352 | 2016-05-08T10:43:05 | 2016-05-08T10:43:05 | 53,977,678 | 1 | 0 | null | 2016-05-21T21:00:30 | 2016-03-15T20:51:46 | Java | UTF-8 | Java | false | false | 762 | java | package atharvai;
import atharvai.webresources.BaseResource;
import com.fasterxml.jackson.core.JsonProcessingException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/graph")
@Produces(MediaType.APPLICATION_JSON)
public class GraphService extends BaseResource {
@GET
@Path("/info")
public Response getGraph() throws JsonProcessingException, org.apache.tinkerpop.shaded.jackson.core.JsonProcessingException {
return Response.ok(graph.variables().asMap()).build();
}
@GET
@Path("/save")
public Response saveGraph() {
Boolean b = gi.saveGraph();
return Response.accepted().entity(b).build();
}
}
| [
"atharva.inamdar07@gmail.com"
] | atharva.inamdar07@gmail.com |
54b8af5269601b8a1b716601136f063af767bb66 | f4b79db15e073091dbf23fabccad58143b5ffee5 | /ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/autoprocessingintegration/AutoProcessingIntegrationServiceLocal.java | 07aa4809148bcefccabc6846abf3c1242e89b88c | [] | no_license | ispyb/ISPyB | 9686eaa6dbe38ac1379df9555a73e1733f345060 | df575d39c9a7bfbb313d6e6edd22ebf8cfae235d | refs/heads/master | 2023-08-09T04:21:02.170113 | 2023-07-24T07:59:05 | 2023-07-24T07:59:05 | 79,993,897 | 10 | 33 | null | 2023-07-24T08:04:04 | 2017-01-25T07:51:06 | Java | UTF-8 | Java | false | false | 1,250 | java | /*************************************************************************************************
* This file is part of ISPyB.
*
* ISPyB is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ISPyB 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ISPyB. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors : S. Delageniere, R. Leal, L. Launer, K. Levik, S. Veyrier, P. Brenchereau, M. Bodin, A. De Maria Antolinos
****************************************************************************************************/
package ispyb.server.mx.services.ws.rest.autoprocessingintegration;
import javax.ejb.Local;
@Local
public interface AutoProcessingIntegrationServiceLocal extends AutoProcessingIntegrationService {
}
| [
"demariaa@esrf.fr"
] | demariaa@esrf.fr |
d46bbf8c890c9f2ed52582f4ce2bf7e33a6cee43 | c073013a79715f53ebf862c5b0a61d64303fe6b3 | /src/com/duobility/hackathons/xkcd/data/photoview/scrollerproxy/ScrollerProxy.java | f7cb3d35a48143ffdfa80abdd0762bef151d7db3 | [] | no_license | vaginessa/xkcd | c2753b75b7e9fc56406cecec4d5cc2b3b5c1644e | e18264b0646ec5bfe04686c3a7e6912846d75b3b | refs/heads/master | 2021-01-23T10:48:38.501074 | 2014-05-31T17:47:47 | 2014-05-31T17:47:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,751 | java | /*******************************************************************************
* Copyright 2011, 2012 Chris Banes.
*
* 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.duobility.hackathons.xkcd.data.photoview.scrollerproxy;
import android.content.Context;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
public abstract class ScrollerProxy {
public static ScrollerProxy getScroller(Context context) {
if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
return new PreGingerScroller(context);
} else if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) {
return new GingerScroller(context);
} else {
return new IcsScroller(context);
}
}
public abstract boolean computeScrollOffset();
public abstract void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY,
int maxY, int overX, int overY);
public abstract void forceFinished(boolean finished);
public abstract boolean isFinished();
public abstract int getCurrX();
public abstract int getCurrY();
}
| [
"anthony_rose12@hotmail.com"
] | anthony_rose12@hotmail.com |
9cf866381ab66d7570722634c14a7ad259069e60 | 05d62a289ac484368067ccf0a133e52fe19153a0 | /app/src/main/java/com/res/ticketplease/Classes/Participante.java | 5efd3de2d8b6656fd0c68bb3cf20dc7e41fd7c03 | [] | no_license | Rodrigo1901/TicketPlease | c6ff11a0737d471c37439e2fed2ef72b8bd58a1c | e261fec7c4f823859390ce95238dea90f535bbf3 | refs/heads/master | 2023-03-30T19:30:56.186780 | 2021-03-29T12:01:38 | 2021-03-29T12:01:38 | 351,534,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.res.ticketplease.Classes;
import com.google.firebase.database.DatabaseReference;
import com.res.ticketplease.Config.ConfigFirebase;
public class Participante {
private String nome, cpf, email, senha, id;
public Participante() {
}
public void salvar() {
DatabaseReference firebaseRef = ConfigFirebase.getFirebaseDatabase();
DatabaseReference usuario = firebaseRef.child("participantes").child(getId());
usuario.setValue(this);
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
| [
"rodrigoos19@gmail.com"
] | rodrigoos19@gmail.com |
d4a052ce260ed4a695ec8aeaf12921803d601e3e | a3e5ecad679814e44a31ff7859d23b50e2466bec | /app/src/main/java/com/example/kamanashis/biswas/mybuttondemo/Activity59_bmw_1000cc.java | b5b595812ddd7d9cf0400bb07b647a366ae12a13 | [] | no_license | Kamanashis-Biswas/Car-Pricing-App | cee04b6eee83152d1ae306429641aba94ceab0a7 | aa86bc8c55b26e28b49fe86d2786f057761921aa | refs/heads/master | 2022-04-06T04:41:43.655369 | 2020-01-22T08:55:59 | 2020-01-22T08:55:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.example.kamanashis.biswas.mybuttondemo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Activity59_bmw_1000cc extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity59_bmw_1000cc);
}
}
| [
"kamanashisbiswas79@gmail.com"
] | kamanashisbiswas79@gmail.com |
5d2a2fdcd054ee09084199dca5120d8042ea6681 | 65ffeaba767291afbab6ca6ea0c6aa82c27217dc | /testng.integration/src/test/java/com/github/toy/constructor/testng/integration/test/ignored/IgnoredStubTest.java | ca8126894b1e968cd7824da84a80ad32defa762a | [] | no_license | TikhomirovSergey/toy.constructor | cac0dd3599b07bb6ec4fbe16ea54c2878987786e | 1c5ceae47bea68f37356f92f8f4d9827231fd831 | refs/heads/master | 2021-01-20T07:57:29.177684 | 2018-07-17T17:16:20 | 2018-07-17T17:16:20 | 90,073,743 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | package com.github.toy.constructor.testng.integration.test.ignored;
import com.github.toy.constructor.testng.integration.test.BaseTestNgIntegrationTest;
import org.testng.annotations.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@Ignore
public class IgnoredStubTest extends BaseTestNgIntegrationTest {
@BeforeSuite
public static void beforeSuiteStatic3() {
//does nothing
}
@BeforeSuite
public void beforeSuiteObject3() {
//does nothing
}
@BeforeTest
public static void beforeTestStatic3() {
//does nothing
}
@BeforeTest
public void beforeTestObject3() {
//does nothing
}
@BeforeClass
public static void beforeClassStatic3() {
//does nothing
}
@BeforeClass
public void beforeClassObject3() {
//does nothing
}
@BeforeMethod
public static void beforeMethodStatic3() {
//does nothing
}
@BeforeMethod
public void beforeMethodObject3() {
//does nothing
}
@Test
public void someEmptyTest() {
assertThat(true, is(true));
}
@Test
public void someEmptyTest2() {
assertThat(false, is(false));
}
@Test
public void someEmptyTest3() {
assertThat(true, is(true));
}
}
| [
"tichomirovsergey@gmail.com"
] | tichomirovsergey@gmail.com |
d9b1f581e90e0c351f19557f22478994f9b703dd | b28a4af5ed9ac0763aef533a486463b2c713080d | /app/src/main/java/com/sujian/lines/ui/gank/welfare/WelfarePresenter.java | 28983ac2ba3bcc8a62fe92a9d8a50676de04f2f4 | [
"Apache-2.0"
] | permissive | sujianqingfeng/Lines | 7cd88cbcd15217255616345aacde3c56c90d6bf6 | 52fd900b8ae3fc9288624dd0c8ef9998620c0f63 | refs/heads/master | 2020-09-24T21:06:49.805938 | 2016-09-29T14:37:25 | 2016-09-29T14:37:25 | 67,345,083 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,511 | java | package com.sujian.lines.ui.gank.welfare;
import com.sujian.lines.data.entity.GankItemBean;
import java.util.List;
import rx.Subscriber;
/**
* Created by sujian on 2016/9/13.
* Mail:121116111@qq.com
*/
public class WelfarePresenter extends WelfareContract.Presenter {
public static final int NUM_OF_PAGE = 20;
private int currentPage = 1;
@Override
void getGirlData() {
currentPage = 1;
mRxManager.add(mModel.getGirlList(NUM_OF_PAGE,currentPage)
.subscribe(new Subscriber<List<GankItemBean>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(List<GankItemBean> list) {
mView.showGirl(list);
}
})
);
}
@Override
void getMoreGirlData() {
mRxManager.add(mModel.getGirlList(NUM_OF_PAGE,++currentPage)
.subscribe(new Subscriber<List<GankItemBean>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(List<GankItemBean> list) {
mView.showGirl(list);
}
})
);
}
@Override
public void onStart() {
}
}
| [
"121116111@qq.com"
] | 121116111@qq.com |
cc4c690b8ba0bf9a9304789a034c39d1a903fefb | 78d085b4c2fd822af3d22c46998d8b296762b106 | /app/src/androidTest/java/appone/bmp/com/cmysql/ExampleInstrumentedTest.java | 175d9e77c604a5d5df6e7a19c3807de38abf8384 | [] | no_license | soulith/CMYS | 88bea4ca00a9fecb97740d2585d29dc33db69c92 | 887350509b6273b232e6d979ae0f28f2b2fc6745 | refs/heads/master | 2020-03-29T15:17:00.581923 | 2018-09-21T04:33:22 | 2018-09-21T04:33:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package appone.bmp.com.cmysql;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("appone.bmp.com.cmysql", appContext.getPackageName());
}
}
| [
"pbounmychup@gmail.com"
] | pbounmychup@gmail.com |
f915a3320149d8c7768c6384d07b25109f562101 | 10d77fabcbb945fe37e15ae438e360a89a24ea05 | /graalvm/transactions/fork/narayana/qa/tests/src/org/jboss/jbossts/qa/PerfProfile01Clients/Client_ExplicitObject_TranCommit_TranRollbackNullOper.java | abd05436fd3e5919ae634649d1e2215ee16fbef2 | [
"Apache-2.0",
"LGPL-2.1-only",
"LGPL-2.1-or-later",
"LicenseRef-scancode-other-copyleft"
] | permissive | nmcl/scratch | 1a881605971e22aa300487d2e57660209f8450d3 | 325513ea42f4769789f126adceb091a6002209bd | refs/heads/master | 2023-03-12T19:56:31.764819 | 2023-02-05T17:14:12 | 2023-02-05T17:14:12 | 48,547,106 | 2 | 1 | Apache-2.0 | 2023-03-01T12:44:18 | 2015-12-24T15:02:58 | Java | UTF-8 | Java | false | false | 3,815 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2007, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags.
* See the copyright.txt in the distribution for a
* full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* (C) 2005-2006,
* @author JBoss Inc.
*/
//
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
//
// Arjuna Technologies Ltd.,
// Newcastle upon Tyne,
// Tyne and Wear,
// UK.
//
package org.jboss.jbossts.qa.PerfProfile01Clients;
/*
* Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved.
*
* HP Arjuna Labs,
* Newcastle upon Tyne,
* Tyne and Wear,
* UK.
*
* $Id: Client_ExplicitObject_TranCommit_TranRollbackNullOper.java,v 1.2 2003/06/26 11:44:19 rbegg Exp $
*/
/*
* Try to get around the differences between Ansi CPP and
* K&R cpp with concatenation.
*/
/*
* Copyright (C) 1999-2001 by HP Bluestone Software, Inc. All rights Reserved.
*
* HP Arjuna Labs,
* Newcastle upon Tyne,
* Tyne and Wear,
* UK.
*
* $Id: Client_ExplicitObject_TranCommit_TranRollbackNullOper.java,v 1.2 2003/06/26 11:44:19 rbegg Exp $
*/
import com.arjuna.ats.jts.extensions.AtomicTransaction;
import org.jboss.jbossts.qa.PerfProfile01.*;
import org.jboss.jbossts.qa.Utils.*;
import java.util.Date;
public class Client_ExplicitObject_TranCommit_TranRollbackNullOper
{
public static void main(String[] args)
{
try
{
ORBInterface.initORB(args, null);
OAInterface.initOA();
String prefix = args[args.length - 3];
int numberOfCalls = Integer.parseInt(args[args.length - 2]);
String explicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
ExplicitObject explicitObject = ExplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(explicitObjectIOR));
boolean correct = true;
Date start = new Date();
for (int index = 0; index < numberOfCalls; index++)
{
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
explicitObject.tran_rollback_nulloper(OTS.current().get_control());
atomicTransaction.commit(true);
}
Date end = new Date();
float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
System.err.println("Operation duration : " + operationDuration + "ms");
System.err.println("Test duration : " + (end.getTime() - start.getTime()) + "ms");
correct = PerformanceProfileStore.checkPerformance(prefix + "_ExplicitObject_TranCommit_TranRollbackNullOper", operationDuration);
if (correct)
{
System.out.println("Passed");
}
else
{
System.out.println("Failed");
}
}
catch (Exception exception)
{
System.out.println("Failed");
System.err.println("Client_ExplicitObject_TranCommit_TranRollbackNullOper.main: " + exception);
exception.printStackTrace(System.err);
}
try
{
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
}
catch (Exception exception)
{
System.err.println("Client_ExplicitObject_TranCommit_TranRollbackNullOper.main: " + exception);
exception.printStackTrace(System.err);
}
}
}
| [
"mlittle@redhat.com"
] | mlittle@redhat.com |
79c1b30b9c2020a661b0e89a2861c55674f36c5a | ca86012525c81eaf3bbdc7c5b1bb26076f771419 | /UserService/src/test/java/com/springbook/biz/user/UserServiceClient.java | 1f784411477037e2707a61e58b2e6a48be7a8ccf | [] | no_license | Knightofcydonia51/SpringQuickStart | 5846b69fef3f6e738ae61818e4ee3c07d62ee717 | b3729cd3ee311ff4c9f8b4b6fe572aab1b1b1237 | refs/heads/master | 2022-12-31T09:54:14.837218 | 2020-10-20T08:56:39 | 2020-10-20T08:56:39 | 297,505,365 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 969 | java | package com.springbook.biz.user;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
public class UserServiceClient {
public static void main(String[] args) {
// 1. Spring 컨테이너 구동
AbstractApplicationContext container =
new GenericXmlApplicationContext("applicationContext.xml");
// 2. Spring 컨테이너로부터 UserServiceImpl 객체를 Lookup
UserService userService =
(UserService) container.getBean("userService");
// 3. 로그인 기능 테스트
UserVO vo = new UserVO();
vo.setId("test");
vo.setPassword("test123");
vo.setName("관리자");
vo.setRole("관리자");
UserVO user = userService.getUser(vo);
System.out.println(user);
if (user != null) {
System.out.println(user.getName() + "님 환영합니다.");
} else {
System.out.println("로그인 실패");
}
container.close();
}
}
| [
"leavingwill@gmail.com"
] | leavingwill@gmail.com |
0581d534846877ff1489b71c771755e0bddf85de | d01c4eb527939ef2297322c8b47444672a94a94f | /src/test/java/http/tests/HttpQueryStringBuilderTest.java | 2c7096ac74dcc74039ff7420a031e345ef215be6 | [] | no_license | adagiu/simple-exercise | a92cf446070c5d021ed357b6c1859f2085185890 | a00e7e9fc609f038535e40c14e150ac14a20f338 | refs/heads/master | 2022-06-12T09:43:00.470738 | 2019-12-10T16:33:59 | 2019-12-10T16:33:59 | 123,624,316 | 0 | 0 | null | 2022-05-20T20:51:03 | 2018-03-02T19:55:56 | Java | UTF-8 | Java | false | false | 3,325 | java | package http.tests;
import org.junit.Test;
import utils.http.QueryStringBuilder;
import static org.junit.Assert.*;
/**
* giuseppe.adaldo
*/
public class HttpQueryStringBuilderTest {
@Test
public void testNullParams() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "accountId", "supports", "onlyActive" });
assertNotNull(query);
assertTrue(query.isEmpty());
assertEquals(query, "");
} catch (Exception e) {
fail();
}
}
@Test
public void testNormalBehaviour() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "accountId", "supports", "onlyActive" }, 10010011,
new String[] { "", "" }, true);
assertNotNull(query);
assertFalse(query.isEmpty());
assertEquals(query, "?accountId=10010011&supports=&supports=&onlyActive=true");
} catch (Exception e) {
fail();
}
}
@Test
public void testLessParamsThanNames() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "accountId", "supports", "onlyActive" }, 10010011,
new String[] { "", "" });
assertNotNull(query);
assertTrue(query.isEmpty());
assertEquals(query, "");
} catch (Exception e) {
fail();
}
}
@Test
public void testLessNamesThanParams() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "accountId", "supports" }, 10010011, "a", "b", "c");
assertNotNull(query);
assertTrue(query.isEmpty());
assertEquals(query, "");
} catch (Exception e) {
fail();
}
}
@Test
public void testArraySingleObj() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "accountId", "supports" }, 10010011, new String[] { "a" });
assertNotNull(query);
assertFalse(query.isEmpty());
assertEquals(query, "?accountId=10010011&supports=a");
} catch (Exception e) {
fail();
}
}
@Test
public void testEmptyArrayObj() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "accountId", "supports" }, 10010011, new String[] {});
assertNotNull(query);
assertFalse(query.isEmpty());
assertEquals(query, "?accountId=10010011");
} catch (Exception e) {
fail();
}
}
@Test
public void testEmptyArrayFirstObj() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "", "supports" }, 10010011, new String[] {});
assertNotNull(query);
assertTrue(query.isEmpty());
assertEquals(query, "");
} catch (Exception e) {
fail();
}
}
@Test
public void testEmptyArrayFirstObjNonNullValues() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "", "supports" }, 10010011, new String[] { "hello world" });
assertNotNull(query);
assertFalse(query.isEmpty());
assertEquals(query, "?supports=hello+world");
} catch (Exception e) {
fail();
}
}
@Test
public void testLongString() {
try {
final String query = QueryStringBuilder.buildURIParams(new String[] { "oneLongStringAsParameterName" },
"a very long string to parse and check as query string value!");
assertNotNull(query);
assertFalse(query.isEmpty());
assertEquals(query, "?oneLongStringAsParameterName=a+very+++long+string+to+parse+and+check+as+query+string+value%21");
} catch (Exception e) {
fail();
}
}
}
| [
"Giuseppe.Adaldo@Gamesys.co.uk"
] | Giuseppe.Adaldo@Gamesys.co.uk |
fea70914884c10f445cebaff6e89f31d1d8f5c03 | 9a85c7743d0be2cad46d378fff88e0b6b2436956 | /BiscuitCaseApp/src/main/java/me/noahandrews/biscuitcaseapp/ViewPagerAdapter.java | 739d9816ca12f433a8cacdd51d7f39f01542fbb5 | [] | no_license | NoahAndrews/BiscuitCase | 447483a385f314baf12396e2e7e9e2eeb8bd6256 | c68a14b2ff81b852736c146ccd20d13285b7622f | refs/heads/master | 2021-01-18T13:59:31.393199 | 2015-05-14T19:10:52 | 2015-05-14T19:10:52 | 34,825,609 | 1 | 0 | null | 2015-05-03T21:42:32 | 2015-04-30T00:30:12 | Java | UTF-8 | Java | false | false | 1,205 | java | package me.noahandrews.biscuitcaseapp;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import me.noahandrews.biscuitcaselibrary.Category;
import me.noahandrews.biscuitcaselibrary.ItemsDataSource;
import java.util.ArrayList;
public class ViewPagerAdapter extends FragmentPagerAdapter {
CharSequence Titles[];
int numOfTabs;
FragmentManager fm;
ArrayList<Category> categories;
public ViewPagerAdapter(FragmentManager fm, CharSequence mTitles[], int mNumOfTabs,ArrayList<Category> categories) {
super(fm);
this.Titles = mTitles;
this.numOfTabs = mNumOfTabs;
this.fm = fm;
this.categories = categories;
}
public Fragment getItem(int position) {
ItemsDataSource dataSource;
dataSource = ItemsDataSource.GUEST_INSTANCE;
if(!dataSource.isOpened()) {
dataSource.open();
}
return CategoryFragment.newInstance(categories.get(position));
}
public CharSequence getPageTitle(int position) {
return Titles[position];
}
public int getCount() {
return numOfTabs;
}
}
| [
"NoahAndrews@users.noreply.github.com"
] | NoahAndrews@users.noreply.github.com |
26bc649ee16f94a69fa7337a45465f0ee322a637 | 329a5d91d7020986c3084fc9b2ac0fe75fde1634 | /src/main/java/com/wills/netty/chapter3_chat/server/ChatServerHandler.java | 635b6b1e7219dcb683fbee4c3ec58bc7b67927b1 | [] | no_license | get2bad/JavaStudy | c911811bdda2d6af26ab72ffb247c83dd3c9e956 | fbc24598692bbf0c8bc8570d858bef38f69acbaa | refs/heads/master | 2023-07-03T15:14:55.458627 | 2021-08-09T07:42:43 | 2021-08-09T07:42:43 | 390,593,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,147 | java | package com.wills.netty.chapter3_chat.server;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
/**
* @author 王帅
* @date 2021-07-30 23:34:59
* @description:
*/
public class ChatServerHandler extends SimpleChannelInboundHandler<String> {
private static ChannelGroup group = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
@Override
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
// 发送消息
Channel channel = ctx.channel();
for (Channel ch : group) {
if(ch == channel){
// 发送给自己
String finalMsg = "我说:" + msg + "\r\n";
ByteBuf buf = Unpooled.copiedBuffer(finalMsg, StandardCharsets.UTF_8);
ch.writeAndFlush(buf);
} else {
// 发送给别人
String finalMsg = channel.remoteAddress().toString() + "说:" + msg + "\r\n";
ByteBuf buf = Unpooled.copiedBuffer(finalMsg, StandardCharsets.UTF_8);
ch.writeAndFlush(buf);
}
}
}
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
SocketAddress address = ctx.channel().remoteAddress();
String msg = "服务器消息:客户端:【" + address.toString() + "】加入了聊天室!\r\n";
group.writeAndFlush(msg);
group.add(ctx.channel());
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
SocketAddress address = ctx.channel().remoteAddress();
String msg = "服务器消息:客户端:【" + address.toString() + "】离开了聊天室!\r\n";
group.writeAndFlush(msg);
// group.remove(ctx.channel());
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
SocketAddress address = ctx.channel().remoteAddress();
String msg = "服务器消息:客户端:【" + address.toString() + "】上线了!\n";
group.writeAndFlush(msg);
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
SocketAddress address = ctx.channel().remoteAddress();
String msg = "服务器消息:客户端:【" + address.toString() + "】离线!\n";
group.writeAndFlush(msg);
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
super.channelReadComplete(ctx);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
cause.printStackTrace();
group.writeAndFlush("服务器遇到了一些错误,请您等待管理员解决!\n");
}
}
| [
"loveing490@qq.com"
] | loveing490@qq.com |
35860c4e11fdbf9d98b3bd5e7286ea5932a67b7d | e9ce19c7644e579ccaf3d29d8c7e5bf4d602793c | /UpLoad/src/com/algorithm/MathAlg/LetterToNum.java | 819ec81648b2ca988d17e2394839a8fe41197d8b | [] | no_license | doctor1717/lau-workplace | d131e7326ff2c766b3be2c1f68b52a7ce3092870 | 57909bbdfdc1519b40a7245b682d0610702843cf | refs/heads/master | 2021-07-08T18:17:49.037799 | 2019-07-29T15:13:05 | 2019-07-29T15:13:05 | 147,302,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,257 | java | package com.algorithm.MathAlg;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class LetterToNum{
public static int Change(String input){
char[] c = input.toCharArray();
int sum = 0;
for(int i = 0;i<c.length;i++){
int temp = c[i]-'A';
sum += temp*Math.pow(26,i);
}
return sum;
}
public static List<Integer> partitionLabels(String S) {
List<Integer> list = new ArrayList<>();
if(S == null || S.length() == 0){
return list;
}
char[] c = S.toCharArray();
int[] count = new int[26];
for(int i = 0;i < c.length;i++){
int index = c[i]-'a';
count[index] = i;
}
int k = 0;
while(k < c.length){
int t = count[c[k]-'a'];
for (int j = k + 1; j < t && j < c.length; j++) {
if (count[c[j]-'a'] > t) {
t = count[c[j]-'a'];
}
}
list.add(t - k + 1);
k = t + 1;
}
return list;
}
public static void main(String[] args) {
System.out.println(partitionLabels("ababcbacadefegdehijhklij").toString());
}
}
| [
"505051921@qq.com"
] | 505051921@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.