blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dd6a18b7a5d55f83dc6779d071ffee2e37956546
|
d8bc877da7355045051bf3eb5cd4db457d024322
|
/app/src/main/java/com/ilp/ilpschedule/activities/ILpinnovationsActivity.java
|
4e0fff5443d37728261164a6e449df18ee11493b
|
[] |
no_license
|
robsinspirechange/MyILP_Abhishek
|
dc94a7b1791eb6e9c1a5589ffd69e328b8237ad2
|
6881218c0438fa4cf39b09f22b31b8c683d585e5
|
refs/heads/master
| 2021-06-15T16:05:22.085092
| 2017-02-28T04:46:23
| 2017-02-28T04:46:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,414
|
java
|
package com.ilp.ilpschedule.activities;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import com.ilp.ilpschedule.R;
public class ILpinnovationsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ilpinnovations);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
@Override
public void onBackPressed() {
finish();
super.onBackPressed();
}
@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_ilpinnovations, 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);
}
}
|
[
"1018475@India.TCS.com"
] |
1018475@India.TCS.com
|
22ac1e5c842c93b8f93bc21836a63473278b0413
|
5e317864cf0d952587457aab6945c7706ddf9055
|
/crm-reactive-microservice/src/main/java/com/example/crm/document/Address.java
|
108d3ce3388ee0fd1eaed693f997d75e5024d744
|
[
"MIT"
] |
permissive
|
deepcloudlabs/dcl350-2020-oct-19
|
d3048da0d547978b147a496ab8e9026660513eae
|
eeef31f0fc0da1db8b6de3afba73e0b9caefa664
|
refs/heads/main
| 2022-12-30T10:38:33.675766
| 2020-10-23T21:30:43
| 2020-10-23T21:30:43
| 304,814,308
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 958
|
java
|
package com.example.crm.document;
public class Address {
private String city;
private String country;
private String line;
private String zipCode;
private AddressType type;
public Address() {
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getLine() {
return line;
}
public void setLine(String line) {
this.line = line;
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
public AddressType getType() {
return type;
}
public void setType(AddressType type) {
this.type = type;
}
@Override
public String toString() {
return "Address [city=" + city + ", country=" + country + ", line=" + line + ", zipCode="
+ zipCode + ", type=" + type + "]";
}
}
|
[
"deepcloudlabs@gmail.com"
] |
deepcloudlabs@gmail.com
|
8748834c2b4f3f49aafedc3ccb615b0f81885a4d
|
b686d115a09864103a761559bcb225e0eaca3f60
|
/src/test/java/CardTest.java
|
c617fb7cc07b08f6cb05286ded4bd9d86f2b918e
|
[] |
no_license
|
DCHitch092/CardGame_wk11
|
ec048c69b9807af582f2ac427521fbf78d69d068
|
7bfeea8de4ca2a13238d2923d0ac45531ad74732
|
refs/heads/master
| 2020-12-08T01:55:41.619961
| 2020-01-09T23:56:48
| 2020-01-09T23:56:48
| 232,853,194
| 0
| 0
| null | 2020-10-13T18:44:35
| 2020-01-09T16:27:00
|
Java
|
UTF-8
|
Java
| false
| false
| 637
|
java
|
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class CardTest {
Card card;
@Before
public void before(){
card = new Card(SuitType.HEARTS, RankType.ACE);
}
@Test
public void canGetSuit(){
assertEquals(SuitType.HEARTS, card.getSuit());
}
@Test
public void canGetRank(){
assertEquals(RankType.ACE, card.getRank());
}
@Test
public void canGetRankValue(){
assertEquals(1, card.getRankValue());
}
@Test
public void canGetSuitValue(){
assertEquals(4, card.getSuitValue());
}
}
|
[
"fahitch+github@gmail.com"
] |
fahitch+github@gmail.com
|
665fc83d2437d0db9543243fc64ae522be7bf1a2
|
b34654bd96750be62556ed368ef4db1043521ff2
|
/ball/Forums_0.11/src/java/main/com/orpheus/game/server/handler/admin/CreatePrivateAuctionHandler.java
|
5601c511ca7ad9fcababda5548274b9947ac2784
|
[] |
no_license
|
topcoder-platform/tcs-cronos
|
81fed1e4f19ef60cdc5e5632084695d67275c415
|
c4ad087bb56bdaa19f9890e6580fcc5a3121b6c6
|
refs/heads/master
| 2023-08-03T22:21:52.216762
| 2019-03-19T08:53:31
| 2019-03-19T08:53:31
| 89,589,444
| 0
| 1
| null | 2019-03-19T08:53:32
| 2017-04-27T11:19:01
| null |
UTF-8
|
Java
| false
| false
| 6,015
|
java
|
/*
* Copyright (C) 2007 TopCoder Inc., All Rights Reserved.
*/
package com.orpheus.game.server.handler.admin;
import com.orpheus.auction.KeyConstants;
import com.orpheus.auction.persistence.CustomBid;
import com.orpheus.game.persistence.Game;
import com.orpheus.game.persistence.HostingBlock;
import com.orpheus.game.server.util.GameDataEJBAdapter;
import com.topcoder.json.object.JSONArray;
import com.topcoder.json.object.JSONObject;
import com.topcoder.util.auction.Auction;
import com.topcoder.util.auction.AuctionManager;
import com.topcoder.util.auction.impl.AuctionImpl;
import com.topcoder.web.frontcontroller.ActionContext;
import com.topcoder.web.frontcontroller.Handler;
import com.topcoder.web.frontcontroller.HandlerExecutionException;
import org.w3c.dom.Element;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;
/**
* <p>A custom {@link Handler} implementation to be used for creating a new game via the pirivate auction where the
* administrator bids on behalf of selected sponsors. The auction is created and closed immediately.</p>
*
* @author isv
* @version 1.0
*/
public class CreatePrivateAuctionHandler extends AbstractCreateGameHandler implements Handler {
/**
* <p>Constructs new <code>CreatePrivateAuctionHandler</code> instance initialized based on the configuration parameters
* provided by the specified <code>XML</code> element.</p>
*
* <p>Below is a sample of an XML element.</p>
*
* <pre>
* <handler type="x">
* <games_key>games</games_key>
* <auctions_request_attr_key>openAuctions</auctions_request_attr_key>
* <game_data_jndi_name>orpheus/GameData</game_data_jndi_name>
* <jndi_context_name>default</jndi_context_name>
* <use_remote_interface>true</use_remote_interface>
* </handler>
* </pre>
*
* @param element an <code>Element</code> representing the XML element to extract the configurable values from.
* @throws IllegalArgumentException if the argument is <code>null</code> or any of required configuration parameters
* is missing.
*/
public CreatePrivateAuctionHandler(Element element) {
super(element);
}
/**
* <p> Process the user request. Null should be returned, if it wants Action object to continue to execute the next
* handler (if there is no handler left, the 'success' Result will be executed). It should return a non-empty
* resultCode if it want to execute a corresponding Result immediately, and ignore all following handlers. </p>
*
* @param context the ActionContext object.
* @return null or a non-empty resultCode string.
* @throws IllegalArgumentException if the context is null.
* @throws HandlerExecutionException if fail to execute this handler.
*/
public String execute(ActionContext context) throws HandlerExecutionException {
if (context == null) {
throw new IllegalArgumentException("The parameter [context] is NULL");
}
try {
HttpServletRequest request = context.getRequest();
HttpSession session = request.getSession(false);
Game game = createGameInstance(context, false);
persistGame(getGameDataEJBAdapter(this.jndiContext), game, session, getBlocksData(request, false));
return null;
} catch (Exception e) {
throw new HandlerExecutionException("Could not create new game with private auction due to unexpected err",
e);
}
}
/**
* <p>Persists game.</p>
*
* @param gameData the GameData
* @param game Game
* @param session the HttpSession
* @param blockObjs the block objects
* @throws HandlerExecutionException if an unexpected error occurs.
*/
private void persistGame(GameDataEJBAdapter gameData, Game game, HttpSession session, JSONObject[] blockObjs)
throws HandlerExecutionException {
Date now = new Date();
try {
Game newGame = gameData.createGame(game);
// Get the auction manager instance from application context
AuctionManager auctionMgr
= (AuctionManager) session.getServletContext().getAttribute(KeyConstants.AUCTION_MANAGER_KEY);
// Use auction framework to create auctions for each block in newGame
HostingBlock[] newHBlock = newGame.getBlocks();
for (int i = 0; i < newHBlock.length; i++) {
JSONObject obj = blockObjs[i];
String summary = "Hosting slots for game " + newGame.getName() + ", block "
+ newHBlock[i].getSequenceNumber();
int itemCount = obj.getInt(getString(SLOT_COUNT_JSON_PROP_CONFIG));
JSONArray slots = obj.getArray("slots");
Date endDate = new Date(now.getTime() + 5 * 1000);
CustomBid[] bids = new CustomBid[itemCount];
for (int j = 0; j < bids.length; j++) {
JSONObject slot = slots.getJSONObject(j);
bids[j] = new CustomBid(slot.getLong("sponsor"), slot.getLong("image"), slot.getInt("maxbid"), now);
bids[j].setEffectiveAmount(slot.getInt("maxbid"));
}
Auction auction = new AuctionImpl(newHBlock[i].getId(), summary, summary, itemCount,
getInteger(MINIMUM_BID_VALUE_CONFIG).intValue(), now, endDate, bids);
auctionMgr.createAuction(auction);
}
} catch (Exception e) {
throw new HandlerExecutionException("", e);
}
}
}
|
[
"mtong@fb370eea-3af6-4597-97f7-f7400a59c12a"
] |
mtong@fb370eea-3af6-4597-97f7-f7400a59c12a
|
ab05440372782e6c078ab62201c5ab899b5f21b2
|
f312afa4a970463aad9082c3c2e2b71b9605d997
|
/src/main/java/com/project/beans/PostsAndBlogs.java
|
bd0dcc4d25c664ba39c42508044eed9dbca7ae37
|
[] |
no_license
|
Chinmay84/IETBackend
|
a329cc2fd06277c1500e01dacf589420b7e50198
|
5baed641bda6bedf81b18c89cbf6257abf142898
|
refs/heads/master
| 2023-03-14T18:21:15.783703
| 2021-03-21T08:05:14
| 2021-03-21T08:05:14
| 349,935,593
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 438
|
java
|
package com.project.beans;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Entity
public class PostsAndBlogs {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
int id;
String name;
String email;
@ManyToOne
@JoinColumn(name = "userid")
User user;
}
|
[
"chinmayphade84@gmail.com"
] |
chinmayphade84@gmail.com
|
ee525c24936fc1b4d42259cf77aac86cbb3ef995
|
8e6456c06378bf3e16aebcfeb3d93d4f2b236c14
|
/src/ch09/RegularEx1.java
|
f44d972708d42348f123dc9257d202ef73ac11a2
|
[] |
no_license
|
ialsghi123/java-basic
|
ddb35b5260d75308473a990f90dd58faa14d710d
|
e9cd8041ae04c98e858f3d96e974abd3b3e8c8d9
|
refs/heads/master
| 2023-02-21T13:40:44.321147
| 2022-12-13T03:51:22
| 2022-12-13T03:51:22
| 326,334,429
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 500
|
java
|
package ch09;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegularEx1 {
public static void main(String[] args) {
String[] data = {"bat", "baby", "bonus", "cA", "ca", "co", "count", "date", "disc"};
Pattern p = Pattern.compile("c[a-z]*");
for (int i = 0; i < data.length; i++) {
Matcher m = p.matcher(data[i]);
if (m.matches()) {
System.out.println(data[i] + ",");
}
}
}
}
|
[
"ialsghi123@naver.com"
] |
ialsghi123@naver.com
|
9b029fc680142a807678884cdb54e9e8fbdd6363
|
8e8dc5cecd023863e02c6bd183d0e80e2688ae00
|
/src/net/timroden/adminchat/utils/Utils.java
|
81d1fe896a0f3a2d41237471a285510068ada841
|
[] |
no_license
|
TheArchives/AdminChat
|
8c88cabddf086946be3c0f933ef8ae268542f824
|
9ee5d749000aecae64296d2742b6f3c9b018ed2b
|
refs/heads/master
| 2020-12-03T02:13:57.436546
| 2014-05-09T21:33:08
| 2014-05-09T21:33:08
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 716
|
java
|
package net.timroden.adminchat.utils;
import net.timroden.adminchat.AdminChat;
import net.timroden.adminchat.CommandType;
public class Utils {
public AdminChat plugin;
public Utils(AdminChat plugin) {
this.plugin = plugin;
}
public String implode(String glue, String[] pieces) {
StringBuilder sb = new StringBuilder();
for(String s : pieces) {
sb.append(s).append(glue);
}
return sb.toString();
}
public String fix(String message, CommandType type) {
if(type.equals(CommandType.AD)) {
return message.substring(plugin.config.rawPrefixAdmin.length());
}
if(type.equals(CommandType.ALL)) {
return message.substring(plugin.config.rawPrefixAll.length());
}
return message;
}
}
|
[
"timroden@telus.net"
] |
timroden@telus.net
|
46735aa2b5749993bb72e8d44efb29639b433e33
|
eb686f6faa165e4e1388810fe8d48b1fcc76b4f7
|
/base_common/src/main/java/com/mding/chatfeng/base_common/components/model/DataFriendPush.java
|
3b3035c520e59bb00ca4a71d231ca4ee4ed798b3
|
[] |
no_license
|
zllAndroid/ChatFengIM-master
|
1d77e87f74f156fd5415dd4fcf16cefc94f8751b
|
cf8a02b102a32fae8d703b92e6cfb0ed09c82e72
|
refs/heads/master
| 2020-06-05T01:34:22.281785
| 2019-06-20T10:09:22
| 2019-06-20T10:09:22
| 192,266,464
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,552
|
java
|
package com.mding.chatfeng.base_common.components.model;
import java.util.List;
public class DataFriendPush {
/**
* code : 200
* msg : 成功
* method : addFriendPush
* record : {"messageList":[{"userId":"49a4-9b2-68","friendUserId":"2644b163-b898-ba84-a7be-69cb62f214c7","remark":"dasd","nickName":"小强子","headImg":"http://doubleq.oss-cn-beijing.aliyuncs.com/logo/154113866221225.png"}]}
* api_key : 20180903
* sign : FDEAFBDD6BB5C8D0F3787CC0285C143A
* timestamp : 1542339695
*/
private int code;
private String msg;
private String method;
private RecordBean record;
private String api_key;
private String sign;
private int timestamp;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public RecordBean getRecord() {
return record;
}
public void setRecord(RecordBean record) {
this.record = record;
}
public String getApi_key() {
return api_key;
}
public void setApi_key(String api_key) {
this.api_key = api_key;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public int getTimestamp() {
return timestamp;
}
public void setTimestamp(int timestamp) {
this.timestamp = timestamp;
}
public static class RecordBean {
private List<MessageListBean> messageList;
public List<MessageListBean> getMessageList() {
return messageList;
}
public void setMessageList(List<MessageListBean> messageList) {
this.messageList = messageList;
}
public static class MessageListBean {
/**
* userId : 49a4-9b2-68
* friendUserId : 2644b163-b898-ba84-a7be-69cb62f214c7
* remark : dasd
* nickName : 小强子
* headImg : http://doubleq.oss-cn-beijing.aliyuncs.com/logo/154113866221225.png
*/
private String userId;
private String friendUserId;
private String remark;
private String nickName;
private String headImg;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFriendUserId() {
return friendUserId;
}
public void setFriendUserId(String friendUserId) {
this.friendUserId = friendUserId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
}
}
}
|
[
"970705279@qq.com"
] |
970705279@qq.com
|
d732ade3e3fd608d77a6f8c2e2161b899cacf493
|
e41b8e0534488d40ec1b2b44b1ac4a5e817d94ea
|
/src/Four.java
|
914995219ab83f0f4f3e731a320fc0bd5390f98d
|
[] |
no_license
|
arnu515/computer-project
|
2d4f18260ec8e6d4f157367dd77f669c13756a63
|
5fe4c4ded00d9499845dda3393f9d5e6c4d69791
|
refs/heads/master
| 2023-02-08T01:37:51.856737
| 2021-01-03T07:27:32
| 2021-01-03T07:27:32
| 326,351,321
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 924
|
java
|
/*
Write a program to enter three sides of a triangle and check whether the triangle
is possible or not. If possible then display whether it is equilateral, an isosceles
or scalene triangle otherwise display the message “triangle is not possible”
*/
import java.util.Scanner;
public class Four {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
int c = s.nextInt();
if (!(a + b > c && b + c > a && c + a > b)) {
System.out.println("Triangle is not possible");
return;
}
String typeOfTriangle = "";
if (a == b && b == c) typeOfTriangle = "equilateral";
else if (a == b || b == c || c == a) typeOfTriangle = "isosceles";
else typeOfTriangle = "scalene";
System.out.println("The triangle is " + typeOfTriangle)
}
}
|
[
"arnu5152@gmail.com"
] |
arnu5152@gmail.com
|
619d7372ec68d3f62938efd13cfd85b01718ac7a
|
20eb62855cb3962c2d36fda4377dfd47d82eb777
|
/IntroClassJava/dataset/digits/313d572e1f050451c688b97510efa105685fa275a8442f9119ce9b3f85f46e234cdf03593568e19798aed6b79c66f45c97be937d09b6ff9544f0f59162538575/000/mutations/2251/digits_313d572e_000.java
|
5bceb4ad82cb842a2c410db6cfe10cd0b262f7ec
|
[] |
no_license
|
ozzydong/CapGen
|
356746618848065cce4e253e5d3c381baa85044a
|
0ba0321b6b1191443276021f1997833342f02515
|
refs/heads/master
| 2023-03-18T20:12:02.923428
| 2020-08-21T03:08:28
| 2020-08-21T03:08:28
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,749
|
java
|
package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class digits_313d572e_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
digits_313d572e_000 mainClass = new digits_313d572e_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj given = new IntObj (), digit10 = new IntObj (), digit9 =
new IntObj (), digit8 = new IntObj (), digit7 = new IntObj (), digit6 =
new IntObj (), digit5 = new IntObj (), digit4 = new IntObj (), digit3 =
new IntObj (), digit2 = new IntObj (), digit1 = new IntObj ();
output += (String.format ("\nEnter an interger > "));
given.value = scanner.nextInt ();
if (given.value >= 1 && given.value < 10) {
digit10.value = given.value % 10;
output +=
(String.format
("\n%d\nThat's all, have a nice day!\n", digit10.value));
}
if (given.value >= 10 && given.value < 100) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
output +=
(String.format
("\n%d\n%d\nThat's all, have a nice day!\n", digit10.value,
digit9.value));
}
if (given.value >= 100 && given.value < 1000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
output +=
(String.format ("\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value));
}
if (given.value >= 1000 && given.value < 10000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
output +=
(String.format ("\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value,
(given.value) / 1000));
}
if (given.value >= 10000 && given.value < 100000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value));
}
if (given.value >= 100000 && given.value < 1000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value));
}
if (given.value >= 1000000 && given.value < 10000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value));
}
if (given.value >= 10000000 && given.value < 100000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value));
}
if (given.value >= 100000000 && given.value < 1000000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value));
}
if (given.value >= 1000000000 && given.value < 10000000000L) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
digit1.value = (given.value / 1000000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value, digit1.value));
}
if (true)
return;;
}
}
|
[
"justinwm@163.com"
] |
justinwm@163.com
|
93605c07f8a7f58fc01bfce32208a79c2ab1ac87
|
56cd451a27fdda7f199b030be46c1dcd4ba765f0
|
/Owing/src/owe/model/OweLoan.java
|
5ef7184866b5bb97c65e5fe30abb1bf586ab8b3f
|
[] |
no_license
|
Tapra/JAVA_Programming
|
8eef233983dead92b2cf0645c1771bcd85d6dd80
|
02c17bf68190deb13ee564f6cc766e81e1f73748
|
refs/heads/master
| 2021-03-24T13:13:07.450495
| 2016-01-11T07:53:15
| 2016-01-11T07:53:15
| 38,217,799
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 383
|
java
|
package owe.model;
public class OweLoan
{
private double amount;
private String date;
public OweLoan(String date, double amount)
{
this.date = date;
this.amount = amount;
}
public double getAmount()
{
return amount;
}
public String toString()
{
return "Date Borrowed : " + date + " : Amount Borrowed $" + amount;
}
}
|
[
"s3482232@student.rmit.edu.au"
] |
s3482232@student.rmit.edu.au
|
8788129cdfe8e47534d8a242fa2146c33d0206dc
|
b5c485493f675bcc19dcadfecf9e775b7bb700ed
|
/jee-utility-client-controller/src/main/java/org/cyk/utility/client/controller/data/Form.java
|
31a485ae276fc21d7d6b105ebab2c8667dd625a0
|
[] |
no_license
|
devlopper/org.cyk.utility
|
148a1aafccfc4af23a941585cae61229630b96ec
|
14ec3ba5cfe0fa14f0e2b1439ef0f728c52ec775
|
refs/heads/master
| 2023-03-05T23:45:40.165701
| 2021-04-03T16:34:06
| 2021-04-03T16:34:06
| 16,252,993
| 1
| 0
| null | 2022-10-12T20:09:48
| 2014-01-26T12:52:24
|
Java
|
UTF-8
|
Java
| false
| false
| 295
|
java
|
package org.cyk.utility.client.controller.data;
import org.cyk.utility.client.controller.Objectable;
public interface Form extends Objectable {
String getTitle();
Form setTitle(String title);
void submit();
/**/
String PROPERTY_TITLE = "title";
String METHOD_SUBMIT = "submit";
}
|
[
"kycdev@gmail.com"
] |
kycdev@gmail.com
|
98ec2c978b987c39e7cddd7dd58149eae2894967
|
a0e5e9a1c1c561eae1240e1446c208bca7a81a3d
|
/week-01/exercises/variables-and-types-exercises/src/Exercise15.java
|
0801eb2fcddb21add36af3e91cbf73467d8aafb8
|
[] |
no_license
|
Tuck-d10/Java-Exercises-c10
|
ed1d68bd3ce07e8c6ff93b34f5e702dc521b495e
|
72777fb7db2081b38d9090102f5ee82758804890
|
refs/heads/main
| 2023-07-07T21:11:53.075655
| 2021-08-10T18:39:03
| 2021-08-10T18:39:03
| 394,749,206
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 591
|
java
|
public class Exercise15 {
public static void main(String[] args) {
int value = 24;
// 1. Declare a boolean variable inRange.
// 2. When value is between 10 and 20 OR value is between 110 and 120, inRange is true. Otherwise, it's false.
// 3. Build an expression using value to set inRange.
// 4. Print the result.
// 5. Change value to test different cases:
// - less than 10
// - between 10 and 20
// - between 21 and 109
// - between 110 and 120
// - greater than 120
}
}
|
[
"87035258+Tuck-d10@users.noreply.github.com"
] |
87035258+Tuck-d10@users.noreply.github.com
|
7b7b401c6f5a2d705d071964e5ed6fbfac282599
|
5d4d552ac8577409550f31d3826b896254772383
|
/src/main/java/org/example/RangeSearchVisualizer.java
|
fda9a014dd93556049238cb82c2c626e9302a6d2
|
[] |
no_license
|
bitflame/KDTrees
|
a207f14ee20ce227723d9f27a8b0a3162feef52e
|
339dcc5a9fedfae5fabd974dbb73d8e63526fd73
|
refs/heads/master
| 2023-08-31T07:43:21.898177
| 2021-10-07T12:39:40
| 2021-10-07T12:39:40
| 387,031,339
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,439
|
java
|
package org.example;
/******************************************************************************
* Compilation: javac RangeSearchVisualizer.java
* Execution: java RangeSearchVisualizer input.txt
* Dependencies: PointSET.java KdTree.java
*
* Read points from a file (specified as a command-line argument) and
* draw to standard draw. Also draw all of the points in the rectangle
* the user selects by dragging the mouse.
*
* The range search results using the brute-force algorithm are drawn
* in red; the results using the kd-tree algorithms are drawn in blue.
*
******************************************************************************/
import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.Point2D;
import edu.princeton.cs.algs4.RectHV;
import edu.princeton.cs.algs4.StdDraw;
public class RangeSearchVisualizer {
public static void main(String[] args) {
// initialize the data structures from file
String filename = args[0];
In in = new In(filename);
PointSET brute = new PointSET();
KdTree kdtree = new KdTree();
while (!in.isEmpty()) {
double x = in.readDouble();
double y = in.readDouble();
Point2D p = new Point2D(x, y);
kdtree.insert(p);
brute.insert(p);
}
double x0 = 0.0, y0 = 0.0; // initial endpoint of rectangle
double x1 = 0.0, y1 = 0.0; // current location of mouse
boolean isDragging = false; // is the user dragging a rectangle
// draw the points
StdDraw.clear();
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.setPenRadius(0.01);
brute.draw();
StdDraw.show();
// process range search queries
StdDraw.enableDoubleBuffering();
while (true) {
// user starts to drag a rectangle
if (StdDraw.isMousePressed() && !isDragging) {
x0 = x1 = StdDraw.mouseX();
y0 = y1 = StdDraw.mouseY();
isDragging = true;
}
// user is dragging a rectangle
else if (StdDraw.isMousePressed() && isDragging) {
x1 = StdDraw.mouseX();
y1 = StdDraw.mouseY();
}
// user stops dragging rectangle
else if (!StdDraw.isMousePressed() && isDragging) {
isDragging = false;
}
// draw the points
StdDraw.clear();
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.setPenRadius(0.01);
brute.draw();
// draw the rectangle
RectHV rect = new RectHV(Math.min(x0, x1), Math.min(y0, y1),
Math.max(x0, x1), Math.max(y0, y1));
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.setPenRadius();
rect.draw();
// draw the range search results for brute-force data structure in red
StdDraw.setPenRadius(0.03);
StdDraw.setPenColor(StdDraw.RED);
for (Point2D p : brute.range(rect))
p.draw();
// draw the range search results for kd-tree in blue
StdDraw.setPenRadius(0.02);
StdDraw.setPenColor(StdDraw.BLUE);
for (Point2D p : kdtree.range(rect))
p.draw();
StdDraw.show();
StdDraw.pause(20);
}
}
}
|
[
"sansari1@cox.net"
] |
sansari1@cox.net
|
00328e0751ac25d493bc7b044f81d875573d3967
|
47de0b67b512ef7aa9dd88118dbc7796598495f1
|
/src/main/java/com/example/demo/student/StudentService.java
|
334d5790be8c010fe606138621f8c52bdc54a19b
|
[] |
no_license
|
manbobo2002/java-spring-backend-template
|
568bca1ba8bbf952776a6fca1b20ca0345d00db9
|
23e9abf5ef8ecb5af5ec98cb82bac46b2d548e29
|
refs/heads/main
| 2023-02-23T01:05:51.582967
| 2021-01-25T13:33:27
| 2021-01-25T13:33:27
| 332,730,401
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,794
|
java
|
package com.example.demo.student;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class StudentService {
private final StudentRepository studentRepository;
@Autowired
public StudentService(StudentRepository studentRepository) {
this.studentRepository = studentRepository;
}
public List<Student> getStudents() {
return studentRepository.findAll();
}
public void addNewStudent(Student student) {
Optional<Student> studentOptional = studentRepository.findStudentByEmail(student.getEmail());
if (studentOptional.isPresent()) {
throw new IllegalStateException("email taken");
}
studentRepository.save(student);
}
public void deleteStudent(Long studentId) {
boolean exists = studentRepository.existsById(studentId);
if (!exists) {
throw new IllegalStateException("student with id " + studentId + " does not exist");
}
studentRepository.deleteById(studentId);
}
@Transactional
public void updateStudent(Long studentId, String name, String email) {
Student student = studentRepository.findById(studentId)
.orElseThrow(() -> new IllegalStateException("student with id " + studentId + " does not exist"));
if (name != null && name.length() > 0 && !Objects.equals(student.getName(), name)) {
student.setName(name);
}
if (email != null && email.length() > 0 && !Objects.equals(student.getName(), email)) {
Optional<Student> studentOptional = studentRepository.findStudentByEmail(email);
if (studentOptional.isPresent()) {
throw new IllegalStateException("email taken");
}
student.setEmail(email);
}
}
}
|
[
"manbobo2012@gmail.com"
] |
manbobo2012@gmail.com
|
fe3a80ef83719bc31fd3d7921c3989a5ab1f65a0
|
9324099ab169d81a866a536947c1eafedf9b8295
|
/src/main/java/com/transbank/webpay/wswebpay/service/WSCompleteWebpayService.java
|
d9540e9c8b88a4ea7b868f5fc4e60f5e8bfae8ee
|
[
"BSD-3-Clause"
] |
permissive
|
evesys/transbank-sdk-java
|
f57137ecdc05e1d01476d28d299f5b3c9e1f5715
|
ea3a3bc1cf09b93ec418be30bba03687b5afbaf4
|
refs/heads/master
| 2023-02-24T16:19:24.104974
| 2020-11-23T14:30:59
| 2020-11-23T14:30:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,608
|
java
|
package com.transbank.webpay.wswebpay.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
* This class was generated by Apache CXF 3.1.5
* 2016-07-18T15:17:03.148-03:00
* Generated source version: 3.1.5
*
*/
@WebService(targetNamespace = "http://service.wswebpay.webpay.transbank.com/", name = "WSCompleteWebpayService")
@XmlSeeAlso({ObjectFactory.class})
public interface WSCompleteWebpayService {
@WebMethod
@RequestWrapper(localName = "initCompleteTransaction", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.InitCompleteTransaction")
@ResponseWrapper(localName = "initCompleteTransactionResponse", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.InitCompleteTransactionResponse")
@WebResult(name = "return", targetNamespace = "")
public com.transbank.webpay.wswebpay.service.WsCompleteInitTransactionOutput initCompleteTransaction(
@WebParam(name = "wsCompleteInitTransactionInput", targetNamespace = "")
com.transbank.webpay.wswebpay.service.WsCompleteInitTransactionInput wsCompleteInitTransactionInput
);
@WebMethod
@RequestWrapper(localName = "authorize", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.Authorize")
@ResponseWrapper(localName = "authorizeResponse", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.AuthorizeResponse")
@WebResult(name = "return", targetNamespace = "")
public com.transbank.webpay.wswebpay.service.WsCompleteAuthorizeOutput authorize(
@WebParam(name = "token", targetNamespace = "")
java.lang.String token,
@WebParam(name = "paymentTypeList", targetNamespace = "")
java.util.List<com.transbank.webpay.wswebpay.service.WsCompletePaymentTypeInput> paymentTypeList
);
@WebMethod
@RequestWrapper(localName = "acknowledgeCompleteTransaction", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.AcknowledgeCompleteTransaction")
@ResponseWrapper(localName = "acknowledgeCompleteTransactionResponse", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.AcknowledgeCompleteTransactionResponse")
public void acknowledgeCompleteTransaction(
@WebParam(name = "tokenInput", targetNamespace = "")
java.lang.String tokenInput
);
@WebMethod
@RequestWrapper(localName = "queryShare", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.QueryShare")
@ResponseWrapper(localName = "queryShareResponse", targetNamespace = "http://service.wswebpay.webpay.transbank.com/", className = "com.transbank.webpay.wswebpay.service.QueryShareResponse")
@WebResult(name = "return", targetNamespace = "")
public com.transbank.webpay.wswebpay.service.WsCompleteQuerySharesOutput queryShare(
@WebParam(name = "token", targetNamespace = "")
java.lang.String token,
@WebParam(name = "buyOrder", targetNamespace = "")
java.lang.String buyOrder,
@WebParam(name = "shareNumber", targetNamespace = "")
int shareNumber
);
}
|
[
"leo.soto@gmail.com"
] |
leo.soto@gmail.com
|
9806299a51c11c329d08cd3600b2e685dc47ad0b
|
ee1244b10de45679f053293e366f192af307be74
|
/sources/org/telegram/tgnet/ConnectionsManager$AzureLoadTask.java
|
df4861d73b23c0b51b9d6f7ffb2ace571c12d8ce
|
[] |
no_license
|
scarletstuff/Turbogram
|
a086e50b3f4d7036526075199616682a0d7c9c45
|
21b8862573953add9260f1eb586f0985d2c71e8e
|
refs/heads/master
| 2021-09-23T14:34:23.323880
| 2018-09-24T17:48:43
| 2018-09-24T17:48:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,722
|
java
|
package org.telegram.tgnet;
import android.os.AsyncTask;
import android.util.Base64;
import com.google.android.exoplayer2.DefaultLoadControl;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
class ConnectionsManager$AzureLoadTask extends AsyncTask<Void, Void, NativeByteBuffer> {
private int currentAccount;
public ConnectionsManager$AzureLoadTask(int instance) {
this.currentAccount = instance;
}
protected NativeByteBuffer doInBackground(Void... voids) {
Throwable e;
Throwable th;
ByteArrayOutputStream byteArrayOutputStream = null;
InputStream httpConnectionStream = null;
try {
URL downloadUrl;
if (ConnectionsManager.native_isTestBackend(this.currentAccount) != 0) {
downloadUrl = new URL("https://software-download.microsoft.com/testv2/config.txt");
} else {
downloadUrl = new URL("https://software-download.microsoft.com/prodv2/config.txt");
}
URLConnection httpConnection = downloadUrl.openConnection();
httpConnection.addRequestProperty("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0 like Mac OS X) AppleWebKit/602.1.38 (KHTML, like Gecko) Version/10.0 Mobile/14A5297c Safari/602.1");
httpConnection.addRequestProperty("Host", "tcdnb.azureedge.net");
httpConnection.setConnectTimeout(DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);
httpConnection.setReadTimeout(DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);
httpConnection.connect();
httpConnectionStream = httpConnection.getInputStream();
ByteArrayOutputStream outbuf = new ByteArrayOutputStream();
try {
byte[] bytes;
NativeByteBuffer buffer;
byte[] data = new byte[32768];
while (!isCancelled()) {
int read = httpConnectionStream.read(data);
if (read > 0) {
outbuf.write(data, 0, read);
} else {
if (read == -1) {
}
bytes = Base64.decode(outbuf.toByteArray(), 0);
buffer = new NativeByteBuffer(bytes.length);
buffer.writeBytes(bytes);
if (httpConnectionStream != null) {
try {
httpConnectionStream.close();
} catch (Throwable e2) {
FileLog.e(e2);
}
}
if (outbuf != null) {
try {
outbuf.close();
} catch (Exception e3) {
}
}
byteArrayOutputStream = outbuf;
return buffer;
}
}
bytes = Base64.decode(outbuf.toByteArray(), 0);
buffer = new NativeByteBuffer(bytes.length);
buffer.writeBytes(bytes);
if (httpConnectionStream != null) {
httpConnectionStream.close();
}
if (outbuf != null) {
outbuf.close();
}
byteArrayOutputStream = outbuf;
return buffer;
} catch (Throwable th2) {
th = th2;
byteArrayOutputStream = outbuf;
}
} catch (Throwable th3) {
e2 = th3;
try {
FileLog.e(e2);
if (httpConnectionStream != null) {
try {
httpConnectionStream.close();
} catch (Throwable e22) {
FileLog.e(e22);
}
}
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (Exception e4) {
}
}
return null;
} catch (Throwable th4) {
th = th4;
if (httpConnectionStream != null) {
try {
httpConnectionStream.close();
} catch (Throwable e222) {
FileLog.e(e222);
}
}
if (byteArrayOutputStream != null) {
try {
byteArrayOutputStream.close();
} catch (Exception e5) {
}
}
throw th;
}
}
}
protected void onPostExecute(final NativeByteBuffer result) {
Utilities.stageQueue.postRunnable(new Runnable() {
public void run() {
if (result != null) {
ConnectionsManager.native_applyDnsConfig(ConnectionsManager$AzureLoadTask.this.currentAccount, result.address, UserConfig.getInstance(ConnectionsManager$AzureLoadTask.this.currentAccount).getClientPhone());
} else if (BuildVars.LOGS_ENABLED) {
FileLog.d("failed to get azure result");
}
ConnectionsManager.access$302(null);
}
});
}
}
|
[
"root@linuxhub.it"
] |
root@linuxhub.it
|
47a9ef186083e356597872a7363e49eb0e08507a
|
94405dc11f45639691d57ccdd4f9bf7e902537fc
|
/Code_Drop/word_classification_script/word_count_duplicate.java
|
82b926c1234aad4156d8644aaf8af511ae115fe0
|
[] |
no_license
|
chialingwang/BigDataAnalysis
|
013bcb8ae3aef7b64f379ddb7d0413e778afa149
|
ce5c7acd5d8109f209979bdb3e1c2c5ca9a1ae93
|
refs/heads/master
| 2021-01-10T13:40:06.030965
| 2016-02-08T15:08:52
| 2016-02-08T15:08:52
| 51,304,572
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,522
|
java
|
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.StringTokenizer;
import org.apache.lucene.analysis.en.KStemmer;
import org.apache.lucene.analysis.en.PorterStemFilter;
import org.tartarus.snowball.ext.PorterStemmer;
import org.apache.lucene.analysis.en.KStemFilter;
public class word_count_duplicate {
public static void main(String[] args) throws IOException
{
try {
String Word ;
FileReader fr1 = new FileReader(args[0]);
BufferedReader br1 = new BufferedReader(fr1);
while ((Word = br1.readLine()) != null){
String line = Word.toString();
String[] pair = line.split("\t");
int count = Integer.parseInt(pair[1]);
for (int i=0 ; i< count ; i++)
System.out.println(""+pair[0]+"\t");
//writer.println(""+pair[0]+"\t");
}
//writer.close();
}
/* System.out.println(strNum);
String[] tokens = strNum.split("-|,|\\ ");
for (String token:tokens) {
System.out.println(token);
}
System.out.println("The first "+str2+" index in line is "+strNum.indexOf(str2)+"");
}*/
catch(IOException ex) {
System.err.println("Input File missing!");
System.err.println("Usage: Stop_Word <input path> <Stop word list> <output path>");
ex.printStackTrace();
}
}
}
|
[
"howfuncurry@gmail.com"
] |
howfuncurry@gmail.com
|
bcec87e85bb24eb8cbf43c4d6c22b8887320cda2
|
3f83f5d35506819d90478370c33cab3dc927f70f
|
/projects/experiment/src/main/java/org/preferanto/experiment/poset/FileConfiguration.java
|
03d2b1fc85c8f5985638c66f12b2166bf3bebfc1
|
[] |
no_license
|
preferanto/preferanto
|
47101bb27c6fb9fcb2c519bac8988c2a4ea72681
|
80e0b567801b5a027e127c0aa251f791f29260cc
|
refs/heads/master
| 2016-09-06T18:22:39.287793
| 2014-04-23T19:59:02
| 2014-04-23T19:59:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 824
|
java
|
package org.preferanto.experiment.poset;
public class FileConfiguration {
private final String dirName;
private final String fileNamePrefix;
private final String fileExtension;
private boolean timestampDirEnabled = true;
public FileConfiguration(String dirName, String fileNamePrefix, String fileExtension) {
super();
this.dirName = dirName;
this.fileNamePrefix = fileNamePrefix;
this.fileExtension = fileExtension;
}
public String getDirName() {
return dirName;
}
public String getFileNamePrefix() {
return fileNamePrefix;
}
public String getFileExtension() {
return fileExtension;
}
public boolean isTimestampDirEnabled() {
return timestampDirEnabled;
}
public void setTimestampDirEnabled(boolean timestampDirEnabled) {
this.timestampDirEnabled = timestampDirEnabled;
}
}
|
[
"iordache@hotmail.com"
] |
iordache@hotmail.com
|
2fc6d2aca70ed28c0f5e03624e27e393aefdc0a0
|
4836355f72d5783cdf5d9bd10090b5bca707abf8
|
/HomeWork/Homework15/src/by/it_academy/task2/Main.java
|
3ad3fe7e9966036f0bfeab3ad0c03f671c6f82e3
|
[] |
no_license
|
Brut1K/javapvtproject
|
76c75779bf7c09909ae0b6861a59e0766109c3ab
|
3488cabcf93315083e83b1012a66f098797fe003
|
refs/heads/master
| 2021-09-05T22:36:47.334143
| 2018-01-31T11:52:01
| 2018-01-31T11:52:01
| 110,532,536
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 883
|
java
|
package by.it_academy.task2;
public class Main {
//synhronized methods
public static void main(String[] args) {
UserThread thread1 = new UserThread();
UserThread thread2 = new UserThread();
thread1.setName("Thread №1");
thread2.setName("Thread №2");
thread1.start();
thread2.start();
}
public synchronized static void print10(){
for(int i = 0;i<10;i++){
StringBuilder sb = new StringBuilder();
for(int j = i*10+1;j<i*10+11;j++){
sb.append(j);
sb.append(" ");
}
System.out.println(Thread.currentThread().getName()+" "+sb.toString());
try {
Thread.sleep((int)(Math.random()*1000));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
|
[
"brutski.aliaksei@gmail.com"
] |
brutski.aliaksei@gmail.com
|
9db4971fb44d7590489e6f1e36d7347265a11b3f
|
8882ea20bf1085e7c4231edc947f46a4fd787e9a
|
/boca/T1_2019_1_Etapa03/src/br/ufes/inf/prog3/jjmuliana/stats/PublicationStats.java
|
d4f555ac7fd257714728347350205c76114a5712
|
[] |
no_license
|
jorgeuliana1/ObjectOriented_Exer
|
70e2a3f4bdbe66bc7b9952880adcef1eb67db998
|
82cd287c060968d30d595e590db62e44afe7755f
|
refs/heads/master
| 2020-04-28T13:07:43.336040
| 2019-07-10T00:56:58
| 2019-07-10T00:56:58
| 175,298,853
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 19,184
|
java
|
package br.ufes.inf.prog3.jjmuliana.stats;
import java.io.*;
import java.util.*;
import br.ufes.inf.prog3.jjmuliana.csvreader.CSVReader;
import br.ufes.inf.prog3.jjmuliana.publication.*;
import br.ufes.inf.prog3.jjmuliana.university.University;
import br.ufes.inf.prog3.jjmuliana.gradprogram.GradProgram;
import br.ufes.inf.prog3.jjmuliana.university.UniversityComparator;
/**
* @author J. Jorge M. Uliana
* @version 1.4
*/
public class PublicationStats {
private UniversityList u_list;
private PublicationList p_list;
private GradProgramList g_list;
public PublicationStats() {
// Creating the lists of items.
u_list = new UniversityList();
p_list = new PublicationList();
g_list = new GradProgramList();
}
public void followCommand(StatsCommand c) {
// This function is responsible for the interpretation of the command.
if(c.equals(StatsCommand.REDE)) {
printNetworks();
} else if(c.equals(StatsCommand.PPG)) {
printProgramData(c.getSubCommand());
} else if(c.equals(StatsCommand.IES)) {
printUniversityData(c.getSubCommand());
} else if(c.equals(StatsCommand.CSV)) {
generateCSV(c.getSubCommand(0), c.getSubCommand(1));
}
}
public void generateCSV(String gpid /* grad program id */, String prodtype /* production type */) {
// Printing the header
if(prodtype.equals(PublicationConst.MUSIC.toString())) {
System.out.println("Natureza;Editora;Cidade;Formacao;Paginas");
GradProgram g = g_list.get(gpid);
g.printCSVStyleTable(";", prodtype);
return;
}
if(!prodtype.equals(PublicationConst.MAGAZINE.toString()))
System.out.print("Natureza;");
if(!prodtype.equals(PublicationConst.PERIODIC.toString()))
System.out.print("Titulo;");
System.out.print("Idioma;");
if(prodtype.equals(PublicationConst.ANNAL.toString())) {
System.out.print("Evento;Cidade;");
} else {
if(!prodtype.equals(PublicationConst.MAGAZINE.toString()))
System.out.print("Editora;");
System.out.print("Cidade;");
if(prodtype.equals(PublicationConst.MAGAZINE.toString())) {
System.out.print("Data;ISSN;");
} else if(prodtype.equals(PublicationConst.PERIODIC.toString())) {
System.out.print("Volume;Fasciculo;Serie;ISSN;");
} else if(prodtype.equals(PublicationConst.BOOK.toString())) {
System.out.print("ISBN;");
} else if(prodtype.equals(PublicationConst.TRANSLATION.toString())) {
System.out.print("Idioma traducao;");
}
}
System.out.println("Paginas");
// Getting GradProgram
GradProgram g = g_list.get(gpid);
g.printCSVStyleTable(";", prodtype);
}
public void printUniversityData(String university_sn) {
Set<University> unilist = u_list.getFromShortName(university_sn);
Iterator<University> iterator = unilist.iterator();
while(iterator.hasNext())
iterator.next().printData();
}
public void printProgramData(String program_id) {
g_list.printProgramData(program_id);
}
public void printAnnalsStats() {
int itPIA, ptPIA, amountPIA, amountPages;
double avePages;
// Getting the amount of institutions that published in annals.
itPIA = u_list.size();
// Getting the amount of project that were published in annals.
amountPIA = p_list.size();
// Getting the amount of graduate programs that published in annals.
ptPIA = g_list.size();
// Getting the ave pages.
avePages = p_list.getAveragePagesNum();
// Getting the amount of pages published.
amountPages = p_list.getValidPagesSum();
//Printing the stats as requested:
System.out.printf(new Locale("pt", "BR"),
"Instituicoes que publicaram em anais: %d\nPPGs que publicaram em anais: %d\n" +
"Quantidade de producoes em anais: %d\nQuantidade de paginas publicadas em anais: %d\n" +
"Media de paginas por publicacao: %.1f\n",
itPIA, ptPIA, amountPIA, amountPages, avePages
);
}
public void printNetworks() {
g_list.printNetworks();
}
public void fromCSV(File f, String type) {
/*
INDEXES TABLE:
INDEX | INFO | UTIL PARA O PROGRAMA?
0 | CD_PROGRAMA_IES | br.ufes.inf.prog3.jjmuliana.gradprogram.GradProgram
1 | NM_PROGRAMA_IES | br.ufes.inf.prog3.jjmuliana.gradprogram.GradProgram
2 | SG_ENTIDADE_ENSINO | University
3 | NM_ENTINDADE_ENSINO | University
4 | AN_BASE_PRODUCAO |
5 | ID_ADD_PRODUCAO_INTELECTUAL |
6 | ID_TIPO_PRODUCAO |
7 | ID_SUBTIPO_PRODUCAO |
8 | DS_NATUREZA |
9 | NM_TITULO | br.ufes.inf.prog3.jjmuliana.publication.Publication / Annal
10 | NR_VOLUME |
11 | DS_FASCICULO |
12 | NR_SERIE |
13 | NR_PAGINA_FINAL | br.ufes.inf.prog3.jjmuliana.publication.Publication
14 | NR_PAGINA_INICIAL | br.ufes.inf.prog3.jjmuliana.publication.Publication
15 | DS_EVENTO |
16 | NM_CIDADE |
17 | NM_PAIS |
18 | DS_IDIOMA |
19 | DS_DIVULGACAO |
20 | DS_URL |
21 | DS_OBSERVACOES |
22 | NR_EDICAO |
23 | DS_ISBN_ISSN |
24 | IN_GLOSA |
*/
if(type == null)
return;
CSVReader csv =
new CSVReader(f, ";(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)",false, true);
while (true) {
// Defining the university name.
csv.nextLine();
if(!csv.hasNextLine())
break;
String natur_ar; // Article nature
String title_ar; // Article title
String langu_ar; // Article language
String cityn_ar; // Article city
String uni_name; // University name
String sho_name; // Short name of university
String grd_code; // GradProgram name
String grd_name; // GradProgram code
String ana_name; // Event name
String iss_isbn; // ISSN or ISBN
String editor_a; // Editorial editor
String publi_dt; // Publishing date
String volume_a; // Periodic volume
String fascic_a; // Periodic fascicle
String series_a; // Periodic series
String instrume; // Instrumental formation
String translat; // Translated language
int first_page = 0;
int last_page = 0;
boolean has_pages = false;
// Inserting some default values:
editor_a = null;
iss_isbn = null;
ana_name = null;
publi_dt = null;
volume_a = null;
fascic_a = null;
series_a = null;
instrume = null;
translat = null;
// Getting the data
try {
natur_ar = csv.getCachedLineContent("DS_NATUREZA");
title_ar = csv.getCachedLineContent("NM_TITULO");
langu_ar = csv.getCachedLineContent("DS_IDIOMA");
cityn_ar = csv.getCachedLineContent("NM_CIDADE");
sho_name = csv.getCachedLineContent(2);
uni_name = csv.getCachedLineContent(3);
grd_code = csv.getCachedLineContent(0);
grd_name = csv.getCachedLineContent(1);
} catch(Exception e) {
break;
}
// Getting the data for editorials
if(type.equals(PublicationConst.BOOK.toString()) || type.equals(PublicationConst.PERIODIC.toString()) ||
type.equals(PublicationConst.MAGAZINE.toString()) || type.equals(PublicationConst.MUSIC.toString())
|| type.equals(PublicationConst.TRANSLATION.toString())
|| type.equals(PublicationConst.GENERIC.toString()) )
{
try {
editor_a = csv.getCachedLineContent("NM_EDITORA");
} catch(Exception e) {
editor_a = null;
}
}
// Getting ISSN
if(type.equals(PublicationConst.PERIODIC.toString()) || type.equals(PublicationConst.MAGAZINE.toString())) {
try {
iss_isbn = csv.getCachedLineContent("DS_ISSN");
} catch(Exception e) {
iss_isbn = null;
}
}
// Getting ISBN
if(type.equals(PublicationConst.BOOK.toString())) {
try {
iss_isbn = csv.getCachedLineContent("DS_ISBN");
} catch(Exception e) {
iss_isbn = null;
}
}
// Getting newspaper and magazine data
if(type.equals(PublicationConst.MAGAZINE.toString())) {
try {
publi_dt = csv.getCachedLineContent("DT_PUBLICACAO");
} catch(Exception e) {
publi_dt = null;
}
}
// Getting periodic data
if(type.equals(PublicationConst.PERIODIC.toString())) {
try {
volume_a = csv.getCachedLineContent("NR_VOLUME");
fascic_a = csv.getCachedLineContent("DS_FASCICULO");
series_a = csv.getCachedLineContent("NR_SERIE");
} catch(Exception e) {
volume_a = null;
fascic_a = null;
series_a = null;
}
/* Fixing the numbers problem:
RESOLUTION LOGIC:
try to convert in integer and then in string again.
if it fails, null the value.
*/
try {
volume_a = String.valueOf(Integer.parseInt(volume_a));
} catch(Exception e) {
volume_a = null;
}
try {
fascic_a = String.valueOf(Integer.parseInt(fascic_a));
} catch(Exception e) {
fascic_a = null;
}
try {
series_a = String.valueOf(Integer.parseInt(series_a));
} catch (Exception e) {
series_a = null;
}
}
// Getting data for musical piece
if(type.equals(PublicationConst.MUSIC.toString())) {
try {
instrume = csv.getCachedLineContent("DS_FORMACAO_INSTRUMENTAL");
} catch (Exception e) {
instrume = null;
}
}
// Getting translated article data
if(type.equals(PublicationConst.TRANSLATION.toString())) {
try {
translat = csv.getCachedLineContent("DS_IDIOMA_TRADUCAO");
} catch(Exception e) {
translat = null;
}
}
// Getting data for annal
if(type.equals(PublicationConst.ANNAL.toString())) {
try {
ana_name = csv.getCachedLineContent("DS_EVENTO");
} catch (Exception e) {
}
}
try {
if(type.equals(PublicationConst.BOOK.toString())) {
last_page = Integer.parseInt(csv.getCachedLineContent("NR_PAGINAS_CONTRIBUICAO")) - 1;
} else if(type.equals(PublicationConst.MUSIC.toString()) ||
type.equals(PublicationConst.GENERIC.toString()) ||
type.equals(PublicationConst.TRANSLATION.toString())) {
last_page = Integer.parseInt(csv.getCachedLineContent("NR_PAGINAS")) - 1;
} else {
first_page = Integer.parseInt(csv.getCachedLineContent("NR_PAGINA_INICIAL"));
last_page = Integer.parseInt(csv.getCachedLineContent("NR_PAGINA_FINAL"));
}
has_pages = true;
} catch (NumberFormatException e) {
first_page = last_page = 0;
has_pages = false;
}
// Creating the data.
University uni;
GradProgram gp;
uni = new University(uni_name, sho_name);
gp = new GradProgram(grd_code, grd_name);
/*
* Pages must only be considered if:
* 1. They are integer positive numbers.
* 2. If the initial page is smaller than the final page.
* 3. If the difference between them is below 2000 pages.
* */
if (first_page < 0 || last_page < 0 || last_page - first_page >= 2000 || last_page - first_page < 0)
has_pages = false;
Publication publi;
if(type.equals(PublicationConst.BOOK.toString()))
publi = new BookPublication(title_ar, langu_ar, cityn_ar, has_pages, first_page, last_page, editor_a, iss_isbn);
else if(type.equals(PublicationConst.ANNAL.toString()))
publi = new AnnalPublication(title_ar, langu_ar, cityn_ar, has_pages, first_page, last_page, ana_name);
else if(type.equals(PublicationConst.MAGAZINE.toString()))
publi = new MagazinePublication(title_ar, langu_ar, cityn_ar, has_pages, first_page, last_page, editor_a, iss_isbn,
publi_dt);
else if(type.equals(PublicationConst.PERIODIC.toString()))
publi = new PeriodicPublication(title_ar, langu_ar, cityn_ar, has_pages, first_page, last_page, editor_a,
iss_isbn, volume_a, fascic_a, series_a);
else if(type.equals(PublicationConst.MUSIC.toString()))
publi = new MusicalPiece(title_ar, langu_ar, cityn_ar, has_pages, first_page, last_page, editor_a, instrume);
else if(type.equals(PublicationConst.TRANSLATION.toString()))
publi = new TranslatedPublication(title_ar, langu_ar, cityn_ar, has_pages, first_page, last_page, editor_a,
translat);
else
publi = new GenericPublication(title_ar, langu_ar, cityn_ar, has_pages, first_page, last_page, editor_a);
publi.setNature(natur_ar);
p_list.addPublication(publi);
u_list.addUniversity(uni, gp);
g_list.addGradProgram(gp, uni, publi);
}
}
public void fromCSV(File f) {
String type = getTypeFromPath(f.getPath());
fromCSV(f, type);
}
public static String getTypeFromPath(String file_path) {
if(file_path.contains("-anais."))
return "anais";
else if(file_path.contains("-artjr."))
return "artjr";
else if(file_path.contains("-artpe."))
return "artpe";
else if(file_path.contains("-livro."))
return "livro";
else if(file_path.contains("-partmu."))
return "partmu";
else if(file_path.contains("-tradu."))
return "tradu";
else if(file_path.contains("-outro."))
return "outro";
else return null;
}
}
// Auxiliar classes:
class UniversityList {
private Map<String, University> u;
UniversityList() {
u = new HashMap<>();
}
void addUniversity(University uni, GradProgram gp) {
if(!u.containsKey(uni.getHashKey()))
u.put(uni.getHashKey(), uni);
// Common operations
u.get(uni.getHashKey()).addGraduateProgram(gp);
}
int size() {
return u.size();
}
Set<University> getFromShortName(String shortn) {
Object[] keys = u.keySet().toArray();
Set<University> l;
l = new TreeSet<>(); // List of universities that have the short name.
// Filling the list
for(Object key : keys) {
if(key.toString().contains("-" + shortn.toLowerCase() + "-"))
l.add(u.get(key));
}
// Returning the array of wanted universities.
return l;
}
}
class PublicationList {
private Map<Integer, Publication> p;
private int valid_pages_sum = 0;
private int valid_publications_num = 0;
PublicationList() {
p = new HashMap<>();
}
void addPublication(Publication publ) {
p.put(publ.getHashKey(), publ);
valid_pages_sum += publ.getPages(); /* Counting the valid pages */
if(publ.hasPageNumber()) valid_publications_num += 1; /* Counting the valid publications */
}
int size() {
return p.size();
}
int getValidPagesSum() {
return valid_pages_sum;
}
int getValidPublicationsNum() {
return valid_publications_num;
}
public double getAveragePagesNum() {
return (double)valid_pages_sum/(double)valid_publications_num;
}
}
class GradProgramList {
private Map<String, GradProgram> g;
GradProgramList() {
g = new HashMap<>();
}
void addGradProgram(GradProgram grp, University u, Publication p) {
boolean isInSet = false;
if(g.containsKey(grp.getHashKey())) {
isInSet = true;
grp = g.get(grp.getHashKey());
}
// common operations:
grp.plusPublication(p);
grp.addUniversity(u);
// else ...
if(!isInSet)
g.put(grp.getHashKey(), grp);
}
int size() {
return g.size();
}
void printNetworks() {
System.out.println("Programas em rede:");
Object[] key_set = g.keySet().toArray();
Arrays.sort(key_set);
GradProgram gp;
for(Object key : key_set) {
gp = g.get(key);
if(gp.getUniversitiesNumber() > 1) {
System.out.println(gp.toString()); // Printing the grad. prog. ID and name.
gp.printUniversitiesList(); // Printing the universities list.
}
}
}
void printProgramData(String program_id) {
if(g.containsKey(program_id.trim()))
g.get(program_id).printData();
else
System.out.println("PPG nao encontrado.");
}
GradProgram get(String id) {
return g.get(id);
}
}
|
[
"ulianamjjorge@gmail.com"
] |
ulianamjjorge@gmail.com
|
bf8edd94704171bcbb74952b832703afd3fbba0c
|
beba93c13d613d3e6ebbc1e7603085bc37538ae5
|
/ws_orgs/gs-rest-service-master/complete/src/main/java/hello/repo/UsersClass.java
|
2aa8681b6224ac67644069a33870a0b5cf785669
|
[] |
no_license
|
reset1301/javaProgs
|
c0f40da2701f9312e8d8aa070e55bcd25b085142
|
92979172ad66e6b5034cb433a050d06b364118ab
|
refs/heads/master
| 2022-12-23T23:33:39.077421
| 2019-10-26T18:29:50
| 2019-10-26T18:29:50
| 144,703,812
| 0
| 0
| null | 2022-12-16T04:32:39
| 2018-08-14T10:14:20
|
Java
|
UTF-8
|
Java
| false
| false
| 2,369
|
java
|
package hello.repo;
import hello.dao.Office;
import hello.dao.Position;
import hello.dao.UserDoc;
import hello.dao.Users;
import org.hibernate.Criteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.*;
import javax.persistence.metamodel.EntityType;
import javax.persistence.metamodel.Metamodel;
import java.util.ArrayList;
import java.util.List;
@Service
public class UsersClass {
private EntityManager em;
@Autowired
public UsersClass(EntityManager em) {
this.em = em;
}
public List<Users> getUserList(long officeId, String firstName,
String lastName, String middleName,
Long positionId, Long userdocId,
Long citizenshipCode) {
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Users> cq = criteriaBuilder.createQuery(Users.class);
Root<Users> usersRoot = cq.from(Users.class);
cq.select(usersRoot);
List<Predicate> predicates = new ArrayList<>();
Predicate office = criteriaBuilder.equal(usersRoot.get("office").get("id"), officeId);
predicates.add(office);
if (firstName != null) {
predicates.add(criteriaBuilder.equal(usersRoot.get("firstName"), firstName));
}
if (lastName != null) {
predicates.add(criteriaBuilder.equal(usersRoot.get("secondName"), lastName));
}
if (middleName != null) {
predicates.add(criteriaBuilder.equal(usersRoot.get("middleName"), middleName));
}
if (positionId != null) {
predicates.add(criteriaBuilder.equal(usersRoot.get("position").get("id"), positionId));
}
if (userdocId != null) {
predicates.add(criteriaBuilder.equal(usersRoot.get("userDoc").get("id"), userdocId));
}
if (citizenshipCode != null) {
predicates.add(criteriaBuilder.equal(usersRoot.get("citizenshipCode"), citizenshipCode));
}
cq.where(predicates.toArray(new Predicate[predicates.size()]));
TypedQuery<Users> q = em.createQuery(cq);
List<Users> users = q.getResultList();
return users;
}
}
|
[
"reset1301@mail.ru"
] |
reset1301@mail.ru
|
6c25cafe4b4499199ce305462420e706f7a35b11
|
b73c463f7b62e580e08d9693fa76ef694a67daab
|
/study_jvm/src/main/java/com/jvm/test4/PCRegisterTest.java
|
eaad2c5ac19d96d48e85222c8d00aef00d2dfa52
|
[] |
no_license
|
start-spt/study2020
|
963ef4187982b953e4e523e1df6b2c7736418781
|
b22133d6fe2d0f547b976e93ad2ee92fcf811f56
|
refs/heads/master
| 2023-07-19T17:01:04.959455
| 2023-07-12T09:55:27
| 2023-07-12T09:55:27
| 318,195,837
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 250
|
java
|
package com.jvm.test4;
public class PCRegisterTest {
public static void main(String[] args) {
int i=10;
int j=20;
int k=i+j;
String s="abc";
System.out.println(i);
System.out.println(k);
}
}
|
[
"pengtao.song"
] |
pengtao.song
|
fa1697cc83a34d855814049057a575ee39162244
|
e93b1ef4d59ef90fbe400dc8206fe85e9c8ae739
|
/app/src/androidTest/java/in/raushanjha/paymentintegration/ExampleInstrumentedTest.java
|
2f617c616c8c73924272c4c97f7bf478bbeda17c
|
[] |
no_license
|
ProgrammerChirag/PaymentIntegrationWithRazoryPay-in-Android
|
291e30477f1492a3064a6c4854733eae9f6766e0
|
a03364df1f9a40b8e505882858ab2220601a9640
|
refs/heads/master
| 2022-04-09T17:37:33.125940
| 2020-02-08T12:30:10
| 2020-02-08T12:30:10
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 779
|
java
|
package in.raushanjha.paymentintegration;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("in.raushanjha.paymentintegration", appContext.getPackageName());
}
}
|
[
"raushanjha465@gmail.com"
] |
raushanjha465@gmail.com
|
e4cb2cadf4bca3e46c487ab77a197136b3c9fb8e
|
3f099e3fe115888ddfd5a149a6ea241ccb4dbba1
|
/Labs/P0002/SourceCode/AirlineTickets/build/generated/src/org/apache/jsp/index_jsp.java
|
ddf99b550872f362d70c927b6ad564be033ea2b3
|
[] |
no_license
|
zeralot/Java-Web-lab
|
5fa1747bd9185476055f712cc987082b1042bcb0
|
59859dd651a136aace4895063c7f2a28ad1c64bd
|
refs/heads/master
| 2020-05-28T11:19:25.826915
| 2019-05-28T08:11:52
| 2019-05-28T08:11:52
| 188,981,121
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 32,423
|
java
|
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.fpt.J3.L.P0002.Model.DBConnect;
import com.fpt.J3.L.P0002.Entity.Customer;
import java.sql.ResultSet;
import java.sql.ResultSet;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
static {
_jspx_dependants = new java.util.ArrayList<String>(7);
_jspx_dependants.add("/Header.jsp");
_jspx_dependants.add("/Home.jsp");
_jspx_dependants.add("/Login.jsp");
_jspx_dependants.add("/Register.jsp");
_jspx_dependants.add("/Booking.jsp");
_jspx_dependants.add("/ManageBookingSearch.jsp");
_jspx_dependants.add("/ManageBookingResult.jsp");
}
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <head>\n");
out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
out.write(" <title>Airline Tickets</title>\n");
out.write(" </head>\n");
out.write(" <link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">\n");
out.write(" \n");
out.write(" ");
String msg = null;
msg = (String) session.getAttribute("msg");
if (msg != null) {
out.write("\n");
out.write(" <script>\n");
out.write(" alert(\"");
out.print(msg);
out.write("\");\n");
out.write(" </script>\n");
out.write(" ");
session.removeAttribute("msg");
}
out.write("\n");
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" \n");
out.write(" <body style='margin:0px'>\n");
out.write(" <div class=\"bg1\">\n");
out.write(" <div class=\"logoheader\">\n");
out.write(" <img src=\"pic/logo.png\" style=\"width:90%; margin-top: 30px\">\n");
out.write(" </div>\n");
out.write(" <div class=\"textheader\">\n");
out.write(" <font color=\"white\" size=\"+2\"> Fast, Frequent & Safe Flights </font>\n");
out.write(" </div>\n");
out.write(" ");
Customer cus = (Customer)session.getAttribute("cus");
out.write("\n");
out.write(" <div class=\"buttonheader\">\n");
out.write(" ");
if (cus == null) {
out.write("\n");
out.write(" <a href=\"index.jsp?service=prelogin\"><img src=\"pic/home.png\" width=\"20%\"></a>\n");
out.write(" <a href=\"index.jsp?service=preregister\"><img src=\"pic/register_t.png\" width=\"20%\"></a>\n");
out.write(" <br>\n");
out.write(" <font color=\"white\" size=\"-1\">\n");
out.write(" <span style=\"margin-left: 10px\">Login</span> \n");
out.write(" <span style=\"margin-left: 15px\">Register</span>\n");
out.write(" </font>\n");
out.write(" ");
} else {
out.write("\n");
out.write(" \n");
out.write(" <div class=\"hed\">\n");
out.write(" Hello, ");
out.print(cus.getFirstname());
out.write(".\n");
out.write(" <a href=\"CustomerController?service=logout\">Logout</a> \n");
out.write(" </div>\n");
out.write(" ");
}
out.write("\n");
out.write(" </div>\n");
out.write(" ");
String service1 = request.getParameter("service");
if (service1==null) service1="home";
out.write("\n");
out.write(" <div style=\"margin-top: 3% \"> \n");
out.write(" <a href=\"index.jsp?service=home\"><button class=\" menu ");
if(service1.equals("home") || service1.equals("prelogin") || service1.equals("preregister")){
out.write(" active ");
}
out.write("\"><font size=\"+2\">Home</font></button></a>\n");
out.write(" <a href=\"FlightController?service=book\"><button class=\"menu ");
if (service1.equals("list")){
out.write(" active ");
}
out.write(" \"><font size=\"+2\">Book</font></button></a>\n");
out.write(" <a href=\"index.jsp?service=managebookingsearch\"><button class=\"menu ");
if (service1.equals("managebookingsearch") || service1.equals("managebookingresult")){
out.write(" active ");
}
out.write(" \" style=\"width:20%\"><font size=\"+2\">Manage Booking</font></button></a>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" <div class='index2'>\n");
out.write(" ");
String service = request.getParameter("service");
if (service == null) {
service = "home";
}
if (service.equals("home")) {
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <body >\n");
out.write(" <div class=\"bghome\">\n");
out.write(" <div class=\"btnfli\">\n");
out.write(" <button class=\"btnflight\">Flight</button>\n");
out.write(" </div>\n");
out.write(" <form action=\"FlightController?service=search\" method=\"post\"> \n");
out.write(" <div class=\"fli\">\n");
out.write(" <div class=\"fli1\">\n");
out.write(" <input type=\"radio\" name=\"trip\" value=\"0\" checked> Roundtrip \n");
out.write(" <input type=\"radio\" name=\"trip\" value=\"1\"> One way\n");
out.write(" <table class=\"tblfli\">\n");
out.write("\n");
out.write(" <tr><td>From </td>\n");
out.write(" <td> <select name=\"from\" width=\"500px\">\n");
out.write(" <option value=\"Ha Noi\">Ha Noi</option>\n");
out.write(" <option value=\"Da Nang\">Da Nang</option>\n");
out.write(" <option value=\"Ho Chi Minh\">Ho Chi Minh</option>\n");
out.write(" <option value=\"Hai Phong\">Hai Phong</option>\n");
out.write(" </select></td></tr>\n");
out.write(" <tr><td>To </td>\n");
out.write(" <td> <select name=\"to\" width=\"150px\">\n");
out.write(" <option value=\"Ha Noi\">Ha Noi</option>\n");
out.write(" <option value=\"Da Nang\">Da Nang</option>\n");
out.write(" <option value=\"Ho Chi Minh\">Ho Chi Minh</option>\n");
out.write(" <option value=\"Hai Phong\">Hai Phong</option>\n");
out.write(" </select></td></tr>\n");
out.write(" <tr><td>Depature </td>\n");
out.write(" <td><input type=\"date\" name=\"depart\">\n");
out.write(" </tr>\n");
out.write(" <tr><td>Return </td>\n");
out.write(" <td><input type=\"date\" name=\"retur\">\n");
out.write(" <br></tr>\n");
out.write("\n");
out.write(" </table>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" <div class=\"fli2\">\n");
out.write(" <button type=\"submit\" class=\"btnfli2\"><font color=\"white\"><b>Search</b></font></button>\n");
out.write(" </div>\n");
out.write(" </form>\n");
out.write("\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
}
if (service.equals("prelogin") && session.getAttribute("cus") == null) {
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <body>\n");
out.write(" <form action=\"CustomerController?service=login\" method=\"post\">\n");
out.write(" <div align=\"center\" style=\"margin-top: 60px; margin-bottom: 50px\">\n");
out.write(" <font color=\"orange\" size=\"+2\"><b>Login</b></font>\n");
out.write(" <table class=\"login1\" style=\"margin-top:10px\">\n");
out.write(" <tr>\n");
out.write(" <td style=\"width: 20%\">Email</td>\n");
out.write(" <td style=\"width:40%\"><input type=\"email\" name=\"email\" style=\"width:200px\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Password</td>\n");
out.write(" <td ><input type=\"password\" name=\"password\" style=\"width:200px\">\n");
out.write(" </tr>\n");
out.write(" <tr style=\"line-height: 60px\">\n");
out.write(" <td> </td>\n");
out.write(" <td>\n");
out.write(" <button class=\"login2\" type=\"submit\"><font color=\"white\">Login</font></button>\n");
out.write(" <a href=\"index.jsp?service=preregister\"><button class=\"login2\" type=\"button\"><font color=\"white\">Register</font></button></a>\n");
out.write(" </tr>\n");
out.write(" </table>\n");
out.write(" </div>\n");
out.write(" </form>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
} else if (service.equals("prelogin") && session.getAttribute("cus") != null){
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <body >\n");
out.write(" <div class=\"bghome\">\n");
out.write(" <div class=\"btnfli\">\n");
out.write(" <button class=\"btnflight\">Flight</button>\n");
out.write(" </div>\n");
out.write(" <form action=\"FlightController?service=search\" method=\"post\"> \n");
out.write(" <div class=\"fli\">\n");
out.write(" <div class=\"fli1\">\n");
out.write(" <input type=\"radio\" name=\"trip\" value=\"0\" checked> Roundtrip \n");
out.write(" <input type=\"radio\" name=\"trip\" value=\"1\"> One way\n");
out.write(" <table class=\"tblfli\">\n");
out.write("\n");
out.write(" <tr><td>From </td>\n");
out.write(" <td> <select name=\"from\" width=\"500px\">\n");
out.write(" <option value=\"Ha Noi\">Ha Noi</option>\n");
out.write(" <option value=\"Da Nang\">Da Nang</option>\n");
out.write(" <option value=\"Ho Chi Minh\">Ho Chi Minh</option>\n");
out.write(" <option value=\"Hai Phong\">Hai Phong</option>\n");
out.write(" </select></td></tr>\n");
out.write(" <tr><td>To </td>\n");
out.write(" <td> <select name=\"to\" width=\"150px\">\n");
out.write(" <option value=\"Ha Noi\">Ha Noi</option>\n");
out.write(" <option value=\"Da Nang\">Da Nang</option>\n");
out.write(" <option value=\"Ho Chi Minh\">Ho Chi Minh</option>\n");
out.write(" <option value=\"Hai Phong\">Hai Phong</option>\n");
out.write(" </select></td></tr>\n");
out.write(" <tr><td>Depature </td>\n");
out.write(" <td><input type=\"date\" name=\"depart\">\n");
out.write(" </tr>\n");
out.write(" <tr><td>Return </td>\n");
out.write(" <td><input type=\"date\" name=\"retur\">\n");
out.write(" <br></tr>\n");
out.write("\n");
out.write(" </table>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" <div class=\"fli2\">\n");
out.write(" <button type=\"submit\" class=\"btnfli2\"><font color=\"white\"><b>Search</b></font></button>\n");
out.write(" </div>\n");
out.write(" </form>\n");
out.write("\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
}
if (service.equals("preregister") && session.getAttribute("cus") == null) {
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <body>\n");
out.write(" <div align=\"center\" style=\"margin-top: 60px; margin-bottom: 100px\">\n");
out.write(" <font color=\"orange\" size=\"+3\"> Register </font>\n");
out.write(" \n");
out.write(" <form action=\"CustomerController?service=register\" method=\"post\" style=\"margin-top: 20px\">\n");
out.write(" <table style=\"line-height: 30px\">\n");
out.write(" <tr>\n");
out.write(" <td><font color=\"orange\" size=\"+1\"> New Account</font>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Email\n");
out.write(" <td><input type=\"email\" name=\"email\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Password\n");
out.write(" <td><input type=\"password\" name=\"pass\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Verify Password\n");
out.write(" <td><input type=\"password\" name=\"repass\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td><font color=\"orange\" size=\"+1\">Contact Information</font>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>First name\n");
out.write(" <td><input type =\"text\" name=\"firstname\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Last name\n");
out.write(" <td><input type=\"text\" name=\"lastname\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Address\n");
out.write(" <td><input type=\"text\" name=\"address\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Phone Number\n");
out.write(" <td><input type=\"text\" name=\"phonenumber\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Sex\n");
out.write(" <td><select name=\"sex\">\n");
out.write(" <option value=\"0\">Male</option>\n");
out.write(" <option value=\"1\">Female</option>\n");
out.write(" </select>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Age\n");
out.write(" <td><input type=\"text\" name=\"age\">\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>Card Number\n");
out.write(" <td><input type=\"text\" name=\"card\">\n");
out.write(" </tr>\n");
out.write(" <tr style=\"height:50px\">\n");
out.write(" <td>\n");
out.write(" <td> <button type=\"submit\" class=\"reg1\"><font color=\"white\">Register</font></button>\n");
out.write(" </tr>\n");
out.write("\n");
out.write(" </table>\n");
out.write(" </form>\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
} else if (service.equals("preregister") && session.getAttribute("cus") != null){
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <body >\n");
out.write(" <div class=\"bghome\">\n");
out.write(" <div class=\"btnfli\">\n");
out.write(" <button class=\"btnflight\">Flight</button>\n");
out.write(" </div>\n");
out.write(" <form action=\"FlightController?service=search\" method=\"post\"> \n");
out.write(" <div class=\"fli\">\n");
out.write(" <div class=\"fli1\">\n");
out.write(" <input type=\"radio\" name=\"trip\" value=\"0\" checked> Roundtrip \n");
out.write(" <input type=\"radio\" name=\"trip\" value=\"1\"> One way\n");
out.write(" <table class=\"tblfli\">\n");
out.write("\n");
out.write(" <tr><td>From </td>\n");
out.write(" <td> <select name=\"from\" width=\"500px\">\n");
out.write(" <option value=\"Ha Noi\">Ha Noi</option>\n");
out.write(" <option value=\"Da Nang\">Da Nang</option>\n");
out.write(" <option value=\"Ho Chi Minh\">Ho Chi Minh</option>\n");
out.write(" <option value=\"Hai Phong\">Hai Phong</option>\n");
out.write(" </select></td></tr>\n");
out.write(" <tr><td>To </td>\n");
out.write(" <td> <select name=\"to\" width=\"150px\">\n");
out.write(" <option value=\"Ha Noi\">Ha Noi</option>\n");
out.write(" <option value=\"Da Nang\">Da Nang</option>\n");
out.write(" <option value=\"Ho Chi Minh\">Ho Chi Minh</option>\n");
out.write(" <option value=\"Hai Phong\">Hai Phong</option>\n");
out.write(" </select></td></tr>\n");
out.write(" <tr><td>Depature </td>\n");
out.write(" <td><input type=\"date\" name=\"depart\">\n");
out.write(" </tr>\n");
out.write(" <tr><td>Return </td>\n");
out.write(" <td><input type=\"date\" name=\"retur\">\n");
out.write(" <br></tr>\n");
out.write("\n");
out.write(" </table>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" <div class=\"fli2\">\n");
out.write(" <button type=\"submit\" class=\"btnfli2\"><font color=\"white\"><b>Search</b></font></button>\n");
out.write(" </div>\n");
out.write(" </form>\n");
out.write("\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
}
if (service.equals("list")) {
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write("\n");
out.write(" <body>\n");
out.write(" ");
ResultSet rs = (ResultSet) session.getAttribute("rsflight");
out.write("\n");
out.write(" <div class=\"booking1\">\n");
out.write(" <div align=\"right\"><b>Deparure: </b>");
out.print((String) session.getAttribute("from"));
out.write(" <b>Return: </b>");
out.print((String) session.getAttribute("to"));
out.write("</div>\n");
out.write(" <h1>1. Select Departing Flight</h1>\n");
out.write(" ");
while (rs.next()) {
out.write("\n");
out.write(" <div class=\"booking2\">\n");
out.write(" <font size = \"+1\" > <b> ");
out.print(rs.getString(2));
out.write("</b> </font><font color=\"gray\">to </font><font size=\"+1\"><b>");
out.print(rs.getString(3));
out.write("</b></font>\n");
out.write(" <div style=\"margin-left: 20px; margin-top: 10px\">\n");
out.write(" <font size='+1' color='orange'><b>");
out.print(rs.getString(4));
out.write("</b></font>\n");
out.write(" <table class=\"booking3\">\n");
out.write(" <tr>\n");
out.write(" <td width='20%'>Departs\n");
out.write(" <td width='20%'>Arrives\n");
out.write(" <td width='20%'>Flight Detail\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>");
out.print(rs.getString(5));
out.write("\n");
out.write(" <td>");
out.print(rs.getString(6));
out.write("\n");
out.write(" <td>");
out.print(rs.getString(7));
out.write("\n");
out.write(" <td class=\"booking4\" width=\"250px\"><font color=\"orange\"><input type=\"radio\">$");
out.print(rs.getInt(8));
out.write(".00</font>\n");
out.write(" </tr>\n");
out.write(" </table>\n");
out.write("\n");
out.write(" Note: Prices quoted are per adult passenger in USD. Unless otherwise stated fares are non refundable, limited changes are permitted changes apply<br>\n");
out.write(" Please note that this amount excludes fees and taxes.\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" <div align='right' style='margin-top:10px'>\n");
out.write(" <a href=\"BookingController?service=add&fid=");
out.print(rs.getInt(1));
out.write("\"> <button class=\"booking5\"><font color=\"white\">Save</font></button></a>\n");
out.write(" </div>\n");
out.write(" ");
}
out.write("\n");
out.write(" </div>\n");
out.write("\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
}
if (service.equals("managebookingsearch")) {
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <body>\n");
out.write(" <div align=\"center\">\n");
out.write(" <font color=\"orange\"><h1>Search Bookings</h1></font>\n");
out.write(" <form action=\"BookingController?service=search\" method=\"post\">\n");
out.write(" <div style='margin-left: -25%'>\n");
out.write(" <input type='radio' name='typeBooking' value='0' checked>Reservation code\n");
out.write(" <input type='radio' name='typeBooking' value='1'>All Bookings\n");
out.write(" </div>\n");
out.write(" <div align='left' style='margin-left: 15%'>\n");
out.write(" <table style='margin-top:20px'>\n");
out.write(" <tr>\n");
out.write(" <td>Enter reservation code \n");
out.write(" <td><input type='text' name='reservationCode' style='width:300px'>\n");
out.write(" </trnh>\n");
out.write(" <tr>\n");
out.write(" <td>\n");
out.write(" <td> <button class=\"mbs1\" type=\"submit\"><font color=\"white\"><b>Search</b></font></button>\n");
out.write(" </tr>\n");
out.write(" </table>\n");
out.write(" \n");
out.write(" </div>\n");
out.write(" </form>\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
}
if (service.equals("managebookingresult")) {
out.write("\n");
out.write(" ");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <body>\n");
out.write(" <div class=\"mbr1\" class='index1'>\n");
out.write(" ");
String msg2 = null;
msg2 = (String) session.getAttribute("msg");
if (msg2 != null) {
out.write("\n");
out.write(" <script>\n");
out.write(" alert(\"");
out.print(msg2);
out.write("\");\n");
out.write(" </script>\n");
out.write(" ");
session.removeAttribute("msg");
}
out.write("\n");
out.write(" ");
ResultSet rs = (ResultSet) session.getAttribute("rsbooking");
while (rs.next()) {
out.write("\n");
out.write(" <font color='orange' size='+2'><b>eTicket Receipt</b></font><br>\n");
out.write(" Prepared For<br>\n");
out.write(" ");
out.print(rs.getString(16));
out.write(',');
out.print(rs.getString(17));
out.write("<br>\n");
out.write(" RESERVATION CODE <b>");
out.print(rs.getInt(1));
out.write("</b><br>\n");
out.write(" TICKET ISSUE DATE ");
out.print(rs.getString(4));
out.write("\n");
out.write(" <br>\n");
out.write(" <br>\n");
out.write(" <font color='orange' size='+2'><b>Itinerary Details</b></font>\n");
out.write(" <table style='line-height:20px'>\n");
out.write(" <tr>\n");
out.write(" <td width='20%'>TRAVEL DATE\n");
out.write(" <td width='20%'>DEPARTURE\n");
out.write(" <td width='20%'>ARRIVAL\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td>");
out.print(rs.getString(8));
out.write("\n");
out.write(" <td>");
out.print(rs.getString(6));
out.write("<br>\n");
out.write(" Time ");
out.print(rs.getString(9));
out.write("\n");
out.write(" <td>");
out.print(rs.getString(7));
out.write("\n");
out.write(" <br>Time ");
out.print(rs.getString(10));
out.write("\n");
out.write(" </tr>\n");
out.write("\n");
out.write(" </table>\n");
out.write(" ");
if (!rs.isLast()) {
out.write("\n");
out.write(" <hr align='center' width='80%' class='hr1'>\n");
out.write(" ");
}
out.write("\n");
out.write(" ");
}
out.write("\n");
out.write("\n");
out.write("\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
out.write("\n");
out.write(" ");
}
out.write("\n");
out.write(" ");
DBConnect dao = new DBConnect(getServletContext());
if (dao.getConnect()!=null) dao.close();
out.write("\n");
out.write(" </div>\n");
out.write(" </body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
|
[
"zerozeralot@gmail.com"
] |
zerozeralot@gmail.com
|
5973e7238ceaeb459b402f4d17271d765af52c04
|
7b7c8d986f0e7e19787fd5113d355b22f0e46e12
|
/app/src/main/java/com/flyingtravel/ImageSlide/CirclePageIndicator.java
|
f6b04947a511b98be19792c4a9e51ddeaefafb89
|
[] |
no_license
|
weiwei1128/Travel
|
a5bff8f6b255962e05b9ed6ea0c41385d03ce795
|
b0a5092c27dd2d8ef08b9e53f33856e5596c9e5c
|
refs/heads/master
| 2021-01-21T13:03:04.213183
| 2016-06-02T04:54:27
| 2016-06-02T04:54:27
| 53,263,079
| 0
| 0
| null | 2016-05-23T01:19:39
| 2016-03-06T15:59:09
|
Java
|
UTF-8
|
Java
| false
| false
| 18,210
|
java
|
package com.flyingtravel.ImageSlide;
/**
* Created by wei on 2015/11/10.
*/
import static android.graphics.Paint.ANTI_ALIAS_FLAG;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import com.flyingtravel.R;
public class CirclePageIndicator extends View implements PageIndicator {
private static final int INVALID_POINTER = -1;
private float mRadius;
private final Paint mPaintPageFill = new Paint(ANTI_ALIAS_FLAG);
private final Paint mPaintStroke = new Paint(ANTI_ALIAS_FLAG);
private final Paint mPaintFill = new Paint(ANTI_ALIAS_FLAG);
private ViewPager mViewPager;
private ViewPager.OnPageChangeListener mListener;
private int mCurrentPage;
private int mSnapPage;
private float mPageOffset;
private int mScrollState;
private int mOrientation;
private boolean mCentered;
private boolean mSnap;
private int mTouchSlop;
private float mLastMotionX = -1;
private int mActivePointerId = INVALID_POINTER;
private boolean mIsDragging;
public CirclePageIndicator(Context context) {
this(context, null);
}
public CirclePageIndicator(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.vpiCirclePageIndicatorStyle);
}
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (isInEditMode()) return;
//Load defaults from resources
final Resources res = getResources();
final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
//default_circle_indicator_fill_color
final int defaultFillColor = res.getColor(R.color.holo_blue_dark);
final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
final int defaultStrokeColor = res.getColor(R.color.black);
//default_circle_indicator_stroke_color to black
final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);
//Retrieve styles attributes
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);
mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
mPaintPageFill.setStyle(Style.FILL);
mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
mPaintStroke.setStyle(Style.STROKE);
mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
mPaintFill.setStyle(Style.FILL);
mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
if (background != null) {
setBackgroundDrawable(background);
}
a.recycle();
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
public void setCentered(boolean centered) {
mCentered = centered;
invalidate();
}
public boolean isCentered() {
return mCentered;
}
public void setPageColor(int pageColor) {
mPaintPageFill.setColor(pageColor);
invalidate();
}
public int getPageColor() {
return mPaintPageFill.getColor();
}
public void setFillColor(int fillColor) {
mPaintFill.setColor(fillColor);
invalidate();
}
public int getFillColor() {
return mPaintFill.getColor();
}
public void setOrientation(int orientation) {
switch (orientation) {
case HORIZONTAL:
case VERTICAL:
mOrientation = orientation;
requestLayout();
break;
default:
throw new IllegalArgumentException("Orientation must be either HORIZONTAL or VERTICAL.");
}
}
public int getOrientation() {
return mOrientation;
}
public void setStrokeColor(int strokeColor) {
mPaintStroke.setColor(strokeColor);
invalidate();
}
public int getStrokeColor() {
return mPaintStroke.getColor();
}
public void setStrokeWidth(float strokeWidth) {
mPaintStroke.setStrokeWidth(strokeWidth);
invalidate();
}
public float getStrokeWidth() {
return mPaintStroke.getStrokeWidth();
}
public void setRadius(float radius) {
mRadius = radius;
invalidate();
}
public float getRadius() {
return mRadius;
}
public void setSnap(boolean snap) {
mSnap = snap;
invalidate();
}
public boolean isSnap() {
return mSnap;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (mViewPager == null) {
return;
}
final int count = mViewPager.getAdapter().getCount();
if (count == 0) {
return;
}
if (mCurrentPage >= count) {
setCurrentItem(count - 1);
return;
}
int longSize;
int longPaddingBefore;
int longPaddingAfter;
int shortPaddingBefore;
if (mOrientation == HORIZONTAL) {
longSize = getWidth();
longPaddingBefore = getPaddingLeft();
longPaddingAfter = getPaddingRight();
shortPaddingBefore = getPaddingTop();
} else {
longSize = getHeight();
longPaddingBefore = getPaddingTop();
longPaddingAfter = getPaddingBottom();
shortPaddingBefore = getPaddingLeft();
}
final float threeRadius = mRadius * 3;
final float shortOffset = shortPaddingBefore + mRadius;
float longOffset = longPaddingBefore + mRadius;
if (mCentered) {
longOffset += ((longSize - longPaddingBefore - longPaddingAfter) / 2.0f) - ((count * threeRadius) / 2.0f);
}
float dX;
float dY;
float pageFillRadius = mRadius;
if (mPaintStroke.getStrokeWidth() > 0) {
pageFillRadius -= mPaintStroke.getStrokeWidth() / 2.0f;
}
//Draw stroked circles
for (int iLoop = 0; iLoop < count; iLoop++) {
float drawLong = longOffset + (iLoop * threeRadius);
if (mOrientation == HORIZONTAL) {
dX = drawLong;
dY = shortOffset;
} else {
dX = shortOffset;
dY = drawLong;
}
// Only paint fill if not completely transparent
if (mPaintPageFill.getAlpha() > 0) {
canvas.drawCircle(dX, dY, pageFillRadius, mPaintPageFill);
}
// Only paint stroke if a stroke width was non-zero
if (pageFillRadius != mRadius) {
canvas.drawCircle(dX, dY, mRadius, mPaintStroke);
}
}
//Draw the filled circle_shape according to the current scroll
float cx = (mSnap ? mSnapPage : mCurrentPage) * threeRadius;
if (!mSnap) {
cx += mPageOffset * threeRadius;
}
if (mOrientation == HORIZONTAL) {
dX = longOffset + cx;
dY = shortOffset;
} else {
dX = shortOffset;
dY = longOffset + cx;
}
canvas.drawCircle(dX, dY, mRadius, mPaintFill);
}
public boolean onTouchEvent(android.view.MotionEvent ev) {
if (super.onTouchEvent(ev)) {
return true;
}
if ((mViewPager == null) || (mViewPager.getAdapter().getCount() == 0)) {
return false;
}
final int action = ev.getAction() & MotionEventCompat.ACTION_MASK;
switch (action) {
case MotionEvent.ACTION_DOWN:
mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
mLastMotionX = ev.getX();
break;
case MotionEvent.ACTION_MOVE: {
final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
final float x = MotionEventCompat.getX(ev, activePointerIndex);
final float deltaX = x - mLastMotionX;
if (!mIsDragging) {
if (Math.abs(deltaX) > mTouchSlop) {
mIsDragging = true;
}
}
if (mIsDragging) {
mLastMotionX = x;
if (mViewPager.isFakeDragging() || mViewPager.beginFakeDrag()) {
mViewPager.fakeDragBy(deltaX);
}
}
break;
}
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (!mIsDragging) {
final int count = mViewPager.getAdapter().getCount();
final int width = getWidth();
final float halfWidth = width / 2f;
final float sixthWidth = width / 6f;
if ((mCurrentPage > 0) && (ev.getX() < halfWidth - sixthWidth)) {
if (action != MotionEvent.ACTION_CANCEL) {
mViewPager.setCurrentItem(mCurrentPage - 1);
}
return true;
} else if ((mCurrentPage < count - 1) && (ev.getX() > halfWidth + sixthWidth)) {
if (action != MotionEvent.ACTION_CANCEL) {
mViewPager.setCurrentItem(mCurrentPage + 1);
}
return true;
}
}
mIsDragging = false;
mActivePointerId = INVALID_POINTER;
if (mViewPager.isFakeDragging()) mViewPager.endFakeDrag();
break;
case MotionEventCompat.ACTION_POINTER_DOWN: {
final int index = MotionEventCompat.getActionIndex(ev);
mLastMotionX = MotionEventCompat.getX(ev, index);
mActivePointerId = MotionEventCompat.getPointerId(ev, index);
break;
}
case MotionEventCompat.ACTION_POINTER_UP:
final int pointerIndex = MotionEventCompat.getActionIndex(ev);
final int pointerId = MotionEventCompat.getPointerId(ev, pointerIndex);
if (pointerId == mActivePointerId) {
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
mActivePointerId = MotionEventCompat.getPointerId(ev, newPointerIndex);
}
mLastMotionX = MotionEventCompat.getX(ev, MotionEventCompat.findPointerIndex(ev, mActivePointerId));
break;
}
return true;
}
@Override
public void setViewPager(ViewPager view) {
if (mViewPager == view) {
return;
}
if (mViewPager != null) {
mViewPager.setOnPageChangeListener(null);
}
if (view.getAdapter() == null) {
throw new IllegalStateException("ViewPager does not have adapter instance.");
}
mViewPager = view;
mViewPager.setOnPageChangeListener(this);
invalidate();
}
@Override
public void setViewPager(ViewPager view, int initialPosition) {
setViewPager(view);
setCurrentItem(initialPosition);
}
@Override
public void setCurrentItem(int item) {
if (mViewPager == null) {
throw new IllegalStateException("ViewPager has not been bound.");
}
mViewPager.setCurrentItem(item);
mCurrentPage = item;
invalidate();
}
@Override
public void notifyDataSetChanged() {
invalidate();
}
@Override
public void onPageScrollStateChanged(int state) {
mScrollState = state;
if (mListener != null) {
mListener.onPageScrollStateChanged(state);
}
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
mCurrentPage = position;
mPageOffset = positionOffset;
invalidate();
if (mListener != null) {
mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);
}
}
@Override
public void onPageSelected(int position) {
if (mSnap || mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mCurrentPage = position;
mSnapPage = position;
invalidate();
}
if (mListener != null) {
mListener.onPageSelected(position);
}
}
@Override
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
mListener = listener;
}
/*
* (non-Javadoc)
*
* @see android.view.View#onMeasure(int, int)
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mOrientation == HORIZONTAL) {
setMeasuredDimension(measureLong(widthMeasureSpec), measureShort(heightMeasureSpec));
} else {
setMeasuredDimension(measureShort(widthMeasureSpec), measureLong(heightMeasureSpec));
}
}
/**
* Determines the width of this view
*
* @param measureSpec
* A measureSpec packed into an int
* @return The width of the view, honoring constraints from measureSpec
*/
private int measureLong(int measureSpec) {
int result;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if ((specMode == MeasureSpec.EXACTLY) || (mViewPager == null)) {
//We were told how big to be
result = specSize;
} else {
//Calculate the width according the views count
final int count = mViewPager.getAdapter().getCount();
result = (int)(getPaddingLeft() + getPaddingRight()
+ (count * 2 * mRadius) + (count - 1) * mRadius + 1);
//Respect AT_MOST value if that was what is called for by measureSpec
if (specMode == MeasureSpec.AT_MOST) {
result = Math.min(result, specSize);
}
}
return result;
}
/**
* Determines the height of this view
*
* @param measureSpec
* A measureSpec packed into an int
* @return The height of the view, honoring constraints from measureSpec
*/
private int measureShort(int measureSpec) {
int result;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
//We were told how big to be
result = specSize;
} else {
//Measure the height
result = (int)(2 * mRadius + getPaddingTop() + getPaddingBottom() + 1);
//Respect AT_MOST value if that was what is called for by measureSpec
if (specMode == MeasureSpec.AT_MOST) {
result = Math.min(result, specSize);
}
}
return result;
}
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState savedState = (SavedState)state;
super.onRestoreInstanceState(savedState.getSuperState());
mCurrentPage = savedState.currentPage;
mSnapPage = savedState.currentPage;
requestLayout();
}
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState savedState = new SavedState(superState);
savedState.currentPage = mCurrentPage;
return savedState;
}
static class SavedState extends BaseSavedState {
int currentPage;
public SavedState(Parcelable superState) {
super(superState);
}
private SavedState(Parcel in) {
super(in);
currentPage = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(currentPage);
}
@SuppressWarnings("UnusedDeclaration")
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {
@Override
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
@Override
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}
}
|
[
"justbearcry@gmail.com"
] |
justbearcry@gmail.com
|
670a2d3cd29073799371a4118a8d826e16ba6032
|
c0d4038466988483b24aa19555ecaced88b2eb46
|
/core/src/fr/n7/game/flappyzombie/world/models/Grass.java
|
99778415f6000536a9ecde3ffd6f418e27f4dad1
|
[
"Beerware"
] |
permissive
|
N7i/Flappy-Zombie
|
767b1df3f06e7e09f742910f48bfc88ad38db895
|
d1c2d348cbc31ce7ccfad9f1073706209d2c90cc
|
refs/heads/master
| 2020-12-24T17:26:47.408308
| 2015-04-06T16:19:01
| 2015-04-06T16:19:01
| 33,444,453
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 621
|
java
|
package fr.n7.game.flappyzombie.world.models;
import fr.n7.game.flappyzombie.world.models.base.HorizontaleScrollable;
/**
* Created by Nementon on 06/04/2015.
*/
public class Grass extends HorizontaleScrollable {
public Grass(float x, float y, int width, int height, float scrollSpeed) {
super(x, y, width, height, scrollSpeed);
}
@Override
public boolean collides(Bird bird) {
if (super.collides(bird)) {
bird.die();
return true;
}
return false;
}
@Override
public void reset(float newX) {
position().x = newX;
}
}
|
[
"gueux666@gmail.com"
] |
gueux666@gmail.com
|
3bbadfcb6a543b06d3a732eda4f5ba3262369536
|
537a5b9e6cbb0a46da2e464564dc25294ec31dd8
|
/StringFAQ/src/RemoveChar.java
|
8e18a3f6b0466e7e9e0f6008b39ae55c3105a6dc
|
[
"MIT"
] |
permissive
|
akashgangurde/anotherJavaRepository
|
8d43685a995b2cc81b4bdb520f6eac1a7f2c806b
|
6bfef7e6ab39c6fb57a024ad0bcf36fade155e84
|
refs/heads/main
| 2023-03-14T16:27:24.194428
| 2021-03-21T09:43:20
| 2021-03-21T09:43:20
| 349,948,722
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 317
|
java
|
public class RemoveChar {
public static void main(String[] args) {
String str = "Lakers 2020 Champs";
System.out.println(charRemoveAt(str, 10));
}
public static String charRemoveAt(String str, int p) {
return str.substring(0, p) + str.substring(p + 1);
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
b7b9bdd31b5de5b9217cff0549fa092871001541
|
af750d17e64bea910003909a10572f8f91d910d8
|
/app/src/main/java/com/example/semesterproject/RetrieveData_TimeTable.java
|
379ae069915abe76f6581097052e1a66e33b71e9
|
[] |
no_license
|
shahrukhktk/SemesterProject_AdminApp
|
3ce4961e0d7bd03f73861033f659861e89bf9a02
|
5678ebef4350451875d8a63babe3541f117f2c47
|
refs/heads/master
| 2020-06-08T22:44:17.412040
| 2019-06-23T11:10:14
| 2019-06-23T11:10:14
| 193,320,257
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,201
|
java
|
package com.example.semesterproject;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.widget.Toast;
import com.example.semesterproject.Model.UploadEvent;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.ArrayList;
import java.util.List;
public class RetrieveData_TimeTable extends AppCompatActivity
{
RecyclerView mRecyclerView;
DatabaseReference dbRefer;
private FirebaseStorage mStorage;
private ValueEventListener mDBListener;
Context mContext;
private Timetable_Adapter adapter;
private List<UploadEvent> mUploads;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_retrieve_data__time_table);
fetchMethod_TimeTable();
}
private void fetchMethod_TimeTable() {
mContext = this;
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_id_recieved);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("CLASSES TIMETABLE");
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mRecyclerView.hasFixedSize();
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mUploads = new ArrayList<>();
mStorage = FirebaseStorage.getInstance();
dbRefer = FirebaseDatabase.getInstance().getReference("Timetable").child("Event");
mDBListener = dbRefer.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
mUploads.clear();
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
UploadEvent uploadedpic = postSnapshot.getValue(UploadEvent.class);
uploadedpic.mKey = postSnapshot.getKey();
mUploads.add(uploadedpic);
}
adapter = new Timetable_Adapter(RetrieveData_TimeTable.this, mUploads);
mRecyclerView.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText(RetrieveData_TimeTable.this, "Error : " + databaseError.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void onStart()
{
super.onStart();
}
@Override
protected void onDestroy()
{
super.onDestroy();
dbRefer.removeEventListener(mDBListener);
}
// @Override
// public void OnItemClick(int position)
// {
// Toast.makeText(mContext, "OnItemClick" + position, Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void UpdateClick(int position)
// {
// Toast.makeText(mContext, "UPDATE" + position, Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void DeleteClick(int position)
// {
// UploadEvent selectedItem = mUploads.get(position);
// final String selectedKey = selectedItem.getmKey();
// StorageReference imgRef = mStorage.getReferenceFromUrl(selectedItem.getImageUri());
// imgRef.delete().addOnSuccessListener(new OnSuccessListener<Void>() {
// @Override
// public void onSuccess(Void aVoid) {
// dbRefer.child("Event").child(selectedKey).setValue(null);
// Toast.makeText(mContext, "Event Deleted", Toast.LENGTH_SHORT).show();
// }
// });
// }
}
|
[
"shahrukhktk760@gmail.com"
] |
shahrukhktk760@gmail.com
|
3ae363d3626265a6fe918789fbbf3c7edb067d39
|
4a55b31930700171377209e10035fe0dea36d675
|
/f1app/src/main/java/uniWork/f1app/Entities/DriverContractTO.java
|
4f7e8537f3929500a3ee20b6401647ea2f9fcfce
|
[] |
no_license
|
Tudiman/F1MVCApp
|
d31af6150be11223cea377ca339a759856ce6c4b
|
bcb6e24bc5ae3824f17c3e2f9937a86d378d2547
|
refs/heads/main
| 2023-02-12T05:32:05.530887
| 2021-01-15T14:05:24
| 2021-01-15T14:05:24
| 329,896,180
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 693
|
java
|
package uniWork.f1app.Entities;
import lombok.*;
@Getter @Setter
@NoArgsConstructor @AllArgsConstructor
@EqualsAndHashCode
public class DriverContractTO {
private String driverFirstName;
private String driverLastName;
private String teamName;
private Integer startDate;
private Integer endDate;
@Override
public String toString() {
return "DriverContractTO{" +
"driverFirstName='" + driverFirstName + '\'' +
", driverLastName='" + driverLastName + '\'' +
", teamName='" + teamName + '\'' +
", startDate=" + startDate +
", endDate=" + endDate +
'}';
}
}
|
[
"vladtudose496@gmail.com"
] |
vladtudose496@gmail.com
|
2d0f21f9ad71f381719e62f9c6a0c1984ecf2b5c
|
53f895ac58cb7c9e1e8976c235df9c4544e79d33
|
/26_Wrapper Classes/com/source/wrapperclass/M24.java
|
0e4dc0f96014bc27ab3348efd30b38a6506dc8d7
|
[] |
no_license
|
alagurajan/CoreJava
|
c336356b45cdbcdc88311efbba8f57503e050b66
|
be5a8c2a60aac072f777d8b0320e4c94a1266cb3
|
refs/heads/master
| 2021-01-11T01:33:11.447570
| 2016-12-16T22:24:58
| 2016-12-16T22:24:58
| 70,690,915
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 226
|
java
|
package com.source.wrapperclass;
public class M24
{
public static void main(String[] args)
{
char c1 = new Character('s');
char c2 = 's'; /****** Unboxing*******/
System.out.println("Done");
}
}
|
[
"aalagurajan@gmail.com"
] |
aalagurajan@gmail.com
|
a6cf6d4d402b87e95b857915a34f2edf3eff8805
|
7b6d5a6a8be27154715f43121d9371e2baa48bfe
|
/src/main/java/com/jian/website/config/VerifyConfig.java
|
ee3fe6fadbffb7eb2bfcd17f356b92a1d409d745
|
[] |
no_license
|
error20000/website222
|
7fcd975c402de78a9104765d9ff1b06e0e979820
|
b36291039c6bd4768081e19c7aa75887d3249556
|
refs/heads/master
| 2020-03-27T10:35:43.627900
| 2018-08-28T10:33:32
| 2018-08-28T10:33:32
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,721
|
java
|
package com.jian.website.config;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.jian.tools.core.HttpTools;
import com.jian.tools.core.JsonTools;
import com.jian.tools.core.ResultTools;
import com.jian.tools.core.Tips;
import com.jian.tools.core.Tools;
public class VerifyConfig {
public static String loginUserKey = Config.login_session_key;
public static String loginUserCache = "CACHE_SSO_USER";
public static String ssoUrl = Config.sso_url;
/**
* 登录验证
* @param req
* @return 通过返回null
*/
public static Map<String, Object> verifyLogin(HttpServletRequest req){
if(Tools.isNullOrEmpty(ssoUrl)){
//单点登录验证.
return verifyLoginSSO(req);
}else{
//本地session验证.
return verifyLoginNormal(req);
}
// return null;
}
/**
* 参数签名验证
* @param req
* @return 通过返回null
*/
public static Map<String, Object> verifySign(HttpServletRequest req){
//TODO do something
return null;
}
/**
* 获取登录用户信息
* @param req
* @return
*/
public static String getUserInfo(HttpServletRequest req){
//获取sso用户信息,注意这里是sso用户,可能需要转换成自己项目的用户
HttpSession session = req.getSession();
Object user = session.getAttribute(loginUserKey);
if(user == null){
return null;
}
//TODO do change
return JsonTools.toJsonString(user);
}
/**
* 写入登录用户信息
* @return
*/
public static void setUserInfo(){
//TODO 建议先判断账号信息是否存在,不存在再写入。
}
private static Map<String, Object> verifyLoginNormal(HttpServletRequest req){
HttpSession session = req.getSession();
Object temp = session.getAttribute(loginUserKey);
if(temp == null){
return ResultTools.custom(Tips.ERROR111).build();
}
return null;
}
private static Map<String, Object> verifyLoginSSO(HttpServletRequest req){
//sso
String token = getTokenSSO(req);
String host = req.getHeader("host");
if(Tools.isNullOrEmpty(token)){
return ResultTools.custom(Tips.ERROR111).build();
}
//缓存在session,节约sso访问时间次数
HttpSession session = req.getSession();
Object temp = session.getAttribute(loginUserCache);
if(temp != null && token.equals(temp)){
return null;
}
//sso验证
String res = HttpTools.getInstance().sendHttpGet(ssoUrl + "/api/user/userAuth?token="+token+"&host="+host);
Map<String, Object> map = new HashMap<>();
try {
map = JsonTools.jsonToMap(res);
} catch (Exception e) {
e.printStackTrace();
}
if(map.get("code") == null || Tools.parseInt(map.get("code") + "") != 1){
return map;
}else{
//保存用户
Map<String, Object> data = JsonTools.jsonToMap(JsonTools.toJsonString(map.get("data")));
if(data != null){
Map<String, Object> user =JsonTools.jsonToMap(JsonTools.toJsonString(data.get("user")));
if(user != null){
session.setAttribute(loginUserKey, user);
session.setAttribute(loginUserCache, token);
//写入帐号信息
setUserInfo();
}
}
}
return null;
}
private static String getTokenSSO(HttpServletRequest req){
// String tokenStr = Tools.isNullOrEmpty(req.getHeader("token")) ? Tools.getReqParamSafe(req, "token") : req.getHeader("token");
//读取cookie
String tokenStr = "";
Cookie[] cookies = req.getCookies();
if(cookies != null){
for (int i = 0; i < cookies.length; i++) {
Cookie tmp = cookies[i];
if("token".equals(tmp.getName())){
tokenStr = tmp.getValue();
break;
}
}
}
return tokenStr;
}
}
|
[
"liujian@digisky.com"
] |
liujian@digisky.com
|
aad6c17540c218926736cad1d41dfbb9a95752fb
|
92900df21cc10450e633bc652ea0dcf006154683
|
/src/main/java/com/kdyzm/spring/helloworld/JUC/TestConcurrentHashMap.java
|
3b9a6055094aaf54df955d99368fdfbab33018d6
|
[] |
no_license
|
dirkzhou222/spring-source-code-deep-analysis
|
eea08fe52ae37f90349d9416e1b4c487273e7940
|
6c5faa2f791b7d827b482d717c22f27bf0b68339
|
refs/heads/master
| 2020-05-14T23:14:23.927980
| 2019-05-14T03:13:32
| 2019-05-14T03:13:32
| 181,993,506
| 0
| 0
| null | 2019-04-18T01:19:32
| 2019-04-18T01:19:32
| null |
UTF-8
|
Java
| false
| false
| 1,115
|
java
|
package com.kdyzm.spring.helloworld.JUC;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @Author: dirk
* @CreateDate: 2019-04-24 17:12
*/
public class TestConcurrentHashMap {
public static void main(String[] args) {
Map map = new ConcurrentHashMap();
/*map.putIfAbsent(1,1);
map.putIfAbsent(17,17);
map.putIfAbsent(33,33);
System.out.println(map.get(17));*/
fullPutCoverage(map);
System.out.println("size="+map.size());
}
public static void fullPutCoverage(Map map){
map.putIfAbsent(7,7);
map.putIfAbsent(23,23);
map.putIfAbsent(39,39);
map.putIfAbsent(11,11);
map.putIfAbsent(27,27);
map.putIfAbsent(15,15);
map.putIfAbsent(31,31);
map.putIfAbsent(47,47);
map.putIfAbsent(63,63);
map.putIfAbsent(79,79);
map.putIfAbsent(95,95);
map.putIfAbsent(111,111);
map.putIfAbsent(127,127);
for(Object key : map.keySet()){
System.out.println("k=>"+key+",v=>"+map.get(key));
}
}
}
|
[
"861588487@qq.com"
] |
861588487@qq.com
|
40092eee56182c88d967274017a5136d8f21ddc2
|
5c016d691b30435c37a11e6f90f2b27f78fd7c05
|
/src/main/java/org/ccframe/subsys/core/service/RoleMenuResRelService.java
|
3c14c1f1d1a05597db18b14bf81cf19fa38ee47c
|
[] |
no_license
|
tbs005/BikeServer
|
4a38788763221dd2cc40380ec8a8e0ec1398b1e9
|
11ca6fbc67cd922e481781a5d757927f90cb4dff
|
refs/heads/master
| 2021-05-05T20:37:06.266744
| 2017-07-29T03:38:13
| 2017-07-29T03:38:13
| 100,594,741
| 2
| 0
| null | 2017-08-17T11:08:44
| 2017-08-17T11:08:44
| null |
UTF-8
|
Java
| false
| false
| 813
|
java
|
package org.ccframe.subsys.core.service;
import org.ccframe.commons.base.BaseService;
import org.ccframe.subsys.core.domain.entity.RoleMenuResRel;
import org.ccframe.subsys.core.repository.RoleMenuResRelRepository;
import org.springframework.stereotype.Service;
@Service
public class RoleMenuResRelService extends BaseService<RoleMenuResRel, Integer, RoleMenuResRelRepository> {
// @Transactional(readOnly = true)
// public List<RoleMenuResRel> findByRoleIdList(Collection<Integer> roleIdList) {
// List<Criterion> orList = new ArrayList<Criterion>();
// for(Integer roleId: roleIdList){
// orList.add(Restrictions.eq(RoleMenuResRel.ROLE_ID, roleId));
// }
// return this.getRepository().findAll(new Criteria<RoleMenuResRel>().add(Restrictions.or(orList.toArray(new Criterion[orList.size()]))));
// }
}
|
[
"1275563227@qq.com"
] |
1275563227@qq.com
|
fc9670941613d237b8be5dad18cdee4666717e1e
|
ce886eb85232d0dfffc9bbac1159cc54a62df593
|
/Implementation/Platform/src/Platform/Util/Profiler/observercode/ObjectValueString.java
|
38a7b7bfcf2a430687ecf1ea852d1407c2764511
|
[] |
no_license
|
Kalinin-Maksim-JavaDev/MultySimSystems
|
0ae87895832646aad8a737cd1210ede042db0949
|
33c43016a89d122a085f070300b591f64f7aa915
|
refs/heads/master
| 2022-11-19T23:28:20.406276
| 2020-07-16T11:16:32
| 2020-07-16T11:16:32
| 280,129,624
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 207
|
java
|
package Platform.Util.Profiler.observercode;
public class ObjectValueString extends ObjectValue {
public ObjectValueString(String name_) {
super(name_);
value = new String();
}
}
|
[
"mk0304@mail.ru"
] |
mk0304@mail.ru
|
70da9a057856b77cf8530fa22c2cfed6e82eacc3
|
df60a350f98730d3c15dc13679fd318d0c1cc482
|
/src/test/java/com/inetbanking/pageObjects/CustomizedStatement.java
|
5b538291f0a757c5a810e2cd68af837f70436b2e
|
[] |
no_license
|
Nikhil8778/inetbanking
|
3b8c43b43d65e80e8d0e0590c4ddfbbc9d9395e9
|
2271d3d8559d2d9732cae6f8bd7eccdc7b2ea231
|
refs/heads/master
| 2022-12-29T06:45:02.101733
| 2020-04-12T00:08:59
| 2020-04-12T00:08:59
| 254,714,580
| 0
| 0
| null | 2020-10-13T21:06:43
| 2020-04-10T19:05:48
|
Java
|
UTF-8
|
Java
| false
| false
| 1,130
|
java
|
package com.inetbanking.pageObjects;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class CustomizedStatement {
WebDriver driver;
CustomizedStatement(WebDriver d) {
driver=d;
PageFactory.initElements(d, this);
}
@FindBy(name="accountno ")WebElement acc;
@FindBy(name="fdate")WebElement fromdate;
@FindBy(name="tdate")WebElement todate;
@FindBy(name="amountlowerlimit")WebElement amlolimit;
@FindBy(name="numtransaction")WebElement numtrans;
@FindBy(name="AccSubmit")WebElement submit;
@FindBy(name="res")WebElement reset;
public void setaccountnumber(String account) {
acc.sendKeys(account);
}
public void setfromdate(String fdate) {
fromdate.sendKeys(fdate);
}
public void settodate(String tdate) {
todate.sendKeys(tdate);
}
public void setamountlowerlimit(String all) {
amlolimit.sendKeys(all);
}
public void setnumbertransaction(String nt) {
numtrans.sendKeys(nt);
}
public void setsubmit() {
submit.click();
}
public void setreset() {
reset.click();
}
}
|
[
"nikhilgupta.4488@gmail.com"
] |
nikhilgupta.4488@gmail.com
|
5c8df4410fa5f073ad99cbb56274836d4dc5b89f
|
9d92bc38d8a3196f6136902c36d2e10bf8cc8d44
|
/src/main/java/com/olp/jpa/domain/docu/ut/EmployeeService.java
|
297ec155312127688fcbb58a87795448d9076555
|
[] |
no_license
|
trilia/b2b_bkofc_jayesh
|
75814e15cfba267b86b7d3f013a400dee16fccc0
|
b6c8826dce5ed7ca624ffe63b4307fd34d3e0e7c
|
refs/heads/master
| 2020-12-03T02:10:22.144574
| 2017-09-12T16:30:52
| 2017-09-12T16:30:52
| 95,911,719
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,867
|
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.olp.jpa.domain.docu.ut;
import com.olp.jpa.domain.docu.ut.model.EmployeeBean;
import com.olp.jpa.common.IJpaService;
import com.olp.jpa.common.SortCriteriaBean;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import org.springframework.data.repository.NoRepositoryBean;
/**
*
* @author raghosh
*/
@NoRepositoryBean
//@WebService(targetNamespace="http://trilia-cloud.com/schema/entity/ut/ut-employee-service/")
public interface EmployeeService extends IJpaService<EmployeeBean, Long> {
@Override
@WebMethod(operationName="listAllEmployees")
public List<EmployeeBean> findAll();
@Override
@WebMethod(operationName="listAllEmployeesSorted")
public List<EmployeeBean> findAll(@WebParam(name="sortCriteria") SortCriteriaBean sort);
@Override
@WebMethod(operationName="findEmployeeById")
public EmployeeBean find(@WebParam(name="employeeInternalId") Long id);
@WebMethod(operationName="findEmployeeByCode")
public EmployeeBean find(String empCode);
@Override
@WebMethod(operationName="addEmployee")
public EmployeeBean add(@WebParam(name="employee") EmployeeBean entity);
@Override
@WebMethod(operationName="updateEmployee")
public EmployeeBean update(@WebParam(name="employee") EmployeeBean entity);
@WebMethod(operationName="createEmployeeAndAssignManager")
public EmployeeBean createEmployee(@WebParam(name="employee") EmployeeBean employee,
@WebParam(name="managerEmployeeCode") String managerEmpCode);
@WebMethod(operationName="createEmployeeAssignManagerDept")
public EmployeeBean createEmployee(@WebParam(name="employee") EmployeeBean employee,
@WebParam(name="managerEmployeeCode") String managerEmpCode, @WebParam(name="departmentCode") String deptCode);
@WebMethod(operationName="assignDepartment")
public boolean assignDepartment(@WebParam(name="employeeCode") String employeeCode, @WebParam(name="departmentCode") String deptCode);
@WebMethod(operationName="assignManager")
public boolean assignManager(@WebParam(name="employeeCode") String employeeCode, @WebParam(name="managerEmployeeCode") String managerEmpCode);
@Override
public List<Long> addAll(List<EmployeeBean> list, boolean ignoreError);
@Override
public List<Long> updateAll(List<EmployeeBean> list, boolean ignoreError);
@Override
public void deleteAll(boolean ignoreError);
@Override
public List<EmployeeBean> find(List<Long> list);
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
4b76e8ab04cda48d07a2f262f25f3165bdb35b1b
|
f3e560384988e15529ff9b35b97a8a9b812c540e
|
/Finance Manager/src/finance/manager/View/MainFrame.java
|
08905965bd793ecae9ff8d2767770bdbddeb12a4
|
[] |
no_license
|
rsmodel/rsmodel
|
d0411b27facd83683a35f5e20304e1fc0218b4c2
|
178cff5d2f2fde8c0d4451070c0e96f8ce268c01
|
refs/heads/master
| 2021-04-26T23:04:34.741553
| 2019-09-15T11:47:40
| 2019-09-15T11:47:40
| 123,926,600
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 799
|
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 finance.manager.View;
import finance.manager.View.menubar.MenubarManager;
import finance.manager.View.tabbedpane.TabbedPaneManager;
import javax.swing.JFrame;
/**
*
* @author User
*/
public class MainFrame extends JFrame{
private MainWindowListener _window_listener = new MainWindowListener();
public MainFrame() {
super("Finance Manager");
this.addWindowListener(_window_listener);
MenubarManager.getInstance().setMenuBar(this);
TabbedPaneManager.getInstance().addTabbedPane(this);
}
}
|
[
"User@Kastel-lar"
] |
User@Kastel-lar
|
1d0ff91b1c6cd7ba5481876978bf61695aa48ffc
|
79d982e5b6353f6d5b63c2c7ad95f7eaddeaa849
|
/org.eclipse.om2m/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java
|
229b344f7ac4818a472087cf3cdd78e61a11767b
|
[] |
no_license
|
hongdatchy/oneM2m
|
720243e849a5f8ed5898e67792e6ef6df5536c99
|
15fccb4c589bf4fe4fe09733c949aa6d65fc410a
|
refs/heads/master
| 2022-12-22T02:49:23.167608
| 2020-09-29T08:41:12
| 2020-09-29T08:41:12
| 299,550,383
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 18,231
|
java
|
/*******************************************************************************
* Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
* 7 Colonel Roche 31077 Toulouse - France
*
* 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
*
* Initial Contributors:
* Thierry Monteil : Project manager, technical co-manager
* Mahdi Ben Alaya : Technical co-manager
* Samir Medjiah : Technical co-manager
* Khalil Drira : Strategy expert
* Guillaume Garzone : Developer
* François Aïssaoui : Developer
*
* New contributors :
*******************************************************************************/
package org.eclipse.om2m.core;
import java.math.BigInteger;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.om2m.commons.constants.AccessControl;
import org.eclipse.om2m.commons.constants.CSEType;
import org.eclipse.om2m.commons.constants.Constants;
import org.eclipse.om2m.commons.constants.MimeMediaType;
import org.eclipse.om2m.commons.constants.Operation;
import org.eclipse.om2m.commons.constants.ResourceType;
import org.eclipse.om2m.commons.constants.ResponseStatusCode;
import org.eclipse.om2m.commons.constants.ResultContent;
import org.eclipse.om2m.commons.constants.ShortName;
import org.eclipse.om2m.commons.entities.AccessControlOriginatorEntity;
import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
import org.eclipse.om2m.commons.entities.AccessControlRuleEntity;
import org.eclipse.om2m.commons.entities.CSEBaseEntity;
import org.eclipse.om2m.commons.entities.RemoteCSEEntity;
import org.eclipse.om2m.commons.resource.AccessControlPolicy;
import org.eclipse.om2m.commons.resource.RemoteCSE;
import org.eclipse.om2m.commons.resource.RequestPrimitive;
import org.eclipse.om2m.commons.resource.ResponsePrimitive;
import org.eclipse.om2m.commons.utils.Util.DateUtil;
import org.eclipse.om2m.core.comm.RestClient;
import org.eclipse.om2m.core.controller.Controller;
import org.eclipse.om2m.core.datamapper.DataMapperSelector;
import org.eclipse.om2m.core.persistence.PersistenceService;
import org.eclipse.om2m.core.remotecse.RemoteCseService;
import org.eclipse.om2m.core.urimapper.UriMapper;
import org.eclipse.om2m.persistence.service.DBService;
import org.eclipse.om2m.persistence.service.DBTransaction;
/**
* Initializer for CSE entity
*
*/
public class CSEInitializer implements Constants {
/** Logger */
private static final Log LOGGER = LogFactory.getLog(CSEInitializer.class);
private static RemoteCSE currentRegistrationToIn;
private static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private static final Object MUTEX = new Object();
/** Private constructor */
private CSEInitializer() {
}
private static String acpAdminId;
/**
* Initialize the current launching CSE.
*/
public static void init() throws InterruptedException {
LOGGER.info("Initializating the cseBase");
// Check the existence of the cseBase in the database
DBService dbs = PersistenceService.getInstance().getDbService();
DBTransaction transaction = dbs.getDbTransaction();
transaction.open();
CSEBaseEntity cseBase = dbs.getDAOFactory().getCSEBaseDAO().find(transaction, "/" + Constants.CSE_ID);
// if the cseBase is not initialized, then create the base resources
if (cseBase == null) {
// Create AccessRight resource
LOGGER.info("Create AccessControlPolicy resource");
initACP();
// Create CSEBase resource
LOGGER.info("Create CSEBase resource");
initCSEBase();
if (!Constants.CSE_TYPE.equalsIgnoreCase(CSEType.IN) && Constants.CSE_AUTHENTICATION) {
LOGGER.info("Register CSE to another CSE.");
new Thread(new Runnable() {
@Override
public void run() {
registerCSE();
checkPeriodicallyCSERegistration();
}
}).start();
}
} else {
LOGGER.info("cseBase already initialized");
}
}
/**
* Creates the root {@link CseBase} resource in DataBase.
*/
private static void initCSEBase() {
CSEBaseEntity cseBaseEntity = new CSEBaseEntity();
DBService db = PersistenceService.getInstance().getDbService();
DBTransaction transaction = db.getDbTransaction();
transaction.open();
AccessControlPolicyEntity acpEntity = db.getDAOFactory().getAccessControlPolicyDAO().find(transaction, acpAdminId);
cseBaseEntity.getAccessControlPolicies().add(acpEntity);
cseBaseEntity.getChildAccessControlPolicies().add(acpEntity);
cseBaseEntity.setCreationTime(DateUtil.now());
cseBaseEntity.setCseid(Constants.CSE_ID);
cseBaseEntity.setCseType(CSEType.toBigInteger(Constants.CSE_TYPE));
cseBaseEntity.setLastModifiedTime(DateUtil.now());
cseBaseEntity.setName(Constants.CSE_NAME);
cseBaseEntity.setResourceID("/" + Constants.CSE_ID);
cseBaseEntity.setResourceType(BigInteger.valueOf(ResourceType.CSE_BASE));
cseBaseEntity.setHierarchicalURI("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);
// generating array of supported resources types
int[] supportedResources = { ResourceType.ACCESS_CONTROL_POLICY, ResourceType.AE, ResourceType.CONTAINER,
ResourceType.CONTENT_INSTANCE, ResourceType.CSE_BASE, ResourceType.GROUP, ResourceType.NODE,
ResourceType.POLLING_CHANNEL, ResourceType.REMOTE_CSE, ResourceType.REQUEST,
ResourceType.SUBSCRIPTION, ResourceType.FLEXCONTAINER };
for (int rt : supportedResources) {
cseBaseEntity.getSupportedResourceType().add(BigInteger.valueOf(rt));
}
cseBaseEntity.getPointOfAccess()
.add("http://" + Constants.CSE_IP + ":" + Constants.CSE_PORT + Constants.CSE_CONTEXT);
UriMapper.addNewUri(cseBaseEntity.getHierarchicalURI(), cseBaseEntity.getResourceID(), ResourceType.CSE_BASE);
if (db.getDAOFactory().getCSEBaseDAO().find(transaction, cseBaseEntity.getResourceID()) == null) {
db.getDAOFactory().getCSEBaseDAO().create(transaction, cseBaseEntity);
} else {
db.getDAOFactory().getCSEBaseDAO().update(transaction, cseBaseEntity);
}
// update acp admin entity's parent
CSEBaseEntity dbCseBaseEntity = db.getDAOFactory().getCSEBaseDAO().find(transaction, cseBaseEntity.getResourceID());
acpEntity.setParentCse(dbCseBaseEntity);
transaction.commit();
transaction.close();
}
/**
* Sends {@link CseBase} resource in DataBase.
*/
private static void registerCSE() {
String contentFormat = System.getProperty("org.eclipse.om2m.registration.contentFormat", MimeMediaType.XML);
RemoteCSE remoteCSE = new RemoteCSE();
switch (Constants.CSE_TYPE.toLowerCase()) {
case CSEType.ASN:
remoteCSE.setCseType(CSEType.ASN_CSE);
break;
case CSEType.MN:
remoteCSE.setCseType(CSEType.MN_CSE);
break;
default:
break;
}
String httpPoa = "http://" + Constants.CSE_IP + ":" + Constants.CSE_PORT + Constants.CSE_CONTEXT;
if (Constants.CSE_CONTEXT.length() > 1) {
httpPoa += "/";
}
remoteCSE.getPointOfAccess().add(httpPoa);
remoteCSE.setCSEID("/" + Constants.CSE_ID);
remoteCSE.setCSEBase("//" + Constants.M2M_SP_ID + remoteCSE.getCSEID());
remoteCSE.setRequestReachability(new Boolean(true));
remoteCSE.setName(Constants.CSE_NAME);
remoteCSE.getDescendantCSEs().add(Constants.CSE_NAME);
String representation = DataMapperSelector.getDataMapperList().get(contentFormat).objToString(remoteCSE);
RequestPrimitive request = new RequestPrimitive();
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
String remotePoa = "http://" + Constants.REMOTE_CSE_IP + ":" + Constants.REMOTE_CSE_PORT + "/~"
+ Constants.REMOTE_CSE_CONTEXT;
if (Constants.REMOTE_CSE_CONTEXT.length() > 1 && !Constants.REMOTE_CSE_CONTEXT.equals("/~")) {
remotePoa += "/";
}
remotePoa += Constants.REMOTE_CSE_ID;
request.setTo(remotePoa);
request.setContent(representation);
request.setOperation(Operation.CREATE);
request.setResourceType(BigInteger.valueOf(ResourceType.REMOTE_CSE));
request.setRequestContentType(contentFormat);
request.setRequestIdentifier("001");
boolean registered = false;
while (!registered) {
ResponsePrimitive response = RestClient.sendRequest(request);
LOGGER.info("response after registration: " + response);
if (response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
registered = true;
// retrieve RemoteCSE entity and store it
synchronized (MUTEX) {
currentRegistrationToIn = (RemoteCSE) DataMapperSelector.getDataMapperList().get(contentFormat)
.stringToObj((String) response.getContent());
}
break;
} else if (ResponseStatusCode.CONFLICT.equals(response.getResponseStatusCode())) {
// conflict ==> the CSE was previously registered
// need to delete old registration
deleteRegistration();
// then create a new one
registered = false;
} else {
try {
LOGGER.info("Error in registration to another CSE. Retrying in 10s");
Thread.sleep(10000);
} catch (InterruptedException e) {
LOGGER.debug("Interrupted Exception", e);
}
}
}
LOGGER.info("Successfully registered to " + Constants.REMOTE_CSE_ID);
RemoteCSEEntity remoteCseEntity = new RemoteCSEEntity();
remoteCseEntity.setCreationTime(DateUtil.now());
remoteCseEntity.setLastModifiedTime(DateUtil.now());
remoteCseEntity.setParentID("/" + Constants.CSE_ID);
DBService dbs = PersistenceService.getInstance().getDbService();
DBTransaction transaction = dbs.getDbTransaction();
transaction.open();
remoteCseEntity.getAccessControlPolicies()
.add(dbs.getDAOFactory().getAccessControlPolicyDAO().find(transaction, acpAdminId));
remoteCseEntity.setResourceType(BigInteger.valueOf(ResourceType.REMOTE_CSE));
remoteCseEntity.setHierarchicalURI(
"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + Constants.REMOTE_CSE_NAME);
String generatedId = Controller.generateId("", "");
remoteCseEntity.setResourceID(
"/" + Constants.CSE_ID + "/" + ShortName.REMOTE_CSE + Constants.PREFIX_SEPERATOR + generatedId);
remoteCseEntity.setName(Constants.REMOTE_CSE_NAME);
UriMapper.addNewUri(remoteCseEntity.getHierarchicalURI(), remoteCseEntity.getResourceID(),
ResourceType.REMOTE_CSE);
remoteCseEntity.setRemoteCseId("/" + Constants.REMOTE_CSE_ID);
remoteCseEntity.setRemoteCseUri("//" + Constants.M2M_SP_ID + remoteCseEntity.getRemoteCseId());
String poa = "http://" + Constants.REMOTE_CSE_IP + ":" + Constants.REMOTE_CSE_PORT
+ Constants.REMOTE_CSE_CONTEXT;
if (Constants.REMOTE_CSE_CONTEXT.length() > 1) {
poa += "/";
}
remoteCseEntity.getPointOfAccess().add(poa);
remoteCseEntity.setRequestReachability(true);
CSEBaseEntity cseBase = dbs.getDAOFactory().getCSEBaseDAO().find(transaction, "/" + Constants.CSE_ID);
cseBase.getRemoteCses().add(remoteCseEntity);
dbs.getDAOFactory().getCSEBaseDAO().update(transaction, cseBase);
dbs.getDAOFactory().getRemoteCSEDAO().create(transaction, remoteCseEntity);
transaction.commit();
transaction.close();
RemoteCseService.getInstance().addRemoteCseAndPublish(remoteCseEntity);
}
private static void deleteRegistration() {
// send DELETE request the Registrar CSE
unregisterCse();
synchronized (MUTEX) {
currentRegistrationToIn = null;
}
// make sure no remoteCse in database
DBService dbs = PersistenceService.getInstance().getDbService();
DBTransaction transaction = dbs.getDbTransaction();
transaction.open();
RemoteCSEEntity remoteCse = dbs.getDAOFactory().getRemoteCSEbyCseIdDAO().find(transaction,
"/" + Constants.REMOTE_CSE_ID);
if (remoteCse != null) {
// remove RemoteCSE from database
dbs.getDAOFactory().getRemoteCSEDAO().delete(transaction, remoteCse);
UriMapper.deleteUri("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + Constants.REMOTE_CSE_NAME);
LOGGER.info("remove remoteCSE from database");
// notify RemoteCseService
RemoteCseService.getInstance().removeRemoteCseAndPublish(remoteCse.getName());
} else {
LOGGER.warn("No remoteCSE to remove from database");
}
transaction.commit();
transaction.close();
}
/**
* Creates a default {@link AccessControlPolicy} resource in DataBase.
*/
private static void initACP() {
AccessControlPolicyEntity acp = new AccessControlPolicyEntity();
acp.setParentID("/" + Constants.CSE_ID);
acp.setCreationTime(DateUtil.now());
acp.setLastModifiedTime(DateUtil.now());
acp.setResourceID(
"/" + Constants.CSE_ID + "/" + ShortName.ACP + Constants.PREFIX_SEPERATOR + Controller.generateId());
acp.setName(Constants.ADMIN_PROFILE_ID);
acp.setResourceType(BigInteger.valueOf(ResourceType.ACCESS_CONTROL_POLICY));
acp.setHierarchicalURI("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + acp.getName());
acp.setResourceType(ResourceType.ACCESS_CONTROL_POLICY);
UriMapper.addNewUri(acp.getHierarchicalURI(), acp.getResourceID(), ResourceType.ACCESS_CONTROL_POLICY);
// Self-privileges - all rights for admin
AccessControlRuleEntity ruleEntity = new AccessControlRuleEntity();
AccessControlOriginatorEntity originatorEntity = new AccessControlOriginatorEntity(
Constants.ADMIN_REQUESTING_ENTITY);
ruleEntity.getAccessControlOriginators().add(originatorEntity);
ruleEntity.setCreate(true);
ruleEntity.setRetrieve(true);
ruleEntity.setUpdate(true);
ruleEntity.setDelete(true);
ruleEntity.setNotify(true);
ruleEntity.setDiscovery(true);
acp.getSelfPrivileges().add(ruleEntity);
// Privileges - all rights for admin
ruleEntity = new AccessControlRuleEntity();
ruleEntity.setCreate(true);
ruleEntity.setRetrieve(true);
ruleEntity.setUpdate(true);
ruleEntity.setDelete(true);
ruleEntity.setNotify(true);
ruleEntity.setDiscovery(true);
ruleEntity.getAccessControlOriginators()
.add(new AccessControlOriginatorEntity(Constants.ADMIN_REQUESTING_ENTITY));
ruleEntity.getAccessControlOriginators().add(new AccessControlOriginatorEntity("/" + Constants.CSE_ID));
acp.getPrivileges().add(ruleEntity);
// privileges for ALL originators (read + discovery)
ruleEntity = new AccessControlRuleEntity();
ruleEntity.setRetrieve(true);
ruleEntity.setDiscovery(true);
ruleEntity.getAccessControlOriginators()
.add(new AccessControlOriginatorEntity(Constants.GUEST_REQUESTING_ENTITY));
acp.getPrivileges().add(ruleEntity);
acpAdminId = acp.getResourceID();
DBService db = PersistenceService.getInstance().getDbService();
DBTransaction transaction = db.getDbTransaction();
transaction.open();
if (db.getDAOFactory().getAccessControlPolicyDAO().find(transaction, acp.getResourceID()) == null) {
db.getDAOFactory().getAccessControlPolicyDAO().create(transaction, acp);
} else {
db.getDAOFactory().getAccessControlPolicyDAO().update(transaction, acp);
}
transaction.commit();
transaction.close();
}
public static void unregisterCse() {
RequestPrimitive request = new RequestPrimitive();
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setOperation(Operation.DELETE);
;
String remotePoa = "http://" + Constants.REMOTE_CSE_IP + ":" + Constants.REMOTE_CSE_PORT + "/~";
;
if (Constants.REMOTE_CSE_CONTEXT.length() > 1) {
remotePoa += "/" + Constants.REMOTE_CSE_CONTEXT;
}
remotePoa += "/" + REMOTE_CSE_ID + "/" + REMOTE_CSE_NAME + "/" + CSE_NAME;
request.setTo(remotePoa);
request.setResultContent(ResultContent.NOTHING);
LOGGER.info("Sending unregistration request");
ResponsePrimitive response = RestClient.sendRequest(request);
LOGGER.info("Unregistration response:\n" + response);
}
private static void checkPeriodicallyCSERegistration() {
scheduler.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
LOGGER.info("check CSE registration");
RemoteCSE registration = null;
synchronized (MUTEX) {
registration = currentRegistrationToIn;
}
if (registration != null) {
RemoteCSE remoteCSEFromIN = retrieveCSERegistration();
if (!compareRemoteCSE(registration, remoteCSEFromIN)) {
// relaunch registration procedure
deleteRegistration();
registerCSE();
} else {
LOGGER.info("registration is good");
}
} else {
LOGGER.info("registration is null --> registration process on going");
}
}
}, 3, 3, TimeUnit.MINUTES);
}
protected static boolean compareRemoteCSE(RemoteCSE registration, RemoteCSE remoteCSEFromIN) {
if (remoteCSEFromIN == null) {
LOGGER.info("compareRemoteCSE() - remoteCSEFromIN is null");
return false;
}
// check only resource id
if (!remoteCSEFromIN.getResourceID().equals(registration.getResourceID())) {
LOGGER.info("compareRemoteCSE() - remoteCSEFromIN.resourceID(" + remoteCSEFromIN.getResourceID()
+ ")!=registration.resourceID(" + registration.getResourceID() + ")");
return false;
}
return true;
}
protected static RemoteCSE retrieveCSERegistration() {
String contentFormat = System.getProperty("org.eclipse.om2m.registration.contentFormat", MimeMediaType.XML);
try {
RequestPrimitive request = new RequestPrimitive();
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setOperation(Operation.RETRIEVE);
;
String remotePoa = "http://" + Constants.REMOTE_CSE_IP + ":" + Constants.REMOTE_CSE_PORT + "/~";
;
if (Constants.REMOTE_CSE_CONTEXT.length() > 1) {
remotePoa += "/" + Constants.REMOTE_CSE_CONTEXT;
}
remotePoa += "/" + Constants.REMOTE_CSE_ID + "/" + Constants.REMOTE_CSE_NAME + "/" + Constants.CSE_NAME;
request.setTo(remotePoa);
request.setResultContent(ResultContent.ATTRIBUTES);
request.setReturnContentType(contentFormat);
ResponsePrimitive response = RestClient.sendRequest(request);
if (ResponseStatusCode.OK.equals(response.getResponseStatusCode())) {
return (RemoteCSE) DataMapperSelector.getDataMapperList().get(contentFormat)
.stringToObj((String) response.getContent());
}
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
|
[
"hongdatchy@gmail.com"
] |
hongdatchy@gmail.com
|
3603046062beeffa5cd7ea4af735c8669fc97000
|
87fb5f0d88b55573abc916289e5353f3a145b850
|
/g201401_client/proj.android/src/org/cocos2dx/lib/Cocos2dxFakeActivity.java
|
b1cc0a9ce11fb9ec7222cd965b1b856553769224
|
[] |
no_license
|
balder2046/lyzr
|
566f83a2373c4e611c16cbeade223a511b561a99
|
e23bcf44e7cd9938a05748e08c1370ad125c1cb6
|
refs/heads/master
| 2021-01-22T07:39:19.916637
| 2017-02-13T14:31:48
| 2017-02-13T14:31:48
| 81,837,922
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,072
|
java
|
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
package org.cocos2dx.lib;
import org.cocos2dx.lib.Cocos2dxHelper.Cocos2dxHelperListener;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.view.ViewGroup;
import android.util.Log;
import android.widget.FrameLayout;
import android.view.View;
import android.view.Gravity;
public abstract class Cocos2dxFakeActivity implements Cocos2dxHelperListener {
// ===========================================================
// Constants
// ===========================================================
private static final String TAG = Cocos2dxFakeActivity.class.getSimpleName();
// ===========================================================
// Fields
// ===========================================================
private Cocos2dxGLSurfaceView mGLSurfaceView;
private Cocos2dxHandler mHandler;
private static Activity sContext = null;
private static View sContentView = null;
public static int mScreenDir = 0;
public static Activity getContext() {
return sContext;
}
public static View getContentView() {
return sContentView;
}
// ===========================================================
// Constructors
// ===========================================================
protected void onCreate(final Activity content, final Bundle savedInstanceState) {
sContext = content;
this.mHandler = new Cocos2dxHandler(content);
this.init();
Cocos2dxHelper.init(content, this);
}
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
private static native void nativeOnDeviceOrientationChanged(final int dir);
public static native void nativeOnScreenOffsetChanged(final int offset);
protected void onConfigurationChanged(Configuration config) {
Log.v(TAG, "the onConfigurationChanged");
mScreenDir = sContext.getWindowManager().getDefaultDisplay().getRotation();
Cocos2dxFakeActivity.nativeOnDeviceOrientationChanged(mScreenDir);
}
protected void onResume() {
Cocos2dxHelper.onResume();
this.mGLSurfaceView.onResume();
}
protected void onPause() {
Cocos2dxHelper.onPause();
this.mGLSurfaceView.onPause();
}
protected void onDestroy() {
Cocos2dxHelper.onDestroy();
}
@Override
public void showDialog(final String pTitle, final String pMessage) {
Message msg = new Message();
msg.what = Cocos2dxHandler.HANDLER_SHOW_DIALOG;
msg.obj = new Cocos2dxHandler.DialogMessage(pTitle, pMessage);
this.mHandler.sendMessage(msg);
}
@Override
public void showEditTextDialog(final String pTitle, final String pContent, final int pInputMode, final int pInputFlag, final int pReturnType, final int pMaxLength) {
Message msg = new Message();
msg.what = Cocos2dxHandler.HANDLER_SHOW_EDITBOX_DIALOG;
msg.obj = new Cocos2dxHandler.EditBoxMessage(pTitle, pContent, pInputMode, pInputFlag, pReturnType, pMaxLength);
this.mHandler.sendMessage(msg);
}
@Override
public void runOnGLThread(final Runnable pRunnable) {
this.mGLSurfaceView.queueEvent(pRunnable);
}
// ===========================================================
// Methods
// ===========================================================
public void init() {
// FrameLayout
ViewGroup.LayoutParams framelayout_params =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
FrameLayout framelayout = new FrameLayout(sContext);
framelayout.setLayoutParams(framelayout_params);
// Cocos2dxEditText layout
FrameLayout.LayoutParams edittext_layout_params =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
Cocos2dxEditText edittext = new Cocos2dxEditText(sContext);
edittext_layout_params.gravity = Gravity.BOTTOM;
edittext.setLayoutParams(edittext_layout_params);
// ...add to FrameLayout
framelayout.addView(edittext);
// Cocos2dxGLSurfaceView
this.mGLSurfaceView = this.onCreateView();
// ...add to FrameLayout
framelayout.addView(this.mGLSurfaceView);
// Switch to supported OpenGL (ARGB888) mode on emulator
if (isAndroidEmulator())
this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);
mScreenDir = sContext.getWindowManager().getDefaultDisplay().getRotation();
this.mGLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());
this.mGLSurfaceView.setCocos2dxEditText(edittext);
// Set framelayout as the content view
sContext.setContentView(framelayout);
sContentView = framelayout;
}
protected Cocos2dxGLSurfaceView onCreateView() {
return new Cocos2dxGLSurfaceView(sContext);
}
private final static boolean isAndroidEmulator() {
String model = Build.MODEL;
Log.d(TAG, "model=" + model);
String product = Build.PRODUCT;
Log.d(TAG, "product=" + product);
boolean isEmulator = false;
if (product != null) {
isEmulator = product.equals("sdk") || product.contains("_sdk") || product.contains("sdk_");
}
Log.d(TAG, "isEmulator=" + isEmulator);
return isEmulator;
}
public void queueEventGLView( Runnable event ) {
mGLSurfaceView.queueEvent( event );
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
|
[
"void1981@gmail.com"
] |
void1981@gmail.com
|
12678cf5ad3a0f6626936f1258cdf41e65270386
|
c363ef9aabcd580ea8f8931e1932cd439f5a8ea7
|
/backend/src/com/turbomeme/datastorage/Connection.java
|
5b29ea35bcdedb45e8b56cadb9669f745ca765aa
|
[] |
no_license
|
kleitz/turbomeme
|
df175533206b39fcfe40167c141f8c3eac4e3e15
|
9e4a361875613f5e8fdcae8ed68b3d6a2f732cc4
|
refs/heads/master
| 2020-12-11T05:54:38.074741
| 2016-03-05T15:25:50
| 2016-03-05T15:25:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 636
|
java
|
package com.turbomeme.datastorage;
import org.javalite.activejdbc.Base;
public final class Connection
{
private static final String DB_DRIVER;
private static final String DB_HOST;
private static final String DB_USERNAME;
private static final String DB_PASSWORD;
static
{
DB_DRIVER = "org.postgresql.Driver";
DB_HOST = System.getProperty("turbomemeDbHost");
DB_USERNAME = System.getProperty("turbomemeDbUsername");
DB_PASSWORD = System.getProperty("turbomemeDbPassword");
}
public static void open()
{
Base.open(DB_DRIVER, DB_HOST, DB_USERNAME, DB_PASSWORD);
}
public static void close()
{
Base.close();
}
}
|
[
"tuomas@heaviestmatter.com"
] |
tuomas@heaviestmatter.com
|
e95bbe683f32586543e49d2a84a5ac6c15c8d302
|
a7bba5d9db46582a672de331d0e9e4df03185688
|
/Multithreading/task24/task3608/MVC-8/controller/Controller.java
|
384940f4a978d16d9b86f749d59638b75c39b932
|
[] |
no_license
|
stereozz/javaRushRu
|
a15529d4c30e1152c49e89ed3ae281a5e757e565
|
098f33c61ce5d6a0731c0f64856de5cd8468d237
|
refs/heads/master
| 2021-09-08T05:13:56.264365
| 2018-03-07T12:46:44
| 2018-03-07T12:46:44
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,174
|
java
|
//They asked him, "What then? Are you Elijah?" He said, "I am not." "Are you the prophet?" He answered, "No." (John 1:21)
package com.javarush.task.task36.task3608.controller;
import com.javarush.task.task36.task3608.model.Model;
import com.javarush.task.task36.task3608.model.MainModel;
import com.javarush.task.task36.task3608.view.UsersView;
import com.javarush.task.task36.task3608.view.EditUserView;
public class Controller {
private Model model;
private UsersView usersView;
private EditUserView editUserView;
public void setModel(Model model) {this.model = model;}
public void onShowAllUsers() {
model.loadUsers();
usersView.refresh(model.getModelData());
}
public void setUsersView(UsersView usersView) {this.usersView = usersView;}
public void onShowAllDeletedUsers() {
model.loadDeletedUsers();
usersView.refresh(model.getModelData());
}
public void setEditUserView(EditUserView editUserView) {this.editUserView = editUserView;}
public void onOpenUserEditForm(long userId) {
model.loadUserById(userId);
editUserView.refresh(model.getModelData());
}
public void onUserDelete(long id) {
model.deleteUserById(id);
usersView.refresh(model.getModelData());
}
}
/*
MVC (8)
1. Следуя принципу MVC аналогично реализации предыдущих методов сделай следующее:
напиши логику удаления пользователя. После удаления должен отображаться список пользователей.
Распредели методы по классам MVC, используя следующие сигнатуры публичных методов:
void fireEventUserDeleted(long id)
void onUserDelete(long id)
void deleteUserById(long id)
Примечание: метод, который ты собираешься добавить в Вью нужно добавить в EditUserView.
2. Добавь в main вызов fireEventUserDeleted(124L) перед вызовом метода fireEventShowDeletedUsers().
3. Выполни рефакторинг класса MainModel. Теперь, когда есть удаленные пользователи, часть методов стала работать неправильно.
Почти во всех методах, где требуется список пользователей, нужно работать только с активными(живыми) пользователями.
Вынеси в отдельный приватный метод List<User> getAllUsers() получение списка всех активных пользователей.
Фильтрация активных пользователей у тебя уже есть — метод List<User> filterOnlyActiveUsers(List<User> allUsers).
Отрефактори все методы, которые используют список пользователей. Они должны использовать список живых пользователей.
4. Добавь в интерфейс Model метод, который ты поместил в Модель, реализуй его в FakeModel: выброси UnsupportedOperationException.
Требования:
1. Необходимо определить правильное расположение метода fireEventUserDeleted(long) и реализовать этот метод.
2. Необходимо определить правильное расположение метода onUserDelete(long) и реализовать этот метод.
3. Необходимо определить правильное расположение метода deleteUserById(long) и реализовать этот метод.
4. В методе main класса Solution необходимо вызвать метод fireEventUserDeleted(124L) у объекта класса EditUserView перед вызовом метода fireEventShowDeletedUsers().
5. В методе main вызов методов должен происходить в такой последовательности: fireEventShowAllUsers(), fireEventOpenUserEditForm(126L), fireEventUserDeleted(124L), fireEventShowDeletedUsers().
6. Необходимо реализовать приватный метод List getAllUsers() в классе MainModel.
7. Необходимо выполнить рефакторинг: все методы класса MainModel, которые используют список пользователей, должны использовать список живых пользователей.
8. Интерфейс Model должен содержать объявление метода, который ты ранее реализовал в классе MainModel.
9. В классе FakeModel в теле метода, помещенного в интерфейс Model, необходимо бросить UnsupportedOperationException.
*/
|
[
"noreply@github.com"
] |
noreply@github.com
|
aea393208c59e97fdb460e7c475cb0d21f911918
|
d26d63928203286a3d096a5075104b8393846c62
|
/java/aulas/src/projetofinal/Pessoa.java
|
bd6c6bc9213a9cbabb9f997a7d04198ab0b29276
|
[] |
no_license
|
beymarjhoel/turma-14
|
f1c05dfab55551a622e111c197d72034d8162d65
|
75470550eaabbb2d96e330a439d9176602e8fe35
|
refs/heads/main
| 2023-02-25T05:00:46.207133
| 2021-01-22T02:43:06
| 2021-01-22T02:43:06
| 315,410,572
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 49
|
java
|
package projetofinal;
public class Pessoa {
}
|
[
"beymarjhlima@gmail.com"
] |
beymarjhlima@gmail.com
|
0b0d80a64a68b6c3aa760ca34b0c17a24988f9ac
|
0735d7bb62b6cfb538985a278b77917685de3526
|
/kotlin/reflect/jvm/internal/impl/resolve/calls/inference/CapturedType.java
|
cbd615c3deac6bcbc9ca40175eeb0b95960a1f37
|
[] |
no_license
|
Denoah/personaltrackerround
|
e18ceaad910f1393f2dd9f21e9055148cda57837
|
b38493ccc7efff32c3de8fe61704e767e5ac62b7
|
refs/heads/master
| 2021-05-20T03:34:17.333532
| 2020-04-02T14:47:31
| 2020-04-02T14:51:01
| 252,166,069
| 0
| 0
| null | null | null | null |
WINDOWS-1252
|
Java
| false
| false
| 5,110
|
java
|
package kotlin.reflect.jvm.internal.impl.resolve.calls.inference;
import java.util.List;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.reflect.jvm.internal.impl.builtins.KotlinBuiltIns;
import kotlin.reflect.jvm.internal.impl.descriptors.annotations.Annotations;
import kotlin.reflect.jvm.internal.impl.resolve.scopes.MemberScope;
import kotlin.reflect.jvm.internal.impl.types.ErrorUtils;
import kotlin.reflect.jvm.internal.impl.types.KotlinType;
import kotlin.reflect.jvm.internal.impl.types.SimpleType;
import kotlin.reflect.jvm.internal.impl.types.SubtypingRepresentatives;
import kotlin.reflect.jvm.internal.impl.types.TypeProjection;
import kotlin.reflect.jvm.internal.impl.types.Variance;
import kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner;
import kotlin.reflect.jvm.internal.impl.types.model.CapturedTypeMarker;
import kotlin.reflect.jvm.internal.impl.types.typeUtil.TypeUtilsKt;
public final class CapturedType
extends SimpleType
implements SubtypingRepresentatives, CapturedTypeMarker
{
private final Annotations annotations;
private final CapturedTypeConstructor constructor;
private final boolean isMarkedNullable;
private final TypeProjection typeProjection;
public CapturedType(TypeProjection paramTypeProjection, CapturedTypeConstructor paramCapturedTypeConstructor, boolean paramBoolean, Annotations paramAnnotations)
{
this.typeProjection = paramTypeProjection;
this.constructor = paramCapturedTypeConstructor;
this.isMarkedNullable = paramBoolean;
this.annotations = paramAnnotations;
}
private final KotlinType representative(Variance paramVariance, KotlinType paramKotlinType)
{
if (this.typeProjection.getProjectionKind() == paramVariance) {
paramKotlinType = this.typeProjection.getType();
}
Intrinsics.checkExpressionValueIsNotNull(paramKotlinType, "if (typeProjection.proje…jection.type else default");
return paramKotlinType;
}
public Annotations getAnnotations()
{
return this.annotations;
}
public List<TypeProjection> getArguments()
{
return CollectionsKt.emptyList();
}
public CapturedTypeConstructor getConstructor()
{
return this.constructor;
}
public MemberScope getMemberScope()
{
MemberScope localMemberScope = ErrorUtils.createErrorScope("No member resolution should be done on captured type, it used only during constraint system resolution", true);
Intrinsics.checkExpressionValueIsNotNull(localMemberScope, "ErrorUtils.createErrorSc…solution\", true\n )");
return localMemberScope;
}
public KotlinType getSubTypeRepresentative()
{
Variance localVariance = Variance.OUT_VARIANCE;
SimpleType localSimpleType = TypeUtilsKt.getBuiltIns(this).getNullableAnyType();
Intrinsics.checkExpressionValueIsNotNull(localSimpleType, "builtIns.nullableAnyType");
return representative(localVariance, (KotlinType)localSimpleType);
}
public KotlinType getSuperTypeRepresentative()
{
Variance localVariance = Variance.IN_VARIANCE;
SimpleType localSimpleType = TypeUtilsKt.getBuiltIns(this).getNothingType();
Intrinsics.checkExpressionValueIsNotNull(localSimpleType, "builtIns.nothingType");
return representative(localVariance, (KotlinType)localSimpleType);
}
public boolean isMarkedNullable()
{
return this.isMarkedNullable;
}
public CapturedType makeNullableAsSpecified(boolean paramBoolean)
{
if (paramBoolean == isMarkedNullable()) {
return this;
}
return new CapturedType(this.typeProjection, getConstructor(), paramBoolean, getAnnotations());
}
public CapturedType refine(KotlinTypeRefiner paramKotlinTypeRefiner)
{
Intrinsics.checkParameterIsNotNull(paramKotlinTypeRefiner, "kotlinTypeRefiner");
paramKotlinTypeRefiner = this.typeProjection.refine(paramKotlinTypeRefiner);
Intrinsics.checkExpressionValueIsNotNull(paramKotlinTypeRefiner, "typeProjection.refine(kotlinTypeRefiner)");
return new CapturedType(paramKotlinTypeRefiner, getConstructor(), isMarkedNullable(), getAnnotations());
}
public CapturedType replaceAnnotations(Annotations paramAnnotations)
{
Intrinsics.checkParameterIsNotNull(paramAnnotations, "newAnnotations");
return new CapturedType(this.typeProjection, getConstructor(), isMarkedNullable(), paramAnnotations);
}
public boolean sameTypeConstructor(KotlinType paramKotlinType)
{
Intrinsics.checkParameterIsNotNull(paramKotlinType, "type");
boolean bool;
if (getConstructor() == paramKotlinType.getConstructor()) {
bool = true;
} else {
bool = false;
}
return bool;
}
public String toString()
{
StringBuilder localStringBuilder = new StringBuilder();
localStringBuilder.append("Captured(");
localStringBuilder.append(this.typeProjection);
localStringBuilder.append(')');
String str;
if (isMarkedNullable()) {
str = "?";
} else {
str = "";
}
localStringBuilder.append(str);
return localStringBuilder.toString();
}
}
|
[
"ivanov.a@i-teco.ru"
] |
ivanov.a@i-teco.ru
|
bc95e3725e0339240224cec111829734ad2ae0fb
|
74262b13f8229ff1572978e42c3cac096c5c698d
|
/build/generated/src/org/apache/jsp/Vista/convenios_jsp.java
|
876fb25425156de4f1efd684a958cf99afe0571e
|
[] |
no_license
|
javidu/Convenios
|
f15ea838bcf349116374a82d57aac64950f82abc
|
c58553695873cbe44c9c474bc01e8a4994aea40c
|
refs/heads/master
| 2020-05-21T10:14:54.058117
| 2016-10-06T08:04:29
| 2016-10-06T08:04:29
| 69,545,610
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,722
|
java
|
package org.apache.jsp.Vista;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class convenios_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write(" <head>\n");
out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
out.write(" <title>JSP Page</title>\n");
out.write(" </head>\n");
out.write(" <body> \n");
out.write(" <header>\n");
out.write(" <center> <img id=\"banner\" src=\"../Vista/img/Banner-superior.png\" alt=\"imagen\" height=\"100px\" width=\"100%\" ></img></center>\n");
out.write(" </header> \n");
out.write(" \n");
out.write(" <div class=\"ufps-navbar ufps-container \" id=\"menu\" >\n");
out.write(" <div class=\"ufps-container-fluid\">\n");
out.write(" <div class=\"ufps-navbar-brand\">\n");
out.write(" <div class=\"ufps-btn-menu\" onclick=\"toggleMenu('menu')\">\n");
out.write(" <div class=\"ufps-btn-menu-bar\"> </div>\n");
out.write(" <div class=\"ufps-btn-menu-bar\"> </div>\n");
out.write(" <div class=\"ufps-btn-menu-bar\"> </div>\n");
out.write(" </div>\n");
out.write("\n");
out.write(" </div>\n");
out.write(" <div class=\"ufps-navbar-left nav\">\n");
out.write("\n");
out.write(" <li><a href=\"\" class=\" ufps-navbar-btn \" >Home </a></li>\n");
out.write(" <li><a href=\"\" class=\"ufps-navbar-btn \" >Convenios </a></li>\n");
out.write(" <li><a href=\"\" class=\"ufps-navbar-btn \" >Actividades </a></li>\n");
out.write("\n");
out.write("\n");
out.write(" </li>\n");
out.write(" </div>\n");
out.write(" <div class=\"ufps-navbar-right nav\">\n");
out.write(" <li> <a href=\"\" class=\"ufps-navbar-btn \">Iniciar Sesión </a></li>\n");
out.write("\n");
out.write(" </div>\n");
out.write("\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" \n");
out.write(" <div class=\"ufps-container ufps-footer \">\n");
out.write(" <h5>Universidad Francisco de Paula Santander</h5>\n");
out.write(" <h6>Programa Ingeniería de Sistemas<br>\n");
out.write(" Desarrollador por: Francisco Javier Duarte García - Heiner Enrique Villamizar Molina</h6>\n");
out.write(" </div> \n");
out.write(" </body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
|
[
"javinovich_12@hotmail.com"
] |
javinovich_12@hotmail.com
|
e12ceee7fbe239879843bfe5537d071b2519b961
|
6fb054a6a340ca4b420f28e742856c5a8179bb69
|
/app/src/main/java/com/ucfo/youcaiwx/UmengPushIntentService.java
|
3e55c23ecca01212b9b928d1416f4e272eaf9136
|
[] |
no_license
|
Androidzh-cpu/youcaiwx_android
|
caa142dd741efa3551c41df331b85147a98fec16
|
1ae86b200ea3ca3aae6728e82291a478e1c204bc
|
refs/heads/master
| 2022-08-06T01:12:56.779185
| 2020-05-21T02:21:15
| 2020-05-21T02:21:15
| 266,709,033
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,844
|
java
|
package com.ucfo.youcaiwx;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.ucfo.youcaiwx.common.Constant;
import com.ucfo.youcaiwx.module.login.LoginActivity;
import com.ucfo.youcaiwx.utils.LogUtils;
import com.umeng.message.UTrack;
import com.umeng.message.UmengMessageService;
import com.umeng.message.entity.UMessage;
import org.android.agoo.common.AgooConstants;
import org.json.JSONObject;
import java.util.Map;
/**
* Author: AND
* Time: 2019-8-11. 下午 2:00
* FileName: UmengPushIntentService
* Description:友盟消息自定义处理
*/
public class UmengPushIntentService extends UmengMessageService {
private String messageType = "";
private Map<String, String> extra = null;
public UmengPushIntentService() {
}
@Override
public void onMessage(Context context, Intent intent) {
try {
String message = intent.getStringExtra(AgooConstants.MESSAGE_BODY);
UMessage msg = new UMessage(new JSONObject(message));
LogUtils.e("Umeng:--------------onMessage:" + message);
Intent intentAct = new Intent();
if (msg != null) {
extra = msg.extra;
}
if (extra != null) {
messageType = extra.get(Constant.TYPE);
if (TextUtils.equals(messageType, Constant.UMENG_MESSAGE_FORCE)) {
intentAct.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intentAct.setClass(context, LoginActivity.class);
startActivity(intentAct);
}
}
UTrack.getInstance(getApplicationContext()).trackMsgClick(msg);
} catch (Exception e) {
LogUtils.e("UmengPushIntentService----------Exception: " + e.getMessage());
}
}
}
|
[
"34635313+Devil-AND@users.noreply.github.com"
] |
34635313+Devil-AND@users.noreply.github.com
|
a19e99a8625bf8f0ec2fd86a193a5c21ae2a0353
|
9208ba403c8902b1374444a895ef2438a029ed5c
|
/sources/com/kantv/ui/androidupnpdemo/service/ClingUpnpService.java
|
e26a35dcd0bf376cfd405978b278a6a0bf3597c7
|
[] |
no_license
|
MewX/kantv-decompiled-v3.1.2
|
3e68b7046cebd8810e4f852601b1ee6a60d050a8
|
d70dfaedf66cdde267d99ad22d0089505a355aa1
|
refs/heads/main
| 2023-02-27T05:32:32.517948
| 2021-02-02T13:38:05
| 2021-02-02T13:44:31
| 335,299,807
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,881
|
java
|
package com.kantv.ui.androidupnpdemo.service;
import android.content.Intent;
import android.os.IBinder;
import org.fourthline.cling.UpnpService;
import org.fourthline.cling.UpnpServiceConfiguration;
import org.fourthline.cling.android.AndroidUpnpServiceImpl;
import org.fourthline.cling.controlpoint.ControlPoint;
import org.fourthline.cling.model.meta.LocalDevice;
import org.fourthline.cling.registry.Registry;
public class ClingUpnpService extends AndroidUpnpServiceImpl {
private LocalDevice mLocalDevice = null;
public class LocalBinder extends Binder {
public LocalBinder() {
super();
}
public /* bridge */ /* synthetic */ UpnpService get() {
return super.get();
}
public /* bridge */ /* synthetic */ UpnpServiceConfiguration getConfiguration() {
return super.getConfiguration();
}
public /* bridge */ /* synthetic */ ControlPoint getControlPoint() {
return super.getControlPoint();
}
public /* bridge */ /* synthetic */ Registry getRegistry() {
return super.getRegistry();
}
public ClingUpnpService getService() {
return ClingUpnpService.this;
}
}
public void onCreate() {
super.onCreate();
this.binder = new LocalBinder();
}
public void onDestroy() {
super.onDestroy();
}
public IBinder onBind(Intent intent) {
return this.binder;
}
public LocalDevice getLocalDevice() {
return this.mLocalDevice;
}
public UpnpServiceConfiguration getConfiguration() {
return this.upnpService.getConfiguration();
}
public Registry getRegistry() {
return this.upnpService.getRegistry();
}
public ControlPoint getControlPoint() {
return this.upnpService.getControlPoint();
}
}
|
[
"xiayuanzhong@gmail.com"
] |
xiayuanzhong@gmail.com
|
bd51a7d2a478cc5f120199fba53cee1d37fe5920
|
c5530fbf8c6e8bb4ad82dca2cf4136f411becd98
|
/src/main/java/cn/maxlu/demo/spring/aop/springinterface/Main.java
|
89c7e13be4ceaba441474f09e7229d76e24efa72
|
[] |
no_license
|
Max-lu/spring-demo
|
85b6bd0cc1a8617da7110bcf4ac2e396d265532a
|
43ac1b6896794e87717f2db8f3f0dd13316ffdb4
|
refs/heads/master
| 2020-03-26T16:28:21.169023
| 2018-08-17T10:06:56
| 2018-08-17T10:06:56
| 145,104,028
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 446
|
java
|
package cn.maxlu.demo.spring.aop.springinterface;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:aop-beans2.xml");
DemoService demoService = ctx.getBean(DemoService.class);
demoService.echo();
}
}
|
[
"luwei@luwei.com"
] |
luwei@luwei.com
|
baaf1e3cfa0fb173550773c3e4a2cf642e4e3d0a
|
4401bcfe8e2661942dd882f35b3596b3c27b6a6f
|
/src/pokladna/DataLoader.java
|
45b24442cf6a2b59d18288068fa94bc5db9c298b
|
[] |
no_license
|
kubasi3/pokladnaPad
|
f3381cd5bb598d3d81c60ddddf2f982c9ae5b372
|
c9f8b290ad444c55eafe070bed9b60f6685f2f91
|
refs/heads/master
| 2020-08-05T23:15:40.250302
| 2019-11-22T06:21:36
| 2019-11-22T06:21:36
| 212,750,679
| 0
| 0
| null | 2019-10-04T06:34:02
| 2019-10-04T06:34:01
| null |
UTF-8
|
Java
| false
| false
| 4,840
|
java
|
package pokladna;
import java.util.ArrayList;
//load data from "fake" database :)
public class DataLoader {
private static ArrayList<Item> creatItems() {
ArrayList<Item> items = new ArrayList<>();
Ticket item = new Ticket("Listek", 20, 30, "student");
Ticket item1 = new Ticket("Listek", 60, 30, "dospeli");
Ticket item2 = new Ticket("Listek", 150, 15, "rodinné");
Ticket item3 = new Ticket("Listek", 30, 30, "senior");
items.add(item);
items.add(item1);
items.add(item2);
items.add(item3);
Candys item4 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item5 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item6 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item4);
items.add(item5);
items.add(item6);
Candys item7 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item8 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item9 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item7);
items.add(item8);
items.add(item9);
Candys item41 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item51= new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item61 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item41);
items.add(item51);
items.add(item61);
Candys item42 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item52 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item62 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item42);
items.add(item52);
items.add(item62);
Candys item43 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item53 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item63 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item43);
items.add(item53);
items.add(item63);
Candys item44 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item54 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item64 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item44);
items.add(item54);
items.add(item64);
Candys item45 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item55 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item65 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item45);
items.add(item55);
items.add(item65);
Candys item46 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item56 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item66 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item46);
items.add(item56);
items.add(item66);
Candys item47 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item57 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item67 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item47);
items.add(item57);
items.add(item67);
Candys item48 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item58 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item68 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item48);
items.add(item58);
items.add(item68);
Candys item49 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item59 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item69 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item49);
items.add(item59);
items.add(item69);
Candys item40 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item50 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item60 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item40);
items.add(item50);
items.add(item60);
Candys item401 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item501 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item601 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item401);
items.add(item501);
items.add(item601);
Candys item402 = new Candys("Mars", 30, 30, "coko_tyčinka");
Candys item502 = new Candys("Bebe-cosi", 10, 30, "oplatek");
Candys item602 = new Candys("Bohemia", 150, 15, "brambůrky");
items.add(item402);
items.add(item502);
items.add(item602);
System.out.println(items.size());
return items;
}
public static CashRegister creatCashRegister() {
return new CashRegister("POKLADNA-1", 2000,"Kč", creatItems());
}
}
|
[
"hony.com@seznam.cz"
] |
hony.com@seznam.cz
|
13910d9ec849fc8aab183375a43d529dc64db5c9
|
ccea60747728d8fe127bf18897507d0080caac32
|
/spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/discovery/EurekaServiceInstanceConverter.java
|
4cb76534785e27ee14f6579a36dda57bf9bfdf43
|
[
"Apache-2.0"
] |
permissive
|
youjava/spring-boot-admin
|
c55d771407c93ede5a2b212ad92f7943d19ae0f2
|
1de7d9d3657a7a9cde0b43b36de6f9d0c050038f
|
refs/heads/master
| 2021-01-17T22:05:41.756695
| 2016-06-06T04:20:03
| 2016-06-06T04:20:03
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,172
|
java
|
/*
* Copyright 2014 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 de.codecentric.boot.admin.discovery;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient.EurekaServiceInstance;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import com.netflix.appinfo.InstanceInfo;
import de.codecentric.boot.admin.model.Application;
/**
* Converts {@link EurekaServiceInstance}s to {@link Application}s
*
* @author Johannes Edmeier
*/
public class EurekaServiceInstanceConverter implements ServiceInstanceConverter {
@Override
public Application convert(ServiceInstance instance) {
Assert.isInstanceOf(EurekaServiceInstance.class, instance,
"serviceInstance must be of type EurekaServiceInstance");
return convert(((EurekaServiceInstance) instance).getInstanceInfo());
}
private Application convert(InstanceInfo instanceInfo) {
String mgmtUrl = instanceInfo.getHomePageUrl();
String mgmtPath = instanceInfo.getMetadata().get("management.context-path");
if (StringUtils.hasText(mgmtPath)) {
mgmtUrl = append(mgmtUrl, mgmtPath);
}
return Application.create(instanceInfo.getAppName())
.withHealthUrl(instanceInfo.getHealthCheckUrl()).withManagementUrl(mgmtUrl)
.withServiceUrl(instanceInfo.getHomePageUrl()).build();
}
private String append(String mgmtUrl, String mgmtPath) {
if (mgmtUrl.endsWith("/")) {
mgmtUrl = mgmtUrl.substring(0, mgmtUrl.length() - 1);
}
if (!mgmtPath.startsWith("/")) {
mgmtPath = "/" + mgmtPath;
}
return mgmtUrl + mgmtPath;
}
}
|
[
"johannes.edmeier@gmail.com"
] |
johannes.edmeier@gmail.com
|
0e6bba0c64daf0bcc7b5197c3aa505c7f7f72360
|
14f9b8174a53e95cfb9625297aa63b097f9e9b41
|
/exercicies/exercicie8.java
|
10a1efc5131b6930802a343a4e5e4e215d1fa58f
|
[] |
no_license
|
lpeta/Java
|
7c3f237846d87bb586b1058172783788e8face71
|
a9062f7ede4bcee833792d196ce5751962b5c6b4
|
refs/heads/master
| 2021-01-21T13:48:18.266109
| 2016-05-06T19:56:09
| 2016-05-06T19:56:09
| 48,952,170
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 523
|
java
|
"#123456"
"#234567"
nao passa!
"#fkvdvknkk"
"kmckdncn"
"#fff"
"1234567"
"#12345u"
public static boolean isColorValid (String color)
{
if(color.length == 7 && color.charAt(0) == "#")
{
for (int i = 1; i <= 6; i++)
{
if(!isHexadecimal(color.charAt(i)))
{
return false;
}
}
return true;
}
else
{
return false;
}
}
//////////
public void callThing()
{
thing(6);
}
public boolean thing(int thong)
{
if(thong > 5)
{
return true;
}
return false;
}
|
[
"leonardopeta@live.co.uk"
] |
leonardopeta@live.co.uk
|
8f14b7d0621b489632841f769651f3c118e3eaf7
|
71e5c794d60460db1b9f675e11586b53ed72dfea
|
/src/main/java/crane/Result.java
|
c26b9c309fa83cf1cb5f5f7ff8e0035abe33fbc3
|
[] |
no_license
|
snowheat/crane3
|
2403797398b9505746a8b3222aa03f4e5d62980e
|
0f64e75878213d611ac6d5dd7912e90b2fc7ca08
|
refs/heads/master
| 2021-01-11T12:08:49.025050
| 2017-01-05T01:48:53
| 2017-01-05T01:48:53
| 76,528,502
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 738
|
java
|
package crane;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.TreeMap;
/**
* Created by insan on 12/5/2016.
*/
public class Result{
public Result() {
}
public TreeMap<BigDecimal,BigDecimal>
innerVerticalForceNodes,
innerHorizontalForceNodes,
innerBendingMomentNodes,
normalStressNodes,
normalBendingStressNodes,
shearStressNodes,
maxPrincipalStressCZeroNodes,
maxPrincipalStressCMaxNodes
;
public BigDecimal
maxPrincipalStressCMaxValue,
maxPrincipalStressCMaxLocation,
maxPrincipalStressCZeroValue,
maxPrincipalStressCZeroLocation,
safetyFactor;
public Input input;
}
|
[
"insan.air@gmail.com"
] |
insan.air@gmail.com
|
8671826232fb1157754a351b0f3e6466be072784
|
1dd4227092fb1ebca232518eb5de4eecd2aacaba
|
/spring-web/src/main/java/org/springframework/http/client/InterceptingAsyncClientHttpRequest.java
|
3242ae42203bd13128da11dc8e471f4eefa8b931
|
[
"Apache-2.0"
] |
permissive
|
qsk1226/spring-framework
|
65b7dd129722af6d924e0e42cec7faa3e0aaf460
|
77899424e8ce2d37d7a2d21a1d38f4bae39b82d6
|
refs/heads/master
| 2023-03-16T16:02:45.578432
| 2021-03-07T05:07:27
| 2021-03-07T05:07:27
| 271,598,371
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,736
|
java
|
/*
* Copyright 2002-2018 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 org.springframework.http.client;
import java.io.IOException;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRequest;
import org.springframework.util.Assert;
import org.springframework.util.StreamUtils;
import org.springframework.util.concurrent.ListenableFuture;
/**
* An {@link AsyncClientHttpRequest} wrapper that enriches it proceeds the actual
* request execution with calling the registered interceptors.
*
* @author Jakub Narloch
* @author Rossen Stoyanchev
* @see InterceptingAsyncClientHttpRequestFactory
* @deprecated as of Spring 5.0, with no direct replacement
*/
@Deprecated
class InterceptingAsyncClientHttpRequest extends AbstractBufferingAsyncClientHttpRequest {
private AsyncClientHttpRequestFactory requestFactory;
private List<AsyncClientHttpRequestInterceptor> interceptors;
private URI uri;
private HttpMethod httpMethod;
/**
* Create new instance of {@link InterceptingAsyncClientHttpRequest}.
* @param requestFactory the async request factory
* @param interceptors the list of interceptors
* @param uri the request URI
* @param httpMethod the HTTP method
*/
public InterceptingAsyncClientHttpRequest(AsyncClientHttpRequestFactory requestFactory,
List<AsyncClientHttpRequestInterceptor> interceptors, URI uri, HttpMethod httpMethod) {
this.requestFactory = requestFactory;
this.interceptors = interceptors;
this.uri = uri;
this.httpMethod = httpMethod;
}
@Override
protected ListenableFuture<ClientHttpResponse> executeInternal(HttpHeaders headers, byte[] body)
throws IOException {
return new AsyncRequestExecution().executeAsync(this, body);
}
@Override
public HttpMethod getMethod() {
return this.httpMethod;
}
@Override
public String getMethodValue() {
return this.httpMethod.name();
}
@Override
public URI getURI() {
return this.uri;
}
private class AsyncRequestExecution implements AsyncClientHttpRequestExecution {
private Iterator<AsyncClientHttpRequestInterceptor> iterator;
public AsyncRequestExecution() {
this.iterator = interceptors.iterator();
}
@Override
public ListenableFuture<ClientHttpResponse> executeAsync(HttpRequest request, byte[] body)
throws IOException {
if (this.iterator.hasNext()) {
AsyncClientHttpRequestInterceptor interceptor = this.iterator.next();
return interceptor.intercept(request, body, this);
}
else {
URI uri = request.getURI();
HttpMethod method = request.getMethod();
HttpHeaders headers = request.getHeaders();
Assert.state(method != null, "No standard HTTP method");
AsyncClientHttpRequest delegate = requestFactory.createAsyncRequest(uri, method);
delegate.getHeaders().putAll(headers);
if (body.length > 0) {
StreamUtils.copy(body, delegate.getBody());
}
return delegate.executeAsync();
}
}
}
}
|
[
"qinshengkei@taoche.com"
] |
qinshengkei@taoche.com
|
151dfaf29f58eaf035358a9091acafca482416c7
|
1376a927de3a0f955966e200feb161ba91ebd083
|
/docroot/WEB-INF/service/it/bysoftware/ct/service/persistence/TracciabilitaSchedaPersistence.java
|
da7e3ddf35708a6f3eb8d1af27bef5437f4de096
|
[] |
no_license
|
mtorrisi/gestionale-op-portlet
|
2bd1b8ebb27b447c89ea1709e91f36f5d4a2d730
|
9849cdd48c9313c6dc12d0add914514893350d93
|
refs/heads/master
| 2020-04-03T20:55:58.667039
| 2018-07-04T14:14:48
| 2018-07-04T14:14:48
| 35,332,819
| 0
| 0
| null | 2018-07-04T14:14:49
| 2015-05-09T15:04:31
|
Java
|
UTF-8
|
Java
| false
| false
| 23,522
|
java
|
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library 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 2.1 of the License, or (at your option)
* any later version.
*
* This library 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.
*/
package it.bysoftware.ct.service.persistence;
import com.liferay.portal.service.persistence.BasePersistence;
import it.bysoftware.ct.model.TracciabilitaScheda;
/**
* The persistence interface for the tracciabilita scheda service.
*
* <p>
* Caching information and settings can be found in <code>portal.properties</code>
* </p>
*
* @author Brian Wing Shun Chan
* @see TracciabilitaSchedaPersistenceImpl
* @see TracciabilitaSchedaUtil
* @generated
*/
public interface TracciabilitaSchedaPersistence extends BasePersistence<TracciabilitaScheda> {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this interface directly. Always use {@link TracciabilitaSchedaUtil} to access the tracciabilita scheda persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this interface.
*/
/**
* Returns all the tracciabilita schedas where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @return the matching tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public java.util.List<it.bysoftware.ct.model.TracciabilitaScheda> findByAnnoIdAssociatoNDocumento(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns a range of all the tracciabilita schedas where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.bysoftware.ct.model.impl.TracciabilitaSchedaModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param start the lower bound of the range of tracciabilita schedas
* @param end the upper bound of the range of tracciabilita schedas (not inclusive)
* @return the range of matching tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public java.util.List<it.bysoftware.ct.model.TracciabilitaScheda> findByAnnoIdAssociatoNDocumento(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento, int start, int end)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns an ordered range of all the tracciabilita schedas where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.bysoftware.ct.model.impl.TracciabilitaSchedaModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param start the lower bound of the range of tracciabilita schedas
* @param end the upper bound of the range of tracciabilita schedas (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of matching tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public java.util.List<it.bysoftware.ct.model.TracciabilitaScheda> findByAnnoIdAssociatoNDocumento(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento, int start, int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the first tracciabilita scheda in the ordered set where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching tracciabilita scheda
* @throws it.bysoftware.ct.NoSuchTracciabilitaSchedaException if a matching tracciabilita scheda could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda findByAnnoIdAssociatoNDocumento_First(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException,
it.bysoftware.ct.NoSuchTracciabilitaSchedaException;
/**
* Returns the first tracciabilita scheda in the ordered set where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching tracciabilita scheda, or <code>null</code> if a matching tracciabilita scheda could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda fetchByAnnoIdAssociatoNDocumento_First(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the last tracciabilita scheda in the ordered set where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching tracciabilita scheda
* @throws it.bysoftware.ct.NoSuchTracciabilitaSchedaException if a matching tracciabilita scheda could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda findByAnnoIdAssociatoNDocumento_Last(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException,
it.bysoftware.ct.NoSuchTracciabilitaSchedaException;
/**
* Returns the last tracciabilita scheda in the ordered set where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the last matching tracciabilita scheda, or <code>null</code> if a matching tracciabilita scheda could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda fetchByAnnoIdAssociatoNDocumento_Last(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the tracciabilita schedas before and after the current tracciabilita scheda in the ordered set where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* @param id the primary key of the current tracciabilita scheda
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next tracciabilita scheda
* @throws it.bysoftware.ct.NoSuchTracciabilitaSchedaException if a tracciabilita scheda with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda[] findByAnnoIdAssociatoNDocumento_PrevAndNext(
long id, int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException,
it.bysoftware.ct.NoSuchTracciabilitaSchedaException;
/**
* Removes all the tracciabilita schedas where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ? from the database.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @throws SystemException if a system exception occurred
*/
public void removeByAnnoIdAssociatoNDocumento(int anno, long idAssociato,
long numeroDocumento, java.lang.String tipoDocumento)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the number of tracciabilita schedas where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ?.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @return the number of matching tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public int countByAnnoIdAssociatoNDocumento(int anno, long idAssociato,
long numeroDocumento, java.lang.String tipoDocumento)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the tracciabilita scheda where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ? and codiceProdotto = ? or throws a {@link it.bysoftware.ct.NoSuchTracciabilitaSchedaException} if it could not be found.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param codiceProdotto the codice prodotto
* @return the matching tracciabilita scheda
* @throws it.bysoftware.ct.NoSuchTracciabilitaSchedaException if a matching tracciabilita scheda could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda findByAnnoIdAssociatoNDocumentoCodiceProdotto(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento, java.lang.String codiceProdotto)
throws com.liferay.portal.kernel.exception.SystemException,
it.bysoftware.ct.NoSuchTracciabilitaSchedaException;
/**
* Returns the tracciabilita scheda where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ? and codiceProdotto = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param codiceProdotto the codice prodotto
* @return the matching tracciabilita scheda, or <code>null</code> if a matching tracciabilita scheda could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda fetchByAnnoIdAssociatoNDocumentoCodiceProdotto(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento, java.lang.String codiceProdotto)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the tracciabilita scheda where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ? and codiceProdotto = ? or returns <code>null</code> if it could not be found, optionally using the finder cache.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param codiceProdotto the codice prodotto
* @param retrieveFromCache whether to use the finder cache
* @return the matching tracciabilita scheda, or <code>null</code> if a matching tracciabilita scheda could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda fetchByAnnoIdAssociatoNDocumentoCodiceProdotto(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento, java.lang.String codiceProdotto,
boolean retrieveFromCache)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Removes the tracciabilita scheda where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ? and codiceProdotto = ? from the database.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param codiceProdotto the codice prodotto
* @return the tracciabilita scheda that was removed
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda removeByAnnoIdAssociatoNDocumentoCodiceProdotto(
int anno, long idAssociato, long numeroDocumento,
java.lang.String tipoDocumento, java.lang.String codiceProdotto)
throws com.liferay.portal.kernel.exception.SystemException,
it.bysoftware.ct.NoSuchTracciabilitaSchedaException;
/**
* Returns the number of tracciabilita schedas where anno = ? and idAssociato = ? and numeroDocumento = ? and tipoDocumento = ? and codiceProdotto = ?.
*
* @param anno the anno
* @param idAssociato the id associato
* @param numeroDocumento the numero documento
* @param tipoDocumento the tipo documento
* @param codiceProdotto the codice prodotto
* @return the number of matching tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public int countByAnnoIdAssociatoNDocumentoCodiceProdotto(int anno,
long idAssociato, long numeroDocumento, java.lang.String tipoDocumento,
java.lang.String codiceProdotto)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Caches the tracciabilita scheda in the entity cache if it is enabled.
*
* @param tracciabilitaScheda the tracciabilita scheda
*/
public void cacheResult(
it.bysoftware.ct.model.TracciabilitaScheda tracciabilitaScheda);
/**
* Caches the tracciabilita schedas in the entity cache if it is enabled.
*
* @param tracciabilitaSchedas the tracciabilita schedas
*/
public void cacheResult(
java.util.List<it.bysoftware.ct.model.TracciabilitaScheda> tracciabilitaSchedas);
/**
* Creates a new tracciabilita scheda with the primary key. Does not add the tracciabilita scheda to the database.
*
* @param id the primary key for the new tracciabilita scheda
* @return the new tracciabilita scheda
*/
public it.bysoftware.ct.model.TracciabilitaScheda create(long id);
/**
* Removes the tracciabilita scheda with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param id the primary key of the tracciabilita scheda
* @return the tracciabilita scheda that was removed
* @throws it.bysoftware.ct.NoSuchTracciabilitaSchedaException if a tracciabilita scheda with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda remove(long id)
throws com.liferay.portal.kernel.exception.SystemException,
it.bysoftware.ct.NoSuchTracciabilitaSchedaException;
public it.bysoftware.ct.model.TracciabilitaScheda updateImpl(
it.bysoftware.ct.model.TracciabilitaScheda tracciabilitaScheda)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the tracciabilita scheda with the primary key or throws a {@link it.bysoftware.ct.NoSuchTracciabilitaSchedaException} if it could not be found.
*
* @param id the primary key of the tracciabilita scheda
* @return the tracciabilita scheda
* @throws it.bysoftware.ct.NoSuchTracciabilitaSchedaException if a tracciabilita scheda with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda findByPrimaryKey(long id)
throws com.liferay.portal.kernel.exception.SystemException,
it.bysoftware.ct.NoSuchTracciabilitaSchedaException;
/**
* Returns the tracciabilita scheda with the primary key or returns <code>null</code> if it could not be found.
*
* @param id the primary key of the tracciabilita scheda
* @return the tracciabilita scheda, or <code>null</code> if a tracciabilita scheda with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
public it.bysoftware.ct.model.TracciabilitaScheda fetchByPrimaryKey(long id)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns all the tracciabilita schedas.
*
* @return the tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public java.util.List<it.bysoftware.ct.model.TracciabilitaScheda> findAll()
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns a range of all the tracciabilita schedas.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.bysoftware.ct.model.impl.TracciabilitaSchedaModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of tracciabilita schedas
* @param end the upper bound of the range of tracciabilita schedas (not inclusive)
* @return the range of tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public java.util.List<it.bysoftware.ct.model.TracciabilitaScheda> findAll(
int start, int end)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns an ordered range of all the tracciabilita schedas.
*
* <p>
* Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link it.bysoftware.ct.model.impl.TracciabilitaSchedaModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
* </p>
*
* @param start the lower bound of the range of tracciabilita schedas
* @param end the upper bound of the range of tracciabilita schedas (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
* @return the ordered range of tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public java.util.List<it.bysoftware.ct.model.TracciabilitaScheda> findAll(
int start, int end,
com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Removes all the tracciabilita schedas from the database.
*
* @throws SystemException if a system exception occurred
*/
public void removeAll()
throws com.liferay.portal.kernel.exception.SystemException;
/**
* Returns the number of tracciabilita schedas.
*
* @return the number of tracciabilita schedas
* @throws SystemException if a system exception occurred
*/
public int countAll()
throws com.liferay.portal.kernel.exception.SystemException;
}
|
[
"torrisi.mario@gmail.com"
] |
torrisi.mario@gmail.com
|
fd43e6050baa58def59f9771662d9cf49f32ec85
|
8456a8291c4733ab50691e36f743f33e163aebdc
|
/Practicals/Tennis/Player.java
|
e203fc28ad14ca11f587fb474484e05bbfa0cbaa
|
[] |
no_license
|
ConnerTenn/Legacy_Java
|
c3b7897c2a6c92396f38f095010a4f6b8bb2776f
|
19ed19f1800ff1727ea237fc4a2b2108d6341a7b
|
refs/heads/master
| 2021-05-09T22:17:34.043973
| 2018-01-24T10:05:32
| 2018-01-24T10:05:32
| 118,747,173
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,950
|
java
|
package Practical1;
public class Player
{
public String name;
public int setsWon = 0;
//public boolean wonGame = false;
public int gamesWon = 0;
public int points = 0;
public Player(String name)
{
this.name = name;
}
//player scores
/*public boolean score()
{
boolean win = false;
if (this.points < 3)
{
this.points += 1;
}
else
{
if (this.points == 3) { this.points += 1; }
else
{
//won game
win = true;
resetPoints();
winGame();
}
}
return win;
}
//player did not score
public void notScore()
{
if (this.points > 3)
{
}
}*/
public void score(Player oponent)
{
//check if score 4 times
if (this.points >= 4)
{
if (this.points - oponent.points >= 2)//check difference
{//win
resetPoints();
oponent.resetPoints();
winGame(oponent);
}
else
{//do Adv calculation
if (oponent.points >=5 )
{
this.points--;
oponent.points--;
}
}
}
}
//a game was won; reset the points
public void resetPoints()
{
this.points = 0;
}
//record a win game
public void winGame(Player oponent)
{
this.gamesWon++;
//this.wonGame = true;
if (this.gamesWon >= 6)
{
if (this.gamesWon - oponent.gamesWon >= 2)//check difference
{//win
resetGames();
oponent.resetGames();
winSet();
}
else
{//do Adv calculation
if (oponent.gamesWon >=7 )
{
this.gamesWon--;
oponent.gamesWon--;
}
}
}
}
public void resetGames()
{
this.gamesWon = 0;
}
public void winSet()
{
this.setsWon++;
}
public String toString()
{
String points = "";
if (this.points == 0) {points = "love";}
else if (this.points == 1) {points = "15";}
else if (this.points == 2) {points = "30";}
else if (this.points == 3) {points = "40";}
else if (this.points == 4) {points = "Adv";}
return this.name + " " + this.setsWon + " " + this.gamesWon + " " + points;
}
}
|
[
"connertenn@gmail.com"
] |
connertenn@gmail.com
|
9e7fd121c5bca8f7551c80bf7a115c3a4482ea6f
|
51e66f0e2d85e19bef203eef93a9e2f981fab0d0
|
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
|
4507e285816922da0f08dd00a4150fda601cb1b7
|
[
"LicenseRef-scancode-unicode",
"Apache-2.0"
] |
permissive
|
iykex/ALPS.L1.MP3.V2.62_HCT6753_65C_C_L1_INHOUSE_KERNEL
|
8733a94f63c9d040921c301d9a9f96a205bde232
|
f027f49ce628afe72d7ec30682d48a67dddfafbb
|
refs/heads/master
| 2021-06-14T04:00:03.042489
| 2017-02-14T05:10:38
| 2017-02-14T05:10:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 173,228
|
java
|
/*
* Copyright (C) 2014 MediaTek Inc.
* Modification based on code covered by the mentioned copyright
* and/or permission notice(s).
*/
/*
* Copyright (C) 2007 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.server.power;
import com.android.internal.app.IAppOpsService;
import com.android.internal.app.IBatteryStats;
import com.android.internal.telephony.ITelephony;
import com.android.internal.os.BackgroundThread;
import com.android.server.EventLogTags;
import com.android.server.ServiceThread;
import com.android.server.SystemService;
import com.android.server.am.BatteryStatsService;
import com.android.server.lights.Light;
import com.android.server.lights.LightsManager;
import com.android.server.Watchdog;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.hardware.SensorManager;
import android.hardware.SystemSensorManager;
import android.hardware.display.DisplayManager;
import android.hardware.display.WifiDisplayStatus;
import android.hardware.display.DisplayManagerInternal;
import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest;
import android.net.Uri;
import android.os.BatteryManager;
import android.os.BatteryManagerInternal;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.IPowerManager;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManagerInternal;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.WorkSource;
import android.os.ServiceManager;
import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.util.EventLog;
import android.util.Slog;
import android.util.TimeUtils;
import android.view.Display;
import android.view.WindowManagerPolicy;
import android.view.Display;
import android.telecom.TelecomManager;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import libcore.util.Objects;
import static android.os.PowerManagerInternal.WAKEFULNESS_ASLEEP;
import static android.os.PowerManagerInternal.WAKEFULNESS_AWAKE;
import static android.os.PowerManagerInternal.WAKEFULNESS_DREAMING;
import static android.os.PowerManagerInternal.WAKEFULNESS_DOZING;
import com.mediatek.hdmi.HdmiDef;
import com.mediatek.hdmi.IMtkHdmiManager;
/**
* The power manager service is responsible for coordinating power management
* functions on the device.
*/
public final class PowerManagerService extends SystemService
implements Watchdog.Monitor {
private static final String TAG = "PowerManagerService";
private static final boolean DEBUG = true;
private static final boolean DEBUG_SPEW = DEBUG && true;
// Message: Sent when a user activity timeout occurs to update the power state.
private static final int MSG_USER_ACTIVITY_TIMEOUT = 1;
// Message: Sent when the device enters or exits a dreaming or dozing state.
private static final int MSG_SANDMAN = 2;
// Message: Sent when the screen brightness boost expires.
private static final int MSG_SCREEN_BRIGHTNESS_BOOST_TIMEOUT = 3;
// Dirty bit: mWakeLocks changed
private static final int DIRTY_WAKE_LOCKS = 1 << 0;
// Dirty bit: mWakefulness changed
private static final int DIRTY_WAKEFULNESS = 1 << 1;
// Dirty bit: user activity was poked or may have timed out
private static final int DIRTY_USER_ACTIVITY = 1 << 2;
// Dirty bit: actual display power state was updated asynchronously
private static final int DIRTY_ACTUAL_DISPLAY_POWER_STATE_UPDATED = 1 << 3;
// Dirty bit: mBootCompleted changed
private static final int DIRTY_BOOT_COMPLETED = 1 << 4;
// Dirty bit: settings changed
private static final int DIRTY_SETTINGS = 1 << 5;
// Dirty bit: mIsPowered changed
private static final int DIRTY_IS_POWERED = 1 << 6;
// Dirty bit: mStayOn changed
private static final int DIRTY_STAY_ON = 1 << 7;
// Dirty bit: battery state changed
private static final int DIRTY_BATTERY_STATE = 1 << 8;
// Dirty bit: proximity state changed
private static final int DIRTY_PROXIMITY_POSITIVE = 1 << 9;
// Dirty bit: dock state changed
private static final int DIRTY_DOCK_STATE = 1 << 10;
// Dirty bit: brightness boost changed
private static final int DIRTY_SCREEN_BRIGHTNESS_BOOST = 1 << 11;
// Dirty bit: ipo boot
private static final int DIRTY_BOOT_IPO = 1 << 12;
// Dirty bit: sd card state changed
private static final int DIRTY_SD_STATE = 1 << 13;
// Dirty bit: smart book state changed
private static final int DIRTY_SMARTBOOK_STATE = 1 << 14;
// Summarizes the state of all active wakelocks.
private static final int WAKE_LOCK_CPU = 1 << 0;
private static final int WAKE_LOCK_SCREEN_BRIGHT = 1 << 1;
private static final int WAKE_LOCK_SCREEN_DIM = 1 << 2;
private static final int WAKE_LOCK_BUTTON_BRIGHT = 1 << 3;
private static final int WAKE_LOCK_PROXIMITY_SCREEN_OFF = 1 << 4;
private static final int WAKE_LOCK_STAY_AWAKE = 1 << 5; // only set if already awake
private static final int WAKE_LOCK_DOZE = 1 << 6;
// Summarizes the user activity state.
private static final int USER_ACTIVITY_SCREEN_BRIGHT = 1 << 0;
private static final int USER_ACTIVITY_SCREEN_DIM = 1 << 1;
private static final int USER_ACTIVITY_SCREEN_DREAM = 1 << 2;
private static final int USER_ACTIVITY_BUTTON_BRIGHT = 1 << 3;
// Default timeout in milliseconds. This is only used until the settings
// provider populates the actual default value (R.integer.def_screen_off_timeout).
private static final int DEFAULT_SCREEN_OFF_TIMEOUT = 15 * 1000;
private static final int DEFAULT_SLEEP_TIMEOUT = -1;
// Screen brightness boost timeout.
// Hardcoded for now until we decide what the right policy should be.
// This should perhaps be a setting.
private static final int SCREEN_BRIGHTNESS_BOOST_TIMEOUT = 5 * 1000;
// The button off timeout, in milliseconds.
// This is subtracted from the end of the screen off timeout so the
// minimum button off timeout should be longer than this.
private static final int SCREEN_BUTTON_LIGHT_DURATION = 8 * 1000;
// The maximum button off timeout expressed as a ratio relative to the button
// off timeout.
private static final float MAXIMUM_SCREEN_BUTTON_RATIO = 0.3f;
// Power hints defined in hardware/libhardware/include/hardware/power.h.
private static final int POWER_HINT_INTERACTION = 2;
private static final int POWER_HINT_LOW_POWER = 5;
// Send cmd to nativeSetSmartBookScreen on/off
private static final int SMARTBOOK_SCREEN_OFF = 0;
private static final int SMARTBOOK_SCREEN_ON = 2;
private final Context mContext;
private final ServiceThread mHandlerThread;
private final PowerManagerHandler mHandler;
private LightsManager mLightsManager;
private BatteryManagerInternal mBatteryManagerInternal;
private DisplayManagerInternal mDisplayManagerInternal;
private IBatteryStats mBatteryStats;
private IAppOpsService mAppOps;
private WindowManagerPolicy mPolicy;
private Notifier mNotifier;
private WirelessChargerDetector mWirelessChargerDetector;
private SettingsObserver mSettingsObserver;
private DreamManagerInternal mDreamManager;
private Light mAttentionLight;
private Light mButtonLight;
private Light mBacklight;
private final Object mLock = new Object();
// A bitfield that indicates what parts of the power state have
// changed and need to be recalculated.
private int mDirty;
// Indicates whether the device is awake or asleep or somewhere in between.
// This is distinct from the screen power state, which is managed separately.
private int mWakefulness;
private boolean mWakefulnessChanging;
// True if the sandman has just been summoned for the first time since entering the
// dreaming or dozing state. Indicates whether a new dream should begin.
private boolean mSandmanSummoned;
// True if MSG_SANDMAN has been scheduled.
private boolean mSandmanScheduled;
// Table of all suspend blockers.
// There should only be a few of these.
private final ArrayList<SuspendBlocker> mSuspendBlockers = new ArrayList<SuspendBlocker>();
// Table of all wake locks acquired by applications.
private final ArrayList<WakeLock> mWakeLocks = new ArrayList<WakeLock>();
// A bitfield that summarizes the state of all active wakelocks.
private int mWakeLockSummary;
// If true, instructs the display controller to wait for the proximity sensor to
// go negative before turning the screen on.
private boolean mRequestWaitForNegativeProximity;
// Timestamp of the last time the device was awoken or put to sleep.
private long mLastWakeTime;
private long mLastSleepTime;
// Timestamp of the last call to user activity.
private long mLastUserActivityTime;
private long mLastUserActivityTimeNoChangeLights;
private long mLastUserActivityButtonTime;
// Timestamp of last interactive power hint.
private long mLastInteractivePowerHintTime;
// Timestamp of the last screen brightness boost.
private long mLastScreenBrightnessBoostTime;
private boolean mScreenBrightnessBoostInProgress;
// A bitfield that summarizes the effect of the user activity timer.
private int mUserActivitySummary;
// The desired display power state. The actual state may lag behind the
// requested because it is updated asynchronously by the display power controller.
private final DisplayPowerRequest mDisplayPowerRequest = new DisplayPowerRequest();
// True if the display power state has been fully applied, which means the display
// is actually on or actually off or whatever was requested.
private boolean mDisplayReady;
// The suspend blocker used to keep the CPU alive when an application has acquired
// a wake lock.
private final SuspendBlocker mWakeLockSuspendBlocker;
// True if the wake lock suspend blocker has been acquired.
private boolean mHoldingWakeLockSuspendBlocker;
// The suspend blocker used to keep the CPU alive when the display is on, the
// display is getting ready or there is user activity (in which case the display
// must be on).
private final SuspendBlocker mDisplaySuspendBlocker;
// True if the display suspend blocker has been acquired.
private boolean mHoldingDisplaySuspendBlocker;
// True if systemReady() has been called.
private boolean mSystemReady;
// True if boot completed occurred. We keep the screen on until this happens.
private boolean mBootCompleted;
// True if auto-suspend mode is enabled.
// Refer to autosuspend.h.
private boolean mHalAutoSuspendModeEnabled;
// True if interactive mode is enabled.
// Refer to power.h.
private boolean mHalInteractiveModeEnabled;
// True if the device is plugged into a power source.
private boolean mIsPowered;
// The current plug type, such as BatteryManager.BATTERY_PLUGGED_WIRELESS.
private int mPlugType;
// The current battery level percentage.
private int mBatteryLevel;
// The battery level percentage at the time the dream started.
// This is used to terminate a dream and go to sleep if the battery is
// draining faster than it is charging and the user activity timeout has expired.
private int mBatteryLevelWhenDreamStarted;
// The current dock state.
private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
// [WFD] The current wfd sleep state.
private boolean mWfdShouldBypass = false;
// True to decouple auto-suspend mode from the display state.
private boolean mDecoupleHalAutoSuspendModeFromDisplayConfig;
// True to decouple interactive mode from the display state.
private boolean mDecoupleHalInteractiveModeFromDisplayConfig;
// True if the device should wake up when plugged or unplugged.
private boolean mWakeUpWhenPluggedOrUnpluggedConfig;
// True if the device should wake up when plugged or unplugged in theater mode.
private boolean mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig;
// True if the device should wake up when plugged or unplugged.
private boolean mPreWakeUpWhenPluggedOrUnpluggedConfig;
// True if the device should suspend when the screen is off due to proximity.
private boolean mSuspendWhenScreenOffDueToProximityConfig;
// True if dreams are supported on this device.
private boolean mDreamsSupportedConfig;
// Default value for dreams enabled
private boolean mDreamsEnabledByDefaultConfig;
// Default value for dreams activate-on-sleep
private boolean mDreamsActivatedOnSleepByDefaultConfig;
// Default value for dreams activate-on-dock
private boolean mDreamsActivatedOnDockByDefaultConfig;
// True if dreams can run while not plugged in.
private boolean mDreamsEnabledOnBatteryConfig;
// Minimum battery level to allow dreaming when powered.
// Use -1 to disable this safety feature.
private int mDreamsBatteryLevelMinimumWhenPoweredConfig;
// Minimum battery level to allow dreaming when not powered.
// Use -1 to disable this safety feature.
private int mDreamsBatteryLevelMinimumWhenNotPoweredConfig;
// If the battery level drops by this percentage and the user activity timeout
// has expired, then assume the device is receiving insufficient current to charge
// effectively and terminate the dream. Use -1 to disable this safety feature.
private int mDreamsBatteryLevelDrainCutoffConfig;
// True if dreams are enabled by the user.
private boolean mDreamsEnabledSetting;
// True if dreams should be activated on sleep.
private boolean mDreamsActivateOnSleepSetting;
// True if dreams should be activated on dock.
private boolean mDreamsActivateOnDockSetting;
// True if doze should not be started until after the screen off transition.
private boolean mDozeAfterScreenOffConfig;
// The minimum screen off timeout, in milliseconds.
private int mMinimumScreenOffTimeoutConfig;
// The screen dim duration, in milliseconds.
// This is subtracted from the end of the screen off timeout so the
// minimum screen off timeout should be longer than this.
private int mMaximumScreenDimDurationConfig;
// The maximum screen dim time expressed as a ratio relative to the screen
// off timeout. If the screen off timeout is very short then we want the
// dim timeout to also be quite short so that most of the time is spent on.
// Otherwise the user won't get much screen on time before dimming occurs.
private float mMaximumScreenDimRatioConfig;
// The screen off timeout setting value in milliseconds.
private int mScreenOffTimeoutSetting;
// The sleep timeout setting value in milliseconds.
private int mSleepTimeoutSetting;
// The maximum allowable screen off timeout according to the device
// administration policy. Overrides other settings.
private int mMaximumScreenOffTimeoutFromDeviceAdmin = Integer.MAX_VALUE;
// The stay on while plugged in setting.
// A bitfield of battery conditions under which to make the screen stay on.
private int mStayOnWhilePluggedInSetting;
// True if the device should stay on.
private boolean mStayOn;
// Keep system alive to prevent from screen off timeout
private boolean mStayOnWithoutDim = false;
// True if the proximity sensor reads a positive result.
private boolean mProximityPositive;
// Screen brightness setting limits.
private int mScreenBrightnessSettingMinimum;
private int mScreenBrightnessSettingMaximum;
private int mScreenBrightnessSettingDefault;
// The screen brightness setting, from 0 to 255.
// Use -1 if no value has been set.
private int mScreenBrightnessSetting;
// The screen auto-brightness adjustment setting, from -1 to 1.
// Use 0 if there is no adjustment.
private float mScreenAutoBrightnessAdjustmentSetting;
// The screen brightness mode.
// One of the Settings.System.SCREEN_BRIGHTNESS_MODE_* constants.
private int mScreenBrightnessModeSetting;
// The screen brightness setting override from the window manager
// to allow the current foreground activity to override the brightness.
// Use -1 to disable.
private int mScreenBrightnessOverrideFromWindowManager = -1;
// The user activity timeout override from the window manager
// to allow the current foreground activity to override the user activity timeout.
// Use -1 to disable.
private long mUserActivityTimeoutOverrideFromWindowManager = -1;
// The screen brightness setting override from the settings application
// to temporarily adjust the brightness until next updated,
// Use -1 to disable.
private int mTemporaryScreenBrightnessSettingOverride = -1;
// The screen brightness adjustment setting override from the settings
// application to temporarily adjust the auto-brightness adjustment factor
// until next updated, in the range -1..1.
// Use NaN to disable.
private float mTemporaryScreenAutoBrightnessAdjustmentSettingOverride = Float.NaN;
// The screen state to use while dozing.
private int mDozeScreenStateOverrideFromDreamManager = Display.STATE_UNKNOWN;
// The screen brightness to use while dozing.
private int mDozeScreenBrightnessOverrideFromDreamManager = PowerManager.BRIGHTNESS_DEFAULT;
// Time when we last logged a warning about calling userActivity() without permission.
private long mLastWarningAboutUserActivityPermission = Long.MIN_VALUE;
public static final String IPO_BOOT = "android.intent.action.ACTION_BOOT_IPO";
public static final String IPO_PREBOOT = "android.intent.action.ACTION_PREBOOT_IPO";
// IPO shutdown backlight/display
private boolean mIPOShutdown = false;
// shutdown screen off
private boolean mShutdownFlag = false;
private boolean mUserActivityTimeoutMin = false;
private int mUserActivityTimeoutOverrideFromCMD = 10;
// [Smart Book] HDMI state
private IMtkHdmiManager mHdmiManager = null;
// [Smart Book] smartbook power state
private boolean mSmartBookSleeped = false;
// [Smart Book] RDMA Limitation
private boolean mSmartBookRDMALimited = false;
// [Smart Book] wakeup pending
private boolean mSmartBookWakeUpPendingByIPO = false;
// [Smart Book] The current smartbook plug state.
private boolean mSmartBookPlugState = false;
// [Smart Book] The lcd backlight control.
private boolean mSmartBookForceBacklightOff = false;
// If true, the device is in low power mode.
private boolean mLowPowerModeEnabled;
// Current state of the low power mode setting.
private boolean mLowPowerModeSetting;
// Current state of whether the settings are allowing auto low power mode.
private boolean mAutoLowPowerModeConfigured;
// The user turned off low power mode below the trigger level
private boolean mAutoLowPowerModeSnoozing;
// True if the battery level is currently considered low.
private boolean mBatteryLevelLow;
// True if theater mode is enabled
private boolean mTheaterModeEnabled;
private final ArrayList<PowerManagerInternal.LowPowerModeListener> mLowPowerModeListeners
= new ArrayList<PowerManagerInternal.LowPowerModeListener>();
private native void nativeInit();
private static native void nativeAcquireSuspendBlocker(String name);
private static native void nativeReleaseSuspendBlocker(String name);
private static native void nativeSetInteractive(boolean enable);
private static native void nativeSetAutoSuspend(boolean enable);
private static native void nativeSetSmartBookMode(boolean enable);
private static native void nativeSetSmartBookSuspend(boolean enable);
private static native void nativeSetSmartBookScreen(int cmd, int timeout);
private static native void nativeSetBlNotify(boolean enable);
private static native void nativeSendPowerHint(int hintId, int data);
public PowerManagerService(Context context) {
super(context);
mContext = context;
mHandlerThread = new ServiceThread(TAG,
Process.THREAD_PRIORITY_DISPLAY, false /*allowIo*/);
mHandlerThread.start();
mHandler = new PowerManagerHandler(mHandlerThread.getLooper());
synchronized (mLock) {
mWakeLockSuspendBlocker = createSuspendBlockerLocked("PowerManagerService.WakeLocks");
mDisplaySuspendBlocker = createSuspendBlockerLocked("PowerManagerService.Display");
mDisplaySuspendBlocker.acquire();
mHoldingDisplaySuspendBlocker = true;
mHalAutoSuspendModeEnabled = false;
mHalInteractiveModeEnabled = true;
mWakefulness = WAKEFULNESS_AWAKE;
nativeInit();
nativeSetAutoSuspend(false);
nativeSetInteractive(true);
}
}
@Override
public void onStart() {
publishBinderService(Context.POWER_SERVICE, new BinderService());
publishLocalService(PowerManagerInternal.class, new LocalService());
Watchdog.getInstance().addMonitor(this);
Watchdog.getInstance().addThread(mHandler);
}
@Override
public void onBootPhase(int phase) {
synchronized (mLock) {
if (phase == PHASE_BOOT_COMPLETED) {
final long now = SystemClock.uptimeMillis();
mBootCompleted = true;
mDirty |= DIRTY_BOOT_COMPLETED;
userActivityNoUpdateLocked(
now, PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
updatePowerStateLocked();
}
}
}
public void systemReady(IAppOpsService appOps) {
synchronized (mLock) {
mSystemReady = true;
mAppOps = appOps;
mDreamManager = getLocalService(DreamManagerInternal.class);
mDisplayManagerInternal = getLocalService(DisplayManagerInternal.class);
mPolicy = getLocalService(WindowManagerPolicy.class);
mBatteryManagerInternal = getLocalService(BatteryManagerInternal.class);
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mScreenBrightnessSettingMinimum = pm.getMinimumScreenBrightnessSetting();
mScreenBrightnessSettingMaximum = pm.getMaximumScreenBrightnessSetting();
mScreenBrightnessSettingDefault = pm.getDefaultScreenBrightnessSetting();
if (DEBUG_SPEW) {
Slog.d(TAG, "mScreenBrightnessSettingMinimum = " + mScreenBrightnessSettingMinimum +
" mScreenBrightnessSettingMinimum = " + mScreenBrightnessSettingMaximum +
" mScreenBrightnessSettingDefault = " + mScreenBrightnessSettingDefault);
}
SensorManager sensorManager = new SystemSensorManager(mContext, mHandler.getLooper());
// The notifier runs on the system server's main looper so as not to interfere
// with the animations and other critical functions of the power manager.
mBatteryStats = BatteryStatsService.getService();
mNotifier = new Notifier(Looper.getMainLooper(), mContext, mBatteryStats,
mAppOps, createSuspendBlockerLocked("PowerManagerService.Broadcasts"),
mPolicy);
mWirelessChargerDetector = new WirelessChargerDetector(sensorManager,
createSuspendBlockerLocked("PowerManagerService.WirelessChargerDetector"),
mHandler);
mSettingsObserver = new SettingsObserver(mHandler);
mLightsManager = getLocalService(LightsManager.class);
mAttentionLight = mLightsManager.getLight(LightsManager.LIGHT_ID_ATTENTION);
mButtonLight = mLightsManager.getLight(LightsManager.LIGHT_ID_BUTTONS);
mBacklight = mLightsManager.getLight(LightsManager.LIGHT_ID_BACKLIGHT);
// Initialize display power management.
mDisplayManagerInternal.initPowerManagement(
mDisplayPowerCallbacks, mHandler, sensorManager);
// Register for broadcasts from other components of the system.
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
mContext.registerReceiver(new BatteryReceiver(), filter, null, mHandler);
filter = new IntentFilter();
filter.addAction(Intent.ACTION_DREAMING_STARTED);
filter.addAction(Intent.ACTION_DREAMING_STOPPED);
mContext.registerReceiver(new DreamReceiver(), filter, null, mHandler);
filter = new IntentFilter();
filter.addAction(Intent.ACTION_USER_SWITCHED);
mContext.registerReceiver(new UserSwitchedReceiver(), filter, null, mHandler);
filter = new IntentFilter();
filter.addAction(Intent.ACTION_DOCK_EVENT);
mContext.registerReceiver(new DockReceiver(), filter, null, mHandler);
// Register for SD Hot Plug notification
filter = new IntentFilter();
filter.addAction(Intent.ACTION_SD_INSERTED);
filter.addDataScheme("file");
mContext.registerReceiver(new SDHotPlugReceiver(), filter, null, mHandler);
// Register for IPO feature
if (SystemProperties.get("ro.mtk_ipo_support").equals("1")) {
filter = new IntentFilter();
filter.addAction(IPO_BOOT);
filter.addAction(IPO_PREBOOT);
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
if (IPO_PREBOOT.equals(intent.getAction())) {
Slog.d(TAG, "PREBOOT_IPO");
mStayOnWithoutDim = true;
mIPOShutdown = false;
mDirty |= DIRTY_BOOT_IPO;
if (mSmartBookWakeUpPendingByIPO) {
wakeUpByReasonInternal(SystemClock.uptimeMillis(), PowerManager.WAKE_UP_REASON_SMARTBOOK);
mSmartBookWakeUpPendingByIPO = false;
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
}
} else if (IPO_BOOT.equals(intent.getAction())) {
Slog.d(TAG, "IPO_BOOT");
mStayOnWithoutDim = false;
mIPOShutdown = false;
mDirty |= DIRTY_BOOT_IPO;
mDisplayManagerInternal.setIPOScreenOnDelay(0);
if (mWakefulness != WAKEFULNESS_AWAKE) {
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
} else {
userActivityNoUpdateLocked(
SystemClock.uptimeMillis(), PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
}
}
updatePowerStateLocked();
}
}
}, filter, null, mHandler);
filter = new IntentFilter();
filter.addAction("android.intent.action.ACTION_SHUTDOWN_IPO");
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (DEBUG) {
Slog.d(TAG, "ACTION_SHUTDOWN_IPO.");
}
mIPOShutdown = true;
}
}, filter, null, mHandler);
filter = new IntentFilter();
filter.addAction("android.intent.action.normal.shutdown");
mContext.registerReceiver(new BroadcastReceiver() {
@Override
// receive android.intent.action.normal.shutdown intent
// user choose to shutdown while alarm boot
// set mBootCompleted as true for blank/unblank control during IPO shutdown
public void onReceive(Context context, Intent intent) {
if(mBootCompleted != true){
Slog.d(TAG, "set mBootCompleted as true");
mBootCompleted = true;
}
}
}, filter, null, mHandler);
}
// Register for smart book notification
filter = new IntentFilter();
filter.addAction(Intent.ACTION_SMARTBOOK_PLUG);
mContext.registerReceiver(new SmartBookPlugReceiver(), filter, null, mHandler);
filter = new IntentFilter();
filter.addAction("com.mediatek.SCREEN_TIMEOUT_MINIMUM");
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (DEBUG) {
Slog.d(TAG, "SCREEN_TIMEOUT_MINIMUM.");
}
mPreWakeUpWhenPluggedOrUnpluggedConfig = mWakeUpWhenPluggedOrUnpluggedConfig;
mWakeUpWhenPluggedOrUnpluggedConfig = false;
mUserActivityTimeoutMin = true;
}
}, filter, null, mHandler);
filter = new IntentFilter();
filter.addAction("com.mediatek.SCREEN_TIMEOUT_NORMAL");
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (DEBUG) {
Slog.d(TAG, "SCREEN_TIMEOUT_NORMAL.");
}
mWakeUpWhenPluggedOrUnpluggedConfig = mPreWakeUpWhenPluggedOrUnpluggedConfig;
mUserActivityTimeoutMin = false;
}
}, filter, null, mHandler);
// Register for settings changes.
final ContentResolver resolver = mContext.getContentResolver();
resolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.SCREENSAVER_ENABLED),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.SCREEN_OFF_TIMEOUT),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Secure.getUriFor(
Settings.Secure.SLEEP_TIMEOUT),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.STAY_ON_WHILE_PLUGGED_IN),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.SCREEN_BRIGHTNESS),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.SCREEN_BRIGHTNESS_MODE),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.LOW_POWER_MODE),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
false, mSettingsObserver, UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.THEATER_MODE_ON),
false, mSettingsObserver, UserHandle.USER_ALL);
mHdmiManager = IMtkHdmiManager.Stub.asInterface(ServiceManager.getService(Context.HDMI_SERVICE));
if (mHdmiManager != null) {
try {
if (mHdmiManager.hasCapability(HdmiDef.CAPABILITY_RDMA_LIMIT)) {
Slog.d(TAG, "RDMA with limitation");
mSmartBookRDMALimited = true;
} else {
Slog.d(TAG, "RDMA without limitation");
mSmartBookRDMALimited = false;
}
} catch (RemoteException e) {
Slog.d(TAG, "RemoteException on mHdmiManager hasCapability");
}
}
// Go.
if (DEBUG) {
Slog.d(TAG, "system ready!");
}
readConfigurationLocked();
updateSettingsLocked();
mDirty |= DIRTY_BATTERY_STATE;
updatePowerStateLocked();
}
}
private void readConfigurationLocked() {
final Resources resources = mContext.getResources();
mDecoupleHalAutoSuspendModeFromDisplayConfig = resources.getBoolean(
com.android.internal.R.bool.config_powerDecoupleAutoSuspendModeFromDisplay);
mDecoupleHalInteractiveModeFromDisplayConfig = resources.getBoolean(
com.android.internal.R.bool.config_powerDecoupleInteractiveModeFromDisplay);
mWakeUpWhenPluggedOrUnpluggedConfig = resources.getBoolean(
com.android.internal.R.bool.config_unplugTurnsOnScreen);
mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig = resources.getBoolean(
com.android.internal.R.bool.config_allowTheaterModeWakeFromUnplug);
mSuspendWhenScreenOffDueToProximityConfig = resources.getBoolean(
com.android.internal.R.bool.config_suspendWhenScreenOffDueToProximity);
mDreamsSupportedConfig = resources.getBoolean(
com.android.internal.R.bool.config_dreamsSupported);
mDreamsEnabledByDefaultConfig = resources.getBoolean(
com.android.internal.R.bool.config_dreamsEnabledByDefault);
mDreamsActivatedOnSleepByDefaultConfig = resources.getBoolean(
com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
mDreamsActivatedOnDockByDefaultConfig = resources.getBoolean(
com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
mDreamsEnabledOnBatteryConfig = resources.getBoolean(
com.android.internal.R.bool.config_dreamsEnabledOnBattery);
mDreamsBatteryLevelMinimumWhenPoweredConfig = resources.getInteger(
com.android.internal.R.integer.config_dreamsBatteryLevelMinimumWhenPowered);
mDreamsBatteryLevelMinimumWhenNotPoweredConfig = resources.getInteger(
com.android.internal.R.integer.config_dreamsBatteryLevelMinimumWhenNotPowered);
mDreamsBatteryLevelDrainCutoffConfig = resources.getInteger(
com.android.internal.R.integer.config_dreamsBatteryLevelDrainCutoff);
mDozeAfterScreenOffConfig = resources.getBoolean(
com.android.internal.R.bool.config_dozeAfterScreenOff);
mMinimumScreenOffTimeoutConfig = resources.getInteger(
com.android.internal.R.integer.config_minimumScreenOffTimeout);
mMaximumScreenDimDurationConfig = resources.getInteger(
com.android.internal.R.integer.config_maximumScreenDimDuration);
mMaximumScreenDimRatioConfig = resources.getFraction(
com.android.internal.R.fraction.config_maximumScreenDimRatio, 1, 1);
}
private void updateSettingsLocked() {
final ContentResolver resolver = mContext.getContentResolver();
mDreamsEnabledSetting = (Settings.Secure.getIntForUser(resolver,
Settings.Secure.SCREENSAVER_ENABLED,
mDreamsEnabledByDefaultConfig ? 1 : 0,
UserHandle.USER_CURRENT) != 0);
mDreamsActivateOnSleepSetting = (Settings.Secure.getIntForUser(resolver,
Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP,
mDreamsActivatedOnSleepByDefaultConfig ? 1 : 0,
UserHandle.USER_CURRENT) != 0);
mDreamsActivateOnDockSetting = (Settings.Secure.getIntForUser(resolver,
Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK,
mDreamsActivatedOnDockByDefaultConfig ? 1 : 0,
UserHandle.USER_CURRENT) != 0);
mScreenOffTimeoutSetting = Settings.System.getIntForUser(resolver,
Settings.System.SCREEN_OFF_TIMEOUT, DEFAULT_SCREEN_OFF_TIMEOUT,
UserHandle.USER_CURRENT);
mSleepTimeoutSetting = Settings.Secure.getIntForUser(resolver,
Settings.Secure.SLEEP_TIMEOUT, DEFAULT_SLEEP_TIMEOUT,
UserHandle.USER_CURRENT);
mStayOnWhilePluggedInSetting = Settings.Global.getInt(resolver,
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC);
mTheaterModeEnabled = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.THEATER_MODE_ON, 0) == 1;
final int oldScreenBrightnessSetting = mScreenBrightnessSetting;
mScreenBrightnessSetting = Settings.System.getIntForUser(resolver,
Settings.System.SCREEN_BRIGHTNESS, mScreenBrightnessSettingDefault,
UserHandle.USER_CURRENT);
if (oldScreenBrightnessSetting != mScreenBrightnessSetting) {
mTemporaryScreenBrightnessSettingOverride = -1;
}
final float oldScreenAutoBrightnessAdjustmentSetting =
mScreenAutoBrightnessAdjustmentSetting;
mScreenAutoBrightnessAdjustmentSetting = Settings.System.getFloatForUser(resolver,
Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f,
UserHandle.USER_CURRENT);
if (oldScreenAutoBrightnessAdjustmentSetting != mScreenAutoBrightnessAdjustmentSetting) {
mTemporaryScreenAutoBrightnessAdjustmentSettingOverride = Float.NaN;
}
mScreenBrightnessModeSetting = Settings.System.getIntForUser(resolver,
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT);
if (DEBUG_SPEW) {
Slog.d(TAG, "updateSettingsLocked: mScreenBrightnessModeSetting=" + mScreenBrightnessModeSetting);
}
final boolean lowPowerModeEnabled = Settings.Global.getInt(resolver,
Settings.Global.LOW_POWER_MODE, 0) != 0;
final boolean autoLowPowerModeConfigured = Settings.Global.getInt(resolver,
Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0) != 0;
if (lowPowerModeEnabled != mLowPowerModeSetting
|| autoLowPowerModeConfigured != mAutoLowPowerModeConfigured) {
mLowPowerModeSetting = lowPowerModeEnabled;
mAutoLowPowerModeConfigured = autoLowPowerModeConfigured;
updateLowPowerModeLocked();
}
mDirty |= DIRTY_SETTINGS;
}
void updateLowPowerModeLocked() {
if (mIsPowered && mLowPowerModeSetting) {
if (DEBUG_SPEW) {
Slog.d(TAG, "updateLowPowerModeLocked: powered, turning setting off");
}
// Turn setting off if powered
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.LOW_POWER_MODE, 0);
mLowPowerModeSetting = false;
}
final boolean autoLowPowerModeEnabled = !mIsPowered && mAutoLowPowerModeConfigured
&& !mAutoLowPowerModeSnoozing && mBatteryLevelLow;
final boolean lowPowerModeEnabled = mLowPowerModeSetting || autoLowPowerModeEnabled;
if (mLowPowerModeEnabled != lowPowerModeEnabled) {
mLowPowerModeEnabled = lowPowerModeEnabled;
powerHintInternal(POWER_HINT_LOW_POWER, lowPowerModeEnabled ? 1 : 0);
BackgroundThread.getHandler().post(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGING)
.putExtra(PowerManager.EXTRA_POWER_SAVE_MODE, mLowPowerModeEnabled)
.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
mContext.sendBroadcast(intent);
ArrayList<PowerManagerInternal.LowPowerModeListener> listeners;
synchronized (mLock) {
listeners = new ArrayList<PowerManagerInternal.LowPowerModeListener>(
mLowPowerModeListeners);
}
for (int i=0; i<listeners.size(); i++) {
listeners.get(i).onLowPowerModeChanged(lowPowerModeEnabled);
}
intent = new Intent(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
mContext.sendBroadcast(intent);
}
});
}
}
private void handleSettingsChangedLocked() {
updateSettingsLocked();
updatePowerStateLocked();
}
private void acquireWakeLockInternal(IBinder lock, int flags, String tag, String packageName,
WorkSource ws, String historyTag, int uid, int pid) {
synchronized (mLock) {
if (DEBUG_SPEW) {
Slog.d(TAG, "acquireWakeLockInternal: lock=" + Objects.hashCode(lock)
+ ", flags=0x" + Integer.toHexString(flags)
+ ", tag=\"" + tag + "\", ws=" + ws + ", uid=" + uid + ", pid=" + pid);
}
WakeLock wakeLock;
int index = findWakeLockIndexLocked(lock);
boolean notifyAcquire;
if (index >= 0) {
wakeLock = mWakeLocks.get(index);
if (!wakeLock.hasSameProperties(flags, tag, ws, uid, pid)) {
// Update existing wake lock. This shouldn't happen but is harmless.
notifyWakeLockChangingLocked(wakeLock, flags, tag, packageName,
uid, pid, ws, historyTag);
wakeLock.updateProperties(flags, tag, packageName, ws, historyTag, uid, pid);
}
notifyAcquire = false;
} else {
wakeLock = new WakeLock(lock, flags, tag, packageName, ws, historyTag, uid, pid);
try {
lock.linkToDeath(wakeLock, 0);
} catch (RemoteException ex) {
throw new IllegalArgumentException("Wake lock is already dead.");
}
mWakeLocks.add(wakeLock);
notifyAcquire = true;
wakeLock.mActiveSince = SystemClock.uptimeMillis();
}
applyWakeLockFlagsOnAcquireLocked(wakeLock, uid);
mDirty |= DIRTY_WAKE_LOCKS;
updatePowerStateLocked();
if (notifyAcquire) {
// This needs to be done last so we are sure we have acquired the
// kernel wake lock. Otherwise we have a race where the system may
// go to sleep between the time we start the accounting in battery
// stats and when we actually get around to telling the kernel to
// stay awake.
notifyWakeLockAcquiredLocked(wakeLock);
}
}
}
@SuppressWarnings("deprecation")
private static boolean isScreenLock(final WakeLock wakeLock) {
switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
case PowerManager.FULL_WAKE_LOCK:
case PowerManager.SCREEN_BRIGHT_WAKE_LOCK:
case PowerManager.SCREEN_DIM_WAKE_LOCK:
return true;
}
return false;
}
private void applyWakeLockFlagsOnAcquireLocked(WakeLock wakeLock, int uid) {
if ((wakeLock.mFlags & PowerManager.ACQUIRE_CAUSES_WAKEUP) != 0
&& isScreenLock(wakeLock)) {
if (mIPOShutdown)
return;
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), uid);
}
}
private void releaseWakeLockInternal(IBinder lock, int flags) {
synchronized (mLock) {
int index = findWakeLockIndexLocked(lock);
if (index < 0) {
if (DEBUG_SPEW) {
Slog.d(TAG, "releaseWakeLockInternal: lock=" + Objects.hashCode(lock)
+ " [not found], flags=0x" + Integer.toHexString(flags));
}
return;
}
WakeLock wakeLock = mWakeLocks.get(index);
wakeLock.mTotalTime = SystemClock.uptimeMillis() - wakeLock.mActiveSince;
if (DEBUG_SPEW) {
Slog.d(TAG, "releaseWakeLockInternal: lock=" + Objects.hashCode(lock)
+ " [" + wakeLock.mTag + "], flags=0x" + Integer.toHexString(flags) + ", total_time=" + wakeLock.mTotalTime + "ms");
}
if ((flags & PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY) != 0) {
mRequestWaitForNegativeProximity = true;
}
wakeLock.mLock.unlinkToDeath(wakeLock, 0);
removeWakeLockLocked(wakeLock, index);
}
}
private void handleWakeLockDeath(WakeLock wakeLock) {
synchronized (mLock) {
if (DEBUG_SPEW) {
Slog.d(TAG, "handleWakeLockDeath: lock=" + Objects.hashCode(wakeLock.mLock)
+ " [" + wakeLock.mTag + "]");
}
int index = mWakeLocks.indexOf(wakeLock);
if (index < 0) {
return;
}
removeWakeLockLocked(wakeLock, index);
}
}
private void removeWakeLockLocked(WakeLock wakeLock, int index) {
mWakeLocks.remove(index);
notifyWakeLockReleasedLocked(wakeLock);
applyWakeLockFlagsOnReleaseLocked(wakeLock);
mDirty |= DIRTY_WAKE_LOCKS;
updatePowerStateLocked();
}
private void applyWakeLockFlagsOnReleaseLocked(WakeLock wakeLock) {
if ((wakeLock.mFlags & PowerManager.ON_AFTER_RELEASE) != 0
&& isScreenLock(wakeLock)) {
userActivityNoUpdateLocked(SystemClock.uptimeMillis(),
PowerManager.USER_ACTIVITY_EVENT_OTHER,
PowerManager.USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS,
wakeLock.mOwnerUid);
}
}
private void updateWakeLockWorkSourceInternal(IBinder lock, WorkSource ws, String historyTag,
int callingUid) {
synchronized (mLock) {
int index = findWakeLockIndexLocked(lock);
if (index < 0) {
if (DEBUG_SPEW) {
Slog.d(TAG, "updateWakeLockWorkSourceInternal: lock=" + Objects.hashCode(lock)
+ " [not found], ws=" + ws);
}
throw new IllegalArgumentException("Wake lock not active: " + lock
+ " from uid " + callingUid);
}
WakeLock wakeLock = mWakeLocks.get(index);
if (DEBUG_SPEW) {
Slog.d(TAG, "updateWakeLockWorkSourceInternal: lock=" + Objects.hashCode(lock)
+ " [" + wakeLock.mTag + "], ws=" + ws);
}
if (!wakeLock.hasSameWorkSource(ws)) {
notifyWakeLockChangingLocked(wakeLock, wakeLock.mFlags, wakeLock.mTag,
wakeLock.mPackageName, wakeLock.mOwnerUid, wakeLock.mOwnerPid,
ws, historyTag);
wakeLock.mHistoryTag = historyTag;
wakeLock.updateWorkSource(ws);
}
}
}
private int findWakeLockIndexLocked(IBinder lock) {
final int count = mWakeLocks.size();
for (int i = 0; i < count; i++) {
if (mWakeLocks.get(i).mLock == lock) {
return i;
}
}
return -1;
}
private void notifyWakeLockAcquiredLocked(WakeLock wakeLock) {
if (mSystemReady) {
wakeLock.mNotifiedAcquired = true;
mNotifier.onWakeLockAcquired(wakeLock.mFlags, wakeLock.mTag, wakeLock.mPackageName,
wakeLock.mOwnerUid, wakeLock.mOwnerPid, wakeLock.mWorkSource,
wakeLock.mHistoryTag);
}
}
private void notifyWakeLockChangingLocked(WakeLock wakeLock, int flags, String tag,
String packageName, int uid, int pid, WorkSource ws, String historyTag) {
if (mSystemReady && wakeLock.mNotifiedAcquired) {
mNotifier.onWakeLockChanging(wakeLock.mFlags, wakeLock.mTag, wakeLock.mPackageName,
wakeLock.mOwnerUid, wakeLock.mOwnerPid, wakeLock.mWorkSource,
wakeLock.mHistoryTag, flags, tag, packageName, uid, pid, ws, historyTag);
}
}
private void notifyWakeLockReleasedLocked(WakeLock wakeLock) {
if (mSystemReady && wakeLock.mNotifiedAcquired) {
wakeLock.mNotifiedAcquired = false;
mNotifier.onWakeLockReleased(wakeLock.mFlags, wakeLock.mTag,
wakeLock.mPackageName, wakeLock.mOwnerUid, wakeLock.mOwnerPid,
wakeLock.mWorkSource, wakeLock.mHistoryTag);
}
}
private void dumpWakeLockLocked() {
final int numWakeLocks = mWakeLocks.size();
if (numWakeLocks > 0) {
Slog.d(TAG, "wakelock list dump: mLocks.size=" + numWakeLocks + ":");
} else {
return;
}
for (int i = 0; i < numWakeLocks; i++) {
final WakeLock wakeLock = mWakeLocks.get(i);
String type = "";
switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
case PowerManager.PARTIAL_WAKE_LOCK:
type = "PARTIAL_WAKE_LOCK";
break;
case PowerManager.FULL_WAKE_LOCK:
type = "FULL_WAKE_LOCK";
break;
case PowerManager.SCREEN_BRIGHT_WAKE_LOCK:
type = "SCREEN_BRIGHT_WAKE_LOCK";
break;
case PowerManager.SCREEN_DIM_WAKE_LOCK:
type = "SCREEN_DIM_WAKE_LOCK";
break;
case PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK:
type = "PROXIMITY_SCREEN_OFF_WAKE_LOCK";
break;
case PowerManager.DOZE_WAKE_LOCK:
type = "DOZE_WAKE_LOCK";
break;
}
long total_time = SystemClock.uptimeMillis() - wakeLock.mActiveSince;
Slog.d(TAG, "No." + i + ": " + type + " '" + wakeLock.mTag + "'"
+ "activated" + "(flags=" + wakeLock.mFlags
+ ", uid=" + wakeLock.mOwnerUid + ", pid=" + wakeLock.mOwnerPid + ")" + " total=" + total_time + "ms)");
}
}
private boolean canBrightnessOverRange() {
if (isWfdEnabled())
return true;
return false;
}
private boolean isWfdEnabled() {
boolean enabled = false;
DisplayManager mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
WifiDisplayStatus mWfdStatus = mDisplayManager.getWifiDisplayStatus();
enabled = (WifiDisplayStatus.DISPLAY_STATE_CONNECTED == mWfdStatus.getActiveDisplayState());
Slog.d(TAG, "isWfdEnabled() mWfdStatus=" + mWfdStatus + ", return " + enabled);
return enabled;
}
@SuppressWarnings("deprecation")
private boolean isWakeLockLevelSupportedInternal(int level) {
synchronized (mLock) {
switch (level) {
case PowerManager.PARTIAL_WAKE_LOCK:
case PowerManager.SCREEN_DIM_WAKE_LOCK:
case PowerManager.SCREEN_BRIGHT_WAKE_LOCK:
case PowerManager.FULL_WAKE_LOCK:
case PowerManager.DOZE_WAKE_LOCK:
return true;
case PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK:
return mSystemReady && mDisplayManagerInternal.isProximitySensorAvailable();
default:
return false;
}
}
}
// Called from native code.
private void userActivityFromNative(long eventTime, int event, int flags) {
if (DEBUG_SPEW) {
Slog.d(TAG, "userActivityFromNative");
}
userActivityInternal(eventTime, event, flags, Process.SYSTEM_UID);
}
private void userActivityInternal(long eventTime, int event, int flags, int uid) {
synchronized (mLock) {
if (userActivityNoUpdateLocked(eventTime, event, flags, uid)) {
updatePowerStateLocked();
}
}
}
private boolean userActivityNoUpdateLocked(long eventTime, int event, int flags, int uid) {
if (DEBUG_SPEW) {
Slog.d(TAG, "userActivityNoUpdateLocked: eventTime=" + eventTime
+ ", event=" + event + ", flags=0x" + Integer.toHexString(flags)
+ ", uid=" + uid);
}
if (eventTime < mLastSleepTime || eventTime < mLastWakeTime
|| !mBootCompleted || !mSystemReady) {
return false;
}
Trace.traceBegin(Trace.TRACE_TAG_POWER, "userActivity");
try {
if (eventTime > mLastInteractivePowerHintTime) {
powerHintInternal(POWER_HINT_INTERACTION, 0);
mLastInteractivePowerHintTime = eventTime;
}
mNotifier.onUserActivity(event, uid);
if (mWakefulness == WAKEFULNESS_ASLEEP
|| mWakefulness == WAKEFULNESS_DOZING
|| (flags & PowerManager.USER_ACTIVITY_FLAG_INDIRECT) != 0) {
return false;
}
if ((flags & PowerManager.USER_ACTIVITY_FLAG_NO_CHANGE_LIGHTS) != 0) {
if (eventTime > mLastUserActivityTimeNoChangeLights
&& eventTime > mLastUserActivityTime) {
mLastUserActivityTimeNoChangeLights = eventTime;
mDirty |= DIRTY_USER_ACTIVITY;
return true;
}
} else {
if (eventTime > mLastUserActivityTime) {
mLastUserActivityTime = eventTime;
mDirty |= DIRTY_USER_ACTIVITY;
if (event == PowerManager.USER_ACTIVITY_EVENT_BUTTON) {
mLastUserActivityButtonTime = eventTime;
}
return true;
}
}
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
return false;
}
// Called from native code.
private void setSmartBookScreenFromNative(int cmd, int timeout) {
synchronized (mLock) {
if (DEBUG) {
StackTraceElement[] stack = new Throwable().getStackTrace();
for (StackTraceElement element : stack)
{
Slog.d(TAG, " |----" + element.toString());
}
Slog.d(TAG, "setSmartBookScreenFromNative (cmd =" + cmd + ", timeout = " + timeout);
}
if (cmd == SMARTBOOK_SCREEN_ON) {
setSmartBookScreenInternal(true);
} else if (cmd == SMARTBOOK_SCREEN_OFF) {
setSmartBookScreenInternal(false);
} else {
Slog.i(TAG, "setSmartBookScreenFromNative cmd not defined (cmd = " + cmd + ")");
}
if (SystemProperties.getBoolean("persist.smb.phone.both.on", false)) {
if (cmd == SMARTBOOK_SCREEN_ON) {
if (DEBUG_SPEW) {
Slog.i(TAG, "setSmartBookScreenFromNative: turn on phone screen...");
}
wakeUpByReasonInternal(SystemClock.uptimeMillis(), PowerManager.WAKE_UP_REASON_SMARTBOOK);
}
}
userActivityNoUpdateLocked(
SystemClock.uptimeMillis(), PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
mDirty |= DIRTY_SMARTBOOK_STATE;
updatePowerStateLocked();
}
}
private void setSmartBookScreenInternal(boolean on) {
if (mIPOShutdown) {
return;
}
synchronized (mLock) {
if (on) {
if (mSmartBookSleeped) {
Slog.i(TAG, "setSmartBookScreenInternal (on = " + on + ")");
nativeSetSmartBookScreen(SMARTBOOK_SCREEN_ON, 0);
mSmartBookSleeped = false;
userActivityNoUpdateLocked(
SystemClock.uptimeMillis(), PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
}
} else {
if (!mSmartBookSleeped) {
Slog.i(TAG, "setSmartBookScreenInternal (on = " + on + ")");
nativeSetSmartBookScreen(SMARTBOOK_SCREEN_OFF, 0);
mSmartBookSleeped = true;
}
}
}
}
private void wakeUpByReasonInternal(long eventTime, int reason) {
if (DEBUG) {
StackTraceElement[] stack = new Throwable().getStackTrace();
for (StackTraceElement element : stack)
{
Slog.d(TAG, " |----" + element.toString());
}
Slog.d(TAG, "wakeUpByReasonInternal in (eventTime = " + eventTime + ", reason = " + reason + ")");
}
if (reason == PowerManager.WAKE_UP_REASON_SMARTBOOK) {
if (mIPOShutdown)
return;
synchronized (mLock) {
Slog.d(TAG, "wakeUpByReasonInternal - nativeSetSmartBookMode");
nativeSetSmartBookMode(false);
/* Turn on backlight */
Slog.d(TAG, "smart book mode: turn on lcd backlight");
mSmartBookForceBacklightOff = false;
if (mSmartBookSleeped) {
Slog.d(TAG, "setSmartBookScreenFromNative: turn on smart book screen...");
nativeSetSmartBookScreen(SMARTBOOK_SCREEN_ON, 0);
mSmartBookSleeped = false;
} else {
/* do nothing, smart book screen is still on */
}
Slog.d(TAG, "wakeUpByReasonInternal - out");
userActivityNoUpdateLocked(
eventTime, PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
updatePowerStateLocked();
}
} else if (reason == PowerManager.WAKE_UP_REASON_SHUTDOWN) {
synchronized (mLock) {
mShutdownFlag = false;
Slog.d(TAG, "mShutdownFlag = " + mShutdownFlag);
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
} else {
Slog.d(TAG, "wakeUpByReasonInternal: reason = " + reason + " not support");
}
}
private void wakeUpInternal(long eventTime, int uid) {
if (mIPOShutdown)
return;
synchronized (mLock) {
if (wakeUpNoUpdateLocked(eventTime, uid)) {
updatePowerStateLocked();
}
}
}
private boolean wakeUpNoUpdateLocked(long eventTime, int uid) {
if (mSmartBookPlugState) {
if (DEBUG_SPEW) {
Slog.d(TAG, "smart book mode: mark mWakefulness as WAKEFULNESS_AWAKE but skip formal wakeUp flow");
}
mWakefulness = WAKEFULNESS_AWAKE;
return false;
}
if (DEBUG) {
StackTraceElement[] stack = new Throwable().getStackTrace();
for (StackTraceElement element : stack)
{
Slog.d(TAG, " |----" + element.toString());
}
}
if (DEBUG_SPEW) {
Slog.d(TAG, "wakeUpNoUpdateLocked: eventTime=" + eventTime + ", uid=" + uid);
}
if (eventTime < mLastSleepTime || mWakefulness == WAKEFULNESS_AWAKE
|| !mBootCompleted || !mSystemReady) {
return false;
}
Trace.traceBegin(Trace.TRACE_TAG_POWER, "wakeUp");
try {
switch (mWakefulness) {
case WAKEFULNESS_ASLEEP:
Slog.i(TAG, "Waking up from sleep (uid " + uid +")...");
break;
case WAKEFULNESS_DREAMING:
Slog.i(TAG, "Waking up from dream (uid " + uid +")...");
break;
case WAKEFULNESS_DOZING:
Slog.i(TAG, "Waking up from dozing (uid " + uid +")...");
break;
}
mLastWakeTime = eventTime;
setWakefulnessLocked(WAKEFULNESS_AWAKE, 0);
userActivityNoUpdateLocked(
eventTime, PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, uid);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
return true;
}
private void goToSleepInternal(long eventTime, int reason, int flags, int uid) {
synchronized (mLock) {
if (mProximityPositive && reason == PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON) {
Slog.d(TAG, "Proximity positive sleep and force wakeup by power button");
mDirty |= DIRTY_WAKEFULNESS;
mWakefulness = WAKEFULNESS_ASLEEP;
updatePowerStateLocked();
return;
}
if (goToSleepNoUpdateLocked(eventTime, reason, flags, uid)) {
updatePowerStateLocked();
}
}
}
// This method is called goToSleep for historical reasons but we actually start
// dozing before really going to sleep.
@SuppressWarnings("deprecation")
private boolean goToSleepNoUpdateLocked(long eventTime, int reason, int flags, int uid) {
if (DEBUG) {
StackTraceElement[] stack = new Throwable().getStackTrace();
for (StackTraceElement element : stack)
{
Slog.d(TAG, " |----" + element.toString());
}
}
if (DEBUG_SPEW) {
Slog.d(TAG, "goToSleepNoUpdateLocked: eventTime=" + eventTime
+ ", reason=" + reason + ", flags=" + flags + ", uid=" + uid);
}
if (reason == PowerManager.GO_TO_SLEEP_REASON_SMARTBOOK) {
Slog.i(TAG, "Going to sleep due to smart book (uid " + uid +")...");
/* Turn off button backlight */
Slog.d(TAG, "Turn off button backlight");
mButtonLight.turnOff();
/* Turn off backlight */
Slog.d(TAG, "Turn off screen backlight");
mSmartBookForceBacklightOff = true;
Slog.d(TAG, "Invoke low-level smartbook mode sleep");
nativeSetSmartBookMode(true);
Slog.d(TAG, "Smartbook mode sleep completion");
return true;
} else if (reason == PowerManager.GO_TO_SLEEP_REASON_SHUTDOWN) {
mDirty |= DIRTY_SETTINGS;
mShutdownFlag = true;
Slog.d(TAG, "mShutdownFlag = " + mShutdownFlag);
return true;
}
if (eventTime < mLastWakeTime
|| mWakefulness == WAKEFULNESS_ASLEEP
|| mWakefulness == WAKEFULNESS_DOZING
|| !mBootCompleted || !mSystemReady
|| mSmartBookPlugState) {
return false;
}
Trace.traceBegin(Trace.TRACE_TAG_POWER, "goToSleep");
try {
switch (reason) {
case PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN:
Slog.i(TAG, "Going to sleep due to device administration policy "
+ "(uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_TIMEOUT:
Slog.i(TAG, "Going to sleep due to screen timeout (uid " + uid +")...");
case PowerManager.GO_TO_SLEEP_REASON_LID_SWITCH:
Slog.i(TAG, "Going to sleep due to lid switch (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON:
Slog.i(TAG, "Going to sleep due to power button (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_HDMI:
Slog.i(TAG, "Going to sleep due to HDMI standby (uid " + uid +")...");
break;
case PowerManager.GO_TO_SLEEP_REASON_PROXIMITY:
Slog.i(TAG, "Going to sleep due to proximity (uid " + uid +")...");
break;
default:
Slog.i(TAG, "Going to sleep by application request (uid " + uid +")...");
reason = PowerManager.GO_TO_SLEEP_REASON_APPLICATION;
break;
}
mLastSleepTime = eventTime;
mSandmanSummoned = true;
setWakefulnessLocked(WAKEFULNESS_DOZING, reason);
// Report the number of wake locks that will be cleared by going to sleep.
int numWakeLocksCleared = 0;
final int numWakeLocks = mWakeLocks.size();
for (int i = 0; i < numWakeLocks; i++) {
final WakeLock wakeLock = mWakeLocks.get(i);
switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
case PowerManager.FULL_WAKE_LOCK:
case PowerManager.SCREEN_BRIGHT_WAKE_LOCK:
case PowerManager.SCREEN_DIM_WAKE_LOCK:
numWakeLocksCleared += 1;
break;
}
}
EventLog.writeEvent(EventLogTags.POWER_SLEEP_REQUESTED, numWakeLocksCleared);
// Wakelock debug
dumpWakeLockLocked();
// Skip dozing if requested.
if ((flags & PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE) != 0) {
reallyGoToSleepNoUpdateLocked(eventTime, uid);
}
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
return true;
}
private void napInternal(long eventTime, int uid) {
synchronized (mLock) {
if (napNoUpdateLocked(eventTime, uid)) {
updatePowerStateLocked();
}
}
}
private boolean napNoUpdateLocked(long eventTime, int uid) {
if (DEBUG_SPEW) {
Slog.d(TAG, "napNoUpdateLocked: eventTime=" + eventTime + ", uid=" + uid);
}
if (eventTime < mLastWakeTime || mWakefulness != WAKEFULNESS_AWAKE
|| !mBootCompleted || !mSystemReady) {
return false;
}
Trace.traceBegin(Trace.TRACE_TAG_POWER, "nap");
try {
Slog.i(TAG, "Nap time (uid " + uid +")...");
mSandmanSummoned = true;
setWakefulnessLocked(WAKEFULNESS_DREAMING, 0);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
return true;
}
// Done dozing, drop everything and go to sleep.
private boolean reallyGoToSleepNoUpdateLocked(long eventTime, int uid) {
if (DEBUG_SPEW) {
Slog.d(TAG, "reallyGoToSleepNoUpdateLocked: eventTime=" + eventTime
+ ", uid=" + uid);
}
if (eventTime < mLastWakeTime || mWakefulness == WAKEFULNESS_ASLEEP
|| !mBootCompleted || !mSystemReady) {
return false;
}
Trace.traceBegin(Trace.TRACE_TAG_POWER, "reallyGoToSleep");
try {
Slog.i(TAG, "Sleeping (uid " + uid +")...");
setWakefulnessLocked(WAKEFULNESS_ASLEEP, PowerManager.GO_TO_SLEEP_REASON_TIMEOUT);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
return true;
}
private void setWakefulnessLocked(int wakefulness, int reason) {
if (mWakefulness != wakefulness) {
finishWakefulnessChangeLocked();
mWakefulness = wakefulness;
mWakefulnessChanging = true;
mDirty |= DIRTY_WAKEFULNESS;
mNotifier.onWakefulnessChangeStarted(wakefulness, reason);
}
}
private void finishWakefulnessChangeLocked() {
if (mWakefulnessChanging) {
mNotifier.onWakefulnessChangeFinished(mWakefulness);
mWakefulnessChanging = false;
}
}
/**
* Updates the global power state based on dirty bits recorded in mDirty.
*
* This is the main function that performs power state transitions.
* We centralize them here so that we can recompute the power state completely
* each time something important changes, and ensure that we do it the same
* way each time. The point is to gather all of the transition logic here.
*/
private void updatePowerStateLocked() {
if (!mSystemReady || mDirty == 0) {
return;
}
if (!Thread.holdsLock(mLock)) {
Slog.wtf(TAG, "Power manager lock was not held when calling updatePowerStateLocked");
}
Trace.traceBegin(Trace.TRACE_TAG_POWER, "updatePowerState");
try {
// Phase 0: Basic state updates.
updateIsPoweredLocked(mDirty);
updateStayOnLocked(mDirty);
updateScreenBrightnessBoostLocked(mDirty);
// Phase 1: Update wakefulness.
// Loop because the wake lock and user activity computations are influenced
// by changes in wakefulness.
final long now = SystemClock.uptimeMillis();
int dirtyPhase2 = 0;
for (;;) {
int dirtyPhase1 = mDirty;
dirtyPhase2 |= dirtyPhase1;
mDirty = 0;
updateWakeLockSummaryLocked(dirtyPhase1);
updateUserActivitySummaryLocked(now, dirtyPhase1);
if (!updateWakefulnessLocked(dirtyPhase1)) {
break;
}
}
// Phase 2: Update display power state.
boolean displayBecameReady = updateDisplayPowerStateLocked(dirtyPhase2);
// Phase 3: Update dream state (depends on display ready signal).
updateDreamLocked(dirtyPhase2, displayBecameReady);
// Phase 4: Send notifications, if needed.
if (mDisplayReady) {
finishWakefulnessChangeLocked();
}
// Phase 5: Update suspend blocker.
// Because we might release the last suspend blocker here, we need to make sure
// we finished everything else first!
updateSuspendBlockerLocked();
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
}
/**
* Updates the value of mIsPowered.
* Sets DIRTY_IS_POWERED if a change occurred.
*/
private void updateIsPoweredLocked(int dirty) {
if ((dirty & DIRTY_BATTERY_STATE) != 0) {
final boolean wasPowered = mIsPowered;
final int oldPlugType = mPlugType;
final boolean oldLevelLow = mBatteryLevelLow;
mIsPowered = mBatteryManagerInternal.isPowered(BatteryManager.BATTERY_PLUGGED_ANY);
mPlugType = mBatteryManagerInternal.getPlugType();
mBatteryLevel = mBatteryManagerInternal.getBatteryLevel();
mBatteryLevelLow = mBatteryManagerInternal.getBatteryLevelLow();
if (DEBUG_SPEW) {
Slog.d(TAG, "updateIsPoweredLocked: wasPowered=" + wasPowered
+ ", mIsPowered=" + mIsPowered
+ ", oldPlugType=" + oldPlugType
+ ", mPlugType=" + mPlugType
+ ", mBatteryLevel=" + mBatteryLevel);
}
if (wasPowered != mIsPowered || oldPlugType != mPlugType) {
mDirty |= DIRTY_IS_POWERED;
// Update wireless dock detection state.
final boolean dockedOnWirelessCharger = mWirelessChargerDetector.update(
mIsPowered, mPlugType, mBatteryLevel);
// Treat plugging and unplugging the devices as a user activity.
// Users find it disconcerting when they plug or unplug the device
// and it shuts off right away.
// Some devices also wake the device when plugged or unplugged because
// they don't have a charging LED.
final long now = SystemClock.uptimeMillis();
if (shouldWakeUpWhenPluggedOrUnpluggedLocked(wasPowered, oldPlugType,
dockedOnWirelessCharger)) {
wakeUpNoUpdateLocked(now, Process.SYSTEM_UID);
}
userActivityNoUpdateLocked(
now, PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
// Tell the notifier whether wireless charging has started so that
// it can provide feedback to the user.
if (dockedOnWirelessCharger) {
mNotifier.onWirelessChargingStarted();
}
}
if (wasPowered != mIsPowered || oldLevelLow != mBatteryLevelLow) {
if (oldLevelLow != mBatteryLevelLow && !mBatteryLevelLow) {
if (DEBUG_SPEW) {
Slog.d(TAG, "updateIsPoweredLocked: resetting low power snooze");
}
mAutoLowPowerModeSnoozing = false;
}
updateLowPowerModeLocked();
}
}
}
private boolean shouldWakeUpWhenPluggedOrUnpluggedLocked(
boolean wasPowered, int oldPlugType, boolean dockedOnWirelessCharger) {
// Don't wake when powered unless configured to do so.
if (!mWakeUpWhenPluggedOrUnpluggedConfig) {
return false;
}
// Don't wake when undocked from wireless charger.
// See WirelessChargerDetector for justification.
if (wasPowered && !mIsPowered
&& oldPlugType == BatteryManager.BATTERY_PLUGGED_WIRELESS) {
return false;
}
// Don't wake when docked on wireless charger unless we are certain of it.
// See WirelessChargerDetector for justification.
if (!wasPowered && mIsPowered
&& mPlugType == BatteryManager.BATTERY_PLUGGED_WIRELESS
&& !dockedOnWirelessCharger) {
return false;
}
// If already dreaming and becoming powered, then don't wake.
if (mIsPowered && mWakefulness == WAKEFULNESS_DREAMING) {
return false;
}
// Don't wake while theater mode is enabled.
if (mTheaterModeEnabled && !mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig) {
return false;
}
// Otherwise wake up!
return true;
}
/**
* Updates the value of mStayOn.
* Sets DIRTY_STAY_ON if a change occurred.
*/
private void updateStayOnLocked(int dirty) {
if ((dirty & (DIRTY_BATTERY_STATE | DIRTY_SETTINGS)) != 0) {
final boolean wasStayOn = mStayOn;
if (mStayOnWhilePluggedInSetting != 0
&& !isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) {
mStayOn = mBatteryManagerInternal.isPowered(mStayOnWhilePluggedInSetting);
} else {
mStayOn = false;
}
if (mStayOn != wasStayOn) {
mDirty |= DIRTY_STAY_ON;
}
}
}
/**
* Updates the value of mWakeLockSummary to summarize the state of all active wake locks.
* Note that most wake-locks are ignored when the system is asleep.
*
* This function must have no other side-effects.
*/
@SuppressWarnings("deprecation")
private void updateWakeLockSummaryLocked(int dirty) {
if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_WAKEFULNESS)) != 0) {
mWakeLockSummary = 0;
final int numWakeLocks = mWakeLocks.size();
for (int i = 0; i < numWakeLocks; i++) {
final WakeLock wakeLock = mWakeLocks.get(i);
switch (wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
case PowerManager.PARTIAL_WAKE_LOCK:
mWakeLockSummary |= WAKE_LOCK_CPU;
break;
case PowerManager.FULL_WAKE_LOCK:
mWakeLockSummary |= WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_BUTTON_BRIGHT;
break;
case PowerManager.SCREEN_BRIGHT_WAKE_LOCK:
mWakeLockSummary |= WAKE_LOCK_SCREEN_BRIGHT;
break;
case PowerManager.SCREEN_DIM_WAKE_LOCK:
mWakeLockSummary |= WAKE_LOCK_SCREEN_DIM;
break;
case PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK:
mWakeLockSummary |= WAKE_LOCK_PROXIMITY_SCREEN_OFF;
break;
case PowerManager.DOZE_WAKE_LOCK:
mWakeLockSummary |= WAKE_LOCK_DOZE;
break;
}
}
// Cancel wake locks that make no sense based on the current state.
if (mWakefulness != WAKEFULNESS_DOZING) {
mWakeLockSummary &= ~WAKE_LOCK_DOZE;
}
if (mWakefulness == WAKEFULNESS_ASLEEP
|| (mWakeLockSummary & WAKE_LOCK_DOZE) != 0) {
mWakeLockSummary &= ~(WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM
| WAKE_LOCK_BUTTON_BRIGHT);
if (mWakefulness == WAKEFULNESS_ASLEEP) {
/* Power Key Force Wakeup to Keep Proximity Wakelock */
// mWakeLockSummary &= ~WAKE_LOCK_PROXIMITY_SCREEN_OFF;
}
}
// Infer implied wake locks where necessary based on the current state.
if ((mWakeLockSummary & (WAKE_LOCK_SCREEN_BRIGHT | WAKE_LOCK_SCREEN_DIM)) != 0) {
if (mWakefulness == WAKEFULNESS_AWAKE) {
mWakeLockSummary |= WAKE_LOCK_CPU | WAKE_LOCK_STAY_AWAKE;
} else if (mWakefulness == WAKEFULNESS_DREAMING) {
mWakeLockSummary |= WAKE_LOCK_CPU;
}
}
if (DEBUG_SPEW) {
Slog.d(TAG, "updateWakeLockSummaryLocked: mWakefulness="
+ PowerManagerInternal.wakefulnessToString(mWakefulness)
+ ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary));
}
}
}
/*
* Check if system should be always on
*/
private boolean bypassUserActivityTimeout() {
if (mStayOnWithoutDim) {
Slog.d(TAG, "bypass UserActivityTimeout because of setting");
return true;
} else if (SystemProperties.getBoolean("persist.keep.awake", false)) {
Slog.d(TAG, "bypass UserActivityTimeout because of system property request");
return true;
}
return false;
}
/**
* Updates the value of mUserActivitySummary to summarize the user requested
* state of the system such as whether the screen should be bright or dim.
* Note that user activity is ignored when the system is asleep.
*
* This function must have no other side-effects.
*/
private void updateUserActivitySummaryLocked(long now, int dirty) {
// Update the status of the user activity timeout timer.
if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY
| DIRTY_WAKEFULNESS | DIRTY_SETTINGS)) != 0) {
mHandler.removeMessages(MSG_USER_ACTIVITY_TIMEOUT);
long nextTimeout = 0;
if (mSmartBookPlugState) {
if (!mSmartBookSleeped) {
final int sleepTimeout = getSleepTimeoutLocked();
final int screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout);
nextTimeout = mLastUserActivityTime + screenOffTimeout;
mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
Message msg = mHandler.obtainMessage(MSG_USER_ACTIVITY_TIMEOUT);
msg.setAsynchronous(true);
mHandler.sendMessageAtTime(msg, nextTimeout);
}
return;
}
if (mWakefulness == WAKEFULNESS_AWAKE
|| mWakefulness == WAKEFULNESS_DREAMING
|| mWakefulness == WAKEFULNESS_DOZING) {
final int sleepTimeout = getSleepTimeoutLocked();
final int screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout);
final int screenDimDuration = getScreenDimDurationLocked(screenOffTimeout);
final int screenButtonLightDuration = getButtonLightDurationLocked(screenOffTimeout);
mUserActivitySummary = 0;
if (mLastUserActivityTime >= mLastWakeTime) {
if ( (mLastUserActivityButtonTime >= mLastWakeTime) && (now < mLastUserActivityButtonTime + screenButtonLightDuration) ) {
mUserActivitySummary |= USER_ACTIVITY_BUTTON_BRIGHT;
mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
nextTimeout = mLastUserActivityButtonTime + screenButtonLightDuration;
} else if (now < mLastUserActivityTime + screenOffTimeout - screenDimDuration) {
nextTimeout = mLastUserActivityTime + screenOffTimeout - screenDimDuration;
mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
} else {
nextTimeout = mLastUserActivityTime + screenOffTimeout;
if (now < nextTimeout) {
mUserActivitySummary |= USER_ACTIVITY_SCREEN_DIM;
}
}
}
if (mUserActivitySummary == 0
&& mLastUserActivityTimeNoChangeLights >= mLastWakeTime) {
nextTimeout = mLastUserActivityTimeNoChangeLights + screenOffTimeout;
if (now < nextTimeout) {
if (mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_BRIGHT) {
mUserActivitySummary = USER_ACTIVITY_SCREEN_BRIGHT;
} else if (mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_DIM) {
mUserActivitySummary = USER_ACTIVITY_SCREEN_DIM;
}
}
}
if (mUserActivitySummary == 0) {
if (sleepTimeout >= 0) {
final long anyUserActivity = Math.max(mLastUserActivityTime,
mLastUserActivityTimeNoChangeLights);
if (anyUserActivity >= mLastWakeTime) {
nextTimeout = anyUserActivity + sleepTimeout;
if (now < nextTimeout) {
mUserActivitySummary = USER_ACTIVITY_SCREEN_DREAM;
}
}
} else {
mUserActivitySummary = USER_ACTIVITY_SCREEN_DREAM;
nextTimeout = -1;
}
}
if (mUserActivitySummary != 0 && nextTimeout >= 0) {
Message msg = mHandler.obtainMessage(MSG_USER_ACTIVITY_TIMEOUT);
msg.setAsynchronous(true);
mHandler.sendMessageAtTime(msg, nextTimeout);
}
} else {
mUserActivitySummary = 0;
}
if (DEBUG_SPEW) {
Slog.d(TAG, "updateUserActivitySummaryLocked: mWakefulness="
+ PowerManagerInternal.wakefulnessToString(mWakefulness)
+ ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary)
+ ", nextTimeout=" + TimeUtils.formatUptime(nextTimeout));
}
}
}
/**
* Called when a user activity timeout has occurred.
* Simply indicates that something about user activity has changed so that the new
* state can be recomputed when the power state is updated.
*
* This function must have no other side-effects besides setting the dirty
* bit and calling update power state. Wakefulness transitions are handled elsewhere.
*/
private void handleUserActivityTimeout() { // runs on handler thread
synchronized (mLock) {
if (!mSmartBookPlugState) {
if (DEBUG_SPEW) {
Slog.d(TAG, "handleUserActivityTimeout");
}
mDirty |= DIRTY_USER_ACTIVITY;
updatePowerStateLocked();
} else {
if ((mWakeLockSummary & WAKE_LOCK_STAY_AWAKE) == 0) {
/* Handle smart book screen off timeout */
if (DEBUG_SPEW) {
Slog.d(TAG, "handleUserActivityTimeout - SmartBook");
}
/* If dreaming is on-going, do not turn off smart book screen */
boolean isDreaming = false;
if (mDreamManager != null) {
isDreaming = mDreamManager.isDreaming();
}
if (isDreaming) {
if (DEBUG_SPEW) {
Slog.d(TAG, "smart book mode: dreaming is on-going, return directly");
}
} else {
/* Trigger SmartBook enter power saving mode */
if (shouldNapAtBedTimeLocked()) {
if (DEBUG_SPEW) {
Slog.d(TAG, "smart book mode: napNoUpdateLocked");
}
napNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
} else {
setSmartBookScreenInternal(false);
mDirty |= DIRTY_SMARTBOOK_STATE;
if (SystemProperties.getBoolean("persist.smb.phone.both.on", false)) {
if (DEBUG_SPEW) {
Slog.d(TAG, "smart book mode: screen off timeout, turn off phone screen together");
}
goToSleepNoUpdateLocked(SystemClock.uptimeMillis(), PowerManager.GO_TO_SLEEP_REASON_SMARTBOOK, 0, Process.SYSTEM_UID);
}
updatePowerStateLocked();
}
}
}
}
}
}
private int getSleepTimeoutLocked() {
int timeout = mSleepTimeoutSetting;
if (timeout <= 0) {
return -1;
}
return Math.max(timeout, mMinimumScreenOffTimeoutConfig);
}
private int getScreenOffTimeoutLocked(int sleepTimeout) {
int timeout = mScreenOffTimeoutSetting;
if (isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) {
timeout = Math.min(timeout, mMaximumScreenOffTimeoutFromDeviceAdmin);
}
if (mUserActivityTimeoutOverrideFromWindowManager >= 0) {
timeout = (int)Math.min(timeout, mUserActivityTimeoutOverrideFromWindowManager);
}
if (sleepTimeout >= 0) {
timeout = Math.min(timeout, sleepTimeout);
}
if (mUserActivityTimeoutMin) {
timeout = (int)Math.min(timeout, mUserActivityTimeoutOverrideFromCMD);
}
return Math.max(timeout, mMinimumScreenOffTimeoutConfig);
}
private int getScreenDimDurationLocked(int screenOffTimeout) {
return Math.min(mMaximumScreenDimDurationConfig,
(int)(screenOffTimeout * mMaximumScreenDimRatioConfig));
}
private int getButtonLightDurationLocked(int screenOffTimeout) {
return Math.min(SCREEN_BUTTON_LIGHT_DURATION,
(int)(screenOffTimeout * MAXIMUM_SCREEN_BUTTON_RATIO));
}
/**
* Updates the wakefulness of the device.
*
* This is the function that decides whether the device should start dreaming
* based on the current wake locks and user activity state. It may modify mDirty
* if the wakefulness changes.
*
* Returns true if the wakefulness changed and we need to restart power state calculation.
*/
private boolean updateWakefulnessLocked(int dirty) {
boolean changed = false;
if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_BOOT_COMPLETED
| DIRTY_WAKEFULNESS | DIRTY_STAY_ON | DIRTY_PROXIMITY_POSITIVE
| DIRTY_DOCK_STATE)) != 0) {
if (mWakefulness == WAKEFULNESS_AWAKE && isItBedTimeYetLocked()) {
if (DEBUG_SPEW) {
Slog.d(TAG, "updateWakefulnessLocked: Bed time...");
}
final long time = SystemClock.uptimeMillis();
if (shouldNapAtBedTimeLocked()) {
changed = napNoUpdateLocked(time, Process.SYSTEM_UID);
} else {
changed = goToSleepNoUpdateLocked(time,
PowerManager.GO_TO_SLEEP_REASON_TIMEOUT, 0, Process.SYSTEM_UID);
}
}
}
return changed;
}
/**
* Returns true if the device should automatically nap and start dreaming when the user
* activity timeout has expired and it's bedtime.
*/
private boolean shouldNapAtBedTimeLocked() {
return mDreamsActivateOnSleepSetting
|| (mDreamsActivateOnDockSetting
&& mDockState != Intent.EXTRA_DOCK_STATE_UNDOCKED);
}
/**
* Returns true if the device should go to sleep now.
* Also used when exiting a dream to determine whether we should go back
* to being fully awake or else go to sleep for good.
*/
private boolean isItBedTimeYetLocked() {
return mBootCompleted && !isBeingKeptAwakeLocked() && !mIPOShutdown;
}
/**
* Returns true if the device is being kept awake by a wake lock, user activity
* or the stay on while powered setting. We also keep the phone awake when
* the proximity sensor returns a positive result so that the device does not
* lock while in a phone call. This function only controls whether the device
* will go to sleep or dream which is independent of whether it will be allowed
* to suspend.
*/
private boolean isBeingKeptAwakeLocked() {
return mStayOn
|| mProximityPositive
|| (mWakeLockSummary & WAKE_LOCK_STAY_AWAKE) != 0
|| (mUserActivitySummary & (USER_ACTIVITY_SCREEN_BRIGHT
| USER_ACTIVITY_SCREEN_DIM)) != 0
|| mScreenBrightnessBoostInProgress
|| bypassUserActivityTimeout();
}
/**
* Determines whether to post a message to the sandman to update the dream state.
*/
private void updateDreamLocked(int dirty, boolean displayBecameReady) {
if ((dirty & (DIRTY_WAKEFULNESS
| DIRTY_USER_ACTIVITY
| DIRTY_WAKE_LOCKS
| DIRTY_BOOT_COMPLETED
| DIRTY_BOOT_IPO
| DIRTY_SETTINGS
| DIRTY_IS_POWERED
| DIRTY_STAY_ON
| DIRTY_SD_STATE
| DIRTY_PROXIMITY_POSITIVE
| DIRTY_BATTERY_STATE)) != 0 || displayBecameReady) {
if (mDisplayReady) {
scheduleSandmanLocked();
}
}
}
private void scheduleSandmanLocked() {
if (!mSandmanScheduled) {
mSandmanScheduled = true;
Message msg = mHandler.obtainMessage(MSG_SANDMAN);
msg.setAsynchronous(true);
mHandler.sendMessage(msg);
}
}
/**
* Called when the device enters or exits a dreaming or dozing state.
*
* We do this asynchronously because we must call out of the power manager to start
* the dream and we don't want to hold our lock while doing so. There is a risk that
* the device will wake or go to sleep in the meantime so we have to handle that case.
*/
private void handleSandman() { // runs on handler thread
// Handle preconditions.
final boolean startDreaming;
final int wakefulness;
synchronized (mLock) {
mSandmanScheduled = false;
wakefulness = mWakefulness;
if (mSandmanSummoned && mDisplayReady) {
startDreaming = canDreamLocked() || canDozeLocked();
if (DEBUG_SPEW) {
Slog.i(TAG, "handleSandman startDreaming = " + startDreaming);
}
mSandmanSummoned = false;
} else {
startDreaming = false;
}
}
// Start dreaming if needed.
// We only control the dream on the handler thread, so we don't need to worry about
// concurrent attempts to start or stop the dream.
final boolean isDreaming;
if (mDreamManager != null) {
// Restart the dream whenever the sandman is summoned.
if (startDreaming) {
mDreamManager.stopDream(false /*immediate*/);
mDreamManager.startDream(wakefulness == WAKEFULNESS_DOZING);
}
isDreaming = mDreamManager.isDreaming();
} else {
isDreaming = false;
}
// Update dream state.
synchronized (mLock) {
// Remember the initial battery level when the dream started.
if (startDreaming && isDreaming) {
mBatteryLevelWhenDreamStarted = mBatteryLevel;
if (wakefulness == WAKEFULNESS_DOZING) {
Slog.i(TAG, "Dozing...");
} else {
Slog.i(TAG, "Dreaming...");
}
}
// If preconditions changed, wait for the next iteration to determine
// whether the dream should continue (or be restarted).
if (mSandmanSummoned || mWakefulness != wakefulness) {
return; // wait for next cycle
}
// Determine whether the dream should continue.
if (wakefulness == WAKEFULNESS_DREAMING) {
if (isDreaming && canDreamLocked()) {
if (mDreamsBatteryLevelDrainCutoffConfig >= 0
&& mBatteryLevel < mBatteryLevelWhenDreamStarted
- mDreamsBatteryLevelDrainCutoffConfig
&& !isBeingKeptAwakeLocked()) {
// If the user activity timeout expired and the battery appears
// to be draining faster than it is charging then stop dreaming
// and go to sleep.
Slog.i(TAG, "Stopping dream because the battery appears to "
+ "be draining faster than it is charging. "
+ "Battery level when dream started: "
+ mBatteryLevelWhenDreamStarted + "%. "
+ "Battery level now: " + mBatteryLevel + "%.");
} else {
return; // continue dreaming
}
}
// Dream has ended or will be stopped. Update the power state.
if (isItBedTimeYetLocked()) {
Slog.i(TAG, "handleSandman: Bed time and goToSleepNoUpdateLocked");
goToSleepNoUpdateLocked(SystemClock.uptimeMillis(),
PowerManager.GO_TO_SLEEP_REASON_TIMEOUT, 0, Process.SYSTEM_UID);
updatePowerStateLocked();
} else {
Slog.i(TAG, "handleSandman: time to wakeUpNoUpdateLocked");
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
updatePowerStateLocked();
}
} else if (wakefulness == WAKEFULNESS_DOZING) {
if (isDreaming) {
return; // continue dozing
}
// Doze has ended or will be stopped. Update the power state.
reallyGoToSleepNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
updatePowerStateLocked();
}
}
// Stop dream.
if (isDreaming) {
if (DEBUG_SPEW) {
Slog.i(TAG, "handleSandman stopDream(false)");
}
mDreamManager.stopDream(false /*immediate*/);
}
}
/**
* Returns true if the device is allowed to dream in its current state.
*/
private boolean canDreamLocked() {
if (DEBUG_SPEW) {
Slog.i(TAG, "canDreamLocked mWakefulness = " + mWakefulness
+ ", mDreamsSupportedConfig = " + mDreamsSupportedConfig
+ ", mDreamsEnabledSetting = " + mDreamsEnabledSetting
+ ", mDisplayPowerRequest.isBrightOrDim() = " + mDisplayPowerRequest.isBrightOrDim()
+ ", mSmartBookForceBacklightOff = " + mSmartBookForceBacklightOff
+ ", mUserActivitySummary = " + mUserActivitySummary
+ ", mBootCompleted = " + mBootCompleted);
}
if (mWakefulness != WAKEFULNESS_DREAMING
|| !mDreamsSupportedConfig
|| !mDreamsEnabledSetting
|| (!mDisplayPowerRequest.isBrightOrDim() && !mSmartBookForceBacklightOff)
|| (mUserActivitySummary & (USER_ACTIVITY_SCREEN_BRIGHT
| USER_ACTIVITY_SCREEN_DIM | USER_ACTIVITY_SCREEN_DREAM)) == 0
|| !mBootCompleted) {
return false;
}
if (!isBeingKeptAwakeLocked()) {
if (!mIsPowered && !mDreamsEnabledOnBatteryConfig) {
return false;
}
if ((!mIsPowered)
&& mDreamsBatteryLevelMinimumWhenNotPoweredConfig >= 0
&& mBatteryLevel < mDreamsBatteryLevelMinimumWhenNotPoweredConfig) {
return false;
}
if ((mIsPowered)
&& mDreamsBatteryLevelMinimumWhenPoweredConfig >= 0
&& mBatteryLevel < mDreamsBatteryLevelMinimumWhenPoweredConfig) {
return false;
}
}
return true;
}
/**
* Returns true if the device is allowed to doze in its current state.
*/
private boolean canDozeLocked() {
return mWakefulness == WAKEFULNESS_DOZING;
}
/**
* Updates the display power state asynchronously.
* When the update is finished, mDisplayReady will be set to true. The display
* controller posts a message to tell us when the actual display power state
* has been updated so we come back here to double-check and finish up.
*
* This function recalculates the display power state each time.
*
* @return True if the display became ready.
*/
private boolean updateDisplayPowerStateLocked(int dirty) {
final boolean oldDisplayReady = mDisplayReady;
if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_WAKEFULNESS
| DIRTY_ACTUAL_DISPLAY_POWER_STATE_UPDATED | DIRTY_BOOT_COMPLETED
| DIRTY_SETTINGS | DIRTY_SCREEN_BRIGHTNESS_BOOST | DIRTY_BOOT_IPO)) != 0) {
mDisplayPowerRequest.policy = getDesiredScreenPolicyLocked();
if (DEBUG) {
Slog.d(TAG, "mDisplayPowerRequest.policy = " + mDisplayPowerRequest.policy);
}
// Determine appropriate screen brightness and auto-brightness adjustments.
int screenBrightness = mScreenBrightnessSettingDefault;
float screenAutoBrightnessAdjustment = 0.0f;
boolean autoBrightness = ((mScreenBrightnessModeSetting &
Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) > 0);
if (isValidBrightness(mScreenBrightnessOverrideFromWindowManager)) {
screenBrightness = mScreenBrightnessOverrideFromWindowManager;
autoBrightness = false;
} else if (isValidBrightness(mTemporaryScreenBrightnessSettingOverride)) {
screenBrightness = mTemporaryScreenBrightnessSettingOverride;
} else if (isValidBrightness(mScreenBrightnessSetting)) {
screenBrightness = mScreenBrightnessSetting;
}
if (autoBrightness) {
screenBrightness = mScreenBrightnessSettingDefault;
if (isValidAutoBrightnessAdjustment(
mTemporaryScreenAutoBrightnessAdjustmentSettingOverride)) {
screenAutoBrightnessAdjustment =
mTemporaryScreenAutoBrightnessAdjustmentSettingOverride;
} else if (isValidAutoBrightnessAdjustment(
mScreenAutoBrightnessAdjustmentSetting)) {
screenAutoBrightnessAdjustment = mScreenAutoBrightnessAdjustmentSetting;
}
}
if (!canBrightnessOverRange()) {
screenBrightness = Math.max(Math.min(screenBrightness,
mScreenBrightnessSettingMaximum), mScreenBrightnessSettingMinimum);
}
screenAutoBrightnessAdjustment = Math.max(Math.min(
screenAutoBrightnessAdjustment, 1.0f), -1.0f);
// Update display power request.
mDisplayPowerRequest.screenBrightness = screenBrightness;
mDisplayPowerRequest.screenAutoBrightnessAdjustment =
screenAutoBrightnessAdjustment;
mDisplayPowerRequest.useAutoBrightness = autoBrightness;
mDisplayPowerRequest.useProximitySensor = shouldUseProximitySensorLocked();
mDisplayPowerRequest.lowPowerMode = mLowPowerModeEnabled;
mDisplayPowerRequest.boostScreenBrightness = mScreenBrightnessBoostInProgress;
if (mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_DOZE) {
mDisplayPowerRequest.dozeScreenState = mDozeScreenStateOverrideFromDreamManager;
mDisplayPowerRequest.dozeScreenBrightness =
mDozeScreenBrightnessOverrideFromDreamManager;
} else {
mDisplayPowerRequest.dozeScreenState = Display.STATE_UNKNOWN;
mDisplayPowerRequest.dozeScreenBrightness = PowerManager.BRIGHTNESS_DEFAULT;
}
mDisplayReady = mDisplayManagerInternal.requestPowerState(mDisplayPowerRequest,
mRequestWaitForNegativeProximity);
mRequestWaitForNegativeProximity = false;
// Button backlight begin
if ((mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_BRIGHT) && (mWakefulness == WAKEFULNESS_AWAKE) && !mIPOShutdown && !mShutdownFlag) {
if ( ( (mWakeLockSummary & WAKE_LOCK_BUTTON_BRIGHT) != 0 ) ||
( (mUserActivitySummary & USER_ACTIVITY_BUTTON_BRIGHT) != 0) ) {
mButtonLight.setBrightness(screenBrightness);
Slog.i(TAG, "setBrightness mButtonLight, screenBrightness=" + screenBrightness);
} else {
mButtonLight.turnOff();
Slog.i(TAG, "setBrightness mButtonLight 0.");
}
} else {
mButtonLight.turnOff();
Slog.i(TAG, "setBrightness mButtonLight 0.");
}
// Button backlight end
if (DEBUG_SPEW) {
Slog.d(TAG, "updateDisplayPowerStateLocked: mDisplayReady=" + mDisplayReady
+ ", policy=" + mDisplayPowerRequest.policy
+ ", mWakefulness=" + mWakefulness
+ ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary)
+ ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary)
+ ", mBootCompleted=" + mBootCompleted
+ ", mScreenBrightnessBoostInProgress="
+ mScreenBrightnessBoostInProgress);
}
}
return mDisplayReady && !oldDisplayReady;
}
private void updateScreenBrightnessBoostLocked(int dirty) {
if ((dirty & DIRTY_SCREEN_BRIGHTNESS_BOOST) != 0) {
if (mScreenBrightnessBoostInProgress) {
final long now = SystemClock.uptimeMillis();
mHandler.removeMessages(MSG_SCREEN_BRIGHTNESS_BOOST_TIMEOUT);
if (mLastScreenBrightnessBoostTime > mLastSleepTime) {
final long boostTimeout = mLastScreenBrightnessBoostTime +
SCREEN_BRIGHTNESS_BOOST_TIMEOUT;
if (boostTimeout > now) {
Message msg = mHandler.obtainMessage(MSG_SCREEN_BRIGHTNESS_BOOST_TIMEOUT);
msg.setAsynchronous(true);
mHandler.sendMessageAtTime(msg, boostTimeout);
return;
}
}
mScreenBrightnessBoostInProgress = false;
userActivityNoUpdateLocked(now,
PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
}
}
}
private static boolean isValidBrightness(int value) {
return value >= 0 && value <= 255;
}
private static boolean isValidAutoBrightnessAdjustment(float value) {
// Handles NaN by always returning false.
return value >= -1.0f && value <= 1.0f;
}
private int getDesiredScreenPolicyLocked() {
if ((mWakefulness == WAKEFULNESS_ASLEEP) || mShutdownFlag || mSmartBookForceBacklightOff) {
return DisplayPowerRequest.POLICY_OFF;
}
if (mWakefulness == WAKEFULNESS_DOZING) {
if ((mWakeLockSummary & WAKE_LOCK_DOZE) != 0) {
return DisplayPowerRequest.POLICY_DOZE;
}
if (mDozeAfterScreenOffConfig) {
return DisplayPowerRequest.POLICY_OFF;
}
// Fall through and preserve the current screen policy if not configured to
// doze after screen off. This causes the screen off transition to be skipped.
}
if ((mWakeLockSummary & WAKE_LOCK_SCREEN_BRIGHT) != 0
|| (mUserActivitySummary & USER_ACTIVITY_SCREEN_BRIGHT) != 0
|| !mBootCompleted
|| mScreenBrightnessBoostInProgress
|| bypassUserActivityTimeout()) {
return DisplayPowerRequest.POLICY_BRIGHT;
}
return DisplayPowerRequest.POLICY_DIM;
}
private final DisplayManagerInternal.DisplayPowerCallbacks mDisplayPowerCallbacks =
new DisplayManagerInternal.DisplayPowerCallbacks() {
private int mDisplayState = Display.STATE_UNKNOWN;
@Override
public void onStateChanged() {
synchronized (mLock) {
mDirty |= DIRTY_ACTUAL_DISPLAY_POWER_STATE_UPDATED;
updatePowerStateLocked();
}
}
@Override
public void onProximityPositive() {
synchronized (mLock) {
Slog.i(TAG, "onProximityPositive");
mProximityPositive = true;
mDirty |= DIRTY_PROXIMITY_POSITIVE;
updatePowerStateLocked();
}
}
@Override
public void onProximityNegative() {
synchronized (mLock) {
Slog.i(TAG, "onProximityNegative");
mProximityPositive = false;
mDirty |= DIRTY_PROXIMITY_POSITIVE;
userActivityNoUpdateLocked(SystemClock.uptimeMillis(),
PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
updatePowerStateLocked();
}
}
public void onDisplayStateChange(int state) {
// This method is only needed to support legacy display blanking behavior
// where the display's power state is coupled to suspend or to the power HAL.
// The order of operations matters here.
synchronized (mLock) {
if (mSmartBookPlugState) {
Slog.i(TAG, "bypass onDisplayStateChange in smart book mode");
return;
}
if (mDisplayState != state) {
mDisplayState = state;
if (state == Display.STATE_OFF) {
if (!mDecoupleHalInteractiveModeFromDisplayConfig) {
setHalInteractiveModeLocked(false);
}
if (!mDecoupleHalAutoSuspendModeFromDisplayConfig) {
setHalAutoSuspendModeLocked(true);
}
} else {
if (!mDecoupleHalAutoSuspendModeFromDisplayConfig) {
setHalAutoSuspendModeLocked(false);
}
if (!mDecoupleHalInteractiveModeFromDisplayConfig) {
setHalInteractiveModeLocked(true);
}
}
}
}
}
@Override
public void acquireSuspendBlocker() {
mDisplaySuspendBlocker.acquire();
}
@Override
public void releaseSuspendBlocker() {
mDisplaySuspendBlocker.release();
}
@Override
public String toString() {
synchronized (this) {
return "state=" + Display.stateToString(mDisplayState);
}
}
};
private boolean shouldUseProximitySensorLocked() {
return (mWakeLockSummary & WAKE_LOCK_PROXIMITY_SCREEN_OFF) != 0;
}
/**
* Updates the suspend blocker that keeps the CPU alive.
*
* This function must have no other side-effects.
*/
private void updateSuspendBlockerLocked() {
final boolean needWakeLockSuspendBlocker = ((mWakeLockSummary & WAKE_LOCK_CPU) != 0);
final boolean needDisplaySuspendBlocker = needDisplaySuspendBlockerLocked();
final boolean autoSuspend = !needDisplaySuspendBlocker;
final boolean interactive = mDisplayPowerRequest.isBrightOrDim();
// Disable auto-suspend if needed.
// FIXME We should consider just leaving auto-suspend enabled forever since
// we already hold the necessary wakelocks.
if (!autoSuspend && mDecoupleHalAutoSuspendModeFromDisplayConfig) {
setHalAutoSuspendModeLocked(false);
}
// First acquire suspend blockers if needed.
if (needWakeLockSuspendBlocker && !mHoldingWakeLockSuspendBlocker) {
mWakeLockSuspendBlocker.acquire();
mHoldingWakeLockSuspendBlocker = true;
}
if (needDisplaySuspendBlocker && !mHoldingDisplaySuspendBlocker) {
mDisplaySuspendBlocker.acquire();
mHoldingDisplaySuspendBlocker = true;
}
// Inform the power HAL about interactive mode.
// Although we could set interactive strictly based on the wakefulness
// as reported by isInteractive(), it is actually more desirable to track
// the display policy state instead so that the interactive state observed
// by the HAL more accurately tracks transitions between AWAKE and DOZING.
// Refer to getDesiredScreenPolicyLocked() for details.
if (mDecoupleHalInteractiveModeFromDisplayConfig) {
// When becoming non-interactive, we want to defer sending this signal
// until the display is actually ready so that all transitions have
// completed. This is probably a good sign that things have gotten
// too tangled over here...
if (interactive || mDisplayReady) {
setHalInteractiveModeLocked(interactive);
}
}
// Then release suspend blockers if needed.
if (!needWakeLockSuspendBlocker && mHoldingWakeLockSuspendBlocker) {
mWakeLockSuspendBlocker.release();
mHoldingWakeLockSuspendBlocker = false;
}
if (!needDisplaySuspendBlocker && mHoldingDisplaySuspendBlocker) {
mDisplaySuspendBlocker.release();
mHoldingDisplaySuspendBlocker = false;
}
// Enable auto-suspend if needed.
if (autoSuspend && mDecoupleHalAutoSuspendModeFromDisplayConfig) {
setHalAutoSuspendModeLocked(true);
}
}
/**
* Return true if we must keep a suspend blocker active on behalf of the display.
* We do so if the screen is on or is in transition between states.
*/
private boolean needDisplaySuspendBlockerLocked() {
if (!mDisplayReady) {
return true;
}
if (mDisplayPowerRequest.isBrightOrDim()) {
// If we asked for the screen to be on but it is off due to the proximity
// sensor then we may suspend but only if the configuration allows it.
// On some hardware it may not be safe to suspend because the proximity
// sensor may not be correctly configured as a wake-up source.
if (!mDisplayPowerRequest.useProximitySensor || !mProximityPositive
|| !mSuspendWhenScreenOffDueToProximityConfig) {
return true;
}
}
if (mScreenBrightnessBoostInProgress) {
return true;
}
// Let the system suspend if the screen is off or dozing.
return false;
}
private void setHalAutoSuspendModeLocked(boolean enable) {
if (enable != mHalAutoSuspendModeEnabled) {
if (DEBUG) {
Slog.d(TAG, "Setting HAL auto-suspend mode to " + enable);
}
mHalAutoSuspendModeEnabled = enable;
Trace.traceBegin(Trace.TRACE_TAG_POWER, "setHalAutoSuspend(" + enable + ")");
try {
nativeSetAutoSuspend(enable);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
}
}
private void setHalInteractiveModeLocked(boolean enable) {
if (enable != mHalInteractiveModeEnabled) {
if (DEBUG) {
Slog.d(TAG, "Setting HAL interactive mode to " + enable);
}
mHalInteractiveModeEnabled = enable;
Trace.traceBegin(Trace.TRACE_TAG_POWER, "setHalInteractive(" + enable + ")");
try {
nativeSetInteractive(enable);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_POWER);
}
}
}
private boolean isInteractiveInternal() {
synchronized (mLock) {
return PowerManagerInternal.isInteractive(mWakefulness);
}
}
private boolean isLowPowerModeInternal() {
synchronized (mLock) {
return mLowPowerModeEnabled;
}
}
private boolean setLowPowerModeInternal(boolean mode) {
synchronized (mLock) {
if (DEBUG) Slog.d(TAG, "setLowPowerModeInternal " + mode + " mIsPowered=" + mIsPowered);
if (mIsPowered) {
return false;
}
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.LOW_POWER_MODE, mode ? 1 : 0);
mLowPowerModeSetting = mode;
if (mAutoLowPowerModeConfigured && mBatteryLevelLow) {
if (mode && mAutoLowPowerModeSnoozing) {
if (DEBUG_SPEW) {
Slog.d(TAG, "setLowPowerModeInternal: clearing low power mode snooze");
}
mAutoLowPowerModeSnoozing = false;
} else if (!mode && !mAutoLowPowerModeSnoozing) {
if (DEBUG_SPEW) {
Slog.d(TAG, "setLowPowerModeInternal: snoozing low power mode");
}
mAutoLowPowerModeSnoozing = true;
}
}
updateLowPowerModeLocked();
return true;
}
}
private void handleBatteryStateChangedLocked() {
mDirty |= DIRTY_BATTERY_STATE;
updatePowerStateLocked();
}
private void shutdownOrRebootInternal(final boolean shutdown, final boolean confirm,
final String reason, boolean wait) {
if (mHandler == null || !mSystemReady) {
throw new IllegalStateException("Too early to call shutdown() or reboot()");
}
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (this) {
if (shutdown) {
ShutdownThread.shutdown(mContext, confirm);
} else {
ShutdownThread.reboot(mContext, reason, confirm);
}
}
}
};
// ShutdownThread must run on a looper capable of displaying the UI.
Message msg = Message.obtain(mHandler, runnable);
msg.setAsynchronous(true);
mHandler.sendMessage(msg);
// PowerManager.reboot() is documented not to return so just wait for the inevitable.
if (wait) {
synchronized (runnable) {
while (true) {
try {
runnable.wait();
} catch (InterruptedException e) {
}
}
}
}
}
private void crashInternal(final String message) {
Thread t = new Thread("PowerManagerService.crash()") {
@Override
public void run() {
throw new RuntimeException(message);
}
};
try {
t.start();
t.join();
} catch (InterruptedException e) {
Slog.wtf(TAG, e);
}
}
private void setStayOnSettingInternal(int val) {
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, val);
}
private void setMaximumScreenOffTimeoutFromDeviceAdminInternal(int timeMs) {
synchronized (mLock) {
mMaximumScreenOffTimeoutFromDeviceAdmin = timeMs;
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
}
private boolean isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked() {
return mMaximumScreenOffTimeoutFromDeviceAdmin >= 0
&& mMaximumScreenOffTimeoutFromDeviceAdmin < Integer.MAX_VALUE;
}
private void setAttentionLightInternal(boolean on, int color) {
Light light;
synchronized (mLock) {
if (!mSystemReady) {
return;
}
light = mAttentionLight;
}
// Control light outside of lock.
light.setFlashing(color, Light.LIGHT_FLASH_HARDWARE, (on ? 3 : 0), 0);
}
private void boostScreenBrightnessInternal(long eventTime, int uid) {
synchronized (mLock) {
if (!mSystemReady || mWakefulness == WAKEFULNESS_ASLEEP
|| eventTime < mLastScreenBrightnessBoostTime) {
return;
}
Slog.i(TAG, "Brightness boost activated (uid " + uid +")...");
mLastScreenBrightnessBoostTime = eventTime;
mScreenBrightnessBoostInProgress = true;
mDirty |= DIRTY_SCREEN_BRIGHTNESS_BOOST;
userActivityNoUpdateLocked(eventTime,
PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, uid);
updatePowerStateLocked();
}
}
/**
* Called when a screen brightness boost timeout has occurred.
*
* This function must have no other side-effects besides setting the dirty
* bit and calling update power state.
*/
private void handleScreenBrightnessBoostTimeout() { // runs on handler thread
synchronized (mLock) {
if (DEBUG_SPEW) {
Slog.d(TAG, "handleScreenBrightnessBoostTimeout");
}
mDirty |= DIRTY_SCREEN_BRIGHTNESS_BOOST;
updatePowerStateLocked();
}
}
private void setScreenBrightnessOverrideFromWindowManagerInternal(int brightness) {
synchronized (mLock) {
if (mScreenBrightnessOverrideFromWindowManager != brightness) {
mScreenBrightnessOverrideFromWindowManager = brightness;
if (DEBUG) {
Slog.d(TAG, "mScreenBrightnessOverrideFromWindowManager = " + brightness);
}
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
}
}
private void setUserActivityTimeoutOverrideFromWindowManagerInternal(long timeoutMillis) {
synchronized (mLock) {
if (mUserActivityTimeoutOverrideFromWindowManager != timeoutMillis) {
if (DEBUG) {
Slog.d(TAG, "UA TimeoutOverrideFromWindowManagerInternal = " + timeoutMillis);
}
mUserActivityTimeoutOverrideFromWindowManager = timeoutMillis;
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
}
}
private void setTemporaryScreenBrightnessSettingOverrideInternal(int brightness) {
synchronized (mLock) {
if (mTemporaryScreenBrightnessSettingOverride != brightness) {
mTemporaryScreenBrightnessSettingOverride = brightness;
if (DEBUG) {
Slog.d(TAG, "mTemporaryScreenBrightnessSettingOverride = " + brightness);
}
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
}
}
private void setTemporaryScreenAutoBrightnessAdjustmentSettingOverrideInternal(float adj) {
synchronized (mLock) {
// Note: This condition handles NaN because NaN is not equal to any other
// value, including itself.
if (mTemporaryScreenAutoBrightnessAdjustmentSettingOverride != adj) {
mTemporaryScreenAutoBrightnessAdjustmentSettingOverride = adj;
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
}
}
private void setDozeOverrideFromDreamManagerInternal(
int screenState, int screenBrightness) {
synchronized (mLock) {
if (mDozeScreenStateOverrideFromDreamManager != screenState
|| mDozeScreenBrightnessOverrideFromDreamManager != screenBrightness) {
mDozeScreenStateOverrideFromDreamManager = screenState;
mDozeScreenBrightnessOverrideFromDreamManager = screenBrightness;
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
}
}
private void powerHintInternal(int hintId, int data) {
nativeSendPowerHint(hintId, data);
}
/**
* Low-level function turn the device off immediately, without trying
* to be clean. Most people should use {@link ShutdownThread} for a clean shutdown.
*/
public static void lowLevelShutdown() {
SystemProperties.set("sys.powerctl", "shutdown");
}
/**
* Low-level function to reboot the device. On success, this
* function doesn't return. If more than 20 seconds passes from
* the time a reboot is requested (120 seconds for reboot to
* recovery), this method returns.
*
* @param reason code to pass to the kernel (e.g. "recovery"), or null.
*/
public static void lowLevelReboot(String reason) {
if (reason == null) {
reason = "";
}
long duration;
if (reason.equals(PowerManager.REBOOT_RECOVERY)) {
// If we are rebooting to go into recovery, instead of
// setting sys.powerctl directly we'll start the
// pre-recovery service which will do some preparation for
// recovery and then reboot for us.
//
// This preparation can take more than 20 seconds if
// there's a very large update package, so lengthen the
// timeout. We have seen 750MB packages take 3-4 minutes
SystemProperties.set("ctl.start", "pre-recovery");
duration = 300 * 1000L;
} else {
SystemProperties.set("sys.powerctl", "reboot," + reason);
duration = 20 * 1000L;
}
try {
Thread.sleep(duration);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
@Override // Watchdog.Monitor implementation
public void monitor() {
// Grab and release lock for watchdog monitor to detect deadlocks.
synchronized (mLock) {
}
}
private void dumpInternal(PrintWriter pw) {
pw.println("POWER MANAGER (dumpsys power)\n");
final WirelessChargerDetector wcd;
synchronized (mLock) {
pw.println("Power Manager State:");
pw.println(" mDirty=0x" + Integer.toHexString(mDirty));
pw.println(" mWakefulness=" + PowerManagerInternal.wakefulnessToString(mWakefulness));
pw.println(" mWakefulnessChanging=" + mWakefulnessChanging);
pw.println(" mIsPowered=" + mIsPowered);
pw.println(" mPlugType=" + mPlugType);
pw.println(" mBatteryLevel=" + mBatteryLevel);
pw.println(" mBatteryLevelWhenDreamStarted=" + mBatteryLevelWhenDreamStarted);
pw.println(" mDockState=" + mDockState);
pw.println(" mStayOn=" + mStayOn);
pw.println(" mProximityPositive=" + mProximityPositive);
pw.println(" mBootCompleted=" + mBootCompleted);
pw.println(" mSystemReady=" + mSystemReady);
pw.println(" mHalAutoSuspendModeEnabled=" + mHalAutoSuspendModeEnabled);
pw.println(" mHalInteractiveModeEnabled=" + mHalInteractiveModeEnabled);
pw.println(" mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary));
pw.println(" mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary));
pw.println(" mRequestWaitForNegativeProximity=" + mRequestWaitForNegativeProximity);
pw.println(" mSandmanScheduled=" + mSandmanScheduled);
pw.println(" mSandmanSummoned=" + mSandmanSummoned);
pw.println(" mLowPowerModeEnabled=" + mLowPowerModeEnabled);
pw.println(" mBatteryLevelLow=" + mBatteryLevelLow);
pw.println(" mLastWakeTime=" + TimeUtils.formatUptime(mLastWakeTime));
pw.println(" mLastSleepTime=" + TimeUtils.formatUptime(mLastSleepTime));
pw.println(" mLastUserActivityTime=" + TimeUtils.formatUptime(mLastUserActivityTime));
pw.println(" mLastUserActivityTimeNoChangeLights="
+ TimeUtils.formatUptime(mLastUserActivityTimeNoChangeLights));
pw.println(" mLastInteractivePowerHintTime="
+ TimeUtils.formatUptime(mLastInteractivePowerHintTime));
pw.println(" mLastScreenBrightnessBoostTime="
+ TimeUtils.formatUptime(mLastScreenBrightnessBoostTime));
pw.println(" mScreenBrightnessBoostInProgress="
+ mScreenBrightnessBoostInProgress);
pw.println(" mDisplayReady=" + mDisplayReady);
pw.println(" mHoldingWakeLockSuspendBlocker=" + mHoldingWakeLockSuspendBlocker);
pw.println(" mHoldingDisplaySuspendBlocker=" + mHoldingDisplaySuspendBlocker);
pw.println();
pw.println("Settings and Configuration:");
pw.println(" mDecoupleHalAutoSuspendModeFromDisplayConfig="
+ mDecoupleHalAutoSuspendModeFromDisplayConfig);
pw.println(" mDecoupleHalInteractiveModeFromDisplayConfig="
+ mDecoupleHalInteractiveModeFromDisplayConfig);
pw.println(" mWakeUpWhenPluggedOrUnpluggedConfig="
+ mWakeUpWhenPluggedOrUnpluggedConfig);
pw.println(" mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig="
+ mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig);
pw.println(" mTheaterModeEnabled="
+ mTheaterModeEnabled);
pw.println(" mSuspendWhenScreenOffDueToProximityConfig="
+ mSuspendWhenScreenOffDueToProximityConfig);
pw.println(" mDreamsSupportedConfig=" + mDreamsSupportedConfig);
pw.println(" mDreamsEnabledByDefaultConfig=" + mDreamsEnabledByDefaultConfig);
pw.println(" mDreamsActivatedOnSleepByDefaultConfig="
+ mDreamsActivatedOnSleepByDefaultConfig);
pw.println(" mDreamsActivatedOnDockByDefaultConfig="
+ mDreamsActivatedOnDockByDefaultConfig);
pw.println(" mDreamsEnabledOnBatteryConfig="
+ mDreamsEnabledOnBatteryConfig);
pw.println(" mDreamsBatteryLevelMinimumWhenPoweredConfig="
+ mDreamsBatteryLevelMinimumWhenPoweredConfig);
pw.println(" mDreamsBatteryLevelMinimumWhenNotPoweredConfig="
+ mDreamsBatteryLevelMinimumWhenNotPoweredConfig);
pw.println(" mDreamsBatteryLevelDrainCutoffConfig="
+ mDreamsBatteryLevelDrainCutoffConfig);
pw.println(" mDreamsEnabledSetting=" + mDreamsEnabledSetting);
pw.println(" mDreamsActivateOnSleepSetting=" + mDreamsActivateOnSleepSetting);
pw.println(" mDreamsActivateOnDockSetting=" + mDreamsActivateOnDockSetting);
pw.println(" mDozeAfterScreenOffConfig=" + mDozeAfterScreenOffConfig);
pw.println(" mLowPowerModeSetting=" + mLowPowerModeSetting);
pw.println(" mAutoLowPowerModeConfigured=" + mAutoLowPowerModeConfigured);
pw.println(" mAutoLowPowerModeSnoozing=" + mAutoLowPowerModeSnoozing);
pw.println(" mMinimumScreenOffTimeoutConfig=" + mMinimumScreenOffTimeoutConfig);
pw.println(" mMaximumScreenDimDurationConfig=" + mMaximumScreenDimDurationConfig);
pw.println(" mMaximumScreenDimRatioConfig=" + mMaximumScreenDimRatioConfig);
pw.println(" mScreenOffTimeoutSetting=" + mScreenOffTimeoutSetting);
pw.println(" mSleepTimeoutSetting=" + mSleepTimeoutSetting);
pw.println(" mMaximumScreenOffTimeoutFromDeviceAdmin="
+ mMaximumScreenOffTimeoutFromDeviceAdmin + " (enforced="
+ isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked() + ")");
pw.println(" mStayOnWhilePluggedInSetting=" + mStayOnWhilePluggedInSetting);
pw.println(" mScreenBrightnessSetting=" + mScreenBrightnessSetting);
pw.println(" mScreenAutoBrightnessAdjustmentSetting="
+ mScreenAutoBrightnessAdjustmentSetting);
pw.println(" mScreenBrightnessModeSetting=" + mScreenBrightnessModeSetting);
pw.println(" mScreenBrightnessOverrideFromWindowManager="
+ mScreenBrightnessOverrideFromWindowManager);
pw.println(" mUserActivityTimeoutOverrideFromWindowManager="
+ mUserActivityTimeoutOverrideFromWindowManager);
pw.println(" mTemporaryScreenBrightnessSettingOverride="
+ mTemporaryScreenBrightnessSettingOverride);
pw.println(" mTemporaryScreenAutoBrightnessAdjustmentSettingOverride="
+ mTemporaryScreenAutoBrightnessAdjustmentSettingOverride);
pw.println(" mDozeScreenStateOverrideFromDreamManager="
+ mDozeScreenStateOverrideFromDreamManager);
pw.println(" mDozeScreenBrightnessOverrideFromDreamManager="
+ mDozeScreenBrightnessOverrideFromDreamManager);
pw.println(" mScreenBrightnessSettingMinimum=" + mScreenBrightnessSettingMinimum);
pw.println(" mScreenBrightnessSettingMaximum=" + mScreenBrightnessSettingMaximum);
pw.println(" mScreenBrightnessSettingDefault=" + mScreenBrightnessSettingDefault);
final int sleepTimeout = getSleepTimeoutLocked();
final int screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout);
final int screenDimDuration = getScreenDimDurationLocked(screenOffTimeout);
pw.println();
pw.println("Sleep timeout: " + sleepTimeout + " ms");
pw.println("Screen off timeout: " + screenOffTimeout + " ms");
pw.println("Screen dim duration: " + screenDimDuration + " ms");
pw.println();
pw.println("Wake Locks: size=" + mWakeLocks.size());
for (WakeLock wl : mWakeLocks) {
pw.println(" " + wl);
}
pw.println();
pw.println("Suspend Blockers: size=" + mSuspendBlockers.size());
for (SuspendBlocker sb : mSuspendBlockers) {
pw.println(" " + sb);
}
pw.println();
pw.println("Display Power: " + mDisplayPowerCallbacks);
wcd = mWirelessChargerDetector;
}
if (wcd != null) {
wcd.dump(pw);
}
}
private SuspendBlocker createSuspendBlockerLocked(String name) {
SuspendBlocker suspendBlocker = new SuspendBlockerImpl(name);
mSuspendBlockers.add(suspendBlocker);
return suspendBlocker;
}
private static WorkSource copyWorkSource(WorkSource workSource) {
return workSource != null ? new WorkSource(workSource) : null;
}
private final class BatteryReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
handleBatteryStateChangedLocked();
}
}
}
private final class DreamReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
scheduleSandmanLocked();
}
}
}
private final class UserSwitchedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
handleSettingsChangedLocked();
}
}
}
private final class DockReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE,
Intent.EXTRA_DOCK_STATE_UNDOCKED);
if (mDockState != dockState) {
mDockState = dockState;
mDirty |= DIRTY_DOCK_STATE;
updatePowerStateLocked();
}
}
}
}
private final class SDHotPlugReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
if (DEBUG) {
Slog.d(TAG, "<<<<< SD Hot Plug >>>>> Receiving " + intent.getAction());
}
if (intent.getAction().equals(Intent.ACTION_SD_INSERTED)) {
mDirty |= DIRTY_SD_STATE;
if (!mIPOShutdown) {
if (mWakefulness != WAKEFULNESS_AWAKE) {
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
} else {
userActivityNoUpdateLocked(SystemClock.uptimeMillis(),
PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
}
updatePowerStateLocked();
}
}
}
}
}
private final class SmartBookPlugReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
synchronized (mLock) {
mSmartBookPlugState = intent.getBooleanExtra(Intent.EXTRA_SMARTBOOK_PLUG_STATE, false);
if (DEBUG) {
Slog.d(TAG, "<<<<< SmartBook Plug >>>>> Receiving " + intent.getAction() + ", mSmartBookPlugState = " + mSmartBookPlugState);
}
if (mSmartBookPlugState) {
if (!mSmartBookRDMALimited) {
if (SystemProperties.getBoolean("persist.smb.phone.both.on", false)) {
if (DEBUG_SPEW) {
Slog.d(TAG, "smart book mode: both smart book and phone screen keep on");
}
} else {
TelecomManager telecomm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
if (telecomm != null) {
if (telecomm.isInCall()) {
Slog.d(TAG, "SmartBookPlugReceiver: InCalling, no need to invoke smartbook sleep mode");
} else {
goToSleepNoUpdateLocked(SystemClock.uptimeMillis(), PowerManager.GO_TO_SLEEP_REASON_SMARTBOOK, 0, Process.SYSTEM_UID);
}
} else {
goToSleepNoUpdateLocked(SystemClock.uptimeMillis(), PowerManager.GO_TO_SLEEP_REASON_SMARTBOOK, 0, Process.SYSTEM_UID);
}
}
} else {
goToSleepNoUpdateLocked(SystemClock.uptimeMillis(), PowerManager.GO_TO_SLEEP_REASON_SMARTBOOK, 0, Process.SYSTEM_UID);
}
/* Re-draw power off dialog if power off dialog is showing*/
ShutdownThread.powerOffDialogRedrawForSmartBook(context);
} else {
if (mIPOShutdown) {
mSmartBookWakeUpPendingByIPO = true;
}
}
setSmartBookScreenInternal(true);
mDirty |= DIRTY_SMARTBOOK_STATE;
userActivityNoUpdateLocked(SystemClock.uptimeMillis(), PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID);
updatePowerStateLocked();
}
}
}
private final class SettingsObserver extends ContentObserver {
public SettingsObserver(Handler handler) {
super(handler);
}
@Override
public void onChange(boolean selfChange, Uri uri) {
synchronized (mLock) {
handleSettingsChangedLocked();
}
}
}
/**
* Handler for asynchronous operations performed by the power manager.
*/
private final class PowerManagerHandler extends Handler {
public PowerManagerHandler(Looper looper) {
super(looper, null, true /*async*/);
}
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_USER_ACTIVITY_TIMEOUT:
handleUserActivityTimeout();
break;
case MSG_SANDMAN:
handleSandman();
break;
case MSG_SCREEN_BRIGHTNESS_BOOST_TIMEOUT:
handleScreenBrightnessBoostTimeout();
break;
}
}
}
/**
* Represents a wake lock that has been acquired by an application.
*/
private final class WakeLock implements IBinder.DeathRecipient {
public final IBinder mLock;
public int mFlags;
public String mTag;
public final String mPackageName;
public WorkSource mWorkSource;
public String mHistoryTag;
public final int mOwnerUid;
public final int mOwnerPid;
public boolean mNotifiedAcquired;
public long mActiveSince = 0;
public long mTotalTime = 0;
public WakeLock(IBinder lock, int flags, String tag, String packageName,
WorkSource workSource, String historyTag, int ownerUid, int ownerPid) {
mLock = lock;
mFlags = flags;
mTag = tag;
mPackageName = packageName;
mWorkSource = copyWorkSource(workSource);
mHistoryTag = historyTag;
mOwnerUid = ownerUid;
mOwnerPid = ownerPid;
}
@Override
public void binderDied() {
PowerManagerService.this.handleWakeLockDeath(this);
}
public boolean hasSameProperties(int flags, String tag, WorkSource workSource,
int ownerUid, int ownerPid) {
return mFlags == flags
&& mTag.equals(tag)
&& hasSameWorkSource(workSource)
&& mOwnerUid == ownerUid
&& mOwnerPid == ownerPid;
}
public void updateProperties(int flags, String tag, String packageName,
WorkSource workSource, String historyTag, int ownerUid, int ownerPid) {
if (!mPackageName.equals(packageName)) {
throw new IllegalStateException("Existing wake lock package name changed: "
+ mPackageName + " to " + packageName);
}
if (mOwnerUid != ownerUid) {
throw new IllegalStateException("Existing wake lock uid changed: "
+ mOwnerUid + " to " + ownerUid);
}
if (mOwnerPid != ownerPid) {
throw new IllegalStateException("Existing wake lock pid changed: "
+ mOwnerPid + " to " + ownerPid);
}
mFlags = flags;
mTag = tag;
updateWorkSource(workSource);
mHistoryTag = historyTag;
}
public boolean hasSameWorkSource(WorkSource workSource) {
return Objects.equal(mWorkSource, workSource);
}
public void updateWorkSource(WorkSource workSource) {
mWorkSource = copyWorkSource(workSource);
}
@Override
public String toString() {
return getLockLevelString()
+ " '" + mTag + "'" + getLockFlagsString()
+ " (uid=" + mOwnerUid + ", pid=" + mOwnerPid + ", ws=" + mWorkSource + ")";
}
@SuppressWarnings("deprecation")
private String getLockLevelString() {
switch (mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK) {
case PowerManager.FULL_WAKE_LOCK:
return "FULL_WAKE_LOCK ";
case PowerManager.SCREEN_BRIGHT_WAKE_LOCK:
return "SCREEN_BRIGHT_WAKE_LOCK ";
case PowerManager.SCREEN_DIM_WAKE_LOCK:
return "SCREEN_DIM_WAKE_LOCK ";
case PowerManager.PARTIAL_WAKE_LOCK:
return "PARTIAL_WAKE_LOCK ";
case PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK:
return "PROXIMITY_SCREEN_OFF_WAKE_LOCK";
case PowerManager.DOZE_WAKE_LOCK:
return "DOZE_WAKE_LOCK ";
default:
return "??? ";
}
}
private String getLockFlagsString() {
String result = "";
if ((mFlags & PowerManager.ACQUIRE_CAUSES_WAKEUP) != 0) {
result += " ACQUIRE_CAUSES_WAKEUP";
}
if ((mFlags & PowerManager.ON_AFTER_RELEASE) != 0) {
result += " ON_AFTER_RELEASE";
}
return result;
}
}
private final class SuspendBlockerImpl implements SuspendBlocker {
private final String mName;
private final String mTraceName;
private int mReferenceCount;
public SuspendBlockerImpl(String name) {
mName = name;
mTraceName = "SuspendBlocker (" + name + ")";
}
@Override
protected void finalize() throws Throwable {
try {
if (mReferenceCount != 0) {
Slog.wtf(TAG, "Suspend blocker \"" + mName
+ "\" was finalized without being released!");
mReferenceCount = 0;
nativeReleaseSuspendBlocker(mName);
Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, mTraceName, 0);
}
} finally {
super.finalize();
}
}
@Override
public void acquire() {
synchronized (this) {
mReferenceCount += 1;
if (mReferenceCount == 1) {
if (DEBUG_SPEW) {
Slog.d(TAG, "Acquiring suspend blocker \"" + mName + "\".");
}
Trace.asyncTraceBegin(Trace.TRACE_TAG_POWER, mTraceName, 0);
nativeAcquireSuspendBlocker(mName);
}
}
}
@Override
public void release() {
synchronized (this) {
mReferenceCount -= 1;
if (mReferenceCount == 0) {
if (DEBUG_SPEW) {
Slog.d(TAG, "Releasing suspend blocker \"" + mName + "\".");
}
nativeReleaseSuspendBlocker(mName);
Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, mTraceName, 0);
} else if (mReferenceCount < 0) {
Slog.wtf(TAG, "Suspend blocker \"" + mName
+ "\" was released without being acquired!", new Throwable());
mReferenceCount = 0;
}
}
}
@Override
public String toString() {
synchronized (this) {
return mName + ": ref count=" + mReferenceCount;
}
}
}
private final class BinderService extends IPowerManager.Stub {
@Override // Binder call
public void acquireWakeLockWithUid(IBinder lock, int flags, String tag,
String packageName, int uid) {
if (uid < 0) {
uid = Binder.getCallingUid();
}
acquireWakeLock(lock, flags, tag, packageName, new WorkSource(uid), null);
}
@Override // Binder call
public void powerHint(int hintId, int data) {
if (!mSystemReady) {
// Service not ready yet, so who the heck cares about power hints, bah.
return;
}
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
powerHintInternal(hintId, data);
}
@Override // Binder call
public void acquireWakeLock(IBinder lock, int flags, String tag, String packageName,
WorkSource ws, String historyTag) {
if (lock == null) {
throw new IllegalArgumentException("lock must not be null");
}
if (packageName == null) {
throw new IllegalArgumentException("packageName must not be null");
}
PowerManager.validateWakeLockParameters(flags, tag);
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
if ((flags & PowerManager.DOZE_WAKE_LOCK) != 0) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
}
if (ws != null && ws.size() != 0) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.UPDATE_DEVICE_STATS, null);
} else {
ws = null;
}
final int uid = Binder.getCallingUid();
final int pid = Binder.getCallingPid();
final long ident = Binder.clearCallingIdentity();
try {
acquireWakeLockInternal(lock, flags, tag, packageName, ws, historyTag, uid, pid);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void releaseWakeLock(IBinder lock, int flags) {
if (lock == null) {
throw new IllegalArgumentException("lock must not be null");
}
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
final long ident = Binder.clearCallingIdentity();
try {
releaseWakeLockInternal(lock, flags);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void updateWakeLockUids(IBinder lock, int[] uids) {
WorkSource ws = null;
if (uids != null) {
ws = new WorkSource();
// XXX should WorkSource have a way to set uids as an int[] instead of adding them
// one at a time?
for (int i = 0; i < uids.length; i++) {
ws.add(uids[i]);
}
}
updateWakeLockWorkSource(lock, ws, null);
}
@Override // Binder call
public void updateWakeLockWorkSource(IBinder lock, WorkSource ws, String historyTag) {
if (lock == null) {
throw new IllegalArgumentException("lock must not be null");
}
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
if (ws != null && ws.size() != 0) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.UPDATE_DEVICE_STATS, null);
} else {
ws = null;
}
final int callingUid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
updateWakeLockWorkSourceInternal(lock, ws, historyTag, callingUid);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public boolean isWakeLockLevelSupported(int level) {
final long ident = Binder.clearCallingIdentity();
try {
return isWakeLockLevelSupportedInternal(level);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void userActivity(long eventTime, int event, int flags) {
final long now = SystemClock.uptimeMillis();
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER)
!= PackageManager.PERMISSION_GRANTED
&& mContext.checkCallingOrSelfPermission(
android.Manifest.permission.USER_ACTIVITY)
!= PackageManager.PERMISSION_GRANTED) {
// Once upon a time applications could call userActivity().
// Now we require the DEVICE_POWER permission. Log a warning and ignore the
// request instead of throwing a SecurityException so we don't break old apps.
synchronized (mLock) {
if (now >= mLastWarningAboutUserActivityPermission + (5 * 60 * 1000)) {
mLastWarningAboutUserActivityPermission = now;
Slog.w(TAG, "Ignoring call to PowerManager.userActivity() because the "
+ "caller does not have DEVICE_POWER or USER_ACTIVITY "
+ "permission. Please fix your app! "
+ " pid=" + Binder.getCallingPid()
+ " uid=" + Binder.getCallingUid());
}
}
return;
}
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
}
final int uid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
userActivityInternal(eventTime, event, flags, uid);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void wakeUp(long eventTime) {
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
}
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final int uid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
wakeUpInternal(eventTime, uid);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void goToSleep(long eventTime, int reason, int flags) {
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
}
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final int uid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
goToSleepInternal(eventTime, reason, flags, uid);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void nap(long eventTime) {
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
}
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final int uid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
napInternal(eventTime, uid);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public boolean isInteractive() {
final long ident = Binder.clearCallingIdentity();
try {
return isInteractiveInternal();
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public boolean isPowerSaveMode() {
final long ident = Binder.clearCallingIdentity();
try {
return isLowPowerModeInternal();
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public boolean setPowerSaveMode(boolean mode) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
return setLowPowerModeInternal(mode);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
/**
* Reboots the device.
*
* @param confirm If true, shows a reboot confirmation dialog.
* @param reason The reason for the reboot, or null if none.
* @param wait If true, this call waits for the reboot to complete and does not return.
*/
@Override // Binder call
public void reboot(boolean confirm, String reason, boolean wait) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.REBOOT, null);
if (PowerManager.REBOOT_RECOVERY.equals(reason)) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.RECOVERY, null);
}
final long ident = Binder.clearCallingIdentity();
try {
shutdownOrRebootInternal(false, confirm, reason, wait);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
/**
* Shuts down the device.
*
* @param confirm If true, shows a shutdown confirmation dialog.
* @param wait If true, this call waits for the shutdown to complete and does not return.
*/
@Override // Binder call
public void shutdown(boolean confirm, boolean wait) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.REBOOT, null);
final long ident = Binder.clearCallingIdentity();
try {
shutdownOrRebootInternal(true, confirm, null, wait);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
/**
* Crash the runtime (causing a complete restart of the Android framework).
* Requires REBOOT permission. Mostly for testing. Should not return.
*/
@Override // Binder call
public void crash(String message) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.REBOOT, null);
final long ident = Binder.clearCallingIdentity();
try {
crashInternal(message);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
/**
* Set the setting that determines whether the device stays on when plugged in.
* The argument is a bit string, with each bit specifying a power source that,
* when the device is connected to that source, causes the device to stay on.
* See {@link android.os.BatteryManager} for the list of power sources that
* can be specified. Current values include
* {@link android.os.BatteryManager#BATTERY_PLUGGED_AC}
* and {@link android.os.BatteryManager#BATTERY_PLUGGED_USB}
*
* Used by "adb shell svc power stayon ..."
*
* @param val an {@code int} containing the bits that specify which power sources
* should cause the device to stay on.
*/
@Override // Binder call
public void setStayOnSetting(int val) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.WRITE_SETTINGS, null);
final long ident = Binder.clearCallingIdentity();
try {
setStayOnSettingInternal(val);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
/**
* Used by the settings application and brightness control widgets to
* temporarily override the current screen brightness setting so that the
* user can observe the effect of an intended settings change without applying
* it immediately.
*
* The override will be canceled when the setting value is next updated.
*
* @param brightness The overridden brightness.
*
* @see android.provider.Settings.System#SCREEN_BRIGHTNESS
*/
@Override // Binder call
public void setTemporaryScreenBrightnessSettingOverride(int brightness) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
setTemporaryScreenBrightnessSettingOverrideInternal(brightness);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
/**
* Used by the settings application and brightness control widgets to
* temporarily override the current screen auto-brightness adjustment setting so that the
* user can observe the effect of an intended settings change without applying
* it immediately.
*
* The override will be canceled when the setting value is next updated.
*
* @param adj The overridden brightness, or Float.NaN to disable the override.
*
* @see android.provider.Settings.System#SCREEN_AUTO_BRIGHTNESS_ADJ
*/
@Override // Binder call
public void setTemporaryScreenAutoBrightnessAdjustmentSettingOverride(float adj) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
setTemporaryScreenAutoBrightnessAdjustmentSettingOverrideInternal(adj);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
/**
* Used by the phone application to make the attention LED flash when ringing.
*/
@Override // Binder call
public void setAttentionLight(boolean on, int color) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
setAttentionLightInternal(on, color);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void boostScreenBrightness(long eventTime) {
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
}
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DEVICE_POWER, null);
final int uid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
boostScreenBrightnessInternal(eventTime, uid);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump PowerManager from from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid());
return;
}
final long ident = Binder.clearCallingIdentity();
try {
dumpInternal(pw);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void setSmartBookScreen(boolean on) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
setSmartBookScreenInternal(on);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void wakeUpByReason(long eventTime, int reason) {
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
}
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
wakeUpByReasonInternal(eventTime, reason);
} finally {
Binder.restoreCallingIdentity(ident);
}
}
@Override // Binder call
public void startBacklight(int delay_msec) {
synchronized (mLock) {
if (SystemProperties.get("ro.mtk_ipo_support").equals("1")) {
Slog.d(TAG, "startBacklight");
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
mDisplayManagerInternal.setIPOScreenOnDelay(delay_msec);
wakeUpNoUpdateLocked(SystemClock.uptimeMillis(), Process.SYSTEM_UID);
updatePowerStateLocked();
} finally {
Binder.restoreCallingIdentity(ident);
}
} else {
Slog.d(TAG, "skip startBacklight because MTK_IPO_SUPPORT not enabled");
}
}
}
@Override // Binder call
public void stopBacklight() {
synchronized (mLock) {
if (SystemProperties.get("ro.mtk_ipo_support").equals("1")) {
Slog.d(TAG, "stopBacklight");
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
final long ident = Binder.clearCallingIdentity();
try {
mDisplayManagerInternal.setIPOScreenOnDelay(0);
goToSleepNoUpdateLocked(SystemClock.uptimeMillis(),
PowerManager.GO_TO_SLEEP_REASON_APPLICATION, 0, Process.SYSTEM_UID);
updatePowerStateLocked();
} finally {
Binder.restoreCallingIdentity(ident);
}
} else {
Slog.d(TAG, "skip stopBacklight because MTK_IPO_SUPPORT not enabled");
}
}
}
@Override
public void setBlNotify() {
synchronized (this) {
nativeSetBlNotify(true);
}
}
@Override
public void setBacklightOffForWfd(boolean enable) {
if(enable) {
Slog.d(TAG, "setBacklightOffForWfd true");
mBacklight.setBrightness(0);
} else {
if (mWfdShouldBypass != true) {
Slog.d(TAG, "setBacklightOffForWfd false");
mBacklight.setBrightness(mScreenBrightnessSetting);
} else {
Slog.d(TAG, "setBacklightOffForWfd false ignored due to screen is off by power key");
}
}
}
}
private final class LocalService extends PowerManagerInternal {
@Override
public void setScreenBrightnessOverrideFromWindowManager(int screenBrightness) {
if (screenBrightness < PowerManager.BRIGHTNESS_DEFAULT
|| screenBrightness > PowerManager.BRIGHTNESS_ON) {
screenBrightness = PowerManager.BRIGHTNESS_DEFAULT;
}
setScreenBrightnessOverrideFromWindowManagerInternal(screenBrightness);
}
@Override
public void setButtonBrightnessOverrideFromWindowManager(int screenBrightness) {
// Do nothing.
// Button lights are not currently supported in the new implementation.
}
@Override
public void setDozeOverrideFromDreamManager(int screenState, int screenBrightness) {
switch (screenState) {
case Display.STATE_UNKNOWN:
case Display.STATE_OFF:
case Display.STATE_DOZE:
case Display.STATE_DOZE_SUSPEND:
case Display.STATE_ON:
break;
default:
screenState = Display.STATE_UNKNOWN;
break;
}
if (screenBrightness < PowerManager.BRIGHTNESS_DEFAULT
|| screenBrightness > PowerManager.BRIGHTNESS_ON) {
screenBrightness = PowerManager.BRIGHTNESS_DEFAULT;
}
setDozeOverrideFromDreamManagerInternal(screenState, screenBrightness);
}
@Override
public void setUserActivityTimeoutOverrideFromWindowManager(long timeoutMillis) {
setUserActivityTimeoutOverrideFromWindowManagerInternal(timeoutMillis);
}
@Override
public void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs) {
setMaximumScreenOffTimeoutFromDeviceAdminInternal(timeMs);
}
@Override
public boolean getLowPowerModeEnabled() {
synchronized (mLock) {
return mLowPowerModeEnabled;
}
}
@Override
public void registerLowPowerModeObserver(LowPowerModeListener listener) {
synchronized (mLock) {
mLowPowerModeListeners.add(listener);
}
}
}
}
|
[
"rekgrpth@gmail.com"
] |
rekgrpth@gmail.com
|
dfa3ff3ad8190fba8b3284805cc08b6a27705b2e
|
c9313b4964509b6767545c3971a2150dcb52ac86
|
/gen/com/actionbarsherlock/R.java
|
3711dbd01981c3788b99e5c19d49a987dbff44be
|
[] |
no_license
|
wilidga/Divisas
|
86e4481dd01857f25b7493555e4dad08373dd71b
|
97777e8467ec8e9dcc09192cda01c4ec6b25e39b
|
refs/heads/master
| 2020-05-17T07:02:23.201414
| 2015-02-26T03:19:54
| 2015-02-26T03:19:54
| 31,348,499
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 41,247
|
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.actionbarsherlock;
public final class R {
public static final class attr {
public static final int actionBarDivider = 0x7f01000e;
public static final int actionBarItemBackground = 0x7f01000f;
public static final int actionBarSize = 0x7f01000d;
public static final int actionBarSplitStyle = 0x7f01000b;
public static final int actionBarStyle = 0x7f01000a;
public static final int actionBarTabBarStyle = 0x7f010007;
public static final int actionBarTabStyle = 0x7f010006;
public static final int actionBarTabTextStyle = 0x7f010008;
public static final int actionBarWidgetTheme = 0x7f01000c;
public static final int actionButtonStyle = 0x7f01003a;
public static final int actionDropDownStyle = 0x7f010039;
public static final int actionMenuTextAppearance = 0x7f010010;
public static final int actionMenuTextColor = 0x7f010011;
public static final int actionModeBackground = 0x7f010014;
public static final int actionModeCloseButtonStyle = 0x7f010013;
public static final int actionModeCloseDrawable = 0x7f010016;
public static final int actionModePopupWindowStyle = 0x7f010018;
public static final int actionModeShareDrawable = 0x7f010017;
public static final int actionModeSplitBackground = 0x7f010015;
public static final int actionModeStyle = 0x7f010012;
public static final int actionOverflowButtonStyle = 0x7f010009;
public static final int actionSpinnerItemStyle = 0x7f01003f;
public static final int activatedBackgroundIndicator = 0x7f010047;
public static final int activityChooserViewStyle = 0x7f010046;
public static final int background = 0x7f010002;
public static final int backgroundSplit = 0x7f010003;
public static final int backgroundStacked = 0x7f01004f;
public static final int buttonStyleSmall = 0x7f010019;
public static final int customNavigationLayout = 0x7f010050;
public static final int displayOptions = 0x7f01004a;
public static final int divider = 0x7f010005;
public static final int dividerVertical = 0x7f010038;
public static final int dropDownHintAppearance = 0x7f010048;
public static final int dropDownListViewStyle = 0x7f01003c;
public static final int dropdownListPreferredItemHeight = 0x7f01003e;
public static final int expandActivityOverflowButtonDrawable = 0x7f01005f;
public static final int headerBackground = 0x7f010059;
public static final int height = 0x7f010004;
public static final int homeAsUpIndicator = 0x7f01003b;
public static final int homeLayout = 0x7f010051;
public static final int horizontalDivider = 0x7f010057;
public static final int icon = 0x7f01004d;
public static final int iconifiedByDefault = 0x7f010060;
public static final int indeterminateProgressStyle = 0x7f010053;
public static final int initialActivityCount = 0x7f01005e;
public static final int itemBackground = 0x7f01005a;
public static final int itemIconDisabledAlpha = 0x7f01005c;
public static final int itemPadding = 0x7f010055;
public static final int itemTextAppearance = 0x7f010056;
public static final int listPopupWindowStyle = 0x7f010045;
public static final int listPreferredItemHeightSmall = 0x7f010032;
public static final int listPreferredItemPaddingLeft = 0x7f010033;
public static final int listPreferredItemPaddingRight = 0x7f010034;
public static final int logo = 0x7f01004e;
public static final int navigationMode = 0x7f010049;
public static final int popupMenuStyle = 0x7f01003d;
public static final int preserveIconSpacing = 0x7f01005d;
public static final int progressBarPadding = 0x7f010054;
public static final int progressBarStyle = 0x7f010052;
public static final int queryHint = 0x7f010061;
public static final int searchAutoCompleteTextView = 0x7f010024;
public static final int searchDropdownBackground = 0x7f010025;
public static final int searchResultListItemHeight = 0x7f01002f;
public static final int searchViewCloseIcon = 0x7f010026;
public static final int searchViewEditQuery = 0x7f01002a;
public static final int searchViewEditQueryBackground = 0x7f01002b;
public static final int searchViewGoIcon = 0x7f010027;
public static final int searchViewSearchIcon = 0x7f010028;
public static final int searchViewTextField = 0x7f01002c;
public static final int searchViewTextFieldRight = 0x7f01002d;
public static final int searchViewVoiceIcon = 0x7f010029;
public static final int selectableItemBackground = 0x7f01001a;
public static final int spinnerDropDownItemStyle = 0x7f010023;
public static final int spinnerItemStyle = 0x7f010022;
public static final int subtitle = 0x7f01004c;
public static final int subtitleTextStyle = 0x7f010001;
public static final int textAppearanceLargePopupMenu = 0x7f01001c;
public static final int textAppearanceListItemSmall = 0x7f010035;
public static final int textAppearanceSearchResultSubtitle = 0x7f010031;
public static final int textAppearanceSearchResultTitle = 0x7f010030;
public static final int textAppearanceSmall = 0x7f01001e;
public static final int textAppearanceSmallPopupMenu = 0x7f01001d;
public static final int textColorPrimary = 0x7f01001f;
public static final int textColorPrimaryDisableOnly = 0x7f010020;
public static final int textColorPrimaryInverse = 0x7f010021;
public static final int textColorSearchUrl = 0x7f01002e;
public static final int title = 0x7f01004b;
public static final int titleTextStyle = 0x7f010000;
public static final int verticalDivider = 0x7f010058;
public static final int windowActionBar = 0x7f010041;
public static final int windowActionBarOverlay = 0x7f010042;
public static final int windowActionModeOverlay = 0x7f010043;
public static final int windowAnimationStyle = 0x7f01005b;
public static final int windowContentOverlay = 0x7f01001b;
public static final int windowMinWidthMajor = 0x7f010036;
public static final int windowMinWidthMinor = 0x7f010037;
public static final int windowNoTitle = 0x7f010040;
public static final int windowSplitActionBar = 0x7f010044;
}
public static final class bool {
public static final int abs__action_bar_embed_tabs = 0x7f040000;
public static final int abs__action_bar_expanded_action_views_exclusive = 0x7f040002;
public static final int abs__config_actionMenuItemAllCaps = 0x7f040004;
public static final int abs__config_allowActionMenuItemTextWithIcon = 0x7f040005;
public static final int abs__config_showMenuShortcutsWhenKeyboardPresent = 0x7f040003;
public static final int abs__split_action_bar_is_narrow = 0x7f040001;
}
public static final class color {
public static final int abs__background_holo_dark = 0x7f050000;
public static final int abs__background_holo_light = 0x7f050001;
public static final int abs__bright_foreground_disabled_holo_dark = 0x7f050004;
public static final int abs__bright_foreground_disabled_holo_light = 0x7f050005;
public static final int abs__bright_foreground_holo_dark = 0x7f050002;
public static final int abs__bright_foreground_holo_light = 0x7f050003;
public static final int abs__primary_text_disable_only_holo_dark = 0x7f050006;
public static final int abs__primary_text_disable_only_holo_light = 0x7f050007;
public static final int abs__primary_text_holo_dark = 0x7f050008;
public static final int abs__primary_text_holo_light = 0x7f050009;
}
public static final class dimen {
public static final int abs__action_bar_default_height = 0x7f060001;
public static final int abs__action_bar_icon_vertical_padding = 0x7f060002;
public static final int abs__action_bar_subtitle_bottom_margin = 0x7f060006;
public static final int abs__action_bar_subtitle_text_size = 0x7f060004;
public static final int abs__action_bar_subtitle_top_margin = 0x7f060005;
public static final int abs__action_bar_title_text_size = 0x7f060003;
public static final int abs__action_button_min_width = 0x7f060007;
public static final int abs__config_prefDialogWidth = 0x7f060000;
public static final int abs__dialog_min_width_major = 0x7f06000d;
public static final int abs__dialog_min_width_minor = 0x7f06000e;
public static final int abs__dropdownitem_icon_width = 0x7f06000a;
public static final int abs__dropdownitem_text_padding_left = 0x7f060008;
public static final int abs__dropdownitem_text_padding_right = 0x7f060009;
public static final int abs__search_view_preferred_width = 0x7f06000c;
public static final int abs__search_view_text_min_width = 0x7f06000b;
}
public static final class drawable {
public static final int abs__ab_bottom_solid_dark_holo = 0x7f020000;
public static final int abs__ab_bottom_solid_inverse_holo = 0x7f020001;
public static final int abs__ab_bottom_solid_light_holo = 0x7f020002;
public static final int abs__ab_bottom_transparent_dark_holo = 0x7f020003;
public static final int abs__ab_bottom_transparent_light_holo = 0x7f020004;
public static final int abs__ab_share_pack_holo_dark = 0x7f020005;
public static final int abs__ab_share_pack_holo_light = 0x7f020006;
public static final int abs__ab_solid_dark_holo = 0x7f020007;
public static final int abs__ab_solid_light_holo = 0x7f020008;
public static final int abs__ab_solid_shadow_holo = 0x7f020009;
public static final int abs__ab_stacked_solid_dark_holo = 0x7f02000a;
public static final int abs__ab_stacked_solid_light_holo = 0x7f02000b;
public static final int abs__ab_stacked_transparent_dark_holo = 0x7f02000c;
public static final int abs__ab_stacked_transparent_light_holo = 0x7f02000d;
public static final int abs__ab_transparent_dark_holo = 0x7f02000e;
public static final int abs__ab_transparent_light_holo = 0x7f02000f;
public static final int abs__activated_background_holo_dark = 0x7f020010;
public static final int abs__activated_background_holo_light = 0x7f020011;
public static final int abs__btn_cab_done_default_holo_dark = 0x7f020012;
public static final int abs__btn_cab_done_default_holo_light = 0x7f020013;
public static final int abs__btn_cab_done_focused_holo_dark = 0x7f020014;
public static final int abs__btn_cab_done_focused_holo_light = 0x7f020015;
public static final int abs__btn_cab_done_holo_dark = 0x7f020016;
public static final int abs__btn_cab_done_holo_light = 0x7f020017;
public static final int abs__btn_cab_done_pressed_holo_dark = 0x7f020018;
public static final int abs__btn_cab_done_pressed_holo_light = 0x7f020019;
public static final int abs__cab_background_bottom_holo_dark = 0x7f02001a;
public static final int abs__cab_background_bottom_holo_light = 0x7f02001b;
public static final int abs__cab_background_top_holo_dark = 0x7f02001c;
public static final int abs__cab_background_top_holo_light = 0x7f02001d;
public static final int abs__ic_ab_back_holo_dark = 0x7f02001e;
public static final int abs__ic_ab_back_holo_light = 0x7f02001f;
public static final int abs__ic_cab_done_holo_dark = 0x7f020020;
public static final int abs__ic_cab_done_holo_light = 0x7f020021;
public static final int abs__ic_clear = 0x7f020022;
public static final int abs__ic_clear_disabled = 0x7f020023;
public static final int abs__ic_clear_holo_light = 0x7f020024;
public static final int abs__ic_clear_normal = 0x7f020025;
public static final int abs__ic_clear_search_api_disabled_holo_light = 0x7f020026;
public static final int abs__ic_clear_search_api_holo_light = 0x7f020027;
public static final int abs__ic_commit_search_api_holo_dark = 0x7f020028;
public static final int abs__ic_commit_search_api_holo_light = 0x7f020029;
public static final int abs__ic_go = 0x7f02002a;
public static final int abs__ic_go_search_api_holo_light = 0x7f02002b;
public static final int abs__ic_menu_moreoverflow_holo_dark = 0x7f02002c;
public static final int abs__ic_menu_moreoverflow_holo_light = 0x7f02002d;
public static final int abs__ic_menu_moreoverflow_normal_holo_dark = 0x7f02002e;
public static final int abs__ic_menu_moreoverflow_normal_holo_light = 0x7f02002f;
public static final int abs__ic_menu_share_holo_dark = 0x7f020030;
public static final int abs__ic_menu_share_holo_light = 0x7f020031;
public static final int abs__ic_search = 0x7f020032;
public static final int abs__ic_search_api_holo_light = 0x7f020033;
public static final int abs__ic_voice_search = 0x7f020034;
public static final int abs__ic_voice_search_api_holo_light = 0x7f020035;
public static final int abs__item_background_holo_dark = 0x7f020036;
public static final int abs__item_background_holo_light = 0x7f020037;
public static final int abs__list_activated_holo = 0x7f020038;
public static final int abs__list_divider_holo_dark = 0x7f020039;
public static final int abs__list_divider_holo_light = 0x7f02003a;
public static final int abs__list_focused_holo = 0x7f02003b;
public static final int abs__list_longpressed_holo = 0x7f02003c;
public static final int abs__list_pressed_holo_dark = 0x7f02003d;
public static final int abs__list_pressed_holo_light = 0x7f02003e;
public static final int abs__list_selector_background_transition_holo_dark = 0x7f02003f;
public static final int abs__list_selector_background_transition_holo_light = 0x7f020040;
public static final int abs__list_selector_disabled_holo_dark = 0x7f020041;
public static final int abs__list_selector_disabled_holo_light = 0x7f020042;
public static final int abs__list_selector_holo_dark = 0x7f020043;
public static final int abs__list_selector_holo_light = 0x7f020044;
public static final int abs__menu_dropdown_panel_holo_dark = 0x7f020045;
public static final int abs__menu_dropdown_panel_holo_light = 0x7f020046;
public static final int abs__progress_bg_holo_dark = 0x7f020047;
public static final int abs__progress_bg_holo_light = 0x7f020048;
public static final int abs__progress_horizontal_holo_dark = 0x7f020049;
public static final int abs__progress_horizontal_holo_light = 0x7f02004a;
public static final int abs__progress_medium_holo = 0x7f02004b;
public static final int abs__progress_primary_holo_dark = 0x7f02004c;
public static final int abs__progress_primary_holo_light = 0x7f02004d;
public static final int abs__progress_secondary_holo_dark = 0x7f02004e;
public static final int abs__progress_secondary_holo_light = 0x7f02004f;
public static final int abs__search_dropdown_dark = 0x7f020050;
public static final int abs__search_dropdown_light = 0x7f020051;
public static final int abs__spinner_48_inner_holo = 0x7f020052;
public static final int abs__spinner_48_outer_holo = 0x7f020053;
public static final int abs__spinner_ab_default_holo_dark = 0x7f020054;
public static final int abs__spinner_ab_default_holo_light = 0x7f020055;
public static final int abs__spinner_ab_disabled_holo_dark = 0x7f020056;
public static final int abs__spinner_ab_disabled_holo_light = 0x7f020057;
public static final int abs__spinner_ab_focused_holo_dark = 0x7f020058;
public static final int abs__spinner_ab_focused_holo_light = 0x7f020059;
public static final int abs__spinner_ab_holo_dark = 0x7f02005a;
public static final int abs__spinner_ab_holo_light = 0x7f02005b;
public static final int abs__spinner_ab_pressed_holo_dark = 0x7f02005c;
public static final int abs__spinner_ab_pressed_holo_light = 0x7f02005d;
public static final int abs__tab_indicator_ab_holo = 0x7f02005e;
public static final int abs__tab_selected_focused_holo = 0x7f02005f;
public static final int abs__tab_selected_holo = 0x7f020060;
public static final int abs__tab_selected_pressed_holo = 0x7f020061;
public static final int abs__tab_unselected_pressed_holo = 0x7f020062;
public static final int abs__textfield_search_default_holo_dark = 0x7f020063;
public static final int abs__textfield_search_default_holo_light = 0x7f020064;
public static final int abs__textfield_search_right_default_holo_dark = 0x7f020065;
public static final int abs__textfield_search_right_default_holo_light = 0x7f020066;
public static final int abs__textfield_search_right_selected_holo_dark = 0x7f020067;
public static final int abs__textfield_search_right_selected_holo_light = 0x7f020068;
public static final int abs__textfield_search_selected_holo_dark = 0x7f020069;
public static final int abs__textfield_search_selected_holo_light = 0x7f02006a;
public static final int abs__textfield_searchview_holo_dark = 0x7f02006b;
public static final int abs__textfield_searchview_holo_light = 0x7f02006c;
public static final int abs__textfield_searchview_right_holo_dark = 0x7f02006d;
public static final int abs__textfield_searchview_right_holo_light = 0x7f02006e;
public static final int abs__toast_frame = 0x7f02006f;
}
public static final class id {
public static final int abs__action_bar = 0x7f080020;
public static final int abs__action_bar_container = 0x7f08001f;
public static final int abs__action_bar_subtitle = 0x7f080011;
public static final int abs__action_bar_title = 0x7f080010;
public static final int abs__action_context_bar = 0x7f080021;
public static final int abs__action_menu_divider = 0x7f080002;
public static final int abs__action_menu_presenter = 0x7f080003;
public static final int abs__action_mode_bar = 0x7f080025;
public static final int abs__action_mode_bar_stub = 0x7f080024;
public static final int abs__action_mode_close_button = 0x7f080014;
public static final int abs__activity_chooser_view_content = 0x7f080015;
public static final int abs__checkbox = 0x7f08001c;
public static final int abs__content = 0x7f080022;
public static final int abs__default_activity_button = 0x7f080018;
public static final int abs__expand_activities_button = 0x7f080016;
public static final int abs__home = 0x7f080000;
public static final int abs__icon = 0x7f08001a;
public static final int abs__image = 0x7f080017;
public static final int abs__imageButton = 0x7f080012;
public static final int abs__list_item = 0x7f080019;
public static final int abs__progress_circular = 0x7f080004;
public static final int abs__progress_horizontal = 0x7f080005;
public static final int abs__radio = 0x7f08001d;
public static final int abs__search_badge = 0x7f080028;
public static final int abs__search_bar = 0x7f080027;
public static final int abs__search_button = 0x7f080029;
public static final int abs__search_close_btn = 0x7f08002e;
public static final int abs__search_edit_frame = 0x7f08002a;
public static final int abs__search_go_btn = 0x7f080030;
public static final int abs__search_mag_icon = 0x7f08002b;
public static final int abs__search_plate = 0x7f08002c;
public static final int abs__search_src_text = 0x7f08002d;
public static final int abs__search_voice_btn = 0x7f080031;
public static final int abs__shortcut = 0x7f08001e;
public static final int abs__split_action_bar = 0x7f080023;
public static final int abs__submit_area = 0x7f08002f;
public static final int abs__textButton = 0x7f080013;
public static final int abs__title = 0x7f08001b;
public static final int abs__up = 0x7f080001;
public static final int disableHome = 0x7f08000a;
public static final int edit_query = 0x7f080026;
public static final int homeAsUp = 0x7f08000b;
public static final int listMode = 0x7f080007;
public static final int normal = 0x7f080008;
public static final int showCustom = 0x7f08000c;
public static final int showHome = 0x7f08000d;
public static final int showTitle = 0x7f08000e;
public static final int tabMode = 0x7f080009;
public static final int useLogo = 0x7f08000f;
public static final int wrap_content = 0x7f080006;
}
public static final class integer {
public static final int abs__max_action_buttons = 0x7f070000;
}
public static final class layout {
public static final int abs__action_bar_home = 0x7f030000;
public static final int abs__action_bar_tab = 0x7f030001;
public static final int abs__action_bar_tab_bar_view = 0x7f030002;
public static final int abs__action_bar_title_item = 0x7f030003;
public static final int abs__action_menu_item_layout = 0x7f030004;
public static final int abs__action_menu_layout = 0x7f030005;
public static final int abs__action_mode_bar = 0x7f030006;
public static final int abs__action_mode_close_item = 0x7f030007;
public static final int abs__activity_chooser_view = 0x7f030008;
public static final int abs__activity_chooser_view_list_item = 0x7f030009;
public static final int abs__list_menu_item_checkbox = 0x7f03000a;
public static final int abs__list_menu_item_icon = 0x7f03000b;
public static final int abs__list_menu_item_radio = 0x7f03000c;
public static final int abs__popup_menu_item_layout = 0x7f03000d;
public static final int abs__screen_action_bar = 0x7f03000e;
public static final int abs__screen_action_bar_overlay = 0x7f03000f;
public static final int abs__screen_simple = 0x7f030010;
public static final int abs__screen_simple_overlay_action_mode = 0x7f030011;
public static final int abs__search_dropdown_item_icons_2line = 0x7f030012;
public static final int abs__search_view = 0x7f030013;
public static final int abs__simple_dropdown_hint = 0x7f030014;
public static final int sherlock_spinner_dropdown_item = 0x7f03001b;
public static final int sherlock_spinner_item = 0x7f03001c;
}
public static final class string {
public static final int abs__action_bar_home_description = 0x7f090000;
public static final int abs__action_bar_up_description = 0x7f090001;
public static final int abs__action_menu_overflow_description = 0x7f090002;
public static final int abs__action_mode_done = 0x7f090003;
public static final int abs__activity_chooser_view_see_all = 0x7f090004;
public static final int abs__activitychooserview_choose_application = 0x7f090005;
public static final int abs__searchview_description_clear = 0x7f09000a;
public static final int abs__searchview_description_query = 0x7f090009;
public static final int abs__searchview_description_search = 0x7f090008;
public static final int abs__searchview_description_submit = 0x7f09000b;
public static final int abs__searchview_description_voice = 0x7f09000c;
public static final int abs__shareactionprovider_share_with = 0x7f090006;
public static final int abs__shareactionprovider_share_with_application = 0x7f090007;
}
public static final class style {
public static final int Sherlock___TextAppearance_Small = 0x7f0a0046;
public static final int Sherlock___Theme = 0x7f0a0051;
public static final int Sherlock___Theme_DarkActionBar = 0x7f0a0053;
public static final int Sherlock___Theme_Light = 0x7f0a0052;
public static final int Sherlock___Widget_ActionBar = 0x7f0a0001;
public static final int Sherlock___Widget_ActionMode = 0x7f0a0016;
public static final int Sherlock___Widget_ActivityChooserView = 0x7f0a001e;
public static final int Sherlock___Widget_Holo_DropDownItem = 0x7f0a0029;
public static final int Sherlock___Widget_Holo_ListView = 0x7f0a0026;
public static final int Sherlock___Widget_Holo_Spinner = 0x7f0a0023;
public static final int Sherlock___Widget_SearchAutoCompleteTextView = 0x7f0a0033;
public static final int TextAppearance_Sherlock = 0x7f0a004a;
public static final int TextAppearance_Sherlock_Light_SearchResult = 0x7f0a004e;
public static final int TextAppearance_Sherlock_Light_SearchResult_Subtitle = 0x7f0a0050;
public static final int TextAppearance_Sherlock_Light_SearchResult_Title = 0x7f0a004f;
public static final int TextAppearance_Sherlock_Light_Small = 0x7f0a0048;
public static final int TextAppearance_Sherlock_Light_Widget_PopupMenu_Large = 0x7f0a0041;
public static final int TextAppearance_Sherlock_Light_Widget_PopupMenu_Small = 0x7f0a0043;
public static final int TextAppearance_Sherlock_SearchResult = 0x7f0a004b;
public static final int TextAppearance_Sherlock_SearchResult_Subtitle = 0x7f0a004d;
public static final int TextAppearance_Sherlock_SearchResult_Title = 0x7f0a004c;
public static final int TextAppearance_Sherlock_Small = 0x7f0a0047;
public static final int TextAppearance_Sherlock_Widget_ActionBar_Menu = 0x7f0a0036;
public static final int TextAppearance_Sherlock_Widget_ActionBar_Subtitle = 0x7f0a0039;
public static final int TextAppearance_Sherlock_Widget_ActionBar_Subtitle_Inverse = 0x7f0a003a;
public static final int TextAppearance_Sherlock_Widget_ActionBar_Title = 0x7f0a0037;
public static final int TextAppearance_Sherlock_Widget_ActionBar_Title_Inverse = 0x7f0a0038;
public static final int TextAppearance_Sherlock_Widget_ActionMode_Subtitle = 0x7f0a003d;
public static final int TextAppearance_Sherlock_Widget_ActionMode_Subtitle_Inverse = 0x7f0a003e;
public static final int TextAppearance_Sherlock_Widget_ActionMode_Title = 0x7f0a003b;
public static final int TextAppearance_Sherlock_Widget_ActionMode_Title_Inverse = 0x7f0a003c;
public static final int TextAppearance_Sherlock_Widget_DropDownHint = 0x7f0a0049;
public static final int TextAppearance_Sherlock_Widget_DropDownItem = 0x7f0a0045;
public static final int TextAppearance_Sherlock_Widget_PopupMenu = 0x7f0a003f;
public static final int TextAppearance_Sherlock_Widget_PopupMenu_Large = 0x7f0a0040;
public static final int TextAppearance_Sherlock_Widget_PopupMenu_Small = 0x7f0a0042;
public static final int TextAppearance_Sherlock_Widget_TextView_SpinnerItem = 0x7f0a0044;
public static final int Theme_Sherlock = 0x7f0a0054;
public static final int Theme_Sherlock_Light = 0x7f0a0055;
public static final int Theme_Sherlock_Light_DarkActionBar = 0x7f0a0056;
public static final int Theme_Sherlock_Light_NoActionBar = 0x7f0a0058;
public static final int Theme_Sherlock_NoActionBar = 0x7f0a0057;
public static final int Widget = 0x7f0a0000;
public static final int Widget_Sherlock_ActionBar = 0x7f0a0002;
public static final int Widget_Sherlock_ActionBar_Solid = 0x7f0a0003;
public static final int Widget_Sherlock_ActionBar_TabBar = 0x7f0a000a;
public static final int Widget_Sherlock_ActionBar_TabText = 0x7f0a000d;
public static final int Widget_Sherlock_ActionBar_TabView = 0x7f0a0007;
public static final int Widget_Sherlock_ActionButton = 0x7f0a0010;
public static final int Widget_Sherlock_ActionButton_CloseMode = 0x7f0a0012;
public static final int Widget_Sherlock_ActionButton_Overflow = 0x7f0a0014;
public static final int Widget_Sherlock_ActionMode = 0x7f0a0017;
public static final int Widget_Sherlock_ActivityChooserView = 0x7f0a001f;
public static final int Widget_Sherlock_Button_Small = 0x7f0a0021;
public static final int Widget_Sherlock_DropDownItem_Spinner = 0x7f0a002a;
public static final int Widget_Sherlock_Light_ActionBar = 0x7f0a0004;
public static final int Widget_Sherlock_Light_ActionBar_Solid = 0x7f0a0005;
public static final int Widget_Sherlock_Light_ActionBar_Solid_Inverse = 0x7f0a0006;
public static final int Widget_Sherlock_Light_ActionBar_TabBar = 0x7f0a000b;
public static final int Widget_Sherlock_Light_ActionBar_TabBar_Inverse = 0x7f0a000c;
public static final int Widget_Sherlock_Light_ActionBar_TabText = 0x7f0a000e;
public static final int Widget_Sherlock_Light_ActionBar_TabText_Inverse = 0x7f0a000f;
public static final int Widget_Sherlock_Light_ActionBar_TabView = 0x7f0a0008;
public static final int Widget_Sherlock_Light_ActionBar_TabView_Inverse = 0x7f0a0009;
public static final int Widget_Sherlock_Light_ActionButton = 0x7f0a0011;
public static final int Widget_Sherlock_Light_ActionButton_CloseMode = 0x7f0a0013;
public static final int Widget_Sherlock_Light_ActionButton_Overflow = 0x7f0a0015;
public static final int Widget_Sherlock_Light_ActionMode = 0x7f0a0018;
public static final int Widget_Sherlock_Light_ActionMode_Inverse = 0x7f0a0019;
public static final int Widget_Sherlock_Light_ActivityChooserView = 0x7f0a0020;
public static final int Widget_Sherlock_Light_Button_Small = 0x7f0a0022;
public static final int Widget_Sherlock_Light_DropDownItem_Spinner = 0x7f0a002b;
public static final int Widget_Sherlock_Light_ListPopupWindow = 0x7f0a001b;
public static final int Widget_Sherlock_Light_ListView_DropDown = 0x7f0a0028;
public static final int Widget_Sherlock_Light_PopupMenu = 0x7f0a001d;
public static final int Widget_Sherlock_Light_PopupWindow_ActionMode = 0x7f0a002d;
public static final int Widget_Sherlock_Light_ProgressBar = 0x7f0a002f;
public static final int Widget_Sherlock_Light_ProgressBar_Horizontal = 0x7f0a0031;
public static final int Widget_Sherlock_Light_SearchAutoCompleteTextView = 0x7f0a0035;
public static final int Widget_Sherlock_Light_Spinner_DropDown_ActionBar = 0x7f0a0025;
public static final int Widget_Sherlock_ListPopupWindow = 0x7f0a001a;
public static final int Widget_Sherlock_ListView_DropDown = 0x7f0a0027;
public static final int Widget_Sherlock_PopupMenu = 0x7f0a001c;
public static final int Widget_Sherlock_PopupWindow_ActionMode = 0x7f0a002c;
public static final int Widget_Sherlock_ProgressBar = 0x7f0a002e;
public static final int Widget_Sherlock_ProgressBar_Horizontal = 0x7f0a0030;
public static final int Widget_Sherlock_SearchAutoCompleteTextView = 0x7f0a0034;
public static final int Widget_Sherlock_Spinner_DropDown_ActionBar = 0x7f0a0024;
public static final int Widget_Sherlock_TextView_SpinnerItem = 0x7f0a0032;
}
public static final class styleable {
public static final int[] SherlockActionBar = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050, 0x7f010051, 0x7f010052, 0x7f010053, 0x7f010054, 0x7f010055 };
public static final int SherlockActionBar_background = 2;
public static final int SherlockActionBar_backgroundSplit = 3;
public static final int SherlockActionBar_backgroundStacked = 12;
public static final int SherlockActionBar_customNavigationLayout = 13;
public static final int SherlockActionBar_displayOptions = 7;
public static final int SherlockActionBar_divider = 5;
public static final int SherlockActionBar_height = 4;
public static final int SherlockActionBar_homeLayout = 14;
public static final int SherlockActionBar_icon = 10;
public static final int SherlockActionBar_indeterminateProgressStyle = 16;
public static final int SherlockActionBar_itemPadding = 18;
public static final int SherlockActionBar_logo = 11;
public static final int SherlockActionBar_navigationMode = 6;
public static final int SherlockActionBar_progressBarPadding = 17;
public static final int SherlockActionBar_progressBarStyle = 15;
public static final int SherlockActionBar_subtitle = 9;
public static final int SherlockActionBar_subtitleTextStyle = 1;
public static final int SherlockActionBar_title = 8;
public static final int SherlockActionBar_titleTextStyle = 0;
public static final int[] SherlockActionMenuItemView = { 0x0101013f };
public static final int SherlockActionMenuItemView_android_minWidth = 0;
public static final int[] SherlockActionMode = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004 };
public static final int SherlockActionMode_background = 2;
public static final int SherlockActionMode_backgroundSplit = 3;
public static final int SherlockActionMode_height = 4;
public static final int SherlockActionMode_subtitleTextStyle = 1;
public static final int SherlockActionMode_titleTextStyle = 0;
public static final int[] SherlockActivityChooserView = { 0x010100d4, 0x7f01005e, 0x7f01005f };
public static final int SherlockActivityChooserView_android_background = 0;
public static final int SherlockActivityChooserView_expandActivityOverflowButtonDrawable = 2;
public static final int SherlockActivityChooserView_initialActivityCount = 1;
public static final int[] SherlockMenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 };
public static final int SherlockMenuGroup_android_checkableBehavior = 5;
public static final int SherlockMenuGroup_android_enabled = 0;
public static final int SherlockMenuGroup_android_id = 1;
public static final int SherlockMenuGroup_android_menuCategory = 3;
public static final int SherlockMenuGroup_android_orderInCategory = 4;
public static final int SherlockMenuGroup_android_visible = 2;
public static final int[] SherlockMenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x010102d9, 0x010102fb, 0x010102fc, 0x01010389 };
public static final int SherlockMenuItem_android_actionLayout = 14;
public static final int SherlockMenuItem_android_actionProviderClass = 16;
public static final int SherlockMenuItem_android_actionViewClass = 15;
public static final int SherlockMenuItem_android_alphabeticShortcut = 9;
public static final int SherlockMenuItem_android_checkable = 11;
public static final int SherlockMenuItem_android_checked = 3;
public static final int SherlockMenuItem_android_enabled = 1;
public static final int SherlockMenuItem_android_icon = 0;
public static final int SherlockMenuItem_android_id = 2;
public static final int SherlockMenuItem_android_menuCategory = 5;
public static final int SherlockMenuItem_android_numericShortcut = 10;
public static final int SherlockMenuItem_android_onClick = 12;
public static final int SherlockMenuItem_android_orderInCategory = 6;
public static final int SherlockMenuItem_android_showAsAction = 13;
public static final int SherlockMenuItem_android_title = 7;
public static final int SherlockMenuItem_android_titleCondensed = 8;
public static final int SherlockMenuItem_android_visible = 4;
public static final int[] SherlockMenuView = { 0x7f010056, 0x7f010057, 0x7f010058, 0x7f010059, 0x7f01005a, 0x7f01005b, 0x7f01005c, 0x7f01005d };
public static final int SherlockMenuView_headerBackground = 3;
public static final int SherlockMenuView_horizontalDivider = 1;
public static final int SherlockMenuView_itemBackground = 4;
public static final int SherlockMenuView_itemIconDisabledAlpha = 6;
public static final int SherlockMenuView_itemTextAppearance = 0;
public static final int SherlockMenuView_preserveIconSpacing = 7;
public static final int SherlockMenuView_verticalDivider = 2;
public static final int SherlockMenuView_windowAnimationStyle = 5;
public static final int[] SherlockSearchView = { 0x0101011f, 0x01010220, 0x01010264, 0x7f010060, 0x7f010061 };
public static final int SherlockSearchView_android_imeOptions = 2;
public static final int SherlockSearchView_android_inputType = 1;
public static final int SherlockSearchView_android_maxWidth = 0;
public static final int SherlockSearchView_iconifiedByDefault = 3;
public static final int SherlockSearchView_queryHint = 4;
public static final int[] SherlockSpinner = { 0x010100af, 0x01010175, 0x01010176, 0x0101017b, 0x01010262, 0x010102ac, 0x010102ad, 0x01010411 };
public static final int SherlockSpinner_android_dropDownHorizontalOffset = 5;
public static final int SherlockSpinner_android_dropDownSelector = 1;
public static final int SherlockSpinner_android_dropDownVerticalOffset = 6;
public static final int SherlockSpinner_android_dropDownWidth = 4;
public static final int SherlockSpinner_android_gravity = 0;
public static final int SherlockSpinner_android_popupBackground = 2;
public static final int SherlockSpinner_android_popupPromptView = 7;
public static final int SherlockSpinner_android_prompt = 3;
public static final int[] SherlockTheme = { 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036, 0x7f010037, 0x7f010038, 0x7f010039, 0x7f01003a, 0x7f01003b, 0x7f01003c, 0x7f01003d, 0x7f01003e, 0x7f01003f, 0x7f010040, 0x7f010041, 0x7f010042, 0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046, 0x7f010047, 0x7f010048 };
public static final int SherlockTheme_actionBarDivider = 8;
public static final int SherlockTheme_actionBarItemBackground = 9;
public static final int SherlockTheme_actionBarSize = 7;
public static final int SherlockTheme_actionBarSplitStyle = 5;
public static final int SherlockTheme_actionBarStyle = 4;
public static final int SherlockTheme_actionBarTabBarStyle = 1;
public static final int SherlockTheme_actionBarTabStyle = 0;
public static final int SherlockTheme_actionBarTabTextStyle = 2;
public static final int SherlockTheme_actionBarWidgetTheme = 6;
public static final int SherlockTheme_actionButtonStyle = 52;
public static final int SherlockTheme_actionDropDownStyle = 51;
public static final int SherlockTheme_actionMenuTextAppearance = 10;
public static final int SherlockTheme_actionMenuTextColor = 11;
public static final int SherlockTheme_actionModeBackground = 14;
public static final int SherlockTheme_actionModeCloseButtonStyle = 13;
public static final int SherlockTheme_actionModeCloseDrawable = 16;
public static final int SherlockTheme_actionModePopupWindowStyle = 18;
public static final int SherlockTheme_actionModeShareDrawable = 17;
public static final int SherlockTheme_actionModeSplitBackground = 15;
public static final int SherlockTheme_actionModeStyle = 12;
public static final int SherlockTheme_actionOverflowButtonStyle = 3;
public static final int SherlockTheme_actionSpinnerItemStyle = 57;
public static final int SherlockTheme_activatedBackgroundIndicator = 65;
public static final int SherlockTheme_activityChooserViewStyle = 64;
public static final int SherlockTheme_buttonStyleSmall = 19;
public static final int SherlockTheme_dividerVertical = 50;
public static final int SherlockTheme_dropDownHintAppearance = 66;
public static final int SherlockTheme_dropDownListViewStyle = 54;
public static final int SherlockTheme_dropdownListPreferredItemHeight = 56;
public static final int SherlockTheme_homeAsUpIndicator = 53;
public static final int SherlockTheme_listPopupWindowStyle = 63;
public static final int SherlockTheme_listPreferredItemHeightSmall = 44;
public static final int SherlockTheme_listPreferredItemPaddingLeft = 45;
public static final int SherlockTheme_listPreferredItemPaddingRight = 46;
public static final int SherlockTheme_popupMenuStyle = 55;
public static final int SherlockTheme_searchAutoCompleteTextView = 30;
public static final int SherlockTheme_searchDropdownBackground = 31;
public static final int SherlockTheme_searchResultListItemHeight = 41;
public static final int SherlockTheme_searchViewCloseIcon = 32;
public static final int SherlockTheme_searchViewEditQuery = 36;
public static final int SherlockTheme_searchViewEditQueryBackground = 37;
public static final int SherlockTheme_searchViewGoIcon = 33;
public static final int SherlockTheme_searchViewSearchIcon = 34;
public static final int SherlockTheme_searchViewTextField = 38;
public static final int SherlockTheme_searchViewTextFieldRight = 39;
public static final int SherlockTheme_searchViewVoiceIcon = 35;
public static final int SherlockTheme_selectableItemBackground = 20;
public static final int SherlockTheme_spinnerDropDownItemStyle = 29;
public static final int SherlockTheme_spinnerItemStyle = 28;
public static final int SherlockTheme_textAppearanceLargePopupMenu = 22;
public static final int SherlockTheme_textAppearanceListItemSmall = 47;
public static final int SherlockTheme_textAppearanceSearchResultSubtitle = 43;
public static final int SherlockTheme_textAppearanceSearchResultTitle = 42;
public static final int SherlockTheme_textAppearanceSmall = 24;
public static final int SherlockTheme_textAppearanceSmallPopupMenu = 23;
public static final int SherlockTheme_textColorPrimary = 25;
public static final int SherlockTheme_textColorPrimaryDisableOnly = 26;
public static final int SherlockTheme_textColorPrimaryInverse = 27;
public static final int SherlockTheme_textColorSearchUrl = 40;
public static final int SherlockTheme_windowActionBar = 59;
public static final int SherlockTheme_windowActionBarOverlay = 60;
public static final int SherlockTheme_windowActionModeOverlay = 61;
public static final int SherlockTheme_windowContentOverlay = 21;
public static final int SherlockTheme_windowMinWidthMajor = 48;
public static final int SherlockTheme_windowMinWidthMinor = 49;
public static final int SherlockTheme_windowNoTitle = 58;
public static final int SherlockTheme_windowSplitActionBar = 62;
public static final int[] SherlockView = { 0x010100da };
public static final int SherlockView_android_focusable = 0;
}
}
|
[
"wilidga@gmail.com"
] |
wilidga@gmail.com
|
4926daeb616cd892afa1c125adffd38e69de2bf0
|
23de2c10f72a30ade795ac8d4d7923036c575de5
|
/src/com/google/android/gms/location/Geofence.java
|
9ec7daefd26bd8a16265f7b820947f07842899e3
|
[] |
no_license
|
PARTHIBANMS/com.divmob.doodlebubble
|
a2c179ad9aa762668c69c0302bb17958e895148e
|
4718ee64c5edc9bcfc95861754ad9b876bd7fd5d
|
refs/heads/master
| 2020-06-04T22:30:50.560385
| 2014-07-17T10:39:23
| 2014-07-17T10:39:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,885
|
java
|
package com.google.android.gms.location;
import android.os.SystemClock;
import com.google.android.gms.internal.hj;
public abstract interface Geofence
{
public static final int GEOFENCE_TRANSITION_DWELL = 4;
public static final int GEOFENCE_TRANSITION_ENTER = 1;
public static final int GEOFENCE_TRANSITION_EXIT = 2;
public static final long NEVER_EXPIRE = -1L;
public abstract String getRequestId();
public static final class Builder
{
private String Hh = null;
private int KU = 0;
private long KV = -9223372036854775808L;
private short KW = -1;
private double KX;
private double KY;
private float KZ;
private int La = 0;
private int Lb = -1;
public Geofence build()
{
if (this.Hh == null) {
throw new IllegalArgumentException("Request ID not set.");
}
if (this.KU == 0) {
throw new IllegalArgumentException("Transitions types not set.");
}
if (((0x4 & this.KU) != 0) && (this.Lb < 0)) {
throw new IllegalArgumentException("Non-negative loitering delay needs to be set when transition types include GEOFENCE_TRANSITION_DWELLING.");
}
if (this.KV == -9223372036854775808L) {
throw new IllegalArgumentException("Expiration not set.");
}
if (this.KW == -1) {
throw new IllegalArgumentException("Geofence region not set.");
}
if (this.La < 0) {
throw new IllegalArgumentException("Notification responsiveness should be nonnegative.");
}
return new hj(this.Hh, this.KU, (short)1, this.KX, this.KY, this.KZ, this.KV, this.La, this.Lb);
}
public Builder setCircularRegion(double paramDouble1, double paramDouble2, float paramFloat)
{
this.KW = 1;
this.KX = paramDouble1;
this.KY = paramDouble2;
this.KZ = paramFloat;
return this;
}
public Builder setExpirationDuration(long paramLong)
{
if (paramLong < 0L)
{
this.KV = -1L;
return this;
}
this.KV = (paramLong + SystemClock.elapsedRealtime());
return this;
}
public Builder setLoiteringDelay(int paramInt)
{
this.Lb = paramInt;
return this;
}
public Builder setNotificationResponsiveness(int paramInt)
{
this.La = paramInt;
return this;
}
public Builder setRequestId(String paramString)
{
this.Hh = paramString;
return this;
}
public Builder setTransitionTypes(int paramInt)
{
this.KU = paramInt;
return this;
}
}
}
/* Location: C:\Users\PARTHIBAN\Desktop\source\dex2jar-0.0.9.15\classes_dex2jar.jar
* Qualified Name: com.google.android.gms.location.Geofence
* JD-Core Version: 0.7.0.1
*/
|
[
"bsauniv30@BSAs-iMac-93.local"
] |
bsauniv30@BSAs-iMac-93.local
|
783e19f7d481576b88387d5e89997b8fb63b4985
|
e8f171ddb3c8fb54fcecaff0a84648e76681f982
|
/community/logicaldoc/tags/logicaldoc-7.6.1/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/services/ZohoService.java
|
5b00dea8cdea3c014885b3c1b5756a66226e6302
|
[] |
no_license
|
zhunengfei/logicaldoc
|
f12114ef72935e683af4b50f30a88fbd5df9bfde
|
9d432d29a9b43ebd2b13a1933a50add3f4784815
|
refs/heads/master
| 2021-01-20T01:05:48.499693
| 2017-01-13T16:24:16
| 2017-01-13T16:24:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,491
|
java
|
package com.logicaldoc.gui.frontend.client.services;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.logicaldoc.gui.common.client.ServerException;
import com.logicaldoc.gui.common.client.beans.GUIDocument;
/**
* The client side stub for the Zoho Service.
*
* @author Marco Meschieri - LogicalDOC
* @since 7.5.2
*/
@RemoteServiceRelativePath("zoho")
public interface ZohoService extends RemoteService {
public void saveAuthToken(String authToken) throws ServerException;
public String loadAuthToken() throws ServerException;
/**
* Exports documents and folders into Zoho
*
* @param sid The session ID
* @param targetPath the target path in Zoho (must be a folder)
* @param folderIds Ids of the folders to be imported (all subfolders and
* docs will be imported as well
* @param docIds Ids of the documents to be imported
* @return
* @throws ServerException
*/
public boolean exportDocuments(String targetFolderId, long[] folderIds, long[] docIds) throws ServerException;
/**
* Exports documents and folders from Zoho into LogicalDOC
*
* @param sid The session ID
* @param targetFolder ID of the root folder that will receive the imported
* elements
* @param folderCompositeIds array of the identifiers of the Zoho folder
* each one is a tokenized string folder_name:folder_id
* @param docIds Ids of the documents in Zoho to be imported
* @return
* @throws ServerException
*/
public int importDocuments(long targetFolder, String[] folderCompositeIds, String[] documentIds)
throws ServerException;
/**
* Uploads a document to Zoho.
*
* @param docId ID of the document to upload
*
* @returns The resourceId of the uploaded document
*/
public String upload(long docId) throws ServerException;
/**
* Deletes a document in Zoho.
*
* @param docId ID of the document to delete
*/
public void delete(String resourceId) throws ServerException;
/**
* Performs the check-in of a Zoho's document into the LogicalDOC
* repository.
*
* @param docId ID of the document to update
* @param comment The comment left for the checkin
* @param major If this is a major or minor release
*
* @return The checked-in document
*/
public GUIDocument checkin(long docId, String comment, boolean major) throws ServerException;
}
|
[
"car031@bae09422-6297-422f-b3ee-419521344c47"
] |
car031@bae09422-6297-422f-b3ee-419521344c47
|
93439c69189dcd7a24044099e1c8df4cf4003e9f
|
9d265892d49e97e98078f7cdba620acd33f69dd9
|
/gratewall/sjzx_query/src/com/gwssi/expression/config/ConfigurationFactory.java
|
f69998176178d78922437f4a5d7e89ca0791ec2f
|
[] |
no_license
|
gxlioper/collections
|
70d11d5f3e6c999d40fc9f92b1fc26e6d78bf15d
|
2458b9e260edd91d564b063072801905e0377a00
|
refs/heads/master
| 2023-06-21T22:17:49.069471
| 2021-08-10T15:43:51
| 2021-08-10T15:43:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,370
|
java
|
package com.gwssi.expression.config;
import com.gwssi.expression.core.lang.ExpressionException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConfigurationFactory{
static final Logger logger = LoggerFactory.getLogger(ConfigurationFactory.class);
static Set<String> configLocationSet = new HashSet<String>();
static Map<Object, Configuration> confMap = new HashMap<Object, Configuration>();
static final String defaultPath = "classpath:com/gwssi/common/rodimus/report/expr/config/expression-config.xml";
public static void addSingleConfigLocation(String configPath, boolean isSkipExists){
if ((configPath == null) || ("".equals(configPath))){
throw new IllegalArgumentException("配置文件路径为空");
}
if ((isSkipExists) && (configLocationSet.contains(configPath))){
logger.info("没有应用配置,原因:已存在。配置路径:" + configPath);
return;
}
configLocationSet.add(configPath);
Configuration config = null;
// if(defaultPath.equals(config)){
config = new Configuration();
// }else{
// config = new Configuration(confMap.get("default"));
// }
config.applyConfigPath(configPath);
String configName = (String)config.get("config.name");
confMap.put(configName, config);
logger.info("应用表达式配置:" + configName);
}
public static Configuration getConfiguration(Object configName){
Configuration config = (Configuration)confMap.get(configName);
if (config == null){
throw new ExpressionException("请在程序或web.xml中配置表达式配置文件:" + configName);
}
return config;
}
public static String toLogString(){
Set<Object> localSet = confMap.keySet();
return String.valueOf(localSet);
}
public static void addConfigLocation(String configPath)
throws Exception{
if ((configPath == null) || ("".equals(configPath))){
return;
}
String[] arrayOfString = configPath.split(";");
for (int i = 0; i < arrayOfString.length; i++)
{
String str = arrayOfString[i].trim();
if ("".equals(str))
continue;
addSingleConfigLocation(str, true);
}
}
// static{
// addSingleConfigLocation(defaultPath,true);
// }
}
|
[
"1039288191@qq.com"
] |
1039288191@qq.com
|
650200b51837f37f737875983cbe3a361be42dc8
|
fe788ea230081361cf143c7086484500f434ae1d
|
/src/askap/css/janus/util/Util.java
|
cc0b6555d5cbd6a47bb3a15bf685f1c9baf33b09
|
[] |
no_license
|
webepics/epics-react
|
7420f7eb5b3d16e0e1bf6c78ebe98a936ff650e9
|
d43a2c1ef1ebeea4444b5955fd2371c14acddefb
|
refs/heads/master
| 2020-04-05T19:49:52.648796
| 2018-11-12T00:50:33
| 2018-11-12T00:50:33
| 157,152,233
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,907
|
java
|
package askap.css.janus.util;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import org.apache.log4j.Logger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import askap.css.janus.websocket.ClientManager;
import askap.css.janus.websocket.ResponseMessage;
public class Util {
public static Logger logger = Logger.getLogger(Util.class);
public static final Gson theGson;
public static String PVFILE_LOCATION = "";
private static Properties parset;
static {
GsonBuilder gsonbuilder = new GsonBuilder();
gsonbuilder.registerTypeAdapter(ResponseMessage.class, new ResponseMessage.ResponseMessageSerializer());
theGson = gsonbuilder.setPrettyPrinting().create();
parset = new Properties();
try {
InputStream in = Util.class.getClassLoader().getResourceAsStream("epics-react.properties");
parset.load(in);
} catch (IOException e) {
System.out.println("Could not load peroperties file: obs.properties");
e.printStackTrace();
}
PVFILE_LOCATION = parset.getProperty("pvfiles.directory");
}
/**
* merge the json contents of all given filesnames into a single json list
* @param fileNames
* @return
*/
public static JsonElement mergeJsonFiles(String fileNames[]) throws Exception {
JsonArray pvList = new JsonArray();
for (String fileName : fileNames) {
String fullFileName = PVFILE_LOCATION + "/" + fileName.trim();
JsonParser parser = new JsonParser();
JsonArray obj = parser.parse(new FileReader(new File(fullFileName))).getAsJsonArray();
for (JsonElement elem : obj) {
pvList.add(elem);
}
}
return pvList;
}
}
|
[
"xinyu.wu@csiro.au"
] |
xinyu.wu@csiro.au
|
891531376d48ddcdb381d14794fd60939b749f2a
|
8ea2ea80ebf9cd3cf42fe7b4e57aee5f3d59dd1e
|
/SampleModel.java
|
c5dfc55d05e0f9453d8c7c84df996202594c84ac
|
[] |
no_license
|
HariharanBaskaran/AndroidParcebleWithRecyclerView
|
9dd90df27978388a659908b531b3e6ea4b15b5ab
|
9af7baa9aedd91b2dba1538e93389c6cf98fba56
|
refs/heads/master
| 2020-03-21T21:44:34.596638
| 2018-06-29T00:29:24
| 2018-06-29T00:29:24
| 139,081,507
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,425
|
java
|
package com.solvedge.androidsampleexamples;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by hariharan on 6/28/2018.
*/
public class SampleModel implements Parcelable{
private String sample;
private String isSelected;
public String getSample() {
return sample;
}
public void setSample(String sample) {
this.sample = sample;
}
public String isSelected() {
return isSelected;
}
public void setSelected(String selected) {
isSelected = selected;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(sample);
dest.writeString(String.valueOf(isSelected));
}
public static final Parcelable.Creator<SampleModel> CREATOR = new Parcelable.Creator<SampleModel>() {
public SampleModel createFromParcel(Parcel in) {
return new SampleModel(in);
}
public SampleModel[] newArray(int size) {
return new SampleModel[size];
}
};
private SampleModel(Parcel in) {
sample = in.readString();
isSelected = in.readString();
}
public SampleModel(String sample,String isSelected){
this.sample = sample;
this.isSelected = isSelected;
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
db242e140cdd3dacc37f98823e1a9de4276b9978
|
1ea6accd3163518319e5425763f24e31c508452d
|
/src/main/java/com/model/businesslogic/AsientoContableService.java
|
41b14aabbd4d53791328e4f685e365863a85f533
|
[] |
no_license
|
gdiazcamilo/nominaRestful
|
b1af0d6c6115c45ab736b7257579d3798b273a97
|
fb5a77c951d199382f4318e579627af29e886d0e
|
refs/heads/master
| 2021-01-18T16:31:23.819365
| 2015-07-19T22:19:02
| 2015-07-19T22:19:02
| 38,860,742
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 218
|
java
|
package com.model.businesslogic;
import com.model.AsientoContable;
public class AsientoContableService extends BaseService<AsientoContable>{
public AsientoContableService() {
super(AsientoContable.class);
}
}
|
[
"gdiazcamilo@gmail.com"
] |
gdiazcamilo@gmail.com
|
00b5e945c48992d184acaef18c409e122bb834c3
|
53a649692d0bd9bee1be8a12afae48d41430b9c0
|
/src/main/java/seedu/address/model/tag/TagIsUnreferenced.java
|
2fc6bc2fbb5b125baea9318c498d1b2efe3ccb8b
|
[
"MIT"
] |
permissive
|
KT27Learn/tp
|
ac878276d686184c7af9504d721a824a8e310ba0
|
44fb91f4c67ca05c95e38aa9cae057cbd17a1e2b
|
refs/heads/master
| 2023-09-05T10:43:30.869561
| 2021-11-05T08:19:13
| 2021-11-05T08:19:13
| 405,566,578
| 0
| 0
|
NOASSERTION
| 2021-10-21T14:49:50
| 2021-09-12T06:36:45
|
Java
|
UTF-8
|
Java
| false
| false
| 295
|
java
|
package seedu.address.model.tag;
import java.util.function.Predicate;
/**
* Tests if {@code Tag} is unreferenced by clients.
*/
public class TagIsUnreferenced implements Predicate<Tag> {
@Override
public boolean test(Tag tag) {
return tag.getClients().size() == 0;
}
}
|
[
"t.karwi@yahoo.com"
] |
t.karwi@yahoo.com
|
b661ab89028f8fe63b9c3f410e811a8e34ea29c0
|
0e53cec1e52cb24db275c97f5fc1e58d2a8f8b1f
|
/04-java-spring/01-spring-fundamentals/03-hello-human/HelloHuman/src/main/java/com/nick/HelloHuman/controllers/HomeControllers.java
|
fc0244a1708fe12daaf14aabec739ffbde10a7b3
|
[] |
no_license
|
Java-October-2020/NickM-Assignments
|
0129d7c0efd1fb65ef3bd1cdaf6f4a118b71e36c
|
66cfc0c9516e678e46d25b5d439a1c10a2fb24ac
|
refs/heads/master
| 2023-01-23T19:37:25.604897
| 2020-11-18T17:39:43
| 2020-11-18T17:39:43
| 299,692,149
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 582
|
java
|
package com.nick.HelloHuman.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeControllers {
@RequestMapping("/users")
public String welcome() {
return "index.jsp";
}
@RequestMapping("/users/{username}")
public String showName(@PathVariable("username") String userName, Model viewModel) {
viewModel.addAttribute("userName", userName);
return "greeting.jsp";
}
}
|
[
"nicolasamiranda97@gmail.com"
] |
nicolasamiranda97@gmail.com
|
a7ba7a483388870f4649a6e20ae419eb5ca46c02
|
dbb465341cea51e2f9800283a26efe2cd84ef8b5
|
/src/main/java/com/ibm/ws/jms20/samples/DeliveryDelayTest.java
|
8322a25be60d02e682074eca17c2e7fdf90726b5
|
[] |
no_license
|
WASdev/sample.javaee7.jms
|
50d7562d898c3dd7a09468fa69f915b8db70346a
|
665ae6f05e745d601e4e0a1b3af95b85b7aedae7
|
refs/heads/master
| 2021-01-10T14:33:22.832219
| 2019-01-21T19:43:34
| 2019-01-21T19:43:34
| 45,968,313
| 6
| 10
| null | 2019-01-21T19:43:35
| 2015-11-11T08:09:40
|
Java
|
UTF-8
|
Java
| false
| false
| 9,428
|
java
|
/*
* COPYRIGHT LICENSE: This information contains sample code provided in source
* code form. You may copy, modify, and distribute these sample programs in any
* form without payment to IBM for the purposes of developing, using, marketing
* or distributing application programs conforming to the application programming
* interface for the operating platform for which the sample code is written.
*
* Notwithstanding anything to the contrary, IBM PROVIDES THE SAMPLE SOURCE CODE
* ON AN "AS IS" BASIS AND IBM DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING,
* BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY,
* SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND ANY WARRANTY OR
* CONDITION OF NON-INFRINGEMENT. IBM SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
* OPERATION OF THE SAMPLE SOURCE CODE. IBM HAS NO OBLIGATION TO PROVIDE
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS TO THE SAMPLE
* SOURCE CODE.
*
* (C) Copyright IBM Corp. 2016.
*
* All Rights Reserved. Licensed Materials - Property of IBM.
*/
package com.ibm.ws.jms20.samples;
import java.io.IOException;
import java.io.PrintWriter;
import javax.jms.JMSConsumer;
import javax.jms.JMSContext;
import javax.jms.JMSProducer;
import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.TopicConnectionFactory;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class P2PTset
*/
@WebServlet("/DeliveryDelayTest")
public class DeliveryDelayTest extends HttpServlet {
/**
* Default constructor.
*/
public DeliveryDelayTest() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String strAction = request.getParameter("ACTION");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Reading asynchronously</title>");
out.println("<meta charset=\"utf-8\"></meta>");
out.println("<title>JMS WAS Classic tests</title>");
out.println("<style>");
out.println(".frm1{padding: 15px;background-color: #9666af; margin-bottom: 10px;}");
out.println(".frm2{padding-left: 25px; font-family: Verdana; color: #440055;}");
out.println(".big{font-size: 26px; color: white;}");
out.println(".small{font-size: 12px;}");
out.println("button, select{padding: 5px; padding-left: 20px; padding-right: 20px; margin:10px; width: 270px}");
out.println("</style>");
out.println("</head>");
out.println("<body>");
out.println("<body>");
out.println("<div class=\"frm1\">");
out.println("<div class=\"big\"> WAS Java EE 7 Sample - JMS</div>");
out.println("</div>");
out.println("<div class=\"frm2\">");
out.println("</div>");
out.println("</head>");
try {
if (strAction == null) {
out.println("Please specify the Action");
out.println("Example : http://<host>:<port>/JMS20_SamplesWeb/DeliveryDelayTest?ACTION=deliveryDelayQueue");
out.println("<br><a href=\"/sample.javaee7.jms/\">Return to main page</a><br>");
} else if (strAction.equalsIgnoreCase("deliveryDelayQueue")) {
deliveryDelayQueue(request, response);
out.println("<br><a href=\"/sample.javaee7.jms/\">Return to main page</a><br>");
} else if (strAction.equalsIgnoreCase("deliveryDelayTopic")) {
deliveryDelayTopic(request, response);
out.println("<br><a href=\"/sample.javaee7.jms/\">Return to main page</a><br>");
} else {
out.println("Incorrect Action Specified, the valid actions are");
out.println("ACTION=deliveryDelayQueue");
out.println("ACTION=deliveryDelayTopic");
out.println("<br><a href=\"/sample.javaee7.jms/\">Return to main page</a><br>");
}
} catch (Exception e) {
out.println("Something unexpected happened, check the logs or restart the server");
e.printStackTrace();
}
}
/**
* Scenario: Point to Point</br> Connects to ME using connection factory
* jndi_JMS_BASE_QCF </br> Sends one message to Queue defined in
* jndi_INPUT_Q </br> Receives the message and prints it on console </br>
*
* @param request
* HTTP request
* @param response
* HTTP response
* @throws Exception
* if an error occurs.
*/
public void deliveryDelayQueue(HttpServletRequest request,
HttpServletResponse response) throws Exception {
PrintWriter out = response.getWriter();
out.println("In this scenario, setDeliveryDelay on JMSProducer is being showcased");
out.println("<br>");
long deliveryDelay = 10000;
/*
* Lookup Queue Connection Factory from JNDI
*/
QueueConnectionFactory cf1 = (QueueConnectionFactory) new InitialContext()
.lookup("java:comp/env/jndi_JMS_BASE_QCF");
// Lookup Queue resource from JNDI
Queue queue = (Queue) new InitialContext()
.lookup("java:comp/env/jndi_INPUT_Q");
// Creating Context
JMSContext jmsContext = cf1.createContext();
// Creating Producer using JMSContext
JMSProducer producer = jmsContext.createProducer();
// setting the delivery delay on producer
producer.setDeliveryDelay(deliveryDelay);
// Creating Consumer using JMSContext
JMSConsumer consumer = jmsContext.createConsumer(queue);
// Creating Text Message using JMSContext
TextMessage message = jmsContext.createTextMessage();
message.setText("JMS20 Samples message");
// Send message to Queue
producer.send(queue, message);
long sendTime = System.currentTimeMillis();
out.println("Time at send " + sendTime);
out.println("<br>");
// receive message from Queue
TextMessage msg = (TextMessage) consumer.receive(20000);
long receiveTime = System.currentTimeMillis();
out.println("Received Message Successfully : " + msg);
out.println("<br>");
out.println("Time at receive " + receiveTime);
out.println("<br>");
out.println("Delivery Delay is enabled to 10000ms and the difference between send time and receive time is seen to be " + (receiveTime - sendTime));
out.println("<br>");
if (jmsContext != null)
jmsContext.close();
out.println("deliveryDelayQueue Completed");
out.println("<br>");
}// end of deliveryDelayQueue
/**
* scenario: Performs pub/sub flow</br> Connects to ME using connection
* factory jmsTCF </br> Creates a consumer for topic jmsTopic </br>
* Publishes a single message to the topic jmsTopic </br> Subscriber
* receives the message from topic jmsTopic and the message is printed on
* console </br>
*
* @param request
* HTTP request
* @param response
* HTTP response
* @throws Exception
* if an error occurs.
*/
public void deliveryDelayTopic(HttpServletRequest request,
HttpServletResponse response) throws Exception {
PrintWriter out = response.getWriter();
out.println("In this scenario, setDeliveryDelay on JMSProducer is being showcased");
out.println("<br>");
long deliveryDelay = 10000;
// create a topic connection factory
TopicConnectionFactory cf1 = (TopicConnectionFactory) new InitialContext()
.lookup("java:comp/env/jmsTCF");
// Lookup topic from JNDI
Topic topic = (Topic) new InitialContext()
.lookup("java:comp/env/jmsTopic");
// Creating Context
JMSContext jmsContext = cf1.createContext();
// Creating Consumer using JMSContext
JMSConsumer consumer = jmsContext.createConsumer(topic);
// Creating Producer using JMSContext
JMSProducer producer = jmsContext.createProducer();
// setting the delivery delay on producer
producer.setDeliveryDelay(deliveryDelay);
// Creating Text Message using JMSContext
TextMessage message = jmsContext.createTextMessage();
message.setText("JMS20 Samples message");
// Publish a message to the topic
producer.send(topic, message);
long sendTime = System.currentTimeMillis();
out.println("Time at send " + sendTime);
out.println("<br>");
TextMessage msg = (TextMessage) consumer.receive(20000);
long receiveTime = System.currentTimeMillis();
out.println("Received Message Successfully : " + msg);
out.println("<br>");
out.println("Time at receive " + receiveTime);
out.println("<br>");
out.println("Delivery Delay is enabled to 10000ms and the difference between send time and receive time is seen to be " + (receiveTime - sendTime));
out.println("<br>");
if (jmsContext != null)
jmsContext.close();
out.println("deliveryDelayTopic Completed");
out.println("<br>");
} // deliveryDelayTopic
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
|
[
"mosqueda@mx1.ibm.com"
] |
mosqueda@mx1.ibm.com
|
473f83268754e8c7c7c6e0e51d67602598c5f7da
|
c885ef92397be9d54b87741f01557f61d3f794f3
|
/tests-without-trycatch/Lang-5/org.apache.commons.lang3.LocaleUtils/BBC-F0-opt-40/14/org/apache/commons/lang3/LocaleUtils_ESTest_scaffolding.java
|
a2359abadbf7b07517938312be95cb182f1bd5a7
|
[
"CC-BY-4.0",
"MIT"
] |
permissive
|
pderakhshanfar/EMSE-BBC-experiment
|
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
|
fea1a92c2e7ba7080b8529e2052259c9b697bbda
|
refs/heads/main
| 2022-11-25T00:39:58.983828
| 2022-04-12T16:04:26
| 2022-04-12T16:04:26
| 309,335,889
| 0
| 1
| null | 2021-11-05T11:18:43
| 2020-11-02T10:30:38
| null |
UTF-8
|
Java
| false
| false
| 3,307
|
java
|
/**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Oct 21 02:34:38 GMT 2021
*/
package org.apache.commons.lang3;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class LocaleUtils_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.lang3.LocaleUtils";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
/*No java.lang.System property to set*/
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(LocaleUtils_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.lang3.LocaleUtils",
"org.apache.commons.lang3.LocaleUtils$SyncAvoid"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(LocaleUtils_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.apache.commons.lang3.LocaleUtils",
"org.apache.commons.lang3.LocaleUtils$SyncAvoid"
);
}
}
|
[
"pouria.derakhshanfar@gmail.com"
] |
pouria.derakhshanfar@gmail.com
|
0d6eece05efa5ebcc48aa386dcbfb090c1491880
|
4b197afb984c7713b85a6b50d435a338405ec130
|
/vertx-example/src/main/java/com/fys/vertx/example/p2p/Sender.java
|
edc3d8270e4436c9dfca389ba48965d63e7d397f
|
[] |
no_license
|
fengyongshe/distributed-system-example
|
02c26055c6d120c04b38775e7126165ef86b204f
|
38658cad4912129cdeb02c6be197d095ba622fc6
|
refs/heads/master
| 2023-01-09T12:16:21.365350
| 2020-07-07T09:26:27
| 2020-07-07T09:26:27
| 163,684,239
| 0
| 0
| null | 2022-12-27T14:43:31
| 2018-12-31T16:48:41
|
Java
|
UTF-8
|
Java
| false
| false
| 699
|
java
|
package com.fys.vertx.example.p2p;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
public class Sender extends AbstractVerticle {
public static void main(String[] args) {
Runner.runClusteredExample(Sender.class);
}
@Override
public void start() throws Exception {
EventBus bus = vertx.eventBus();
System.out.println("Sender Ready, Start to receive reply!");
vertx.setPeriodic(100, v -> {
bus.send("ping-address", "ping!", reply -> {
if(reply.succeeded()) {
System.out.println("Received reply " + reply.result().body());
} else {
System.out.println("No reply");
}
});
});
}
}
|
[
"fengyongshe@cmss.chinamobile.com"
] |
fengyongshe@cmss.chinamobile.com
|
b0e6422a12e97bb922f720313ad18fbf097e42e4
|
2c28c3b770dd670ba09090795141cac0f38a785e
|
/backend/dh-activiti/src/main/java/com/hyn/activiti/util/SecurityUtil.java
|
a76bbd2f62cbb3256044edd2585425b98104a2ee
|
[] |
no_license
|
wangchuanluoshui/smart-dh
|
0b067f7e735ee6f73a999862b1a6f89cf08f05cd
|
7d2111d056adc114b61786944ec74aa55f3c387c
|
refs/heads/main
| 2023-07-13T21:06:16.236839
| 2021-08-19T15:54:45
| 2021-08-19T15:54:45
| 395,018,672
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,305
|
java
|
package com.hyn.activiti.util;
/*
* @Classname SecurityUtil
* @Description TODO
* @Date 2021-01-01 19:26
* @Created by 62538
*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextImpl;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;
import java.util.Collection;
@Component
public class SecurityUtil {
private Logger logger = LoggerFactory.getLogger(SecurityUtil.class);
@Autowired
private UserDetailsService userDetailsService;
public void logInAs(String username) {
UserDetails user = userDetailsService.loadUserByUsername(username);
if (user == null) {
throw new IllegalStateException("User " + username + " doesn't exist, please provide a valid user");
}
logger.info("> Logged in as: " + username);
SecurityContextHolder.setContext(new SecurityContextImpl(new Authentication() {
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return user.getAuthorities();
}
@Override
public Object getCredentials() {
return user.getPassword();
}
@Override
public Object getDetails() {
return user;
}
@Override
public Object getPrincipal() {
return user;
}
@Override
public boolean isAuthenticated() {
return true;
}
@Override
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
}
@Override
public String getName() {
return user.getUsername();
}
}));
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(username);
}
}
|
[
"625385032@qq.com"
] |
625385032@qq.com
|
8d09ad0a530091e1f328331de7652bbbd489881c
|
f5a5494b0943dc1a1d8ac73ed4a2a69d272836bb
|
/Practice/LeetCode/Easy/SumOfSquares.java
|
a1493aed8e672b558ea5f58e035b1a383068db54
|
[] |
no_license
|
vtkrishn/Learning
|
f0eda9763e1196169b6c4932aca52cb23ded1e2e
|
4ede1bd5205190588e3ebc1445c47e10118a01af
|
refs/heads/master
| 2022-12-12T02:31:33.378052
| 2021-10-20T03:14:21
| 2021-10-20T03:14:21
| 72,395,832
| 1
| 0
| null | 2022-12-07T08:20:22
| 2016-10-31T03:26:38
|
Java
|
UTF-8
|
Java
| false
| false
| 817
|
java
|
public boolean judgeSquareSum(int c) {
for (long a = 0; a * a <= c; a++) {
double b = Math.sqrt(c - a * a);
if (b == (int) b)
return true;
}
return false;
}
----------
public class Solution {
public boolean judgeSquareSum(int c) {
for (long a = 0; a * a <= c; a++) {
int b = c - (int)(a * a);
if (binary_search(0, b, b))
return true;
}
return false;
}
public boolean binary_search(long s, long e, int n) {
if (s > e)
return false;
long mid = s + (e - s) / 2;
if (mid * mid == n)
return true;
if (mid * mid > n)
return binary_search(s, mid - 1, n);
return binary_search(mid + 1, e, n);
}
}
|
[
"vin.sinin@gmail.com"
] |
vin.sinin@gmail.com
|
7d6d6a511594feccac292ee94d2bb8bd42728080
|
34b947e390a17792a0250a358936d92b0d6b4cbf
|
/app/src/main/java/com/sayyidisal/movieapp/activities/DetailTelevisionActivity.java
|
e0fbaeec27ddca8837475d9a982888f526ff0353
|
[] |
no_license
|
sayyidisal/MovieApps
|
23d15bae599066025dde040d1d79cd5d3b20f3ad
|
40adfbdec34c54a830836014e2700fab30120cec
|
refs/heads/main
| 2023-06-26T03:39:05.685103
| 2021-07-26T18:13:22
| 2021-07-26T18:13:22
| 389,727,763
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,054
|
java
|
package com.sayyidisal.movieapp.activities;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.sayyidisal.movieapp.R;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.github.ivbaranov.mfb.MaterialFavoriteButton;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.sayyidisal.movieapp.adapter.TrailerAdapter;
import com.sayyidisal.movieapp.model.ModelTV;
import com.sayyidisal.movieapp.model.ModelTrailer;
import com.sayyidisal.movieapp.networking.ApiEndPoint;
import com.sayyidisal.movieapp.realm.RealmHelper;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class DetailTelevisionActivity extends AppCompatActivity {
Toolbar toolbar;
TextView tvTitle, tvName, tvRating, tvRelease, tvPopularity, tvOverview;
ImageView imgCover, imgPhoto;
RecyclerView rvTrailer;
MaterialFavoriteButton imgFavorite;
FloatingActionButton fabShare;
RatingBar ratingBar;
String NameFilm, ReleaseDate, Popularity, Overview, Cover, Thumbnail, movieURL;
int Id;
double Rating;
ModelTV modelTV;
ProgressDialog progressDialog;
List<ModelTrailer> modelTrailer = new ArrayList<>();
TrailerAdapter trailerAdapter;
RealmHelper helper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (Build.VERSION.SDK_INT >= 21) {
setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("");
setSupportActionBar(toolbar);
assert getSupportActionBar() != null;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
progressDialog = new ProgressDialog(this);
progressDialog.setTitle("Mohon Tunggu");
progressDialog.setCancelable(false);
progressDialog.setMessage("Sedang menampilkan trailer");
ratingBar = findViewById(R.id.ratingBar);
imgCover = findViewById(R.id.imgCover);
imgPhoto = findViewById(R.id.imgPhoto);
imgFavorite = findViewById(R.id.imgFavorite);
tvTitle = findViewById(R.id.tvTitle);
tvName = findViewById(R.id.tvName);
tvRating = findViewById(R.id.tvRating);
tvRelease = findViewById(R.id.tvRelease);
tvPopularity = findViewById(R.id.tvPopularity);
tvOverview = findViewById(R.id.tvOverview);
rvTrailer = findViewById(R.id.rvTrailer);
fabShare = findViewById(R.id.fabShare);
helper = new RealmHelper(this);
modelTV = (ModelTV) getIntent().getSerializableExtra("detailTV");
if (modelTV != null) {
Id = modelTV.getId();
NameFilm = modelTV.getName();
Rating = modelTV.getVoteAverage();
ReleaseDate = modelTV.getReleaseDate();
Popularity = modelTV.getPopularity();
Overview = modelTV.getOverview();
Cover = modelTV.getBackdropPath();
Thumbnail = modelTV.getPosterPath();
movieURL = ApiEndPoint.URLFILM + "" + Id;
tvTitle.setText(NameFilm);
tvName.setText(NameFilm);
tvRating.setText(Rating + "/10");
tvRelease.setText(ReleaseDate);
tvPopularity.setText(Popularity);
tvOverview.setText(Overview);
tvTitle.setSelected(true);
tvName.setSelected(true);
float newValue = (float)Rating;
ratingBar.setNumStars(5);
ratingBar.setStepSize((float) 0.5);
ratingBar.setRating(newValue / 2);
Glide.with(this)
.load(ApiEndPoint.URLIMAGE + Cover)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(imgCover);
Glide.with(this)
.load(ApiEndPoint.URLIMAGE + Thumbnail)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(imgPhoto);
rvTrailer.setHasFixedSize(true);
rvTrailer.setLayoutManager(new LinearLayoutManager(this));
getTrailer();
}
imgFavorite.setOnFavoriteChangeListener(
new MaterialFavoriteButton.OnFavoriteChangeListener() {
@Override
public void onFavoriteChanged(MaterialFavoriteButton buttonView, boolean favorite) {
if (favorite) {
Id = modelTV.getId();
NameFilm = modelTV.getName();
Rating = modelTV.getVoteAverage();
Overview = modelTV.getOverview();
ReleaseDate = modelTV.getReleaseDate();
Thumbnail = modelTV.getPosterPath();
Cover = modelTV.getBackdropPath();
Popularity = modelTV.getPopularity();
helper.addFavoriteTV(Id, NameFilm, Rating, Overview, ReleaseDate, Thumbnail, Cover, Popularity);
Snackbar.make(buttonView, modelTV.getName() + " Added to Favorite",
Snackbar.LENGTH_SHORT).show();
} else {
helper.deleteFavoriteTV(modelTV.getId());
Snackbar.make(buttonView, modelTV.getName() + " Removed from Favorite",
Snackbar.LENGTH_SHORT).show();
}
}
}
);
fabShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
String subject = modelTV.getName();
String description = modelTV.getOverview();
shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
shareIntent.putExtra(Intent.EXTRA_TEXT, subject + "\n\n" + description + "\n\n" + movieURL);
startActivity(Intent.createChooser(shareIntent, "Bagikan dengan :"));
}
});
}
private void getTrailer() {
progressDialog.show();
AndroidNetworking.get(ApiEndPoint.BASEURL + ApiEndPoint.TV_VIDEO + ApiEndPoint.APIKEY + ApiEndPoint.LANGUAGE)
.addPathParameter("id", String.valueOf(Id))
.setPriority(Priority.HIGH)
.build()
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
try {
progressDialog.dismiss();
JSONArray jsonArray = response.getJSONArray("results");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
ModelTrailer dataApi = new ModelTrailer();
dataApi.setKey(jsonObject.getString("key"));
dataApi.setType(jsonObject.getString("type"));
modelTrailer.add(dataApi);
showTrailer();
}
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(DetailTelevisionActivity.this,
"Gagal menampilkan data!", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(ANError anError) {
progressDialog.dismiss();
Toast.makeText(DetailTelevisionActivity.this,
"Tidak ada jaringan internet!", Toast.LENGTH_SHORT).show();
}
});
}
private void showTrailer() {
trailerAdapter = new TrailerAdapter(DetailTelevisionActivity.this, modelTrailer);
rvTrailer.setAdapter(trailerAdapter);
}
public static void setWindowFlag(Activity activity, final int bits, boolean on) {
Window window = activity.getWindow();
WindowManager.LayoutParams winParams = window.getAttributes();
if (on) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
}
window.setAttributes(winParams);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
this.finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
[
"sayyidshalahuddin96@gmail.com"
] |
sayyidshalahuddin96@gmail.com
|
b259b83c4b60f6a8d182caa1eba35e95c87c7b15
|
b47c60f86b9fc33bdb6465ab1882207e113ddb7b
|
/src/main/java/test/java/voiture/commentaire/repositories/RoleRepository.java
|
245bfae9d4423dae86fbb911801d090c438e2b6b
|
[] |
no_license
|
Veronique9333/TestVoiture
|
1053414bdc227e76b9457f433a513410739b875f
|
36cb8e85605fbdd119794c201a05b703430303a3
|
refs/heads/master
| 2023-04-06T22:37:07.982896
| 2021-04-22T12:28:29
| 2021-04-22T12:28:29
| 360,110,140
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 300
|
java
|
package test.java.voiture.commentaire.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import test.java.voiture.commentaire.models.Role;
@Repository
public interface RoleRepository extends JpaRepository<Role, String> {
}
|
[
"rasoanantenainav@gmail.com"
] |
rasoanantenainav@gmail.com
|
d81c4d7013539a8bae7e4beffda16dfdde1f1977
|
af7b8bbe77461e59f32ba746f4bb055620a5c110
|
/base/src/main/java/com/hz/yk/reflect/param/Demo.java
|
694d4d7081ddab2e09be2beda57fde1394cc0d7a
|
[] |
no_license
|
ykdsg/MyJavaProject
|
3e51564a3fb57ab4ae043c9112e1936ccc179dd5
|
a7d88aee2f58698aed7d497c2cf6e23a605ebb59
|
refs/heads/master
| 2023-06-26T02:23:33.812330
| 2023-06-12T11:28:23
| 2023-06-12T11:28:23
| 1,435,034
| 4
| 6
| null | 2022-12-01T15:21:01
| 2011-03-03T13:30:03
|
Java
|
UTF-8
|
Java
| false
| false
| 176
|
java
|
package com.hz.yk.reflect.param;
/**
* Created by wuzheng.yk on 16/1/29.
*/
public class Demo {
public void add(int a,int b){
System.out.println(a + b);
}
}
|
[
"17173as@163.com"
] |
17173as@163.com
|
aa8f6bb19772dfc9f3b41f02551e0e4875d2f44a
|
35348f6624d46a1941ea7e286af37bb794bee5b7
|
/Ghidra/Framework/Generic/src/main/java/ghidra/util/graph/EdgeSet.java
|
b34ddf698548f0052341d66bcd0dffbc1c34f3d0
|
[
"Apache-2.0",
"GPL-1.0-or-later",
"GPL-3.0-only",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
StarCrossPortal/ghidracraft
|
7af6257c63a2bb7684e4c2ad763a6ada23297fa3
|
a960e81ff6144ec8834e187f5097dfcf64758e18
|
refs/heads/master
| 2023-08-23T20:17:26.250961
| 2021-10-22T00:53:49
| 2021-10-22T00:53:49
| 359,644,138
| 80
| 19
|
Apache-2.0
| 2021-10-20T03:59:55
| 2021-04-20T01:14:29
|
Java
|
UTF-8
|
Java
| false
| false
| 16,143
|
java
|
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* 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 ghidra.util.graph;
import ghidra.util.exception.NoValueException;
import java.util.*;
/** Container class for a set of edges (ghidra.util.graph.Edge).
*
*
*/
class EdgeSet implements KeyIndexableSet<Edge> {
private final DirectedGraph parentGraph;
private long modificationNumber;
private int capacity;
private int nextIndex;
private AddableLongIntHashtable edgeIndices;
private Edge [] edges;
private Edge [] previousEdgeWithSameFrom;
private Edge [] previousEdgeWithSameTo;
private Edge [] nextEdgeWithSameFrom;
private Edge [] nextEdgeWithSameTo;
/** Constructor
* @param parent The DirectedGraph that this EdgeSet belongs to.
* @param capacity The initial number of edges this edge set can have
* without growing.
*/
EdgeSet( DirectedGraph parent, int capacity)
{
if( capacity < 10 ) capacity = 10;
this.parentGraph = parent;
this.modificationNumber = 0;
this.capacity = capacity;
this.nextIndex = 0;
edgeIndices = new AddableLongIntHashtable( capacity );
edges = new Edge[capacity];
previousEdgeWithSameFrom = new Edge[capacity];
previousEdgeWithSameTo = new Edge[capacity];
nextEdgeWithSameFrom = new Edge[capacity];
nextEdgeWithSameTo = new Edge[capacity];
}
/** Returns the edge at the specified index in the internal arrays. */
Edge getByIndex( int index )
{
return edges[index];
}
/** Removes an edge from this EdgeSet. Returns true if and only if the
* edge was in the EdgeSet and was sucessfully removed.
*/
public boolean remove( Edge e )
{
if( e == null )
{
return false;
}
VertexSet vertices = parentGraph.vertices();
Edge oldNextEdgeWithSameFrom = getNextEdgeWithSameFrom( e );
Edge oldNextEdgeWithSameTo = getNextEdgeWithSameTo( e );
Edge oldPreviousEdgeWithSameFrom = getPreviousEdgeWithSameFrom( e);
Edge oldPreviousEdgeWithSameTo = getPreviousEdgeWithSameTo( e );
Vertex from = e.from();
Vertex to = e.to();
Edge firstOutgoingEdgeOfFrom = vertices.getFirstOutgoingEdge( from );
Edge firstIncomingEdgeOfTo = vertices.getFirstIncomingEdge( to );
Edge lastOutgoingEdgeOfFrom = vertices.getLastOutgoingEdge( from );
Edge lastIncomingEdgeOfTo = vertices.getLastIncomingEdge( to );
if( e.equals( firstOutgoingEdgeOfFrom ) )
{
vertices.setFirstOutgoingEdge( from, oldNextEdgeWithSameFrom );
}
if( e.equals( lastOutgoingEdgeOfFrom ) )
{
vertices.setLastOutgoingEdge( from, oldPreviousEdgeWithSameFrom );
}
if( e.equals( firstIncomingEdgeOfTo ) )
{
vertices.setFirstIncomingEdge( to, oldNextEdgeWithSameTo );
}
if( e.equals( lastIncomingEdgeOfTo ) )
{
vertices.setLastIncomingEdge( to, oldPreviousEdgeWithSameTo );
}
if( oldNextEdgeWithSameFrom != null )
{
setPreviousEdgeWithSameFrom(oldNextEdgeWithSameFrom, oldPreviousEdgeWithSameFrom);
}
if( oldPreviousEdgeWithSameFrom != null )
{
setNextEdgeWithSameFrom(oldPreviousEdgeWithSameFrom, oldNextEdgeWithSameFrom);
}
if( oldNextEdgeWithSameTo != null )
{
setPreviousEdgeWithSameTo(oldNextEdgeWithSameTo,oldPreviousEdgeWithSameTo);
}
if( oldPreviousEdgeWithSameTo != null )
{
setNextEdgeWithSameTo(oldPreviousEdgeWithSameTo, oldNextEdgeWithSameTo);
}
setPreviousEdgeWithSameFrom(e , null );
setNextEdgeWithSameFrom( e, null );
setPreviousEdgeWithSameTo( e, null );
setNextEdgeWithSameTo( e, null );
try{
int index = edgeIndices.get( e.key() );
edges[index] = null;
edgeIndices.remove( e.key() );
modificationNumber++;
return true;
}catch( NoValueException exc ){
//do nothing
}
return false;
}
/** Adds an edge to the graph. If either endpoint is not in the graph add it.
* If the edge is already in the graph return false and do nothing.
* @return true if and only if the edge was sucessfully added.
*/
public boolean add( Edge e )
{
if( contains(e) )
{
return false;
}
else if( nextIndex >= capacity )
{
grow();
}
edges[nextIndex] = e;
edgeIndices.add( e.key(), nextIndex++ );
VertexSet vertices = parentGraph.vertices();
Vertex from = e.from();
Vertex to = e.to();
if( !vertices.contains( from ) )
{
vertices.add( from );
}
if( !vertices.contains( to ) )
{
vertices.add( to );
}
Edge oldLastOutgoingEdge = vertices.getLastOutgoingEdge( from );
if( oldLastOutgoingEdge == null )
{
vertices.setFirstOutgoingEdge( from, e );
vertices.setLastOutgoingEdge( from, e );
}
else
{
vertices.setLastOutgoingEdge( from, e );
setNextEdgeWithSameFrom( oldLastOutgoingEdge, e );
setPreviousEdgeWithSameFrom( e, oldLastOutgoingEdge );
}
Edge oldLastIncomingEdge = vertices.getLastIncomingEdge( to );
if( oldLastIncomingEdge == null )
{
vertices.setFirstIncomingEdge( to, e );
vertices.setLastIncomingEdge( to, e );
}
else
{
vertices.setLastIncomingEdge( to, e );
setNextEdgeWithSameTo( oldLastIncomingEdge, e );
setPreviousEdgeWithSameTo( e, oldLastIncomingEdge );
}
modificationNumber++;
return true;
}
/** Return true if and only if the edge is contained in this EdgeSet. */
public boolean contains( Edge edge )
{
return edgeIndices.contains( edge.key() );
}
/** Returns the internal index of the given edge within this edge set.
* Throws a class cast exception if the object is not an edge. */
int index( Edge e )
{
try{
return edgeIndices.get( e.key() );
}catch( NoValueException exc ){
return -1;
}
}
/** Returns the next edge having the same 'from' if it exists. Otherwise
returns null.
*/
Edge getNextEdgeWithSameFrom( Edge e )
{
int indexOfEdge = index(e);
if( indexOfEdge >= 0 )
{
return nextEdgeWithSameFrom[ indexOfEdge ];
}
return null;
}
/** Returns next edge having the same 'to' if it exists. Otherwise returns
null.
*/
Edge getNextEdgeWithSameTo( Edge e )
{
int indexOfEdge = index( e );
if( indexOfEdge >= 0 )
{
return nextEdgeWithSameTo[ indexOfEdge ];
}
return null;
}
/** Returns the previous edge having the same 'from' if it exists. Otherwise
returns null.
*/
Edge getPreviousEdgeWithSameFrom( Edge e )
{
int indexOfEdge = index( e );
if( indexOfEdge >= 0 )
{
return previousEdgeWithSameFrom[ indexOfEdge ];
}
return null;
}
/** Returns previous edge having the same 'to' if it exists. Otherwise returns
null.
*/
Edge getPreviousEdgeWithSameTo( Edge e )
{
int indexOfEdge = index( e );
if( indexOfEdge >= 0 )
{
return previousEdgeWithSameTo[ indexOfEdge ];
}
return null;
}
/** Helper method for maintaining internal data structures. */
private void setNextEdgeWithSameFrom(Edge e, Edge nextEdge)
{
nextEdgeWithSameFrom[ index( e ) ] = nextEdge;
}
/** Helper method for maintaining internal data structures. */
private void setNextEdgeWithSameTo(Edge e, Edge nextEdge)
{
nextEdgeWithSameTo[ index( e ) ] = nextEdge;
}
/** Helper method for maintaining internal data structures. */
private void setPreviousEdgeWithSameFrom(Edge e, Edge previousEdge)
{
previousEdgeWithSameFrom[ index( e ) ] = previousEdge;
}
/** Helper method for maintaining internal data structures. */
private void setPreviousEdgeWithSameTo(Edge e, Edge previousEdge)
{
previousEdgeWithSameTo[ index( e ) ] = previousEdge;
}
/** Returns the current number of edges within this edge set. */
public int size()
{
return this.edgeIndices.size();
}
/** Empties out the edge set while leaving the capacity alone. Much faster
than removing the edges one by one.
*/
public void clear()
{
if( size() > 0 )
{
edgeIndices.removeAll();
for( int i=0; i< capacity; i++ )
{
edges[i] = null;
previousEdgeWithSameFrom[i] = null;
previousEdgeWithSameTo[i] = null;
nextEdgeWithSameFrom[i] = null;
nextEdgeWithSameTo[i] = null;
}
}
nextIndex = 0;
modificationNumber++;
}
/** Returns the number of edges this edge set can hold without growing. */
public int capacity()
{
return this.capacity;
}
/** Either compacts the edge set by removing vacant positions if there are
many or grows the edge set so that there is additional space.
*/
void grow()
{
int newCapacity = (int)Math.round( this.size()* 1.7) + 7;
nextIndex = 0;
modificationNumber++;
if( (this.size()*13) > (capacity*9) )
{
Edge [] newEdges = new Edge[newCapacity];
Edge [] newPreviousEdgeWithSameFrom = new Edge[newCapacity];
Edge [] newPreviousEdgeWithSameTo = new Edge[newCapacity];
Edge [] newNextEdgeWithSameFrom = new Edge[newCapacity];
Edge [] newNextEdgeWithSameTo = new Edge[newCapacity];
for( int i=0; i<capacity; i++ )
{
if( edges[i] != null )
{
newEdges[nextIndex] = edges[i];
newPreviousEdgeWithSameFrom[nextIndex] = previousEdgeWithSameFrom[i];
newPreviousEdgeWithSameTo[nextIndex] = previousEdgeWithSameTo[i];
newNextEdgeWithSameFrom[nextIndex] = nextEdgeWithSameFrom[i];
newNextEdgeWithSameTo[nextIndex] = nextEdgeWithSameTo[i];
this.edgeIndices.remove( edges[i].key());
this.edgeIndices.put( edges[i].key(), nextIndex );
nextIndex++;
}
}
capacity = newCapacity;
edges = newEdges;
previousEdgeWithSameFrom = newPreviousEdgeWithSameFrom;
previousEdgeWithSameTo = newPreviousEdgeWithSameTo;
nextEdgeWithSameFrom = newNextEdgeWithSameFrom;
nextEdgeWithSameTo = newNextEdgeWithSameTo;
}
else // just tighten
{
tighten();
}
}
private void tighten()
{
nextIndex = 0;
for( int i=0; i<capacity; i++ )
{
if( edges[i] != null )
{
if( i > nextIndex )
{
edges[nextIndex] = edges[i];
previousEdgeWithSameFrom[nextIndex] = previousEdgeWithSameFrom[i];
previousEdgeWithSameTo[nextIndex] = previousEdgeWithSameTo[i];
nextEdgeWithSameFrom[nextIndex] = nextEdgeWithSameFrom[i];
nextEdgeWithSameTo[nextIndex] = nextEdgeWithSameTo[i];
edgeIndices.remove( edges[i].key());
edgeIndices.put( edges[i].key(), nextIndex );
edges[i] = null;
previousEdgeWithSameFrom[i] = null;
previousEdgeWithSameTo[i] = null;
nextEdgeWithSameFrom[i] = null;
nextEdgeWithSameTo[i] = null;
}
nextIndex++;
}
}
}
/** Returns an iterator for this EdgeSet. */
public GraphIterator<Edge> iterator()
{
return new EdgeSetIterator();
}
/** Used to test if edges have been added or removed from this edge set. */
public long getModificationNumber()
{
return this.modificationNumber;
}
/* (non-Javadoc)
* @see ghidra.util.graph.KeyIndexableSet#getKeyedObject(long)
*/
public Edge getKeyedObject(long key)
{
if (edgeIndices.contains(key)) {
try {
return edges[edgeIndices.get(key)];
} catch (Exception e) {
return null;
}
}
return null;
}
// /** Used for debugging. */
// void verbosePrint()
// {
// Err.debug(this, "Edges:");
// for( int i=0; i<capacity; i++ )
// {
// if( this.edges[i] != null )
// {
// Err.debug(this, "From: " + edges[i].from().name() + " To: " + edges[i].to().name());
// }
// }
// }
/** Get the edges in this EdgeSet as a java.util.Set. */
public Set<Edge> toSet()
{
GraphIterator<Edge> i = this.iterator();
Set<Edge> s = new HashSet<Edge>( this.size() );
while( i.hasNext() )
{
s.add( i.next() );
}
return s;
}
/** @return array of Edges contained in this EdgeSet */
public Edge[] toArray()
{
Edge[] theEdges = new Edge[this.size()];
int i=0, cnt = 0;
int done = this.size();
while( cnt < done )
{
if( edges[i] != null )
{
theEdges[cnt++] = edges[i];
}
i++;
}
return theEdges;
}
/** EdgeSetIterator uses the hasNext()/next() paradigm. Throws
a ConcurrentModificationException if any addition or deletions to
the backing EdgeSet are made except through the iterator's own methods.
*/
private class EdgeSetIterator implements GraphIterator<Edge>
{
private int currentPosition;
private int nextPosition;
private long edgeSetModificationNumber;
/** Constructor */
public EdgeSetIterator()
{
currentPosition = -1;
nextPosition = -1;
//CompactEdgeSet.edgeSet = (CompactEdgeSet)parentGraph.edges();
this.edgeSetModificationNumber = getModificationNumber();
getNextPosition();
}
private void getNextPosition()
{
nextPosition++;
while( (nextPosition < capacity()) && ( edges[nextPosition] == null ))
{
nextPosition++;
}
}
/** @return true if and only if a call to next() will return a valid edge.
* @throws ConcurrentModificationException
*/
public boolean hasNext() throws ConcurrentModificationException
{
if( edgeSetModificationNumber != getModificationNumber() )
{
throw new ConcurrentModificationException("Edge Set Modified");
}
if( nextPosition < capacity() )
{
return true;
}
return false;
}
/** @return the next edge.
* @throws ConcurrentModificationException
* @throws NoSuchElementException if there is no next edge.
*/
public Edge next() throws ConcurrentModificationException
{
if( edgeSetModificationNumber != getModificationNumber() )
{
throw new ConcurrentModificationException("Edge Set Modified");
}
if( nextPosition < capacity() )
{
currentPosition = nextPosition;
getNextPosition();
return edges[currentPosition];
}
throw new NoSuchElementException();
}
/** Removes the edge returned by the most recent call to next(). */
public boolean remove() throws ConcurrentModificationException
{
boolean removed;
if( edgeSetModificationNumber != getModificationNumber() )
{
throw new ConcurrentModificationException("Edge Set Modified");
}
removed = EdgeSet.this.remove( edges[currentPosition] );
edgeSetModificationNumber = getModificationNumber();
return removed;
}
}
}
|
[
"46821332+nsadeveloper789@users.noreply.github.com"
] |
46821332+nsadeveloper789@users.noreply.github.com
|
2a17f310bb8e1683aa63cacef502b04d22e97d18
|
3c76ab132a5160253ab7a5557056749d3a4ab327
|
/RPGTextGame_IndividualParts/PartEight/AttackableTarget.java
|
f3fcb471ea91514eab1e5d5a275da03a7c02542e
|
[
"MIT"
] |
permissive
|
Squirrelbear/RPGTextGame
|
1296a864d95e7068a118067300cfcb87061c448e
|
7a42e9a6372c48557b384819cb297a649523a842
|
refs/heads/main
| 2023-08-27T23:23:49.334494
| 2021-10-14T07:22:26
| 2021-10-14T07:22:26
| 381,925,089
| 0
| 0
| null | 2021-10-14T07:22:26
| 2021-07-01T05:54:44
|
Java
|
UTF-8
|
Java
| false
| false
| 93
|
java
|
public interface AttackableTarget {
void takeDamage(int amount);
String getName();
}
|
[
"petermitchell0001@gmail.com"
] |
petermitchell0001@gmail.com
|
1c9d410aaf8e9b936734dfee1e1786693f9d0a52
|
3ccf08b9d1ce7894213020e4681c76e032f2f806
|
/TP1/src/arraySorter/Libro.java
|
9713fa18e7e848b58bd8150919f6f0151e0f971c
|
[] |
no_license
|
Gaaston12/Algoritmos1
|
bef66153dffb87cf1bb7fbdd873d5bb45a1b24d1
|
2c9160109d4b852edd91672fa95293cd4bd06fac
|
refs/heads/master
| 2023-01-19T18:19:04.115254
| 2020-12-03T13:32:49
| 2020-12-03T13:32:49
| 290,237,179
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,312
|
java
|
package arraySorter;
public class Libro {
private String titulo;
private String autor;
private int nroPag;
public Libro() {
titulo = null;
autor = null;
nroPag = 0;
}
public Libro(String t, String a, int p) {
titulo = t;
autor = a;
nroPag = p;
}
public String obtenerTitulo() {
return titulo;
}
public void asignarTitulo(String t) {
titulo = t;
}
public String obtenerAutor() {
return autor;
}
public void asignarAutor(String a) {
autor = a;
}
public int obtenerNroPag() {
return nroPag;
}
public void asignarNroPag(int n) {
nroPag = n;
}
@Override
public String toString() {
return "Autor: " + autor + ", Titulo: " + titulo + ", Paginas: " + nroPag;
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (other == null) return false;
if (other.getClass() != this.getClass()) return false;
return (this.obtenerAutor().equals(((Libro)other).obtenerAutor()) &&
this.obtenerTitulo().equals(((Libro)other).obtenerTitulo()) &&
this.obtenerNroPag() == ((Libro)other).obtenerNroPag());
}
}
|
[
"Gaastonmaartin12@gmail.com"
] |
Gaastonmaartin12@gmail.com
|
23bb165a87a1c3a7e0dd90a047aad239134b8330
|
2f97464863813a2372e1f83808219acc13cf2c44
|
/app/src/androidTest/java/com/shamdroid/myfinancialassistant/ExampleInstrumentedTest.java
|
f5f7bad34c54001cc4c123b328a62e91d42c6ff1
|
[
"MIT"
] |
permissive
|
mAlaliSy/MyFinancialAssistant
|
02078dec86d003afa599c90c8ced1b86eb891342
|
e5ab10a76cb6e1fcf7db6d7ddfa8295d3c75e5e9
|
refs/heads/master
| 2020-12-28T21:50:44.747791
| 2019-01-19T20:02:39
| 2019-01-19T20:02:39
| 68,455,794
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 772
|
java
|
package com.shamdroid.myfinancialassistant;
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.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.shamdroid.myfinancialassistant", appContext.getPackageName());
}
}
|
[
"m.alali.sy@gmail.com"
] |
m.alali.sy@gmail.com
|
7df0dcedd4eda4718759f6fd05f51e218715709c
|
5bf3f953ef579a9776d2ad1f58e46da995fef791
|
/chaos-common/src/test/java/com/str/CommentLabel.java
|
7eb34f095fc84e314793e8d2bbe9f0e52ab65fa5
|
[] |
no_license
|
marvinsworld/chaos
|
171276b6658400ff6a1e07e69941aeef0327c547
|
1893b4b15f82c90baf066f4935d89c7f7aca8262
|
refs/heads/master
| 2020-12-08T09:38:15.365763
| 2018-08-05T04:19:44
| 2018-08-05T04:19:44
| 66,061,450
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 460
|
java
|
package com.str;
/**
* Created by lunjianchang on 2/16/16.
*/
public class CommentLabel {
private String content;
private int label_type;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getLabel_type() {
return label_type;
}
public void setLabel_type(int label_type) {
this.label_type = label_type;
}
}
|
[
"gezhiqiang@meituan.com"
] |
gezhiqiang@meituan.com
|
05f2032cabfc340a948b903e69dea69709d84c67
|
4043795962745e43f7fcff99d7cb2ed404231bd9
|
/DataSharing/app/src/main/java/com/example/datasharing/Database.java
|
704d27c5944c1c58e664a13105a873cc1fb2655b
|
[] |
no_license
|
bohmax/Android
|
eef00ae96559324901020468147c33e538a07d52
|
7056e240226ed61826e00d5a282e1c6e94923412
|
refs/heads/master
| 2020-09-07T08:44:09.282720
| 2019-11-13T10:08:35
| 2019-11-13T10:08:35
| 220,724,432
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,370
|
java
|
package com.example.datasharing;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class Database extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "DBName";
private static final int DATABASE_VERSION = 2;
private static final String DATABASE_CREATE = "CREATE TABLE IF NOT EXISTS Dipartimento ( _id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT not null);";
private static Database Istance;
public static Database getInstance(Context context){
if(Istance == null)
Istance = new Database(context.getApplicationContext());
return Istance;
}
private Database(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Method is called during creation of the database
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DATABASE_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(Database.class.getName(),
"Upgrading database from version " + oldVersion + " to "
+ newVersion + ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS Dipartimento");
onCreate(db);
}
}
|
[
"mssmpuddu@gmail.com"
] |
mssmpuddu@gmail.com
|
a64124f769ce1d8989ce267cf8d159786f8ec1f4
|
baba7ae4f32f0e680f084effcd658890183e7710
|
/MutationFramework/muJava/muJavaMutantStructure/Persistence/TobiasSamples/Debug2/int_linearSearch(int,int)/ROR_7/Debug2.java
|
40a12a90e940f67f9e641c1e916f343f7d5310c4
|
[
"Apache-2.0"
] |
permissive
|
TUBS-ISF/MutationAnalysisForDBC-FormaliSE21
|
75972c823c3c358494d2a2e9ec12e0a00e26d771
|
de825bc9e743db851f5ec1c5133dca3f04d20bad
|
refs/heads/main
| 2023-04-22T21:29:28.165271
| 2021-05-17T07:43:22
| 2021-05-17T07:43:22
| 368,096,901
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,785
|
java
|
// This is a mutant program.
// Author : ysma
public class Debug2
{
/*@
@ normal_behavior
@ requires true;
@ ensures \result>=0 ==> a[\result]==x;
@*/
public static int linearSearch( int[] a, int x )
{
int i = a.length - 1;
/*@ loop_invariant !(\exists int q; q >= i+1 && q < a.length; a[q]==x) && i>=-1 && i<a.length;
@ decreases i+1;
@*/
while (false && a[i] != x) {
i = i - 1;
}
return i;
}
/*@
@ normal_behavior
@ requires A.length > 0;
@ ensures (\forall int q; q >= 0 & q < A.length; A[\result]>=A[q]);
@*/
public static int maxElement( int[] A )
{
int i = 0;
int j = 1;
/*@ loop_invariant (\forall int q; q >= 0 && q < j; A[i]>=A[q]) && i>=0 && i<A.length && j>0 && j<=A.length;
@ decreases A.length - j;
@*/
while (j != A.length) {
if (A[j] > A[i]) {
i = j;
} else {
if (A[j] <= A[i]) {
;
}
}
j = j + 1;
}
return i;
}
/*@
@ normal_behavior
@ requires n >= 0 && n<6;
@ ensures \result==Helper.factorial(n);
@*/
public static int fac( int n )
{
int f = 0;
if (n == 0) {
f = 1;
} else {
if (n == 1) {
f = 1;
} else {
if (n >= 2) {
int tmp = n - 1;
f = n * Helper.factorial( tmp );
}
}
}
return f;
}
/*@
@ normal_behavior
@ requires A.length > 0 && (\forall int i; i>=0 & i<A.length; A[i] == 0 || A[i] == 1 || A[i] == 2);
@ ensures (\forall int q; q >= 1 && q < \result.length; \result[q-1]<=\result[q]);
@*/
public static int[] DutchFlag( int[] A )
{
int wb = 0;
int wt = 0;
int bb = A.length;
/*@ loop_invariant (\forall int i; i>=0 & i<A.length; A[i] == 0 || A[i] == 1 || A[i] == 2) && (\forall int q; q >= 0 && q < wb; A[q]==0) && (\forall int q; q >= wb && q < wt; A[q]==1) && (\forall int q; q >= bb && q < A.length; A[q]==2) && 0<=wb && wb<=wt && wt<=bb && bb<=A.length;
@ decreases bb-wt;
@*/
while (wt != bb) {
if (A[wt] == 0) {
int t = A[wt];
A[wt] = A[wb];
A[wb] = t;
wt = wt + 1;
wb = wb + 1;
} else {
if (A[wt] == 1) {
wt = wt + 1;
} else {
if (A[wt] == 2) {
int t = A[wt];
A[wt] = A[bb - 1];
A[bb - 1] = t;
bb = bb - 1;
}
}
}
}
return A;
}
}
|
[
"a.knueppel@tu-bs.de"
] |
a.knueppel@tu-bs.de
|
620ba45ca2d1708c40e7ec23c7901dfe0694d4f4
|
976f7afff64d36a9715eb16f66f97124da91f269
|
/app/src/main/java/com/example/mat/herome/Fragments/ShowBackStoryFragment.java
|
59ad206e200512f0e2d2f1fc833210834a4973f2
|
[] |
no_license
|
Mateaus/HeroMe
|
9db08b8440e11d4f9239d82aea8de0b899bf48be
|
81df3928edc16c20325e2d4d60caf75214e7779c
|
refs/heads/master
| 2020-03-17T22:32:39.653163
| 2018-05-18T22:12:10
| 2018-05-18T22:12:10
| 134,008,061
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 8,036
|
java
|
package com.example.mat.herome.Fragments;
import android.content.Context;
import android.net.Uri;
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.Button;
import android.widget.TextView;
import com.example.mat.herome.Activities.MainActivity;
import com.example.mat.herome.R;
import org.w3c.dom.Text;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link ShowBackStoryFragment.ShowBackStoryInteractionListener} interface
* to handle interaction events.
* Use the {@link ShowBackStoryFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ShowBackStoryFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private ShowBackStoryInteractionListener mListener;
public ShowBackStoryFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment show_backstory.
*/
// TODO: Rename and change types and number of parameters
public static ShowBackStoryFragment newInstance(String param1, String param2) {
ShowBackStoryFragment fragment = new ShowBackStoryFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_show_backstory, container, false);
TextView heroName = (TextView)view.findViewById(R.id.heroName);
TextView mainTitle = (TextView)view.findViewById(R.id.mainTitle);
TextView aboutHero = (TextView)view.findViewById(R.id.aboutHero);
Button startoverBtn = (Button)view.findViewById(R.id.startoverBtn);
Button primaryBtn = (Button)view.findViewById(R.id.primaryBtn);
Button secondaryBtn = (Button)view.findViewById(R.id.secondaryBtn);
MainFragment mainFragment = new MainFragment();
PickPowerFragment pickPowerFragment = new PickPowerFragment();
// Text Changes
if (mainFragment.getInheritance().equalsIgnoreCase("accident") && (pickPowerFragment.getPower().equalsIgnoreCase("turtle"))) {
heroName.setText("Marty");
mainTitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.big_superman_logo, 0, 0, 0);
aboutHero.setText(" Marty Rivia was once part of a videogame called Paragon where he participated as a " +
"semi professional player. During his career he decided that it was of his best interest to become a Turtle superhero after having a conversation " +
"with BloodMordicus, his jungler. Since then, Marty has been roaming through the jungle as a Turtle living a peaceful life.");
}
// Primary power result
if (mainFragment.getInheritance().equalsIgnoreCase("accident")) {
primaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.lightning, 0, 0, 0);
primaryBtn.setBackgroundResource(R.drawable.button_base);
}
else if (mainFragment.getInheritance().equalsIgnoreCase("genetic")) {
primaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.atomic, 0, 0, 0);
primaryBtn.setBackgroundResource(R.drawable.genetic_mutation_powers);
}
else if (mainFragment.getInheritance().equalsIgnoreCase("born")) {
primaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.rocket, 0, 0, 0);
primaryBtn.setBackgroundResource(R.drawable.born_with_them_powers);
}
// Secondary power result
if (pickPowerFragment.getPower().equalsIgnoreCase("turtle")) {
secondaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.turtle_power, 0, 0, 0);
secondaryBtn.setBackgroundResource(R.drawable.turtle_power_option);
}
else if (pickPowerFragment.getPower().equalsIgnoreCase("lighting")) {
secondaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.thors_hammer, 0, 0, 0);
secondaryBtn.setBackgroundResource(R.drawable.lightning_option);
}
else if (pickPowerFragment.getPower().equalsIgnoreCase("flight")) {
secondaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.super_man_crest,0 ,0 ,0);
secondaryBtn.setBackgroundResource(R.drawable.flight_option);
}
else if (pickPowerFragment.getPower().equalsIgnoreCase("web")) {
secondaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.spider_web, 0, 0, 0);
secondaryBtn.setBackgroundResource(R.drawable.web_slinging_option);
}
else if (pickPowerFragment.getPower().equalsIgnoreCase("laser")) {
secondaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.laser_vision, 0, 0, 0);
secondaryBtn.setBackgroundResource(R.drawable.laser_vision_option);
}
else if (pickPowerFragment.getPower().equalsIgnoreCase("strength")) {
secondaryBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.super_strength, 0, 0, 0);
secondaryBtn.setBackgroundResource(R.drawable.super_strength_option);
}
// Back to the beginning to start over
startoverBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MainActivity mainActivity = (MainActivity)getActivity();
mainActivity.loadMainFragmentScreen();
}
});
// Inflate the layout for this fragment
return view;
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onShowBackStoryFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof ShowBackStoryInteractionListener) {
mListener = (ShowBackStoryInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface ShowBackStoryInteractionListener {
// TODO: Update argument type and name
void onShowBackStoryFragmentInteraction(Uri uri);
}
}
|
[
"mateausc@gmail.com"
] |
mateausc@gmail.com
|
62d5d7833160f720e9d1c987967323a50fc226b4
|
7a4a62721df0daf92a50f2f79ea73767c594ffc7
|
/app/src/main/java/com/elfefe/mynews/models/article_search/SearchQuery.java
|
13d7f7f463c244169e3a97ffd2bc7ed5ef2f9c0c
|
[] |
no_license
|
elfefe/MyNews
|
b0dc3362cc93bc8d192d5c80f2484edaabbe61fb
|
422b9966f2dadfa77418f8e6ba34507bdf01a5fa
|
refs/heads/toRebase
| 2020-05-14T08:49:11.136713
| 2019-08-29T11:11:06
| 2019-08-29T11:11:06
| 181,729,160
| 0
| 1
| null | 2019-06-19T00:41:25
| 2019-04-16T16:42:29
|
Java
|
UTF-8
|
Java
| false
| false
| 1,069
|
java
|
package com.elfefe.mynews.models.article_search;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
class SearchQuery {
@SerializedName("status")
@Expose
private String status;
@SerializedName("copyright")
@Expose
private String copyright;
@SerializedName("response")
@Expose
private Response response;
@SuppressWarnings("unused")
public String getStatus() {
return status;
}
@SuppressWarnings("unused")
public void setStatus(String status) {
this.status = status;
}
@SuppressWarnings("unused")
public String getCopyright() {
return copyright;
}
@SuppressWarnings("unused")
public void setCopyright(String copyright) {
this.copyright = copyright;
}
@SuppressWarnings("unused")
public Response getResponse() {
return response;
}
@SuppressWarnings("unused")
public void setResponse(Response response) {
this.response = response;
}
}
|
[
"f.bou-reiff@orange.fr"
] |
f.bou-reiff@orange.fr
|
24a61e374dbf16c148e90e4dd225ac28e1534f4c
|
5bfdd3e3e61e046a56f5e4714bd13e4bf0bf359d
|
/algorithm/src/boj/Regist7287.java
|
c49aefae6186eb74656d855af906499886d47cb6
|
[
"MIT"
] |
permissive
|
Oraindrop/algorithm
|
e40b0c36a6728bc3f3599b7769d581cc3e59e9d8
|
7081464a4153c307c5ad6e92523b7d6f74fce332
|
refs/heads/master
| 2022-01-18T15:11:13.959202
| 2021-12-30T14:39:17
| 2021-12-30T14:39:17
| 146,498,419
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 153
|
java
|
package boj;
public class Regist7287 {
public static void main(String[] args) {
System.out.println("26");
System.out.println("chltmdals111");
}
}
|
[
"chltmdals115@gmail.com"
] |
chltmdals115@gmail.com
|
ea6fef9d38a502e8c3afe791658c504840284574
|
355c41b5bb8706ad1acb282b828ab50f2a58d1a2
|
/cn/jsprun/domain/Typeoptions.java
|
16d48f8ee0ad18791deb0c4c66292a08788c5c55
|
[] |
no_license
|
goldbo/vcity
|
d7a424f00939ceafbb4f6d06ebfa608321a75c8a
|
645f6a5eb429d3974ef4afa4e3f00ab37f6d5643
|
refs/heads/master
| 2021-01-22T01:54:36.186223
| 2012-02-20T09:30:57
| 2012-02-20T09:30:57
| 3,134,179
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,142
|
java
|
package cn.jsprun.domain;
public class Typeoptions implements java.io.Serializable {
private static final long serialVersionUID = 2707874118083150326L;
private Short optionid;
private Short classid;
private Short displayorder;
private String title;
private String description;
private String identifier;
private String type;
private String rules;
public Typeoptions() {
}
public Typeoptions(Short classid, Short displayorder, String title, String description, String identifier, String type, String rules) {
this.classid = classid;
this.displayorder = displayorder;
this.title = title;
this.description = description;
this.identifier = identifier;
this.type = type;
this.rules = rules;
}
public Short getOptionid() {
return this.optionid;
}
public void setOptionid(Short optionid) {
this.optionid = optionid;
}
public Short getClassid() {
return this.classid;
}
public void setClassid(Short classid) {
this.classid = classid;
}
public Short getDisplayorder() {
return this.displayorder;
}
public void setDisplayorder(Short displayorder) {
this.displayorder = displayorder;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public String getIdentifier() {
return this.identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public String getRules() {
return this.rules;
}
public void setRules(String rules) {
this.rules = rules;
}
}
|
[
"549668352@qq.com"
] |
549668352@qq.com
|
83ccc07ab52c35b6bfb920da9a7460e60b1bdb44
|
f4dfe52bd506f1508637f23f1d9822c659891c12
|
/JAVA7/InvokeDynamic/src/main/java/org/mk/training/invoke/ThreadPoolMain.java
|
d0be48d413084b2288971a826354f058a662e87b
|
[] |
no_license
|
siddhantaws/LowLatency
|
5b27b99b8fbe3a98029ca42f636b49d870a0b3bb
|
f245916fed8bfe5a038dc21098d813bf5accdb1e
|
refs/heads/master
| 2021-06-25T19:55:07.994337
| 2019-09-19T15:39:15
| 2019-09-19T15:39:15
| 152,133,438
| 0
| 0
| null | 2020-10-13T16:09:28
| 2018-10-08T19:17:54
|
Java
|
UTF-8
|
Java
| false
| false
| 1,811
|
java
|
package org.mk.training.invoke;
import org.mk.training.invoke.ThreadPoolManager.CancelProxy;
import java.lang.invoke.MethodHandle;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledFuture;
public class ThreadPoolMain {
private ThreadPoolManager manager;
private void cancelUsingReflection(ScheduledFuture<?> hndl) {
Method meth = manager.makeReflective();
try {
System.out.println("With Reflection");
meth.invoke(hndl);
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
e.printStackTrace();
}
}
private void cancelUsingProxy(ScheduledFuture<?> hndl) {
CancelProxy proxy = manager.makeProxy();
System.out.println("With Proxy");
proxy.invoke(manager, hndl);
}
private void cancelUsingMH(ScheduledFuture<?> hndl) {
MethodHandle mh = manager.makeMh();
try {
System.out.println("With Method Handle");
mh.invokeExact(manager, hndl);
} catch (Throwable e) {
e.printStackTrace();
}
}
private void run() {
BlockingQueue<WorkUnit<String>> lbq = new LinkedBlockingQueue<>();
manager = new ThreadPoolManager(lbq);
final QueueReaderTask msgReader = new QueueReaderTask(100) {
@Override
public void doAction(String msg_) {
if (msg_ != null)
System.out.println("Msg recvd: " + msg_);
}
};
ScheduledFuture<?> hndl = manager.run(msgReader);
cancelUsingMH(hndl);
// cancelUsingProxy(hndl);
// cancelUsingReflection(hndl);
}
public static void main(String[] args) {
ThreadPoolMain main = new ThreadPoolMain();
main.run();
}
}
|
[
"siddhantaws@gmail.com"
] |
siddhantaws@gmail.com
|
8b01caa837ea891e16e994973d7cd336e23d7b6b
|
307187542f43504d48544a9119c1fbdf8fe4782f
|
/app/controllers/UserPermissionManagement.java
|
3f9db2eca24947f76be62606284a605dbfa64227
|
[] |
no_license
|
sheikhshamirshakir/EIMS
|
bfa231ca145b77a370f8e8bc55ae6d889b90474b
|
aa7b012f871f034395bfccf7df74cbb87dd7f226
|
refs/heads/master
| 2020-12-25T17:26:07.224692
| 2016-08-29T08:41:34
| 2016-08-29T08:41:34
| 31,545,247
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,931
|
java
|
/**Created By Sheikh Shamir Shakir Shomoy Solution
* Shomoy Solution
* On 28-Apr-2015
***/
package controllers;
import java.util.Date;
import java.util.List;
import java.util.Map;
import models.Role;
import models.User;
import models.UserPermission;
import models.UserRole;
import models.admission.Course;
import models.admission.Parent;
import models.admission.Student;
import models.admission.StudentCourse;
import models.admission.Teacher;
import play.data.Form;
import play.mvc.Controller;
import play.mvc.Http;
import play.mvc.Result;
import services.RolePermissionCheck;
import services.UpdatePermission;
import services.UserRoleCheck;
import utils.AppConstants;
import views.html.userpermission.*;
public class UserPermissionManagement extends Controller{
static Form<UserPermission> userPermissionForm = Form.form(UserPermission.class);
public static Result createWithRole(String roleId) {
Long rId = Long.parseLong(roleId);
Integer rID = Integer.parseInt(roleId);
List<Boolean> isChecked = RolePermissionCheck.check(rID);
//List<Boolean> isChecked = UpdatePermission.viewUpdatePermission(rId);
int rid = Integer.parseInt(rId.toString());
String roleName = Role.get(rid).roleName;
return ok(createWithoutList.render(rid, roleName, isChecked));
}
public static Result create() {
return ok(createWithList.render(userPermissionForm));
}
public static Result save() {
Form<UserPermission> filledForm = userPermissionForm.bindFromRequest();
if (filledForm.hasErrors()) {
return badRequest(createWithList.render(filledForm));
} else {
UserPermission userPermission = filledForm.get();
UserPermission.deleteUserPermissionsByRole(userPermission.roleId);
Map<String, String[]> reqBody = request().body().asFormUrlEncoded();
String[] permissions = reqBody.get("permissionId");
Role role = Role.get(userPermission.roleId);
if(permissions!=null){
for (String p : permissions) {
Integer permissionId = Integer.parseInt(p);
UserPermission userPermission2 = new UserPermission();
userPermission2.permissionId = permissionId;
userPermission2.roleId = role.id;
List<Integer> users = UserRole.finduserIdsByRoleId(role.id);
for(int user: users){
userPermission2.userId = user;
UserPermission.create(userPermission2);
}
}
}
flash("success", AppConstants.SUCCESS_MESSAGE);
//return ok("");
return redirect(routes.UserPermissionManagement.create());
}
}
//
// public static Result list() {
// return ok(list.render(UserPermission.all()));
// }
// public static Result show(int id) {
// UserPermission userPermission = UserPermission.get(id);
// return ok(show.render(userPermission));
// }
// public static Result edit(Long id) {
// return ok("");
// }
// public static Result update() {
// return ok("");
// }
}
|
[
"sheikhshamirshakir@gmail.com"
] |
sheikhshamirshakir@gmail.com
|
1af9ece33ec008d5c7f069bd6afc9969943df3b3
|
0de9c91955bdeb7a99eac16b3ad98b28d2b00721
|
/src/main/java/no/nav/fo/veilarbdialog/config/TimedConfiguration.java
|
75bc4793e8231c404ee7388cf13e797b4d7b9e5f
|
[
"MIT"
] |
permissive
|
navikt/veilarbdialog
|
6af2f8e4fb60423c387a021d652bc55c48d4f31a
|
71de40f23c47d7c089da28d927439c3c0290777d
|
refs/heads/main
| 2023-09-01T20:07:08.744780
| 2023-08-17T12:10:32
| 2023-08-17T12:10:32
| 160,199,893
| 2
| 1
|
MIT
| 2023-09-08T11:31:07
| 2018-12-03T14:01:15
|
Java
|
UTF-8
|
Java
| false
| false
| 670
|
java
|
package no.nav.fo.veilarbdialog.config;
import io.micrometer.core.aop.CountedAspect;
import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@Configuration
@EnableAspectJAutoProxy
public class TimedConfiguration {
@Bean
TimedAspect timedAspect(MeterRegistry registry) {
return new TimedAspect(registry);
}
@Bean
CountedAspect countedAspect(MeterRegistry registry) {
return new CountedAspect(registry);
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
0fe2a016b3b51a0d82a9d15d594a6b8622e349f6
|
bced7c254b4414a4bbbb14cbdb76d104fcd2052f
|
/core/src/com/itstimetosnuff/jellyfishsurvival/UpgradeScreen.java
|
5264e1ebabfa1afc3414d7b120d9e6748a0204e1
|
[] |
no_license
|
ItsTimeToSnuff/jellyfish-survival
|
7fb50fc94cf8da8485f9106f97093f1eba029788
|
e08c2e79240c4b4f935283c8aa5755f230395385
|
refs/heads/master
| 2023-06-03T20:57:51.657783
| 2021-06-17T21:44:22
| 2021-06-17T21:44:22
| 377,930,681
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,771
|
java
|
package com.itstimetosnuff.jellyfishsurvival;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.itstimetosnuff.jellyfishsurvival.helper.Settings;
public class UpgradeScreen implements Screen {
JellyfishSurvivalGame game;
public static float height;
public static float width = 1000;
OrthographicCamera camera;
Viewport viewport;
SpriteBatch batch;
private BitmapFont font;
public UpgradeScreen(JellyfishSurvivalGame game) {
this.game = game;
Settings.load();
float ppu = Gdx.graphics.getWidth() / width;
height = Gdx.graphics.getHeight() / ppu;
camera = new OrthographicCamera();
camera.setToOrtho(false, width, height);
viewport = new FitViewport(width, height, camera);
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/fonts/neuropol200.fnt"));
}
public void dispose() {
}
@Override
public void render(float delta) {
camera.update();
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
Gdx.gl.glEnable(GL20.GL_BLEND);
batch.begin();
batch.enableBlending();
batch.end();
}
public void resize(int width, int height) {
}
@Override
public void show() {
}
@Override
public void hide() {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
}
|
[
"itstimetosnuff@gmail.com"
] |
itstimetosnuff@gmail.com
|
2b1c9bffd3e24e6dee88ee9af11d016b8554b7b4
|
61c29b9954c0ae2ea7ea2ea3dfbdeb03a8f026a3
|
/src/main/java/flatstore/test/StorageTest.java
|
b2ae31bc1d502a3f19709418373ddd5fc9e73f65
|
[] |
no_license
|
SWBForms/SWBSemEngine
|
8be53aa738baccd18383c705496dd3b0faee23f3
|
cdd8caddd2425e9434034da308823ff1433ff787
|
refs/heads/master
| 2020-06-12T19:23:01.127060
| 2016-12-06T19:39:03
| 2016-12-06T19:39:03
| 75,764,768
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,177
|
java
|
package flatstore.test;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.semanticwb.store.Graph;
import org.semanticwb.store.flatstore.GraphImp;
/**
*
* @author serch
*/
public class StorageTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException, InterruptedException {
long time = System.currentTimeMillis();
Map params = new HashMap();
params.put("path", "/data/flatstore/");
// Graph tGraph = new GraphImp("SWBAdmin", params);
// ((GraphImp)tGraph).createFromNT("/data/bench/SWBAdmin.nt");
Graph tGraph = new GraphImp("bench", params);
((GraphImp)tGraph).createFromNT("/data/bench/infoboxes-fixed.nt.gz","/data/bench/geocoordinates-fixed.nt.gz","/data/bench/homepages-fixed.nt.gz");
// Graph tGraph = new GraphImp("DBMS100M", params);
// ((GraphImp)tGraph).createFromNT("/data/bench/dataset_100m.nt.gz");
System.out.println("time: "+(System.currentTimeMillis()-time));
tGraph.close();
}
}
|
[
"softjei@gmail.com"
] |
softjei@gmail.com
|
3f63ba15c69c540508595c950d02edea1042dd10
|
b80023c2e0d55937fc9dd942de6de09b354911e3
|
/clone/CloneTest.java
|
e7e6ae83954dc3d89c7334df1dbec869f9aa923d
|
[] |
no_license
|
biheng/corejava-9e-
|
3f9affac7def669c542e420abf2c3c96f98c0a53
|
17bb1c5d619c692d1077b8457226dd9021b1da06
|
refs/heads/master
| 2021-01-14T12:09:50.205085
| 2014-10-22T05:39:34
| 2014-10-22T05:39:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 682
|
java
|
package clone;
/**
* This program demonstrates cloning.
* @author youkpter
* 2014年 09月 24日 星期三 23:37:28 CST
*/
public class CloneTest
{
public static void main(String[] args)
{
try
{
Employee original = new Employee("John Q. Public", 50000);
original.setHireDay(2000, 1, 1);
Employee copy = original.clone();
copy.raiseSalary(10);
copy.setHireDay(2002, 12, 31);
System.out.println("original=" + original);
System.out.println("copy=" + copy);
}
catch(CloneNotSupportedException e)
{
e.printStackTrace();
}
}
}
|
[
"xingqiang345@163.com"
] |
xingqiang345@163.com
|
10ce30752a945911064fe82edd4073269988077d
|
0347c553e977427aaf17aaef88028d788f2c2142
|
/tulingmall-canal/src/main/java/com/tuling/tulingmall/client/SimpleCanalClientExample.java
|
d0cd88c6f127cb95ae9020c30f2fd2e21283aea6
|
[] |
no_license
|
gaogushenling/tuling-mall-3
|
a2c0722ab42e5207e6b6cb1693b77e127afad77d
|
e31a0607db3287deaf45f434b5d20d88dc6c78d5
|
refs/heads/master
| 2023-03-29T05:03:05.208874
| 2021-03-27T09:09:49
| 2021-03-27T09:09:49
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,227
|
java
|
package com.tuling.tulingmall.client;
import java.net.InetSocketAddress;
import java.util.List;
import com.alibaba.otter.canal.client.CanalConnectors;
import com.alibaba.otter.canal.client.CanalConnector;
import com.alibaba.otter.canal.common.utils.AddressUtils;
import com.alibaba.otter.canal.protocol.Message;
import com.alibaba.otter.canal.protocol.CanalEntry.Column;
import com.alibaba.otter.canal.protocol.CanalEntry.Entry;
import com.alibaba.otter.canal.protocol.CanalEntry.EntryType;
import com.alibaba.otter.canal.protocol.CanalEntry.EventType;
import com.alibaba.otter.canal.protocol.CanalEntry.RowChange;
import com.alibaba.otter.canal.protocol.CanalEntry.RowData;
/**
* @author :杨过
* @date :Created in 2020/3/3
* @version: V1.0
* @slogan: 天下风云出我辈,一入代码岁月催
* @description:
**/
public class SimpleCanalClientExample {
public static void main(String args[]) {
// 创建链接
CanalConnector connector = CanalConnectors.newSingleConnector(new InetSocketAddress("192.168.88.202",
11111), "example", "", "");
int batchSize = 1000;
int emptyCount = 0;
try {
connector.connect();
connector.subscribe(".*\\..*");
connector.rollback();
int totalEmptyCount = 120;
while (emptyCount < totalEmptyCount) {
Message message = connector.getWithoutAck(batchSize); // 获取指定数量的数据
long batchId = message.getId();
int size = message.getEntries().size();
if (batchId == -1 || size == 0) {
emptyCount++;
System.out.println("empty count : " + emptyCount);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
} else {
emptyCount = 0;
// System.out.printf("message[batchId=%s,size=%s] \n", batchId, size);
printEntry(message.getEntries());
}
connector.ack(batchId); // 提交确认
// connector.rollback(batchId); // 处理失败, 回滚数据
}
System.out.println("empty too many times, exit");
} finally {
connector.disconnect();
}
}
private static void printEntry(List<Entry> entrys) {
for (Entry entry : entrys) {
if (entry.getEntryType() == EntryType.TRANSACTIONBEGIN || entry.getEntryType() == EntryType.TRANSACTIONEND) {
continue;
}
RowChange rowChage = null;
try {
rowChage = RowChange.parseFrom(entry.getStoreValue());
} catch (Exception e) {
throw new RuntimeException("ERROR ## parser of eromanga-event has an error , data:" + entry.toString(),
e);
}
EventType eventType = rowChage.getEventType();
System.out.println(String.format("================> binlog[%s:%s] , name[%s,%s] , eventType : %s",
entry.getHeader().getLogfileName(), entry.getHeader().getLogfileOffset(),
entry.getHeader().getSchemaName(), entry.getHeader().getTableName(),
eventType));
for (RowData rowData : rowChage.getRowDatasList()) {
if (eventType == EventType.DELETE) {
printColumn(rowData.getBeforeColumnsList());
} else if (eventType == EventType.INSERT) {
printColumn(rowData.getAfterColumnsList());
} else {
System.out.println("-------> before");
printColumn(rowData.getBeforeColumnsList());
System.out.println("-------> after");
printColumn(rowData.getAfterColumnsList());
}
}
}
}
private static void printColumn(List<Column> columns) {
for (Column column : columns) {
System.out.println(column.getName() + " : " + column.getValue() + " update=" + column.getUpdated());
}
}
}
|
[
"1561763825@qq.com"
] |
1561763825@qq.com
|
f473a486fcd30731eef06f583e1f19ac37e8a8fe
|
58d7f6ada7cb4909172c5096880ba54406556d5b
|
/Easymall/easymall-common-resources/src/main/java/com/jt/common/vo/Page.java
|
1b09b69fca3eae58ff79e15c9a9b664c917e0ce5
|
[] |
no_license
|
Vivian-ww/catnip
|
67987062afe2cd86a4acf3b2bbd53b9449deadb9
|
37d42b850bd614ce96eeb1aaf5c93b35ed81a80e
|
refs/heads/master
| 2021-01-06T10:06:12.875101
| 2020-08-27T02:00:46
| 2020-08-27T02:00:46
| 241,290,721
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 746
|
java
|
package com.jt.common.vo;
import java.util.List;
import com.jt.common.pojo.Product;
/**
* @author admin
*
*/
public class Page {
//总页数
private Integer totalPage;
//当前页数
private Integer currentPage;
//查询分页结果
private List<Product> products;
public Integer getTotalPage() {
return totalPage;
}
public void setTotalPage(Integer totalPage) {
this.totalPage = totalPage;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public List<Product> getProducts() {
return products;
}
public void setProducts(List<Product> products) {
this.products = products;
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
781ebbec2b3e2826a1f3aadf3289d7a8b887f3ef
|
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
|
/crash-reproduction-ws/results/XRENDERING-481-10-17-Single_Objective_GGA-WeightedSum/org/xwiki/display/internal/ConfiguredDocumentDisplayer_ESTest_scaffolding.java
|
01c0b9df8af79a67ef208f970b4af0e0bbfb9f83
|
[
"MIT",
"CC-BY-4.0"
] |
permissive
|
STAMP-project/Botsing-basic-block-coverage-application
|
6c1095c6be945adc0be2b63bbec44f0014972793
|
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
|
refs/heads/master
| 2022-07-28T23:05:55.253779
| 2022-04-20T13:54:11
| 2022-04-20T13:54:11
| 285,771,370
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 458
|
java
|
/**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Tue Mar 31 17:24:14 UTC 2020
*/
package org.xwiki.display.internal;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class ConfiguredDocumentDisplayer_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
|
[
"pouria.derakhshanfar@gmail.com"
] |
pouria.derakhshanfar@gmail.com
|
7edb7dbda0b0ecee9da6c6450dd8e393a10058b3
|
6c2f9d94c3e60bd8c9764ce0fa86d88cf258bd5b
|
/ass4.java
|
a89f78b7a8a24be5dbbc5e2b85227f0a65449a16
|
[] |
no_license
|
sonaliparekh/exception_handling
|
dc4bf934351f67f827ee987229d3182a6892bdb1
|
79b764b4f7720fdd71cee821d308e0b913ef7162
|
refs/heads/master
| 2021-01-10T03:38:16.987680
| 2016-03-01T18:48:19
| 2016-03-01T18:48:19
| 52,901,069
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 371
|
java
|
public class ass4 {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str="Sonali";
try{
System.out.println("Value at index 0 "+str.charAt(0));
System.out.println("value at index 10"+str.charAt(15));
}
catch(StringIndexOutOfBoundsException e)
{
System.out.println("String index out of bound");
}
}
}
|
[
"sonaliparekh22@gmail.com"
] |
sonaliparekh22@gmail.com
|
aeddb32ded9c9e40ea81caede0e286c40220c851
|
14e9ca431e112a7ed9acbc3355e05a9035019ace
|
/Java/YamanBanking/app/src/main/java/br/com/yaman/yamanbanking/LoginActivity.java
|
57ffe6c5aa45a6cf2f17b50ebdf1851b0bc01e7c
|
[] |
no_license
|
JhonatanSuardi/Projetos_pessoais
|
a532362e7ebc01b06eb270d4adeadb80b62b6e0d
|
d4f831705a023aede1901e8713537fbee65eb240
|
refs/heads/master
| 2022-11-15T23:50:23.546569
| 2020-07-15T14:35:43
| 2020-07-15T14:35:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,574
|
java
|
package br.com.yaman.yamanbanking;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import java.io.IOException;
import java.net.MalformedURLException;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class LoginActivity extends AppCompatActivity {
private Button btn_entrar;
private TextInputEditText nAgencia, nConta, nSenha;
private TextInputLayout lAgencia, lConta, lSenha;
private ProgressBar prBar;
private ConnectivityManager connectivityManager;
private Boolean error;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// BOTÃO ENTRAR
btn_entrar = findViewById(R.id.btn_entrar);
//CAMPOS DE TEXTO
nAgencia = findViewById(R.id.nAgenciaLogin);
nConta = findViewById(R.id.nContaLogin);
nSenha = findViewById(R.id.nSenhaLogin);
//CAMPOS DO LAYOUT
lAgencia = findViewById(R.id.nEditAgencia);
lConta = findViewById(R.id.nEditConta);
lSenha = findViewById(R.id.nEditSenha);
//CARREGAMENTO
connectivityManager = (ConnectivityManager) LoginActivity.this.getSystemService((Context.CONNECTIVITY_SERVICE));
prBar = findViewById(R.id.progressBar);
// connectivityManager = (ConnectivityManager) LoginActivity.this.getSystemService(Context.CONNECTIVITY_SERVICE);
// exibirProgress(false);
// Bundle dados = new Bundle();
// dados.putString("Agencia", nAgencia.toString());
btn_entrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
submit();
// SharedPreferences preferences = getApplication().getSharedPreferences("DADOS", MODE_PRIVATE);
// SharedPreferences.Editor editor;
// editor = preferences.edit();
// Log.i("Agencia", nAgencia.getText().toString());
// editor.putString("agencia", nAgencia.getText().toString());
// editor.putString("conta", nConta.getText().toString());
// editor.putString("password", nSenha.getText().toString());
// editor.apply();
}
});
}
private void exibirProgress(Boolean exibir) {
if (connectivityManager.getActiveNetworkInfo() != null &&
connectivityManager.getActiveNetworkInfo().isAvailable() &&
connectivityManager.getActiveNetworkInfo().isConnected()) {
prBar.setVisibility(exibir ? View.VISIBLE : View.GONE);
} else {
Toast.makeText(LoginActivity.this, "Verifique sua conexão com a rede", Toast.LENGTH_LONG).show();
prBar.setVisibility(View.GONE);
}
}
public void submit() {
if (!validaAgencia() || !validaConta() || !validaSenha()) {
return;
}
verifyLogin();
}
// private void verifyLogin() {
// @SuppressLint("StaticFieldLeak") AsyncTask<Integer, Void, Void> task = new AsyncTask<Integer, Void, Void>() {
// @Override
// protected void onPreExecute() {
// super.onPreExecute();
// exibirProgress(true);
// }
// @Override
// protected Void doInBackground(Integer... integers) {
// OkHttpClient cliente = new OkHttpClient();
// MultipartBody.Builder builder = new MultipartBody.Builder();
// builder.setType(MultipartBody.FORM);
// builder.addFormDataPart("agencia", nAgencia.getText().toString().trim());
// builder.addFormDataPart("numeroConta", nConta.getText().toString().trim());
// builder.addFormDataPart("senha", nSenha.getText().toString().trim());
// RequestBody corpo = builder.build();
// Request request = new Request.Builder()
// .url("https://api-yaman-banking.herokuapp.com/operacao/login")
// .post(corpo)
// .build();
// try {
// Response response = cliente.newCall(request).execute();
// if (response.code() == 200) {
// error = false;
// } else {
// error = true;
// }
// } catch (MalformedURLException e) {
// e.printStackTrace();
// } catch (IOException e) {
// e.printStackTrace();
// }
// return null;
// }
// @Override
// protected void onPostExecute(Void aVoid) {
// exibirProgress(false);
// if(!error) {
// SharedPreferences preferences = getApplication().getSharedPreferences("dados", MODE_PRIVATE);
// SharedPreferences.Editor editor;
// editor = preferences.edit();
// editor.putString("agencia", nAgencia.getText().toString());
// editor.putString("conta", nConta.getText().toString());
// editor.putString("password", nSenha.getText().toString());
// editor.apply();
// Intent home = new Intent(getApplicationContext(), DrawerActivity.class);
// startActivity(home);
// finish();
// }
// else {
// Toast.makeText(getApplicationContext(), "Verifique os dados inseridos no login", Toast.LENGTH_SHORT).show();
// }
// }
// }; task.execute();
// }
private void verifyLogin() {
@SuppressLint("StaticFieldLeak") AsyncTask<Integer, Void, Void> task = new AsyncTask<Integer, Void, Void>() {
@Override
public void onPreExecute() {
super.onPreExecute();
exibirProgress(true);
}
@SuppressLint("WrongThread")
@Override
protected Void doInBackground(Integer... integers) {
OkHttpClient cliente = new OkHttpClient();
MultipartBody.Builder builder = new MultipartBody.Builder();
builder.setType(MultipartBody.FORM);
builder.addFormDataPart("agencia", nAgencia.getText().toString().trim());
builder.addFormDataPart("numeroConta", nConta.getText().toString().trim());
builder.addFormDataPart("senha", nSenha.getText().toString().trim());
RequestBody corpo = builder.build();
Request request = new Request.Builder()
.url("https://api-yaman-banking.herokuapp.com/operacao/login")
.post(corpo)
.build();
try {
Response response = cliente.newCall(request).execute();
if (response.code() == 200) {
error = false;
}
else{
error = true;
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
exibirProgress(false);
if (!error) {
SharedPreferences preferences = getApplication().getSharedPreferences("DADOS", MODE_PRIVATE);
SharedPreferences.Editor editor;
editor = preferences.edit();
editor.putString("agencia", nAgencia.getText().toString());
editor.putString("numeroConta", nConta.getText().toString());
editor.putString("senha", nSenha.getText().toString());
editor.apply();
Intent drawer = new Intent(getApplicationContext(), DrawerActivity.class);
startActivity(drawer);
finish();
} else
Toast.makeText(getApplicationContext(), "Verifique os dados do login", Toast.LENGTH_SHORT).show();
}
};
task.execute();
}
public boolean validaAgencia() {
if (nAgencia.getText().toString().trim().isEmpty() || nAgencia.length() < 4) {
lAgencia.setError("Numero de caracteres insuficiente");
requestFocus(nAgencia);
return false;
} else {
lAgencia.setErrorEnabled(false);
}
return true;
}
public boolean validaConta() {
if (nConta.getText().toString().trim().isEmpty() || nConta.length() < 6) {
lConta.setError("Numero de caracteres insuficiente");
requestFocus(nConta);
return false;
} else {
lAgencia.setErrorEnabled(false);
}
return true;
}
public boolean validaSenha() {
if (nSenha.getText().toString().trim().isEmpty() || nSenha.length() < 6) {
lSenha.setError("Numero de caracteres insuficiente");
requestFocus(nSenha);
return false;
} else {
lSenha.setErrorEnabled(false);
}
return true;
}
private void requestFocus(View View) {
if (View.requestFocus()) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT);
}
}
}
|
[
"jhonatan.suardi123@gmail.com"
] |
jhonatan.suardi123@gmail.com
|
33d498fb5cd94b9d73ac9bec9964d537fa6eee46
|
cc2a0e84761c0324c192551ad4f8dd4228969dd2
|
/app/src/main/java/com/example/tech_5/syncdemo/VectorActivity.java
|
80fbafb4383dd01c2ad84ab5b9052fbde6d299eb
|
[] |
no_license
|
NidhiPatel1311/Syncdemo
|
436be73589944f0026011aa61eb0cc7bfe37d285
|
3ddd0abca89b56fc6fbff94f1939fdc439ed94d2
|
refs/heads/master
| 2020-06-25T17:45:30.114700
| 2019-07-29T05:34:35
| 2019-07-29T05:34:35
| 199,381,261
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 721
|
java
|
package com.example.tech_5.syncdemo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class VectorActivity extends AppCompatActivity {
private ImageView mImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vector);
mImageView = (ImageView)findViewById(R.id.imageView);
Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.path_morph);
mImageView.startAnimation(hyperspaceJumpAnimation);
}
}
|
[
"nhp13118@gmail.com"
] |
nhp13118@gmail.com
|
094ea267c386bf06348ba0f181dd127a916f36ed
|
005dc0860f173f4eeb3a0c7114625dffd9057d3f
|
/week-10/example-exam/src/main/java/com/exampleexam/exampleexam/services/UrlService.java
|
ec4a4e55c916faf86cdfac1f9d170d9ba03d4871
|
[] |
no_license
|
green-fox-academy/nadayzsolt
|
9e2d0d13e1e4aa3843a99f7c2bf25c4c463514c8
|
7f2d94bce24c5d7634bf4e2de0ce084ff54c96e8
|
refs/heads/master
| 2023-01-18T15:52:18.015190
| 2020-11-17T22:24:19
| 2020-11-17T22:24:19
| 279,879,167
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,643
|
java
|
package com.exampleexam.exampleexam.services;
import com.exampleexam.exampleexam.models.Url;
import com.exampleexam.exampleexam.repositories.UrlRepository;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UrlService {
UrlRepository urlRepository;
@Autowired
public UrlService(UrlRepository urlRepository) {
this.urlRepository = urlRepository;
}
public Url checkNewUrl(String url, String alias) {
if (url.equals("") || alias.equals("")) {
return null;
} else if (urlRepository.findByAlias(alias) == null) {
int code = (int) (Math.random() * 9000) + 1000;
return urlRepository.save(new Url(url, alias, code));
} else {
Url actualUrl = urlRepository.findByAlias(alias);
actualUrl.setUrlOld(true);
urlRepository.save(actualUrl);
return actualUrl;
}
}
public boolean checkIfUrlOld(String alias) {
return urlRepository.findByAlias(alias).isUrlOld();
}
public Url checkAlias(String alias) {
return urlRepository.findByAlias(alias);
}
public void incrementHitCount (String alias) {
Url actualUrl = urlRepository.findByAlias(alias);
actualUrl.setHitCount(actualUrl.getHitCount()+1);
urlRepository.save(actualUrl);
}
public List listAllUrls (){
return urlRepository.findAll();
}
public Url checkCode (int code){
return urlRepository.findByCode(code);
}
public Url checkId (int id){
return urlRepository.findById(id);
}
public void removeUrlByCode (int code){
urlRepository.deleteByCode(code);
}
}
|
[
"nadayzsolt@gmail.com"
] |
nadayzsolt@gmail.com
|
51d7f210c2922951a93cbd60f0bd42ce471514e8
|
ae1cbf5459daa1da08ab61070286a4210a9286d4
|
/app/src/main/java/com/example/sampurna/stormy/AlertDialogFragment.java
|
a32c42de208bc083c68831e13cdcb798466119e4
|
[] |
no_license
|
sampurnabasu/SmartUmbrella
|
ce9f0185b2c65fc9d309cc1eac78cd9f879b2569
|
61a1488f264c704dd6c58c64ee1f2e707c06afb4
|
refs/heads/master
| 2020-12-31T00:19:27.948487
| 2015-12-29T23:14:09
| 2015-12-29T23:14:09
| 48,771,155
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 801
|
java
|
package com.example.sampurna.stormy;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.os.Bundle;
/**
* Created by sampurna on 12/27/15.
*/
public class AlertDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Context context = getActivity();
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.error_title)
.setMessage(R.string.error_message)
.setPositiveButton(R.string.error_OK_button_text, null); //null on click listener will do nothing once clicked (just return)
AlertDialog dialog = builder.create();
return dialog;
}
}
|
[
"sampurna.basu23@gmail.com"
] |
sampurna.basu23@gmail.com
|
86625298584d3f225abebcfc5ac916bb48893d39
|
9c24b6c6774d715a6c4de338d80e46587e486b1f
|
/GovernmentTax.java
|
8c8efc9fb25d7d927eeebad89884015bda8ddb6c
|
[] |
no_license
|
aliamahamad/javaExercise
|
cc9bd12e6e4646407c28196901eddfd43a057abb
|
64f115dc1defef80fedeb1af21edbe3a3cd40633
|
refs/heads/master
| 2021-07-07T23:47:01.970563
| 2017-10-03T18:41:59
| 2017-10-03T18:41:59
| 105,687,771
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 497
|
java
|
//To calculate total amount
import java.util.Scanner;
public class GovernmentTax {
public static void main (String [] args) {
Scanner input = new Scanner (System.in);
//Get payment of food
System.out.println("Enter your current payment of food :");
double payment = input.nextDouble();
//Get payment of drink
System.out.println("Enter your current payment of drink :");
double payment = input.nextDouble();
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
7a285f9cf4a632fedc26be6738df1880d88472dd
|
2df75ad287977c1884367aa09a089d52fd9c5bec
|
/Kruskals/src/mini/DisjSets.java
|
2f4f7de20d4e5b51f7ede8a2ed5841a66f36a4fd
|
[] |
no_license
|
shadowjljp/Algorithms_Java
|
c09184afe300e1d0885a411520703eb2fa26dfa4
|
40d80a00b291baf768c6f799a63f68dc20d53fd6
|
refs/heads/master
| 2023-08-01T15:43:42.504865
| 2021-09-16T02:20:21
| 2021-09-16T02:20:21
| 283,597,849
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,604
|
java
|
package mini;
// DisjSets class
//
// CONSTRUCTION: with int representing initial number of sets
//
// ******************PUBLIC OPERATIONS*********************
// void union( root1, root2 ) --> Merge two sets
// int find( x ) --> Return set containing x
// ******************ERRORS********************************
// No error checking is performed
/**
* Disjoint set class, using union by rank and path compression.
* Elements in the set are numbered starting at 0.
* @author Mark Allen Weiss
*/
public class DisjSets
{
/**
* Construct the disjoint sets object.
* @param numElements the initial number of disjoint sets.
*/
public DisjSets( int numElements )
{
s = new int [ numElements ];
for( int i = 0; i < s.length; i++ )
s[ i ] = -1;
}
/**
* Union two disjoint sets using the height heuristic.
* For simplicity, we assume root1 and root2 are distinct
* and represent set names.
* @param root1 the root of set 1.
* @param root2 the root of set 2.
*/
public void union( int root1, int root2 )
{
if( s[ root2 ] < s[ root1 ] ) // root2 is deeper
s[ root1 ] = root2; // Make root2 new root
else
{
if( s[ root1 ] == s[ root2 ] )
s[ root1 ]--; // Update height if same
s[ root2 ] = root1; // Make root1 new root
}
}
/**
* Perform a find with path compression.
* Error checks omitted again for simplicity.
* @param x the element being searched for.
* @return the set containing x.
*/
public int find( int x )
{
if( s[ x ] < 0 )
return x;
else
return s[ x ] = find( s[ x ] );
}
private int [ ] s;
// Test main; all finds on same output line should be identical
public static void main( String [ ] args )
{
int NumElements = 128;
int NumInSameSet = 16;
DisjSets ds = new DisjSets( NumElements );
int set1, set2;
for( int k = 1; k < NumInSameSet; k *= 2 )
{
for( int j = 0; j + k < NumElements; j += 2 * k )
{
set1 = ds.find( j );
set2 = ds.find( j + k );
ds.union( set1, set2 );
}
}
for( int i = 0; i < NumElements; i++ )
{
System.out.print( ds.find( i )+ "*" );
if( i % NumInSameSet == NumInSameSet - 1 )
System.out.println( );
}
System.out.println( );
}
}
|
[
"40411574+shadowjljp@users.noreply.github.com"
] |
40411574+shadowjljp@users.noreply.github.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.