blob_id stringlengths 40 40 | __id__ int64 225 39,780B | directory_id stringlengths 40 40 | path stringlengths 6 313 | content_id stringlengths 40 40 | detected_licenses list | license_type stringclasses 2
values | repo_name stringlengths 6 132 | repo_url stringlengths 25 151 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 70 | visit_date timestamp[ns] | revision_date timestamp[ns] | committer_date timestamp[ns] | github_id int64 7.28k 689M ⌀ | star_events_count int64 0 131k | fork_events_count int64 0 48k | gha_license_id stringclasses 23
values | gha_fork bool 2
classes | gha_event_created_at timestamp[ns] | gha_created_at timestamp[ns] | gha_updated_at timestamp[ns] | gha_pushed_at timestamp[ns] | gha_size int64 0 40.4M ⌀ | gha_stargazers_count int32 0 112k ⌀ | gha_forks_count int32 0 39.4k ⌀ | gha_open_issues_count int32 0 11k ⌀ | gha_language stringlengths 1 21 ⌀ | gha_archived bool 2
classes | gha_disabled bool 1
class | content stringlengths 7 4.37M | src_encoding stringlengths 3 16 | language stringclasses 1
value | length_bytes int64 7 4.37M | extension stringclasses 24
values | filename stringlengths 4 174 | language_id stringclasses 1
value | entities list | contaminating_dataset stringclasses 0
values | malware_signatures list | redacted_content stringlengths 7 4.37M | redacted_length_bytes int64 7 4.37M | alphanum_fraction float32 0.25 0.94 | alpha_fraction float32 0.25 0.94 | num_lines int32 1 84k | avg_line_length float32 0.76 99.9 | std_line_length float32 0 220 | max_line_length int32 5 998 | is_vendor bool 2
classes | is_generated bool 1
class | max_hex_length int32 0 319 | hex_fraction float32 0 0.38 | max_unicode_length int32 0 408 | unicode_fraction float32 0 0.36 | max_base64_length int32 0 506 | base64_fraction float32 0 0.5 | avg_csv_sep_count float32 0 4 | is_autogen_header bool 1
class | is_empty_html bool 1
class | shard stringclasses 16
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7744326e441766996c993db9a131bdff89a5696f | 21,174,188,776,004 | 628ac983c0ceff6e5383242753fe0a4711321928 | /minuku2-extended/src/main/java/labelingStudy/nctu/minuku/dao/AccessibilityDataRecordDAO.java | c8f27a1bbf5f44453102d62d570de151caffb43a | [] | no_license | bufficecream/LabelingStudy | https://github.com/bufficecream/LabelingStudy | c91954e0e60b39e37844f08a24de0e574f140746 | 93fd9ccd6027f88996dd8553367400bbb50f8d80 | refs/heads/master | 2022-01-07T20:17:18.762000 | 2019-04-28T11:57:53 | 2019-04-28T11:57:53 | 109,563,253 | 0 | 0 | null | true | 2017-11-05T08:31:26 | 2017-11-05T09:31:25 | 2017-11-01T07:24:26 | 2017-11-01T07:24:23 | 41,224 | 0 | 0 | 0 | null | false | null | package labelingStudy.nctu.minuku.dao;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Future;
import labelingStudy.nctu.minuku.Data.DBHelper;
import labelingStudy.nctu.minuku.manager.DBManager;
import labelingStudy.nctu.minuku.model.DataRecord.AccessibilityDataRecord;
import labelingStudy.nctu.minukucore.dao.DAO;
import labelingStudy.nctu.minukucore.dao.DAOException;
import labelingStudy.nctu.minukucore.user.User;
/**
* Created by Lawrence on 2017/9/6.
*/
public class AccessibilityDataRecordDAO implements DAO<AccessibilityDataRecord> {
private final String TAG = "AccessibilityDataRecordDAO";
private DBHelper dBHelper;
private Context mContext;
public AccessibilityDataRecordDAO(Context applicationContext){
this.mContext = applicationContext;
dBHelper = DBHelper.getInstance(applicationContext);
}
@Override
public void setDevice(User user, UUID uuid) {
}
@Override
public void add(AccessibilityDataRecord entity) throws DAOException {
Log.d(TAG, "Adding accessibility data record.");
ContentValues values = new ContentValues();
try {
SQLiteDatabase db = DBManager.getInstance().openDatabase();
values.put(DBHelper.TIME, entity.getCreationTime());
values.put(DBHelper.pack_col, entity.getPack());
values.put(DBHelper.text_col, entity.getText());
values.put(DBHelper.type_col, entity.getType());
values.put(DBHelper.extra_col, entity.getExtra());
values.put(DBHelper.COL_SESSION_ID, entity.getSessionid());
db.insert(DBHelper.accessibility_table, null, values);
} catch (NullPointerException e) {
e.printStackTrace();
} finally {
values.clear();
DBManager.getInstance().closeDatabase();
}
}
public void query_check() {
SQLiteDatabase db = DBManager.getInstance().openDatabase();
Cursor packCursor = db.rawQuery("SELECT "+ DBHelper.pack_col +" FROM "+ DBHelper.accessibility_table, null);
int packrow = packCursor.getCount();
int packcol = packCursor.getColumnCount();
Log.d(TAG, "packrow "+packrow+"packcol "+packcol);
String[] columns = new String[]{"pack"};
Cursor c = db.query(DBHelper.accessibility_table, columns, null, null, null, null, null, null);
c.moveToFirst();
Log.d(TAG, "pack "+c.getString(0));
}
@Override
public void delete(AccessibilityDataRecord entity) throws DAOException {
}
@Override
public Future<List<AccessibilityDataRecord>> getAll() throws DAOException {
return null;
}
@Override
public Future<List<AccessibilityDataRecord>> getLast(int N) throws DAOException {
return null;
}
@Override
public void update(AccessibilityDataRecord oldEntity, AccessibilityDataRecord newEntity) throws DAOException {
}
}
| UTF-8 | Java | 3,149 | java | AccessibilityDataRecordDAO.java | Java | [
{
"context": "tudy.nctu.minukucore.user.User;\n\n/**\n * Created by Lawrence on 2017/9/6.\n */\n\npublic class AccessibilityDataR",
"end": 649,
"score": 0.9925045967102051,
"start": 641,
"tag": "NAME",
"value": "Lawrence"
}
] | null | [] | package labelingStudy.nctu.minuku.dao;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Future;
import labelingStudy.nctu.minuku.Data.DBHelper;
import labelingStudy.nctu.minuku.manager.DBManager;
import labelingStudy.nctu.minuku.model.DataRecord.AccessibilityDataRecord;
import labelingStudy.nctu.minukucore.dao.DAO;
import labelingStudy.nctu.minukucore.dao.DAOException;
import labelingStudy.nctu.minukucore.user.User;
/**
* Created by Lawrence on 2017/9/6.
*/
public class AccessibilityDataRecordDAO implements DAO<AccessibilityDataRecord> {
private final String TAG = "AccessibilityDataRecordDAO";
private DBHelper dBHelper;
private Context mContext;
public AccessibilityDataRecordDAO(Context applicationContext){
this.mContext = applicationContext;
dBHelper = DBHelper.getInstance(applicationContext);
}
@Override
public void setDevice(User user, UUID uuid) {
}
@Override
public void add(AccessibilityDataRecord entity) throws DAOException {
Log.d(TAG, "Adding accessibility data record.");
ContentValues values = new ContentValues();
try {
SQLiteDatabase db = DBManager.getInstance().openDatabase();
values.put(DBHelper.TIME, entity.getCreationTime());
values.put(DBHelper.pack_col, entity.getPack());
values.put(DBHelper.text_col, entity.getText());
values.put(DBHelper.type_col, entity.getType());
values.put(DBHelper.extra_col, entity.getExtra());
values.put(DBHelper.COL_SESSION_ID, entity.getSessionid());
db.insert(DBHelper.accessibility_table, null, values);
} catch (NullPointerException e) {
e.printStackTrace();
} finally {
values.clear();
DBManager.getInstance().closeDatabase();
}
}
public void query_check() {
SQLiteDatabase db = DBManager.getInstance().openDatabase();
Cursor packCursor = db.rawQuery("SELECT "+ DBHelper.pack_col +" FROM "+ DBHelper.accessibility_table, null);
int packrow = packCursor.getCount();
int packcol = packCursor.getColumnCount();
Log.d(TAG, "packrow "+packrow+"packcol "+packcol);
String[] columns = new String[]{"pack"};
Cursor c = db.query(DBHelper.accessibility_table, columns, null, null, null, null, null, null);
c.moveToFirst();
Log.d(TAG, "pack "+c.getString(0));
}
@Override
public void delete(AccessibilityDataRecord entity) throws DAOException {
}
@Override
public Future<List<AccessibilityDataRecord>> getAll() throws DAOException {
return null;
}
@Override
public Future<List<AccessibilityDataRecord>> getLast(int N) throws DAOException {
return null;
}
@Override
public void update(AccessibilityDataRecord oldEntity, AccessibilityDataRecord newEntity) throws DAOException {
}
}
| 3,149 | 0.692283 | 0.69006 | 98 | 31.12245 | 29.457775 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.663265 | false | false | 13 |
b55ea6a92538e2059b1a500f3381c8f626596164 | 31,903,017,115,348 | 4534c87e794302abac3f93ba02329a6f36aedef1 | /src/Main.java | 281a1bcd1f2df5b66e6f1e2043b6ccc2e59aa877 | [] | no_license | Sroka/urbanThingsTest | https://github.com/Sroka/urbanThingsTest | 6a039ff98483cedd7d28f7a168b40d22b61bbf1b | 03765df9fc5681ae5d935c04c296e42c385ea679 | refs/heads/master | 2021-05-06T17:11:52.498000 | 2017-11-23T10:28:25 | 2017-11-23T10:28:25 | 111,795,707 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.IntStream;
public class Main {
private final static Logger LOGGER = Logger.getLogger(Main.class.getName());
public static void main(String[] args) {
System.out.println("Hello World!");
}
public static int calculateLiftTicks(final int[] weights, final int[] destinedFloors, final int floorCount,
final int maxLiftPeopleCount, final int maxLiftWeight) {
int tick = 0;
int movedPeopleCount = 0;
int elevatorWeight = 0;
int elevatorPeopleCount = 0;
while (movedPeopleCount < weights.length) {
elevatorWeight += weights[movedPeopleCount];
elevatorPeopleCount++;
movedPeopleCount++;
// LOGGER.log(Level.INFO, String.format("Load people, elevatorWeight: %d, elevatorPeopleCount: %d, movedPeopleCount: %d", elevatorWeight, elevatorPeopleCount, movedPeopleCount));
if (elevatorWeight >= maxLiftWeight || elevatorPeopleCount >= maxLiftPeopleCount || movedPeopleCount >= weights.length) {
// LOGGER.log(Level.INFO, String.format("People loaded, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
//Elevator full
tick++;
int floor = 0;
//Its is a trade-off between number of operations and memory allocation here. We could allocate an array
// and track people currently loaded on the elevator but I assume that it is cheaper to loop through
// them on every floor
int currentRunLoad = elevatorPeopleCount;
while (elevatorPeopleCount > 0) {
LOGGER.log(Level.INFO, String.format("Move floor up, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
floor++;
tick++;
boolean stoppedOnCurrentFloor = false;
for (int person = movedPeopleCount - currentRunLoad; person < movedPeopleCount; person++) {
LOGGER.log(Level.INFO, String.format("Check unload person: %d, movedPeopleCount: %d, currentRunLoad: %d", person, movedPeopleCount, currentRunLoad));
if (destinedFloors[person] == floor) {
stoppedOnCurrentFloor = true;
elevatorPeopleCount--;
}
}
if (stoppedOnCurrentFloor) {
LOGGER.log(Level.INFO, String.format("Unload people, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
tick++;
//Reset
stoppedOnCurrentFloor = false;
}
}
while (floor > 0) {
LOGGER.log(Level.INFO, String.format("Move floor down, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
floor--;
tick++;
}
//Reset
elevatorWeight = 0;
}
}
return tick;
}
}
| UTF-8 | Java | 3,307 | java | Main.java | Java | [] | null | [] | import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.IntStream;
public class Main {
private final static Logger LOGGER = Logger.getLogger(Main.class.getName());
public static void main(String[] args) {
System.out.println("Hello World!");
}
public static int calculateLiftTicks(final int[] weights, final int[] destinedFloors, final int floorCount,
final int maxLiftPeopleCount, final int maxLiftWeight) {
int tick = 0;
int movedPeopleCount = 0;
int elevatorWeight = 0;
int elevatorPeopleCount = 0;
while (movedPeopleCount < weights.length) {
elevatorWeight += weights[movedPeopleCount];
elevatorPeopleCount++;
movedPeopleCount++;
// LOGGER.log(Level.INFO, String.format("Load people, elevatorWeight: %d, elevatorPeopleCount: %d, movedPeopleCount: %d", elevatorWeight, elevatorPeopleCount, movedPeopleCount));
if (elevatorWeight >= maxLiftWeight || elevatorPeopleCount >= maxLiftPeopleCount || movedPeopleCount >= weights.length) {
// LOGGER.log(Level.INFO, String.format("People loaded, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
//Elevator full
tick++;
int floor = 0;
//Its is a trade-off between number of operations and memory allocation here. We could allocate an array
// and track people currently loaded on the elevator but I assume that it is cheaper to loop through
// them on every floor
int currentRunLoad = elevatorPeopleCount;
while (elevatorPeopleCount > 0) {
LOGGER.log(Level.INFO, String.format("Move floor up, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
floor++;
tick++;
boolean stoppedOnCurrentFloor = false;
for (int person = movedPeopleCount - currentRunLoad; person < movedPeopleCount; person++) {
LOGGER.log(Level.INFO, String.format("Check unload person: %d, movedPeopleCount: %d, currentRunLoad: %d", person, movedPeopleCount, currentRunLoad));
if (destinedFloors[person] == floor) {
stoppedOnCurrentFloor = true;
elevatorPeopleCount--;
}
}
if (stoppedOnCurrentFloor) {
LOGGER.log(Level.INFO, String.format("Unload people, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
tick++;
//Reset
stoppedOnCurrentFloor = false;
}
}
while (floor > 0) {
LOGGER.log(Level.INFO, String.format("Move floor down, elevatorWeight: %d, elevatorPeopleCount: %d", elevatorWeight, elevatorPeopleCount));
floor--;
tick++;
}
//Reset
elevatorWeight = 0;
}
}
return tick;
}
}
| 3,307 | 0.566374 | 0.563955 | 69 | 46.927536 | 47.683838 | 189 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.086957 | false | false | 13 |
7354ed14173cf3b9111d78fafcf0ffc4aa495a06 | 34,849,364,682,758 | 9be352d4af914c3cac0a8f62811d9e74e113af93 | /day_18/Calculator.java | ca09ca24f4b08f2a58479eda156f3899c4792f18 | [] | no_license | Jay-Plumb/30-Days-of-Code | https://github.com/Jay-Plumb/30-Days-of-Code | 986c2a50284aefeceb40127bc70a11488dc3c34a | 292fcbfbe5e209da06d02416b485df6a81e18549 | refs/heads/master | 2021-01-13T17:06:10.786000 | 2017-01-03T17:11:16 | 2017-01-03T17:11:16 | 72,647,029 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //Write your code here
class Calculator {
int power(int n ,int p) throws Exception {
int ans = 1;
if (n < 0 || p < 0) {
throw new Exception("n and p should be non-negative");
}
for (int i = 1; i <= p; i++ ) {
ans *= n;
}
return ans;
}
}
| UTF-8 | Java | 322 | java | Calculator.java | Java | [] | null | [] | //Write your code here
class Calculator {
int power(int n ,int p) throws Exception {
int ans = 1;
if (n < 0 || p < 0) {
throw new Exception("n and p should be non-negative");
}
for (int i = 1; i <= p; i++ ) {
ans *= n;
}
return ans;
}
}
| 322 | 0.437888 | 0.425466 | 14 | 22 | 17.468338 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false | 13 |
cc07a9a02d64d23f15c120a3fba9538be71b2c69 | 35,553,739,313,538 | 1792068ab7478b0cf793b78a80f454114e86cdf9 | /tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cli/QueueCommandTest.java | a933b1610497878a35189eb72ab3d17dc5961b4a | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"MIT",
"OFL-1.1"
] | permissive | apache/activemq-artemis | https://github.com/apache/activemq-artemis | caf9a87a245e0e20e24a981b030e55a81583c421 | 98710fe0320c391631626736291962df3639de7f | refs/heads/main | 2023-09-01T20:39:35.019000 | 2023-09-01T19:26:12 | 2023-09-01T19:26:28 | 36,057,260 | 969 | 1,097 | Apache-2.0 | false | 2023-09-14T16:42:37 | 2015-05-22T07:00:05 | 2023-09-09T07:43:52 | 2023-09-14T16:42:37 | 91,487 | 878 | 887 | 10 | Java | false | false | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.cli;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.invoke.MethodHandles;
import java.util.EnumSet;
import java.util.Set;
import java.util.UUID;
import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.cli.commands.ActionContext;
import org.apache.activemq.artemis.cli.commands.messages.ConnectionAbstract;
import org.apache.activemq.artemis.cli.commands.queue.CreateQueue;
import org.apache.activemq.artemis.cli.commands.queue.DeleteQueue;
import org.apache.activemq.artemis.cli.commands.queue.PurgeQueue;
import org.apache.activemq.artemis.cli.commands.queue.UpdateQueue;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.QueueQueryResult;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class QueueCommandTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
//the command
private ByteArrayOutputStream output;
private ByteArrayOutputStream error;
@Override
protected void extraServerConfig(ActiveMQServer server) {
super.extraServerConfig(server);
server.getConfiguration().setAddressQueueScanPeriod(100);
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
this.output = new ByteArrayOutputStream(1024);
this.error = new ByteArrayOutputStream(1024);
}
@Test
public void testCreateCoreQueueShowsErrorWhenAddressDoesNotExists() throws Exception {
String queueName = "queue1";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(command, "AMQ229203");
assertFalse(server.queueQuery(new SimpleString(queueName)).isExists());
}
@Test
public void testCreateCoreQueueAutoCreateAddressDefaultAddress() throws Exception {
String queueName = UUID.randomUUID().toString();
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
assertNotNull(server.getAddressInfo(new SimpleString(queueName)));
Queue queue = server.locateQueue(new SimpleString(queueName));
assertEquals(-1, queue.getMaxConsumers());
assertEquals(false, queue.isPurgeOnNoConsumers());
assertTrue(server.queueQuery(new SimpleString(queueName)).isExists());
}
@Test
public void testCreateCoreQueueAddressExists() throws Exception {
String queueName = "queue";
String address = "address";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setAutoCreateAddress(false);
command.setMulticast(true);
command.setAnycast(false);
command.setAddress(address);
server.addOrUpdateAddressInfo(new AddressInfo(new SimpleString(address), RoutingType.MULTICAST));
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
assertNotNull(server.getAddressInfo(new SimpleString(address)));
Queue queue = server.locateQueue(new SimpleString(queueName));
assertEquals(-1, queue.getMaxConsumers());
assertEquals(false, queue.isPurgeOnNoConsumers());
assertTrue(server.queueQuery(new SimpleString(queueName)).isExists());
}
@Test
public void testCreateCoreQueueWithFilter() throws Exception {
String queueName = "queue2";
String filerString = "color='green'";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
Queue queue = server.locateQueue(new SimpleString(queueName));
assertNotNull(queue);
assertEquals(new SimpleString(filerString), queue.getFilter().getFilterString());
}
@Test
public void testCreateQueueAlreadyExists() throws Exception {
String queueName = "queue2";
String filerString = "color='green'";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(command, "AMQ229019");
}
@Test
public void testDeleteCoreQueue() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(delete);
assertFalse(server.queueQuery(queueName).isExists());
}
@Test
public void testDeleteQueueDoesNotExist() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(delete, "AMQ229017");
assertFalse(server.queueQuery(queueName).isExists());
}
@Test
public void testDeleteQueueWithConsumersFails() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(delete, "AMQ229025");
}
@Test
public void testDeleteQueueWithConsumersFailsAndRemoveConsumersTrue() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.setRemoveConsumers(true);
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
}
@Test
public void testAutoDeleteAddress() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
assertNotNull(server.getAddressInfo(queueName));
server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.setRemoveConsumers(true);
delete.setAutoDeleteAddress(true);
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
Wait.assertTrue(() -> server.getAddressInfo(queueName) == null, 2000, 10);
}
@Test
public void testUpdateCoreQueue() throws Exception {
final String queueName = "updateQueue";
final SimpleString queueNameString = new SimpleString(queueName);
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final int oldMaxConsumers = -1;
final RoutingType oldRoutingType = RoutingType.MULTICAST;
final boolean oldPurgeOnNoConsumers = false;
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST));
server.addAddressInfo(addressInfo);
server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false));
final int newMaxConsumers = 1;
final RoutingType newRoutingType = RoutingType.ANYCAST;
final boolean newPurgeOnNoConsumers = true;
final UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName);
updateQueue.setPurgeOnNoConsumers(newPurgeOnNoConsumers);
updateQueue.setAnycast(true);
updateQueue.setMulticast(false);
updateQueue.setMaxConsumers(newMaxConsumers);
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(updateQueue);
final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString);
assertEquals("maxConsumers", newMaxConsumers, queueQueryResult.getMaxConsumers());
assertEquals("routingType", newRoutingType, queueQueryResult.getRoutingType());
assertTrue("purgeOnNoConsumers", newPurgeOnNoConsumers == queueQueryResult.isPurgeOnNoConsumers());
}
@Test
public void testUpdateCoreQueueCannotChangeRoutingType() throws Exception {
final String queueName = "updateQueue";
final SimpleString queueNameString = new SimpleString(queueName);
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final int oldMaxConsumers = 10;
final RoutingType oldRoutingType = RoutingType.MULTICAST;
final boolean oldPurgeOnNoConsumers = false;
final Set<RoutingType> supportedRoutingTypes = EnumSet.of(oldRoutingType);
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.copyOf(supportedRoutingTypes));
server.addAddressInfo(addressInfo);
server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false));
final RoutingType newRoutingType = RoutingType.ANYCAST;
final UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName);
updateQueue.setAnycast(true);
updateQueue.setMulticast(false);
updateQueue.setMaxConsumers(-1);
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateQueue, "AMQ229211");
final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString);
assertEquals("maxConsumers", oldMaxConsumers, queueQueryResult.getMaxConsumers());
assertEquals("routingType", oldRoutingType, queueQueryResult.getRoutingType());
assertTrue("purgeOnNoConsumers", oldPurgeOnNoConsumers == queueQueryResult.isPurgeOnNoConsumers());
}
@Test
public void testUpdateCoreQueueCannotLowerMaxConsumers() throws Exception {
final String queueName = "updateQueue";
final SimpleString queueNameString = new SimpleString(queueName);
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final int oldMaxConsumers = 2;
final RoutingType oldRoutingType = RoutingType.MULTICAST;
final boolean oldPurgeOnNoConsumers = false;
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, oldRoutingType);
server.addAddressInfo(addressInfo);
server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false));
server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer());
server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer());
final int newMaxConsumers = 1;
final UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName);
updateQueue.setMaxConsumers(newMaxConsumers);
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateQueue, "AMQ229210");
final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString);
assertEquals("maxConsumers", oldMaxConsumers, queueQueryResult.getMaxConsumers());
}
@Test
public void testUpdateCoreQueueDoesNotExist() throws Exception {
SimpleString queueName = new SimpleString("updateQueue");
UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName.toString());
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateQueue, "AMQ229017: Queue " + queueName + " does not exist");
assertFalse(server.queueQuery(queueName).isExists());
}
@Test
public void testPurgeQueue() throws Exception {
SimpleString queueName = new SimpleString("purgeQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setAutoCreateAddress(true);
command.setAnycast(true);
command.execute(new ActionContext());
PurgeQueue purge = new PurgeQueue();
purge.setName(queueName.toString());
purge.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(purge);
}
@Test
public void testPurgeQueueDoesNotExist() throws Exception {
SimpleString queueName = new SimpleString("purgeQueue");
PurgeQueue purge = new PurgeQueue();
purge.setName(queueName.toString());
purge.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(purge, "AMQ229067: Cannot find resource with name queue." + queueName);
assertFalse(server.queueQuery(queueName).isExists());
}
private void checkExecutionPassed(ConnectionAbstract command) throws Exception {
String fullMessage = output.toString();
logger.debug("output: {}", fullMessage);
assertTrue(fullMessage, fullMessage.contains("successfully"));
}
private void checkExecutionFailure(ConnectionAbstract command, String message) throws Exception {
String fullMessage = error.toString();
logger.debug("error: {}", fullMessage);
assertTrue(fullMessage, fullMessage.contains(message));
}
}
| UTF-8 | Java | 17,177 | java | QueueCommandTest.java | Java | [] | null | [] | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.cli;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.invoke.MethodHandles;
import java.util.EnumSet;
import java.util.Set;
import java.util.UUID;
import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.cli.commands.ActionContext;
import org.apache.activemq.artemis.cli.commands.messages.ConnectionAbstract;
import org.apache.activemq.artemis.cli.commands.queue.CreateQueue;
import org.apache.activemq.artemis.cli.commands.queue.DeleteQueue;
import org.apache.activemq.artemis.cli.commands.queue.PurgeQueue;
import org.apache.activemq.artemis.cli.commands.queue.UpdateQueue;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.QueueQueryResult;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class QueueCommandTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
//the command
private ByteArrayOutputStream output;
private ByteArrayOutputStream error;
@Override
protected void extraServerConfig(ActiveMQServer server) {
super.extraServerConfig(server);
server.getConfiguration().setAddressQueueScanPeriod(100);
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
this.output = new ByteArrayOutputStream(1024);
this.error = new ByteArrayOutputStream(1024);
}
@Test
public void testCreateCoreQueueShowsErrorWhenAddressDoesNotExists() throws Exception {
String queueName = "queue1";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(command, "AMQ229203");
assertFalse(server.queueQuery(new SimpleString(queueName)).isExists());
}
@Test
public void testCreateCoreQueueAutoCreateAddressDefaultAddress() throws Exception {
String queueName = UUID.randomUUID().toString();
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
assertNotNull(server.getAddressInfo(new SimpleString(queueName)));
Queue queue = server.locateQueue(new SimpleString(queueName));
assertEquals(-1, queue.getMaxConsumers());
assertEquals(false, queue.isPurgeOnNoConsumers());
assertTrue(server.queueQuery(new SimpleString(queueName)).isExists());
}
@Test
public void testCreateCoreQueueAddressExists() throws Exception {
String queueName = "queue";
String address = "address";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setAutoCreateAddress(false);
command.setMulticast(true);
command.setAnycast(false);
command.setAddress(address);
server.addOrUpdateAddressInfo(new AddressInfo(new SimpleString(address), RoutingType.MULTICAST));
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
assertNotNull(server.getAddressInfo(new SimpleString(address)));
Queue queue = server.locateQueue(new SimpleString(queueName));
assertEquals(-1, queue.getMaxConsumers());
assertEquals(false, queue.isPurgeOnNoConsumers());
assertTrue(server.queueQuery(new SimpleString(queueName)).isExists());
}
@Test
public void testCreateCoreQueueWithFilter() throws Exception {
String queueName = "queue2";
String filerString = "color='green'";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
Queue queue = server.locateQueue(new SimpleString(queueName));
assertNotNull(queue);
assertEquals(new SimpleString(filerString), queue.getFilter().getFilterString());
}
@Test
public void testCreateQueueAlreadyExists() throws Exception {
String queueName = "queue2";
String filerString = "color='green'";
CreateQueue command = new CreateQueue();
command.setName(queueName);
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
command.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(command, "AMQ229019");
}
@Test
public void testDeleteCoreQueue() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(delete);
assertFalse(server.queueQuery(queueName).isExists());
}
@Test
public void testDeleteQueueDoesNotExist() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(delete, "AMQ229017");
assertFalse(server.queueQuery(queueName).isExists());
}
@Test
public void testDeleteQueueWithConsumersFails() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(delete, "AMQ229025");
}
@Test
public void testDeleteQueueWithConsumersFailsAndRemoveConsumersTrue() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.setRemoveConsumers(true);
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
}
@Test
public void testAutoDeleteAddress() throws Exception {
SimpleString queueName = new SimpleString("deleteQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setFilter("color='green'");
command.setAutoCreateAddress(true);
command.setMulticast(true);
command.setAnycast(false);
command.execute(new ActionContext());
assertNotNull(server.getAddressInfo(queueName));
server.locateQueue(queueName).addConsumer(new DummyServerConsumer());
DeleteQueue delete = new DeleteQueue();
delete.setName(queueName.toString());
delete.setRemoveConsumers(true);
delete.setAutoDeleteAddress(true);
delete.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(command);
Wait.assertTrue(() -> server.getAddressInfo(queueName) == null, 2000, 10);
}
@Test
public void testUpdateCoreQueue() throws Exception {
final String queueName = "updateQueue";
final SimpleString queueNameString = new SimpleString(queueName);
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final int oldMaxConsumers = -1;
final RoutingType oldRoutingType = RoutingType.MULTICAST;
final boolean oldPurgeOnNoConsumers = false;
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.of(RoutingType.ANYCAST, RoutingType.MULTICAST));
server.addAddressInfo(addressInfo);
server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false));
final int newMaxConsumers = 1;
final RoutingType newRoutingType = RoutingType.ANYCAST;
final boolean newPurgeOnNoConsumers = true;
final UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName);
updateQueue.setPurgeOnNoConsumers(newPurgeOnNoConsumers);
updateQueue.setAnycast(true);
updateQueue.setMulticast(false);
updateQueue.setMaxConsumers(newMaxConsumers);
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(updateQueue);
final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString);
assertEquals("maxConsumers", newMaxConsumers, queueQueryResult.getMaxConsumers());
assertEquals("routingType", newRoutingType, queueQueryResult.getRoutingType());
assertTrue("purgeOnNoConsumers", newPurgeOnNoConsumers == queueQueryResult.isPurgeOnNoConsumers());
}
@Test
public void testUpdateCoreQueueCannotChangeRoutingType() throws Exception {
final String queueName = "updateQueue";
final SimpleString queueNameString = new SimpleString(queueName);
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final int oldMaxConsumers = 10;
final RoutingType oldRoutingType = RoutingType.MULTICAST;
final boolean oldPurgeOnNoConsumers = false;
final Set<RoutingType> supportedRoutingTypes = EnumSet.of(oldRoutingType);
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, EnumSet.copyOf(supportedRoutingTypes));
server.addAddressInfo(addressInfo);
server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false));
final RoutingType newRoutingType = RoutingType.ANYCAST;
final UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName);
updateQueue.setAnycast(true);
updateQueue.setMulticast(false);
updateQueue.setMaxConsumers(-1);
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateQueue, "AMQ229211");
final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString);
assertEquals("maxConsumers", oldMaxConsumers, queueQueryResult.getMaxConsumers());
assertEquals("routingType", oldRoutingType, queueQueryResult.getRoutingType());
assertTrue("purgeOnNoConsumers", oldPurgeOnNoConsumers == queueQueryResult.isPurgeOnNoConsumers());
}
@Test
public void testUpdateCoreQueueCannotLowerMaxConsumers() throws Exception {
final String queueName = "updateQueue";
final SimpleString queueNameString = new SimpleString(queueName);
final String addressName = "address";
final SimpleString addressSimpleString = new SimpleString(addressName);
final int oldMaxConsumers = 2;
final RoutingType oldRoutingType = RoutingType.MULTICAST;
final boolean oldPurgeOnNoConsumers = false;
final AddressInfo addressInfo = new AddressInfo(addressSimpleString, oldRoutingType);
server.addAddressInfo(addressInfo);
server.createQueue(new QueueConfiguration(queueNameString).setAddress(addressSimpleString).setRoutingType(oldRoutingType).setMaxConsumers(oldMaxConsumers).setPurgeOnNoConsumers(oldPurgeOnNoConsumers).setAutoCreateAddress(false));
server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer());
server.locateQueue(queueNameString).addConsumer(new DummyServerConsumer());
final int newMaxConsumers = 1;
final UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName);
updateQueue.setMaxConsumers(newMaxConsumers);
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateQueue, "AMQ229210");
final QueueQueryResult queueQueryResult = server.queueQuery(queueNameString);
assertEquals("maxConsumers", oldMaxConsumers, queueQueryResult.getMaxConsumers());
}
@Test
public void testUpdateCoreQueueDoesNotExist() throws Exception {
SimpleString queueName = new SimpleString("updateQueue");
UpdateQueue updateQueue = new UpdateQueue();
updateQueue.setName(queueName.toString());
updateQueue.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(updateQueue, "AMQ229017: Queue " + queueName + " does not exist");
assertFalse(server.queueQuery(queueName).isExists());
}
@Test
public void testPurgeQueue() throws Exception {
SimpleString queueName = new SimpleString("purgeQueue");
CreateQueue command = new CreateQueue();
command.setName(queueName.toString());
command.setAutoCreateAddress(true);
command.setAnycast(true);
command.execute(new ActionContext());
PurgeQueue purge = new PurgeQueue();
purge.setName(queueName.toString());
purge.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionPassed(purge);
}
@Test
public void testPurgeQueueDoesNotExist() throws Exception {
SimpleString queueName = new SimpleString("purgeQueue");
PurgeQueue purge = new PurgeQueue();
purge.setName(queueName.toString());
purge.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
checkExecutionFailure(purge, "AMQ229067: Cannot find resource with name queue." + queueName);
assertFalse(server.queueQuery(queueName).isExists());
}
private void checkExecutionPassed(ConnectionAbstract command) throws Exception {
String fullMessage = output.toString();
logger.debug("output: {}", fullMessage);
assertTrue(fullMessage, fullMessage.contains("successfully"));
}
private void checkExecutionFailure(ConnectionAbstract command, String message) throws Exception {
String fullMessage = error.toString();
logger.debug("error: {}", fullMessage);
assertTrue(fullMessage, fullMessage.contains(message));
}
}
| 17,177 | 0.743552 | 0.73872 | 396 | 42.376263 | 34.387238 | 235 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.828283 | false | false | 13 |
18022bb9a132476d777db1de7a81a5efd21646c5 | 27,530,740,433,184 | 0076adea8c02f0b2500ee7e6914ad12dd33ae8e6 | /src/main/java/com/wxservice/framework/report/ReportManager.java | c828c9b1801006da80c5ae4c383676c44392c7dd | [] | no_license | 116518135/Wxservice | https://github.com/116518135/Wxservice | 14ea7ccee1cc1e1aff499083eddb142aef0108ca | d102528f41d2c530285742174c5f5671291bc905 | refs/heads/master | 2021-01-20T06:27:43.349000 | 2015-06-24T23:51:34 | 2015-06-24T23:51:34 | 37,895,352 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wxservice.framework.report;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import com.wxservice.database.po.report.Trpreport;
import com.wxservice.framework.components.online.UserInfoTool;
import com.wxservice.framework.engine.BaseEngine;
import com.wxservice.framework.engine.support.SysConfig;
import com.wxservice.framework.report.base.ReportConfig;
import com.wxservice.framework.report.base.ReportRequest;
import com.wxservice.framework.report.core.ConditionProcess;
import com.wxservice.framework.report.core.IExport;
import com.wxservice.framework.report.util.ReportUtil;
import com.wxservice.framework.util.DateUtil;
import com.wxservice.framework.util.StringUtil;
import com.wxservice.framework.util.SysFinal;
import com.wxservice.framework.util.SystemLogger;
import com.wxservice.framework.util.WebUtil;
import com.wxservice.framework.web.action.ActionContext;
import com.wxservice.framework.web.action.IStrutsForward;
import com.wxservice.framework.web.action.support.DownloadForward;
import com.wxservice.framework.web.session.ClientSession;
import com.wxservice.web.form.report.ReportForm;
public class ReportManager extends BaseEngine {
ConditionProcess conditionProcess = null;
public ReportManager() {
super();
}
public void createSession(ActionContext context) {
ClientSession client = null;
ReportForm form = (ReportForm) context.getForm();
if (client == null && checkProxyFlag()&&StringUtil.isNotBlank(form.getServer_url())) {
client = form.getClient();
HttpSession session = context.getRequest().getSession(true);
client.setSessionid(session.getId());
session.setAttribute(SysFinal.CLIENT_SESSION, client);
UserInfoTool.addOnlineUser(client);
}
}
public boolean checkProxyFlag() {
if (serviceConfig.getBooleanConfig("sws.report.proxyflag", true)) {
return true;
}
return false;
}
// 进入工具页面
public IStrutsForward condition(ActionContext context) {
processCondition(context);
return this.forwardJsp("condition");
}
public void processCondition(ActionContext context) {
token.saveToken(context.getRequest());// 生成令牌
ReportForm form = (ReportForm) context.getForm();
try {
Trpreport rp = ReportUtil.getReport(dao, form.getReportid());
if (checkProxyFlag()) {
ClientSession client = WebUtil.getClientSession(context
.getRequest());
form.setClient(client);
String report_server = SysConfig
.getStringConfig("sws.report.server");
if (StringUtil.isNotBlank(report_server)) {
form.setServer_url(report_server);
}
if (StringUtil.isNotBlank(rp.getServerurl())) {
form.setServer_url(rp.getServerurl());
}
}
ReportConfig rc = null;
if (!ReportUtil.existsReportConfig(rp.getCode(), form)) {// 判断编译后的文件存不存在
rc = ReportUtil.createReportConfig(dao, rp);// 重新编译,加载
ReportUtil.saveReportConfig(rc, form);
} else {
rc = ReportUtil.loader(rp.getCode(), form);
}
if (StringUtils.isNotBlank(rc.getReport().getProcessclass())) {
form.setService(rc.getReport().getProcessclass());
}
String condition = conditionProcess.toHtml(rc, context);
form.setCondition(condition);
} catch (Exception e) {
SystemLogger.error("进入报表查询页面发生错误", e);
}
}
// 进入工具页面
public IStrutsForward debugcondition(ActionContext context) {
processCondition(context);
return this.forwardJsp("debugcondition");
}
public IStrutsForward xsl(ActionContext context) {
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
this.createSession(context);
initQuery(context, form, rr);
Trpreport rp = rr.getRc().getReport();
if (!this.xslEx(context, rr)) {
return this.forwardJsp("reporterror");
}
IExport export = this.getXslExport(form, context);
byte[] bytes = (byte[]) export.export(rr);
IStrutsForward forward = null;
if (rr.getRarFlag() == 1) {
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ ".rar", context);
} else {
// forward = new ExcelForward(bytes);
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ "/" + rr.getVars().get("$billno") + ".xls", context);
}
rr.release();
rr = null;
return forward;
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public IStrutsForward printErrorMsg(String messgae, Exception e,
ReportRequest rr, ReportForm form) {
StringBuffer msg = new StringBuffer();
msg.append(messgae);
msg.append("[报表编号为:");
if (rr != null && rr.getRc() != null && rr.getRc().getReport() != null) {
msg.append(rr.getRc().getReport().getCode());
}
msg.append("]");
msg.append(e.getMessage());
SystemLogger.error(msg.toString(), e);
form.setHtmlContent(msg.toString());// 将错误系统打印前台
return this.forwardJsp("error");
}
public IStrutsForward cacheXsl(ActionContext context) {
token.saveToken(context.getRequest());// 生成令牌
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
initQuery(context, form, rr);
Trpreport rp = rr.getRc().getReport();
IExport export = this.getXslExport(form, context);
byte[] bytes = (byte[]) export.cache(rr);
IStrutsForward forward = null;
if (rr.getRarFlag() == 1) {
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ ".rar", context);
} else {
// forward = new ExcelForward(bytes);
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ ".xls", context);
}
return forward;
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
protected IExport getXslExport(ReportForm form, ActionContext context)
throws IOException {
IExport o = (IExport) WebUtil.getBean("xslExport", context.getForm());
return o;
}
public IStrutsForward forword(String processor) {
if (ReportUtil.display_dcube.equals(processor)) {
return this.forwardJsp("dcube");
}
if (ReportUtil.display_dhskudcube.equals(processor)) {
return this.forwardJsp("dhskudcube");
} else {
return this.forwardJsp("html");
}
}
protected IExport getExport(ReportRequest rr, ActionContext context)
throws IOException {
IExport o = null;
String processor = rr.getRc().getReport().getDispprocessor();
if (ReportUtil.display_dcube.equals(processor)
|| ReportUtil.display_dhskudcube.equals(processor)) {
o = (IExport) WebUtil.getBean("dcubeExport", context.getForm());
} else {
o = (IExport) WebUtil.getBean("htmlExport", context.getForm());
}
return o;
}
public IStrutsForward html(ActionContext context) {
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
this.createSession(context);
initQuery(context, form, rr);
if (!this.htmlEx(context, rr)) {
return this.forwardJsp("reporterror");
}
IExport export = this.getExport(rr, context);
String content = (String) export.export(rr);
form.setHtmlContent(content);
form.setModuleTitle(rr.getRc().getReport().getName());
String displayprocessor = rr.getRc().getReport().getDispprocessor();
rr.release();
rr = null;
return forword(displayprocessor);
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public IStrutsForward debughtml(ActionContext context) {
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
this.createSession(context);
initQuery(context, form, rr);
if (!this.htmlEx(context, rr)) {
return this.forwardJsp("reporterror");
}
IExport export = this.getExport(rr, context);
String content = (String) export.export(rr);
if (rr.getErrormap().get("sqlerror") != null) {
String sqlerror = rr.getErrormap().get("sqlerror").toString();
sqlerror = sqlerror.replaceAll(",", ",<br>");
form.setHtmlContent(sqlerror);//
form.setModuleTitle(rr.getRc().getReport().getName());
return this.forwardJsp("sqlerror");
}
form.setHtmlContent(content);
form.setModuleTitle(rr.getRc().getReport().getName());
String displayprocessor = rr.getRc().getReport().getDispprocessor();
rr.release();
rr = null;
return forword(displayprocessor);
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public IStrutsForward cacheHtml(ActionContext context) {
token.saveToken(context.getRequest());// 生成令牌
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
initQuery(context, form, rr);
IExport export = this.getExport(rr, context);
String content = (String) export.cache(rr);
form.setHtmlContent(content);
form.setModuleTitle(rr.getRc().getReport().getName());
String displayprocessor = rr.getRc().getReport().getDispprocessor();
rr.release();
rr = null;
return forword(displayprocessor);
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public void initQuery(ActionContext context, ReportForm form,
ReportRequest rr) {
ReportConfig rc = ReportUtil.loader(form.getReportid(), form);
rr.setContext(context);
rr.setRc(rc);
rr.setDao(dao);
setPublicVariable(rr, rc);
}
protected void setPublicVariable(ReportRequest rr, ReportConfig rc) {
rr.setAttribute("$title", rc.getReport().getName());
ClientSession client = WebUtil.getClientSession(rr.getContext()
.getRequest());
if(client.getCmpid()!=null)
rr.setAttribute("$cmpid", client.getCmpid().toString());
rr.setAttribute("$cmpname", client.getCmpname());
rr.setAttribute("$username", client.getUsername());
rr.setAttribute("$usercode", client.getUsercode());
rr.setAttribute("$today", DateUtil.formatDetailDate(new Date()));
}
public ConditionProcess getConditionProcess() {
return conditionProcess;
}
public void setConditionProcess(ConditionProcess conditionProcess) {
this.conditionProcess = conditionProcess;
}
public boolean htmlEx(ActionContext context, ReportRequest rr) {
return true;
}
public boolean xslEx(ActionContext context, ReportRequest rr) {
return true;
}
} | UTF-8 | Java | 10,886 | java | ReportManager.java | Java | [] | null | [] | package com.wxservice.framework.report;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import com.wxservice.database.po.report.Trpreport;
import com.wxservice.framework.components.online.UserInfoTool;
import com.wxservice.framework.engine.BaseEngine;
import com.wxservice.framework.engine.support.SysConfig;
import com.wxservice.framework.report.base.ReportConfig;
import com.wxservice.framework.report.base.ReportRequest;
import com.wxservice.framework.report.core.ConditionProcess;
import com.wxservice.framework.report.core.IExport;
import com.wxservice.framework.report.util.ReportUtil;
import com.wxservice.framework.util.DateUtil;
import com.wxservice.framework.util.StringUtil;
import com.wxservice.framework.util.SysFinal;
import com.wxservice.framework.util.SystemLogger;
import com.wxservice.framework.util.WebUtil;
import com.wxservice.framework.web.action.ActionContext;
import com.wxservice.framework.web.action.IStrutsForward;
import com.wxservice.framework.web.action.support.DownloadForward;
import com.wxservice.framework.web.session.ClientSession;
import com.wxservice.web.form.report.ReportForm;
public class ReportManager extends BaseEngine {
ConditionProcess conditionProcess = null;
public ReportManager() {
super();
}
public void createSession(ActionContext context) {
ClientSession client = null;
ReportForm form = (ReportForm) context.getForm();
if (client == null && checkProxyFlag()&&StringUtil.isNotBlank(form.getServer_url())) {
client = form.getClient();
HttpSession session = context.getRequest().getSession(true);
client.setSessionid(session.getId());
session.setAttribute(SysFinal.CLIENT_SESSION, client);
UserInfoTool.addOnlineUser(client);
}
}
public boolean checkProxyFlag() {
if (serviceConfig.getBooleanConfig("sws.report.proxyflag", true)) {
return true;
}
return false;
}
// 进入工具页面
public IStrutsForward condition(ActionContext context) {
processCondition(context);
return this.forwardJsp("condition");
}
public void processCondition(ActionContext context) {
token.saveToken(context.getRequest());// 生成令牌
ReportForm form = (ReportForm) context.getForm();
try {
Trpreport rp = ReportUtil.getReport(dao, form.getReportid());
if (checkProxyFlag()) {
ClientSession client = WebUtil.getClientSession(context
.getRequest());
form.setClient(client);
String report_server = SysConfig
.getStringConfig("sws.report.server");
if (StringUtil.isNotBlank(report_server)) {
form.setServer_url(report_server);
}
if (StringUtil.isNotBlank(rp.getServerurl())) {
form.setServer_url(rp.getServerurl());
}
}
ReportConfig rc = null;
if (!ReportUtil.existsReportConfig(rp.getCode(), form)) {// 判断编译后的文件存不存在
rc = ReportUtil.createReportConfig(dao, rp);// 重新编译,加载
ReportUtil.saveReportConfig(rc, form);
} else {
rc = ReportUtil.loader(rp.getCode(), form);
}
if (StringUtils.isNotBlank(rc.getReport().getProcessclass())) {
form.setService(rc.getReport().getProcessclass());
}
String condition = conditionProcess.toHtml(rc, context);
form.setCondition(condition);
} catch (Exception e) {
SystemLogger.error("进入报表查询页面发生错误", e);
}
}
// 进入工具页面
public IStrutsForward debugcondition(ActionContext context) {
processCondition(context);
return this.forwardJsp("debugcondition");
}
public IStrutsForward xsl(ActionContext context) {
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
this.createSession(context);
initQuery(context, form, rr);
Trpreport rp = rr.getRc().getReport();
if (!this.xslEx(context, rr)) {
return this.forwardJsp("reporterror");
}
IExport export = this.getXslExport(form, context);
byte[] bytes = (byte[]) export.export(rr);
IStrutsForward forward = null;
if (rr.getRarFlag() == 1) {
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ ".rar", context);
} else {
// forward = new ExcelForward(bytes);
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ "/" + rr.getVars().get("$billno") + ".xls", context);
}
rr.release();
rr = null;
return forward;
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public IStrutsForward printErrorMsg(String messgae, Exception e,
ReportRequest rr, ReportForm form) {
StringBuffer msg = new StringBuffer();
msg.append(messgae);
msg.append("[报表编号为:");
if (rr != null && rr.getRc() != null && rr.getRc().getReport() != null) {
msg.append(rr.getRc().getReport().getCode());
}
msg.append("]");
msg.append(e.getMessage());
SystemLogger.error(msg.toString(), e);
form.setHtmlContent(msg.toString());// 将错误系统打印前台
return this.forwardJsp("error");
}
public IStrutsForward cacheXsl(ActionContext context) {
token.saveToken(context.getRequest());// 生成令牌
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
initQuery(context, form, rr);
Trpreport rp = rr.getRc().getReport();
IExport export = this.getXslExport(form, context);
byte[] bytes = (byte[]) export.cache(rr);
IStrutsForward forward = null;
if (rr.getRarFlag() == 1) {
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ ".rar", context);
} else {
// forward = new ExcelForward(bytes);
forward = new DownloadForward(bytes);
((DownloadForward) forward).setDownloadFile("_" + rp.getName()
+ ".xls", context);
}
return forward;
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
protected IExport getXslExport(ReportForm form, ActionContext context)
throws IOException {
IExport o = (IExport) WebUtil.getBean("xslExport", context.getForm());
return o;
}
public IStrutsForward forword(String processor) {
if (ReportUtil.display_dcube.equals(processor)) {
return this.forwardJsp("dcube");
}
if (ReportUtil.display_dhskudcube.equals(processor)) {
return this.forwardJsp("dhskudcube");
} else {
return this.forwardJsp("html");
}
}
protected IExport getExport(ReportRequest rr, ActionContext context)
throws IOException {
IExport o = null;
String processor = rr.getRc().getReport().getDispprocessor();
if (ReportUtil.display_dcube.equals(processor)
|| ReportUtil.display_dhskudcube.equals(processor)) {
o = (IExport) WebUtil.getBean("dcubeExport", context.getForm());
} else {
o = (IExport) WebUtil.getBean("htmlExport", context.getForm());
}
return o;
}
public IStrutsForward html(ActionContext context) {
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
this.createSession(context);
initQuery(context, form, rr);
if (!this.htmlEx(context, rr)) {
return this.forwardJsp("reporterror");
}
IExport export = this.getExport(rr, context);
String content = (String) export.export(rr);
form.setHtmlContent(content);
form.setModuleTitle(rr.getRc().getReport().getName());
String displayprocessor = rr.getRc().getReport().getDispprocessor();
rr.release();
rr = null;
return forword(displayprocessor);
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public IStrutsForward debughtml(ActionContext context) {
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
this.createSession(context);
initQuery(context, form, rr);
if (!this.htmlEx(context, rr)) {
return this.forwardJsp("reporterror");
}
IExport export = this.getExport(rr, context);
String content = (String) export.export(rr);
if (rr.getErrormap().get("sqlerror") != null) {
String sqlerror = rr.getErrormap().get("sqlerror").toString();
sqlerror = sqlerror.replaceAll(",", ",<br>");
form.setHtmlContent(sqlerror);//
form.setModuleTitle(rr.getRc().getReport().getName());
return this.forwardJsp("sqlerror");
}
form.setHtmlContent(content);
form.setModuleTitle(rr.getRc().getReport().getName());
String displayprocessor = rr.getRc().getReport().getDispprocessor();
rr.release();
rr = null;
return forword(displayprocessor);
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public IStrutsForward cacheHtml(ActionContext context) {
token.saveToken(context.getRequest());// 生成令牌
ReportForm form = (ReportForm) context.getForm();
ReportRequest rr = new ReportRequest();
try {
initQuery(context, form, rr);
IExport export = this.getExport(rr, context);
String content = (String) export.cache(rr);
form.setHtmlContent(content);
form.setModuleTitle(rr.getRc().getReport().getName());
String displayprocessor = rr.getRc().getReport().getDispprocessor();
rr.release();
rr = null;
return forword(displayprocessor);
} catch (Exception e) {
return printErrorMsg("查询报表发生错误!", e, rr, form);
}
}
public void initQuery(ActionContext context, ReportForm form,
ReportRequest rr) {
ReportConfig rc = ReportUtil.loader(form.getReportid(), form);
rr.setContext(context);
rr.setRc(rc);
rr.setDao(dao);
setPublicVariable(rr, rc);
}
protected void setPublicVariable(ReportRequest rr, ReportConfig rc) {
rr.setAttribute("$title", rc.getReport().getName());
ClientSession client = WebUtil.getClientSession(rr.getContext()
.getRequest());
if(client.getCmpid()!=null)
rr.setAttribute("$cmpid", client.getCmpid().toString());
rr.setAttribute("$cmpname", client.getCmpname());
rr.setAttribute("$username", client.getUsername());
rr.setAttribute("$usercode", client.getUsercode());
rr.setAttribute("$today", DateUtil.formatDetailDate(new Date()));
}
public ConditionProcess getConditionProcess() {
return conditionProcess;
}
public void setConditionProcess(ConditionProcess conditionProcess) {
this.conditionProcess = conditionProcess;
}
public boolean htmlEx(ActionContext context, ReportRequest rr) {
return true;
}
public boolean xslEx(ActionContext context, ReportRequest rr) {
return true;
}
} | 10,886 | 0.689128 | 0.688941 | 329 | 30.437691 | 23.097847 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.735562 | false | false | 13 |
ee8ed0f763b6d20dd0cb2d9791cc77a3b6bdb925 | 3,839,700,830,843 | 6633abf9ec9db78436b59f042818e0309a8deea3 | /springboot-mybatis_plus/src/main/java/com/wyu/admin/mapper/ElectiveStudentMapper.java | 90a499687a4470df07c3d5b93e4db2fd4b2500c4 | [] | no_license | ZzzLJ/SpringBoot-Learning | https://github.com/ZzzLJ/SpringBoot-Learning | 80b22fa873047b65784afaab59403903826aa01a | 41ff0392a7c135536326a5a13c7fa7f890aa31a6 | refs/heads/master | 2020-04-11T21:00:10.012000 | 2019-03-06T06:06:07 | 2019-03-06T06:06:07 | 158,809,177 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wyu.admin.mapper;
import com.wyu.admin.po.ElectiveStudent;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @author ZzzLJ
* @Description
*/
@Repository
public interface ElectiveStudentMapper extends BaseMapper<ElectiveStudent> {
}
| UTF-8 | Java | 312 | java | ElectiveStudentMapper.java | Java | [
{
"context": "ngframework.stereotype.Repository;\n\n/**\n * @author ZzzLJ\n * @Description\n */\n@Repository\npublic interface ",
"end": 199,
"score": 0.9997222423553467,
"start": 194,
"tag": "USERNAME",
"value": "ZzzLJ"
}
] | null | [] | package com.wyu.admin.mapper;
import com.wyu.admin.po.ElectiveStudent;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* @author ZzzLJ
* @Description
*/
@Repository
public interface ElectiveStudentMapper extends BaseMapper<ElectiveStudent> {
}
| 312 | 0.801282 | 0.801282 | 14 | 21.285715 | 23.786036 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 13 |
c6f7e8fb90b0b770a2837e4cd58fd7f5e8cdab01 | 30,219,389,906,253 | 2cccc2d4d631e78ef34879a60fda120459563342 | /common_item/src/main/java/com/item/service/ItemParamService.java | e3c597fbf470cc262ade61713c12228aa35106ff | [] | no_license | Arivons/shop | https://github.com/Arivons/shop | 7cced24f1484dbcbe18ef488d8830f2af24b0790 | 562529922bb0221a9b211dc62f416dd5edafef70 | refs/heads/master | 2022-12-11T06:38:06.493000 | 2019-09-24T12:01:29 | 2019-09-24T12:01:29 | 210,598,530 | 0 | 0 | null | false | 2022-12-06T00:32:46 | 2019-09-24T12:33:34 | 2019-09-24T12:37:11 | 2022-12-06T00:32:45 | 109 | 0 | 0 | 3 | Java | false | false | package com.item.service;
import com.common.utils.PageResult;
import com.pojo.TbItemParam;
/**
* 商品规格参数模板Service
*/
public interface ItemParamService {
/**
* 查询商品规格参数类目模板
* @param itemCatId
* @return
*/
TbItemParam selectItemParamByItemCatId(Long itemCatId);
/**
* 查询所有商品规格参数模板并分页
* @return
*/
PageResult selectItemParamAll(Integer page,Integer rows);
/**
* 添加商品规格参数模板
* @param tbItemParam
* @return
*/
Integer insertItemParam(TbItemParam tbItemParam);
/**
* 删除商品规格参数模板
* @param id
* @return
*/
Integer deleteItemParamById(Long id);
}
| UTF-8 | Java | 758 | java | ItemParamService.java | Java | [] | null | [] | package com.item.service;
import com.common.utils.PageResult;
import com.pojo.TbItemParam;
/**
* 商品规格参数模板Service
*/
public interface ItemParamService {
/**
* 查询商品规格参数类目模板
* @param itemCatId
* @return
*/
TbItemParam selectItemParamByItemCatId(Long itemCatId);
/**
* 查询所有商品规格参数模板并分页
* @return
*/
PageResult selectItemParamAll(Integer page,Integer rows);
/**
* 添加商品规格参数模板
* @param tbItemParam
* @return
*/
Integer insertItemParam(TbItemParam tbItemParam);
/**
* 删除商品规格参数模板
* @param id
* @return
*/
Integer deleteItemParamById(Long id);
}
| 758 | 0.625 | 0.625 | 35 | 17.514286 | 16.183538 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.228571 | false | false | 13 |
7399b0521ad7ab262731214c7093c6d40a988ff6 | 11,467,562,715,288 | 932cf25489958711bedb531e5089252aeeb6af39 | /src/main/java/hairsalon/repository/DesignerDao_Oracle.java | f027bea0a5f956597ce4e56ff0aa961e9f7b7beb | [] | no_license | ReindeerG/pf_hairsalon | https://github.com/ReindeerG/pf_hairsalon | 844f0dc99241b4b6c0e954dca0118ec0a61333af | a601dc8fcad75fdced7e19ce555853638811f62b | refs/heads/master | 2022-04-30T13:46:11.456000 | 2019-05-23T02:56:36 | 2019-05-23T02:56:36 | 188,150,484 | 0 | 0 | null | false | 2022-03-31T21:14:13 | 2019-05-23T02:54:00 | 2019-05-23T02:56:45 | 2022-03-31T21:14:13 | 10,569 | 0 | 0 | 4 | JavaScript | false | false | package hairsalon.repository;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import hairsalon.entity.CustomerDto;
import hairsalon.entity.DesignDto;
import hairsalon.entity.DesignerDto;
@Repository("designerDao")
public class DesignerDao_Oracle implements DesignerDao {
@Autowired
private SqlSession sqlSession;
public int nextval() {
return sqlSession.selectOne("db_designer.nextval");
}
public int insert(DesignerDto designerDto) {
return sqlSession.insert("db_designer.insert", designerDto);
}
public List<DesignerDto> getAllList() {
return sqlSession.selectList("db_designer.alllist");
}
public List<DesignerDto> getSearchList(DesignerDto designerDto) {
return sqlSession.selectList("db_designer.list_search",designerDto);
}
public List<DesignerDto> getOnList() {
return sqlSession.selectList("db_designer.onlist");
}
public DesignerDto getOne(int no) {
return sqlSession.selectOne("db_designer.getone",no);
}
public int modify(DesignerDto designerDto) {
return sqlSession.update("db_designer.modify", designerDto);
}
public int picChange(DesignerDto designerDto) {
return sqlSession.update("db_designer.picchange", designerDto);
}
public int delete(int no) {
return sqlSession.delete("db_designer.delete", no);
}
public int designcount(int no) {
return sqlSession.update("db_designer.designcount",no);
}
public int toVacation(int no) {
return sqlSession.update("db_designer.tovacation", no);
}
public int toWorkAll() {
return sqlSession.update("db_designer.toworkall");
}
public int restore() {
sqlSession.update("db_designer.restore1");
return sqlSession.update("db_designer.restore2");
}
} | UTF-8 | Java | 1,815 | java | DesignerDao_Oracle.java | Java | [] | null | [] | package hairsalon.repository;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import hairsalon.entity.CustomerDto;
import hairsalon.entity.DesignDto;
import hairsalon.entity.DesignerDto;
@Repository("designerDao")
public class DesignerDao_Oracle implements DesignerDao {
@Autowired
private SqlSession sqlSession;
public int nextval() {
return sqlSession.selectOne("db_designer.nextval");
}
public int insert(DesignerDto designerDto) {
return sqlSession.insert("db_designer.insert", designerDto);
}
public List<DesignerDto> getAllList() {
return sqlSession.selectList("db_designer.alllist");
}
public List<DesignerDto> getSearchList(DesignerDto designerDto) {
return sqlSession.selectList("db_designer.list_search",designerDto);
}
public List<DesignerDto> getOnList() {
return sqlSession.selectList("db_designer.onlist");
}
public DesignerDto getOne(int no) {
return sqlSession.selectOne("db_designer.getone",no);
}
public int modify(DesignerDto designerDto) {
return sqlSession.update("db_designer.modify", designerDto);
}
public int picChange(DesignerDto designerDto) {
return sqlSession.update("db_designer.picchange", designerDto);
}
public int delete(int no) {
return sqlSession.delete("db_designer.delete", no);
}
public int designcount(int no) {
return sqlSession.update("db_designer.designcount",no);
}
public int toVacation(int no) {
return sqlSession.update("db_designer.tovacation", no);
}
public int toWorkAll() {
return sqlSession.update("db_designer.toworkall");
}
public int restore() {
sqlSession.update("db_designer.restore1");
return sqlSession.update("db_designer.restore2");
}
} | 1,815 | 0.760331 | 0.759229 | 70 | 24.942858 | 23.691401 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.414286 | false | false | 13 |
ffbae4d047b8462b9af1fe94d626545e87a18bf3 | 1,589,137,910,407 | 4b9596197948b0b5045b18365f24e6d566a49d60 | /dhis2-android-app/src/main/java/org/dhis2/mobile/io/models/interpretation/InterpretationOrganizationUnit.java | 717468c44b7defe08cd9cdee9af1ba107228940c | [
"BSD-3-Clause"
] | permissive | winhtaikaung/dhis2-android | https://github.com/winhtaikaung/dhis2-android | 1887a279bd25f562e4ab7a1f203f0e72c73c8d57 | 9fbe2c938715a09f379ac2d06e273e143ab73726 | refs/heads/master | 2016-08-04T14:40:52.613000 | 2014-12-30T19:21:14 | 2014-12-30T19:21:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.dhis2.mobile.io.models.interpretation;
import org.dhis2.mobile.io.models.dashboard.BaseIdentifiableObject;
public class InterpretationOrganizationUnit extends BaseIdentifiableObject {
private String code;
private String name;
private String displayName;
private boolean externalAccess;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public boolean isExternalAccess() {
return externalAccess;
}
public void setExternalAccess(boolean externalAccess) {
this.externalAccess = externalAccess;
}
}
| UTF-8 | Java | 983 | java | InterpretationOrganizationUnit.java | Java | [] | null | [] | package org.dhis2.mobile.io.models.interpretation;
import org.dhis2.mobile.io.models.dashboard.BaseIdentifiableObject;
public class InterpretationOrganizationUnit extends BaseIdentifiableObject {
private String code;
private String name;
private String displayName;
private boolean externalAccess;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public boolean isExternalAccess() {
return externalAccess;
}
public void setExternalAccess(boolean externalAccess) {
this.externalAccess = externalAccess;
}
}
| 983 | 0.643947 | 0.641913 | 42 | 21.404762 | 20.620216 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
5909ef855950f22dbba5f060835684c051f141c9 | 14,328,010,905,043 | 854cecb47e00d807a4b1f803a82b024ff8f58f4b | /src/main/java/com/amazonaws/services/simpleworkflow/flow/worker/GenericWorker.java | 726ec976a553e37040fad086051c51ec4895c758 | [
"Apache-2.0"
] | permissive | wse/aws-swf-flow-library | https://github.com/wse/aws-swf-flow-library | 2febfdafcbcf9d6213522a4c8a5122e0c092d9aa | b2fee40ca289f6cd882b3289d65795d10f0b092b | refs/heads/master | 2023-01-02T20:14:08.236000 | 2020-10-19T18:21:11 | 2020-10-19T18:21:11 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.simpleworkflow.flow.worker;
import java.lang.Thread.UncaughtExceptionHandler;
import java.lang.management.ManagementFactory;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow;
import com.amazonaws.services.simpleworkflow.flow.WorkerBase;
import com.amazonaws.services.simpleworkflow.flow.common.FlowConstants;
import com.amazonaws.services.simpleworkflow.model.DomainAlreadyExistsException;
import com.amazonaws.services.simpleworkflow.model.RegisterDomainRequest;
public abstract class GenericWorker<T> implements WorkerBase {
class ExecutorThreadFactory implements ThreadFactory {
private AtomicInteger threadIndex = new AtomicInteger();
private final String threadPrefix;
public ExecutorThreadFactory(String threadPrefix) {
this.threadPrefix = threadPrefix;
}
@Override
public Thread newThread(Runnable r) {
Thread result = new Thread(r);
result.setName(threadPrefix + (threadIndex.incrementAndGet()));
result.setUncaughtExceptionHandler(uncaughtExceptionHandler);
return result;
}
}
private class PollingTask implements Runnable {
private final TaskPoller<T> poller;
PollingTask(final TaskPoller poller) {
this.poller = poller;
}
@Override
public void run() {
try {
while(true) {
log.debug("poll task begin");
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
final int availableWorkers = workerExecutor.getMaximumPoolSize() - workerExecutor.getActiveCount();
if (availableWorkers < 1) {
log.debug("no available workers");
return;
}
pollBackoffThrottler.throttle();
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
if (pollRateThrottler != null) {
pollRateThrottler.throttle();
}
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
T task = poller.poll();
if (task == null) {
log.debug("no work returned");
return;
}
workerExecutor.execute(new ExecuteTask(poller, task));
log.debug("poll task end");
}
} catch (final Throwable e) {
pollBackoffThrottler.failure();
if (!(e.getCause() instanceof InterruptedException)) {
uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), e);
}
}
}
}
private class ExecuteTask implements Runnable {
private final TaskPoller<T> poller;
private final T task;
ExecuteTask(final TaskPoller poller, final T task) {
this.poller = poller;
this.task = task;
}
@Override
public void run() {
try {
log.debug("execute task begin");
poller.execute(task);
pollBackoffThrottler.success();
log.debug("execute task end");
} catch (Throwable e) {
pollBackoffThrottler.failure();
if (!(e.getCause() instanceof InterruptedException)) {
uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), e);
}
}
}
}
private static final Log log = LogFactory.getLog(GenericWorker.class);
protected static final int MAX_IDENTITY_LENGTH = 256;
protected AmazonSimpleWorkflow service;
protected String domain;
protected boolean registerDomain;
protected long domainRetentionPeriodInDays = FlowConstants.NONE;
private String taskListToPoll;
private int maximumPollRateIntervalMilliseconds = 1000;
private double maximumPollRatePerSecond;
private double pollBackoffCoefficient = 2;
private long pollBackoffInitialInterval = 100;
private long pollBackoffMaximumInterval = 60000;
private boolean disableTypeRegistrationOnStart;
private boolean disableServiceShutdownOnStop;
private boolean suspended;
private final AtomicBoolean startRequested = new AtomicBoolean();
private final AtomicBoolean shutdownRequested = new AtomicBoolean();
private ScheduledExecutorService pollingExecutor;
private ThreadPoolExecutor workerExecutor;
private String identity = ManagementFactory.getRuntimeMXBean().getName();
private int pollThreadCount = 1;
private int executeThreadCount = 1;
private BackoffThrottler pollBackoffThrottler;
private Throttler pollRateThrottler;
protected UncaughtExceptionHandler uncaughtExceptionHandler = new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
log.error("Failure in thread " + t.getName(), e);
}
};
private TaskPoller poller;
public GenericWorker(AmazonSimpleWorkflow service, String domain, String taskListToPoll) {
this.service = service;
this.domain = domain;
this.taskListToPoll = taskListToPoll;
}
public GenericWorker() {
identity = ManagementFactory.getRuntimeMXBean().getName();
int length = Math.min(identity.length(), GenericWorker.MAX_IDENTITY_LENGTH);
identity = identity.substring(0, length);
}
@Override
public AmazonSimpleWorkflow getService() {
return service;
}
public void setService(AmazonSimpleWorkflow service) {
this.service = service;
}
@Override
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
@Override
public boolean isRegisterDomain() {
return registerDomain;
}
/**
* Should domain be registered on startup. Default is <code>false</code>.
* When enabled {@link #setDomainRetentionPeriodInDays(long)} property is
* required.
*/
@Override
public void setRegisterDomain(boolean registerDomain) {
this.registerDomain = registerDomain;
}
@Override
public long getDomainRetentionPeriodInDays() {
return domainRetentionPeriodInDays;
}
@Override
public void setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays) {
this.domainRetentionPeriodInDays = domainRetentionPeriodInDays;
}
@Override
public String getTaskListToPoll() {
return taskListToPoll;
}
public void setTaskListToPoll(String taskListToPoll) {
this.taskListToPoll = taskListToPoll;
}
@Override
public double getMaximumPollRatePerSecond() {
return maximumPollRatePerSecond;
}
@Override
public void setMaximumPollRatePerSecond(double maximumPollRatePerSecond) {
this.maximumPollRatePerSecond = maximumPollRatePerSecond;
}
@Override
public int getMaximumPollRateIntervalMilliseconds() {
return maximumPollRateIntervalMilliseconds;
}
@Override
public void setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds) {
this.maximumPollRateIntervalMilliseconds = maximumPollRateIntervalMilliseconds;
}
@Override
public UncaughtExceptionHandler getUncaughtExceptionHandler() {
return uncaughtExceptionHandler;
}
@Override
public void setUncaughtExceptionHandler(UncaughtExceptionHandler uncaughtExceptionHandler) {
this.uncaughtExceptionHandler = uncaughtExceptionHandler;
}
@Override
public String getIdentity() {
return identity;
}
@Override
public void setIdentity(String identity) {
this.identity = identity;
}
@Override
public long getPollBackoffInitialInterval() {
return pollBackoffInitialInterval;
}
@Override
public void setPollBackoffInitialInterval(long backoffInitialInterval) {
if (backoffInitialInterval < 0) {
throw new IllegalArgumentException("expected value should be positive or 0: " + backoffInitialInterval);
}
this.pollBackoffInitialInterval = backoffInitialInterval;
}
@Override
public long getPollBackoffMaximumInterval() {
return pollBackoffMaximumInterval;
}
@Override
public void setPollBackoffMaximumInterval(long backoffMaximumInterval) {
if (backoffMaximumInterval <= 0) {
throw new IllegalArgumentException("expected value should be positive: " + backoffMaximumInterval);
}
this.pollBackoffMaximumInterval = backoffMaximumInterval;
}
/**
* @see #setDisableServiceShutdownOnStop(boolean)
*/
@Override
public boolean isDisableServiceShutdownOnStop() {
return disableServiceShutdownOnStop;
}
/**
* By default when @{link {@link #shutdown()} or @{link
* {@link #shutdownNow()} is called the worker calls
* {@link AmazonSimpleWorkflow#shutdown()} on the service instance it is
* configured with before shutting down internal thread pools. Otherwise
* threads that are waiting on a poll request might block shutdown for the
* duration of a poll. This flag allows disabling this behavior.
*
* @param disableServiceShutdownOnStop
* <code>true</code> means do not call
* {@link AmazonSimpleWorkflow#shutdown()}
*/
@Override
public void setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop) {
this.disableServiceShutdownOnStop = disableServiceShutdownOnStop;
}
@Override
public double getPollBackoffCoefficient() {
return pollBackoffCoefficient;
}
@Override
public void setPollBackoffCoefficient(double backoffCoefficient) {
if (backoffCoefficient < 1.0) {
throw new IllegalArgumentException("expected value should be bigger or equal to 1.0: " + backoffCoefficient);
}
this.pollBackoffCoefficient = backoffCoefficient;
}
@Override
public int getPollThreadCount() {
return pollThreadCount;
}
@Override
public void setPollThreadCount(int threadCount) {
checkStarted();
this.pollThreadCount = threadCount;
/*
It is actually not very useful to have poll thread count
larger than execute thread count. Since execute thread count
is a new concept introduced since Flow-3.7, to make the
major version upgrade more friendly, try to bring the
execute thread count to match poll thread count if client
does not the set execute thread count explicitly.
*/
if (this.executeThreadCount < threadCount) {
this.executeThreadCount = threadCount;
}
}
@Override
public int getExecuteThreadCount() {
return executeThreadCount;
}
@Override
public void setExecuteThreadCount(int threadCount) {
checkStarted();
this.executeThreadCount = threadCount;
}
@Override
public void setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart) {
this.disableTypeRegistrationOnStart = disableTypeRegistrationOnStart;
}
@Override
public boolean isDisableTypeRegistrationOnStart() {
return disableTypeRegistrationOnStart;
}
@Override
public void start() {
if (log.isInfoEnabled()) {
log.info("start: " + toString());
}
if (shutdownRequested.get()) {
throw new IllegalStateException("Shutdown Requested. Not restartable.");
}
if (!startRequested.compareAndSet(false, true)) {
return;
}
checkRequiredProperty(service, "service");
checkRequiredProperty(domain, "domain");
checkRequiredProperty(taskListToPoll, "taskListToPoll");
checkRequiredProperties();
if (registerDomain) {
registerDomain();
}
if (!disableTypeRegistrationOnStart) {
registerTypesToPoll();
}
if (maximumPollRatePerSecond > 0.0) {
pollRateThrottler = new Throttler("pollRateThrottler " + taskListToPoll, maximumPollRatePerSecond,
maximumPollRateIntervalMilliseconds);
}
poller = createPoller();
if (suspended) {
poller.suspend();
}
pollBackoffThrottler = new BackoffThrottler(pollBackoffInitialInterval, pollBackoffMaximumInterval,
pollBackoffCoefficient);
workerExecutor = new ThreadPoolExecutor(executeThreadCount, executeThreadCount, 1, TimeUnit.MINUTES,
new SynchronousQueue<>(), new BlockCallerPolicy());
ExecutorThreadFactory pollExecutorThreadFactory = getExecutorThreadFactory("Worker");
workerExecutor.setThreadFactory(pollExecutorThreadFactory);
pollingExecutor = new ScheduledThreadPoolExecutor(pollThreadCount, getExecutorThreadFactory("Poller"));
for (int i = 0; i < pollThreadCount; i++) {
pollingExecutor.scheduleWithFixedDelay(new PollingTask(poller), 0, 1, TimeUnit.SECONDS);
}
}
private ExecutorThreadFactory getExecutorThreadFactory(final String type) {
return new ExecutorThreadFactory(getPollThreadNamePrefix() + " " + type);
}
protected abstract String getPollThreadNamePrefix();
protected abstract TaskPoller<T> createPoller();
protected abstract void checkRequiredProperties();
private void registerDomain() {
if (domainRetentionPeriodInDays == FlowConstants.NONE) {
throw new IllegalStateException("required property domainRetentionPeriodInDays is not set");
}
try {
service.registerDomain(new RegisterDomainRequest().withName(domain).withWorkflowExecutionRetentionPeriodInDays(
String.valueOf(domainRetentionPeriodInDays)));
}
catch (DomainAlreadyExistsException e) {
if (log.isTraceEnabled()) {
log.trace("Domain is already registered: " + domain);
}
}
}
protected void checkRequiredProperty(Object value, String name) {
if (value == null) {
throw new IllegalStateException("required property " + name + " is not set");
}
}
protected void checkStarted() {
if (isStarted()) {
throw new IllegalStateException("started");
}
}
private boolean isStarted() {
return startRequested.get();
}
@Override
public void shutdown() {
if (log.isInfoEnabled()) {
log.info("shutdown");
}
if (!shutdownRequested.compareAndSet(false, true)) {
return;
}
if (!isStarted()) {
return;
}
if (!disableServiceShutdownOnStop) {
service.shutdown();
}
pollingExecutor.shutdown();
workerExecutor.shutdown();
}
@Override
public void shutdownNow() {
if (log.isInfoEnabled()) {
log.info("shutdownNow");
}
if (!shutdownRequested.compareAndSet(false, true)) {
return;
}
if (!isStarted()) {
return;
}
if (!disableServiceShutdownOnStop) {
service.shutdown();
}
pollingExecutor.shutdownNow();
workerExecutor.shutdownNow();
}
@Override
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
long start = System.currentTimeMillis();
boolean terminated = pollingExecutor.awaitTermination(timeout, unit);
long elapsed = System.currentTimeMillis() - start;
long left = TimeUnit.MILLISECONDS.convert(timeout, unit) - elapsed;
terminated &= workerExecutor.awaitTermination(left, TimeUnit.MILLISECONDS);
return terminated;
}
/**
* The graceful shutdown will wait for existing polls and tasks to complete
* unless the timeout is not enough. It does not shutdown the SWF client.
*/
@Override
public boolean gracefulShutdown(long timeout, TimeUnit unit) throws InterruptedException {
setDisableServiceShutdownOnStop(true);
return shutdownAndAwaitTermination(timeout, unit);
}
/**
* This method will also shutdown SWF client unless you {@link #setDisableServiceShutdownOnStop(boolean)} to <code>true</code>.
*/
@Override
public boolean shutdownAndAwaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
long timeoutMilliseconds = TimeUnit.MILLISECONDS.convert(timeout, unit);
long start = System.currentTimeMillis();
if (shutdownRequested.compareAndSet(false, true)) {
if (!isStarted()) {
return true;
}
if (!disableServiceShutdownOnStop) {
service.shutdown();
}
pollingExecutor.shutdown();
pollingExecutor.awaitTermination(timeout, unit);
workerExecutor.shutdown();
long elapsed = System.currentTimeMillis() - start;
long left = timeoutMilliseconds - elapsed;
workerExecutor.awaitTermination(left, unit);
}
long elapsed = System.currentTimeMillis() - start;
long left = timeoutMilliseconds - elapsed;
return awaitTermination(left, TimeUnit.MILLISECONDS);
}
@Override
public String toString() {
return this.getClass().getSimpleName() + "[service=" + service + ", domain=" + domain + ", taskListToPoll="
+ taskListToPoll + ", identity=" + identity + ", backoffInitialInterval=" + pollBackoffInitialInterval
+ ", backoffMaximumInterval=" + pollBackoffMaximumInterval + ", backoffCoefficient=" + pollBackoffCoefficient
+ "]";
}
@Override
public boolean isRunning() {
return isStarted() && !pollingExecutor.isTerminated() && !workerExecutor.isTerminated();
}
@Override
public void suspendPolling() {
if (log.isInfoEnabled()) {
log.info("suspendPolling");
}
suspended = true;
if (poller != null) {
poller.suspend();
}
}
@Override
public void resumePolling() {
if (log.isInfoEnabled()) {
log.info("resumePolling");
}
suspended = false;
if (poller != null) {
poller.resume();
}
}
@Override
public boolean isPollingSuspended() {
if (poller != null) {
return poller.isSuspended();
}
return suspended;
}
@Override
public void setPollingSuspended(boolean flag) {
if (flag) {
suspendPolling();
}
else {
resumePolling();
}
}
}
| UTF-8 | Java | 20,383 | java | GenericWorker.java | Java | [] | null | [] | /**
* Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.simpleworkflow.flow.worker;
import java.lang.Thread.UncaughtExceptionHandler;
import java.lang.management.ManagementFactory;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflow;
import com.amazonaws.services.simpleworkflow.flow.WorkerBase;
import com.amazonaws.services.simpleworkflow.flow.common.FlowConstants;
import com.amazonaws.services.simpleworkflow.model.DomainAlreadyExistsException;
import com.amazonaws.services.simpleworkflow.model.RegisterDomainRequest;
public abstract class GenericWorker<T> implements WorkerBase {
class ExecutorThreadFactory implements ThreadFactory {
private AtomicInteger threadIndex = new AtomicInteger();
private final String threadPrefix;
public ExecutorThreadFactory(String threadPrefix) {
this.threadPrefix = threadPrefix;
}
@Override
public Thread newThread(Runnable r) {
Thread result = new Thread(r);
result.setName(threadPrefix + (threadIndex.incrementAndGet()));
result.setUncaughtExceptionHandler(uncaughtExceptionHandler);
return result;
}
}
private class PollingTask implements Runnable {
private final TaskPoller<T> poller;
PollingTask(final TaskPoller poller) {
this.poller = poller;
}
@Override
public void run() {
try {
while(true) {
log.debug("poll task begin");
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
final int availableWorkers = workerExecutor.getMaximumPoolSize() - workerExecutor.getActiveCount();
if (availableWorkers < 1) {
log.debug("no available workers");
return;
}
pollBackoffThrottler.throttle();
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
if (pollRateThrottler != null) {
pollRateThrottler.throttle();
}
if (pollingExecutor.isShutdown() || workerExecutor.isShutdown()) {
return;
}
T task = poller.poll();
if (task == null) {
log.debug("no work returned");
return;
}
workerExecutor.execute(new ExecuteTask(poller, task));
log.debug("poll task end");
}
} catch (final Throwable e) {
pollBackoffThrottler.failure();
if (!(e.getCause() instanceof InterruptedException)) {
uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), e);
}
}
}
}
private class ExecuteTask implements Runnable {
private final TaskPoller<T> poller;
private final T task;
ExecuteTask(final TaskPoller poller, final T task) {
this.poller = poller;
this.task = task;
}
@Override
public void run() {
try {
log.debug("execute task begin");
poller.execute(task);
pollBackoffThrottler.success();
log.debug("execute task end");
} catch (Throwable e) {
pollBackoffThrottler.failure();
if (!(e.getCause() instanceof InterruptedException)) {
uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), e);
}
}
}
}
private static final Log log = LogFactory.getLog(GenericWorker.class);
protected static final int MAX_IDENTITY_LENGTH = 256;
protected AmazonSimpleWorkflow service;
protected String domain;
protected boolean registerDomain;
protected long domainRetentionPeriodInDays = FlowConstants.NONE;
private String taskListToPoll;
private int maximumPollRateIntervalMilliseconds = 1000;
private double maximumPollRatePerSecond;
private double pollBackoffCoefficient = 2;
private long pollBackoffInitialInterval = 100;
private long pollBackoffMaximumInterval = 60000;
private boolean disableTypeRegistrationOnStart;
private boolean disableServiceShutdownOnStop;
private boolean suspended;
private final AtomicBoolean startRequested = new AtomicBoolean();
private final AtomicBoolean shutdownRequested = new AtomicBoolean();
private ScheduledExecutorService pollingExecutor;
private ThreadPoolExecutor workerExecutor;
private String identity = ManagementFactory.getRuntimeMXBean().getName();
private int pollThreadCount = 1;
private int executeThreadCount = 1;
private BackoffThrottler pollBackoffThrottler;
private Throttler pollRateThrottler;
protected UncaughtExceptionHandler uncaughtExceptionHandler = new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
log.error("Failure in thread " + t.getName(), e);
}
};
private TaskPoller poller;
public GenericWorker(AmazonSimpleWorkflow service, String domain, String taskListToPoll) {
this.service = service;
this.domain = domain;
this.taskListToPoll = taskListToPoll;
}
public GenericWorker() {
identity = ManagementFactory.getRuntimeMXBean().getName();
int length = Math.min(identity.length(), GenericWorker.MAX_IDENTITY_LENGTH);
identity = identity.substring(0, length);
}
@Override
public AmazonSimpleWorkflow getService() {
return service;
}
public void setService(AmazonSimpleWorkflow service) {
this.service = service;
}
@Override
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
@Override
public boolean isRegisterDomain() {
return registerDomain;
}
/**
* Should domain be registered on startup. Default is <code>false</code>.
* When enabled {@link #setDomainRetentionPeriodInDays(long)} property is
* required.
*/
@Override
public void setRegisterDomain(boolean registerDomain) {
this.registerDomain = registerDomain;
}
@Override
public long getDomainRetentionPeriodInDays() {
return domainRetentionPeriodInDays;
}
@Override
public void setDomainRetentionPeriodInDays(long domainRetentionPeriodInDays) {
this.domainRetentionPeriodInDays = domainRetentionPeriodInDays;
}
@Override
public String getTaskListToPoll() {
return taskListToPoll;
}
public void setTaskListToPoll(String taskListToPoll) {
this.taskListToPoll = taskListToPoll;
}
@Override
public double getMaximumPollRatePerSecond() {
return maximumPollRatePerSecond;
}
@Override
public void setMaximumPollRatePerSecond(double maximumPollRatePerSecond) {
this.maximumPollRatePerSecond = maximumPollRatePerSecond;
}
@Override
public int getMaximumPollRateIntervalMilliseconds() {
return maximumPollRateIntervalMilliseconds;
}
@Override
public void setMaximumPollRateIntervalMilliseconds(int maximumPollRateIntervalMilliseconds) {
this.maximumPollRateIntervalMilliseconds = maximumPollRateIntervalMilliseconds;
}
@Override
public UncaughtExceptionHandler getUncaughtExceptionHandler() {
return uncaughtExceptionHandler;
}
@Override
public void setUncaughtExceptionHandler(UncaughtExceptionHandler uncaughtExceptionHandler) {
this.uncaughtExceptionHandler = uncaughtExceptionHandler;
}
@Override
public String getIdentity() {
return identity;
}
@Override
public void setIdentity(String identity) {
this.identity = identity;
}
@Override
public long getPollBackoffInitialInterval() {
return pollBackoffInitialInterval;
}
@Override
public void setPollBackoffInitialInterval(long backoffInitialInterval) {
if (backoffInitialInterval < 0) {
throw new IllegalArgumentException("expected value should be positive or 0: " + backoffInitialInterval);
}
this.pollBackoffInitialInterval = backoffInitialInterval;
}
@Override
public long getPollBackoffMaximumInterval() {
return pollBackoffMaximumInterval;
}
@Override
public void setPollBackoffMaximumInterval(long backoffMaximumInterval) {
if (backoffMaximumInterval <= 0) {
throw new IllegalArgumentException("expected value should be positive: " + backoffMaximumInterval);
}
this.pollBackoffMaximumInterval = backoffMaximumInterval;
}
/**
* @see #setDisableServiceShutdownOnStop(boolean)
*/
@Override
public boolean isDisableServiceShutdownOnStop() {
return disableServiceShutdownOnStop;
}
/**
* By default when @{link {@link #shutdown()} or @{link
* {@link #shutdownNow()} is called the worker calls
* {@link AmazonSimpleWorkflow#shutdown()} on the service instance it is
* configured with before shutting down internal thread pools. Otherwise
* threads that are waiting on a poll request might block shutdown for the
* duration of a poll. This flag allows disabling this behavior.
*
* @param disableServiceShutdownOnStop
* <code>true</code> means do not call
* {@link AmazonSimpleWorkflow#shutdown()}
*/
@Override
public void setDisableServiceShutdownOnStop(boolean disableServiceShutdownOnStop) {
this.disableServiceShutdownOnStop = disableServiceShutdownOnStop;
}
@Override
public double getPollBackoffCoefficient() {
return pollBackoffCoefficient;
}
@Override
public void setPollBackoffCoefficient(double backoffCoefficient) {
if (backoffCoefficient < 1.0) {
throw new IllegalArgumentException("expected value should be bigger or equal to 1.0: " + backoffCoefficient);
}
this.pollBackoffCoefficient = backoffCoefficient;
}
@Override
public int getPollThreadCount() {
return pollThreadCount;
}
@Override
public void setPollThreadCount(int threadCount) {
checkStarted();
this.pollThreadCount = threadCount;
/*
It is actually not very useful to have poll thread count
larger than execute thread count. Since execute thread count
is a new concept introduced since Flow-3.7, to make the
major version upgrade more friendly, try to bring the
execute thread count to match poll thread count if client
does not the set execute thread count explicitly.
*/
if (this.executeThreadCount < threadCount) {
this.executeThreadCount = threadCount;
}
}
@Override
public int getExecuteThreadCount() {
return executeThreadCount;
}
@Override
public void setExecuteThreadCount(int threadCount) {
checkStarted();
this.executeThreadCount = threadCount;
}
@Override
public void setDisableTypeRegistrationOnStart(boolean disableTypeRegistrationOnStart) {
this.disableTypeRegistrationOnStart = disableTypeRegistrationOnStart;
}
@Override
public boolean isDisableTypeRegistrationOnStart() {
return disableTypeRegistrationOnStart;
}
@Override
public void start() {
if (log.isInfoEnabled()) {
log.info("start: " + toString());
}
if (shutdownRequested.get()) {
throw new IllegalStateException("Shutdown Requested. Not restartable.");
}
if (!startRequested.compareAndSet(false, true)) {
return;
}
checkRequiredProperty(service, "service");
checkRequiredProperty(domain, "domain");
checkRequiredProperty(taskListToPoll, "taskListToPoll");
checkRequiredProperties();
if (registerDomain) {
registerDomain();
}
if (!disableTypeRegistrationOnStart) {
registerTypesToPoll();
}
if (maximumPollRatePerSecond > 0.0) {
pollRateThrottler = new Throttler("pollRateThrottler " + taskListToPoll, maximumPollRatePerSecond,
maximumPollRateIntervalMilliseconds);
}
poller = createPoller();
if (suspended) {
poller.suspend();
}
pollBackoffThrottler = new BackoffThrottler(pollBackoffInitialInterval, pollBackoffMaximumInterval,
pollBackoffCoefficient);
workerExecutor = new ThreadPoolExecutor(executeThreadCount, executeThreadCount, 1, TimeUnit.MINUTES,
new SynchronousQueue<>(), new BlockCallerPolicy());
ExecutorThreadFactory pollExecutorThreadFactory = getExecutorThreadFactory("Worker");
workerExecutor.setThreadFactory(pollExecutorThreadFactory);
pollingExecutor = new ScheduledThreadPoolExecutor(pollThreadCount, getExecutorThreadFactory("Poller"));
for (int i = 0; i < pollThreadCount; i++) {
pollingExecutor.scheduleWithFixedDelay(new PollingTask(poller), 0, 1, TimeUnit.SECONDS);
}
}
private ExecutorThreadFactory getExecutorThreadFactory(final String type) {
return new ExecutorThreadFactory(getPollThreadNamePrefix() + " " + type);
}
protected abstract String getPollThreadNamePrefix();
protected abstract TaskPoller<T> createPoller();
protected abstract void checkRequiredProperties();
private void registerDomain() {
if (domainRetentionPeriodInDays == FlowConstants.NONE) {
throw new IllegalStateException("required property domainRetentionPeriodInDays is not set");
}
try {
service.registerDomain(new RegisterDomainRequest().withName(domain).withWorkflowExecutionRetentionPeriodInDays(
String.valueOf(domainRetentionPeriodInDays)));
}
catch (DomainAlreadyExistsException e) {
if (log.isTraceEnabled()) {
log.trace("Domain is already registered: " + domain);
}
}
}
protected void checkRequiredProperty(Object value, String name) {
if (value == null) {
throw new IllegalStateException("required property " + name + " is not set");
}
}
protected void checkStarted() {
if (isStarted()) {
throw new IllegalStateException("started");
}
}
private boolean isStarted() {
return startRequested.get();
}
@Override
public void shutdown() {
if (log.isInfoEnabled()) {
log.info("shutdown");
}
if (!shutdownRequested.compareAndSet(false, true)) {
return;
}
if (!isStarted()) {
return;
}
if (!disableServiceShutdownOnStop) {
service.shutdown();
}
pollingExecutor.shutdown();
workerExecutor.shutdown();
}
@Override
public void shutdownNow() {
if (log.isInfoEnabled()) {
log.info("shutdownNow");
}
if (!shutdownRequested.compareAndSet(false, true)) {
return;
}
if (!isStarted()) {
return;
}
if (!disableServiceShutdownOnStop) {
service.shutdown();
}
pollingExecutor.shutdownNow();
workerExecutor.shutdownNow();
}
@Override
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
long start = System.currentTimeMillis();
boolean terminated = pollingExecutor.awaitTermination(timeout, unit);
long elapsed = System.currentTimeMillis() - start;
long left = TimeUnit.MILLISECONDS.convert(timeout, unit) - elapsed;
terminated &= workerExecutor.awaitTermination(left, TimeUnit.MILLISECONDS);
return terminated;
}
/**
* The graceful shutdown will wait for existing polls and tasks to complete
* unless the timeout is not enough. It does not shutdown the SWF client.
*/
@Override
public boolean gracefulShutdown(long timeout, TimeUnit unit) throws InterruptedException {
setDisableServiceShutdownOnStop(true);
return shutdownAndAwaitTermination(timeout, unit);
}
/**
* This method will also shutdown SWF client unless you {@link #setDisableServiceShutdownOnStop(boolean)} to <code>true</code>.
*/
@Override
public boolean shutdownAndAwaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
long timeoutMilliseconds = TimeUnit.MILLISECONDS.convert(timeout, unit);
long start = System.currentTimeMillis();
if (shutdownRequested.compareAndSet(false, true)) {
if (!isStarted()) {
return true;
}
if (!disableServiceShutdownOnStop) {
service.shutdown();
}
pollingExecutor.shutdown();
pollingExecutor.awaitTermination(timeout, unit);
workerExecutor.shutdown();
long elapsed = System.currentTimeMillis() - start;
long left = timeoutMilliseconds - elapsed;
workerExecutor.awaitTermination(left, unit);
}
long elapsed = System.currentTimeMillis() - start;
long left = timeoutMilliseconds - elapsed;
return awaitTermination(left, TimeUnit.MILLISECONDS);
}
@Override
public String toString() {
return this.getClass().getSimpleName() + "[service=" + service + ", domain=" + domain + ", taskListToPoll="
+ taskListToPoll + ", identity=" + identity + ", backoffInitialInterval=" + pollBackoffInitialInterval
+ ", backoffMaximumInterval=" + pollBackoffMaximumInterval + ", backoffCoefficient=" + pollBackoffCoefficient
+ "]";
}
@Override
public boolean isRunning() {
return isStarted() && !pollingExecutor.isTerminated() && !workerExecutor.isTerminated();
}
@Override
public void suspendPolling() {
if (log.isInfoEnabled()) {
log.info("suspendPolling");
}
suspended = true;
if (poller != null) {
poller.suspend();
}
}
@Override
public void resumePolling() {
if (log.isInfoEnabled()) {
log.info("resumePolling");
}
suspended = false;
if (poller != null) {
poller.resume();
}
}
@Override
public boolean isPollingSuspended() {
if (poller != null) {
return poller.isSuspended();
}
return suspended;
}
@Override
public void setPollingSuspended(boolean flag) {
if (flag) {
suspendPolling();
}
else {
resumePolling();
}
}
}
| 20,383 | 0.643379 | 0.641073 | 622 | 31.770096 | 29.097301 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416399 | false | false | 13 |
8593b804d8d5cb969df44cf9979d4d94389b2ae2 | 21,345,987,478,014 | eb1e5af502b2523d3037617330c7c54b3a92b44f | /app/models/Product.java | 49038774a3f28b4cf63b80c569d9f0b03a307dde | [] | no_license | rcernaUTC/pos | https://github.com/rcernaUTC/pos | efc29074301b0ac20fa4e30ba5a2362d5fbeb9cc | d99a3b175c821b4805123c66c3b0f4bf400088c4 | refs/heads/master | 2021-01-13T01:41:00.369000 | 2015-07-15T19:41:31 | 2015-07-15T19:41:31 | 39,157,392 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package models;
import javax.persistence.Entity;
import play.db.jpa.Model;
@Entity
public class Product extends Model {
public long code;
private String description;
private float price;
private boolean stock;
private String nombreImagen;
private int numStock;
public Product(long code, String description, float price, boolean stock,
String nombreImagen, int numStock) {
this.code = code;
this.description = description;
this.price = price;
this.nombreImagen = nombreImagen;
this.stock = stock;
this.numStock = numStock;
}
public long getCode() {
return this.code;
}
public void setCode(long code) {
this.code = code;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public float getPrice() {
return this.price;
}
public void setPrice(float price) {
this.price = price;
}
public String getNombreImagen() {
return this.nombreImagen;
}
public void setNombreImagen(String NombreImagen) {
this.nombreImagen = NombreImagen;
}
public boolean getStock() {
return this.stock;
}
public void setStock(boolean stock) {
this.stock = stock;
}
public String toString() {
return "nombre: (" + description + ")";
}
}
| UTF-8 | Java | 1,280 | java | Product.java | Java | [] | null | [] | package models;
import javax.persistence.Entity;
import play.db.jpa.Model;
@Entity
public class Product extends Model {
public long code;
private String description;
private float price;
private boolean stock;
private String nombreImagen;
private int numStock;
public Product(long code, String description, float price, boolean stock,
String nombreImagen, int numStock) {
this.code = code;
this.description = description;
this.price = price;
this.nombreImagen = nombreImagen;
this.stock = stock;
this.numStock = numStock;
}
public long getCode() {
return this.code;
}
public void setCode(long code) {
this.code = code;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public float getPrice() {
return this.price;
}
public void setPrice(float price) {
this.price = price;
}
public String getNombreImagen() {
return this.nombreImagen;
}
public void setNombreImagen(String NombreImagen) {
this.nombreImagen = NombreImagen;
}
public boolean getStock() {
return this.stock;
}
public void setStock(boolean stock) {
this.stock = stock;
}
public String toString() {
return "nombre: (" + description + ")";
}
}
| 1,280 | 0.717188 | 0.717188 | 69 | 17.550724 | 16.30554 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.42029 | false | false | 13 |
8effd72d5a38c6d03c13310216db93f95b03e4b8 | 21,345,987,478,203 | 92e57bdf3434275c52249932a949ceb716099400 | /TA-FL-master/Pract/src/com/company/Parser.java | 4af10325707c3c2f9b740d5a384ef249d6f23c22 | [] | no_license | Maxim278/TA_PR | https://github.com/Maxim278/TA_PR | 3795befe9baab9043db01930a9f4f4376818cfd9 | 31bcdb4d98a31fdc70cb372b199cffda2aa33c15 | refs/heads/master | 2020-11-27T07:16:36.387000 | 2019-12-20T23:38:00 | 2019-12-20T23:38:00 | 229,350,790 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.company;
import com.company.AST.*;
import java.util.*;
public class Parser {
private final List<Token> tokens;
private int pos = 0;
static Map<String, String> scope = new TreeMap<>();
public Parser(List<Token> tokens) {
this.tokens = tokens;
}
private void error(String message) {
if (pos < tokens.size()) {
Token t = tokens.get(pos);
throw new RuntimeException(message + " в позиции " + t.pos);
} else {
throw new RuntimeException(message + " в конце файла");
}
}
private Token match(TokenType... expected) {
if (pos < tokens.size()) {//проход по всему списку токенов
Token curr = tokens.get(pos);
if (Arrays.asList(expected).contains(curr.type)) {//если этот элемент соответствует переданному типу, то передать токен
pos++;
return curr;
}
}
return null;
}
private Token require(TokenType... expected) {
Token t = match(expected); //поиск токена
if (t == null)
error("Ожидается " + Arrays.toString(expected));
return t;
}
private ExprNode parseElem() {
Token num = match(TokenType.NUMBER);
if (num != null)
return new NumberNode(num);
Token id = match(TokenType.ID);
if (id != null)
return new VarNode(id);
error("Ожидается число или переменная");
return null;
}
public ExprNode parseUnoOp() {
Token t;
while ((t = match(
TokenType.ID,
TokenType.NUMBER,
TokenType.INC,
TokenType.DEC,
TokenType.PRINT)) != null) {
if (t.type == TokenType.NUMBER || t.type == TokenType.ID) {
pos--;
ExprNode e = parseElem();
if ((t = match(TokenType.INC, TokenType.DEC)) != null) {
e = new UnoOpNode(t, e);
require(TokenType.SEMICOLON);
return e;
}
} else {
ExprNode e = new UnoOpNode(t, parseElem());
require(TokenType.SEMICOLON);
return e;
}
}
throw new IllegalStateException();
}
public ExprNode parseCond() { // только для условий
ExprNode e1 = parseElem();
Token op;
if ((op = match(TokenType.LESS, TokenType.EQ, TokenType.MORE)) != null) {
ExprNode e2 = parseElem();
e1 = new BinOpNode(op, e1, e2);
}
return e1;
}
public ExprNode parseAssign() { // если встретим переменную и присвоение, то вернем соответствующий узел
// в противном случае не вернем ничего
if (match(TokenType.ID) == null) {
return null;
}
pos--;
ExprNode e1 = parseElem();
Token op;
if ((op = match(TokenType.ASSIGN)) != null) {
ExprNode e2 = parseElem();
e1 = new BinOpNode(op, e1, e2);
require(TokenType.SEMICOLON);
return e1;
}
pos--;
return null;
}
public ExprNode parseWhile() {// если встретился цикл, то считываем условие
//условие помещается в бин узел
//так же добавляем проверку на вложенные циклы (рекурсия)
//в теле цикла либо бинарный либо одиночный узел (проверяем)
if (match(TokenType.WHILE) != null) {
ExprNode condition = parseCond();
require(TokenType.DO);
WhileOrder statements = new WhileOrder();
while (match(TokenType.DONE) == null) {
statements.addNode(parseWhile());
}
require(TokenType.SEMICOLON);
return new WhileNode(condition, statements);
} else {
ExprNode node = parseAssign();
if (node != null) {
return node;
}
return parseUnoOp();
}
}
public ExprNode parseExpression() {//создаем список узлов
//из списка токенов
WhileOrder wo = new WhileOrder();
while (pos < tokens.size()) {
wo.addNode(parseWhile());
}
return wo;
}
public String eval(ExprNode e) {
if (e instanceof NumberNode) {
NumberNode num = (NumberNode) e;
return num.getDecimal();
} else if (e instanceof VarNode) {
VarNode var = (VarNode) e;
if (scope.containsKey(var.id.text)) {
return scope.get(var.id.text);
} else {
System.out.println("Введите значение переменной(х16) " + var.id.text + ":");
String line = new Scanner(System.in).nextLine();
scope.put(var.id.text, line);
return line;
}
} else if (e instanceof UnoOpNode) {
UnoOpNode uOp = (UnoOpNode) e;
String value;
switch (uOp.operator.type) {
case PRINT:
System.out.println(eval(uOp.operand));
return "";
case INC:
if (uOp.operand instanceof VarNode) {
value = scope.get(((VarNode) uOp.operand).id.text);
value = dexToHex(value,TokenType.INC);
VarNode var = (VarNode) uOp.operand;
scope.put(var.id.text, value);
} else if (uOp.operand instanceof NumberNode) {
value = eval(uOp.operand);
value = dexToHex(value,TokenType.INC);
} else {
throw new IllegalStateException();
}
return value;
case DEC:
if (uOp.operand instanceof VarNode) {
value = scope.get(((VarNode) uOp.operand).id.text);
value = dexToHex(value,TokenType.DEC);
VarNode var = (VarNode) uOp.operand;
scope.put(var.id.text, value);
} else if (uOp.operand instanceof NumberNode) {
value = eval(uOp.operand);
value = dexToHex(value,TokenType.DEC);
} else {
throw new IllegalStateException();
}
return value;
default:
return "";
}
} else if (e instanceof BinOpNode) {
BinOpNode bOp = (BinOpNode) e;
if (bOp.op.type == TokenType.ASSIGN) {
if (bOp.left instanceof VarNode) {
String key = ((VarNode) bOp.left).id.text;
String value;
if (bOp.right instanceof NumberNode) {
value = ((NumberNode) bOp.right).number.text;
scope.put(key, value);
return "";
} else if (bOp.right instanceof VarNode) {
String refKey = ((VarNode) bOp.right).id.text;
value = scope.get(refKey);
scope.put(key, value);
return "";
}
}
throw new IllegalStateException();
}
String l = eval(bOp.left);
String r = eval(bOp.right);
switch (bOp.op.type) {
case LESS:
return Integer.parseInt(l,16) < Integer.parseInt(r,16) ? "True" : "False";
case EQ:
return Integer.parseInt(l,16) == Integer.parseInt(r,16) ? "True" : "False";
case MORE:
return Integer.parseInt(l,16) > Integer.parseInt(r,16) ? "True" : "False";
default:
break;
}
} else if (e instanceof WhileOrder) {
WhileOrder wo = (WhileOrder) e;
for (ExprNode node : wo.getNodeList()) {
eval(node);
}
return "";
} else if (e instanceof WhileNode) {
WhileNode node = (WhileNode) e;
while (eval(node.condition).equals("True")) {
eval(node.innerExpr);
}
return "";
}
throw new IllegalStateException();
}
public String dexToHex(String res, TokenType tokenType)
{
switch(tokenType)
{
case INC: {
int dex = Integer.parseInt(res, 16); //конвертация из 10-й в 16-ю сс
dex++;
res = Integer.toString(dex, 16);
return res;
}
case DEC: {
int dex = Integer.parseInt(res, 16);
dex--;
res = Integer.toString(dex, 16);
return res;
}
}
return "";
}
public static void main(String[] args) {
String text =
"while x>03 do" +
"print x;" +
"x--;" +
"done;" +
"x := 44;" +
"print x;" +
"while y < 0d do" +
"y++;" +
"while 1 > 2 do" +
"print 777;" +
"done;" +
"print y;" +
"done;";
Lexer l = new Lexer(text);
List<Token> tokens = l.lex();
tokens.removeIf(t -> t.type == TokenType.SPACE);
Parser p = new Parser(tokens);
ExprNode node = p.parseExpression();
p.eval(node);
}
}
| UTF-8 | Java | 10,689 | java | Parser.java | Java | [] | null | [] | package com.company;
import com.company.AST.*;
import java.util.*;
public class Parser {
private final List<Token> tokens;
private int pos = 0;
static Map<String, String> scope = new TreeMap<>();
public Parser(List<Token> tokens) {
this.tokens = tokens;
}
private void error(String message) {
if (pos < tokens.size()) {
Token t = tokens.get(pos);
throw new RuntimeException(message + " в позиции " + t.pos);
} else {
throw new RuntimeException(message + " в конце файла");
}
}
private Token match(TokenType... expected) {
if (pos < tokens.size()) {//проход по всему списку токенов
Token curr = tokens.get(pos);
if (Arrays.asList(expected).contains(curr.type)) {//если этот элемент соответствует переданному типу, то передать токен
pos++;
return curr;
}
}
return null;
}
private Token require(TokenType... expected) {
Token t = match(expected); //поиск токена
if (t == null)
error("Ожидается " + Arrays.toString(expected));
return t;
}
private ExprNode parseElem() {
Token num = match(TokenType.NUMBER);
if (num != null)
return new NumberNode(num);
Token id = match(TokenType.ID);
if (id != null)
return new VarNode(id);
error("Ожидается число или переменная");
return null;
}
public ExprNode parseUnoOp() {
Token t;
while ((t = match(
TokenType.ID,
TokenType.NUMBER,
TokenType.INC,
TokenType.DEC,
TokenType.PRINT)) != null) {
if (t.type == TokenType.NUMBER || t.type == TokenType.ID) {
pos--;
ExprNode e = parseElem();
if ((t = match(TokenType.INC, TokenType.DEC)) != null) {
e = new UnoOpNode(t, e);
require(TokenType.SEMICOLON);
return e;
}
} else {
ExprNode e = new UnoOpNode(t, parseElem());
require(TokenType.SEMICOLON);
return e;
}
}
throw new IllegalStateException();
}
public ExprNode parseCond() { // только для условий
ExprNode e1 = parseElem();
Token op;
if ((op = match(TokenType.LESS, TokenType.EQ, TokenType.MORE)) != null) {
ExprNode e2 = parseElem();
e1 = new BinOpNode(op, e1, e2);
}
return e1;
}
public ExprNode parseAssign() { // если встретим переменную и присвоение, то вернем соответствующий узел
// в противном случае не вернем ничего
if (match(TokenType.ID) == null) {
return null;
}
pos--;
ExprNode e1 = parseElem();
Token op;
if ((op = match(TokenType.ASSIGN)) != null) {
ExprNode e2 = parseElem();
e1 = new BinOpNode(op, e1, e2);
require(TokenType.SEMICOLON);
return e1;
}
pos--;
return null;
}
public ExprNode parseWhile() {// если встретился цикл, то считываем условие
//условие помещается в бин узел
//так же добавляем проверку на вложенные циклы (рекурсия)
//в теле цикла либо бинарный либо одиночный узел (проверяем)
if (match(TokenType.WHILE) != null) {
ExprNode condition = parseCond();
require(TokenType.DO);
WhileOrder statements = new WhileOrder();
while (match(TokenType.DONE) == null) {
statements.addNode(parseWhile());
}
require(TokenType.SEMICOLON);
return new WhileNode(condition, statements);
} else {
ExprNode node = parseAssign();
if (node != null) {
return node;
}
return parseUnoOp();
}
}
public ExprNode parseExpression() {//создаем список узлов
//из списка токенов
WhileOrder wo = new WhileOrder();
while (pos < tokens.size()) {
wo.addNode(parseWhile());
}
return wo;
}
public String eval(ExprNode e) {
if (e instanceof NumberNode) {
NumberNode num = (NumberNode) e;
return num.getDecimal();
} else if (e instanceof VarNode) {
VarNode var = (VarNode) e;
if (scope.containsKey(var.id.text)) {
return scope.get(var.id.text);
} else {
System.out.println("Введите значение переменной(х16) " + var.id.text + ":");
String line = new Scanner(System.in).nextLine();
scope.put(var.id.text, line);
return line;
}
} else if (e instanceof UnoOpNode) {
UnoOpNode uOp = (UnoOpNode) e;
String value;
switch (uOp.operator.type) {
case PRINT:
System.out.println(eval(uOp.operand));
return "";
case INC:
if (uOp.operand instanceof VarNode) {
value = scope.get(((VarNode) uOp.operand).id.text);
value = dexToHex(value,TokenType.INC);
VarNode var = (VarNode) uOp.operand;
scope.put(var.id.text, value);
} else if (uOp.operand instanceof NumberNode) {
value = eval(uOp.operand);
value = dexToHex(value,TokenType.INC);
} else {
throw new IllegalStateException();
}
return value;
case DEC:
if (uOp.operand instanceof VarNode) {
value = scope.get(((VarNode) uOp.operand).id.text);
value = dexToHex(value,TokenType.DEC);
VarNode var = (VarNode) uOp.operand;
scope.put(var.id.text, value);
} else if (uOp.operand instanceof NumberNode) {
value = eval(uOp.operand);
value = dexToHex(value,TokenType.DEC);
} else {
throw new IllegalStateException();
}
return value;
default:
return "";
}
} else if (e instanceof BinOpNode) {
BinOpNode bOp = (BinOpNode) e;
if (bOp.op.type == TokenType.ASSIGN) {
if (bOp.left instanceof VarNode) {
String key = ((VarNode) bOp.left).id.text;
String value;
if (bOp.right instanceof NumberNode) {
value = ((NumberNode) bOp.right).number.text;
scope.put(key, value);
return "";
} else if (bOp.right instanceof VarNode) {
String refKey = ((VarNode) bOp.right).id.text;
value = scope.get(refKey);
scope.put(key, value);
return "";
}
}
throw new IllegalStateException();
}
String l = eval(bOp.left);
String r = eval(bOp.right);
switch (bOp.op.type) {
case LESS:
return Integer.parseInt(l,16) < Integer.parseInt(r,16) ? "True" : "False";
case EQ:
return Integer.parseInt(l,16) == Integer.parseInt(r,16) ? "True" : "False";
case MORE:
return Integer.parseInt(l,16) > Integer.parseInt(r,16) ? "True" : "False";
default:
break;
}
} else if (e instanceof WhileOrder) {
WhileOrder wo = (WhileOrder) e;
for (ExprNode node : wo.getNodeList()) {
eval(node);
}
return "";
} else if (e instanceof WhileNode) {
WhileNode node = (WhileNode) e;
while (eval(node.condition).equals("True")) {
eval(node.innerExpr);
}
return "";
}
throw new IllegalStateException();
}
public String dexToHex(String res, TokenType tokenType)
{
switch(tokenType)
{
case INC: {
int dex = Integer.parseInt(res, 16); //конвертация из 10-й в 16-ю сс
dex++;
res = Integer.toString(dex, 16);
return res;
}
case DEC: {
int dex = Integer.parseInt(res, 16);
dex--;
res = Integer.toString(dex, 16);
return res;
}
}
return "";
}
public static void main(String[] args) {
String text =
"while x>03 do" +
"print x;" +
"x--;" +
"done;" +
"x := 44;" +
"print x;" +
"while y < 0d do" +
"y++;" +
"while 1 > 2 do" +
"print 777;" +
"done;" +
"print y;" +
"done;";
Lexer l = new Lexer(text);
List<Token> tokens = l.lex();
tokens.removeIf(t -> t.type == TokenType.SPACE);
Parser p = new Parser(tokens);
ExprNode node = p.parseExpression();
p.eval(node);
}
}
| 10,689 | 0.443976 | 0.439173 | 283 | 34.045937 | 22.737122 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.632509 | false | false | 13 |
c4338ca52a22385d3177a92c041c2b455d013f19 | 25,589,415,172,184 | 395af3d2cfef78738d46a83e818fcb6332c2689a | /src/clustering/distance/EditDistance.java | cac7fa748629aed7fe1577065c7ca1e76676739c | [] | no_license | njustesen/broodwar-analysis | https://github.com/njustesen/broodwar-analysis | 58955e34a9ddf78de2a3d3feb913598492d5c64b | b834737e2b17ae209d3d8341b838259756b70c87 | refs/heads/master | 2021-01-10T19:55:14.228000 | 2015-08-14T20:46:28 | 2015-08-14T20:46:28 | 18,358,959 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package clustering.distance;
import java.util.ArrayList;
import java.util.List;
import domain.buildorder.Build;
import domain.buildorder.BuildOrder;
import domain.cost.CostMap;
import analyser.Action;
import analyser.Action.ActionType;
import analyser.Action.Type;
import analyser.Player;
/**
* Wagner-Fisher algorithm for calculating the edit distance for two build orders.
*
*/
public class EditDistance {
int discount;
boolean units;
boolean buildings;
boolean upgrades;
boolean research;
private boolean cost;
private int max;
public EditDistance(boolean units,
boolean buildings, boolean upgrades, boolean research, boolean cost, int discount, int max) {
super();
this.discount = discount;
this.units = units;
this.buildings = buildings;
this.upgrades = upgrades;
this.research = research;
this.cost = cost;
this.max = max;
}
public double distance(Player a, Player b){
List<Action> buildOrderA = buildOrder(a);
List<Action> buildOrderB = buildOrder(b);
// for all i and j, d[i,j] will hold the Levenshtein distance between
// the first i characters of s and the first j characters of t;
// note that d has (m+1)x(n+1) values
// s and t
List<Action> s = buildOrderA;
List<Action> t = buildOrderB;
// m and n
int m = Math.min(max, s.size());
int n = Math.min(max, t.size());
double[][] d = new double[m+1][n+1];
d[0][0] = 0;
for(int i = 1; i <= m; i++){
d[i][0] = d[i - 1][0] + cost(s.get(i-1).actionType); // + cost of deletion
}
for(int j = 1; j <= n; j++){
d[0][j] = d[0][j - 1] + cost(t.get(j-1).actionType); // + cost of insertion
}
for(int j = 1; j <= n; j++){
for(int i = 1; i <= m; i++){
if (s.get(i-1).actionType == t.get(j-1).actionType){
d[i][j] = d[i-1][j-1];
} else {
double deletion = d[i-1][j] + cost(s.get(i-1).actionType); // + cost of deletion
double insertion = d[i][j-1] + cost(t.get(j-1).actionType); // + cost of insertion
double substitution = d[i-1][j-1] + cost(s.get(i-1).actionType) + cost(t.get(j-1).actionType); // + cost of deletion and insertion
d[i][j] = deletion;
if (insertion < d[i][j])
d[i][j] = insertion;
if (substitution < d[i][j])
d[i][j] = substitution;
// Add discount
if (discount != 0)
d[i][j] = d[i][j] * (double)((double)discount/(double)j);
}
}
}
return d[m][n];
}
public double distance(BuildOrder a, BuildOrder b){
List<Build> s = a.builds;
List<Build> t = b.builds;
// for all i and j, d[i,j] will hold the Levenshtein distance between
// the first i characters of s and the first j characters of t;
// note that d has (m+1)x(n+1) values
// m and n
int m = Math.min(max, s.size());
int n = Math.min(max, t.size());
double[][] d = new double[m+1][n+1];
d[0][0] = 0;
for(int i = 1; i <= m; i++){
d[i][0] = d[i - 1][0] + cost(s.get(i-1).action); // + cost of deletion
}
for(int j = 1; j <= n; j++){
d[0][j] = d[0][j - 1] + cost(t.get(j-1).action); // + cost of insertion
}
for(int j = 1; j <= n; j++){
for(int i = 1; i <= m; i++){
if (s.get(i-1).action == t.get(j-1).action){
d[i][j] = d[i-1][j-1];
} else {
double deletion = d[i-1][j] + cost(s.get(i-1).action); // + cost of deletion
double insertion = d[i][j-1] + cost(t.get(j-1).action); // + cost of insertion
double substitution = d[i-1][j-1] + cost(s.get(i-1).action) + cost(t.get(j-1).action); // + cost of deletion and insertion
d[i][j] = deletion;
if (insertion < d[i][j])
d[i][j] = insertion;
if (substitution < d[i][j])
d[i][j] = substitution;
// Add discount
if (discount != 0)
d[i][j] = d[i][j] * ( (double)discount/(double)j );
}
}
}
return d[m][n];
}
private double cost(ActionType action) {
if (!cost){
return 1;
}
if (CostMap.costs.containsKey(action))
return CostMap.costs.get(action).getMinerals() +
CostMap.costs.get(action).getGas();
return -1;
}
private List<Action> buildOrder(Player a) {
List<Action> actions = new ArrayList<Action>();
for(Action action : a.getActions()){
if (action.type == Type.Building && buildings)
actions.add(action);
if (action.type == Type.Unit && units)
actions.add(action);
if (action.type == Type.Research && research)
actions.add(action);
if (action.type == Type.Upgrade && upgrades)
actions.add(action);
}
return actions;
}
public int getDiscount() {
return discount;
}
public void setDiscount(int discount) {
this.discount = discount;
}
public boolean isUnits() {
return units;
}
public void setUnits(boolean units) {
this.units = units;
}
public boolean isBuildings() {
return buildings;
}
public void setBuildings(boolean buildings) {
this.buildings = buildings;
}
public boolean isUpgrades() {
return upgrades;
}
public void setUpgrades(boolean upgrades) {
this.upgrades = upgrades;
}
public boolean isResearch() {
return research;
}
public void setResearch(boolean research) {
this.research = research;
}
}
| UTF-8 | Java | 5,105 | java | EditDistance.java | Java | [] | null | [] | package clustering.distance;
import java.util.ArrayList;
import java.util.List;
import domain.buildorder.Build;
import domain.buildorder.BuildOrder;
import domain.cost.CostMap;
import analyser.Action;
import analyser.Action.ActionType;
import analyser.Action.Type;
import analyser.Player;
/**
* Wagner-Fisher algorithm for calculating the edit distance for two build orders.
*
*/
public class EditDistance {
int discount;
boolean units;
boolean buildings;
boolean upgrades;
boolean research;
private boolean cost;
private int max;
public EditDistance(boolean units,
boolean buildings, boolean upgrades, boolean research, boolean cost, int discount, int max) {
super();
this.discount = discount;
this.units = units;
this.buildings = buildings;
this.upgrades = upgrades;
this.research = research;
this.cost = cost;
this.max = max;
}
public double distance(Player a, Player b){
List<Action> buildOrderA = buildOrder(a);
List<Action> buildOrderB = buildOrder(b);
// for all i and j, d[i,j] will hold the Levenshtein distance between
// the first i characters of s and the first j characters of t;
// note that d has (m+1)x(n+1) values
// s and t
List<Action> s = buildOrderA;
List<Action> t = buildOrderB;
// m and n
int m = Math.min(max, s.size());
int n = Math.min(max, t.size());
double[][] d = new double[m+1][n+1];
d[0][0] = 0;
for(int i = 1; i <= m; i++){
d[i][0] = d[i - 1][0] + cost(s.get(i-1).actionType); // + cost of deletion
}
for(int j = 1; j <= n; j++){
d[0][j] = d[0][j - 1] + cost(t.get(j-1).actionType); // + cost of insertion
}
for(int j = 1; j <= n; j++){
for(int i = 1; i <= m; i++){
if (s.get(i-1).actionType == t.get(j-1).actionType){
d[i][j] = d[i-1][j-1];
} else {
double deletion = d[i-1][j] + cost(s.get(i-1).actionType); // + cost of deletion
double insertion = d[i][j-1] + cost(t.get(j-1).actionType); // + cost of insertion
double substitution = d[i-1][j-1] + cost(s.get(i-1).actionType) + cost(t.get(j-1).actionType); // + cost of deletion and insertion
d[i][j] = deletion;
if (insertion < d[i][j])
d[i][j] = insertion;
if (substitution < d[i][j])
d[i][j] = substitution;
// Add discount
if (discount != 0)
d[i][j] = d[i][j] * (double)((double)discount/(double)j);
}
}
}
return d[m][n];
}
public double distance(BuildOrder a, BuildOrder b){
List<Build> s = a.builds;
List<Build> t = b.builds;
// for all i and j, d[i,j] will hold the Levenshtein distance between
// the first i characters of s and the first j characters of t;
// note that d has (m+1)x(n+1) values
// m and n
int m = Math.min(max, s.size());
int n = Math.min(max, t.size());
double[][] d = new double[m+1][n+1];
d[0][0] = 0;
for(int i = 1; i <= m; i++){
d[i][0] = d[i - 1][0] + cost(s.get(i-1).action); // + cost of deletion
}
for(int j = 1; j <= n; j++){
d[0][j] = d[0][j - 1] + cost(t.get(j-1).action); // + cost of insertion
}
for(int j = 1; j <= n; j++){
for(int i = 1; i <= m; i++){
if (s.get(i-1).action == t.get(j-1).action){
d[i][j] = d[i-1][j-1];
} else {
double deletion = d[i-1][j] + cost(s.get(i-1).action); // + cost of deletion
double insertion = d[i][j-1] + cost(t.get(j-1).action); // + cost of insertion
double substitution = d[i-1][j-1] + cost(s.get(i-1).action) + cost(t.get(j-1).action); // + cost of deletion and insertion
d[i][j] = deletion;
if (insertion < d[i][j])
d[i][j] = insertion;
if (substitution < d[i][j])
d[i][j] = substitution;
// Add discount
if (discount != 0)
d[i][j] = d[i][j] * ( (double)discount/(double)j );
}
}
}
return d[m][n];
}
private double cost(ActionType action) {
if (!cost){
return 1;
}
if (CostMap.costs.containsKey(action))
return CostMap.costs.get(action).getMinerals() +
CostMap.costs.get(action).getGas();
return -1;
}
private List<Action> buildOrder(Player a) {
List<Action> actions = new ArrayList<Action>();
for(Action action : a.getActions()){
if (action.type == Type.Building && buildings)
actions.add(action);
if (action.type == Type.Unit && units)
actions.add(action);
if (action.type == Type.Research && research)
actions.add(action);
if (action.type == Type.Upgrade && upgrades)
actions.add(action);
}
return actions;
}
public int getDiscount() {
return discount;
}
public void setDiscount(int discount) {
this.discount = discount;
}
public boolean isUnits() {
return units;
}
public void setUnits(boolean units) {
this.units = units;
}
public boolean isBuildings() {
return buildings;
}
public void setBuildings(boolean buildings) {
this.buildings = buildings;
}
public boolean isUpgrades() {
return upgrades;
}
public void setUpgrades(boolean upgrades) {
this.upgrades = upgrades;
}
public boolean isResearch() {
return research;
}
public void setResearch(boolean research) {
this.research = research;
}
}
| 5,105 | 0.609207 | 0.596278 | 212 | 23.080189 | 24.021378 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.382076 | false | false | 13 |
e77ae421c97b63d2919fb6a993c4f259e8ef0677 | 25,323,127,185,956 | 3a421ea61be205b6251854d0e4d2c8624ee6e268 | /src/fr/creatruth/blocks/block/material/MatData.java | 3f940dd56ed663407a45f599664d4525a858f338 | [] | no_license | YogaSama/Blocks | https://github.com/YogaSama/Blocks | 6f23e03e8b437e9495c3fe3e6b1ec362af422c5c | 56ea702b2dbcec663dce57bc3ff27b58f3185a31 | refs/heads/master | 2020-04-06T04:31:36.881000 | 2016-01-29T19:28:12 | 2016-01-29T19:28:12 | 40,722,178 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.creatruth.blocks.block.material;
import org.bukkit.Material;
public class MatData {
private Material material;
private short data;
public MatData(Material material, short data) {
this.material = material;
this.data = data;
}
public MatData(int id) {
this(Material.getMaterial(id), (short) 0);
}
public MatData(Material material) {
this(material.getId(), (short) 0);
}
public MatData(int id, short data) {
this(Material.getMaterial(id), data);
}
public Material getMaterial() {
return material;
}
public short getData() {
return data;
}
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object instanceof MatData) {
MatData md = (MatData) object;
return md.material == this.material &&
md.data == this.data;
}
return false;
}
@Override
public String toString() {
return material.getId() + ":" + data;
}
}
| UTF-8 | Java | 1,103 | java | MatData.java | Java | [] | null | [] | package fr.creatruth.blocks.block.material;
import org.bukkit.Material;
public class MatData {
private Material material;
private short data;
public MatData(Material material, short data) {
this.material = material;
this.data = data;
}
public MatData(int id) {
this(Material.getMaterial(id), (short) 0);
}
public MatData(Material material) {
this(material.getId(), (short) 0);
}
public MatData(int id, short data) {
this(Material.getMaterial(id), data);
}
public Material getMaterial() {
return material;
}
public short getData() {
return data;
}
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object instanceof MatData) {
MatData md = (MatData) object;
return md.material == this.material &&
md.data == this.data;
}
return false;
}
@Override
public String toString() {
return material.getId() + ":" + data;
}
}
| 1,103 | 0.564823 | 0.56301 | 51 | 20.627451 | 18.060856 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false | 13 |
06f687e979084ae58fd8aeb18df98f06e2829971 | 21,397,527,098,205 | 603a77cd617dac315597a9516a430fb1a329ade3 | /app/src/main/java/com/myappconverter/java/foundations/NSString.java | a5c46462ac0ee4e9434806340dab47217cc0148d | [] | no_license | myappconverter-community/Foundation | https://github.com/myappconverter-community/Foundation | 1b1d695093979d6c5d6ad738e0b66912881fb7eb | a55eb7640b1ebfb822dc56992d4ce4f3cc1cb39f | refs/heads/master | 2021-01-10T06:54:29.454000 | 2016-01-26T10:48:31 | 2016-01-26T10:48:31 | 50,422,216 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.myappconverter.java.foundations;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.text.Collator;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.SortedMap;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.os.AsyncTask;
import android.util.Log;
import com.myappconverter.java.corefoundations.utilities.AndroidIOUtils;
import com.myappconverter.java.coregraphics.CGPoint;
import com.myappconverter.java.coregraphics.CGRect;
import com.myappconverter.java.coregraphics.CGSize;
import com.myappconverter.java.foundations.NSLinguisticTagger.NSLinguisticTaggerOptions;
import com.myappconverter.java.foundations.NSObjCRuntime.NSComparisonResult;
import com.myappconverter.java.foundations.constants.NSStringEncoding;
import com.myappconverter.java.foundations.protocols.NSCoding;
import com.myappconverter.java.foundations.protocols.NSCopying;
import com.myappconverter.java.foundations.protocols.NSMutableCopying;
import com.myappconverter.java.foundations.protocols.NSSecureCoding;
import com.myappconverter.java.foundations.utilities.AndroidFilenameUtils;
import com.myappconverter.java.foundations.utilities.AndroidWordUtils;
import com.myappconverter.java.foundations.utilities.BinaryPropertyListWriter;
import com.myappconverter.java.uikit.NSStringDrawing.NSStringDrawingOptions;
import com.myappconverter.java.uikit.NSStringDrawingContext;
import com.myappconverter.mapping.utils.AndroidFileUtils;
import com.myappconverter.mapping.utils.AndroidRessourcesUtils;
import com.myappconverter.mapping.utils.AndroidStringUtils;
import com.myappconverter.mapping.utils.AndroidVersionUtils;
import com.myappconverter.mapping.utils.GenericMainContext;
import com.myappconverter.mapping.utils.InstanceTypeFactory;
import com.myappconverter.mapping.utils.PerformBlock;
public class NSString extends NSObject
implements Serializable, NSCopying, NSMutableCopying, NSSecureCoding, Comparable<NSString> {
private static final Logger LOGGER = Logger.getLogger(NSString.class.getName());
private static final long serialVersionUID = 1L;
protected static final String TAG = "NSString";
public interface Adressable {
NSString stringWithContentsOfURLEncodingError(NSURL url, NSStringEncoding enc,
NSError error);
NSError[] getStringWithContentsOfURLEncodingErrorArray();
}
// Enumeration
public static enum NSStringEnumerationOptions {
NSStringEnumerationByLines(0), //
NSStringEnumerationByParagraphs(1), //
NSStringEnumerationByComposedCharacterSequences(2), //
NSStringEnumerationByWords(3), //
NSStringEnumerationBySentences(4), //
NSStringEnumerationReverse(1L << 8), //
NSStringEnumerationSubstringNotRequired(1L << 9), //
NSStringEnumerationLocalized(1L << 10);
long value;
NSStringEnumerationOptions(long v) {
value = v;
}
public long getValue() {
return value;
}
};
public static enum NSStringEncodingConversionOptions {
NSStringEncodingConversionAllowLossy(1), //
NSStringEncodingConversionExternalRepresentation(2);
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
int value;
NSStringEncodingConversionOptions(int v) {
value = v;
}
};
public static enum NSStringCompareOptions {
NSCaseInsensitiveSearch(1), //
NSLiteralSearch(2), //
NSBackwardsSearch(4), //
NSAnchoredSearch(8), //
NSNumericSearch(64), //
NSDiacriticInsensitiveSearch(128), //
NSWidthInsensitiveSearch(256), //
NSForcedOrderingSearch(512), //
NSRegularExpressionSearch(1024);
int value;
NSStringCompareOptions(int v) {
value = v;
}
public int getValue() {
return value;
}
}
protected String wrappedString;
public String getWrappedString() {
return wrappedString;
}
public void setWrappedString(String aString) {
wrappedString = aString;
}
public NSString() {
this.wrappedString = new String();
}
public NSString(String string) {
this.wrappedString = string;
}
// Creating and Initializing Strings
/**
* @Signature: string
* @Declaration : + (instancetype)string
* @Description : Returns an empty string.
* @return Return Value An empty string.
**/
public static NSString string() {
return new NSString();
}
public static NSString string(Class clazz) {
NSString str = new NSString();
return (NSString) InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: init
* @Declaration : - (instancetype)init
* @Description : Returns an initialized NSString object that contains no characters.
* @return Return Value An initialized NSString object that contains no characters. The returned object may be different from the
* original receiver.
**/
@Override
public NSString init() {
return this;
}
/**
* @Signature: initWithBytes:length:encoding:
* @Declaration : - (instancetype)initWithBytes:(const void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding
* @Description : Returns an initialized NSString object containing a given number of bytes from a given buffer of bytes interpreted in
* a given encoding.
* @param bytes A buffer of bytes interpreted in the encoding specified by encoding.
* @param length The number of bytes to use from bytes.
* @param encoding The character encoding applied to bytes.
* @return Return Value An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The
* returned object may be different from the original receiver. The return byte strings are allowed to be unterminated. If the
* length of the byte string is greater than the specified length a nil value is returned.
**/
public Object initWithBytesLengthEncoding(byte[] bytes, int length, int encoding) {
if (bytes.length < length) {
return null;
} else {
this.wrappedString = new String(bytes, 0, length,
NSStringEncoding.getCharsetFromInt(encoding));
return this;
}
}
public Object initWithBytesLengthEncoding(Class clazz, byte[] bytes, int length, NSStringEncoding encoding) {
// not yet covered
if (bytes.length < length) {
return null;
} else {
// NSStringEncoding.getWrappedCharset() not yet covered
// this.wrappedString = new String(bytes, 0, length, encoding.getWrappedCharset());
return InstanceTypeFactory.getInstance(this, NSString.class, clazz, new NSString("setWrappedString"),
this.getWrappedString());
}
}
/**
* @Signature: initWithBytesNoCopy:length:encoding:freeWhenDone:
* @Declaration : - (instancetype)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding
* freeWhenDone:(BOOL)flag
* @Description : Returns an initialized NSString object that contains a given number of bytes from a given buffer of bytes interpreted
* in a given encoding, and optionally frees the buffer.
* @param bytes A buffer of bytes interpreted in the encoding specified by encoding.
* @param length The number of bytes to use from bytes.
* @param encoding The character encoding of bytes.
* @param flag If YES, the receiver frees the memory when it no longer needs the data; if NO it won’t.
* @return Return Value An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The
* returned object may be different from the original receiver.
**/
public Object initWithBytesNoCopyLengthEncodingFreeWhenDone(byte[] bytes, int length,
int encoding, boolean freeWhenDone) {
if (bytes.length < length) {
return null;
} else {
this.wrappedString = new String(bytes, 0, length,
NSStringEncoding.getCharsetFromInt(encoding));
if (freeWhenDone) {
bytes = null;
}
return this;
}
}
public Object initWithBytesNoCopyLengthEncodingFreeWhenDone(Class clazz, byte[] bytes, int length, NSStringEncoding encoding,
boolean freeWhenDone) {
// not yet covered
if (bytes.length < length) {
return null;
} else {
// NSStringEncoding.getWrappedCharset() not yet covered
// this.wrappedString = new String(bytes, 0, length, encoding.getWrappedCharset());
if (freeWhenDone) {
bytes = null;
}
return InstanceTypeFactory.getInstance(this, NSString.class, clazz, new NSString("setWrappedString"), this.getWrappedString());
}
}
/**
* @Signature: initWithCharacters:length:
* @Declaration : - (instancetype)initWithCharacters:(const unichar *)characters length:(NSUInteger)length
* @Description : Returns an initialized NSString object that contains a given number of characters from a given C array of Unicode
* characters.
* @param characters A C array of Unicode characters; the value must not be NULL. Important:Â Raises an exception if characters is NULL,
* even if length is 0.
* @param length The number of characters to use from characters.
* @return Return Value An initialized NSString object containing length characters taken from characters. The returned object may be
* different from the original receiver.
**/
public Object initWithCharactersLength(char[] characters, int length) {
this.wrappedString = new String(characters, 0, length);
return this;
}
public Object initWithCharactersLength(Class clazz, char[] characters, int length) {
this.wrappedString = new String(characters, 0, length);
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithCharactersNoCopy:length:freeWhenDone:
* @Declaration : - (instancetype)initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)flag
* @Description : Returns an initialized NSString object that contains a given number of characters from a given C array of Unicode
* characters.
* @param characters A C array of Unicode characters.
* @param length The number of characters to use from characters.
* @param flag If YES, the receiver will free the memory when it no longer needs the characters; if NO it won’t.
* @return Return Value An initialized NSString object that contains length characters from characters. The returned object may be
* different from the original receiver.
**/
public Object initWithCharactersNoCopyLengthFreeWhenDone(char[] characters, int length,
boolean freeWhenDone) {
if (length < characters.length)
this.wrappedString = new String(characters, 0, length);
else
this.wrappedString = new String(characters);
if (freeWhenDone) {
characters = null;
}
return this;
}
public Object initWithCharactersNoCopyLengthFreeWhenDone(Class clazz, char[] characters,
int length, boolean freeWhenDone) {
if (length < characters.length)
this.wrappedString = new String(characters, 0, length);
else
this.wrappedString = new String(characters);
if (freeWhenDone) {
characters = null;
}
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithString:
* @Declaration : - (instancetype)initWithString:(NSString *)aString
* @Description : Returns an NSString object initialized by copying the characters from another given string.
* @param aString The string from which to copy characters. This value must not be nil. Important:Â Raises an NSInvalidArgumentException
* if aString is nil.
* @return Return Value An NSString object initialized by copying the characters from aString. The returned object may be different from
* the original receiver.
**/
public Object initWithString(NSString string) {
this.wrappedString = string.wrappedString;
return this;
}
public Object initWithString(Class clazz, NSString string) {
this.wrappedString = string.wrappedString;
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithCString:encoding:
* @Declaration : - (instancetype)initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding
* @Description : Returns an NSString object initialized using the characters in a given C array, interpreted according to a given
* encoding.
* @param nullTerminatedCString A C array of characters. The array must end with a NULL character; intermediate NULL characters are not
* allowed.
* @param encoding The encoding of nullTerminatedCString.
* @return Return Value An NSString object initialized using the characters from nullTerminatedCString. The returned object may be
* different from the original receiver
* @Discussion If nullTerminatedCString is not a NULL-terminated C string, or encoding does not match the actual encoding, the results
* are undefined.
**/
public Object initWithCStringEncoding(char[] characters, int encoding) {
Object nsString = null;
try {
nsString = this.getClass().newInstance();
CharBuffer cbuf = CharBuffer.wrap(characters);
Charset charset = (encoding != 0) ? NSStringEncoding.getCharsetFromInt(encoding)
: Charset.defaultCharset();
ByteBuffer bbuf = charset.encode(cbuf);
if (nsString instanceof NSString) {
((NSString) nsString).setWrappedString(new String(bbuf.array()));
} else if (nsString instanceof NSMutableString) {
((NSMutableString) nsString).setWrappedString(new String(bbuf.array()));
}
} catch (InstantiationException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
} catch (IllegalAccessException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return nsString;
}
public Object initWithCStringEncoding(Class clazz, char[] characters, int encoding) {
Object nsString = null;
try {
nsString = this.getClass().newInstance();
CharBuffer cbuf = CharBuffer.wrap(characters);
Charset charset = (encoding != 0) ? NSStringEncoding.getCharsetFromInt(encoding)
: Charset.defaultCharset();
ByteBuffer bbuf = charset.encode(cbuf);
if (nsString instanceof NSString) {
((NSString) nsString).setWrappedString(new String(bbuf.array()));
} else if (nsString instanceof NSMutableString) {
((NSMutableString) nsString).setWrappedString(new String(bbuf.array()));
}
} catch (InstantiationException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
} catch (IllegalAccessException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return InstanceTypeFactory.getInstance(nsString, NSString.class, clazz,
new NSString("setWrappedString"), ((NSString) nsString).getWrappedString());
}
/**
* @Signature: initWithUTF8String:
* @Declaration : - (instancetype)initWithUTF8String:(const char *)bytes
* @Description : Returns an NSString object initialized by copying the characters from a given C array of UTF8-encoded bytes.
* @param bytes A NULL-terminated C array of bytes in UTF-8 encoding. This value must not be NULL. Important:Â Raises an exception if
* bytes is NULL.
* @return Return Value An NSString object initialized by copying the bytes from bytes. The returned object may be different from the
* original receiver.
**/
public Object initWithUTF8String(char[] characters) {
// @TODO check encoding
this.wrappedString = new String(characters);
return this;
}
public Object initWithUTF8String(Class clazz, char[] characters) {
// @TODO check encoding
this.wrappedString = new String(characters);
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format, ...
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value An NSString object initialized by using format as a template into which the remaining argument values are
* substituted according to the system locale. The returned object may be different from the original receiver.
* @Discussion Invokes initWithFormat:locale:arguments: with nil as the locale, hence using the system locale to format numbers. This is
* useful, for example, if you want to produce "non-localized" formatting which needs to be written out to files and parsed
* back later.
**/
public Object initWithFormat(NSString format, Object... arg) {
if (format == null)
throw new IllegalArgumentException();
this.wrappedString = String.format(format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return this;
}
public Object initWithFormat(Class clazz, NSString format, Object... arg) {
if (format == null)
throw new IllegalArgumentException("format is null");
this.wrappedString = String.format(format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:arguments:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format arguments:(va_list)argList
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted according to the current locale.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param argList A list of arguments to substitute into format.
* @return Return Value An NSString object initialized by using format as a template into which the values in argList are substituted
* according to the current locale. The returned object may be different from the original receiver.
* @Discussion Invokes initWithFormat:locale:arguments: with nil as the locale.
**/
public Object initWithFormatArguments(NSString format, NSObject... arg) {
List<NSObject> argList = new ArrayList<NSObject>();
for (NSObject objArg : arg) {
argList.add(objArg);
}
this.wrappedString = String.format(format.getWrappedString(), argList.toArray());
return this;
}
public Object initWithFormatArguments(Class clazz, NSString format, NSObject... arg) {
List<NSObject> argList = new ArrayList<NSObject>();
for (NSObject objArg : arg) {
argList.add(objArg);
}
this.wrappedString = String.format(format.getWrappedString(), argList.toArray());
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:locale:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format locale:(id)locale, ...
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted according to given locale.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param locale An NSLocale object specifying the locale to use. To use the current locale, pass [NSLocalecurrentLocale]. To use the
* system locale, pass nil. For legacy support, this may be an instance of NSDictionary containing locale information.
* @param ... A comma-separated list of arguments to substitute into format.
* @Discussion Invokes initWithFormat:locale:arguments: with locale as the locale.
**/
public Object initWithFormatLocale(NSString format, NSLocale local, NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return this;
}
public Object initWithFormatLocale(Class clazz, NSString format, NSLocale local,
NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:locale:arguments:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format locale:(id)locale arguments:(va_list)argList
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted according to given locale information.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param locale An NSLocale object specifying the locale to use. To use the current locale (specified by user preferences), pass
* [NSLocalecurrentLocale]. To use the system locale, pass nil. For legacy support, this may be an instance of NSDictionary
* containing locale information.
* @param argList A list of arguments to substitute into format.
* @return Return Value An NSString object initialized by using format as a template into which values in argList are substituted
* according the locale information in locale. The returned object may be different from the original receiver.
* @Discussion The following code fragment illustrates how to create a string from myArgs, which is derived from a string object with
* the value “Cost:� and an int with the value 32: va_list myArgs; NSString *myString = [[NSString alloc] initWithFormat:@
* "%@: %d\n" locale:[NSLocale currentLocale] arguments:myArgs]; The resulting string has the value “Cost: 32\n�. See
* String Programming Guide for more information.
**/
public Object initWithFormatLocaleArguments(NSString format, NSLocale local, NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return this;
}
public Object initWithFormatLocaleArguments(Class clazz, NSString format, NSLocale local,
NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithData:encoding:
* @Declaration : - (instancetype)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding
* @Description : Returns an NSString object initialized by converting given data into Unicode characters using a given encoding.
* @param data An NSData object containing bytes in encoding and the default plain text format (that is, pure content with no attributes
* or other markups) for that encoding.
* @param encoding The encoding used by data.
* @return Return Value An NSString object initialized by converting the bytes in data into Unicode characters using encoding. The
* returned object may be different from the original receiver. Returns nil if the initialization fails for some reason (for
* example if data does not represent valid data for encoding).
**/
public Object initWithDataEncoding(NSData data, int encoding) {
this.wrappedString = new String(data.getWrappedData(),
NSStringEncoding.getCharsetFromInt(encoding));
return this;
}
public Object initWithDataEncoding(Class clazz, NSData data, int encoding) {
this.wrappedString = new String(data.getWrappedData(),
NSStringEncoding.getCharsetFromInt(encoding));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: stringWithFormat:
* @Declaration : + (instancetype)stringWithFormat:(NSString *)format,, ...
* @Description : Returns a string created by using a given format string as a template into which the remaining argument values are
* substituted.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value A string created by using format as a template into which the remaining argument values are substituted
* according to the system locale.
* @Discussion This method is similar to localizedStringWithFormat:, but using the system locale to format numbers. This is useful, for
* example, if you want to produce “non-localized� formatting which needs to be written out to files and parsed back later.
**/
public static NSString stringWithFormat(NSString format, Object... args) {
// not yet covered
// if (format.getWrappedString() == null) {
// throw new IllegalArgumentException("stringWithFormat : format must not be null");
// }
// // String aFormat = format.getWrappedString().replace("%@", "%s");
// // return new NSString(String.format(aFormat, args));
//
// String[] params = { "1$", "2$", "3$", "4$", "5$" };
// String mStr = format.getWrappedString();
// for (String str : params) {
// if (format.getWrappedString().indexOf(str) != -1)
// mStr = mStr.replace(str, "");
// }
//
// mStr = mStr.replaceAll("%@", "%s");
// mStr = mStr.replaceAll("ld", "d");
// mStr = mStr.replaceAll("lf", "f");
// mStr = mStr.replaceAll("lx", "d");
// mStr = mStr.replaceAll("lu", "d");
// // mStr = mStr.replaceAll("(?i)u", "d");//FIXME music ===> mdsic
// mStr = mStr.replaceAll("%%", "%c");
// mStr = mStr.replaceAll("\\.f", "f");
// mStr = mStr.replaceAll("%02i", "%02d");
// mStr = mStr.replaceAll("%i", "%d");
// return new NSString(String.format(mStr, args));
return null;
}
public static NSString stringWithFormat(Class clazz, NSString format, Object... args) {
if (format.getWrappedString() == null) {
throw new IllegalArgumentException("stringWithFormat : format must not be null");
}
String[] params = { "1$", "2$", "3$", "4$", "5$" };
String mStr = format.getWrappedString();
for (String str : params) {
if (format.getWrappedString().indexOf(str) != -1)
mStr = mStr.replace(str, "");
}
mStr = mStr.replaceAll("%@", "%s");
mStr = mStr.replaceAll("%ld", "%d");
mStr = mStr.replaceAll("%lf", "%f");
mStr = mStr.replaceAll("%lx", "%d");
mStr = mStr.replaceAll("%lu", "%d");
// convert an int32 argument
mStr = mStr.replaceAll("%li", "%d");
mStr = mStr.replaceAll("%lX", "%d");
mStr = mStr.replaceAll("%lo", "%d");
mStr = mStr.replaceAll("%lu", "%d");
// mStr = mStr.replaceAll("(?i)u", "d");//FIXME music ===> mdsic
mStr = mStr.replaceAll("%%", "%c");
mStr = mStr.replaceAll("\\.f", "%f");
mStr = mStr.replaceAll("%02i", "%02d");
mStr = mStr.replaceAll("%i", "%d");
mStr = mStr.replaceAll("%04d", "%04d");
mStr = mStr.replaceAll("%02li", "%02d");
if (args.length < 1) {
args = null;
}
NSString newstr = new NSString(String.format(mStr, args));
return (NSString) InstanceTypeFactory.getInstance(newstr, NSString.class, clazz,
new NSString("setWrappedString"), newstr.getWrappedString());
}
/**
* @Signature: localizedStringWithFormat:
* @Declaration : + (instancetype)localizedStringWithFormat:(NSString *)format, ...
* @Description : Returns a string created by using a given format string as a template into which the remaining argument values are
* substituted according to the current locale.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Raises an NSInvalidArgumentException if format is nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value A string created by using format as a template into which the following argument values are substituted
* according to the formatting information in the current locale.
* @Discussion This method is equivalent to using initWithFormat:locale: and passing the current locale as the locale argument.
**/
public static NSString localizedStringWithFormat(NSString format, NSString... args) {
NSString nsString = new NSString();
if (format == null)
throw new IllegalArgumentException();
nsString.setWrappedString(String.format(Locale.getDefault(), format.getWrappedString()));
return nsString;
}
public static NSString localizedStringWithFormat(Class clazz, NSString format,
NSString... args) {
NSString nsString = new NSString();
if (format == null)
throw new IllegalArgumentException();
nsString.setWrappedString(String.format(Locale.getDefault(), format.getWrappedString()));
return nsString;
}
/**
* @Signature: stringWithCharacters:length:
* @Declaration : + (instancetype)stringWithCharacters:(const unichar *)chars length:(NSUInteger)length
* @Description : Returns a string containing a given number of characters taken from a given C array of Unicode characters.
* @param chars A C array of Unicode characters; the value must not be NULL. Important:Â Raises an exception if chars is NULL, even if
* length is 0.
* @param length The number of characters to use from chars.
* @return Return Value A string containing length Unicode characters taken (starting with the first) from chars.
**/
public static NSString stringWithCharactersLength(char[] characters, int length) {
NSString myNSString = new NSString();
myNSString.wrappedString = new String(characters, 0, length);
return myNSString;
}
public static Object stringWithCharactersLength(Class clazz, char[] characters, int length) {
NSString myNSString = new NSString();
myNSString.wrappedString = new String(characters, 0, length);
return InstanceTypeFactory.getInstance(myNSString, NSString.class, clazz,
new NSString("setWrappedString"), myNSString.getWrappedString());
}
/**
* @Signature: stringWithString:
* @Declaration : + (instancetype)stringWithString:(NSString *)aString
* @Description : Returns a string created by copying the characters from another given string.
* @param aString The string from which to copy characters. This value must not be nil. Important:Â Raises an NSInvalidArgumentException
* if aString is nil.
* @return Return Value A string created by copying the characters from aString.
**/
public static NSString stringWithString(NSString mString) {
NSString myNSString = new NSString();
myNSString.wrappedString = mString.wrappedString;
return myNSString;
}
public static Object stringWithString(Class clazz, NSString mString) {
NSString myNSString = new NSString();
myNSString.wrappedString = mString.wrappedString;
return InstanceTypeFactory.getInstance(myNSString, NSString.class, clazz,
new NSString("setWrappedString"), myNSString.getWrappedString());
}
/**
* @Signature: stringWithCString:encoding:
* @Declaration : + (instancetype)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc
* @Description : Returns a string containing the bytes in a given C array, interpreted according to a given encoding.
* @param cString A C array of bytes. The array must end with a NULL byte; intermediate NULL bytes are not allowed.
* @param enc The encoding of cString.
* @return Return Value A string containing the characters described in cString.
* @Discussion If cString is not a NULL-terminated C string, or encoding does not match the actual encoding, the results are undefined.
**/
public static NSString stringWithCStringEncoding(char[] characters, int encoding) {
if (characters != null && characters.length > 0 && encoding != 0) {
byte bytes[] = (new String(characters))
.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
return new NSString(new String(bytes, Charset.defaultCharset()));
}
throw new IllegalArgumentException(" This value must not be null");
}
public static Object stringWithCStringEncoding(Class clazz, char[] characters, int encoding) {
if (characters != null && characters.length > 0 && encoding != 0) {
byte bytes[] = (new String(characters))
.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
NSString str = new NSString(new String(bytes, Charset.defaultCharset()));
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
throw new IllegalArgumentException(" This value must not be null");
}
/**
* @Signature: stringWithCString:encoding:
* @Declaration : + (instancetype)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc
* @Description : Returns a string containing the bytes in a given C array, interpreted according to a given encoding.
* @param cString A C array of bytes. The array must end with a NULL byte; intermediate NULL bytes are not allowed.
* @param enc The encoding of cString.
* @return Return Value A string containing the characters described in cString.
* @Discussion If cString is not a NULL-terminated C string, or encoding does not match the actual encoding, the results are undefined.
**/
public static NSString stringWithCStringEncoding(String characters, int encoding) {
if (characters != null && characters.length() > 0 && encoding != 0) {
byte bytes[] = characters.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
return new NSString(new String(bytes, Charset.defaultCharset()));
}
throw new IllegalArgumentException(" This value must not be null");
}
public static Object stringWithCStringEncoding(Class clazz, String characters, int encoding) {
if (characters != null && characters.length() > 0 && encoding != 0) {
byte bytes[] = characters.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
NSString str = new NSString(new String(bytes, Charset.defaultCharset()));
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
throw new IllegalArgumentException(" This value must not be null");
}
/**
* @Signature: stringWithUTF8String:
* @Declaration : + (instancetype)stringWithUTF8String:(const char *)bytes
* @Description : Returns a string created by copying the data from a given C array of UTF8-encoded bytes.
* @param bytes A NULL-terminated C array of bytes in UTF8 encoding. Important:Â Raises an exception if bytes is NULL.
* @return Return Value A string created by copying the data from bytes.
**/
public static NSString stringWithUTF8String(char[] string) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string);
return myNSSTring;
}
public static Object stringWithUTF8String(Class clazz, char[] string) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string);
return InstanceTypeFactory.getInstance(myNSSTring, NSString.class, clazz,
new NSString("setWrappedString"), myNSSTring.getWrappedString());
}
public static Object stringWithUTF8String(Class clazz, NSString string) {
return InstanceTypeFactory.getInstance(string, NSString.class, clazz,
new NSString("setWrappedString"), string.getWrappedString());
}
/**
* @Signature: stringWithCString:
* @Declaration : + (id)stringWithCString:(const char *)cString
* @Description : Creates a new string using a given C-string. (Deprecated in iOS 2.0. Use stringWithCString:encoding: instead.)
* @Discussion cString should contain data in the default C string encoding. If the argument passed to stringWithCString: is not a
* zero-terminated C-string, the results are undefined.
**/
public static NSString stringWithCString(char[] string) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string);
return myNSSTring;
}
/**
* @Signature: stringWithCString:length:
* @Declaration : + (id)stringWithCString:(const char *)cString length:(NSUInteger)length
* @Description : Returns a string containing the characters in a given C-string. (Deprecated in iOS 2.0. Use
* stringWithCString:encoding: instead.)
* @Discussion cString must not be NULL. cString should contain characters in the default C-string encoding. This method converts length
* * sizeof(char) bytes from cString and doesn’t stop short at a NULL character.
**/
public static NSString stringWithCStringLength(char[] string, int length) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string, 0, length);
return myNSSTring;
}
/**
* @Signature: initWithCString:
* @Declaration : - (id)initWithCString:(const char *)cString
* @Description : Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the
* default C-string encoding into the Unicode character encoding. (Deprecated in iOS 2.0. Use initWithCString:encoding:
* instead.)
* @Discussion cString must be a zero-terminated C string in the default C string encoding, and may not be NULL. Returns an initialized
* object, which might be different from the original receiver. To create an immutable string from an immutable C string
* buffer, do not attempt to use this method. Instead, use initWithCStringNoCopy:length:freeWhenDone:.
**/
public NSString initWithCString(char[] string) {
this.wrappedString = new String(string);
return this;
}
/**
* @Signature: initWithCString:length:
* @Declaration : - (id)initWithCString:(const char *)cString length:(NSUInteger)length
* @Description : Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the
* default C-string encoding into the Unicode character encoding. (Deprecated in iOS 2.0. Use
* initWithBytes:length:encoding: instead.)
* @Discussion This method converts length * sizeof(char) bytes from cString and doesn’t stop short at a zero character. cString must
* contain bytes in the default C-string encoding and may not be NULL. Returns an initialized object, which might be
* different from the original receiver.
**/
public NSString initWithCStringLength(char[] string, int length) {
this.wrappedString = new String(string, 0, length);
return this;
}
/**
* @Signature: initWithCStringNoCopy:length:freeWhenDone:
* @Declaration : - (id)initWithCStringNoCopy:(char *)cString length:(NSUInteger)length freeWhenDone:(BOOL)flag
* @Description : Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the
* default C-string encoding into the Unicode character encoding. (Deprecated in iOS 2.0. Use
* initWithBytesNoCopy:length:encoding:freeWhenDone: instead.)
* @Discussion This method converts length * sizeof(char) bytes from cString and doesn’t stop short at a zero character. cString must
* contain data in the default C-string encoding and may not be NULL. The receiver becomes the owner of cString; if flag is
* YES it will free the memory when it no longer needs it, but if flag is NO it won’t. Returns an initialized object, which
* might be different from the original receiver. You can use this method to create an immutable string from an immutable
* (const char *) C-string buffer. If you receive a warning message, you can disregard it; its purpose is simply to warn you
* that the C string passed as the method’s first argument may be modified. If you make certain the freeWhenDone argument to
* initWithStringNoCopy is NO, the C string passed as the method’s first argument cannot be modified, so you can safely use
* initWithStringNoCopy to create an immutable string from an immutable (const char *) C-string buffer.
**/
public NSString initWithCStringNoCopyLengthFreeWhenDone(char[] string, int length,
boolean freeWhenDone) {
this.wrappedString = new String(string, 0, length);
if (freeWhenDone) {
string = null;
}
return this;
}
// Creating and Initializing a String from a File
/**
* @Signature: stringWithContentsOfFile:encoding:error:
* @Declaration : + (instancetype)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns a string created by reading data from the file at a given path interpreted using a given encoding.
* @param path A path to a file.
* @param enc The encoding of the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value A string created by reading data from the file named by path using the encoding, enc. If the file can’t be
* opened or there is an encoding error, returns nil.
**/
public static NSString stringWithContentsOfFileEncodingError(NSString path, int enc,
NSError[] error) {
// TODO use Encoding
if (AndroidVersionUtils.isInteger(path.getWrappedString())) {
if (Integer.parseInt(path.getWrappedString()) == 0) {
return null;
}
int resId = Integer.parseInt(path.getWrappedString());
InputStream is = GenericMainContext.sharedContext.getResources().openRawResource(resId);
String mystring = null;
try {
mystring = AndroidIOUtils.toString(is);
AndroidIOUtils.closeQuietly(is);
return new NSString(mystring);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
return null;
}
} else if (path.getWrappedString().contains("assets ")) {
try {
String realPath = path.getWrappedString().substring("assets ".length(),
path.getWrappedString().length());
InputStream is = GenericMainContext.sharedContext.getAssets().open(realPath);
String mystring = AndroidRessourcesUtils.getStringFromInputStream(is);
return new NSString(mystring);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
return null;
}
} else {
NSString nsString = new NSString();
// get default system encoding
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
try {
File file = new File(path.getWrappedString());
String encodedString = AndroidFileUtils.readFileToString(file, encoding);
nsString.setWrappedString(encodedString);
return nsString;
} catch (FileNotFoundException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
}
return null;
}
}
public static Object stringWithContentsOfFileEncodingError(Class clazz, NSString path, int enc,
NSError[] error) {
NSString str = stringWithContentsOfFileEncodingError(path, enc, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfFile:encoding:error:
* @Declaration : - (instancetype)initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from the file at a given path using a given encoding.
* @param path A path to a file.
* @param enc The encoding of the file at path.
* @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from the file named by path using the encoding, enc. The returned
* object may be different from the original receiver. If the file can’t be opened or there is an encoding error, returns nil.
**/
public NSString initWithContentsOfFileEncodingError(NSString path, int enc, NSError[] error) {
NSString nsString = new NSString();
nsString = stringWithContentsOfFileEncodingError(path, enc, error);
return nsString;
}
public Object initWithContentsOfFileEncodingError(Class clazz, NSString path, int enc,
NSError[] error) {
NSString nsString = new NSString();
nsString = stringWithContentsOfFileEncodingError(path, enc, error);
return InstanceTypeFactory.getInstance(nsString, NSString.class, clazz,
new NSString("setWrappedString"), nsString.getWrappedString());
}
/**
* @Signature: stringWithContentsOfFile:usedEncoding:error:
* @Declaration : + (instancetype)stringWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns a string created by reading data from the file at a given path and returns by reference the encoding used to
* interpret the file.
* @param path A path to a file.
* @param enc Upon return, if the file is read successfully, contains the encoding used to interpret the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, you may pass in NULL.
* @return Return Value A string created by reading data from the file named by path. If the file can’t be opened or there is an
* encoding error, returns nil.
* @Discussion This method attempts to determine the encoding of the file at path.
**/
public static NSString stringWithContentsOfFileUsedEncodingError(NSString path, int[] enc,
NSError[] error) {
// TODO
int encBridge = 0;
if (error != null && error.length > 0) {
encBridge = enc[0];
}
return stringWithContentsOfFileEncodingError(path, encBridge, error);
}
public static Object stringWithContentsOfFileUsedEncodingError(Class clazz, NSString path,
int[] enc, NSError[] error) {
// TODO
NSString str = stringWithContentsOfFileUsedEncodingError(path, enc, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfFile:usedEncoding:error:
* @Declaration : - (instancetype)initWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from the file at a given path and returns by reference the
* encoding used to interpret the characters.
* @param path A path to a file.
* @param enc Upon return, if the file is read successfully, contains the encoding used to interpret the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from the file named by path. The returned object may be different
* from the original receiver. If the file can’t be opened or there is an encoding error, returns nil.
**/
public NSString initWithContentsOfFileUsedEncodingError(NSString path, int[] enc,
NSError[] error) {
int encodBridge = 0;
if (enc != null && enc.length > 0) {
encodBridge = enc[0];
}
return initWithContentsOfFileEncodingError(path, encodBridge, error);
}
/**
* @Signature: stringWithContentsOfFile:
* @Declaration : + (id)stringWithContentsOfFile:(NSString *)path
* @Description : Returns a string created by reading data from the file named by a given path. (Deprecated in iOS 2.0. Use
* stringWithContentsOfFile:encoding:error: or stringWithContentsOfFile:usedEncoding:error: instead.)
* @Discussion If the contents begin with a Unicode byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters.
* If the contents begin with a UTF-8 byte-order mark (EFBBBF), interprets the contents as UTF-8. Otherwise, interprets the
* contents as data in the default C string encoding. Since the default C string encoding will vary with the user’s
* configuration, do not depend on this method unless you are using Unicode or UTF-8 or you can verify the default C string
* encoding. Returns nil if the file can’t be opened.
**/
public static NSString stringWithContentsOfFile(NSString path) {
// TODO
if (AndroidVersionUtils.isInteger(path.getWrappedString())) {
if (Integer.parseInt(path.getWrappedString()) == 0) {
return null;
}
int resId = Integer.parseInt(path.getWrappedString());
InputStream is = GenericMainContext.sharedContext.getResources().openRawResource(resId);
String mystring = null;
mystring = AndroidRessourcesUtils.getStringFromInputStream(is);
return new NSString(mystring);
} else if (path.getWrappedString().contains("assets ")) {
try {
String realPath = path.getWrappedString().substring("assets ".length(),
path.getWrappedString().length());
InputStream is = GenericMainContext.sharedContext.getAssets().open(realPath);
String mystring = AndroidRessourcesUtils.getStringFromInputStream(is);
return new NSString(mystring);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
return null;
}
} else
return stringWithContentsOfFileEncodingError(path, 0, null);
}
/**
* @Signature: initWithContentsOfFile:
* @Declaration : - (id)initWithContentsOfFile:(NSString *)path
* @Description : Initializes the receiver, a newly allocated NSString object, by reading data from the file named by path. (Deprecated
* in iOS 2.0. Use initWithContentsOfFile:encoding:error: or initWithContentsOfFile:usedEncoding:error: instead.)
* @Discussion Initializes the receiver, a newly allocated NSString object, by reading data from the file named by path. If the contents
* begin with a byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters; otherwise interprets the
* contents as data in the default C string encoding. Returns an initialized object, which might be different from the
* original receiver, or nil if the file can’t be opened.
**/
public NSString initWithContentsOfFile(NSString path) {
return initWithContentsOfFileEncodingError(path, 0, null);
}
// Creating and Initializing a String from an URL
/**
* @Signature: stringWithContentsOfURL:encoding:error:
* @Declaration : + (instancetype)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns a string created by reading data from a given URL interpreted using a given encoding.
* @param url The URL to read.
* @param enc The encoding of the data at url.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, you may pass in NULL.
* @return Return Value A string created by reading data from URL using the encoding, enc. If the URL can’t be opened or there is an
* encoding error, returns nil.
**/
public static NSString stringWithContentsOfURLEncodingError(NSURL url, int enc,
NSError[] error) {
String encoding = Charset.defaultCharset().name();
NSString nsString = null;
try {
BufferedReader in = new BufferedReader(
new InputStreamReader(url.getUrl().openStream()));
StringBuilder strBuilder = new StringBuilder();
String str;
while ((str = in.readLine()) != null) {
strBuilder.append(str);
}
in.close();
nsString = new NSString();
nsString.wrappedString = new String(strBuilder.toString().getBytes(), encoding);
} catch (MalformedURLException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
} catch (IOException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
}
return nsString;
}
public static Object stringWithContentsOfURLEncodingError(Class clazz, final NSURL url,
final int enc, final NSError[] error) {
AsyncTask task = new AsyncTask<NSString, Void, NSString>() {
@Override
protected NSString doInBackground(NSString... param) {
NSString str = stringWithContentsOfURLEncodingError(url, enc, error);
return str;
}
@Override
protected void onPostExecute(NSString str) {
super.onPostExecute(str);
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
};
NSString str = new NSString("");
try {
str = (NSString) task.execute(new NSString[] {}).get();
} catch (Exception ex) {
LOGGER.info(String.valueOf(ex));
}
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfURL:encoding:error:
* @Declaration : - (instancetype)initWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from a given URL interpreted using a given encoding.
* @param url The URL to read.
* @param enc The encoding of the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from url. The returned object may be different from the original
* receiver. If the URL can’t be opened or there is an encoding error, returns nil.
**/
public NSString initWithContentsOfURLEncodingError(NSURL url, int encoding, NSError[] error) {
return stringWithContentsOfURLEncodingError(url, encoding, error);
}
public Object initWithContentsOfURLEncodingError(Class clazz, NSURL url, int encoding,
NSError[] error) {
NSString str = stringWithContentsOfURLEncodingError(url, encoding, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: stringWithContentsOfURL:usedEncoding:error:
* @Declaration : + (instancetype)stringWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns a string created by reading data from a given URL and returns by reference the encoding used to interpret the
* data.
* @param url The URL from which to read data.
* @param enc Upon return, if url is read successfully, contains the encoding used to interpret the data.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, you may pass in NULL.
* @return Return Value A string created by reading data from url. If the URL can’t be opened or there is an encoding error, returns
* nil.
* @Discussion This method attempts to determine the encoding at url.
**/
public static NSString stringWithContentsOfURLUsedEncodingError(NSURL url, int[] usedEncoding,
NSError[] error) {
return new NSString().initWithContentsOfURLUsedEncodingError(url, usedEncoding, error);
}
public static Object stringWithContentsOfURLUsedEncodingError(Class clazz, NSURL url,
int[] usedEncoding, NSError[] error) {
NSString str = new NSString().initWithContentsOfURLUsedEncodingError(url, usedEncoding,
error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfURL:usedEncoding:error:
* @Declaration : - (instancetype)initWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from a given URL and returns by reference the encoding used to
* interpret the data.
* @param url The URL from which to read data.
* @param enc Upon return, if url is read successfully, contains the encoding used to interpret the data.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from url. If url can’t be opened or the encoding cannot be
* determined, returns nil. The returned initialized object might be different from the original receiver
* @Discussion To read data with an unknown encoding, pass 0 as the enc parameter as in: NSURL *textFileURL = …; NSStringEncoding
* encoding = 0; NSError *error = nil; NSString *string = [[NSString alloc] initWithContentsOfURL:textFileURL
* usedEncoding:&encoding error:&error];
**/
public NSString initWithContentsOfURLUsedEncodingError(NSURL url, int[] enc, NSError[] error) {
int bridgeEncoding = 0;
if (enc != null && enc.length > 0) {
bridgeEncoding = enc[0];
} else {
bridgeEncoding = 2;// default
}
return initWithContentsOfURLEncodingError(url, bridgeEncoding, error);
}
public Object initWithContentsOfURLUsedEncodingError(Class clazz, NSURL url, int[] enc,
NSError[] error) {
NSString str = initWithContentsOfURLUsedEncodingError(url, enc, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: stringWithContentsOfURL:
* @Declaration : + (id)stringWithContentsOfURL:(NSURL *)aURL
* @Description : Returns a string created by reading data from the file named by a given URL. (Deprecated in iOS 2.0. Use
* stringWithContentsOfURL:encoding:error: or stringWithContentsOfURL:usedEncoding:error: instead.)
* @Discussion If the contents begin with a byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters. If the
* contents begin with a UTF-8 byte-order mark (EFBBBF), interprets the contents as UTF-8. Otherwise interprets the contents
* as data in the default C string encoding. Since the default C string encoding will vary with the user’s configuration, do
* not depend on this method unless you are using Unicode or UTF-8 or you can verify the default C string encoding. Returns
* nil if the location can’t be opened.
**/
public NSString stringWithContentsOfURL(NSURL aURL) {
return stringWithContentsOfURLUsedEncodingError(aURL, null, null);
}
/**
* @Signature: initWithContentsOfURL:
* @Declaration : - (id)initWithContentsOfURL:(NSURL *)aURL
* @Description : Initializes the receiver, a newly allocated NSString object, by reading data from the location named by a given URL.
* (Deprecated in iOS 2.0. Use initWithContentsOfURL:encoding:error: or initWithContentsOfURL:usedEncoding:error: instead.)
* @Discussion Initializes the receiver, a newly allocated NSString object, by reading data from the location named by aURL. If the
* contents begin with a byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters; otherwise
* interprets the contents as data in the default C string encoding. Returns an initialized object, which might be different
* from the original receiver, or nil if the location can’t be opened.
**/
public NSString initWithContentsOfURL(NSURL aURL) {
return initWithContentsOfURLUsedEncodingError(aURL, null, null);
}
/**
* @Signature: writeToFile:atomically:encoding:error:
* @Declaration : - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError
* **)error
* @Description : Writes the contents of the receiver to a file at a given path using a given encoding.
* @param path The file to which to write the receiver. If path contains a tilde (~) character, you must expand it with
* stringByExpandingTildeInPath before invoking this method.
* @param useAuxiliaryFile If YES, the receiver is written to an auxiliary file, and then the auxiliary file is renamed to path. If NO,
* the receiver is written directly to path. The YES option guarantees that path, if it exists at all, won’t be corrupted
* even if the system should crash during writing.
* @param enc The encoding to use for the output.
* @param error If there is an error, upon return contains an NSError object that describes the problem. If you are not interested in
* details of errors, you may pass in NULL.
* @return Return Value YES if the file is written successfully, otherwise NO (if there was a problem writing to the file or with the
* encoding).
* @Discussion This method overwrites any existing file at path. This method stores the specified encoding with the file in an extended
* attribute under the name com.apple.TextEncoding. The value contains the IANA name for the encoding and the
* CFStringEncoding value for the encoding, separated by a semicolon. The CFStringEncoding value is written as an ASCII
* string containing an unsigned 32-bit decimal integer and is not terminated by a null character. One or both of these
* values may be missing.
**/
public boolean writeToFileAtomicallyEncodingError(NSString path, boolean useAuxiliaryFile,
int enc, NSError[] error) {
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
File file = new File(path.getWrappedString());
if (file.isFile() && file.canWrite()) {
FileOutputStream fileos;
try {
fileos = new FileOutputStream(path.getWrappedString());
AndroidIOUtils.write(wrappedString, fileos, encoding);
return true;
} catch (FileNotFoundException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
}
}
return false;
}
/**
* @Signature: writeToURL:atomically:encoding:error:
* @Declaration : - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError
* **)error
* @Description : Writes the contents of the receiver to the URL specified by url using the specified encoding.
* @param url The URL to which to write the receiver. Only file URLs are supported.
* @param useAuxiliaryFile If YES, the receiver is written to an auxiliary file, and then the auxiliary file is renamed to url. If NO,
* the receiver is written directly to url. The YES option guarantees that url, if it exists at all, won’t be corrupted even
* if the system should crash during writing. The useAuxiliaryFile parameter is ignored if url is not of a type that can be
* accessed atomically.
* @param enc The encoding to use for the output.
* @param error If there is an error, upon return contains an NSError object that describes the problem. If you are not interested in
* details of errors, you may pass in NULL.
* @return Return Value YES if the URL is written successfully, otherwise NO (if there was a problem writing to the URL or with the
* encoding).
* @Discussion This method stores the specified encoding with the file in an extended attribute under the name com.apple.TextEncoding.
* The value contains the IANA name for the encoding and the CFStringEncoding value for the encoding, separated by a
* semicolon. The CFStringEncoding value is written as an ASCII string containing an unsigned 32-bit decimal integer and is
* not terminated by a null character. One or both of these values may be missing. Examples of the value written include the
* following: MACINTOSH;0 UTF-8;134217984 UTF-8; ;3071 The methods initWithContentsOfFile:usedEncoding:error:,
* initWithContentsOfURL:usedEncoding:error:, stringWithContentsOfFile:usedEncoding:error:, and
* stringWithContentsOfURL:usedEncoding:error: use this information to open the file using the right encoding. Note:Â In the
* future this attribute may be extended compatibly by adding additional information after what's there now, so any readers
* should be prepared for an arbitrarily long value for this attribute, with stuff following the CFStringEncoding value,
* separated by a non-digit.
**/
public boolean writeToURLAtomicallyEncodingError(NSURL url, boolean useAuxiliaryFile, int enc,
NSError[] error) {
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
FileOutputStream fileos;
try {
fileos = new FileOutputStream(url.path().wrappedString);
AndroidIOUtils.write(wrappedString, fileos, encoding);
return true;
} catch (FileNotFoundException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
} catch (IOException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
}
return false;
}
/**
* @Signature: writeToFile:atomically:
* @Declaration : - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
* @Description : Writes the contents of the receiver to the file specified by a given path. (Deprecated in iOS 2.0. Use
* writeToFile:atomically:encoding:error: instead.)
* @return Return Value YES if the file is written successfully, otherwise NO.
* @Discussion Writes the contents of the receiver to the file specified by path (overwriting any existing file at path). path is
* written in the default C-string encoding if possible (that is, if no information would be lost), in the Unicode encoding
* otherwise. If flag is YES, the receiver is written to an auxiliary file, and then the auxiliary file is renamed to path.
* If flag is NO, the receiver is written directly to path. The YES option guarantees that path, if it exists at all, won’t
* be corrupted even if the system should crash during writing. If path contains a tilde (~) character, you must expand it
* with stringByExpandingTildeInPath before invoking this method.
**/
public void writeToFileAtomically(NSString path, boolean atomically) {
writeToFileAtomicallyEncodingError(path, atomically, 0, null);
}
/**
* @Signature: writeToURL:atomically:
* @Declaration : - (BOOL)writeToURL:(NSURL *)aURL atomically:(BOOL)atomically
* @Description : Writes the contents of the receiver to the location specified by a given URL. (Deprecated in iOS 2.0. Use
* writeToURL:atomically:encoding:error: instead.)
* @return Return Value YES if the location is written successfully, otherwise NO.
* @Discussion If atomically is YES, the receiver is written to an auxiliary location, and then the auxiliary location is renamed to
* aURL. If atomically is NO, the receiver is written directly to aURL. The YES option guarantees that aURL, if it exists at
* all, won’t be corrupted even if the system should crash during writing. The atomically parameter is ignored if aURL is
* not of a type that can be accessed atomically.
**/
public void writeToURLAtomically(NSURL url, boolean atomically) {
writeToURLAtomicallyEncodingError(url, atomically, 0, null);
}
// Getting Characters and Bytes
/**
* @Signature: characterAtIndex:
* @Declaration : - (unichar)characterAtIndex:(NSUInteger)index
* @Description : Returns the character at a given array position.
* @param index The index of the character to retrieve. The index value must not lie outside the bounds of the receiver.
* @return Return Value The character at the array position given by index.
* @Discussion Raises an NSRangeException if index lies beyond the end of the receiver.
**/
public char characterAtIndex(int index) {
return wrappedString.charAt(index);
}
/**
* @Signature: getCharacters:range:
* @Declaration : - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange
* @Description : Copies characters from a given range in the receiver into a given buffer.
* @param buffer Upon return, contains the characters from the receiver. buffer must be large enough to contain the characters in the
* range aRange (aRange.length*sizeof(unichar)).
* @param aRange The range of characters to retrieve. The range must not exceed the bounds of the receiver. Important:Â Raises an
* NSRangeException if any part of aRange lies beyond the bounds of the receiver.
* @Discussion This method does not add a NULL character. The abstract implementation of this method uses characterAtIndex: repeatedly,
* correctly extracting the characters, though very inefficiently. Subclasses should override it to provide a fast
* implementation.
**/
public void getCharactersRange(CharBuffer[] buffer, NSRange aRange) {
if (buffer != null && buffer.length > 0) {
buffer[0] = CharBuffer.allocate(aRange.length);
buffer[0].append(wrappedString.subSequence(aRange.location, aRange.length));
}
}
/**
* @Signature: getBytes:maxLength:usedLength:encoding:options:range:remainingRange:
* @Declaration : - (BOOL)getBytes:(void *)buffer maxLength:(NSUInteger)maxBufferCount usedLength:(NSUInteger *)usedBufferCount
* encoding:(NSStringEncoding)encoding options:(NSStringEncodingConversionOptions)options range:(NSRange)range
* remainingRange:(NSRangePointer)leftover
* @Description : Gets a given range of characters as bytes in a specified encoding.
* @param buffer A buffer into which to store the bytes from the receiver. The returned bytes are not NULL-terminated.
* @param maxBufferCount The maximum number of bytes to write to buffer.
* @param usedBufferCount The number of bytes used from buffer. Pass NULL if you do not need this value.
* @param encoding The encoding to use for the returned bytes.
* @param options A mask to specify options to use for converting the receiver’s contents to encoding (if conversion is necessary).
* @param range The range of characters in the receiver to get.
* @param leftover The remaining range. Pass NULL If you do not need this value.
* @return Return Value YES if some characters were converted, otherwise NO.
* @Discussion Conversion might stop when the buffer fills, but it might also stop when the conversion isn't possible due to the chosen
* encoding.
**/
public boolean getBytesMaxLengthUsedLengthEncodingOptionsRangeRemainingRange(ByteBuffer buffer,
int maxBufferCount, int usedBufferCount, int enc,
NSStringEncodingConversionOptions options, NSRange range, NSRangePointer leftover) {
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
buffer = (maxBufferCount == 0) ? ByteBuffer.allocate(wrappedString.length())
: ByteBuffer.allocate(maxBufferCount);
try {
byte[] result = new String(
wrappedString.substring(range.location, range.length).getBytes(), encoding)
.getBytes();
buffer.put(result);
return true;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return false;
}
/**
* @Signature: getCharacters:
* @Declaration : - (void)getCharacters:(unichar *)buffer
* @Description : Copies all characters from the receiver into a given buffer. (Deprecated in iOS 4.0. This method is unsafe because it
* could potentially cause buffer overruns. Use getCharacters:range: instead.)
* @param buffer Upon return, contains the characters from the receiver. buffer must be large enough to contain all characters in the
* string ([string length]*sizeof(unichar)).
* @Discussion Invokes getCharacters:range: with buffer and the entire extent of the receiver as the range.
**/
public void getCharacters(char[] buffer) {
buffer = wrappedString.toCharArray();
}
// Combining Strings
/**
* @Signature: stringByAppendingFormat:
* @Declaration : - (NSString *)stringByAppendingFormat:(NSString *)format, ...
* @Description : Returns a string made by appending to the receiver a string constructed from a given format string and the following
* arguments.
* @param format A format string. See “Formatting String Objects� for more information. This value must not be nil. Important: Raises an
* NSInvalidArgumentException if format is nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value A string made by appending to the receiver a string constructed from format and the following arguments, in the
* manner of stringWithFormat:.
**/
public NSString stringByAppendingFormat(NSString format, Object... args) {
StringBuilder strBuilder = new StringBuilder(wrappedString);
if (format == null)
throw new IllegalArgumentException(" This value must not be null");
strBuilder.append(String.format(format.getWrappedString(), args));
this.setWrappedString(strBuilder.toString());
return this;
}
/**
* @Signature: stringByAppendingString:
* @Declaration : - (NSString *)stringByAppendingString:(NSString *)aString
* @Description : Returns a new string made by appending a given string to the receiver.
* @param aString The string to append to the receiver. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if
* aString is nil.
* @return Return Value A new string made by appending aString to the receiver.
* @Discussion This code excerpt, for example: NSString *errorTag = @"Error: "; NSString *errorString = @"premature end of file.";
* NSString *errorMessage = [errorTag stringByAppendingString:errorString]; produces the string “Error: premature end of
* file.�.
**/
public NSString stringByAppendingString(NSString mString) {
StringBuilder strBuilder = new StringBuilder(this.wrappedString);
if (strBuilder == null)
throw new IllegalArgumentException(" This value must not be null ");
return new NSString(strBuilder.append(mString.getWrappedString()).toString());
}
/**
* @Signature: stringByPaddingToLength:withString:startingAtIndex:
* @Declaration : - (NSString *)stringByPaddingToLength:(NSUInteger)newLength withString:(NSString *)padString
* startingAtIndex:(NSUInteger)padIndex
* @Description : Returns a new string formed from the receiver by either removing characters from the end, or by appending as many
* occurrences as necessary of a given pad string.
* @param newLength The new length for the receiver.
* @param padString The string with which to extend the receiver.
* @param padIndex The index in padString from which to start padding.
* @return Return Value A new string formed from the receiver by either removing characters from the end, or by appending as many
* occurrences of padString as necessary.
* @Discussion Here are some examples of usage: [@"abc" stringByPaddingToLength: 9 withString: @"." startingAtIndex:0]; // Results in
* "abc......" [@"abc" stringByPaddingToLength: 2 withString: @"." startingAtIndex:0]; // Results in "ab" [@"abc"
* stringByPaddingToLength: 9 withString: @". " startingAtIndex:1]; // Results in "abc . . ." // Notice that the first
* character in the padding is " "
**/
public NSString stringByPaddingToLengthWithStringStartingAtIndex(int newLength,
NSString padString, int padIndex) {
return new NSString(
(wrappedString.length() < newLength ? wrappedString + padString : wrappedString)
.substring(0, newLength));
}
// Finding Characters and Substrings
/**
* @Signature: rangeOfCharacterFromSet:
* @Declaration : - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet
* @Description : Finds and returns the range in the receiver of the first character from a given character set.
* @param aSet A character set. This value must not be nil. Raises an NSInvalidArgumentException if aSet is nil.
* @return Return Value The range in the receiver of the first character found from aSet. Returns a range of {NSNotFound, 0} if none of
* the characters in aSet are found.
* @Discussion Invokes rangeOfCharacterFromSet:options: with no options.
**/
public NSRange rangeOfCharacterFromSet(NSCharacterSet aSet) {
return rangeOfCharacterFromSetOptionsRange(aSet,
NSStringCompareOptions.NSCaseInsensitiveSearch, null);
}
/**
* @Signature: rangeOfCharacterFromSet:options:
* @Declaration : - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask
* @Description : Finds and returns the range in the receiver of the first character, using given options, from a given character set.
* @param aSet A character set. This value must not be nil. Raises an NSInvalidArgumentException if aSet is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSAnchoredSearch, NSBackwardsSearch.
* @return Return Value The range in the receiver of the first character found from aSet. Returns a range of {NSNotFound, 0} if none of
* the characters in aSet are found.
* @Discussion Invokes rangeOfCharacterFromSet:options:range: with mask for the options and the entire extent of the receiver for the
* range.
**/
public NSRange rangeOfCharacterFromSetOptions(NSCharacterSet aSet,
NSStringCompareOptions mask) {
return rangeOfCharacterFromSetOptionsRange(aSet, mask, null);
}
/**
* @Signature: rangeOfCharacterFromSet:options:range:
* @Declaration : - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask range:(NSRange)aRange
* @Description : Finds and returns the range in the receiver of the first character from a given character set found in a given range
* with given options.
* @param aSet A character set. This value must not be nil. Raises an NSInvalidArgumentException if aSet is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSAnchoredSearch, NSBackwardsSearch.
* @param aRange The range in which to search. aRange must not exceed the bounds of the receiver. Raises an NSRangeException if aRange
* is invalid.
* @return Return Value The range in the receiver of the first character found from aSet within aRange. Returns a range of {NSNotFound,
* 0} if none of the characters in aSet are found.
* @Discussion Because pre-composed characters in aSet can match composed character sequences in the receiver, the length of the
* returned range can be greater than 1. For example, if you search for “ü� in the string “stru¨del�, the returned range is
* {3,2}.
**/
public NSRange rangeOfCharacterFromSetOptionsRange(NSCharacterSet aSet,
NSStringCompareOptions mask, NSRange aRange) {
if (aSet == null)
throw new IllegalArgumentException(" This value must not be null ");
NSRange nsRange = new NSRange(0, 0);
int indexOfMatch = -1;
if (aSet.getCharacterSet() == null || wrappedString.isEmpty()
|| aSet.getCharacterSet().isEmpty()) {
return nsRange;
}
// check invertedSet if set
if (aSet.getInvertedSet() != null) {
while (aSet.getInvertedSet().iterator().hasNext()) {
if ((indexOfMatch = wrappedString
.indexOf(aSet.getInvertedSet().iterator().next())) == -1) {
nsRange.location = NSObjCRuntime.NSNotFound;
return nsRange;
}
}
}
while (aSet.getCharacterSet().iterator().hasNext()) {
if ((indexOfMatch = wrappedString
.indexOf(aSet.getCharacterSet().iterator().next())) != -1) {
nsRange.location = indexOfMatch;
return nsRange;
}
}
return nsRange;
}
/**
* @Signature: rangeOfString:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString
* @Description : Finds and returns the range of the first occurrence of a given string within the receiver.
* @param aString The string to search for. This value must not be nil. Raises an NSInvalidArgumentException if aString is nil.
* @return Return Value An NSRange structure giving the location and length in the receiver of the first occurrence of aString. Returns
* {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion Invokes rangeOfString:options: with no options.
**/
public NSRange rangeOfString(NSString mString) {
NSRange range = new NSRange();
if (!this.getWrappedString().contains(mString.getWrappedString()))
range.location = NSObjCRuntime.NSNotFound;
else {
NSRange searchRange = NSRange.NSMakeRange(0, wrappedString.length());
range = rangeOfStringOptionsRangeLocale(mString,
NSStringCompareOptions.NSCaseInsensitiveSearch, searchRange, null);
}
return range;
}
/**
* @Signature: rangeOfString:options:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask
* @Description : Finds and returns the range of the first occurrence of a given string within the receiver, subject to given options.
* @param aString The string to search for. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if aString is
* nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSBackwardsSearch, NSAnchoredSearch. See String Programming Guide for
* details on these options.
* @return Return Value An NSRange structure giving the location and length in the receiver of the first occurrence of aString, modulo
* the options in mask. Returns {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion Invokes rangeOfString:options:range: with the options specified by mask and the entire extent of the receiver as the
* range.
**/
public NSRange rangeOfStringOptions(NSString mString, NSStringCompareOptions mask) {
return rangeOfStringOptionsRangeLocale(mString, mask, null, null);
}
/**
* @Signature: rangeOfString:options:range:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)aRange
* @Description : Finds and returns the range of the first occurrence of a given string, within the given range of the receiver, subject
* to given options.
* @param aString The string for which to search. This value must not be nil. Raises an NSInvalidArgumentException if aString is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSBackwardsSearch, and NSAnchoredSearch. See String Programming Guide
* for details on these options.
* @param aRange The range within the receiver for which to search for aString. Raises an NSRangeException if aRange is invalid.
* @return Return Value An NSRange structure giving the location and length in the receiver of aString within aRange in the receiver,
* modulo the options in mask. The range returned is relative to the start of the string, not to the passed-in range. Returns
* {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion The length of the returned range and that of aString may differ if equivalent composed character sequences are matched.
**/
public NSRange rangeOfStringOptionsRange(NSCharacterSet aSet, NSStringCompareOptions mask,
NSRange aRange) {
// TODO
NSRange nsRange = new NSRange(0, 0);
final Pattern pattern = Pattern.compile("[" + Pattern.quote(wrappedString) + "]");
final Matcher matcher = pattern.matcher(wrappedString);
return nsRange;
}
/**
* @Signature: rangeOfString:options:range:locale:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)searchRange
* locale:(NSLocale *)locale
* @Description : Finds and returns the range of the first occurrence of a given string within a given range of the receiver, subject to
* given options, using the specified locale, if any.
* @param aString The string for which to search. This value must not be nil. Raises an NSInvalidArgumentException if aString is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSBackwardsSearch, and NSAnchoredSearch. See String Programming Guide
* for details on these options.
* @param aRange The range within the receiver for which to search for aString. Raises an NSRangeException if aRange is invalid.
* @param locale The locale to use when comparing the receiver with aString. To use the current locale, pass [NSLocalecurrentLocale]. To
* use the system locale, pass nil. The locale argument affects the equality checking algorithm. For example, for the Turkish
* locale, case-insensitive compare matches “I� to “ı� (Unicode code point U+0131, Latin Small Dotless I), not the normal “i�
* character.
* @return Return Value An NSRange structure giving the location and length in the receiver of aString within aRange in the receiver,
* modulo the options in mask. The range returned is relative to the start of the string, not to the passed-in range. Returns
* {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion The length of the returned range and that of aString may differ if equivalent composed character sequences are matched.
**/
public NSRange rangeOfStringOptionsRangeLocale(NSString aString, NSStringCompareOptions mask,
NSRange searchRange, Locale locale) {
NSRange nsRange = new NSRange(0, 0);
Locale defaultLocale;
if (aString == null)
throw new IllegalArgumentException("This value must not be nil.");
if (locale == null)
defaultLocale = Locale.getDefault();
else
defaultLocale = locale;
String receiverRangeString = new String(
getWrappedString().substring(searchRange.location, searchRange.length));
receiverRangeString = String.format(defaultLocale, "%s", receiverRangeString);
aString = new NSString(String.format(defaultLocale, "%s", aString));
if (AndroidStringUtils.contains(receiverRangeString, aString.getWrappedString())) {
nsRange.location = AndroidStringUtils.indexOf(receiverRangeString,
aString.getWrappedString());
nsRange.length = aString.getLength();
}
return nsRange;
}
/**
* @Signature: enumerateLinesUsingBlock:
* @Declaration : - (void)enumerateLinesUsingBlock:(void (^)(NSString *line, BOOL *stop))block
* @Description : Enumerates all the lines in a string.
* @param block The block executed for the enumeration. The block takes two arguments: line The current line of the string being
* enumerated. The line contains just the contents of the line, without the line terminators. See
* getLineStart:end:contentsEnd:forRange: for a discussion of line terminators. stop A reference to a Boolean value that the
* block can use to stop the enumeration by setting *stop = YES; it should not touch *stop otherwise.
* @param line The current line of the string being enumerated. The line contains just the contents of the line, without the line
* terminators. See getLineStart:end:contentsEnd:forRange: for a discussion of line terminators.
* @param stop A reference to a Boolean value that the block can use to stop the enumeration by setting *stop = YES; it should not touch
* *stop otherwise.
**/
public void enumerateLinesUsingBlock(PerformBlock.VoidBlockNSStringNSRangeNSRangeBOOL block) {
boolean[] stop = new boolean[1];
String lineSeparator = System.getProperty("line.separator");
Matcher m = Pattern.compile(lineSeparator).matcher(wrappedString);
NSString nLine = new NSString();
while (m.find()) {
nLine.wrappedString = m.group();
block.perform(nLine, stop);
}
}
/**
* @Signature: enumerateSubstringsInRange:options:usingBlock:
* @Declaration : - (void)enumerateSubstringsInRange:(NSRange)range options:(NSStringEnumerationOptions)opts usingBlock:(void
* (^)(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop))block
* @Description : Enumerates the substrings of the specified type in the specified range of the string.
* @param range The range within the string to enumerate substrings.
* @param opts Options specifying types of substrings and enumeration styles.
* @param block The block executed for the enumeration. The block takes four arguments: substring The enumerated string. substringRange
* The range of the enumerated string in the receiver. enclosingRange The range that includes the substring as well as any
* separator or filler characters that follow. For instance, for lines, enclosingRange contains the line terminators. The
* enclosingRange for the first string enumerated also contains any characters that occur before the string. Consecutive
* enclosing ranges are guaranteed not to overlap, and every single character in the enumerated range is included in one and
* only one enclosing range. stop A reference to a Boolean value that the block can use to stop the enumeration by setting
* *stop = YES; it should not touch *stop otherwise.
* @param substring The enumerated string.
* @param substringRange The range of the enumerated string in the receiver.
* @param enclosingRange The range that includes the substring as well as any separator or filler characters that follow. For instance,
* for lines, enclosingRange contains the line terminators. The enclosingRange for the first string enumerated also contains
* any characters that occur before the string. Consecutive enclosing ranges are guaranteed not to overlap, and every single
* character in the enumerated range is included in one and only one enclosing range.
* @param stop A reference to a Boolean value that the block can use to stop the enumeration by setting *stop = YES; it should not touch
* *stop otherwise.
* @Discussion If this method is sent to an instance of NSMutableString, mutation (deletion, addition, or change) is allowed, as long as
* it is within enclosingRange. After a mutation, the enumeration continues with the range immediately following the
* processed range, after the length of the processed range is adjusted for the mutation. (The enumerator assumes any change
* in length occurs in the specified range.) For example, if the block is called with a range starting at location N, and
* the block deletes all the characters in the supplied range, the next call will also pass N as the index of the range.
* This is the case even if mutation of the previous range changes the string in such a way that the following substring
* would have extended to include the already enumerated range. For example, if the string "Hello World" is enumerated via
* words, and the block changes "Hello " to "Hello", thus forming "HelloWorld", the next enumeration will return "World"
* rather than "HelloWorld".
**/
public void enumerateSubstringsInRangeOptionsUsingBlock(NSRange range,
NSStringEnumerationOptions opts,
PerformBlock.VoidBlockNSStringNSRangeNSRangeBOOL block) {
// not yet covered
}
// Determining Line and Paragraph Ranges
/**
* @Signature: getLineStart:end:contentsEnd:forRange:
* @Declaration : - (void)getLineStart:(NSUInteger *)startIndex end:(NSUInteger *)lineEndIndex contentsEnd:(NSUInteger
* *)contentsEndIndex forRange:(NSRange)aRange
* @Description : Returns by reference the beginning of the first line and the end of the last line touched by the given range.
* @param startIndex Upon return, contains the index of the first character of the line containing the beginning of aRange. Pass NULL if
* you do not need this value (in which case the work to compute the value isn’t performed).
* @param lineEndIndex Upon return, contains the index of the first character past the terminator of the line containing the end of
* aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param contentsEndIndex Upon return, contains the index of the first character of the terminator of the line containing the end of
* aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param aRange A range within the receiver. The value must not exceed the bounds of the receiver. Raises an NSRangeException if aRange
* is invalid.
* @Discussion A line is delimited by any of these characters, the longest possible sequence being preferred to any shorter: U+000D (\r
* or CR) U+2028 (Unicode line separator) U+000A (\n or LF) U+2029 (Unicode paragraph separator) \r\n, in that order (also
* known as CRLF) If aRange is contained with a single line, of course, the returned indexes all belong to that line. You
* can use the results of this method to construct ranges for lines by using the start index as the range’s location and the
* difference between the end index and the start index as the range’s length.
**/
public void getLineStartEndContentsEndForRange(int[] startIndex, int[] lineEndIndex,
int[] contentsEndIndex, NSRange aRange) {
// not yet covered
}
/**
* @Signature: lineRangeForRange:
* @Declaration : - (NSRange)lineRangeForRange:(NSRange)aRange
* @Description : Returns the range of characters representing the line or lines containing a given range.
* @param aRange A range within the receiver. The value must not exceed the bounds of the receiver.
* @return Return Value The range of characters representing the line or lines containing aRange, including the line termination
* characters. See getLineStart:end:contentsEnd:forRange: for a discussion of line terminators.
**/
public NSRange lineRangeForRange(NSRange aRange) {
// not yet covered
return null;
}
/**
* @Signature: getParagraphStart:end:contentsEnd:forRange:
* @Declaration : - (void)getParagraphStart:(NSUInteger *)startIndex end:(NSUInteger *)endIndex contentsEnd:(NSUInteger
* *)contentsEndIndex forRange:(NSRange)aRange
* @Description : Returns by reference the beginning of the first paragraph and the end of the last paragraph touched by the given
* range.
* @param startIndex Upon return, contains the index of the first character of the paragraph containing the beginning of aRange. Pass
* NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param endIndex Upon return, contains the index of the first character past the terminator of the paragraph containing the end of
* aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param contentsEndIndex Upon return, contains the index of the first character of the terminator of the paragraph containing the end
* of aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param aRange A range within the receiver. The value must not exceed the bounds of the receiver.
* @Discussion If aRange is contained with a single paragraph, of course, the returned indexes all belong to that paragraph. Similar to
* getLineStart:end:contentsEnd:forRange:, you can use the results of this method to construct the ranges for paragraphs.
**/
public void getParagraphStartEndContentsEndForRange(int[] startIndex, int[] endIndex,
int[] contentsEndIndex, NSRange aRange) {
// not yet covered
}
/**
* @Signature: paragraphRangeForRange:
* @Declaration : - (NSRange)paragraphRangeForRange:(NSRange)aRange
* @Description : Returns the range of characters representing the paragraph or paragraphs containing a given range.
* @param aRange A range within the receiver. The range must not exceed the bounds of the receiver.
* @return Return Value The range of characters representing the paragraph or paragraphs containing aRange, including the paragraph
* termination characters.
**/
public NSRange paragraphRangeForRange(NSRange aRange) {
// not yet covered
return null;
}
// Converting String Contents Into a Property List
/**
* @Signature: propertyList
* @Declaration : - (id)propertyList
* @Description : Parses the receiver as a text representation of a property list, returning an NSString, NSData, NSArray, or
* NSDictionary object, according to the topmost element.
* @return Return Value A property list representation of returning an NSString, NSData, NSArray, or NSDictionary object, according to
* the topmost element.
* @Discussion The receiver must contain a string in a property list format. For a discussion of property list formats, see Property
* List Programming Guide. Important:Â Raises an NSParseErrorException if the receiver cannot be parsed as a property list.
**/
public void propertyList() {
// not yet covered
}
/**
* @Signature: propertyListFromStringsFileFormat
* @Declaration : - (NSDictionary *)propertyListFromStringsFileFormat
* @Description : Returns a dictionary object initialized with the keys and values found in the receiver.
* @return Return Value A dictionary object initialized with the keys and values found in the receiver
* @Discussion The receiver must contain text in the format used for .strings files. In this format, keys and values are separated by an
* equal sign, and each key-value pair is terminated with a semicolon. The value is optional—if not present, the equal sign
* is also omitted. The keys and values themselves are always strings enclosed in straight quotation marks.
**/
public NSDictionary propertyListFromStringsFileFormat() {
// not yet covered
return null;
}
// Folding Strings
/**
* @Signature: stringByFoldingWithOptions:locale:
* @Declaration : - (NSString *)stringByFoldingWithOptions:(NSStringCompareOptions)options locale:(NSLocale *)locale
* @Description : Returns a string with the given character folding options applied.
* @param options A mask of compare flags with a suffix InsensitiveSearch.
* @param locale The locale to use for the folding. To use the current locale, pass [NSLocalecurrentLocale]. To use the system locale,
* pass nil.
* @return Return Value A string with the character folding options applied.
* @Discussion Character folding operations remove distinctions between characters. For example, case folding may replace uppercase
* letters with their lowercase equivalents. The locale affects the folding logic. For example, for the Turkish locale,
* case-insensitive compare matches “I� to “ı� (Unicode code point U+0131, Latin Small Dotless I), not the normal “i�
* character.
**/
public String stringByFoldingWithOptionsLocale(NSStringCompareOptions options, Locale locale) {
return Normalizer.normalize(wrappedString, Normalizer.Form.NFD);
}
// Changing Case
/**
* @Declaration : @property (readonly, copy) NSString *capitalizedString
* @Description : A capitalized representation of the receiver. (read-only)
* @Discussion A string with the first character in each word changed to its corresponding uppercase value, and all remaining characters
* set to their corresponding lowercase values. A “word� is any sequence of characters delimited by spaces, tabs, or line
* terminators (listed under getLineStart:end:contentsEnd:forRange:). Some common word delimiting punctuation isn’t
* considered, so this property may not generally produce the desired results for multiword strings. Case transformations
* aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. See lowercaseString for
* an example. Note:Â This property performs the canonical (non-localized) mapping. It is suitable for programming operations
* that require stable results not depending on the current locale. For localized case mapping for strings presented to
* users, use the capitalizedStringWithLocale: method.
**/
public NSString capitalizedString;
public NSString capitalizedString() {
capitalizedString = new NSString(AndroidWordUtils.capitalizeFully(wrappedString));
return capitalizedString;
}
/**
* @Signature: capitalizedStringWithLocale:
* @Declaration : - (NSString *)capitalizedStringWithLocale:(NSLocale *)locale
* @Description : Returns a capitalized representation of the receiver using the specified locale.
* @param locale The locale. For strings presented to users, pass the current locale ([NSLocalecurrentLocale]). To use the system
* locale, pass nil.
* @return Return Value A string with the first character from each word in the receiver changed to its corresponding uppercase value,
* and all remaining characters set to their corresponding lowercase values.
* @Discussion A “word� is any sequence of characters delimited by spaces, tabs, or line terminators (listed under
* getLineStart:end:contentsEnd:forRange:). Some common word delimiting punctuation isn’t considered, so this method may not
* generally produce the desired results for multiword strings.
**/
public String capitalizedStringWithLocale(Locale locale) {
return AndroidWordUtils.capitalizeFully(String.format(locale, "%s", wrappedString));
}
/**
* @Declaration : @property (readonly, copy) NSString *lowercaseString
* @Description : A lowercase representation of the string.
* @Discussion Case transformations aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. The
* result of this statement: lcString = [myString lowercaseString]; might not be equal to this statement: lcString =
* [[myString uppercaseString] lowercaseString]; For example, the uppercase form of “ß� in German is “SS�, so converting
* “Straße� to uppercase, then lowercase, produces this sequence of strings: “Straße� “STRASSE� “strasse� Note: This
* property performs the canonical (non-localized) mapping. It is suitable for programming operations that require stable
* results not depending on the current locale. For localized case mapping for strings presented to users, use
* lowercaseStringWithLocale:.
**/
private NSString lowercaseString;
public NSString lowercaseString() {
lowercaseString = new NSString(wrappedString.toLowerCase());
return lowercaseString;
}
public NSString getLowercaseString() {
return lowercaseString();
}
public void setLowercaseString(NSString lowercaseString) {
this.lowercaseString = lowercaseString;
}
/**
* @Signature: lowercaseStringWithLocale:
* @Declaration : - (NSString *)lowercaseStringWithLocale:(NSLocale *)locale
* @Description : Returns a version of the string with all letters converted to lowercase, taking into account the specified locale.
* @param locale The locale. For strings presented to users, pass the current locale ([NSLocalecurrentLocale]). To use the system local,
* pass nil.
* @return Return Value A lowercase string using the locale. Input of @"ABcde" would result in a return of @"abcde".
* @Discussion .
**/
public NSString lowercaseStringWithLocale(NSLocale locale) {
if (locale == null)
return lowercaseString();
return new NSString(wrappedString.toLowerCase(locale.getWrappedLocale()));
}
/**
* @Declaration : @property (readonly, copy) NSString *uppercaseString
* @Description : An uppercase representation of the string. (read-only)
* @Discussion Case transformations aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. See
* lowercaseString for an example. Note:Â This property performs the canonical (non-localized) mapping. It is suitable for
* programming operations that require stable results not depending on the current locale. For localized case mapping for
* strings presented to users, use the uppercaseStringWithLocale: method.
**/
private NSString uppercaseString;
public NSString uppercaseString() {
uppercaseString = new NSString(wrappedString.toUpperCase(Locale.getDefault()));
return uppercaseString;
}
/**
* @Signature: uppercaseStringWithLocale:
* @Declaration : - (NSString *)uppercaseStringWithLocale:(NSLocale *)locale
* @Description : Returns a version of the string with all letters converted to uppercase, taking into account the specified locale.
* @param locale The locale. For strings presented to users, pass the current locale ([NSLocalecurrentLocale]). To use the system
* locale, pass nil.
* @return Return Value An uppercase string using the locale. Input of @"ABcde" would result in a return of @"ABCDE".
**/
public NSString uppercaseStringWithLocale(NSLocale locale) {
if (locale == null)
return uppercaseString();
return new NSString(wrappedString.toUpperCase(locale.getWrappedLocale()));
}
// Getting Numeric Values
/**
* @Declaration : @property (readonly) double doubleValue
* @Description : The floating-point value of the string as a double. (read-only)
* @Discussion This property doesn’t include any whitespace at the beginning of the string. This property is HUGE_VAL or –HUGE_VAL on
* overflow, 0.0 on underflow. This property is 0.0 if the string doesn’t begin with a valid text representation of a
* floating-point number. This property uses formatting information stored in the non-localized value; use an NSScanner
* object for localized scanning of numeric values from a string.
**/
public double doubleValue() {
if (!"".equals(wrappedString)) {
wrappedString = wrappedString.trim().replaceAll(" ", "");
return Double.parseDouble(wrappedString);
}
return 0;
}
public double getDoubleValue() {
return doubleValue();
}
/**
* @Declaration : @property (readonly) float floatValue
* @Description : The floating-point value of the string as a float. (read-only)
* @Discussion This property doesn’t include whitespace at the beginning of the string. This property is HUGE_VAL or –HUGE_VAL on
* overflow, 0.0 on underflow. This property is 0.0 if the string doesn’t begin with a valid text representation of a
* floating-point number. This method uses formatting information stored in the non-localized value; use an NSScanner object
* for localized scanning of numeric values from a string.
**/
private float floatValue;
public float floatValue() {
floatValue = Float.parseFloat(wrappedString);
return floatValue;
}
/**
* @Declaration : @property (readonly) int intValue
* @Description : The integer value of the string. (read-only)
* @Discussion The integer value of the string, assuming a decimal representation and skipping whitespace at the beginning of the
* string. This property is INT_MAX or INT_MIN on overflow. This property is 0 if the string doesn’t begin with a valid
* decimal text representation of a number. This property uses formatting information stored in the non-localized value; use
* an NSScanner object for localized scanning of numeric values from a string.
**/
private int intValue;
public int intValue() {
if ("".equalsIgnoreCase(wrappedString)) {
return 0;
}
return Integer.parseInt(wrappedString);
}
/**
* @Declaration : @property (readonly) NSInteger integerValue
* @Description : The NSInteger value of the string. (read-only)
* @Discussion The NSInteger value of the string, assuming a decimal representation and skipping whitespace at the beginning of the
* string. This property is 0 if the string doesn’t begin with a valid decimal text representation of a number. This
* property uses formatting information stored in the non-localized value; use an NSScanner object for localized scanning of
* numeric values from a string.
**/
private int integerValue;
public int integerValue() {
integerValue = Integer.parseInt(wrappedString);
return integerValue;
}
/**
* @Declaration : @property (readonly) long long longLongValue
* @Description : The long long value of the string. (read-only)
* @Discussion The long long value of the string, assuming a decimal representation and skipping whitespace at the beginning of the
* string. This property is LLONG_MAX or LLONG_MIN on overflow. This property is 0 if the receiver doesn’t begin with a
* valid decimal text representation of a number. This property uses formatting information stored in the non-localized
* value; use an NSScanner object for localized scanning of numeric values from a string.
**/
private long longLongValue;
public Long longLongValue() {
longLongValue = Long.parseLong(wrappedString);
return longLongValue;
}
/**
* @Declaration : @property (readonly) BOOL boolValue
* @Description : The Boolean value of the string. (read-only)
* @Discussion This property is YES on encountering one of "Y", "y", "T", "t", or a digit 1-9—the method ignores any trailing
* characters. This property is NO if the receiver doesn’t begin with a valid decimal text representation of a number. The
* property assumes a decimal representation and skips whitespace at the beginning of the string. It also skips initial
* whitespace characters, or optional -/+ sign followed by zeroes.
**/
private boolean boolValue;
public Boolean boolValue() {
boolValue = Boolean.parseBoolean(wrappedString);
return boolValue;
}
// Working with Paths
/**
* @Signature: pathWithComponents:
* @Declaration : + (NSString *)pathWithComponents:(NSArray *)components
* @Description : Returns a string built from the strings in a given array by concatenating them with a path separator between each
* pair.
* @param components An array of NSString objects representing a file path. To create an absolute path, use a slash mark (“/�) as the
* first component. To include a trailing path divider, use an empty string as the last component.
* @return Return Value A string built from the strings in components by concatenating them (in the order they appear in the array) with
* a path separator between each pair.
* @Discussion This method doesn’t clean up the path created; use stringByStandardizingPath to resolve empty components, references to
* the parent directory, and so on.
**/
public static NSString pathWithComponents(NSArray<?> components) {
// not yet covered
return null;
}
/**
* @Signature: pathComponents
* @Declaration : - (NSArray *)pathComponents
* @Description : Returns an array of NSString objects containing, in order, each path component of the receiver.
* @return Return Value An array of NSString objects containing, in order, each path component of the receiver.
* @Discussion The strings in the array appear in the order they did in the receiver. If the string begins or ends with the path
* separator, then the first or last component, respectively, will contain the separator. Empty components (caused by
* consecutive path separators) are deleted. For example, this code excerpt: NSString *path = @"tmp/scratch"; NSArray
* *pathComponents = [path pathComponents]; produces an array with these contents: Index Path Component 0 “tmp� 1 “scratch�
* If the receiver begins with a slash—for example, “/tmp/scratch�—the array has these contents: Index Path Component 0 “/�
* 1 “tmp� 2 “scratch� If the receiver has no separators—for example, “scratch�—the array contains the string itself, in
* this case “scratch�. Note that this method only works with file paths (not, for example, string representations of URLs).
**/
public NSArray<NSString> pathComponents() {
String[] Result = wrappedString.split(File.pathSeparator);
NSArray<NSString> nsArray = new NSArray<NSString>();
for (String string : Result) {
nsArray.getWrappedList().add(new NSString(string));
}
return nsArray;
}
/**
* @Signature: completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:
* @Declaration : - (NSUInteger)completePathIntoString:(NSString **)outputName caseSensitive:(BOOL)flag matchesIntoArray:(NSArray
* **)outputArray filterTypes:(NSArray *)filterTypes
* @Description : Interprets the receiver as a path in the file system and attempts to perform filename completion, returning a numeric
* value that indicates whether a match was possible, and by reference the longest path that matches the receiver.
* @param outputName Upon return, contains the longest path that matches the receiver.
* @param flag If YES, the method considers case for possible completions.
* @param outputArray Upon return, contains all matching filenames.
* @param filterTypes An array of NSString objects specifying path extensions to consider for completion. Only paths whose extensions
* (not including the extension separator) match one of these strings are included in outputArray. Pass nil if you don’t want
* to filter the output.
* @return Return Value 0 if no matches are found and 1 if exactly one match is found. In the case of multiple matches, returns the
* actual number of matching paths if outputArray is provided, or simply a positive value if outputArray is NULL.
* @Discussion You can check for the existence of matches without retrieving by passing NULL as outputArray. Note that this method only
* works with file paths (not, for example, string representations of URLs).
**/
public int completePathIntoStringCaseSensitiveMatchesIntoArrayFilterTypes(NSString[] outputName,
boolean caseSensitive, NSArray<NSString> outputArray, NSArray<NSString> filterTypes) {
// TODO will not be implemented
return 0;
}
/**
* @Signature: fileSystemRepresentation
* @Declaration : - (const char *)fileSystemRepresentation
* @Description : Returns a file system-specific representation of the receiver.
* @return Return Value A file system-specific representation of the receiver, as described for getFileSystemRepresentation:maxLength:.
* @Discussion The returned C string will be automatically freed just as a returned object would be released; your code should copy the
* representation or use getFileSystemRepresentation:maxLength: if it needs to store the representation outside of the
* memory context in which the representation was created. Raises an NSCharacterConversionException if the receiver can’t be
* represented in the file system’s encoding. It also raises an exception if the receiver contains no characters. Note that
* this method only works with file paths (not, for example, string representations of URLs). To convert a char * path (such
* as you might get from a C library routine) to an NSString object, use NSFileManager‘s
* stringWithFileSystemRepresentation:length: method.
**/
public String fileSystemRepresentation() {
// NOT IMPLEMENTED
return "";
}
/**
* @Signature: getFileSystemRepresentation:maxLength:
* @Declaration : - (BOOL)getFileSystemRepresentation:(char *)buffer maxLength:(NSUInteger)maxLength
* @Description : Interprets the receiver as a system-independent path and fills a buffer with a C-string in a format and encoding
* suitable for use with file-system calls.
* @param buffer Upon return, contains a C-string that represent the receiver as as a system-independent path, plus the NULL termination
* byte. The size of buffer must be large enough to contain maxLength bytes.
* @param maxLength The maximum number of bytes in the string to return in buffer (including a terminating NULL character, which this
* method adds).
* @return Return Value YES if buffer is successfully filled with a file-system representation, otherwise NO (for example, if maxLength
* would be exceeded or if the receiver can’t be represented in the file system’s encoding).
* @Discussion This method operates by replacing the abstract path and extension separator characters (‘/’ and ‘.’ respectively) with
* their equivalents for the operating system. If the system-specific path or extension separator appears in the abstract
* representation, the characters it is converted to depend on the system (unless they’re identical to the abstract
* separators). Note that this method only works with file paths (not, for example, string representations of URLs). The
* following example illustrates the use of the maxLength argument. The first method invocation returns failure as the file
* representation of the string (@"/mach_kernel") is 12 bytes long and the value passed as the maxLength argument (12) does
* not allow for the addition of a NULL termination byte. char filenameBuffer[13]; BOOL success; success = [@"/mach_kernel"
* getFileSystemRepresentation:filenameBuffer maxLength:12]; // success == NO // Changing the length to include the NULL
* character does work success = [@"/mach_kernel" getFileSystemRepresentation:filenameBuffer maxLength:13]; // success ==
* YES
**/
public boolean getFileSystemRepresentationMaxLength(byte[] buffer, int maxLength) {
// TODO WILL NOT BE IMPLEMENTED
return true;
}
/**
* @Signature: isAbsolutePath
* @Declaration : - (BOOL)isAbsolutePath
* @Description : Returning a Boolean value that indicates whether the receiver represents an absolute path.
* @return Return Value YES if the receiver (if interpreted as a path) represents an absolute path, otherwise NO (if the receiver
* represents a relative path).
* @Discussion See String Programming Guide for more information on paths. Note that this method only works with file paths (not, for
* example, string representations of URLs). The method does not check the filesystem for the existence of the path (use
* fileExistsAtPath: or similar methods in NSFileManager for that task).
**/
public boolean isAbsolutePath() {
URI uri;
File f = new File(wrappedString);
try {
uri = new URI(wrappedString);
return uri.isAbsolute() || f.isAbsolute();
} catch (URISyntaxException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
return false;
}
}
/**
* @Signature: lastPathComponent
* @Declaration : - (NSString *)lastPathComponent
* @Description : Returns the last path component of the receiver.
* @return Return Value The last path component of the receiver.
* @Discussion Path components are alphanumeric strings delineated by the path separator (slash “/�) or the beginning or end of the path
* string. Multiple path separators at the end of the string are stripped. The following table illustrates the effect of
* lastPathComponent on a variety of different paths: Receiver’s String Value String Returned “/tmp/scratch.tiff�
* “scratch.tiff� “/tmp/scratch� “scratch� “/tmp/� “tmp� “scratch///� “scratch� “/� “/� Note that this method only works
* with file paths (not, for example, string representations of URLs).
**/
public NSString lastPathComponent() {
if (wrappedString.contains("assets ")) {
wrappedString = wrappedString.replace("assets ", "");
}
return new NSString(wrappedString.substring(wrappedString.lastIndexOf("/") + 1,
wrappedString.length()));
}
/**
* @Signature: pathExtension
* @Declaration : - (NSString *)pathExtension
* @Description : Interprets the receiver as a path and returns the receiver’s extension, if any.
* @return Return Value The receiver’s extension, if any (not including the extension divider).
* @Discussion The path extension is the portion of the last path component which follows the final period, if there is one. The
* following table illustrates the effect of pathExtension on a variety of different paths: Receiver’s String Value String
* Returned “/tmp/scratch.tiff� “tiff� “.scratch.tiff� “tiff� “/tmp/scratch� “� (an empty string) “/tmp/� “� (an empty
* string) “/tmp/scratch..tiff� “tiff� Note that this method only works with file paths (not, for example, string
* representations of URLs).
**/
public NSString pathExtension() {
return new NSString(AndroidFilenameUtils.getExtension(wrappedString));
}
/**
* @Signature: stringByAbbreviatingWithTildeInPath
* @Declaration : - (NSString *)stringByAbbreviatingWithTildeInPath
* @Description : Returns a new string that replaces the current home directory portion of the current path with a tilde (~) character.
* @return Return Value A new string based on the current string object. If the new string specifies a file in the current home
* directory, the home directory portion of the path is replaced with a tilde (~) character. If the string does not specify a
* file in the current home directory, this method returns a new string object whose path is unchanged from the path in the
* current string.
* @Discussion Note that this method only works with file paths. It does not work for string representations of URLs. For sandboxed apps
* in OS X, the current home directory is not the same as the user’s home directory. For a sandboxed app, the home directory
* is the app’s home directory. So if you specified a path of /Users/<current_user>/file.txt for a sandboxed app, the
* returned path would be unchanged from the original. However, if you specified the same path for an app not in a sandbox,
* this method would replace the /Users/<current_user> portion of the path with a tilde.
**/
public void stringByAbbreviatingWithTildeInPath() {
// TODO will not be implemented
}
/**
* @Signature: stringByAppendingPathExtension:
* @Declaration : - (NSString *)stringByAppendingPathExtension:(NSString *)ext
* @Description : Returns a new string made by appending to the receiver an extension separator followed by a given extension.
* @param ext The extension to append to the receiver.
* @return Return Value A new string made by appending to the receiver an extension separator followed by ext.
* @Discussion The following table illustrates the effect of this method on a variety of different paths, assuming that ext is supplied
* as @"tiff": Receiver’s String Value Resulting String “/tmp/scratch.old� “/tmp/scratch.old.tiff� “/tmp/scratch.�
* “/tmp/scratch..tiff� “/tmp/� “/tmp.tiff� “scratch� “scratch.tiff� Note that adding an extension to @"/tmp/" causes the
* result to be @"/tmp.tiff" instead of @"/tmp/.tiff". This difference is because a file named @".tiff" is not considered to
* have an extension, so the string is appended to the last nonempty path component. Note that this method only works with
* file paths (not, for example, string representations of URLs).
**/
public NSString stringByAppendingPathExtension(NSString ext) {
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(wrappedString);
strBuilder.append(AndroidFilenameUtils.EXTENSION_SEPARATOR);
strBuilder.append(ext.getWrappedString());
return new NSString(strBuilder.toString());
}
/**
* @Signature: stringByDeletingLastPathComponent
* @Declaration : - (NSString *)stringByDeletingLastPathComponent
* @Description : Returns a new string made by deleting the last path component from the receiver, along with any final path separator.
* @return Return Value A new string made by deleting the last path component from the receiver, along with any final path separator. If
* the receiver represents the root path it is returned unaltered.
* @Discussion The following table illustrates the effect of this method on a variety of different paths: Receiver’s String Value
* Resulting String “/tmp/scratch.tiff� “/tmp� “/tmp/lock/� “/tmp� “/tmp/� “/� “/tmp� “/� “/� “/� “scratch.tiff� “� (an
* empty string) Note that this method only works with file paths (not, for example, string representations of URLs).
**/
public NSString stringByDeletingLastPathComponent() {
if ("/".equals(wrappedString))
return new NSString(wrappedString);
if (wrappedString.contains(File.pathSeparator)) {
int index = wrappedString.lastIndexOf(File.pathSeparator);
return new NSString(wrappedString.substring(0, index));
}
return null;
}
/**
* @Signature: stringByDeletingPathExtension
* @Declaration : - (NSString *)stringByDeletingPathExtension
* @Description : Returns a new string made by deleting the extension (if any, and only the last) from the receiver.
* @return Return Value a new string made by deleting the extension (if any, and only the last) from the receiver. Strips any trailing
* path separator before checking for an extension. If the receiver represents the root path, it is returned unaltered.
* @Discussion The following table illustrates the effect of this method on a variety of different paths: Receiver’s String Value
* Resulting String “/tmp/scratch.tiff� “/tmp/scratch� “/tmp/� “/tmp� “scratch.bundle/� “scratch� “scratch..tiff� “scratch.�
* “.tiff� “.tiff� “/� “/� Note that attempting to delete an extension from @".tiff" causes the result to be @".tiff"
* instead of an empty string. This difference is because a file named @".tiff" is not considered to have an extension, so
* nothing is deleted. Note also that this method only works with file paths (not, for example, string representations of
* URLs).
**/
public NSString stringByDeletingPathExtension() {
if ("/".equals(wrappedString))
return new NSString(wrappedString);
if (wrappedString.contains(".")) {
int index = wrappedString.lastIndexOf(".");
return new NSString(wrappedString.substring(0, index));
}
return null;
}
/**
* @Signature: stringByExpandingTildeInPath
* @Declaration : - (NSString *)stringByExpandingTildeInPath
* @Description : Returns a new string made by expanding the initial component of the receiver to its full path value.
* @return Return Value A new string made by expanding the initial component of the receiver, if it begins with “~� or “~user�, to its
* full path value. Returns a new string matching the receiver if the receiver’s initial component can’t be expanded.
* @Discussion Note that this method only works with file paths (not, for example, string representations of URLs).
**/
public NSString stringByExpandingTildeInPath() {
// TODO will not be implemented
return null;
}
/**
* @Signature: stringByResolvingSymlinksInPath
* @Declaration : - (NSString *)stringByResolvingSymlinksInPath
* @Description : Returns a new string made from the receiver by resolving all symbolic links and standardizing path.
* @return Return Value A new string made by expanding an initial tilde expression in the receiver, then resolving all symbolic links
* and references to current or parent directories if possible, to generate a standardized path. If the original path is
* absolute, all symbolic links are guaranteed to be removed; if it’s a relative path, symbolic links that can’t be resolved are
* left unresolved in the returned string. Returns self if an error occurs.
* @Discussion If the name of the receiving path begins with /private, the stringByResolvingSymlinksInPath method strips off the
* /private designator, provided the result is the name of an existing file. Note that this method only works with file
* paths (not, for example, string representations of URLs).
**/
public void stringByResolvingSymlinksInPath() {
// TODO will not be implemented
}
/**
* @Signature: stringByStandardizingPath
* @Declaration : - (NSString *)stringByStandardizingPath
* @Description : Returns a new string made by removing extraneous path components from the receiver.
* @return Return Value A new string made by removing extraneous path components from the receiver.
* @Discussion If an invalid pathname is provided, stringByStandardizingPath may attempt to resolve it by calling
* stringByResolvingSymlinksInPath, and the results are undefined. If any other kind of error is encountered (such as a path
* component not existing), self is returned. This method can make the following changes in the provided string: Expand an
* initial tilde expression using stringByExpandingTildeInPath. Reduce empty components and references to the current
* directory (that is, the sequences “//� and “/./�) to single path separators. In absolute paths only, resolve references
* to the parent directory (that is, the component “..�) to the real parent directory if possible using
* stringByResolvingSymlinksInPath, which consults the file system to resolve each potential symbolic link. In relative
* paths, because symbolic links can’t be resolved, references to the parent directory are left in place. Remove an initial
* component of “/private� from the path if the result still indicates an existing file or directory (checked by consulting
* the file system). Note that the path returned by this method may still have symbolic link components in it. Note also
* that this method only works with file paths (not, for example, string representations of URLs).
**/
public void stringByStandardizingPath() {
wrappedString = AndroidFilenameUtils.normalize(wrappedString);
}
// Linguistic Tagging and Analysis
/**
* @Signature: enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:
* @Declaration : - (void)enumerateLinguisticTagsInRange:(NSRange)range scheme:(NSString *)tagScheme
* options:(NSLinguisticTaggerOptions)opts orthography:(NSOrthography *)orthography usingBlock:(void (^)(NSString *tag,
* NSRange tokenRange, NSRange sentenceRange, BOOL *stop))block
* @Description : Performs linguistic analysis on the specified string by enumerating the specific range of the string, providing the
* Block with the located tags.
* @param range The range of the string to analyze.
* @param tagScheme The tag scheme to use. See Linguistic Tag Schemes for supported values.
* @param opts The linguistic tagger options to use. See NSLinguisticTaggerOptionsfor the constants. These constants can be combined
* using the C-Bitwise OR operator.
* @param orthography The orthography of the string. If nil, the linguistic tagger will attempt to determine the orthography from the
* string content.
* @param block The Block to apply to the string. The block takes four arguments: tag The tag scheme for the token. The opts parameter
* specifies the types of tagger options that are located. tokenRange The range of a string matching the tag scheme.
* sentenceRange The range of the sentence in which the token is found. stop A reference to a Boolean value. The block can
* set the value to YES to stop further processing of the array. The stop argument is an out-only argument. You should only
* ever set this Boolean to YES within the Block.
* @param tag The tag scheme for the token. The opts parameter specifies the types of tagger options that are located.
* @param tokenRange The range of a string matching the tag scheme.
* @param sentenceRange The range of the sentence in which the token is found.
* @param stop A reference to a Boolean value. The block can set the value to YES to stop further processing of the array. The stop
* argument is an out-only argument. You should only ever set this Boolean to YES within the Block.
* @Discussion This is a convenience method. It is the equivalent of creating an instance of NSLinguisticTagger, specifying the receiver
* as the string to be analyzed, and the orthography (or nil) and then invoking the NSLinguisticTagger method or
* enumerateTagsInRange:scheme:options:usingBlock:.
**/
public void enumerateLinguisticTagsInRangeSchemeOptionsOrthographyUsingBlock(NSRange range,
NSString tagScheme, NSLinguisticTaggerOptions opts, NSOrthography orthography,
PerformBlock.VoidBlockNSStringNSRangeNSRangeBOOL block) {
}
/**
* @Signature: linguisticTagsInRange:scheme:options:orthography:tokenRanges:
* @Declaration : - (NSArray *)linguisticTagsInRange:(NSRange)range scheme:(NSString *)tagScheme options:(NSLinguisticTaggerOptions)opts
* orthography:(NSOrthography *)orthography tokenRanges:(NSArray **)tokenRanges
* @Description : Returns an array of linguistic tags for the specified range and requested tags within the receiving string.
* @param range The range of the string to analyze.
* @param tagScheme The tag scheme to use. See Linguistic Tag Schemes for supported values.
* @param opts The linguistic tagger options to use. See NSLinguisticTaggerOptions for the constants. These constants can be combined
* using the C-Bitwise OR operator.
* @param orthography The orthography of the string. If nil, the linguistic tagger will attempt to determine the orthography from the
* string content.
* @param tokenRanges An array returned by-reference containing the token ranges of the linguistic tags wrapped in NSValue objects.
* @return Return Value Returns an array containing the linguistic tags for the tokenRanges within the receiving string.
* @Discussion This is a convenience method. It is the equivalent of creating an instance of NSLinguisticTagger, specifying the receiver
* as the string to be analyzed, and the orthography (or nil) and then invoking the NSLinguisticTagger method or
* linguisticTagsInRange:scheme:options:orthography:tokenRanges:.
**/
public NSArray linguisticTagsInRangeSchemeOptionsOrthographyTokenRanges(NSRange range,
NSString tagScheme, NSLinguisticTaggerOptions opts, NSOrthography orthography,
NSArray[] tokenRanges) {
return null;
}
/**
* @Declaration : @property (readonly) NSUInteger length
* @Description : The number of Unicode characters in the receiver. (read-only)
* @Discussion This number includes the individual characters of composed character sequences, so you cannot use this property to
* determine if a string will be visible when printed or how long it will appear.
**/
public int length;
public int length() {
length = wrappedString.length();
return length;
}
public int getLength() {
return this.length();
}
/**
* @Signature: lengthOfBytesUsingEncoding:
* @Declaration : - (NSUInteger)lengthOfBytesUsingEncoding:(NSStringEncoding)enc
* @Description : Returns the number of bytes required to store the receiver in a given encoding.
* @param enc The encoding for which to determine the receiver's length.
* @return Return Value The number of bytes required to store the receiver in the encoding enc in a non-external representation. The
* length does not include space for a terminating NULL character. Returns 0 if the specified encoding cannot be used to convert
* the receiver or if the amount of memory required for storing the results of the encoding conversion would exceed
* NSIntegerMax.
* @Discussion The result is exact and is returned in O(n) time.
**/
public int lengthOfBytesUsingEncoding(int enc) {
CharsetEncoder encoder = NSStringEncoding.getCharsetFromInt(enc).newEncoder();
char[] arrayTmp = this.wrappedString.toCharArray();
char[] array = { arrayTmp[0] };
int len = 0;
CharBuffer input = CharBuffer.wrap(array);
ByteBuffer output = ByteBuffer.allocate(10);
for (int i = 0; i < arrayTmp.length; i++) {
array[0] = arrayTmp[i];
output.clear();
input.clear();
encoder.encode(input, output, false);
len += output.position();
}
return len;
}
/**
* @Signature: maximumLengthOfBytesUsingEncoding:
* @Declaration : - (NSUInteger)maximumLengthOfBytesUsingEncoding:(NSStringEncoding)enc
* @Description : Returns the maximum number of bytes needed to store the receiver in a given encoding.
* @param enc The encoding for which to determine the receiver's length.
* @return Return Value The maximum number of bytes needed to store the receiver in encoding in a non-external representation. The
* length does not include space for a terminating NULL character. Returns 0 if the amount of memory required for storing the
* results of the encoding conversion would exceed NSIntegerMax.
* @Discussion The result is an estimate and is returned in O(1) time; the estimate may be considerably greater than the actual length
* needed.
**/
public int maximumLengthOfBytesUsingEncoding(int enc) {
if (enc == NSStringEncoding.NSUnicodeStringEncoding)
return length() * 2;
if ((enc) == NSStringEncoding.NSUTF8StringEncoding)
return length() * 6;
if ((enc) == NSStringEncoding.NSUTF16StringEncoding)
return length() * 8;
return this.length();
}
// Dividing Strings
/**
* @Signature: componentsSeparatedByString:
* @Declaration : - (NSArray *)componentsSeparatedByString:(NSString *)separator
* @Description : Returns an array containing substrings from the receiver that have been divided by a given separator.
* @param separator The separator string.
* @return Return Value An NSArray object containing substrings from the receiver that have been divided by separator.
* @Discussion The substrings in the array appear in the order they did in the receiver. Adjacent occurrences of the separator string
* produce empty strings in the result. Similarly, if the string begins or ends with the separator, the first or last
* substring, respectively, is empty.
**/
public NSArray<NSString> componentsSeparatedByString(NSString separator) {
String[] arrayOfString = this.wrappedString.split(separator.getWrappedString());
List<NSString> anArray = new ArrayList<NSString>();
for (int i = 0; i < arrayOfString.length; i++) {
anArray.add(new NSString(arrayOfString[i]));
}
return new NSArray<NSString>(anArray);
}
/**
* @Signature: componentsSeparatedByCharactersInSet:
* @Declaration : - (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)separator
* @Description : Returns an array containing substrings from the receiver that have been divided by characters in a given set.
* @param separator A character set containing the characters to to use to split the receiver. Must not be nil.
* @return Return Value An NSArray object containing substrings from the receiver that have been divided by characters in separator.
* @Discussion The substrings in the array appear in the order they did in the receiver. Adjacent occurrences of the separator
* characters produce empty strings in the result. Similarly, if the string begins or ends with separator characters, the
* first or last substring, respectively, is empty.
**/
public NSArray<Object> componentsSeparatedByCharactersInSet(NSCharacterSet separator) {
NSArray<Object> nsArray = new NSArray<Object>();
StringBuilder result = new StringBuilder();
for (int i = 0; i < separator.getCharacterSet().size(); i++) {
result.append("\\" + separator.getCharacterSet().toArray()[i]);
if (i < separator.getCharacterSet().size() - 1) {
result.append("|\\");
}
}
String myRegexStr = result.toString();
String[] arrayOfString = this.wrappedString.split(myRegexStr);
for (String string : arrayOfString) {
nsArray.getWrappedList().add(new NSString(string));
}
return nsArray;
}
/**
* @Signature: stringByTrimmingCharactersInSet:
* @Declaration : - (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set
* @Description : Returns a new string made by removing from both ends of the receiver characters contained in a given character set.
* @param set A character set containing the characters to remove from the receiver. set must not be nil.
* @return Return Value A new string made by removing from both ends of the receiver characters contained in set. If the receiver is
* composed entirely of characters from set, the empty string is returned.
* @Discussion Use whitespaceCharacterSet or whitespaceAndNewlineCharacterSet to remove whitespace around strings.
**/
public NSString stringByTrimmingCharactersInSet(NSCharacterSet separator) {
NSString result = new NSString();
StringBuilder regEx = new StringBuilder();
Iterator<Character> it = separator.getCharacterSet().iterator();
int count = 0;
while (it.hasNext()) {
Character c = it.next();
regEx.append("\\" + c);
if (count < separator.getCharacterSet().size() - 1) {
regEx.append("|");
}
count++;
}
String myRegexStr = regEx.toString();
result.wrappedString = this.wrappedString.replaceAll(myRegexStr, "");
this.wrappedString = result.wrappedString;
return result;
}
/**
* @Signature: substringFromIndex:
* @Declaration : - (NSString *)substringFromIndex:(NSUInteger)anIndex
* @Description : Returns a new string containing the characters of the receiver from the one at a given index to the end.
* @param anIndex An index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver. Raises an
* NSRangeException if (anIndex - 1) lies beyond the end of the receiver.
* @return Return Value A new string containing the characters of the receiver from the one at anIndex to the end. If anIndex is equal
* to the length of the string, returns an empty string.
**/
public NSString substringFromIndex(int anIndex) {
NSString result = new NSString();
result.wrappedString = this.wrappedString.substring(anIndex);
if (anIndex - 1 < this.wrappedString.length()) {
} else {
throw new IndexOutOfBoundsException("Index lies beyond the end of the receiver");
}
return result;
}
/**
* @Signature: substringWithRange:
* @Declaration : - (NSString *)substringWithRange:(NSRange)aRange
* @Description : Returns a string object containing the characters of the receiver that lie within a given range.
* @param aRange A range. The range must not exceed the bounds of the receiver. Raises an NSRangeException if (aRange.location - 1) or
* (aRange.location + aRange.length - 1) lies beyond the end of the receiver.
* @return Return Value A string object containing the characters of the receiver that lie within aRange.
**/
public NSString substringWithRange(NSRange aRange) {
NSString result = new NSString();
int start = aRange.location;
int end = aRange.location + aRange.length;
if (!(start - 1 > this.wrappedString.length() || end > this.wrappedString.length())) {
result.wrappedString = this.wrappedString.substring(start, end);
} else {
throw new IndexOutOfBoundsException("Index lies beyond the end of the receiver");
}
return result;
}
/**
* @Signature: substringToIndex:
* @Declaration : - (NSString *)substringToIndex:(NSUInteger)anIndex
* @Description : Returns a new string containing the characters of the receiver up to, but not including, the one at a given index.
* @param anIndex An index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver. Raises an
* NSRangeException if (anIndex - 1) lies beyond the end of the receiver.
* @return Return Value A new string containing the characters of the receiver up to, but not including, the one at anIndex. If anIndex
* is equal to the length of the string, returns a copy of the receiver.
**/
public NSString substringToIndex(int anIndex) {
NSString result = new NSString();
int end = anIndex;
result.wrappedString = this.wrappedString.substring(0, end);
return result;
}
// Replacing Substrings
/**
* @Signature: stringByReplacingOccurrencesOfString:withString:
* @Declaration : - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
* @Description : Returns a new string in which all occurrences of a target string in the receiver are replaced by another given string.
* @param target The string to replace.
* @param replacement The string with which to replace target.
* @return Return Value A new string in which all occurrences of target in the receiver are replaced by replacement.
* @Discussion Invokes stringByReplacingOccurrencesOfString:withString:options:range:with 0 options and range of the whole string.
**/
public NSString stringByReplacingOccurrencesOfStringWithString(NSString stringToBeReplaced,
NSString replacement) {
this.wrappedString.replaceAll(stringToBeReplaced.getWrappedString(),
replacement.getWrappedString());
return this;
}
/**
* @Signature: stringByReplacingOccurrencesOfString:withString:options:range:
* @Declaration : - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
* options:(NSStringCompareOptions)options range:(NSRange)searchRange
* @Description : Returns a new string in which all occurrences of a target string in a specified range of the receiver are replaced by
* another given string.
* @param target The string to replace.
* @param replacement The string with which to replace target.
* @param options A mask of options to use when comparing target with the receiver. Pass 0 to specify no options.
* @param searchRange The range in the receiver in which to search for target.
* @return Return Value A new string in which all occurrences of target, matched using options, in searchRange of the receiver are
* replaced by replacement.
**/
public NSString stringByReplacingOccurrencesOfStringWithStringOptionsRange(
NSString stringToBeReplaced, NSString replacement, NSStringCompareOptions options,
NSRange range) {
if (options == NSStringCompareOptions.NSAnchoredSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSBackwardsSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSCaseInsensitiveSearch) {
// @TODO FIXME Ò and È are not supported
String insentiveCase = "(?i)";
this.wrappedString = this.wrappedString.replaceAll(insentiveCase + stringToBeReplaced,
replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
// @TODO FIXME
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSLiteralSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSRegularExpressionSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
}
return this;
}
/**
* @Signature: stringByReplacingCharactersInRange:withString:
* @Declaration : - (NSString *)stringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement
* @Description : Returns a new string in which the characters in a specified range of the receiver are replaced by a given string.
* @param range A range of characters in the receiver.
* @param replacement The string with which to replace the characters in range.
* @return Return Value A new string in which the characters in range of the receiver are replaced by replacement.
**/
public NSString stringByReplacingCharactersInRangeWithString(NSRange range,
String replacement) {
String tmpString = this.wrappedString.substring(range.location,
range.location + length() - 1);
this.wrappedString.replace(tmpString, replacement);
return null;
}
// Determining Composed Character Sequences
/**
* @Signature: rangeOfComposedCharacterSequenceAtIndex:
* @Declaration : - (NSRange)rangeOfComposedCharacterSequenceAtIndex:(NSUInteger)anIndex
* @Description : Returns the range in the receiver of the composed character sequence located at a given index.
* @param anIndex The index of a character in the receiver. The value must not exceed the bounds of the receiver.
* @return Return Value The range in the receiver of the composed character sequence located at anIndex.
* @Discussion The composed character sequence includes the first base character found at or before anIndex, and its length includes the
* base character and all non-base characters following the base character.
**/
public NSRange rangeOfComposedCharacterSequenceAtIndex(int anIndex) {
return new NSRange(anIndex, 1);
}
/**
* @Signature: rangeOfComposedCharacterSequencesForRange:
* @Declaration : - (NSRange)rangeOfComposedCharacterSequencesForRange:(NSRange)range
* @Description : Returns the range in the string of the composed character sequences for a given range.
* @param range A range in the receiver. The range must not exceed the bounds of the receiver.
* @return Return Value The range in the receiver that includes the composed character sequences in range.
* @Discussion This method provides a convenient way to grow a range to include all composed character sequences it overlaps.
**/
public NSRange rangeOfComposedCharacterSequencesForRange(NSRange range) {
return range;
}
// Identifying and Comparing Strings
/**
* @Signature: caseInsensitiveCompare:
* @Declaration : - (NSComparisonResult)caseInsensitiveCompare:(NSString *)aString
* @Description : Returns the result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value The result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.
* @Discussion If you are comparing strings to present to the end-user, you should typically use localizedCaseInsensitiveCompare:
* instead.
**/
public NSComparisonResult caseInsensitiveCompare(NSString aString) {
int ordre = this.getWrappedString().compareToIgnoreCase(aString.getWrappedString());
if(ordre == 0)return NSComparisonResult.NSOrderedSame;
if(ordre < 0)return NSComparisonResult.NSOrderedAscending;
return NSComparisonResult.NSOrderedDescending;
}
/**
* @Signature: localizedCaseInsensitiveCompare:
* @Declaration : - (NSComparisonResult)localizedCaseInsensitiveCompare:(NSString *)aString
* @Description : Compares the string with a given string using a case-insensitive, localized, comparison.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value Returns an NSComparisonResult value that indicates the lexical ordering. NSOrderedAscending the receiver
* precedes aString in lexical ordering, NSOrderedSame the receiver and aString are equivalent in lexical value, and
* NSOrderedDescending if the receiver follows aString.
* @Discussion This method uses the current locale.
**/
public NSObjCRuntime.NSComparisonResult localizedCaseInsensitiveCompare(NSString aString) {
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.SECONDARY);
int comparison = collator.compare(this.getWrappedString(), aString.getWrappedString());
if (comparison == 0)
return NSObjCRuntime.NSComparisonResult.NSOrderedSame;
if (comparison < 0)
return NSObjCRuntime.NSComparisonResult.NSOrderedAscending;
return NSObjCRuntime.NSComparisonResult.NSOrderedDescending;
}
/**
* @Signature: compare:options:range:locale:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)range
* locale:(id)locale
* @Description : Compares the string using the specified options and returns the lexical ordering for the range.
* @param aString The string with which to compare the range of the receiver specified by range. This value must not be nil. If this
* value is nil, the behavior is undefined and may change in future versions of OS X.
* @param mask Options for the search—you can combine any of the following using a C bitwise OR operator: NSCaseInsensitiveSearch,
* NSLiteralSearch, NSNumericSearch. See String Programming Guide for details on these options.
* @param range The range of the receiver over which to perform the comparison. The range must not exceed the bounds of the receiver.
* Important:Â Raises an NSRangeException if range exceeds the bounds of the receiver.
* @param locale An instance of NSLocale. To use the current locale, pass [NSLocale currentLocale]. For example, if you are comparing
* strings to present to the end-user, use the current locale. To use the system locale, pass nil.
* @return Return Value Returns an NSComparisonResult value that indicates the lexical ordering of a specified range within the receiver
* and a given string. NSOrderedAscending if the substring of the receiver given by range precedes aString in lexical ordering
* for the locale given in dict, NSOrderedSame if the substring of the receiver and aString are equivalent in lexical value, and
* NSOrderedDescending if the substring of the receiver follows aString.
* @Discussion The locale argument affects both equality and ordering algorithms. For example, in some locales, accented characters are
* ordered immediately after the base; other locales order them after “z�.
**/
public NSComparisonResult compareOptionsRangeLocale(NSString aString,
NSStringCompareOptions mask, NSRange range, NSLocale locale) {
int strntgh = Collator.IDENTICAL;
if (mask == NSStringCompareOptions.NSCaseInsensitiveSearch) {
strntgh = Collator.SECONDARY;
} else if (mask == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
strntgh = Collator.PRIMARY;
}
NSString subtringFRomRange = substringWithRange(range);
Collator collator = Collator.getInstance(locale.getLocale());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(subtringFRomRange, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: localizedCompare:
* @Declaration : - (NSComparisonResult)localizedCompare:(NSString *)aString
* @Description : Compares the string and a given string using a localized comparison.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value Returns an NSComparisonResult. NSOrderedAscending the receiver precedes string in lexical ordering,
* NSOrderedSame the receiver and string are equivalent in lexical value, and NSOrderedDescending if the receiver follows
* string.
* @Discussion This method uses the current locale.
**/
public NSComparisonResult localizedCompare(NSString aString) {
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: compare:options:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask
* @Description : Compares the string with the specified string using the given options.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @param mask Options for the search—you can combine any of the following using a C bitwise OR operator: NSCaseInsensitiveSearch,
* NSLiteralSearch, NSNumericSearch. See String Programming Guide for details on these options.
* @return Return Value The result of invoking compare:options:range: with a given mask as the options and the receiver’s full extent as
* the range.
* @Discussion If you are comparing strings to present to the end-user, you should typically use localizedCompare: or
* localizedCaseInsensitiveCompare: instead, or use compare:options:range:locale: and pass the user’s locale.
**/
public NSComparisonResult compareOptions(NSString aString, NSStringCompareOptions mask) {
int strntgh = Collator.IDENTICAL;
if (mask == NSStringCompareOptions.NSCaseInsensitiveSearch) {
strntgh = Collator.SECONDARY;
} else if (mask == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
strntgh = Collator.PRIMARY;
}
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: compare:options:range:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)range
* @Description : Returns the result of invoking compare:options:range:locale: with a nil locale.
* @param aString The string with which to compare the range of the receiver specified by range. This value must not be nil. If this
* value is nil, the behavior is undefined and may change in future versions of OS X.
* @param mask Options for the search—you can combine any of the following using a C bitwise OR operator: NSCaseInsensitiveSearch,
* NSLiteralSearch, NSNumericSearch. See String Programming Guide for details on these options.
* @param range The range of the receiver over which to perform the comparison. The range must not exceed the bounds of the receiver.
* Important:Â Raises an NSRangeException if range exceeds the bounds of the receiver.
* @return Return Value The result of invoking compare:options:range:locale: with a nil locale.
* @Discussion If you are comparing strings to present to the end-user, use compare:options:range:locale: instead and pass the current
* locale.
**/
public NSComparisonResult compareOptionsRange(NSString aString, NSStringCompareOptions mask,
NSRange range) {
int strntgh = Collator.IDENTICAL;
if (mask == NSStringCompareOptions.NSCaseInsensitiveSearch) {
strntgh = Collator.SECONDARY;
} else if (mask == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
strntgh = Collator.PRIMARY;
}
NSString subtringFRomRange = substringWithRange(range);
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(subtringFRomRange, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: compare:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString
* @Description : Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value The result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
* @Discussion If you are comparing strings to present to the end-user, you should typically use localizedCompare: or
* localizedCaseInsensitiveCompare: instead.
**/
public NSComparisonResult compare(NSString aString) {
if (aString == null)
throw new IllegalArgumentException(" This value must not be null ");
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else if (comparison > 0) {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedDescending;
}
}
/**
* @Signature: localizedStandardCompare:
* @Declaration : - (NSComparisonResult)localizedStandardCompare:(NSString *)string
* @Description : Compares strings as sorted by the Finder.
* @param string The string to compare with the receiver.
* @return Return Value The result of the comparison.
* @Discussion This method should be used whenever file names or other strings are presented in lists and tables where Finder-like
* sorting is appropriate. The exact sorting behavior of this method is different under different locales and may be changed
* in future releases. This method uses the current locale.
**/
public NSComparisonResult localizedStandardCompare(NSString aString) {
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.TERTIARY);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: hasPrefix:
* @Declaration : - (BOOL)hasPrefix:(NSString *)aString
* @Description : Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.
* @param aString A string.
* @return Return Value YES if aString matches the beginning characters of the receiver, otherwise NO. Returns NO if aString is empty.
* @Discussion This method is a convenience for comparing strings using the NSAnchoredSearch option. See String Programming Guide for
* more information.
**/
public boolean hasPrefix(NSString prefix) {
return this.wrappedString.startsWith(prefix.wrappedString);
}
/**
* @Signature: hasSuffix:
* @Declaration : - (BOOL)hasSuffix:(NSString *)aString
* @Description : Returns a Boolean value that indicates whether a given string matches the ending characters of the receiver.
* @param aString A string.
* @return Return Value YES if aString matches the ending characters of the receiver, otherwise NO. Returns NO if aString is empty.
* @Discussion This method is a convenience for comparing strings using the NSAnchoredSearch and NSBackwardsSearch options. See String
* Programming Guide for more information.
**/
public boolean hasSuffix(NSString suffix) {
return this.wrappedString.endsWith(suffix.wrappedString);
}
/**
* @Signature: isEqualToString:
* @Declaration : - (BOOL)isEqualToString:(NSString *)aString
* @Description : Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based
* comparison.
* @param aString The string with which to compare the receiver.
* @return Return Value YES if aString is equivalent to the receiver (if they have the same id or if they are NSOrderedSame in a literal
* comparison), otherwise NO.
* @Discussion The comparison uses the canonical representation of strings, which for a particular string is the length of the string
* plus the Unicode characters that make up the string. When this method compares two strings, if the individual Unicodes
* are the same, then the strings are equal, regardless of the backing store. “Literal� when applied to string comparison
* means that various Unicode decomposition rules are not applied and Unicode characters are individually compared. So, for
* instance, “Ö� represented as the composed character sequence “O� and umlaut would not compare equal to “Ö� represented as
* one Unicode character.
**/
public boolean isEqualToString(NSString myStr) {
if (myStr == null || this.wrappedString == null) {
return false;
} else {
return this.wrappedString.equals(myStr.wrappedString);
}
}
/**
* @Declaration : @property (readonly) NSUInteger hash
* @Description : An unsigned integer that can be used as a hash table address. (read-only)
* @Discussion If two string objects are equal (as determined by the isEqualToString: method), they must have the same hash value. This
* property fulfills this requirement. You should not rely on this property having the same hash value across releases of OS
* X.
**/
private int hash;
@Override
public int hash() {
hash = wrappedString.hashCode();
return hash;
}
// Getting C Strings
/**
* @Signature: cStringUsingEncoding:
* @Declaration : - (const char *)cStringUsingEncoding:(NSStringEncoding)encoding
* @Description : Returns a representation of the receiver as a C string using a given encoding.
* @param encoding The encoding for the returned C string.
* @return Return Value A C string representation of the receiver using the encoding specified by encoding. Returns NULL if the receiver
* cannot be losslessly converted to encoding.
* @Discussion The returned C string is guaranteed to be valid only until either the receiver is freed, or until the current memory is
* emptied, whichever occurs first. You should copy the C string or use getCString:maxLength:encoding: if it needs to store
* the C string beyond this time. You can use canBeConvertedToEncoding: to check whether a string can be losslessly
* converted to encoding. If it can’t, you can use dataUsingEncoding:allowLossyConversion: to get a C-string representation
* using encoding, allowing some loss of information (note that the data returned by dataUsingEncoding:allowLossyConversion:
* is not a strict C-string since it does not have a NULL terminator).
**/
public char[] cStringUsingEncoding(NSStringEncoding encoding) {
// TODO check the encoding
return this.wrappedString.toCharArray();
}
/**
* @Signature: getCString:maxLength:encoding:
* @Declaration : - (BOOL)getCString:(char *)buffer maxLength:(NSUInteger)maxBufferCount encoding:(NSStringEncoding)encoding
* @Description : Converts the receiver’s content to a given encoding and stores them in a buffer.
* @param buffer Upon return, contains the converted C-string plus the NULL termination byte. The buffer must include room for
* maxBufferCount bytes.
* @param maxBufferCount The maximum number of bytes in the string to return in buffer (including the NULL termination byte).
* @param encoding The encoding for the returned C string.
* @return Return Value YES if the operation was successful, otherwise NO. Returns NO if conversion is not possible due to encoding
* errors or if buffer is too small.
* @Discussion Note that in the treatment of the maxBufferCount argument, this method differs from the deprecated getCString:maxLength:
* method which it replaces. (The buffer should include room for maxBufferCount bytes; this number should accommodate the
* expected size of the return value plus the NULL termination byte, which this method adds.) You can use
* canBeConvertedToEncoding: to check whether a string can be losslessly converted to encoding. If it can’t, you can use
* dataUsingEncoding:allowLossyConversion: to get a C-string representation using encoding, allowing some loss of
* information (note that the data returned by dataUsingEncoding:allowLossyConversion: is not a strict C-string since it
* does not have a NULL terminator).
**/
public boolean getCStringMaxLengthMaxBufferCountEncoding(char[] buffer, int maxBufferCount,
NSStringEncoding encoding) {
// FIXME check the encoding
char[] charArray = this.wrappedString.toCharArray();
int minLength = Math.min(charArray.length, maxBufferCount);
buffer = Arrays.copyOfRange(charArray, 0, minLength);
if (buffer.length > 0) {
return true;
} else {
return false;
}
}
/**
* @Declaration : @property (readonly) __strong const char *UTF8String
* @Description : A null-terminated UTF8 representation of the string. (read-only)
* @Discussion This C string is a pointer to a structure inside the string object, which may have a lifetime shorter than the string
* object and will certainly not have a longer lifetime. Therefore, you should copy the C string if it needs to be stored
* outside of the memory context in which you use this property.
**/
private String UTF8String;
public String UTF8String() {
// UTF-8 is the default encoding
UTF8String = this.wrappedString;
return UTF8String;
}
/**
* @Signature: cString
* @Declaration : - (const char *)cString
* @Description : Returns a representation of the receiver as a C string in the default C-string encoding. (Deprecated in iOS 2.0. Use
* cStringUsingEncoding: or UTF8String instead.)
* @Discussion The returned C string will be automatically freed just as a returned object would be released; your code should copy the
* C string or use getCString: if it needs to store the C string outside of the autorelease context in which the C string is
* created. Raises an NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding
* without loss of information. Use canBeConvertedToEncoding: if necessary to check whether a string can be losslessly
* converted to the default C-string encoding. If it can’t, use lossyCString or dataUsingEncoding:allowLossyConversion: to
* get a C-string representation with some loss of information.
**/
public char[] cString() {
return this.wrappedString.toCharArray();
}
/**
* @Signature: cStringLength
* @Declaration : - (NSUInteger)cStringLength
* @Description : Returns the length in char-sized units of the receiver’s C-string representation in the default C-string encoding.
* (Deprecated in iOS 2.0. Use lengthOfBytesUsingEncoding: or maximumLengthOfBytesUsingEncoding: instead.)
* @Discussion Raises if the receiver can’t be represented in the default C-string encoding without loss of information. You can also
* use canBeConvertedToEncoding: to check whether a string can be losslessly converted to the default C-string encoding. If
* it can’t, use lossyCString to get a C-string representation with some loss of information, then check its length
* explicitly using the ANSI function strlen().
**/
public int cStringLength() {
return wrappedString.toCharArray().length;
}
/**
* @Signature: getCString:
* @Declaration : - (void)getCString:(char *)buffer
* @Description : Invokes getCString:maxLength:range:remainingRange: with NSMaximumStringLength as the maximum length, the receiver’s
* entire extent as the range, and NULL for the remaining range. (Deprecated in iOS 2.0. Use cStringUsingEncoding: or
* dataUsingEncoding:allowLossyConversion: instead.)
* @Discussion buffer must be large enough to contain the resulting C-string plus a terminating NULL character (which this method
* adds—[string cStringLength]). Raises an NSCharacterConversionException if the receiver can’t be represented in the
* default C-string encoding without loss of information. Use canBeConvertedToEncoding: if necessary to check whether a
* string can be losslessly converted to the default C-string encoding. If it can’t, use lossyCString or
* dataUsingEncoding:allowLossyConversion: to get a C-string representation with some loss of information.
**/
public void getCString(char[] buffer) {
// FIXME check the encoding
buffer = this.wrappedString.toCharArray();
}
public void getCString(String buffer) {
// FIXME check the encoding
buffer = this.wrappedString;
}
/**
* @Signature: getCString:maxLength:
* @Declaration : - (void)getCString:(char *)buffer maxLength:(NSUInteger)maxLength
* @Description : Invokes getCString:maxLength:range:remainingRange: with maxLength as the maximum length in char-sized units, the
* receiver’s entire extent as the range, and NULL for the remaining range. (Deprecated in iOS 2.0. Use
* getCString:maxLength:encoding: instead.)
* @Discussion buffer must be large enough to contain maxLength chars plus a terminating zero char (which this method adds). Raises an
* NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding without loss of
* information. Use canBeConvertedToEncoding: if necessary to check whether a string can be losslessly converted to the
* default C-string encoding. If it can’t, use lossyCString or dataUsingEncoding:allowLossyConversion: to get a C-string
* representation with some loss of information.
**/
public void getCStringMaxLength(char[] buffer, int maxLength) {
char[] charArray = this.wrappedString.toCharArray();
int minLength = Math.min(charArray.length, maxLength);
buffer = Arrays.copyOfRange(this.wrappedString.toCharArray(), 0, minLength - 1);
char[] anotherCharArray = new char[minLength + 1];
for (int i = 0; i < anotherCharArray.length; i++) {
if (i == anotherCharArray.length - 1) {
anotherCharArray[i] = 0;
} else {
anotherCharArray[i] = buffer[i];
}
}
buffer = anotherCharArray;
}
/**
* @Signature: getCString:maxLength:range:remainingRange:
* @Declaration : - (void)getCString:(char *)buffer maxLength:(NSUInteger)maxLength range:(NSRange)aRange
* remainingRange:(NSRangePointer)leftoverRange
* @Description : Converts the receiver’s content to the default C-string encoding and stores them in a given buffer. (Deprecated in iOS
* 2.0. Use getCString:maxLength:encoding: instead.)
* @Discussion buffer must be large enough to contain maxLength bytes plus a terminating zero character (which this method adds). Copies
* and converts as many characters as possible from aRange and stores the range of those not converted in the range given by
* leftoverRange (if it’s non-nil). Raises an NSRangeException if any part of aRange lies beyond the end of the string.
* Raises an NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding without
* loss of information. Use canBeConvertedToEncoding: if necessary to check whether a string can be losslessly converted to
* the default C-string encoding. If it can’t, use lossyCString or dataUsingEncoding:allowLossyConversion: to get a C-string
* representation with some loss of information.
**/
public void getCStringMaxLengthRangeRemainingRange(char[] buffer, int maxLength, NSRange aRange,
NSRangePointer leftoverRange) {
char[] charArray = this.wrappedString.toCharArray();
int start = aRange.location;
int end = aRange.location + aRange.length;
int minLength = Math.min(charArray.length, maxLength);
minLength = Math.min(minLength, aRange.length);
char[] anotherCharArray = Arrays.copyOfRange(this.wrappedString.toCharArray(), start, end);
// buffer = new String[minLength + 1];
for (int i = 0; i < buffer.length; i++) {
if (i == buffer.length - 1) {
buffer[i] = '0';
} else {
buffer[i] = anotherCharArray[i];
}
}
}
/**
* @Signature: lossyCString
* @Declaration : - (const char *)lossyCString
* @Description : Returns a representation of the receiver as a C string in the default C-string encoding, possibly losing information
* in converting to that encoding. (Deprecated in iOS 2.0. Use cStringUsingEncoding: or
* dataUsingEncoding:allowLossyConversion: instead.)
* @Discussion This method does not raise an exception if the conversion is lossy. The returned C string will be automatically freed
* just as a returned object would be released; your code should copy the C string or use getCString: if it needs to store
* the C string outside of the autorelease context in which the C string is created.
**/
public void lossyCString(char[] buffer) {
buffer = this.wrappedString.toCharArray();
}
// Getting a Shared Prefix
/**
* @Signature: commonPrefixWithString:options:
* @Declaration : - (NSString *)commonPrefixWithString:(NSString *)aString options:(NSStringCompareOptions)mask
* @Description : Returns a string containing characters the receiver and a given string have in common, starting from the beginning of
* each up to the first characters that aren’t equivalent.
* @param aString The string with which to compare the receiver.
* @param mask Options for the comparison. The following search options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch. See String Programming Guide for details on these options.
* @return Return Value A string containing characters the receiver and aString have in common, starting from the beginning of each up
* to the first characters that aren’t equivalent.
* @Discussion The returned string is based on the characters of the receiver. For example, if the receiver is “Ma¨dchen� and aString is
* “Mädchenschule�, the string returned is “Ma¨dchen�, not “Mädchen�.
**/
public NSString commonPrefixWithStringOptions(NSString myStr, int mask) {
char[] myStrCharArray = Normalizer.normalize(myStr.wrappedString, Normalizer.Form.NFD)
.toCharArray();
char[] thisStrCharArray = Normalizer.normalize(this.wrappedString, Normalizer.Form.NFD)
.toCharArray();
StringBuilder strBdr = new StringBuilder();
int minLength = Math.min(myStrCharArray.length, thisStrCharArray.length);
for (int i = 0; i < minLength; i++) {
if (thisStrCharArray[i] == myStrCharArray[i]) {
strBdr.append(myStrCharArray[i]);
}
}
return new NSString(strBdr.toString());
}
// Getting Strings with Mapping
/**
* @Declaration : @property (readonly, copy) NSString *decomposedStringWithCanonicalMapping
* @Description : A string made by normalizing the string’s contents using the Unicode Normalization Form D. (read-only)
**/
private NSString decomposedStringWithCanonicalMapping;
public NSString decomposedStringWithCanonicalMapping() {
decomposedStringWithCanonicalMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFD));
return decomposedStringWithCanonicalMapping;
}
/**
* @Declaration : @property (readonly, copy) NSString *decomposedStringWithCompatibilityMapping
* @Description : A string made by normalizing the receiver’s contents using the Unicode Normalization Form KD. (read-only)
**/
private NSString decomposedStringWithCompatibilityMapping;
public NSString decomposedStringWithCompatibilityMapping() {
decomposedStringWithCompatibilityMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFKD));
return decomposedStringWithCompatibilityMapping;
}
/**
* @Declaration : @property (readonly, copy) NSString *precomposedStringWithCanonicalMapping
* @Description : A string made by normalizing the string’s contents using the Unicode Normalization Form C. (read-only)
**/
private NSString precomposedStringWithCanonicalMapping;
public NSString precomposedStringWithCanonicalMapping() {
precomposedStringWithCanonicalMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFC));
return precomposedStringWithCanonicalMapping;
}
/**
* @Declaration : @property (readonly, copy) NSString *precomposedStringWithCompatibilityMappin
* @Description : A string made by normalizing the receiver’s contents using the Unicode Normalization Form KC. (read-only)
**/
private NSString precomposedStringWithCompatibilityMapping;
public NSString precomposedStringWithCompatibilityMapping() {
precomposedStringWithCompatibilityMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFKC));
return precomposedStringWithCompatibilityMapping;
}
// Working with Encodings
/**
* @Signature: availableStringEncodings
* @Declaration : + (const NSStringEncoding *)availableStringEncodings
* @Description : Returns a zero-terminated list of the encodings string objects support in the application’s environment.
* @return Return Value A zero-terminated list of the encodings string objects support in the application’s environment.
* @Discussion Among the more commonly used encodings are: NSASCIIStringEncoding NSUnicodeStringEncoding NSISOLatin1StringEncoding
* NSISOLatin2StringEncoding NSSymbolStringEncoding See the “Constants� section for a larger list and descriptions of many
* supported encodings. In addition to those encodings listed here, you can also use the encodings defined for CFString in
* Core Foundation; you just need to call the CFStringConvertEncodingToNSStringEncoding function to convert them to a usable
* format.
**/
public static int[] availableStringEncodings() {
SortedMap<String, Charset> availableCharsetEntry = Charset.availableCharsets();
Set<String> availableCharsetKey = availableCharsetEntry.keySet();
int[] available = new int[availableCharsetKey.size()];
int i = 0;
for (String string : availableCharsetKey) {
available[i++] = NSStringEncoding.getIntFromCharset(string);
}
return available;
}
/**
* @Signature: defaultCStringEncoding
* @Declaration : + (NSStringEncoding)defaultCStringEncoding
* @Description : Returns the C-string encoding assumed for any method accepting a C string as an argument.
* @return Return Value The C-string encoding assumed for any method accepting a C string as an argument.
* @Discussion This method returns a user-dependent encoding who value is derived from user's default language and potentially other
* factors. You might sometimes need to use this encoding when interpreting user documents with unknown encodings, in the
* absence of other hints, but in general this encoding should be used rarely, if at all. Note that some potential values
* might result in unexpected encoding conversions of even fairly straightforward NSString content—for example, punctuation
* characters with a bidirectional encoding. Methods that accept a C string as an argument use ...CString... in the keywords
* for such arguments: for example, stringWithCString:—note, though, that these are deprecated. The default C-string
* encoding is determined from system information and can’t be changed programmatically for an individual process. See
* “String Encodings� for a full list of supported encodings.
**/
public static NSStringEncoding defaultCStringEncoding() {
return new NSStringEncoding();
}
/**
* @Signature: localizedNameOfStringEncoding:
* @Declaration : + (NSString *)localizedNameOfStringEncoding:(NSStringEncoding)encoding
* @Description : Returns a human-readable string giving the name of a given encoding.
* @param encoding A string encoding.
* @return Return Value A human-readable string giving the name of encoding in the current locale.
**/
public static NSString localizedNameOfStringEncoding(int encoding) {
return new NSString(NSStringEncoding.getCharsetFromInt(encoding).name());
}
/**
* @Signature: canBeConvertedToEncoding:
* @Declaration : - (BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding
* @Description : Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of
* information.
* @param encoding A string encoding.
* @return Return Value YES if the receiver can be converted to encoding without loss of information. Returns NO if characters would
* have to be changed or deleted in the process of changing encodings.
* @Discussion If you plan to actually convert a string, the dataUsingEncoding:... methods return nil on failure, so you can avoid the
* overhead of invoking this method yourself by simply trying to convert the string.
**/
public boolean canBeConvertedToEncoding(int encoding) {
// we encode the string
byte[] bytes = this.wrappedString.getBytes(NSStringEncoding.getCharsetFromInt(encoding)); // Charset to encode into
// Now we decode it :
String decodedString;
try {
decodedString = new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
return false;
} // Charset with which bytes were encoded
return this.wrappedString.equals(decodedString) ? true : false;
}
/**
* @Signature: dataUsingEncoding:
* @Declaration : - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding
* @Description : Returns an NSData object containing a representation of the receiver encoded using a given encoding.
* @param encoding A string encoding.
* @return Return Value The result of invoking dataUsingEncoding:allowLossyConversion: with NO as the second argument (that is,
* requiring lossless conversion).
**/
public NSData dataUsingEncoding(int encoding) {
byte[] bytes = this.wrappedString.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
return new NSData(bytes);
}
/**
* @Signature: dataUsingEncoding:allowLossyConversion:
* @Declaration : - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding allowLossyConversion:(BOOL)flag
* @Description : Returns an NSData object containing a representation of the receiver encoded using a given encoding.
* @param encoding A string encoding.
* @param flag If YES, then allows characters to be removed or altered in conversion.
* @return Return Value An NSData object containing a representation of the receiver encoded using encoding. Returns nil if flag is NO
* and the receiver can’t be converted without losing some information (such as accents or case).
* @Discussion If flag is YES and the receiver can’t be converted without losing some information, some characters may be removed or
* altered in conversion. For example, in converting a character from NSUnicodeStringEncoding to NSASCIIStringEncoding, the
* character ‘�’ becomes ‘A’, losing the accent. This method creates an external representation (with a byte order marker,
* if necessary, to indicate endianness) to ensure that the resulting NSData object can be written out to a file safely. The
* result of this method, when lossless conversion is made, is the default “plain text� format for encoding and is the
* recommended way to save or transmit a string object.
**/
public NSData dataUsingEncodingAllowLossyConversion(int encoding, boolean flag) {
// FIXME check if it's possible to enable lossyConversion
return new NSData(
this.wrappedString.getBytes(NSStringEncoding.getCharsetFromInt(encoding)));
}
/**
* @Declaration : @property (readonly, copy) NSString *description
* @Description : This NSString object. (read-only)
**/
private NSString description;
@Override
public NSString description() {
description = new NSString(wrappedString);
return description;
}
/**
* @Declaration : @property (readonly) NSStringEncoding fastestEncoding
* @Description : The fastest encoding to which the receiver may be converted without loss of information. (read-only)
* @Discussion “Fastest� applies to retrieval of characters from the string. This encoding may not be space efficient.
**/
transient private NSStringEncoding fastestEncoding;
public NSStringEncoding fastestEncoding() {
// NOTMAPPED RETURNS THE DEFAULT ENCODING
return fastestEncoding = new NSStringEncoding();
}
/**
* @Declaration : @property (readonly) NSStringEncoding smallestEncoding
* @Description : The smallest encoding to which the receiver can be converted without loss of information. (read-only)
* @Discussion This encoding may not be the fastest for accessing characters, but is space-efficient. This property may take some time
* to access.
**/
private int smallestEncoding;
public int smallestEncoding() {
// NOTMAPPED RETURNS THE DEFAULT ENCODING
int[] encoding = this.availableStringEncodings();
int smallestEncoding = 0;
int theSmallestEncoding = 0;
for (int i = 0; i < encoding.length; i++) {
byte[] bytes = this.wrappedString
.getBytes(NSStringEncoding.getCharsetFromInt(encoding[i])); // Charset to encode into
// Now we decode it :
String decodedString;
try {
decodedString = new String(bytes, "UTF-8");
if (this.wrappedString.equals(decodedString) && smallestEncoding > bytes.length) {
smallestEncoding = bytes.length;
theSmallestEncoding = encoding[i];
}
} catch (UnsupportedEncodingException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
} // Charset with which bytes were encoded
}
return theSmallestEncoding;
}
// Working with URLs
/**
* stringByAddingPercentEscapesUsingEncoding:
*
* @Returns a representation of the receiver using a given encoding to determine the percent escapes necessary to convert the receiver
* into a legal URL string. - (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
* @Parameters encoding The encoding to use for the returned string. If you are uncertain of the correct encoding you should use
* NSUTF8StringEncoding.
* @Return Value A representation of the receiver using encoding to determine the percent escapes necessary to convert the receiver into
* a legal URL string. Returns nil if encoding cannot encode a particular character.
* @Discussion It may be difficult to use this function to "clean up" unescaped or partially escaped URL strings where sequences are
* unpredictable. See CFURLCreateStringByAddingPercentEscapes for more information.
*/
public NSString stringByAddingPercentEscapesUsingEncoding(int encoding) {
encoding = NSStringEncoding.NSUTF8StringEncoding;
NSString result = new NSString();
if (getWrappedString() == null)
return null;
byte[] bytes = getWrappedString().getBytes(NSStringEncoding.getCharsetFromInt(encoding));
StringBuilder out = new StringBuilder();
for (byte b : bytes)
if ((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b >= '0' && b <= '9'))
out.append((char) b);
else
switch (b) {
case '!':
case '*':
case '\'':
case '(':
case ')':
case ';':
case ':':
case '@':
case '&':
case '=':
case '+':
case '$':
case ',':
case '/':
case '?':
case '#':
case '[':
case ']':
case '-':
case '_':
case '.':
case '~':
out.append((char) b);
break;
default:
out.append('%').append(hex((b & 0xf0) >> 4)).append(hex(b & 0xf));
}
result.wrappedString = out.toString();
return result;
}
private static char hex(int num) {
return num > 9 ? (char) (num + 55) : (char) (num + '0');
}
/**
* stringByReplacingPercentEscapesUsingEncoding:
*
* @Returns a new string made by replacing in the receiver all percent escapes with the matching characters as determined by a given
* encoding. - (NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
* @Parameters encoding The encoding to use for the returned string.
* @Return Value A new string made by replacing in the receiver all percent escapes with the matching characters as determined by the
* given encoding encoding. Returns nil if the transformation is not possible, for example, the percent escapes give a byte
* sequence not legal in encoding.
* @Discussion See CFURLCreateStringByReplacingPercentEscapes for more complex transformations.
*/
public NSString stringByReplacingPercentEscapesUsingEncoding(int encoding) {
NSString result = new NSString();
try {
result.wrappedString = URLDecoder.decode(this.wrappedString,
NSStringEncoding.getCharsetFromInt(encoding).name());
return result;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return result;
}
/**
* stringByAddingPercentEncodingWithAllowedCharacters: Returns a new string made from the receiver by replacing all characters not in
* the specified set with percent encoded characters. - (NSString *)stringByAddingPercentEncodingWithAllowedCharacters:(NSCharacterSet
* *)allowedCharacters Parameters allowedCharacters The characters not replaced in the string. Return Value Returns the encoded string
* or nil if the transformation is not possible. Discussion UTF-8 encoding is used to determine the correct percent encoded characters.
* Entire URL strings cannot be percent-encoded. This method is intended to percent-encode an URL component or subcomponent string, NOT
* the entire URL string. Any characters in allowedCharacters outside of the 7-bit ASCII range are ignored.
*/
public NSString stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet charset) {
if (getWrappedString() == null)
return null;
NSString result = new NSString();
char[] url = getWrappedString().toCharArray();
StringBuilder out = new StringBuilder();
try {
for (char c : url) {
if (charset.characterIsMember(c))
out.append(c);
else {
byte[] bytes = (c + "").getBytes("UTF-8");
for (byte b : bytes) {
out.append('%').append(hex((b & 0xf0) >> 4)).append(hex(b & 0xf));
}
}
}
result.wrappedString = out.toString();
return result;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
// e.printStackTrace();
return null;
}
}
/*
* if(!NSCharacterSet.getCharacterSet().emty) public NSString stringByAddingPercentEncodingWithAllowedCharacters(String URL,
* NSCharacterSet charset) { NSString result = new NSString(); // Converting ArrayList to String in Java using advanced for-each loop
* int hhhh = 0.5; StringBuilder sb = new StringBuilder(); for (int i = 0; i < charset.getCharacterSet().size(); i++) {
* sb.append(charset.getCharacterSet().toArray()[i]).append(';'); // separating contents using semi colon }
*
* String charsetString = sb.toString();
*
* if (URL == null) return null; try { char[] chares = URL.toCharArray();
*
* StringBuilder out = new StringBuilder(); for (char c : chares) {
*
* if (charsetString.contains(c + "")) { out.append(new String(c + "")); } else { byte[] bytes = (c + "").getBytes("UTF-8"); for (byte b
* : bytes) { out.append('%').append(hex((b & 0xf0) >> 4)).append(hex(b & 0xf)); } } } result.wrappedString = out.toString(); return
* result; } catch (UnsupportedEncodingException e) { Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: " +
* Log.getStackTraceString(e)); } return null; }
*/
/**
* stringByRemovingPercentEncoding
*
* @Returns a new string made from the receiver by replacing all percent encoded sequences with the matching UTF-8 characters. -
* (NSString *)stringByRemovingPercentEncoding
* @Return Value A new string with the percent encoded sequences removed.
*/
public NSString stringByRemovingPercentEncoding() {
NSString result = new NSString();
try {
result.wrappedString = URLDecoder.decode(this.wrappedString, "UTF-8");
return result;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return result;
}
@Override
public boolean supportsSecureCoding() {
return false;
}
@Override
public NSObject mutableCopyWithZone(NSZone zone) {
return new NSString(this.getWrappedString());
}
@Override
public String toString() {
return this.getWrappedString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((wrappedString == null) ? 0 : wrappedString.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NSString other = (NSString) obj;
if (wrappedString == null) {
if (other.wrappedString != null)
return false;
} else if (!wrappedString.equals(other.wrappedString))
return false;
return true;
}
@Override
public int compareTo(NSString another) {
NSString str = another;
return getWrappedString().compareTo(str.getWrappedString());
}
@Override
public NSObject copy() {
return new NSString(new String(wrappedString));
}
@Override
public NSObject copyWithZone(NSZone zone) {
return null;
}
// Keys for dictionaries that contain text attributes.
/**
* Key to the font in a text attributes dictionary. The corresponding value is an instance of UIFont. Use a font with size 0.0 to get
* the default font size for the current context.
*/
public static final NSString UITextAttributeFont = new NSString("UITextAttributeFont");
/**
* Key to the text color in a text attributes dictionary. The corresponding value is an instance of UIColor.
*/
public static final NSString UITextAttributeTextColor = new NSString(
"UITextAttributeTextColor");
/**
* Key to the text shadow color in a text attributes dictionary. The corresponding value is an instance of UIColor.
*/
public static final NSString UITextAttributeTextShadowColor = new NSString(
"UITextAttributeTextShadowColor");
/**
* Key to the offset used for the text shadow in a text attributes dictionary. The corresponding value is an instance of NSValue
* wrapping a UIOffset struct.
*/
public static final NSString UITextAttributeTextShadowOffset = new NSString(
"UITextAttributeTextShadowOffset");
/**
* Creates an NSString from its binary representation.
*
* @param bytes The binary representation.
* @param encoding The encoding of the binary representation, the name of a supported charset.
* @throws UnsupportedEncodingException
* @see java.lang.String
*/
public NSString(byte[] bytes, String encoding) throws UnsupportedEncodingException {
setWrappedString(new String(bytes, encoding));
}
/**
* Gets this strings content.
*
* @return This NSString as Java String object.
*/
public String getContent() {
return getWrappedString();
}
/**
* Sets the contents of this string.
*
* @param c The new content of this string object.
*/
public void setContent(String c) {
setWrappedString(c);
}
/**
* Appends a string to this string.
*
* @param s The string to append.
*/
public void append(NSString s) {
append(s.getContent());
}
/**
* Appends a string to this string.
*
* @param s The string to append.
*/
public void append(String s) {
wrappedString += s;
}
/**
* Prepends a string to this string.
*
* @param s The string to prepend.
*/
public void prepend(String s) {
wrappedString = s + wrappedString;
}
/**
* Prepends a string to this string.
*
* @param s The string to prepend.
*/
public void prepend(NSString s) {
prepend(s.getContent());
}
private static CharsetEncoder asciiEncoder, utf16beEncoder, utf8Encoder;
@Override
public void toXML(StringBuilder xml, Integer level) {
toXML(xml, level.intValue());
}
@Override
public void toXML(StringBuilder xml, int level) {
indent(xml, level);
xml.append("<string>");
// Make sure that the string is encoded in UTF-8 for the XML output
synchronized (NSString.class) {
if (utf8Encoder == null)
utf8Encoder = Charset.forName("UTF-8").newEncoder();
else
utf8Encoder.reset();
try {
ByteBuffer byteBuf = utf8Encoder.encode(CharBuffer.wrap(wrappedString));
byte[] bytes = new byte[byteBuf.remaining()];
byteBuf.get(bytes);
wrappedString = new String(bytes, "UTF-8");
} catch (Exception ex) {
Log.d("Exception ",
"Message :" + ex.getMessage() + "\n Could not encode the NSString into UTF-8");
}
}
// According to http://www.w3.org/TR/REC-xml/#syntax node values must not
// contain the characters < or &. Also the > character should be escaped.
if (wrappedString.contains("&") || wrappedString.contains("<")
|| wrappedString.contains(">")) {
xml.append("<![CDATA[");
xml.append(wrappedString.replaceAll("]]>", "]]]]><![CDATA[>"));
xml.append("]]>");
} else {
xml.append(wrappedString);
}
xml.append("</string>");
}
@Override
public void toBinary(BinaryPropertyListWriter out) throws IOException {
CharBuffer charBuf = CharBuffer.wrap(wrappedString);
int kind;
ByteBuffer byteBuf;
synchronized (NSString.class) {
if (asciiEncoder == null)
asciiEncoder = Charset.forName("ASCII").newEncoder();
else
asciiEncoder.reset();
if (asciiEncoder.canEncode(charBuf)) {
kind = 0x5; // standard ASCII
byteBuf = asciiEncoder.encode(charBuf);
} else {
if (utf16beEncoder == null)
utf16beEncoder = Charset.forName("UTF-16BE").newEncoder();
else
utf16beEncoder.reset();
kind = 0x6; // UTF-16-BE
byteBuf = utf16beEncoder.encode(charBuf);
}
}
byte[] bytes = new byte[byteBuf.remaining()];
byteBuf.get(bytes);
out.writeIntHeader(kind, wrappedString.length());
out.write(bytes);
}
@Override
public void toASCII(StringBuilder ascii, int level) {
indent(ascii, level);
ascii.append("\"");
// According to
// https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/OldStylePlists/OldStylePLists.html
// non-ASCII characters are not escaped but simply written into the
// file, thus actually violating the ASCII plain text format.
// We will escape the string anyway because current Xcode project files (ASCII property lists) also escape their
// strings.
ascii.append(escapeStringForASCII(wrappedString));
ascii.append("\"");
}
@Override
public void toASCIIGnuStep(StringBuilder ascii, int level) {
indent(ascii, level);
ascii.append("\"");
ascii.append(escapeStringForASCII(wrappedString));
ascii.append("\"");
}
/**
* Escapes a string for use in ASCII property lists.
*
* @param s The unescaped string.
* @return The escaped string.
*/
static String escapeStringForASCII(String s) {
String out = "";
char[] cArray = s.toCharArray();
for (int i = 0; i < cArray.length; i++) {
char c = cArray[i];
if (c > 127) {
// non-ASCII Unicode
out += "\\U";
String hex = Integer.toHexString(c);
while (hex.length() < 4)
hex = "0" + hex;
out += hex;
} else if (c == '\\') {
out += "\\\\";
} else if (c == '\"') {
out += "\\\"";
} else if (c == '\b') {
out += "\\b";
} else if (c == '\n') {
out += "\\n";
} else if (c == '\r') {
out += "\\r";
} else if (c == '\t') {
out += "\\t";
} else {
out += c;
}
}
return out;
}
/**
* Options for aligning text horizontally. (Deprecated. Use “NSTextAlignment� instead.)
*/
public static enum UITextAlignment {
UITextAlignmentLeft, //
UITextAlignmentCenter, //
UITextAlignmentRight;
int value;
public int getValue() {
return this.ordinal();
}
}
@Override
public NSString retain() {
return this;
}
public NSString stringByAppendingPathComponent(NSString mString) {
if (mString != null) {
StringBuilder strBuilder = new StringBuilder(getWrappedString());
if (!mString.getWrappedString().endsWith("/") && (!"".equals(mString.getWrappedString())
|| "/".equals(mString.getWrappedString())))
return new NSString(strBuilder.append("/" + mString).toString());
}
return mString;
}
@Override
public void encodeWithCoder(NSCoder encoder) {
}
@Override
public NSCoding initWithCoder(NSCoder decoder) {
return null;
}
// Addressable Methods
public static final Adressable adressable = new Adressable() {
NSError[] outError;
@Override
public NSString stringWithContentsOfURLEncodingError(NSURL url, NSStringEncoding enc,
NSError error) {
outError = new NSError[] { error };
return stringWithContentsOfURLEncodingError(url, enc, error);
}
@Override
public NSError[] getStringWithContentsOfURLEncodingErrorArray() {
return outError;
}
};
/*
* public static CGSize sizeWithFontForWidthLineBreakMode(UIFont
* font, CGSize size, int lineBreakMode) { return new CGSize(); }
*/
/**
* Returns the size of the string if it were to be rendered with the specified font on a single line.
*
* @deprecated Deprecation Statement Use sizeWithAttributes: instead.
* @Declaration OBJECTIVE-C - (CGSize)sizeWithFont:(UIFont *)font
* @Parameters font The font to use for computing the string size.
* @return Return Value The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole
* number.
* @Discussion You can use this method to obtain the layout metrics you need to draw a string in your user interface. This method does
* not actually draw the string or alter the receiver’s text in any way.
*
* In iOS 6, this method wraps text using the NSLineBreakByWordWrapping option by default. In earlier versions of iOS, this
* method does not perform any line wrapping and returns the absolute width and height of the string using the specified
* font.
*/
/*
* @Deprecated
*
* public CGSize sizeWithFont(UIFont font) { Rect bounds = new Rect(); Paint paint = new
* Paint(); paint.setTextAlign(Align.LEFT); Typeface typeface = font.typeface; paint.setTypeface(typeface); float textSize =
* font.getWrappedTextSize(); paint.setTextSize(textSize); paint.getTextBounds(getWrappedString(), 0, getWrappedString().length(),
* bounds); return new CGSize(bounds.width(), bounds.height()); }
*/
/**
* Returns the size of the string if it were rendered and constrained to the specified size.
*
* @deprecated Deprecation Statement Use boundingRectWithSize:options:attributes:context: instead. See also UILabel as a possible
* alternative for some use cases.
* @Declaration OBJECTIVE-C - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size
* @Parameters font The font to use for computing the string size. size The maximum acceptable size for the string. This value is used
* to calculate where line breaks and wrapping would occur.
* @return Return Value The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole
* number.
* @Discussion You can use this method to obtain the layout metrics you need to draw a string in your user interface. This method does
* not actually draw the string or alter the receiver’s text in any way.
*
* This method computes the metrics needed to draw the specified string. This method lays out the receiver’s text and
* attempts to make it fit the specified size using the specified font and the NSLineBreakByWordWrapping line break option.
* During layout, the method may break the text onto multiple lines to make it fit better. If the receiver’s text does not
* completely fit in the specified size, it lays out as much of the text as possible and truncates it (for layout purposes
* only) according to the specified line break mode. It then returns the size of the resulting truncated string. If the
* height specified in the size parameter is less than a single line of text, this method may return a height value that is
* bigger than the one specified.
*/
/*
* @Deprecated
*
* public CGSize sizeWithFontConstrainedToSize(UIFont font, CGSize size) { Rect bounds = new
* Rect();
*
* Paint paint = new Paint(); paint.setTextAlign(Align.LEFT); Typeface typeface = font.typeface; paint.setTypeface(typeface); float
* textSize = font.getWrappedTextSize(); paint.setTextSize(textSize); paint.getTextBounds(getWrappedString(), 0,
* getWrappedString().length(), bounds); float h = size.height(); float w = size.width(); if (size.width() > bounds.width()) { w =
* bounds.width(); } if (size.height() > bounds.height()) { h = bounds.height(); } return new CGSize(w, h); }
*/
/**
* Returns the size of the string if it were rendered with the specified constraints.
*
* @deprecated Deprecation Statement Use boundingRectWithSize:options:attributes:context: instead.
* @Declaration OBJECTIVE-C - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size
* lineBreakMode:(NSLineBreakMode)lineBreakMode
* @Parameters font The font to use for computing the string size.<br>
* size The maximum acceptable size for the string. This value is used to calculate where line breaks and wrapping would
* occur.<br>
* lineBreakMode The line break options for computing the size of the string. For a list of possible values, see
* NSLineBreakMode.<br>
* @return Return Value The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole
* number.
* @Discussion You can use this method to obtain the layout metrics you need to draw a string in your user interface. This method does
* not actually draw the string or alter the receiver’s text in any way.
*
* This method computes the metrics needed to draw the specified string. This method lays out the receiver’s text and
* attempts to make it fit the specified size using the specified font and line break options. During layout, the method may
* break the text onto multiple lines to make it fit better. If the receiver’s text does not completely fit in the specified
* size, it lays out as much of the text as possible and truncates it (for layout purposes only) according to the specified
* line break mode. It then returns the size of the resulting truncated string. If the height specified in the size
* parameter is less than a single line of text, this method may return a height value that is bigger than the one
* specified.
*/
/*
* @Deprecated
*
* public CGSize sizeWithFontConstrainedToSizeLineBreakMode(UIFont
* font, CGSize size, NSLineBreakMode lineBreakMode) { // By default android takes lines breaks in the measure return
* sizeWithFontConstrainedToSize(font, size); }
*/
/**
* Draws the string in a single line at the specified point in the current graphics context using the specified font.
*
* @deprecated Deprecation Statement Use drawAtPoint:withAttributes: instead.
* @Declaration OBJECTIVE-C - (CGSize)drawAtPoint:(CGPoint)point withFont:(UIFont *)font
* @Parameters point The location (in the coordinate system of the current graphics context) at which to draw the string. This point
* represents the top-left corner of the string’s bounding box. font The font to use for rendering.
* @return Return Value The size of the rendered string. The returned values may be rounded up to the nearest whole number.
* @Discussion This method draws only a single line of text, drawing as much of the string as possible using the given font. This method
* does not perform any line wrapping during drawing.
*/
/*
* @Deprecated
*
* public CGSize drawAtPointWithFont(CGPoint point, UIFont font) { Paint paint = new
* Paint(); paint.setTextAlign(Align.LEFT); View view =
* GenericMainContext.sharedContext.getWindow().getDecorView().findViewById(android.R.id.content); Canvas canvas = new Canvas();
* canvas.drawText(getWrappedString(), point.getX(), point.getY(), paint); return sizeWithFont(font); }
*/
// Depricated UIKit Additions
/**
* @Signature: boundingRectWithSize:options:context:
* @Declaration : - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options context:(NSStringDrawingContext
* *)context
* @Description : Returns the bounding rectangle required to draw the string.
* @Discussion You can use this method to compute the space required to draw the string. The constraints you specify in the size
* parameter are a guide for the renderer for how to size the string. However, the actual bounding rectangle returned by
* this method can be larger than the constraints if additional space is needed to render the entire string. Typically, the
* renderer preserves the width constraint and adjusts the height constraint as needed. In iOS 7 and later, this method
* returns fractional sizes (in the size component of the returned CGRect); to use a returned size to size views, you must
* use raise its value to the nearest higher integer using the ceil function.
**/
public CGRect boundingRectWithSizeOptionsContext(CGSize size, NSStringDrawingOptions options,
NSStringDrawingContext context) {
return null;
}
/**
* @Signature: drawAtPoint:
* @Declaration : - (void)drawAtPoint:(CGPoint)point
* @Description : Draws the attributed string starting at the specified point in the current graphics context.
* @Discussion This method draws the entire string starting at the specified point. This method draws the line using the attributes
* specified in the attributed string itself. If newline characters are present in the string, those characters are honored
* and cause subsequent text to be placed on the next line underneath the starting point.
**/
public void drawAtPoint(CGPoint point) {
}
/**
* @Signature: drawInRect:
* @Declaration : - (void)drawInRect:(CGRect)rect
* @Description : Draws the attributed string inside the specified bounding rectangle in the current graphics context.
* @Discussion This method draws as much of the string as it can inside the specified rectangle, wrapping the string text as needed to
* make it fit. If the string is too long to fit inside the rectangle, the method renders as much as possible and clips the
* rest. This method draws the line using the attributes specified in the attributed string itself. If newline characters
* are present in the string, those characters are honored and cause subsequent text to be placed on the next line
* underneath the starting point.
**/
public void drawInRect(CGRect rect) {
}
/**
* @Signature: drawWithRect:options:context:
* @Declaration : - (void)drawWithRect:(CGRect)rect options:(NSStringDrawingOptions)options context:(NSStringDrawingContext *)context
* @Description : Draws the attributed string in the specified bounding rectangle using the provided options.
* @Discussion This method draws as much of the string as it can inside the specified rectangle. If
* NSStringDrawingUsesLineFragmentOrigin is specified in options, it wraps the string text as needed to make it fit. If the
* string is too big to fit completely inside the rectangle, the method scales the font or adjusts the letter spacing to
* make the string fit within the given bounds. This method draws the line using the attributes specified in the attributed
* string itself. If newline characters are present in the string, those characters are honored and cause subsequent text to
* be placed on the next line underneath the starting point.
**/
public void drawWithRectOptionsContext(CGRect rect, NSStringDrawingOptions options,
NSStringDrawingContext context) {
}
/**
* @Signature: size
* @Declaration : - (CGSize)size
* @Description : Returns the size required to draw the string.
* @Discussion You can use this method prior to drawing to compute how much space is required to draw the string. In iOS 7 and later,
* this method returns fractional sizes; to use a returned size to size views, you must use raise its value to the nearest
* higher integer using the ceil function.
**/
public CGSize size() {
return null;
}
// UIKit Addition
// 1
/**
* @Signature: boundingRectWithSize:options:attributes:context:
* @Declaration : - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary
* *)attributes context:(NSStringDrawingContext *)context
* @Description : Calculates and returns the bounding rect for the receiver drawn using the given options and display characteristics,
* within the specified rectangle in the current graphics context.
* @Discussion To correctly draw and size multi-line text, pass NSStringDrawingUsesLineFragmentOrigin in the options parameter. This
* method returns fractional sizes (in the size component of the returned CGRect); to use a returned size to size views, you
* must raise its value to the nearest higher integer using the ceil function.
**/
public CGRect boundingRectWithSizeOptionsAttributesContext(CGSize size,
NSStringDrawingOptions options, NSDictionary attributes,
NSStringDrawingContext context) {
return null;
}
// 2
/**
* @Signature: drawAtPoint:withAttributes:
* @Declaration : - (void)drawAtPoint:(CGPoint)point withAttributes:(NSDictionary *)attrs
* @Description : Draws the receiver with the font and other display characteristics of the given attributes, at the specified point in
* the current graphics context.
* @Discussion The width (height for vertical layout) of the rendering area is unlimited, unlike drawInRect:withAttributes:, which uses
* a bounding rectangle. As a result, this method renders the text in a single line. However, if newline characters are
* present in the string, those characters are honored and cause subsequent text to be placed on the next line underneath
* the starting point.
**/
public void drawAtPointWithAttributes(CGPoint point, NSDictionary attrs) {
}
// 3
/**
* @Signature: drawInRect:withAttributes:
* @Declaration : - (void)drawInRect:(CGRect)rect withAttributes:(NSDictionary *)attrs
* @Description : Draws the attributed string inside the specified bounding rectangle in the current graphics context.
* @Discussion This method draws as much of the string as it can inside the specified rectangle, wrapping the string text as needed to
* make it fit. If the string is too long to fit inside the rectangle, the method renders as much as possible and clips the
* rest. If newline characters are present in the string, those characters are honored and cause subsequent text to be
* placed on the next line underneath the starting point.
**/
public void drawInRectWithAttributes(CGRect rect, NSDictionary attrs) {
}
// 4
/**
* @Signature: drawWithRect:options:attributes:context:
* @Declaration : - (void)drawWithRect:(CGRect)rect options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes
* context:(NSStringDrawingContext *)context
* @Description : Draws the attributed string in the specified bounding rectangle using the provided options.
* @Discussion This method draws as much of the string as it can inside the specified rectangle, wrapping the string text as needed to
* make it fit. If the string is too big to fit completely inside the rectangle, the method scales the font or adjusts the
* letter spacing to make the string fit within the given bounds. If newline characters are present in the string, those
* characters are honored and cause subsequent text to be placed on the next line underneath the starting point. To
* correctly draw and size multi-line text, pass NSStringDrawingUsesLineFragmentOrigin in the options parameter.
**/
public void drawWithRectOptionsAttributesContext(CGRect rect, NSStringDrawingOptions options,
NSDictionary attributes, NSStringDrawingContext context) {
}
// 5
/**
* @Signature: sizeWithAttributes:
* @Declaration : - (CGSize)sizeWithAttributes:(NSDictionary *)attrs
* @Description : Returns the bounding box size the receiver occupies when drawn with the given attributes.
* @Discussion This method returns fractional sizes; to use a returned size to size views, you must raise its value to the nearest
* higher integer using the ceil function.
**/
public CGSize sizeWithAttributes(NSDictionary attrs) {
return null;
}
public boolean containsString(NSString aString) {
if (aString != null && aString.getWrappedString() != null) {
if (this.getWrappedString() != null) {
return this.getWrappedString().contains(aString.getWrappedString());
}
}
return false;
}
} | UTF-8 | Java | 238,008 | java | NSString.java | Java | [] | null | [] |
package com.myappconverter.java.foundations;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.text.Collator;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.SortedMap;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.os.AsyncTask;
import android.util.Log;
import com.myappconverter.java.corefoundations.utilities.AndroidIOUtils;
import com.myappconverter.java.coregraphics.CGPoint;
import com.myappconverter.java.coregraphics.CGRect;
import com.myappconverter.java.coregraphics.CGSize;
import com.myappconverter.java.foundations.NSLinguisticTagger.NSLinguisticTaggerOptions;
import com.myappconverter.java.foundations.NSObjCRuntime.NSComparisonResult;
import com.myappconverter.java.foundations.constants.NSStringEncoding;
import com.myappconverter.java.foundations.protocols.NSCoding;
import com.myappconverter.java.foundations.protocols.NSCopying;
import com.myappconverter.java.foundations.protocols.NSMutableCopying;
import com.myappconverter.java.foundations.protocols.NSSecureCoding;
import com.myappconverter.java.foundations.utilities.AndroidFilenameUtils;
import com.myappconverter.java.foundations.utilities.AndroidWordUtils;
import com.myappconverter.java.foundations.utilities.BinaryPropertyListWriter;
import com.myappconverter.java.uikit.NSStringDrawing.NSStringDrawingOptions;
import com.myappconverter.java.uikit.NSStringDrawingContext;
import com.myappconverter.mapping.utils.AndroidFileUtils;
import com.myappconverter.mapping.utils.AndroidRessourcesUtils;
import com.myappconverter.mapping.utils.AndroidStringUtils;
import com.myappconverter.mapping.utils.AndroidVersionUtils;
import com.myappconverter.mapping.utils.GenericMainContext;
import com.myappconverter.mapping.utils.InstanceTypeFactory;
import com.myappconverter.mapping.utils.PerformBlock;
public class NSString extends NSObject
implements Serializable, NSCopying, NSMutableCopying, NSSecureCoding, Comparable<NSString> {
private static final Logger LOGGER = Logger.getLogger(NSString.class.getName());
private static final long serialVersionUID = 1L;
protected static final String TAG = "NSString";
public interface Adressable {
NSString stringWithContentsOfURLEncodingError(NSURL url, NSStringEncoding enc,
NSError error);
NSError[] getStringWithContentsOfURLEncodingErrorArray();
}
// Enumeration
public static enum NSStringEnumerationOptions {
NSStringEnumerationByLines(0), //
NSStringEnumerationByParagraphs(1), //
NSStringEnumerationByComposedCharacterSequences(2), //
NSStringEnumerationByWords(3), //
NSStringEnumerationBySentences(4), //
NSStringEnumerationReverse(1L << 8), //
NSStringEnumerationSubstringNotRequired(1L << 9), //
NSStringEnumerationLocalized(1L << 10);
long value;
NSStringEnumerationOptions(long v) {
value = v;
}
public long getValue() {
return value;
}
};
public static enum NSStringEncodingConversionOptions {
NSStringEncodingConversionAllowLossy(1), //
NSStringEncodingConversionExternalRepresentation(2);
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
int value;
NSStringEncodingConversionOptions(int v) {
value = v;
}
};
public static enum NSStringCompareOptions {
NSCaseInsensitiveSearch(1), //
NSLiteralSearch(2), //
NSBackwardsSearch(4), //
NSAnchoredSearch(8), //
NSNumericSearch(64), //
NSDiacriticInsensitiveSearch(128), //
NSWidthInsensitiveSearch(256), //
NSForcedOrderingSearch(512), //
NSRegularExpressionSearch(1024);
int value;
NSStringCompareOptions(int v) {
value = v;
}
public int getValue() {
return value;
}
}
protected String wrappedString;
public String getWrappedString() {
return wrappedString;
}
public void setWrappedString(String aString) {
wrappedString = aString;
}
public NSString() {
this.wrappedString = new String();
}
public NSString(String string) {
this.wrappedString = string;
}
// Creating and Initializing Strings
/**
* @Signature: string
* @Declaration : + (instancetype)string
* @Description : Returns an empty string.
* @return Return Value An empty string.
**/
public static NSString string() {
return new NSString();
}
public static NSString string(Class clazz) {
NSString str = new NSString();
return (NSString) InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: init
* @Declaration : - (instancetype)init
* @Description : Returns an initialized NSString object that contains no characters.
* @return Return Value An initialized NSString object that contains no characters. The returned object may be different from the
* original receiver.
**/
@Override
public NSString init() {
return this;
}
/**
* @Signature: initWithBytes:length:encoding:
* @Declaration : - (instancetype)initWithBytes:(const void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding
* @Description : Returns an initialized NSString object containing a given number of bytes from a given buffer of bytes interpreted in
* a given encoding.
* @param bytes A buffer of bytes interpreted in the encoding specified by encoding.
* @param length The number of bytes to use from bytes.
* @param encoding The character encoding applied to bytes.
* @return Return Value An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The
* returned object may be different from the original receiver. The return byte strings are allowed to be unterminated. If the
* length of the byte string is greater than the specified length a nil value is returned.
**/
public Object initWithBytesLengthEncoding(byte[] bytes, int length, int encoding) {
if (bytes.length < length) {
return null;
} else {
this.wrappedString = new String(bytes, 0, length,
NSStringEncoding.getCharsetFromInt(encoding));
return this;
}
}
public Object initWithBytesLengthEncoding(Class clazz, byte[] bytes, int length, NSStringEncoding encoding) {
// not yet covered
if (bytes.length < length) {
return null;
} else {
// NSStringEncoding.getWrappedCharset() not yet covered
// this.wrappedString = new String(bytes, 0, length, encoding.getWrappedCharset());
return InstanceTypeFactory.getInstance(this, NSString.class, clazz, new NSString("setWrappedString"),
this.getWrappedString());
}
}
/**
* @Signature: initWithBytesNoCopy:length:encoding:freeWhenDone:
* @Declaration : - (instancetype)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding
* freeWhenDone:(BOOL)flag
* @Description : Returns an initialized NSString object that contains a given number of bytes from a given buffer of bytes interpreted
* in a given encoding, and optionally frees the buffer.
* @param bytes A buffer of bytes interpreted in the encoding specified by encoding.
* @param length The number of bytes to use from bytes.
* @param encoding The character encoding of bytes.
* @param flag If YES, the receiver frees the memory when it no longer needs the data; if NO it won’t.
* @return Return Value An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The
* returned object may be different from the original receiver.
**/
public Object initWithBytesNoCopyLengthEncodingFreeWhenDone(byte[] bytes, int length,
int encoding, boolean freeWhenDone) {
if (bytes.length < length) {
return null;
} else {
this.wrappedString = new String(bytes, 0, length,
NSStringEncoding.getCharsetFromInt(encoding));
if (freeWhenDone) {
bytes = null;
}
return this;
}
}
public Object initWithBytesNoCopyLengthEncodingFreeWhenDone(Class clazz, byte[] bytes, int length, NSStringEncoding encoding,
boolean freeWhenDone) {
// not yet covered
if (bytes.length < length) {
return null;
} else {
// NSStringEncoding.getWrappedCharset() not yet covered
// this.wrappedString = new String(bytes, 0, length, encoding.getWrappedCharset());
if (freeWhenDone) {
bytes = null;
}
return InstanceTypeFactory.getInstance(this, NSString.class, clazz, new NSString("setWrappedString"), this.getWrappedString());
}
}
/**
* @Signature: initWithCharacters:length:
* @Declaration : - (instancetype)initWithCharacters:(const unichar *)characters length:(NSUInteger)length
* @Description : Returns an initialized NSString object that contains a given number of characters from a given C array of Unicode
* characters.
* @param characters A C array of Unicode characters; the value must not be NULL. Important:Â Raises an exception if characters is NULL,
* even if length is 0.
* @param length The number of characters to use from characters.
* @return Return Value An initialized NSString object containing length characters taken from characters. The returned object may be
* different from the original receiver.
**/
public Object initWithCharactersLength(char[] characters, int length) {
this.wrappedString = new String(characters, 0, length);
return this;
}
public Object initWithCharactersLength(Class clazz, char[] characters, int length) {
this.wrappedString = new String(characters, 0, length);
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithCharactersNoCopy:length:freeWhenDone:
* @Declaration : - (instancetype)initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)flag
* @Description : Returns an initialized NSString object that contains a given number of characters from a given C array of Unicode
* characters.
* @param characters A C array of Unicode characters.
* @param length The number of characters to use from characters.
* @param flag If YES, the receiver will free the memory when it no longer needs the characters; if NO it won’t.
* @return Return Value An initialized NSString object that contains length characters from characters. The returned object may be
* different from the original receiver.
**/
public Object initWithCharactersNoCopyLengthFreeWhenDone(char[] characters, int length,
boolean freeWhenDone) {
if (length < characters.length)
this.wrappedString = new String(characters, 0, length);
else
this.wrappedString = new String(characters);
if (freeWhenDone) {
characters = null;
}
return this;
}
public Object initWithCharactersNoCopyLengthFreeWhenDone(Class clazz, char[] characters,
int length, boolean freeWhenDone) {
if (length < characters.length)
this.wrappedString = new String(characters, 0, length);
else
this.wrappedString = new String(characters);
if (freeWhenDone) {
characters = null;
}
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithString:
* @Declaration : - (instancetype)initWithString:(NSString *)aString
* @Description : Returns an NSString object initialized by copying the characters from another given string.
* @param aString The string from which to copy characters. This value must not be nil. Important:Â Raises an NSInvalidArgumentException
* if aString is nil.
* @return Return Value An NSString object initialized by copying the characters from aString. The returned object may be different from
* the original receiver.
**/
public Object initWithString(NSString string) {
this.wrappedString = string.wrappedString;
return this;
}
public Object initWithString(Class clazz, NSString string) {
this.wrappedString = string.wrappedString;
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithCString:encoding:
* @Declaration : - (instancetype)initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding
* @Description : Returns an NSString object initialized using the characters in a given C array, interpreted according to a given
* encoding.
* @param nullTerminatedCString A C array of characters. The array must end with a NULL character; intermediate NULL characters are not
* allowed.
* @param encoding The encoding of nullTerminatedCString.
* @return Return Value An NSString object initialized using the characters from nullTerminatedCString. The returned object may be
* different from the original receiver
* @Discussion If nullTerminatedCString is not a NULL-terminated C string, or encoding does not match the actual encoding, the results
* are undefined.
**/
public Object initWithCStringEncoding(char[] characters, int encoding) {
Object nsString = null;
try {
nsString = this.getClass().newInstance();
CharBuffer cbuf = CharBuffer.wrap(characters);
Charset charset = (encoding != 0) ? NSStringEncoding.getCharsetFromInt(encoding)
: Charset.defaultCharset();
ByteBuffer bbuf = charset.encode(cbuf);
if (nsString instanceof NSString) {
((NSString) nsString).setWrappedString(new String(bbuf.array()));
} else if (nsString instanceof NSMutableString) {
((NSMutableString) nsString).setWrappedString(new String(bbuf.array()));
}
} catch (InstantiationException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
} catch (IllegalAccessException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return nsString;
}
public Object initWithCStringEncoding(Class clazz, char[] characters, int encoding) {
Object nsString = null;
try {
nsString = this.getClass().newInstance();
CharBuffer cbuf = CharBuffer.wrap(characters);
Charset charset = (encoding != 0) ? NSStringEncoding.getCharsetFromInt(encoding)
: Charset.defaultCharset();
ByteBuffer bbuf = charset.encode(cbuf);
if (nsString instanceof NSString) {
((NSString) nsString).setWrappedString(new String(bbuf.array()));
} else if (nsString instanceof NSMutableString) {
((NSMutableString) nsString).setWrappedString(new String(bbuf.array()));
}
} catch (InstantiationException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
} catch (IllegalAccessException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return InstanceTypeFactory.getInstance(nsString, NSString.class, clazz,
new NSString("setWrappedString"), ((NSString) nsString).getWrappedString());
}
/**
* @Signature: initWithUTF8String:
* @Declaration : - (instancetype)initWithUTF8String:(const char *)bytes
* @Description : Returns an NSString object initialized by copying the characters from a given C array of UTF8-encoded bytes.
* @param bytes A NULL-terminated C array of bytes in UTF-8 encoding. This value must not be NULL. Important:Â Raises an exception if
* bytes is NULL.
* @return Return Value An NSString object initialized by copying the bytes from bytes. The returned object may be different from the
* original receiver.
**/
public Object initWithUTF8String(char[] characters) {
// @TODO check encoding
this.wrappedString = new String(characters);
return this;
}
public Object initWithUTF8String(Class clazz, char[] characters) {
// @TODO check encoding
this.wrappedString = new String(characters);
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format, ...
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value An NSString object initialized by using format as a template into which the remaining argument values are
* substituted according to the system locale. The returned object may be different from the original receiver.
* @Discussion Invokes initWithFormat:locale:arguments: with nil as the locale, hence using the system locale to format numbers. This is
* useful, for example, if you want to produce "non-localized" formatting which needs to be written out to files and parsed
* back later.
**/
public Object initWithFormat(NSString format, Object... arg) {
if (format == null)
throw new IllegalArgumentException();
this.wrappedString = String.format(format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return this;
}
public Object initWithFormat(Class clazz, NSString format, Object... arg) {
if (format == null)
throw new IllegalArgumentException("format is null");
this.wrappedString = String.format(format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:arguments:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format arguments:(va_list)argList
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted according to the current locale.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param argList A list of arguments to substitute into format.
* @return Return Value An NSString object initialized by using format as a template into which the values in argList are substituted
* according to the current locale. The returned object may be different from the original receiver.
* @Discussion Invokes initWithFormat:locale:arguments: with nil as the locale.
**/
public Object initWithFormatArguments(NSString format, NSObject... arg) {
List<NSObject> argList = new ArrayList<NSObject>();
for (NSObject objArg : arg) {
argList.add(objArg);
}
this.wrappedString = String.format(format.getWrappedString(), argList.toArray());
return this;
}
public Object initWithFormatArguments(Class clazz, NSString format, NSObject... arg) {
List<NSObject> argList = new ArrayList<NSObject>();
for (NSObject objArg : arg) {
argList.add(objArg);
}
this.wrappedString = String.format(format.getWrappedString(), argList.toArray());
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:locale:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format locale:(id)locale, ...
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted according to given locale.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param locale An NSLocale object specifying the locale to use. To use the current locale, pass [NSLocalecurrentLocale]. To use the
* system locale, pass nil. For legacy support, this may be an instance of NSDictionary containing locale information.
* @param ... A comma-separated list of arguments to substitute into format.
* @Discussion Invokes initWithFormat:locale:arguments: with locale as the locale.
**/
public Object initWithFormatLocale(NSString format, NSLocale local, NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return this;
}
public Object initWithFormatLocale(Class clazz, NSString format, NSLocale local,
NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithFormat:locale:arguments:
* @Declaration : - (instancetype)initWithFormat:(NSString *)format locale:(id)locale arguments:(va_list)argList
* @Description : Returns an NSString object initialized by using a given format string as a template into which the remaining argument
* values are substituted according to given locale information.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param locale An NSLocale object specifying the locale to use. To use the current locale (specified by user preferences), pass
* [NSLocalecurrentLocale]. To use the system locale, pass nil. For legacy support, this may be an instance of NSDictionary
* containing locale information.
* @param argList A list of arguments to substitute into format.
* @return Return Value An NSString object initialized by using format as a template into which values in argList are substituted
* according the locale information in locale. The returned object may be different from the original receiver.
* @Discussion The following code fragment illustrates how to create a string from myArgs, which is derived from a string object with
* the value “Cost:� and an int with the value 32: va_list myArgs; NSString *myString = [[NSString alloc] initWithFormat:@
* "%@: %d\n" locale:[NSLocale currentLocale] arguments:myArgs]; The resulting string has the value “Cost: 32\n�. See
* String Programming Guide for more information.
**/
public Object initWithFormatLocaleArguments(NSString format, NSLocale local, NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return this;
}
public Object initWithFormatLocaleArguments(Class clazz, NSString format, NSLocale local,
NSString... arg) {
if (arg.length > 0) {
format = arg[0];
if (format == null)
throw new IllegalArgumentException();
}
this.wrappedString = String.format(local.getWrappedLocale(), format.getWrappedString(),
(Object) (Arrays.copyOfRange(arg, 0, arg.length - 1)));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: initWithData:encoding:
* @Declaration : - (instancetype)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding
* @Description : Returns an NSString object initialized by converting given data into Unicode characters using a given encoding.
* @param data An NSData object containing bytes in encoding and the default plain text format (that is, pure content with no attributes
* or other markups) for that encoding.
* @param encoding The encoding used by data.
* @return Return Value An NSString object initialized by converting the bytes in data into Unicode characters using encoding. The
* returned object may be different from the original receiver. Returns nil if the initialization fails for some reason (for
* example if data does not represent valid data for encoding).
**/
public Object initWithDataEncoding(NSData data, int encoding) {
this.wrappedString = new String(data.getWrappedData(),
NSStringEncoding.getCharsetFromInt(encoding));
return this;
}
public Object initWithDataEncoding(Class clazz, NSData data, int encoding) {
this.wrappedString = new String(data.getWrappedData(),
NSStringEncoding.getCharsetFromInt(encoding));
return InstanceTypeFactory.getInstance(this, NSString.class, clazz,
new NSString("setWrappedString"), this.getWrappedString());
}
/**
* @Signature: stringWithFormat:
* @Declaration : + (instancetype)stringWithFormat:(NSString *)format,, ...
* @Description : Returns a string created by using a given format string as a template into which the remaining argument values are
* substituted.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if format is
* nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value A string created by using format as a template into which the remaining argument values are substituted
* according to the system locale.
* @Discussion This method is similar to localizedStringWithFormat:, but using the system locale to format numbers. This is useful, for
* example, if you want to produce “non-localized� formatting which needs to be written out to files and parsed back later.
**/
public static NSString stringWithFormat(NSString format, Object... args) {
// not yet covered
// if (format.getWrappedString() == null) {
// throw new IllegalArgumentException("stringWithFormat : format must not be null");
// }
// // String aFormat = format.getWrappedString().replace("%@", "%s");
// // return new NSString(String.format(aFormat, args));
//
// String[] params = { "1$", "2$", "3$", "4$", "5$" };
// String mStr = format.getWrappedString();
// for (String str : params) {
// if (format.getWrappedString().indexOf(str) != -1)
// mStr = mStr.replace(str, "");
// }
//
// mStr = mStr.replaceAll("%@", "%s");
// mStr = mStr.replaceAll("ld", "d");
// mStr = mStr.replaceAll("lf", "f");
// mStr = mStr.replaceAll("lx", "d");
// mStr = mStr.replaceAll("lu", "d");
// // mStr = mStr.replaceAll("(?i)u", "d");//FIXME music ===> mdsic
// mStr = mStr.replaceAll("%%", "%c");
// mStr = mStr.replaceAll("\\.f", "f");
// mStr = mStr.replaceAll("%02i", "%02d");
// mStr = mStr.replaceAll("%i", "%d");
// return new NSString(String.format(mStr, args));
return null;
}
public static NSString stringWithFormat(Class clazz, NSString format, Object... args) {
if (format.getWrappedString() == null) {
throw new IllegalArgumentException("stringWithFormat : format must not be null");
}
String[] params = { "1$", "2$", "3$", "4$", "5$" };
String mStr = format.getWrappedString();
for (String str : params) {
if (format.getWrappedString().indexOf(str) != -1)
mStr = mStr.replace(str, "");
}
mStr = mStr.replaceAll("%@", "%s");
mStr = mStr.replaceAll("%ld", "%d");
mStr = mStr.replaceAll("%lf", "%f");
mStr = mStr.replaceAll("%lx", "%d");
mStr = mStr.replaceAll("%lu", "%d");
// convert an int32 argument
mStr = mStr.replaceAll("%li", "%d");
mStr = mStr.replaceAll("%lX", "%d");
mStr = mStr.replaceAll("%lo", "%d");
mStr = mStr.replaceAll("%lu", "%d");
// mStr = mStr.replaceAll("(?i)u", "d");//FIXME music ===> mdsic
mStr = mStr.replaceAll("%%", "%c");
mStr = mStr.replaceAll("\\.f", "%f");
mStr = mStr.replaceAll("%02i", "%02d");
mStr = mStr.replaceAll("%i", "%d");
mStr = mStr.replaceAll("%04d", "%04d");
mStr = mStr.replaceAll("%02li", "%02d");
if (args.length < 1) {
args = null;
}
NSString newstr = new NSString(String.format(mStr, args));
return (NSString) InstanceTypeFactory.getInstance(newstr, NSString.class, clazz,
new NSString("setWrappedString"), newstr.getWrappedString());
}
/**
* @Signature: localizedStringWithFormat:
* @Declaration : + (instancetype)localizedStringWithFormat:(NSString *)format, ...
* @Description : Returns a string created by using a given format string as a template into which the remaining argument values are
* substituted according to the current locale.
* @param format A format string. See “Formatting String Objects� for examples of how to use this method, and “String Format Specifiers�
* for a list of format specifiers. This value must not be nil. Raises an NSInvalidArgumentException if format is nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value A string created by using format as a template into which the following argument values are substituted
* according to the formatting information in the current locale.
* @Discussion This method is equivalent to using initWithFormat:locale: and passing the current locale as the locale argument.
**/
public static NSString localizedStringWithFormat(NSString format, NSString... args) {
NSString nsString = new NSString();
if (format == null)
throw new IllegalArgumentException();
nsString.setWrappedString(String.format(Locale.getDefault(), format.getWrappedString()));
return nsString;
}
public static NSString localizedStringWithFormat(Class clazz, NSString format,
NSString... args) {
NSString nsString = new NSString();
if (format == null)
throw new IllegalArgumentException();
nsString.setWrappedString(String.format(Locale.getDefault(), format.getWrappedString()));
return nsString;
}
/**
* @Signature: stringWithCharacters:length:
* @Declaration : + (instancetype)stringWithCharacters:(const unichar *)chars length:(NSUInteger)length
* @Description : Returns a string containing a given number of characters taken from a given C array of Unicode characters.
* @param chars A C array of Unicode characters; the value must not be NULL. Important:Â Raises an exception if chars is NULL, even if
* length is 0.
* @param length The number of characters to use from chars.
* @return Return Value A string containing length Unicode characters taken (starting with the first) from chars.
**/
public static NSString stringWithCharactersLength(char[] characters, int length) {
NSString myNSString = new NSString();
myNSString.wrappedString = new String(characters, 0, length);
return myNSString;
}
public static Object stringWithCharactersLength(Class clazz, char[] characters, int length) {
NSString myNSString = new NSString();
myNSString.wrappedString = new String(characters, 0, length);
return InstanceTypeFactory.getInstance(myNSString, NSString.class, clazz,
new NSString("setWrappedString"), myNSString.getWrappedString());
}
/**
* @Signature: stringWithString:
* @Declaration : + (instancetype)stringWithString:(NSString *)aString
* @Description : Returns a string created by copying the characters from another given string.
* @param aString The string from which to copy characters. This value must not be nil. Important:Â Raises an NSInvalidArgumentException
* if aString is nil.
* @return Return Value A string created by copying the characters from aString.
**/
public static NSString stringWithString(NSString mString) {
NSString myNSString = new NSString();
myNSString.wrappedString = mString.wrappedString;
return myNSString;
}
public static Object stringWithString(Class clazz, NSString mString) {
NSString myNSString = new NSString();
myNSString.wrappedString = mString.wrappedString;
return InstanceTypeFactory.getInstance(myNSString, NSString.class, clazz,
new NSString("setWrappedString"), myNSString.getWrappedString());
}
/**
* @Signature: stringWithCString:encoding:
* @Declaration : + (instancetype)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc
* @Description : Returns a string containing the bytes in a given C array, interpreted according to a given encoding.
* @param cString A C array of bytes. The array must end with a NULL byte; intermediate NULL bytes are not allowed.
* @param enc The encoding of cString.
* @return Return Value A string containing the characters described in cString.
* @Discussion If cString is not a NULL-terminated C string, or encoding does not match the actual encoding, the results are undefined.
**/
public static NSString stringWithCStringEncoding(char[] characters, int encoding) {
if (characters != null && characters.length > 0 && encoding != 0) {
byte bytes[] = (new String(characters))
.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
return new NSString(new String(bytes, Charset.defaultCharset()));
}
throw new IllegalArgumentException(" This value must not be null");
}
public static Object stringWithCStringEncoding(Class clazz, char[] characters, int encoding) {
if (characters != null && characters.length > 0 && encoding != 0) {
byte bytes[] = (new String(characters))
.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
NSString str = new NSString(new String(bytes, Charset.defaultCharset()));
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
throw new IllegalArgumentException(" This value must not be null");
}
/**
* @Signature: stringWithCString:encoding:
* @Declaration : + (instancetype)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc
* @Description : Returns a string containing the bytes in a given C array, interpreted according to a given encoding.
* @param cString A C array of bytes. The array must end with a NULL byte; intermediate NULL bytes are not allowed.
* @param enc The encoding of cString.
* @return Return Value A string containing the characters described in cString.
* @Discussion If cString is not a NULL-terminated C string, or encoding does not match the actual encoding, the results are undefined.
**/
public static NSString stringWithCStringEncoding(String characters, int encoding) {
if (characters != null && characters.length() > 0 && encoding != 0) {
byte bytes[] = characters.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
return new NSString(new String(bytes, Charset.defaultCharset()));
}
throw new IllegalArgumentException(" This value must not be null");
}
public static Object stringWithCStringEncoding(Class clazz, String characters, int encoding) {
if (characters != null && characters.length() > 0 && encoding != 0) {
byte bytes[] = characters.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
NSString str = new NSString(new String(bytes, Charset.defaultCharset()));
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
throw new IllegalArgumentException(" This value must not be null");
}
/**
* @Signature: stringWithUTF8String:
* @Declaration : + (instancetype)stringWithUTF8String:(const char *)bytes
* @Description : Returns a string created by copying the data from a given C array of UTF8-encoded bytes.
* @param bytes A NULL-terminated C array of bytes in UTF8 encoding. Important:Â Raises an exception if bytes is NULL.
* @return Return Value A string created by copying the data from bytes.
**/
public static NSString stringWithUTF8String(char[] string) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string);
return myNSSTring;
}
public static Object stringWithUTF8String(Class clazz, char[] string) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string);
return InstanceTypeFactory.getInstance(myNSSTring, NSString.class, clazz,
new NSString("setWrappedString"), myNSSTring.getWrappedString());
}
public static Object stringWithUTF8String(Class clazz, NSString string) {
return InstanceTypeFactory.getInstance(string, NSString.class, clazz,
new NSString("setWrappedString"), string.getWrappedString());
}
/**
* @Signature: stringWithCString:
* @Declaration : + (id)stringWithCString:(const char *)cString
* @Description : Creates a new string using a given C-string. (Deprecated in iOS 2.0. Use stringWithCString:encoding: instead.)
* @Discussion cString should contain data in the default C string encoding. If the argument passed to stringWithCString: is not a
* zero-terminated C-string, the results are undefined.
**/
public static NSString stringWithCString(char[] string) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string);
return myNSSTring;
}
/**
* @Signature: stringWithCString:length:
* @Declaration : + (id)stringWithCString:(const char *)cString length:(NSUInteger)length
* @Description : Returns a string containing the characters in a given C-string. (Deprecated in iOS 2.0. Use
* stringWithCString:encoding: instead.)
* @Discussion cString must not be NULL. cString should contain characters in the default C-string encoding. This method converts length
* * sizeof(char) bytes from cString and doesn’t stop short at a NULL character.
**/
public static NSString stringWithCStringLength(char[] string, int length) {
NSString myNSSTring = new NSString();
myNSSTring.wrappedString = new String(string, 0, length);
return myNSSTring;
}
/**
* @Signature: initWithCString:
* @Declaration : - (id)initWithCString:(const char *)cString
* @Description : Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the
* default C-string encoding into the Unicode character encoding. (Deprecated in iOS 2.0. Use initWithCString:encoding:
* instead.)
* @Discussion cString must be a zero-terminated C string in the default C string encoding, and may not be NULL. Returns an initialized
* object, which might be different from the original receiver. To create an immutable string from an immutable C string
* buffer, do not attempt to use this method. Instead, use initWithCStringNoCopy:length:freeWhenDone:.
**/
public NSString initWithCString(char[] string) {
this.wrappedString = new String(string);
return this;
}
/**
* @Signature: initWithCString:length:
* @Declaration : - (id)initWithCString:(const char *)cString length:(NSUInteger)length
* @Description : Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the
* default C-string encoding into the Unicode character encoding. (Deprecated in iOS 2.0. Use
* initWithBytes:length:encoding: instead.)
* @Discussion This method converts length * sizeof(char) bytes from cString and doesn’t stop short at a zero character. cString must
* contain bytes in the default C-string encoding and may not be NULL. Returns an initialized object, which might be
* different from the original receiver.
**/
public NSString initWithCStringLength(char[] string, int length) {
this.wrappedString = new String(string, 0, length);
return this;
}
/**
* @Signature: initWithCStringNoCopy:length:freeWhenDone:
* @Declaration : - (id)initWithCStringNoCopy:(char *)cString length:(NSUInteger)length freeWhenDone:(BOOL)flag
* @Description : Initializes the receiver, a newly allocated NSString object, by converting the data in a given C-string from the
* default C-string encoding into the Unicode character encoding. (Deprecated in iOS 2.0. Use
* initWithBytesNoCopy:length:encoding:freeWhenDone: instead.)
* @Discussion This method converts length * sizeof(char) bytes from cString and doesn’t stop short at a zero character. cString must
* contain data in the default C-string encoding and may not be NULL. The receiver becomes the owner of cString; if flag is
* YES it will free the memory when it no longer needs it, but if flag is NO it won’t. Returns an initialized object, which
* might be different from the original receiver. You can use this method to create an immutable string from an immutable
* (const char *) C-string buffer. If you receive a warning message, you can disregard it; its purpose is simply to warn you
* that the C string passed as the method’s first argument may be modified. If you make certain the freeWhenDone argument to
* initWithStringNoCopy is NO, the C string passed as the method’s first argument cannot be modified, so you can safely use
* initWithStringNoCopy to create an immutable string from an immutable (const char *) C-string buffer.
**/
public NSString initWithCStringNoCopyLengthFreeWhenDone(char[] string, int length,
boolean freeWhenDone) {
this.wrappedString = new String(string, 0, length);
if (freeWhenDone) {
string = null;
}
return this;
}
// Creating and Initializing a String from a File
/**
* @Signature: stringWithContentsOfFile:encoding:error:
* @Declaration : + (instancetype)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns a string created by reading data from the file at a given path interpreted using a given encoding.
* @param path A path to a file.
* @param enc The encoding of the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value A string created by reading data from the file named by path using the encoding, enc. If the file can’t be
* opened or there is an encoding error, returns nil.
**/
public static NSString stringWithContentsOfFileEncodingError(NSString path, int enc,
NSError[] error) {
// TODO use Encoding
if (AndroidVersionUtils.isInteger(path.getWrappedString())) {
if (Integer.parseInt(path.getWrappedString()) == 0) {
return null;
}
int resId = Integer.parseInt(path.getWrappedString());
InputStream is = GenericMainContext.sharedContext.getResources().openRawResource(resId);
String mystring = null;
try {
mystring = AndroidIOUtils.toString(is);
AndroidIOUtils.closeQuietly(is);
return new NSString(mystring);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
return null;
}
} else if (path.getWrappedString().contains("assets ")) {
try {
String realPath = path.getWrappedString().substring("assets ".length(),
path.getWrappedString().length());
InputStream is = GenericMainContext.sharedContext.getAssets().open(realPath);
String mystring = AndroidRessourcesUtils.getStringFromInputStream(is);
return new NSString(mystring);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
return null;
}
} else {
NSString nsString = new NSString();
// get default system encoding
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
try {
File file = new File(path.getWrappedString());
String encodedString = AndroidFileUtils.readFileToString(file, encoding);
nsString.setWrappedString(encodedString);
return nsString;
} catch (FileNotFoundException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
}
return null;
}
}
public static Object stringWithContentsOfFileEncodingError(Class clazz, NSString path, int enc,
NSError[] error) {
NSString str = stringWithContentsOfFileEncodingError(path, enc, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfFile:encoding:error:
* @Declaration : - (instancetype)initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from the file at a given path using a given encoding.
* @param path A path to a file.
* @param enc The encoding of the file at path.
* @param error If an error occurs, upon return contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from the file named by path using the encoding, enc. The returned
* object may be different from the original receiver. If the file can’t be opened or there is an encoding error, returns nil.
**/
public NSString initWithContentsOfFileEncodingError(NSString path, int enc, NSError[] error) {
NSString nsString = new NSString();
nsString = stringWithContentsOfFileEncodingError(path, enc, error);
return nsString;
}
public Object initWithContentsOfFileEncodingError(Class clazz, NSString path, int enc,
NSError[] error) {
NSString nsString = new NSString();
nsString = stringWithContentsOfFileEncodingError(path, enc, error);
return InstanceTypeFactory.getInstance(nsString, NSString.class, clazz,
new NSString("setWrappedString"), nsString.getWrappedString());
}
/**
* @Signature: stringWithContentsOfFile:usedEncoding:error:
* @Declaration : + (instancetype)stringWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns a string created by reading data from the file at a given path and returns by reference the encoding used to
* interpret the file.
* @param path A path to a file.
* @param enc Upon return, if the file is read successfully, contains the encoding used to interpret the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, you may pass in NULL.
* @return Return Value A string created by reading data from the file named by path. If the file can’t be opened or there is an
* encoding error, returns nil.
* @Discussion This method attempts to determine the encoding of the file at path.
**/
public static NSString stringWithContentsOfFileUsedEncodingError(NSString path, int[] enc,
NSError[] error) {
// TODO
int encBridge = 0;
if (error != null && error.length > 0) {
encBridge = enc[0];
}
return stringWithContentsOfFileEncodingError(path, encBridge, error);
}
public static Object stringWithContentsOfFileUsedEncodingError(Class clazz, NSString path,
int[] enc, NSError[] error) {
// TODO
NSString str = stringWithContentsOfFileUsedEncodingError(path, enc, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfFile:usedEncoding:error:
* @Declaration : - (instancetype)initWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from the file at a given path and returns by reference the
* encoding used to interpret the characters.
* @param path A path to a file.
* @param enc Upon return, if the file is read successfully, contains the encoding used to interpret the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from the file named by path. The returned object may be different
* from the original receiver. If the file can’t be opened or there is an encoding error, returns nil.
**/
public NSString initWithContentsOfFileUsedEncodingError(NSString path, int[] enc,
NSError[] error) {
int encodBridge = 0;
if (enc != null && enc.length > 0) {
encodBridge = enc[0];
}
return initWithContentsOfFileEncodingError(path, encodBridge, error);
}
/**
* @Signature: stringWithContentsOfFile:
* @Declaration : + (id)stringWithContentsOfFile:(NSString *)path
* @Description : Returns a string created by reading data from the file named by a given path. (Deprecated in iOS 2.0. Use
* stringWithContentsOfFile:encoding:error: or stringWithContentsOfFile:usedEncoding:error: instead.)
* @Discussion If the contents begin with a Unicode byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters.
* If the contents begin with a UTF-8 byte-order mark (EFBBBF), interprets the contents as UTF-8. Otherwise, interprets the
* contents as data in the default C string encoding. Since the default C string encoding will vary with the user’s
* configuration, do not depend on this method unless you are using Unicode or UTF-8 or you can verify the default C string
* encoding. Returns nil if the file can’t be opened.
**/
public static NSString stringWithContentsOfFile(NSString path) {
// TODO
if (AndroidVersionUtils.isInteger(path.getWrappedString())) {
if (Integer.parseInt(path.getWrappedString()) == 0) {
return null;
}
int resId = Integer.parseInt(path.getWrappedString());
InputStream is = GenericMainContext.sharedContext.getResources().openRawResource(resId);
String mystring = null;
mystring = AndroidRessourcesUtils.getStringFromInputStream(is);
return new NSString(mystring);
} else if (path.getWrappedString().contains("assets ")) {
try {
String realPath = path.getWrappedString().substring("assets ".length(),
path.getWrappedString().length());
InputStream is = GenericMainContext.sharedContext.getAssets().open(realPath);
String mystring = AndroidRessourcesUtils.getStringFromInputStream(is);
return new NSString(mystring);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
return null;
}
} else
return stringWithContentsOfFileEncodingError(path, 0, null);
}
/**
* @Signature: initWithContentsOfFile:
* @Declaration : - (id)initWithContentsOfFile:(NSString *)path
* @Description : Initializes the receiver, a newly allocated NSString object, by reading data from the file named by path. (Deprecated
* in iOS 2.0. Use initWithContentsOfFile:encoding:error: or initWithContentsOfFile:usedEncoding:error: instead.)
* @Discussion Initializes the receiver, a newly allocated NSString object, by reading data from the file named by path. If the contents
* begin with a byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters; otherwise interprets the
* contents as data in the default C string encoding. Returns an initialized object, which might be different from the
* original receiver, or nil if the file can’t be opened.
**/
public NSString initWithContentsOfFile(NSString path) {
return initWithContentsOfFileEncodingError(path, 0, null);
}
// Creating and Initializing a String from an URL
/**
* @Signature: stringWithContentsOfURL:encoding:error:
* @Declaration : + (instancetype)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns a string created by reading data from a given URL interpreted using a given encoding.
* @param url The URL to read.
* @param enc The encoding of the data at url.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, you may pass in NULL.
* @return Return Value A string created by reading data from URL using the encoding, enc. If the URL can’t be opened or there is an
* encoding error, returns nil.
**/
public static NSString stringWithContentsOfURLEncodingError(NSURL url, int enc,
NSError[] error) {
String encoding = Charset.defaultCharset().name();
NSString nsString = null;
try {
BufferedReader in = new BufferedReader(
new InputStreamReader(url.getUrl().openStream()));
StringBuilder strBuilder = new StringBuilder();
String str;
while ((str = in.readLine()) != null) {
strBuilder.append(str);
}
in.close();
nsString = new NSString();
nsString.wrappedString = new String(strBuilder.toString().getBytes(), encoding);
} catch (MalformedURLException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
} catch (IOException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
}
return nsString;
}
public static Object stringWithContentsOfURLEncodingError(Class clazz, final NSURL url,
final int enc, final NSError[] error) {
AsyncTask task = new AsyncTask<NSString, Void, NSString>() {
@Override
protected NSString doInBackground(NSString... param) {
NSString str = stringWithContentsOfURLEncodingError(url, enc, error);
return str;
}
@Override
protected void onPostExecute(NSString str) {
super.onPostExecute(str);
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
};
NSString str = new NSString("");
try {
str = (NSString) task.execute(new NSString[] {}).get();
} catch (Exception ex) {
LOGGER.info(String.valueOf(ex));
}
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfURL:encoding:error:
* @Declaration : - (instancetype)initWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from a given URL interpreted using a given encoding.
* @param url The URL to read.
* @param enc The encoding of the file at path.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from url. The returned object may be different from the original
* receiver. If the URL can’t be opened or there is an encoding error, returns nil.
**/
public NSString initWithContentsOfURLEncodingError(NSURL url, int encoding, NSError[] error) {
return stringWithContentsOfURLEncodingError(url, encoding, error);
}
public Object initWithContentsOfURLEncodingError(Class clazz, NSURL url, int encoding,
NSError[] error) {
NSString str = stringWithContentsOfURLEncodingError(url, encoding, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: stringWithContentsOfURL:usedEncoding:error:
* @Declaration : + (instancetype)stringWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns a string created by reading data from a given URL and returns by reference the encoding used to interpret the
* data.
* @param url The URL from which to read data.
* @param enc Upon return, if url is read successfully, contains the encoding used to interpret the data.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, you may pass in NULL.
* @return Return Value A string created by reading data from url. If the URL can’t be opened or there is an encoding error, returns
* nil.
* @Discussion This method attempts to determine the encoding at url.
**/
public static NSString stringWithContentsOfURLUsedEncodingError(NSURL url, int[] usedEncoding,
NSError[] error) {
return new NSString().initWithContentsOfURLUsedEncodingError(url, usedEncoding, error);
}
public static Object stringWithContentsOfURLUsedEncodingError(Class clazz, NSURL url,
int[] usedEncoding, NSError[] error) {
NSString str = new NSString().initWithContentsOfURLUsedEncodingError(url, usedEncoding,
error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: initWithContentsOfURL:usedEncoding:error:
* @Declaration : - (instancetype)initWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error
* @Description : Returns an NSString object initialized by reading data from a given URL and returns by reference the encoding used to
* interpret the data.
* @param url The URL from which to read data.
* @param enc Upon return, if url is read successfully, contains the encoding used to interpret the data.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in
* possible errors, pass in NULL.
* @return Return Value An NSString object initialized by reading data from url. If url can’t be opened or the encoding cannot be
* determined, returns nil. The returned initialized object might be different from the original receiver
* @Discussion To read data with an unknown encoding, pass 0 as the enc parameter as in: NSURL *textFileURL = …; NSStringEncoding
* encoding = 0; NSError *error = nil; NSString *string = [[NSString alloc] initWithContentsOfURL:textFileURL
* usedEncoding:&encoding error:&error];
**/
public NSString initWithContentsOfURLUsedEncodingError(NSURL url, int[] enc, NSError[] error) {
int bridgeEncoding = 0;
if (enc != null && enc.length > 0) {
bridgeEncoding = enc[0];
} else {
bridgeEncoding = 2;// default
}
return initWithContentsOfURLEncodingError(url, bridgeEncoding, error);
}
public Object initWithContentsOfURLUsedEncodingError(Class clazz, NSURL url, int[] enc,
NSError[] error) {
NSString str = initWithContentsOfURLUsedEncodingError(url, enc, error);
return InstanceTypeFactory.getInstance(str, NSString.class, clazz,
new NSString("setWrappedString"), str.getWrappedString());
}
/**
* @Signature: stringWithContentsOfURL:
* @Declaration : + (id)stringWithContentsOfURL:(NSURL *)aURL
* @Description : Returns a string created by reading data from the file named by a given URL. (Deprecated in iOS 2.0. Use
* stringWithContentsOfURL:encoding:error: or stringWithContentsOfURL:usedEncoding:error: instead.)
* @Discussion If the contents begin with a byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters. If the
* contents begin with a UTF-8 byte-order mark (EFBBBF), interprets the contents as UTF-8. Otherwise interprets the contents
* as data in the default C string encoding. Since the default C string encoding will vary with the user’s configuration, do
* not depend on this method unless you are using Unicode or UTF-8 or you can verify the default C string encoding. Returns
* nil if the location can’t be opened.
**/
public NSString stringWithContentsOfURL(NSURL aURL) {
return stringWithContentsOfURLUsedEncodingError(aURL, null, null);
}
/**
* @Signature: initWithContentsOfURL:
* @Declaration : - (id)initWithContentsOfURL:(NSURL *)aURL
* @Description : Initializes the receiver, a newly allocated NSString object, by reading data from the location named by a given URL.
* (Deprecated in iOS 2.0. Use initWithContentsOfURL:encoding:error: or initWithContentsOfURL:usedEncoding:error: instead.)
* @Discussion Initializes the receiver, a newly allocated NSString object, by reading data from the location named by aURL. If the
* contents begin with a byte-order mark (U+FEFF or U+FFFE), interprets the contents as Unicode characters; otherwise
* interprets the contents as data in the default C string encoding. Returns an initialized object, which might be different
* from the original receiver, or nil if the location can’t be opened.
**/
public NSString initWithContentsOfURL(NSURL aURL) {
return initWithContentsOfURLUsedEncodingError(aURL, null, null);
}
/**
* @Signature: writeToFile:atomically:encoding:error:
* @Declaration : - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError
* **)error
* @Description : Writes the contents of the receiver to a file at a given path using a given encoding.
* @param path The file to which to write the receiver. If path contains a tilde (~) character, you must expand it with
* stringByExpandingTildeInPath before invoking this method.
* @param useAuxiliaryFile If YES, the receiver is written to an auxiliary file, and then the auxiliary file is renamed to path. If NO,
* the receiver is written directly to path. The YES option guarantees that path, if it exists at all, won’t be corrupted
* even if the system should crash during writing.
* @param enc The encoding to use for the output.
* @param error If there is an error, upon return contains an NSError object that describes the problem. If you are not interested in
* details of errors, you may pass in NULL.
* @return Return Value YES if the file is written successfully, otherwise NO (if there was a problem writing to the file or with the
* encoding).
* @Discussion This method overwrites any existing file at path. This method stores the specified encoding with the file in an extended
* attribute under the name com.apple.TextEncoding. The value contains the IANA name for the encoding and the
* CFStringEncoding value for the encoding, separated by a semicolon. The CFStringEncoding value is written as an ASCII
* string containing an unsigned 32-bit decimal integer and is not terminated by a null character. One or both of these
* values may be missing.
**/
public boolean writeToFileAtomicallyEncodingError(NSString path, boolean useAuxiliaryFile,
int enc, NSError[] error) {
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
File file = new File(path.getWrappedString());
if (file.isFile() && file.canWrite()) {
FileOutputStream fileos;
try {
fileos = new FileOutputStream(path.getWrappedString());
AndroidIOUtils.write(wrappedString, fileos, encoding);
return true;
} catch (FileNotFoundException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
} catch (IOException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(),
null);
}
}
return false;
}
/**
* @Signature: writeToURL:atomically:encoding:error:
* @Declaration : - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError
* **)error
* @Description : Writes the contents of the receiver to the URL specified by url using the specified encoding.
* @param url The URL to which to write the receiver. Only file URLs are supported.
* @param useAuxiliaryFile If YES, the receiver is written to an auxiliary file, and then the auxiliary file is renamed to url. If NO,
* the receiver is written directly to url. The YES option guarantees that url, if it exists at all, won’t be corrupted even
* if the system should crash during writing. The useAuxiliaryFile parameter is ignored if url is not of a type that can be
* accessed atomically.
* @param enc The encoding to use for the output.
* @param error If there is an error, upon return contains an NSError object that describes the problem. If you are not interested in
* details of errors, you may pass in NULL.
* @return Return Value YES if the URL is written successfully, otherwise NO (if there was a problem writing to the URL or with the
* encoding).
* @Discussion This method stores the specified encoding with the file in an extended attribute under the name com.apple.TextEncoding.
* The value contains the IANA name for the encoding and the CFStringEncoding value for the encoding, separated by a
* semicolon. The CFStringEncoding value is written as an ASCII string containing an unsigned 32-bit decimal integer and is
* not terminated by a null character. One or both of these values may be missing. Examples of the value written include the
* following: MACINTOSH;0 UTF-8;134217984 UTF-8; ;3071 The methods initWithContentsOfFile:usedEncoding:error:,
* initWithContentsOfURL:usedEncoding:error:, stringWithContentsOfFile:usedEncoding:error:, and
* stringWithContentsOfURL:usedEncoding:error: use this information to open the file using the right encoding. Note:Â In the
* future this attribute may be extended compatibly by adding additional information after what's there now, so any readers
* should be prepared for an arbitrarily long value for this attribute, with stuff following the CFStringEncoding value,
* separated by a non-digit.
**/
public boolean writeToURLAtomicallyEncodingError(NSURL url, boolean useAuxiliaryFile, int enc,
NSError[] error) {
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
FileOutputStream fileos;
try {
fileos = new FileOutputStream(url.path().wrappedString);
AndroidIOUtils.write(wrappedString, fileos, encoding);
return true;
} catch (FileNotFoundException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
} catch (IOException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
error[0] = NSError.errorWithDomainCodeUserInfo(
NSString.stringWithString(new NSString(e.getMessage())), e.hashCode(), null);
}
return false;
}
/**
* @Signature: writeToFile:atomically:
* @Declaration : - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
* @Description : Writes the contents of the receiver to the file specified by a given path. (Deprecated in iOS 2.0. Use
* writeToFile:atomically:encoding:error: instead.)
* @return Return Value YES if the file is written successfully, otherwise NO.
* @Discussion Writes the contents of the receiver to the file specified by path (overwriting any existing file at path). path is
* written in the default C-string encoding if possible (that is, if no information would be lost), in the Unicode encoding
* otherwise. If flag is YES, the receiver is written to an auxiliary file, and then the auxiliary file is renamed to path.
* If flag is NO, the receiver is written directly to path. The YES option guarantees that path, if it exists at all, won’t
* be corrupted even if the system should crash during writing. If path contains a tilde (~) character, you must expand it
* with stringByExpandingTildeInPath before invoking this method.
**/
public void writeToFileAtomically(NSString path, boolean atomically) {
writeToFileAtomicallyEncodingError(path, atomically, 0, null);
}
/**
* @Signature: writeToURL:atomically:
* @Declaration : - (BOOL)writeToURL:(NSURL *)aURL atomically:(BOOL)atomically
* @Description : Writes the contents of the receiver to the location specified by a given URL. (Deprecated in iOS 2.0. Use
* writeToURL:atomically:encoding:error: instead.)
* @return Return Value YES if the location is written successfully, otherwise NO.
* @Discussion If atomically is YES, the receiver is written to an auxiliary location, and then the auxiliary location is renamed to
* aURL. If atomically is NO, the receiver is written directly to aURL. The YES option guarantees that aURL, if it exists at
* all, won’t be corrupted even if the system should crash during writing. The atomically parameter is ignored if aURL is
* not of a type that can be accessed atomically.
**/
public void writeToURLAtomically(NSURL url, boolean atomically) {
writeToURLAtomicallyEncodingError(url, atomically, 0, null);
}
// Getting Characters and Bytes
/**
* @Signature: characterAtIndex:
* @Declaration : - (unichar)characterAtIndex:(NSUInteger)index
* @Description : Returns the character at a given array position.
* @param index The index of the character to retrieve. The index value must not lie outside the bounds of the receiver.
* @return Return Value The character at the array position given by index.
* @Discussion Raises an NSRangeException if index lies beyond the end of the receiver.
**/
public char characterAtIndex(int index) {
return wrappedString.charAt(index);
}
/**
* @Signature: getCharacters:range:
* @Declaration : - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange
* @Description : Copies characters from a given range in the receiver into a given buffer.
* @param buffer Upon return, contains the characters from the receiver. buffer must be large enough to contain the characters in the
* range aRange (aRange.length*sizeof(unichar)).
* @param aRange The range of characters to retrieve. The range must not exceed the bounds of the receiver. Important:Â Raises an
* NSRangeException if any part of aRange lies beyond the bounds of the receiver.
* @Discussion This method does not add a NULL character. The abstract implementation of this method uses characterAtIndex: repeatedly,
* correctly extracting the characters, though very inefficiently. Subclasses should override it to provide a fast
* implementation.
**/
public void getCharactersRange(CharBuffer[] buffer, NSRange aRange) {
if (buffer != null && buffer.length > 0) {
buffer[0] = CharBuffer.allocate(aRange.length);
buffer[0].append(wrappedString.subSequence(aRange.location, aRange.length));
}
}
/**
* @Signature: getBytes:maxLength:usedLength:encoding:options:range:remainingRange:
* @Declaration : - (BOOL)getBytes:(void *)buffer maxLength:(NSUInteger)maxBufferCount usedLength:(NSUInteger *)usedBufferCount
* encoding:(NSStringEncoding)encoding options:(NSStringEncodingConversionOptions)options range:(NSRange)range
* remainingRange:(NSRangePointer)leftover
* @Description : Gets a given range of characters as bytes in a specified encoding.
* @param buffer A buffer into which to store the bytes from the receiver. The returned bytes are not NULL-terminated.
* @param maxBufferCount The maximum number of bytes to write to buffer.
* @param usedBufferCount The number of bytes used from buffer. Pass NULL if you do not need this value.
* @param encoding The encoding to use for the returned bytes.
* @param options A mask to specify options to use for converting the receiver’s contents to encoding (if conversion is necessary).
* @param range The range of characters in the receiver to get.
* @param leftover The remaining range. Pass NULL If you do not need this value.
* @return Return Value YES if some characters were converted, otherwise NO.
* @Discussion Conversion might stop when the buffer fills, but it might also stop when the conversion isn't possible due to the chosen
* encoding.
**/
public boolean getBytesMaxLengthUsedLengthEncodingOptionsRangeRemainingRange(ByteBuffer buffer,
int maxBufferCount, int usedBufferCount, int enc,
NSStringEncodingConversionOptions options, NSRange range, NSRangePointer leftover) {
String encoding = Charset.defaultCharset().name();
if (enc != 0)
encoding = NSStringEncoding.getCharsetFromInt(enc).name();
buffer = (maxBufferCount == 0) ? ByteBuffer.allocate(wrappedString.length())
: ByteBuffer.allocate(maxBufferCount);
try {
byte[] result = new String(
wrappedString.substring(range.location, range.length).getBytes(), encoding)
.getBytes();
buffer.put(result);
return true;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return false;
}
/**
* @Signature: getCharacters:
* @Declaration : - (void)getCharacters:(unichar *)buffer
* @Description : Copies all characters from the receiver into a given buffer. (Deprecated in iOS 4.0. This method is unsafe because it
* could potentially cause buffer overruns. Use getCharacters:range: instead.)
* @param buffer Upon return, contains the characters from the receiver. buffer must be large enough to contain all characters in the
* string ([string length]*sizeof(unichar)).
* @Discussion Invokes getCharacters:range: with buffer and the entire extent of the receiver as the range.
**/
public void getCharacters(char[] buffer) {
buffer = wrappedString.toCharArray();
}
// Combining Strings
/**
* @Signature: stringByAppendingFormat:
* @Declaration : - (NSString *)stringByAppendingFormat:(NSString *)format, ...
* @Description : Returns a string made by appending to the receiver a string constructed from a given format string and the following
* arguments.
* @param format A format string. See “Formatting String Objects� for more information. This value must not be nil. Important: Raises an
* NSInvalidArgumentException if format is nil.
* @param ... A comma-separated list of arguments to substitute into format.
* @return Return Value A string made by appending to the receiver a string constructed from format and the following arguments, in the
* manner of stringWithFormat:.
**/
public NSString stringByAppendingFormat(NSString format, Object... args) {
StringBuilder strBuilder = new StringBuilder(wrappedString);
if (format == null)
throw new IllegalArgumentException(" This value must not be null");
strBuilder.append(String.format(format.getWrappedString(), args));
this.setWrappedString(strBuilder.toString());
return this;
}
/**
* @Signature: stringByAppendingString:
* @Declaration : - (NSString *)stringByAppendingString:(NSString *)aString
* @Description : Returns a new string made by appending a given string to the receiver.
* @param aString The string to append to the receiver. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if
* aString is nil.
* @return Return Value A new string made by appending aString to the receiver.
* @Discussion This code excerpt, for example: NSString *errorTag = @"Error: "; NSString *errorString = @"premature end of file.";
* NSString *errorMessage = [errorTag stringByAppendingString:errorString]; produces the string “Error: premature end of
* file.�.
**/
public NSString stringByAppendingString(NSString mString) {
StringBuilder strBuilder = new StringBuilder(this.wrappedString);
if (strBuilder == null)
throw new IllegalArgumentException(" This value must not be null ");
return new NSString(strBuilder.append(mString.getWrappedString()).toString());
}
/**
* @Signature: stringByPaddingToLength:withString:startingAtIndex:
* @Declaration : - (NSString *)stringByPaddingToLength:(NSUInteger)newLength withString:(NSString *)padString
* startingAtIndex:(NSUInteger)padIndex
* @Description : Returns a new string formed from the receiver by either removing characters from the end, or by appending as many
* occurrences as necessary of a given pad string.
* @param newLength The new length for the receiver.
* @param padString The string with which to extend the receiver.
* @param padIndex The index in padString from which to start padding.
* @return Return Value A new string formed from the receiver by either removing characters from the end, or by appending as many
* occurrences of padString as necessary.
* @Discussion Here are some examples of usage: [@"abc" stringByPaddingToLength: 9 withString: @"." startingAtIndex:0]; // Results in
* "abc......" [@"abc" stringByPaddingToLength: 2 withString: @"." startingAtIndex:0]; // Results in "ab" [@"abc"
* stringByPaddingToLength: 9 withString: @". " startingAtIndex:1]; // Results in "abc . . ." // Notice that the first
* character in the padding is " "
**/
public NSString stringByPaddingToLengthWithStringStartingAtIndex(int newLength,
NSString padString, int padIndex) {
return new NSString(
(wrappedString.length() < newLength ? wrappedString + padString : wrappedString)
.substring(0, newLength));
}
// Finding Characters and Substrings
/**
* @Signature: rangeOfCharacterFromSet:
* @Declaration : - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet
* @Description : Finds and returns the range in the receiver of the first character from a given character set.
* @param aSet A character set. This value must not be nil. Raises an NSInvalidArgumentException if aSet is nil.
* @return Return Value The range in the receiver of the first character found from aSet. Returns a range of {NSNotFound, 0} if none of
* the characters in aSet are found.
* @Discussion Invokes rangeOfCharacterFromSet:options: with no options.
**/
public NSRange rangeOfCharacterFromSet(NSCharacterSet aSet) {
return rangeOfCharacterFromSetOptionsRange(aSet,
NSStringCompareOptions.NSCaseInsensitiveSearch, null);
}
/**
* @Signature: rangeOfCharacterFromSet:options:
* @Declaration : - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask
* @Description : Finds and returns the range in the receiver of the first character, using given options, from a given character set.
* @param aSet A character set. This value must not be nil. Raises an NSInvalidArgumentException if aSet is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSAnchoredSearch, NSBackwardsSearch.
* @return Return Value The range in the receiver of the first character found from aSet. Returns a range of {NSNotFound, 0} if none of
* the characters in aSet are found.
* @Discussion Invokes rangeOfCharacterFromSet:options:range: with mask for the options and the entire extent of the receiver for the
* range.
**/
public NSRange rangeOfCharacterFromSetOptions(NSCharacterSet aSet,
NSStringCompareOptions mask) {
return rangeOfCharacterFromSetOptionsRange(aSet, mask, null);
}
/**
* @Signature: rangeOfCharacterFromSet:options:range:
* @Declaration : - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask range:(NSRange)aRange
* @Description : Finds and returns the range in the receiver of the first character from a given character set found in a given range
* with given options.
* @param aSet A character set. This value must not be nil. Raises an NSInvalidArgumentException if aSet is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSAnchoredSearch, NSBackwardsSearch.
* @param aRange The range in which to search. aRange must not exceed the bounds of the receiver. Raises an NSRangeException if aRange
* is invalid.
* @return Return Value The range in the receiver of the first character found from aSet within aRange. Returns a range of {NSNotFound,
* 0} if none of the characters in aSet are found.
* @Discussion Because pre-composed characters in aSet can match composed character sequences in the receiver, the length of the
* returned range can be greater than 1. For example, if you search for “ü� in the string “stru¨del�, the returned range is
* {3,2}.
**/
public NSRange rangeOfCharacterFromSetOptionsRange(NSCharacterSet aSet,
NSStringCompareOptions mask, NSRange aRange) {
if (aSet == null)
throw new IllegalArgumentException(" This value must not be null ");
NSRange nsRange = new NSRange(0, 0);
int indexOfMatch = -1;
if (aSet.getCharacterSet() == null || wrappedString.isEmpty()
|| aSet.getCharacterSet().isEmpty()) {
return nsRange;
}
// check invertedSet if set
if (aSet.getInvertedSet() != null) {
while (aSet.getInvertedSet().iterator().hasNext()) {
if ((indexOfMatch = wrappedString
.indexOf(aSet.getInvertedSet().iterator().next())) == -1) {
nsRange.location = NSObjCRuntime.NSNotFound;
return nsRange;
}
}
}
while (aSet.getCharacterSet().iterator().hasNext()) {
if ((indexOfMatch = wrappedString
.indexOf(aSet.getCharacterSet().iterator().next())) != -1) {
nsRange.location = indexOfMatch;
return nsRange;
}
}
return nsRange;
}
/**
* @Signature: rangeOfString:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString
* @Description : Finds and returns the range of the first occurrence of a given string within the receiver.
* @param aString The string to search for. This value must not be nil. Raises an NSInvalidArgumentException if aString is nil.
* @return Return Value An NSRange structure giving the location and length in the receiver of the first occurrence of aString. Returns
* {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion Invokes rangeOfString:options: with no options.
**/
public NSRange rangeOfString(NSString mString) {
NSRange range = new NSRange();
if (!this.getWrappedString().contains(mString.getWrappedString()))
range.location = NSObjCRuntime.NSNotFound;
else {
NSRange searchRange = NSRange.NSMakeRange(0, wrappedString.length());
range = rangeOfStringOptionsRangeLocale(mString,
NSStringCompareOptions.NSCaseInsensitiveSearch, searchRange, null);
}
return range;
}
/**
* @Signature: rangeOfString:options:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask
* @Description : Finds and returns the range of the first occurrence of a given string within the receiver, subject to given options.
* @param aString The string to search for. This value must not be nil. Important:Â Raises an NSInvalidArgumentException if aString is
* nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSBackwardsSearch, NSAnchoredSearch. See String Programming Guide for
* details on these options.
* @return Return Value An NSRange structure giving the location and length in the receiver of the first occurrence of aString, modulo
* the options in mask. Returns {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion Invokes rangeOfString:options:range: with the options specified by mask and the entire extent of the receiver as the
* range.
**/
public NSRange rangeOfStringOptions(NSString mString, NSStringCompareOptions mask) {
return rangeOfStringOptionsRangeLocale(mString, mask, null, null);
}
/**
* @Signature: rangeOfString:options:range:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)aRange
* @Description : Finds and returns the range of the first occurrence of a given string, within the given range of the receiver, subject
* to given options.
* @param aString The string for which to search. This value must not be nil. Raises an NSInvalidArgumentException if aString is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSBackwardsSearch, and NSAnchoredSearch. See String Programming Guide
* for details on these options.
* @param aRange The range within the receiver for which to search for aString. Raises an NSRangeException if aRange is invalid.
* @return Return Value An NSRange structure giving the location and length in the receiver of aString within aRange in the receiver,
* modulo the options in mask. The range returned is relative to the start of the string, not to the passed-in range. Returns
* {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion The length of the returned range and that of aString may differ if equivalent composed character sequences are matched.
**/
public NSRange rangeOfStringOptionsRange(NSCharacterSet aSet, NSStringCompareOptions mask,
NSRange aRange) {
// TODO
NSRange nsRange = new NSRange(0, 0);
final Pattern pattern = Pattern.compile("[" + Pattern.quote(wrappedString) + "]");
final Matcher matcher = pattern.matcher(wrappedString);
return nsRange;
}
/**
* @Signature: rangeOfString:options:range:locale:
* @Declaration : - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)searchRange
* locale:(NSLocale *)locale
* @Description : Finds and returns the range of the first occurrence of a given string within a given range of the receiver, subject to
* given options, using the specified locale, if any.
* @param aString The string for which to search. This value must not be nil. Raises an NSInvalidArgumentException if aString is nil.
* @param mask A mask specifying search options. The following options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSBackwardsSearch, and NSAnchoredSearch. See String Programming Guide
* for details on these options.
* @param aRange The range within the receiver for which to search for aString. Raises an NSRangeException if aRange is invalid.
* @param locale The locale to use when comparing the receiver with aString. To use the current locale, pass [NSLocalecurrentLocale]. To
* use the system locale, pass nil. The locale argument affects the equality checking algorithm. For example, for the Turkish
* locale, case-insensitive compare matches “I� to “ı� (Unicode code point U+0131, Latin Small Dotless I), not the normal “i�
* character.
* @return Return Value An NSRange structure giving the location and length in the receiver of aString within aRange in the receiver,
* modulo the options in mask. The range returned is relative to the start of the string, not to the passed-in range. Returns
* {NSNotFound, 0} if aString is not found or is empty (@"").
* @Discussion The length of the returned range and that of aString may differ if equivalent composed character sequences are matched.
**/
public NSRange rangeOfStringOptionsRangeLocale(NSString aString, NSStringCompareOptions mask,
NSRange searchRange, Locale locale) {
NSRange nsRange = new NSRange(0, 0);
Locale defaultLocale;
if (aString == null)
throw new IllegalArgumentException("This value must not be nil.");
if (locale == null)
defaultLocale = Locale.getDefault();
else
defaultLocale = locale;
String receiverRangeString = new String(
getWrappedString().substring(searchRange.location, searchRange.length));
receiverRangeString = String.format(defaultLocale, "%s", receiverRangeString);
aString = new NSString(String.format(defaultLocale, "%s", aString));
if (AndroidStringUtils.contains(receiverRangeString, aString.getWrappedString())) {
nsRange.location = AndroidStringUtils.indexOf(receiverRangeString,
aString.getWrappedString());
nsRange.length = aString.getLength();
}
return nsRange;
}
/**
* @Signature: enumerateLinesUsingBlock:
* @Declaration : - (void)enumerateLinesUsingBlock:(void (^)(NSString *line, BOOL *stop))block
* @Description : Enumerates all the lines in a string.
* @param block The block executed for the enumeration. The block takes two arguments: line The current line of the string being
* enumerated. The line contains just the contents of the line, without the line terminators. See
* getLineStart:end:contentsEnd:forRange: for a discussion of line terminators. stop A reference to a Boolean value that the
* block can use to stop the enumeration by setting *stop = YES; it should not touch *stop otherwise.
* @param line The current line of the string being enumerated. The line contains just the contents of the line, without the line
* terminators. See getLineStart:end:contentsEnd:forRange: for a discussion of line terminators.
* @param stop A reference to a Boolean value that the block can use to stop the enumeration by setting *stop = YES; it should not touch
* *stop otherwise.
**/
public void enumerateLinesUsingBlock(PerformBlock.VoidBlockNSStringNSRangeNSRangeBOOL block) {
boolean[] stop = new boolean[1];
String lineSeparator = System.getProperty("line.separator");
Matcher m = Pattern.compile(lineSeparator).matcher(wrappedString);
NSString nLine = new NSString();
while (m.find()) {
nLine.wrappedString = m.group();
block.perform(nLine, stop);
}
}
/**
* @Signature: enumerateSubstringsInRange:options:usingBlock:
* @Declaration : - (void)enumerateSubstringsInRange:(NSRange)range options:(NSStringEnumerationOptions)opts usingBlock:(void
* (^)(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop))block
* @Description : Enumerates the substrings of the specified type in the specified range of the string.
* @param range The range within the string to enumerate substrings.
* @param opts Options specifying types of substrings and enumeration styles.
* @param block The block executed for the enumeration. The block takes four arguments: substring The enumerated string. substringRange
* The range of the enumerated string in the receiver. enclosingRange The range that includes the substring as well as any
* separator or filler characters that follow. For instance, for lines, enclosingRange contains the line terminators. The
* enclosingRange for the first string enumerated also contains any characters that occur before the string. Consecutive
* enclosing ranges are guaranteed not to overlap, and every single character in the enumerated range is included in one and
* only one enclosing range. stop A reference to a Boolean value that the block can use to stop the enumeration by setting
* *stop = YES; it should not touch *stop otherwise.
* @param substring The enumerated string.
* @param substringRange The range of the enumerated string in the receiver.
* @param enclosingRange The range that includes the substring as well as any separator or filler characters that follow. For instance,
* for lines, enclosingRange contains the line terminators. The enclosingRange for the first string enumerated also contains
* any characters that occur before the string. Consecutive enclosing ranges are guaranteed not to overlap, and every single
* character in the enumerated range is included in one and only one enclosing range.
* @param stop A reference to a Boolean value that the block can use to stop the enumeration by setting *stop = YES; it should not touch
* *stop otherwise.
* @Discussion If this method is sent to an instance of NSMutableString, mutation (deletion, addition, or change) is allowed, as long as
* it is within enclosingRange. After a mutation, the enumeration continues with the range immediately following the
* processed range, after the length of the processed range is adjusted for the mutation. (The enumerator assumes any change
* in length occurs in the specified range.) For example, if the block is called with a range starting at location N, and
* the block deletes all the characters in the supplied range, the next call will also pass N as the index of the range.
* This is the case even if mutation of the previous range changes the string in such a way that the following substring
* would have extended to include the already enumerated range. For example, if the string "Hello World" is enumerated via
* words, and the block changes "Hello " to "Hello", thus forming "HelloWorld", the next enumeration will return "World"
* rather than "HelloWorld".
**/
public void enumerateSubstringsInRangeOptionsUsingBlock(NSRange range,
NSStringEnumerationOptions opts,
PerformBlock.VoidBlockNSStringNSRangeNSRangeBOOL block) {
// not yet covered
}
// Determining Line and Paragraph Ranges
/**
* @Signature: getLineStart:end:contentsEnd:forRange:
* @Declaration : - (void)getLineStart:(NSUInteger *)startIndex end:(NSUInteger *)lineEndIndex contentsEnd:(NSUInteger
* *)contentsEndIndex forRange:(NSRange)aRange
* @Description : Returns by reference the beginning of the first line and the end of the last line touched by the given range.
* @param startIndex Upon return, contains the index of the first character of the line containing the beginning of aRange. Pass NULL if
* you do not need this value (in which case the work to compute the value isn’t performed).
* @param lineEndIndex Upon return, contains the index of the first character past the terminator of the line containing the end of
* aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param contentsEndIndex Upon return, contains the index of the first character of the terminator of the line containing the end of
* aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param aRange A range within the receiver. The value must not exceed the bounds of the receiver. Raises an NSRangeException if aRange
* is invalid.
* @Discussion A line is delimited by any of these characters, the longest possible sequence being preferred to any shorter: U+000D (\r
* or CR) U+2028 (Unicode line separator) U+000A (\n or LF) U+2029 (Unicode paragraph separator) \r\n, in that order (also
* known as CRLF) If aRange is contained with a single line, of course, the returned indexes all belong to that line. You
* can use the results of this method to construct ranges for lines by using the start index as the range’s location and the
* difference between the end index and the start index as the range’s length.
**/
public void getLineStartEndContentsEndForRange(int[] startIndex, int[] lineEndIndex,
int[] contentsEndIndex, NSRange aRange) {
// not yet covered
}
/**
* @Signature: lineRangeForRange:
* @Declaration : - (NSRange)lineRangeForRange:(NSRange)aRange
* @Description : Returns the range of characters representing the line or lines containing a given range.
* @param aRange A range within the receiver. The value must not exceed the bounds of the receiver.
* @return Return Value The range of characters representing the line or lines containing aRange, including the line termination
* characters. See getLineStart:end:contentsEnd:forRange: for a discussion of line terminators.
**/
public NSRange lineRangeForRange(NSRange aRange) {
// not yet covered
return null;
}
/**
* @Signature: getParagraphStart:end:contentsEnd:forRange:
* @Declaration : - (void)getParagraphStart:(NSUInteger *)startIndex end:(NSUInteger *)endIndex contentsEnd:(NSUInteger
* *)contentsEndIndex forRange:(NSRange)aRange
* @Description : Returns by reference the beginning of the first paragraph and the end of the last paragraph touched by the given
* range.
* @param startIndex Upon return, contains the index of the first character of the paragraph containing the beginning of aRange. Pass
* NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param endIndex Upon return, contains the index of the first character past the terminator of the paragraph containing the end of
* aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param contentsEndIndex Upon return, contains the index of the first character of the terminator of the paragraph containing the end
* of aRange. Pass NULL if you do not need this value (in which case the work to compute the value isn’t performed).
* @param aRange A range within the receiver. The value must not exceed the bounds of the receiver.
* @Discussion If aRange is contained with a single paragraph, of course, the returned indexes all belong to that paragraph. Similar to
* getLineStart:end:contentsEnd:forRange:, you can use the results of this method to construct the ranges for paragraphs.
**/
public void getParagraphStartEndContentsEndForRange(int[] startIndex, int[] endIndex,
int[] contentsEndIndex, NSRange aRange) {
// not yet covered
}
/**
* @Signature: paragraphRangeForRange:
* @Declaration : - (NSRange)paragraphRangeForRange:(NSRange)aRange
* @Description : Returns the range of characters representing the paragraph or paragraphs containing a given range.
* @param aRange A range within the receiver. The range must not exceed the bounds of the receiver.
* @return Return Value The range of characters representing the paragraph or paragraphs containing aRange, including the paragraph
* termination characters.
**/
public NSRange paragraphRangeForRange(NSRange aRange) {
// not yet covered
return null;
}
// Converting String Contents Into a Property List
/**
* @Signature: propertyList
* @Declaration : - (id)propertyList
* @Description : Parses the receiver as a text representation of a property list, returning an NSString, NSData, NSArray, or
* NSDictionary object, according to the topmost element.
* @return Return Value A property list representation of returning an NSString, NSData, NSArray, or NSDictionary object, according to
* the topmost element.
* @Discussion The receiver must contain a string in a property list format. For a discussion of property list formats, see Property
* List Programming Guide. Important:Â Raises an NSParseErrorException if the receiver cannot be parsed as a property list.
**/
public void propertyList() {
// not yet covered
}
/**
* @Signature: propertyListFromStringsFileFormat
* @Declaration : - (NSDictionary *)propertyListFromStringsFileFormat
* @Description : Returns a dictionary object initialized with the keys and values found in the receiver.
* @return Return Value A dictionary object initialized with the keys and values found in the receiver
* @Discussion The receiver must contain text in the format used for .strings files. In this format, keys and values are separated by an
* equal sign, and each key-value pair is terminated with a semicolon. The value is optional—if not present, the equal sign
* is also omitted. The keys and values themselves are always strings enclosed in straight quotation marks.
**/
public NSDictionary propertyListFromStringsFileFormat() {
// not yet covered
return null;
}
// Folding Strings
/**
* @Signature: stringByFoldingWithOptions:locale:
* @Declaration : - (NSString *)stringByFoldingWithOptions:(NSStringCompareOptions)options locale:(NSLocale *)locale
* @Description : Returns a string with the given character folding options applied.
* @param options A mask of compare flags with a suffix InsensitiveSearch.
* @param locale The locale to use for the folding. To use the current locale, pass [NSLocalecurrentLocale]. To use the system locale,
* pass nil.
* @return Return Value A string with the character folding options applied.
* @Discussion Character folding operations remove distinctions between characters. For example, case folding may replace uppercase
* letters with their lowercase equivalents. The locale affects the folding logic. For example, for the Turkish locale,
* case-insensitive compare matches “I� to “ı� (Unicode code point U+0131, Latin Small Dotless I), not the normal “i�
* character.
**/
public String stringByFoldingWithOptionsLocale(NSStringCompareOptions options, Locale locale) {
return Normalizer.normalize(wrappedString, Normalizer.Form.NFD);
}
// Changing Case
/**
* @Declaration : @property (readonly, copy) NSString *capitalizedString
* @Description : A capitalized representation of the receiver. (read-only)
* @Discussion A string with the first character in each word changed to its corresponding uppercase value, and all remaining characters
* set to their corresponding lowercase values. A “word� is any sequence of characters delimited by spaces, tabs, or line
* terminators (listed under getLineStart:end:contentsEnd:forRange:). Some common word delimiting punctuation isn’t
* considered, so this property may not generally produce the desired results for multiword strings. Case transformations
* aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. See lowercaseString for
* an example. Note:Â This property performs the canonical (non-localized) mapping. It is suitable for programming operations
* that require stable results not depending on the current locale. For localized case mapping for strings presented to
* users, use the capitalizedStringWithLocale: method.
**/
public NSString capitalizedString;
public NSString capitalizedString() {
capitalizedString = new NSString(AndroidWordUtils.capitalizeFully(wrappedString));
return capitalizedString;
}
/**
* @Signature: capitalizedStringWithLocale:
* @Declaration : - (NSString *)capitalizedStringWithLocale:(NSLocale *)locale
* @Description : Returns a capitalized representation of the receiver using the specified locale.
* @param locale The locale. For strings presented to users, pass the current locale ([NSLocalecurrentLocale]). To use the system
* locale, pass nil.
* @return Return Value A string with the first character from each word in the receiver changed to its corresponding uppercase value,
* and all remaining characters set to their corresponding lowercase values.
* @Discussion A “word� is any sequence of characters delimited by spaces, tabs, or line terminators (listed under
* getLineStart:end:contentsEnd:forRange:). Some common word delimiting punctuation isn’t considered, so this method may not
* generally produce the desired results for multiword strings.
**/
public String capitalizedStringWithLocale(Locale locale) {
return AndroidWordUtils.capitalizeFully(String.format(locale, "%s", wrappedString));
}
/**
* @Declaration : @property (readonly, copy) NSString *lowercaseString
* @Description : A lowercase representation of the string.
* @Discussion Case transformations aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. The
* result of this statement: lcString = [myString lowercaseString]; might not be equal to this statement: lcString =
* [[myString uppercaseString] lowercaseString]; For example, the uppercase form of “ß� in German is “SS�, so converting
* “Straße� to uppercase, then lowercase, produces this sequence of strings: “Straße� “STRASSE� “strasse� Note: This
* property performs the canonical (non-localized) mapping. It is suitable for programming operations that require stable
* results not depending on the current locale. For localized case mapping for strings presented to users, use
* lowercaseStringWithLocale:.
**/
private NSString lowercaseString;
public NSString lowercaseString() {
lowercaseString = new NSString(wrappedString.toLowerCase());
return lowercaseString;
}
public NSString getLowercaseString() {
return lowercaseString();
}
public void setLowercaseString(NSString lowercaseString) {
this.lowercaseString = lowercaseString;
}
/**
* @Signature: lowercaseStringWithLocale:
* @Declaration : - (NSString *)lowercaseStringWithLocale:(NSLocale *)locale
* @Description : Returns a version of the string with all letters converted to lowercase, taking into account the specified locale.
* @param locale The locale. For strings presented to users, pass the current locale ([NSLocalecurrentLocale]). To use the system local,
* pass nil.
* @return Return Value A lowercase string using the locale. Input of @"ABcde" would result in a return of @"abcde".
* @Discussion .
**/
public NSString lowercaseStringWithLocale(NSLocale locale) {
if (locale == null)
return lowercaseString();
return new NSString(wrappedString.toLowerCase(locale.getWrappedLocale()));
}
/**
* @Declaration : @property (readonly, copy) NSString *uppercaseString
* @Description : An uppercase representation of the string. (read-only)
* @Discussion Case transformations aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. See
* lowercaseString for an example. Note:Â This property performs the canonical (non-localized) mapping. It is suitable for
* programming operations that require stable results not depending on the current locale. For localized case mapping for
* strings presented to users, use the uppercaseStringWithLocale: method.
**/
private NSString uppercaseString;
public NSString uppercaseString() {
uppercaseString = new NSString(wrappedString.toUpperCase(Locale.getDefault()));
return uppercaseString;
}
/**
* @Signature: uppercaseStringWithLocale:
* @Declaration : - (NSString *)uppercaseStringWithLocale:(NSLocale *)locale
* @Description : Returns a version of the string with all letters converted to uppercase, taking into account the specified locale.
* @param locale The locale. For strings presented to users, pass the current locale ([NSLocalecurrentLocale]). To use the system
* locale, pass nil.
* @return Return Value An uppercase string using the locale. Input of @"ABcde" would result in a return of @"ABCDE".
**/
public NSString uppercaseStringWithLocale(NSLocale locale) {
if (locale == null)
return uppercaseString();
return new NSString(wrappedString.toUpperCase(locale.getWrappedLocale()));
}
// Getting Numeric Values
/**
* @Declaration : @property (readonly) double doubleValue
* @Description : The floating-point value of the string as a double. (read-only)
* @Discussion This property doesn’t include any whitespace at the beginning of the string. This property is HUGE_VAL or –HUGE_VAL on
* overflow, 0.0 on underflow. This property is 0.0 if the string doesn’t begin with a valid text representation of a
* floating-point number. This property uses formatting information stored in the non-localized value; use an NSScanner
* object for localized scanning of numeric values from a string.
**/
public double doubleValue() {
if (!"".equals(wrappedString)) {
wrappedString = wrappedString.trim().replaceAll(" ", "");
return Double.parseDouble(wrappedString);
}
return 0;
}
public double getDoubleValue() {
return doubleValue();
}
/**
* @Declaration : @property (readonly) float floatValue
* @Description : The floating-point value of the string as a float. (read-only)
* @Discussion This property doesn’t include whitespace at the beginning of the string. This property is HUGE_VAL or –HUGE_VAL on
* overflow, 0.0 on underflow. This property is 0.0 if the string doesn’t begin with a valid text representation of a
* floating-point number. This method uses formatting information stored in the non-localized value; use an NSScanner object
* for localized scanning of numeric values from a string.
**/
private float floatValue;
public float floatValue() {
floatValue = Float.parseFloat(wrappedString);
return floatValue;
}
/**
* @Declaration : @property (readonly) int intValue
* @Description : The integer value of the string. (read-only)
* @Discussion The integer value of the string, assuming a decimal representation and skipping whitespace at the beginning of the
* string. This property is INT_MAX or INT_MIN on overflow. This property is 0 if the string doesn’t begin with a valid
* decimal text representation of a number. This property uses formatting information stored in the non-localized value; use
* an NSScanner object for localized scanning of numeric values from a string.
**/
private int intValue;
public int intValue() {
if ("".equalsIgnoreCase(wrappedString)) {
return 0;
}
return Integer.parseInt(wrappedString);
}
/**
* @Declaration : @property (readonly) NSInteger integerValue
* @Description : The NSInteger value of the string. (read-only)
* @Discussion The NSInteger value of the string, assuming a decimal representation and skipping whitespace at the beginning of the
* string. This property is 0 if the string doesn’t begin with a valid decimal text representation of a number. This
* property uses formatting information stored in the non-localized value; use an NSScanner object for localized scanning of
* numeric values from a string.
**/
private int integerValue;
public int integerValue() {
integerValue = Integer.parseInt(wrappedString);
return integerValue;
}
/**
* @Declaration : @property (readonly) long long longLongValue
* @Description : The long long value of the string. (read-only)
* @Discussion The long long value of the string, assuming a decimal representation and skipping whitespace at the beginning of the
* string. This property is LLONG_MAX or LLONG_MIN on overflow. This property is 0 if the receiver doesn’t begin with a
* valid decimal text representation of a number. This property uses formatting information stored in the non-localized
* value; use an NSScanner object for localized scanning of numeric values from a string.
**/
private long longLongValue;
public Long longLongValue() {
longLongValue = Long.parseLong(wrappedString);
return longLongValue;
}
/**
* @Declaration : @property (readonly) BOOL boolValue
* @Description : The Boolean value of the string. (read-only)
* @Discussion This property is YES on encountering one of "Y", "y", "T", "t", or a digit 1-9—the method ignores any trailing
* characters. This property is NO if the receiver doesn’t begin with a valid decimal text representation of a number. The
* property assumes a decimal representation and skips whitespace at the beginning of the string. It also skips initial
* whitespace characters, or optional -/+ sign followed by zeroes.
**/
private boolean boolValue;
public Boolean boolValue() {
boolValue = Boolean.parseBoolean(wrappedString);
return boolValue;
}
// Working with Paths
/**
* @Signature: pathWithComponents:
* @Declaration : + (NSString *)pathWithComponents:(NSArray *)components
* @Description : Returns a string built from the strings in a given array by concatenating them with a path separator between each
* pair.
* @param components An array of NSString objects representing a file path. To create an absolute path, use a slash mark (“/�) as the
* first component. To include a trailing path divider, use an empty string as the last component.
* @return Return Value A string built from the strings in components by concatenating them (in the order they appear in the array) with
* a path separator between each pair.
* @Discussion This method doesn’t clean up the path created; use stringByStandardizingPath to resolve empty components, references to
* the parent directory, and so on.
**/
public static NSString pathWithComponents(NSArray<?> components) {
// not yet covered
return null;
}
/**
* @Signature: pathComponents
* @Declaration : - (NSArray *)pathComponents
* @Description : Returns an array of NSString objects containing, in order, each path component of the receiver.
* @return Return Value An array of NSString objects containing, in order, each path component of the receiver.
* @Discussion The strings in the array appear in the order they did in the receiver. If the string begins or ends with the path
* separator, then the first or last component, respectively, will contain the separator. Empty components (caused by
* consecutive path separators) are deleted. For example, this code excerpt: NSString *path = @"tmp/scratch"; NSArray
* *pathComponents = [path pathComponents]; produces an array with these contents: Index Path Component 0 “tmp� 1 “scratch�
* If the receiver begins with a slash—for example, “/tmp/scratch�—the array has these contents: Index Path Component 0 “/�
* 1 “tmp� 2 “scratch� If the receiver has no separators—for example, “scratch�—the array contains the string itself, in
* this case “scratch�. Note that this method only works with file paths (not, for example, string representations of URLs).
**/
public NSArray<NSString> pathComponents() {
String[] Result = wrappedString.split(File.pathSeparator);
NSArray<NSString> nsArray = new NSArray<NSString>();
for (String string : Result) {
nsArray.getWrappedList().add(new NSString(string));
}
return nsArray;
}
/**
* @Signature: completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:
* @Declaration : - (NSUInteger)completePathIntoString:(NSString **)outputName caseSensitive:(BOOL)flag matchesIntoArray:(NSArray
* **)outputArray filterTypes:(NSArray *)filterTypes
* @Description : Interprets the receiver as a path in the file system and attempts to perform filename completion, returning a numeric
* value that indicates whether a match was possible, and by reference the longest path that matches the receiver.
* @param outputName Upon return, contains the longest path that matches the receiver.
* @param flag If YES, the method considers case for possible completions.
* @param outputArray Upon return, contains all matching filenames.
* @param filterTypes An array of NSString objects specifying path extensions to consider for completion. Only paths whose extensions
* (not including the extension separator) match one of these strings are included in outputArray. Pass nil if you don’t want
* to filter the output.
* @return Return Value 0 if no matches are found and 1 if exactly one match is found. In the case of multiple matches, returns the
* actual number of matching paths if outputArray is provided, or simply a positive value if outputArray is NULL.
* @Discussion You can check for the existence of matches without retrieving by passing NULL as outputArray. Note that this method only
* works with file paths (not, for example, string representations of URLs).
**/
public int completePathIntoStringCaseSensitiveMatchesIntoArrayFilterTypes(NSString[] outputName,
boolean caseSensitive, NSArray<NSString> outputArray, NSArray<NSString> filterTypes) {
// TODO will not be implemented
return 0;
}
/**
* @Signature: fileSystemRepresentation
* @Declaration : - (const char *)fileSystemRepresentation
* @Description : Returns a file system-specific representation of the receiver.
* @return Return Value A file system-specific representation of the receiver, as described for getFileSystemRepresentation:maxLength:.
* @Discussion The returned C string will be automatically freed just as a returned object would be released; your code should copy the
* representation or use getFileSystemRepresentation:maxLength: if it needs to store the representation outside of the
* memory context in which the representation was created. Raises an NSCharacterConversionException if the receiver can’t be
* represented in the file system’s encoding. It also raises an exception if the receiver contains no characters. Note that
* this method only works with file paths (not, for example, string representations of URLs). To convert a char * path (such
* as you might get from a C library routine) to an NSString object, use NSFileManager‘s
* stringWithFileSystemRepresentation:length: method.
**/
public String fileSystemRepresentation() {
// NOT IMPLEMENTED
return "";
}
/**
* @Signature: getFileSystemRepresentation:maxLength:
* @Declaration : - (BOOL)getFileSystemRepresentation:(char *)buffer maxLength:(NSUInteger)maxLength
* @Description : Interprets the receiver as a system-independent path and fills a buffer with a C-string in a format and encoding
* suitable for use with file-system calls.
* @param buffer Upon return, contains a C-string that represent the receiver as as a system-independent path, plus the NULL termination
* byte. The size of buffer must be large enough to contain maxLength bytes.
* @param maxLength The maximum number of bytes in the string to return in buffer (including a terminating NULL character, which this
* method adds).
* @return Return Value YES if buffer is successfully filled with a file-system representation, otherwise NO (for example, if maxLength
* would be exceeded or if the receiver can’t be represented in the file system’s encoding).
* @Discussion This method operates by replacing the abstract path and extension separator characters (‘/’ and ‘.’ respectively) with
* their equivalents for the operating system. If the system-specific path or extension separator appears in the abstract
* representation, the characters it is converted to depend on the system (unless they’re identical to the abstract
* separators). Note that this method only works with file paths (not, for example, string representations of URLs). The
* following example illustrates the use of the maxLength argument. The first method invocation returns failure as the file
* representation of the string (@"/mach_kernel") is 12 bytes long and the value passed as the maxLength argument (12) does
* not allow for the addition of a NULL termination byte. char filenameBuffer[13]; BOOL success; success = [@"/mach_kernel"
* getFileSystemRepresentation:filenameBuffer maxLength:12]; // success == NO // Changing the length to include the NULL
* character does work success = [@"/mach_kernel" getFileSystemRepresentation:filenameBuffer maxLength:13]; // success ==
* YES
**/
public boolean getFileSystemRepresentationMaxLength(byte[] buffer, int maxLength) {
// TODO WILL NOT BE IMPLEMENTED
return true;
}
/**
* @Signature: isAbsolutePath
* @Declaration : - (BOOL)isAbsolutePath
* @Description : Returning a Boolean value that indicates whether the receiver represents an absolute path.
* @return Return Value YES if the receiver (if interpreted as a path) represents an absolute path, otherwise NO (if the receiver
* represents a relative path).
* @Discussion See String Programming Guide for more information on paths. Note that this method only works with file paths (not, for
* example, string representations of URLs). The method does not check the filesystem for the existence of the path (use
* fileExistsAtPath: or similar methods in NSFileManager for that task).
**/
public boolean isAbsolutePath() {
URI uri;
File f = new File(wrappedString);
try {
uri = new URI(wrappedString);
return uri.isAbsolute() || f.isAbsolute();
} catch (URISyntaxException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
return false;
}
}
/**
* @Signature: lastPathComponent
* @Declaration : - (NSString *)lastPathComponent
* @Description : Returns the last path component of the receiver.
* @return Return Value The last path component of the receiver.
* @Discussion Path components are alphanumeric strings delineated by the path separator (slash “/�) or the beginning or end of the path
* string. Multiple path separators at the end of the string are stripped. The following table illustrates the effect of
* lastPathComponent on a variety of different paths: Receiver’s String Value String Returned “/tmp/scratch.tiff�
* “scratch.tiff� “/tmp/scratch� “scratch� “/tmp/� “tmp� “scratch///� “scratch� “/� “/� Note that this method only works
* with file paths (not, for example, string representations of URLs).
**/
public NSString lastPathComponent() {
if (wrappedString.contains("assets ")) {
wrappedString = wrappedString.replace("assets ", "");
}
return new NSString(wrappedString.substring(wrappedString.lastIndexOf("/") + 1,
wrappedString.length()));
}
/**
* @Signature: pathExtension
* @Declaration : - (NSString *)pathExtension
* @Description : Interprets the receiver as a path and returns the receiver’s extension, if any.
* @return Return Value The receiver’s extension, if any (not including the extension divider).
* @Discussion The path extension is the portion of the last path component which follows the final period, if there is one. The
* following table illustrates the effect of pathExtension on a variety of different paths: Receiver’s String Value String
* Returned “/tmp/scratch.tiff� “tiff� “.scratch.tiff� “tiff� “/tmp/scratch� “� (an empty string) “/tmp/� “� (an empty
* string) “/tmp/scratch..tiff� “tiff� Note that this method only works with file paths (not, for example, string
* representations of URLs).
**/
public NSString pathExtension() {
return new NSString(AndroidFilenameUtils.getExtension(wrappedString));
}
/**
* @Signature: stringByAbbreviatingWithTildeInPath
* @Declaration : - (NSString *)stringByAbbreviatingWithTildeInPath
* @Description : Returns a new string that replaces the current home directory portion of the current path with a tilde (~) character.
* @return Return Value A new string based on the current string object. If the new string specifies a file in the current home
* directory, the home directory portion of the path is replaced with a tilde (~) character. If the string does not specify a
* file in the current home directory, this method returns a new string object whose path is unchanged from the path in the
* current string.
* @Discussion Note that this method only works with file paths. It does not work for string representations of URLs. For sandboxed apps
* in OS X, the current home directory is not the same as the user’s home directory. For a sandboxed app, the home directory
* is the app’s home directory. So if you specified a path of /Users/<current_user>/file.txt for a sandboxed app, the
* returned path would be unchanged from the original. However, if you specified the same path for an app not in a sandbox,
* this method would replace the /Users/<current_user> portion of the path with a tilde.
**/
public void stringByAbbreviatingWithTildeInPath() {
// TODO will not be implemented
}
/**
* @Signature: stringByAppendingPathExtension:
* @Declaration : - (NSString *)stringByAppendingPathExtension:(NSString *)ext
* @Description : Returns a new string made by appending to the receiver an extension separator followed by a given extension.
* @param ext The extension to append to the receiver.
* @return Return Value A new string made by appending to the receiver an extension separator followed by ext.
* @Discussion The following table illustrates the effect of this method on a variety of different paths, assuming that ext is supplied
* as @"tiff": Receiver’s String Value Resulting String “/tmp/scratch.old� “/tmp/scratch.old.tiff� “/tmp/scratch.�
* “/tmp/scratch..tiff� “/tmp/� “/tmp.tiff� “scratch� “scratch.tiff� Note that adding an extension to @"/tmp/" causes the
* result to be @"/tmp.tiff" instead of @"/tmp/.tiff". This difference is because a file named @".tiff" is not considered to
* have an extension, so the string is appended to the last nonempty path component. Note that this method only works with
* file paths (not, for example, string representations of URLs).
**/
public NSString stringByAppendingPathExtension(NSString ext) {
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(wrappedString);
strBuilder.append(AndroidFilenameUtils.EXTENSION_SEPARATOR);
strBuilder.append(ext.getWrappedString());
return new NSString(strBuilder.toString());
}
/**
* @Signature: stringByDeletingLastPathComponent
* @Declaration : - (NSString *)stringByDeletingLastPathComponent
* @Description : Returns a new string made by deleting the last path component from the receiver, along with any final path separator.
* @return Return Value A new string made by deleting the last path component from the receiver, along with any final path separator. If
* the receiver represents the root path it is returned unaltered.
* @Discussion The following table illustrates the effect of this method on a variety of different paths: Receiver’s String Value
* Resulting String “/tmp/scratch.tiff� “/tmp� “/tmp/lock/� “/tmp� “/tmp/� “/� “/tmp� “/� “/� “/� “scratch.tiff� “� (an
* empty string) Note that this method only works with file paths (not, for example, string representations of URLs).
**/
public NSString stringByDeletingLastPathComponent() {
if ("/".equals(wrappedString))
return new NSString(wrappedString);
if (wrappedString.contains(File.pathSeparator)) {
int index = wrappedString.lastIndexOf(File.pathSeparator);
return new NSString(wrappedString.substring(0, index));
}
return null;
}
/**
* @Signature: stringByDeletingPathExtension
* @Declaration : - (NSString *)stringByDeletingPathExtension
* @Description : Returns a new string made by deleting the extension (if any, and only the last) from the receiver.
* @return Return Value a new string made by deleting the extension (if any, and only the last) from the receiver. Strips any trailing
* path separator before checking for an extension. If the receiver represents the root path, it is returned unaltered.
* @Discussion The following table illustrates the effect of this method on a variety of different paths: Receiver’s String Value
* Resulting String “/tmp/scratch.tiff� “/tmp/scratch� “/tmp/� “/tmp� “scratch.bundle/� “scratch� “scratch..tiff� “scratch.�
* “.tiff� “.tiff� “/� “/� Note that attempting to delete an extension from @".tiff" causes the result to be @".tiff"
* instead of an empty string. This difference is because a file named @".tiff" is not considered to have an extension, so
* nothing is deleted. Note also that this method only works with file paths (not, for example, string representations of
* URLs).
**/
public NSString stringByDeletingPathExtension() {
if ("/".equals(wrappedString))
return new NSString(wrappedString);
if (wrappedString.contains(".")) {
int index = wrappedString.lastIndexOf(".");
return new NSString(wrappedString.substring(0, index));
}
return null;
}
/**
* @Signature: stringByExpandingTildeInPath
* @Declaration : - (NSString *)stringByExpandingTildeInPath
* @Description : Returns a new string made by expanding the initial component of the receiver to its full path value.
* @return Return Value A new string made by expanding the initial component of the receiver, if it begins with “~� or “~user�, to its
* full path value. Returns a new string matching the receiver if the receiver’s initial component can’t be expanded.
* @Discussion Note that this method only works with file paths (not, for example, string representations of URLs).
**/
public NSString stringByExpandingTildeInPath() {
// TODO will not be implemented
return null;
}
/**
* @Signature: stringByResolvingSymlinksInPath
* @Declaration : - (NSString *)stringByResolvingSymlinksInPath
* @Description : Returns a new string made from the receiver by resolving all symbolic links and standardizing path.
* @return Return Value A new string made by expanding an initial tilde expression in the receiver, then resolving all symbolic links
* and references to current or parent directories if possible, to generate a standardized path. If the original path is
* absolute, all symbolic links are guaranteed to be removed; if it’s a relative path, symbolic links that can’t be resolved are
* left unresolved in the returned string. Returns self if an error occurs.
* @Discussion If the name of the receiving path begins with /private, the stringByResolvingSymlinksInPath method strips off the
* /private designator, provided the result is the name of an existing file. Note that this method only works with file
* paths (not, for example, string representations of URLs).
**/
public void stringByResolvingSymlinksInPath() {
// TODO will not be implemented
}
/**
* @Signature: stringByStandardizingPath
* @Declaration : - (NSString *)stringByStandardizingPath
* @Description : Returns a new string made by removing extraneous path components from the receiver.
* @return Return Value A new string made by removing extraneous path components from the receiver.
* @Discussion If an invalid pathname is provided, stringByStandardizingPath may attempt to resolve it by calling
* stringByResolvingSymlinksInPath, and the results are undefined. If any other kind of error is encountered (such as a path
* component not existing), self is returned. This method can make the following changes in the provided string: Expand an
* initial tilde expression using stringByExpandingTildeInPath. Reduce empty components and references to the current
* directory (that is, the sequences “//� and “/./�) to single path separators. In absolute paths only, resolve references
* to the parent directory (that is, the component “..�) to the real parent directory if possible using
* stringByResolvingSymlinksInPath, which consults the file system to resolve each potential symbolic link. In relative
* paths, because symbolic links can’t be resolved, references to the parent directory are left in place. Remove an initial
* component of “/private� from the path if the result still indicates an existing file or directory (checked by consulting
* the file system). Note that the path returned by this method may still have symbolic link components in it. Note also
* that this method only works with file paths (not, for example, string representations of URLs).
**/
public void stringByStandardizingPath() {
wrappedString = AndroidFilenameUtils.normalize(wrappedString);
}
// Linguistic Tagging and Analysis
/**
* @Signature: enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:
* @Declaration : - (void)enumerateLinguisticTagsInRange:(NSRange)range scheme:(NSString *)tagScheme
* options:(NSLinguisticTaggerOptions)opts orthography:(NSOrthography *)orthography usingBlock:(void (^)(NSString *tag,
* NSRange tokenRange, NSRange sentenceRange, BOOL *stop))block
* @Description : Performs linguistic analysis on the specified string by enumerating the specific range of the string, providing the
* Block with the located tags.
* @param range The range of the string to analyze.
* @param tagScheme The tag scheme to use. See Linguistic Tag Schemes for supported values.
* @param opts The linguistic tagger options to use. See NSLinguisticTaggerOptionsfor the constants. These constants can be combined
* using the C-Bitwise OR operator.
* @param orthography The orthography of the string. If nil, the linguistic tagger will attempt to determine the orthography from the
* string content.
* @param block The Block to apply to the string. The block takes four arguments: tag The tag scheme for the token. The opts parameter
* specifies the types of tagger options that are located. tokenRange The range of a string matching the tag scheme.
* sentenceRange The range of the sentence in which the token is found. stop A reference to a Boolean value. The block can
* set the value to YES to stop further processing of the array. The stop argument is an out-only argument. You should only
* ever set this Boolean to YES within the Block.
* @param tag The tag scheme for the token. The opts parameter specifies the types of tagger options that are located.
* @param tokenRange The range of a string matching the tag scheme.
* @param sentenceRange The range of the sentence in which the token is found.
* @param stop A reference to a Boolean value. The block can set the value to YES to stop further processing of the array. The stop
* argument is an out-only argument. You should only ever set this Boolean to YES within the Block.
* @Discussion This is a convenience method. It is the equivalent of creating an instance of NSLinguisticTagger, specifying the receiver
* as the string to be analyzed, and the orthography (or nil) and then invoking the NSLinguisticTagger method or
* enumerateTagsInRange:scheme:options:usingBlock:.
**/
public void enumerateLinguisticTagsInRangeSchemeOptionsOrthographyUsingBlock(NSRange range,
NSString tagScheme, NSLinguisticTaggerOptions opts, NSOrthography orthography,
PerformBlock.VoidBlockNSStringNSRangeNSRangeBOOL block) {
}
/**
* @Signature: linguisticTagsInRange:scheme:options:orthography:tokenRanges:
* @Declaration : - (NSArray *)linguisticTagsInRange:(NSRange)range scheme:(NSString *)tagScheme options:(NSLinguisticTaggerOptions)opts
* orthography:(NSOrthography *)orthography tokenRanges:(NSArray **)tokenRanges
* @Description : Returns an array of linguistic tags for the specified range and requested tags within the receiving string.
* @param range The range of the string to analyze.
* @param tagScheme The tag scheme to use. See Linguistic Tag Schemes for supported values.
* @param opts The linguistic tagger options to use. See NSLinguisticTaggerOptions for the constants. These constants can be combined
* using the C-Bitwise OR operator.
* @param orthography The orthography of the string. If nil, the linguistic tagger will attempt to determine the orthography from the
* string content.
* @param tokenRanges An array returned by-reference containing the token ranges of the linguistic tags wrapped in NSValue objects.
* @return Return Value Returns an array containing the linguistic tags for the tokenRanges within the receiving string.
* @Discussion This is a convenience method. It is the equivalent of creating an instance of NSLinguisticTagger, specifying the receiver
* as the string to be analyzed, and the orthography (or nil) and then invoking the NSLinguisticTagger method or
* linguisticTagsInRange:scheme:options:orthography:tokenRanges:.
**/
public NSArray linguisticTagsInRangeSchemeOptionsOrthographyTokenRanges(NSRange range,
NSString tagScheme, NSLinguisticTaggerOptions opts, NSOrthography orthography,
NSArray[] tokenRanges) {
return null;
}
/**
* @Declaration : @property (readonly) NSUInteger length
* @Description : The number of Unicode characters in the receiver. (read-only)
* @Discussion This number includes the individual characters of composed character sequences, so you cannot use this property to
* determine if a string will be visible when printed or how long it will appear.
**/
public int length;
public int length() {
length = wrappedString.length();
return length;
}
public int getLength() {
return this.length();
}
/**
* @Signature: lengthOfBytesUsingEncoding:
* @Declaration : - (NSUInteger)lengthOfBytesUsingEncoding:(NSStringEncoding)enc
* @Description : Returns the number of bytes required to store the receiver in a given encoding.
* @param enc The encoding for which to determine the receiver's length.
* @return Return Value The number of bytes required to store the receiver in the encoding enc in a non-external representation. The
* length does not include space for a terminating NULL character. Returns 0 if the specified encoding cannot be used to convert
* the receiver or if the amount of memory required for storing the results of the encoding conversion would exceed
* NSIntegerMax.
* @Discussion The result is exact and is returned in O(n) time.
**/
public int lengthOfBytesUsingEncoding(int enc) {
CharsetEncoder encoder = NSStringEncoding.getCharsetFromInt(enc).newEncoder();
char[] arrayTmp = this.wrappedString.toCharArray();
char[] array = { arrayTmp[0] };
int len = 0;
CharBuffer input = CharBuffer.wrap(array);
ByteBuffer output = ByteBuffer.allocate(10);
for (int i = 0; i < arrayTmp.length; i++) {
array[0] = arrayTmp[i];
output.clear();
input.clear();
encoder.encode(input, output, false);
len += output.position();
}
return len;
}
/**
* @Signature: maximumLengthOfBytesUsingEncoding:
* @Declaration : - (NSUInteger)maximumLengthOfBytesUsingEncoding:(NSStringEncoding)enc
* @Description : Returns the maximum number of bytes needed to store the receiver in a given encoding.
* @param enc The encoding for which to determine the receiver's length.
* @return Return Value The maximum number of bytes needed to store the receiver in encoding in a non-external representation. The
* length does not include space for a terminating NULL character. Returns 0 if the amount of memory required for storing the
* results of the encoding conversion would exceed NSIntegerMax.
* @Discussion The result is an estimate and is returned in O(1) time; the estimate may be considerably greater than the actual length
* needed.
**/
public int maximumLengthOfBytesUsingEncoding(int enc) {
if (enc == NSStringEncoding.NSUnicodeStringEncoding)
return length() * 2;
if ((enc) == NSStringEncoding.NSUTF8StringEncoding)
return length() * 6;
if ((enc) == NSStringEncoding.NSUTF16StringEncoding)
return length() * 8;
return this.length();
}
// Dividing Strings
/**
* @Signature: componentsSeparatedByString:
* @Declaration : - (NSArray *)componentsSeparatedByString:(NSString *)separator
* @Description : Returns an array containing substrings from the receiver that have been divided by a given separator.
* @param separator The separator string.
* @return Return Value An NSArray object containing substrings from the receiver that have been divided by separator.
* @Discussion The substrings in the array appear in the order they did in the receiver. Adjacent occurrences of the separator string
* produce empty strings in the result. Similarly, if the string begins or ends with the separator, the first or last
* substring, respectively, is empty.
**/
public NSArray<NSString> componentsSeparatedByString(NSString separator) {
String[] arrayOfString = this.wrappedString.split(separator.getWrappedString());
List<NSString> anArray = new ArrayList<NSString>();
for (int i = 0; i < arrayOfString.length; i++) {
anArray.add(new NSString(arrayOfString[i]));
}
return new NSArray<NSString>(anArray);
}
/**
* @Signature: componentsSeparatedByCharactersInSet:
* @Declaration : - (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)separator
* @Description : Returns an array containing substrings from the receiver that have been divided by characters in a given set.
* @param separator A character set containing the characters to to use to split the receiver. Must not be nil.
* @return Return Value An NSArray object containing substrings from the receiver that have been divided by characters in separator.
* @Discussion The substrings in the array appear in the order they did in the receiver. Adjacent occurrences of the separator
* characters produce empty strings in the result. Similarly, if the string begins or ends with separator characters, the
* first or last substring, respectively, is empty.
**/
public NSArray<Object> componentsSeparatedByCharactersInSet(NSCharacterSet separator) {
NSArray<Object> nsArray = new NSArray<Object>();
StringBuilder result = new StringBuilder();
for (int i = 0; i < separator.getCharacterSet().size(); i++) {
result.append("\\" + separator.getCharacterSet().toArray()[i]);
if (i < separator.getCharacterSet().size() - 1) {
result.append("|\\");
}
}
String myRegexStr = result.toString();
String[] arrayOfString = this.wrappedString.split(myRegexStr);
for (String string : arrayOfString) {
nsArray.getWrappedList().add(new NSString(string));
}
return nsArray;
}
/**
* @Signature: stringByTrimmingCharactersInSet:
* @Declaration : - (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set
* @Description : Returns a new string made by removing from both ends of the receiver characters contained in a given character set.
* @param set A character set containing the characters to remove from the receiver. set must not be nil.
* @return Return Value A new string made by removing from both ends of the receiver characters contained in set. If the receiver is
* composed entirely of characters from set, the empty string is returned.
* @Discussion Use whitespaceCharacterSet or whitespaceAndNewlineCharacterSet to remove whitespace around strings.
**/
public NSString stringByTrimmingCharactersInSet(NSCharacterSet separator) {
NSString result = new NSString();
StringBuilder regEx = new StringBuilder();
Iterator<Character> it = separator.getCharacterSet().iterator();
int count = 0;
while (it.hasNext()) {
Character c = it.next();
regEx.append("\\" + c);
if (count < separator.getCharacterSet().size() - 1) {
regEx.append("|");
}
count++;
}
String myRegexStr = regEx.toString();
result.wrappedString = this.wrappedString.replaceAll(myRegexStr, "");
this.wrappedString = result.wrappedString;
return result;
}
/**
* @Signature: substringFromIndex:
* @Declaration : - (NSString *)substringFromIndex:(NSUInteger)anIndex
* @Description : Returns a new string containing the characters of the receiver from the one at a given index to the end.
* @param anIndex An index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver. Raises an
* NSRangeException if (anIndex - 1) lies beyond the end of the receiver.
* @return Return Value A new string containing the characters of the receiver from the one at anIndex to the end. If anIndex is equal
* to the length of the string, returns an empty string.
**/
public NSString substringFromIndex(int anIndex) {
NSString result = new NSString();
result.wrappedString = this.wrappedString.substring(anIndex);
if (anIndex - 1 < this.wrappedString.length()) {
} else {
throw new IndexOutOfBoundsException("Index lies beyond the end of the receiver");
}
return result;
}
/**
* @Signature: substringWithRange:
* @Declaration : - (NSString *)substringWithRange:(NSRange)aRange
* @Description : Returns a string object containing the characters of the receiver that lie within a given range.
* @param aRange A range. The range must not exceed the bounds of the receiver. Raises an NSRangeException if (aRange.location - 1) or
* (aRange.location + aRange.length - 1) lies beyond the end of the receiver.
* @return Return Value A string object containing the characters of the receiver that lie within aRange.
**/
public NSString substringWithRange(NSRange aRange) {
NSString result = new NSString();
int start = aRange.location;
int end = aRange.location + aRange.length;
if (!(start - 1 > this.wrappedString.length() || end > this.wrappedString.length())) {
result.wrappedString = this.wrappedString.substring(start, end);
} else {
throw new IndexOutOfBoundsException("Index lies beyond the end of the receiver");
}
return result;
}
/**
* @Signature: substringToIndex:
* @Declaration : - (NSString *)substringToIndex:(NSUInteger)anIndex
* @Description : Returns a new string containing the characters of the receiver up to, but not including, the one at a given index.
* @param anIndex An index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver. Raises an
* NSRangeException if (anIndex - 1) lies beyond the end of the receiver.
* @return Return Value A new string containing the characters of the receiver up to, but not including, the one at anIndex. If anIndex
* is equal to the length of the string, returns a copy of the receiver.
**/
public NSString substringToIndex(int anIndex) {
NSString result = new NSString();
int end = anIndex;
result.wrappedString = this.wrappedString.substring(0, end);
return result;
}
// Replacing Substrings
/**
* @Signature: stringByReplacingOccurrencesOfString:withString:
* @Declaration : - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
* @Description : Returns a new string in which all occurrences of a target string in the receiver are replaced by another given string.
* @param target The string to replace.
* @param replacement The string with which to replace target.
* @return Return Value A new string in which all occurrences of target in the receiver are replaced by replacement.
* @Discussion Invokes stringByReplacingOccurrencesOfString:withString:options:range:with 0 options and range of the whole string.
**/
public NSString stringByReplacingOccurrencesOfStringWithString(NSString stringToBeReplaced,
NSString replacement) {
this.wrappedString.replaceAll(stringToBeReplaced.getWrappedString(),
replacement.getWrappedString());
return this;
}
/**
* @Signature: stringByReplacingOccurrencesOfString:withString:options:range:
* @Declaration : - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
* options:(NSStringCompareOptions)options range:(NSRange)searchRange
* @Description : Returns a new string in which all occurrences of a target string in a specified range of the receiver are replaced by
* another given string.
* @param target The string to replace.
* @param replacement The string with which to replace target.
* @param options A mask of options to use when comparing target with the receiver. Pass 0 to specify no options.
* @param searchRange The range in the receiver in which to search for target.
* @return Return Value A new string in which all occurrences of target, matched using options, in searchRange of the receiver are
* replaced by replacement.
**/
public NSString stringByReplacingOccurrencesOfStringWithStringOptionsRange(
NSString stringToBeReplaced, NSString replacement, NSStringCompareOptions options,
NSRange range) {
if (options == NSStringCompareOptions.NSAnchoredSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSBackwardsSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSCaseInsensitiveSearch) {
// @TODO FIXME Ò and È are not supported
String insentiveCase = "(?i)";
this.wrappedString = this.wrappedString.replaceAll(insentiveCase + stringToBeReplaced,
replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
// @TODO FIXME
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSLiteralSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
} else if (options == NSStringCompareOptions.NSRegularExpressionSearch) {
this.wrappedString = this.wrappedString.replaceAll(
stringToBeReplaced.getWrappedString(), replacement.getWrappedString());
}
return this;
}
/**
* @Signature: stringByReplacingCharactersInRange:withString:
* @Declaration : - (NSString *)stringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement
* @Description : Returns a new string in which the characters in a specified range of the receiver are replaced by a given string.
* @param range A range of characters in the receiver.
* @param replacement The string with which to replace the characters in range.
* @return Return Value A new string in which the characters in range of the receiver are replaced by replacement.
**/
public NSString stringByReplacingCharactersInRangeWithString(NSRange range,
String replacement) {
String tmpString = this.wrappedString.substring(range.location,
range.location + length() - 1);
this.wrappedString.replace(tmpString, replacement);
return null;
}
// Determining Composed Character Sequences
/**
* @Signature: rangeOfComposedCharacterSequenceAtIndex:
* @Declaration : - (NSRange)rangeOfComposedCharacterSequenceAtIndex:(NSUInteger)anIndex
* @Description : Returns the range in the receiver of the composed character sequence located at a given index.
* @param anIndex The index of a character in the receiver. The value must not exceed the bounds of the receiver.
* @return Return Value The range in the receiver of the composed character sequence located at anIndex.
* @Discussion The composed character sequence includes the first base character found at or before anIndex, and its length includes the
* base character and all non-base characters following the base character.
**/
public NSRange rangeOfComposedCharacterSequenceAtIndex(int anIndex) {
return new NSRange(anIndex, 1);
}
/**
* @Signature: rangeOfComposedCharacterSequencesForRange:
* @Declaration : - (NSRange)rangeOfComposedCharacterSequencesForRange:(NSRange)range
* @Description : Returns the range in the string of the composed character sequences for a given range.
* @param range A range in the receiver. The range must not exceed the bounds of the receiver.
* @return Return Value The range in the receiver that includes the composed character sequences in range.
* @Discussion This method provides a convenient way to grow a range to include all composed character sequences it overlaps.
**/
public NSRange rangeOfComposedCharacterSequencesForRange(NSRange range) {
return range;
}
// Identifying and Comparing Strings
/**
* @Signature: caseInsensitiveCompare:
* @Declaration : - (NSComparisonResult)caseInsensitiveCompare:(NSString *)aString
* @Description : Returns the result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value The result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.
* @Discussion If you are comparing strings to present to the end-user, you should typically use localizedCaseInsensitiveCompare:
* instead.
**/
public NSComparisonResult caseInsensitiveCompare(NSString aString) {
int ordre = this.getWrappedString().compareToIgnoreCase(aString.getWrappedString());
if(ordre == 0)return NSComparisonResult.NSOrderedSame;
if(ordre < 0)return NSComparisonResult.NSOrderedAscending;
return NSComparisonResult.NSOrderedDescending;
}
/**
* @Signature: localizedCaseInsensitiveCompare:
* @Declaration : - (NSComparisonResult)localizedCaseInsensitiveCompare:(NSString *)aString
* @Description : Compares the string with a given string using a case-insensitive, localized, comparison.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value Returns an NSComparisonResult value that indicates the lexical ordering. NSOrderedAscending the receiver
* precedes aString in lexical ordering, NSOrderedSame the receiver and aString are equivalent in lexical value, and
* NSOrderedDescending if the receiver follows aString.
* @Discussion This method uses the current locale.
**/
public NSObjCRuntime.NSComparisonResult localizedCaseInsensitiveCompare(NSString aString) {
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.SECONDARY);
int comparison = collator.compare(this.getWrappedString(), aString.getWrappedString());
if (comparison == 0)
return NSObjCRuntime.NSComparisonResult.NSOrderedSame;
if (comparison < 0)
return NSObjCRuntime.NSComparisonResult.NSOrderedAscending;
return NSObjCRuntime.NSComparisonResult.NSOrderedDescending;
}
/**
* @Signature: compare:options:range:locale:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)range
* locale:(id)locale
* @Description : Compares the string using the specified options and returns the lexical ordering for the range.
* @param aString The string with which to compare the range of the receiver specified by range. This value must not be nil. If this
* value is nil, the behavior is undefined and may change in future versions of OS X.
* @param mask Options for the search—you can combine any of the following using a C bitwise OR operator: NSCaseInsensitiveSearch,
* NSLiteralSearch, NSNumericSearch. See String Programming Guide for details on these options.
* @param range The range of the receiver over which to perform the comparison. The range must not exceed the bounds of the receiver.
* Important:Â Raises an NSRangeException if range exceeds the bounds of the receiver.
* @param locale An instance of NSLocale. To use the current locale, pass [NSLocale currentLocale]. For example, if you are comparing
* strings to present to the end-user, use the current locale. To use the system locale, pass nil.
* @return Return Value Returns an NSComparisonResult value that indicates the lexical ordering of a specified range within the receiver
* and a given string. NSOrderedAscending if the substring of the receiver given by range precedes aString in lexical ordering
* for the locale given in dict, NSOrderedSame if the substring of the receiver and aString are equivalent in lexical value, and
* NSOrderedDescending if the substring of the receiver follows aString.
* @Discussion The locale argument affects both equality and ordering algorithms. For example, in some locales, accented characters are
* ordered immediately after the base; other locales order them after “z�.
**/
public NSComparisonResult compareOptionsRangeLocale(NSString aString,
NSStringCompareOptions mask, NSRange range, NSLocale locale) {
int strntgh = Collator.IDENTICAL;
if (mask == NSStringCompareOptions.NSCaseInsensitiveSearch) {
strntgh = Collator.SECONDARY;
} else if (mask == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
strntgh = Collator.PRIMARY;
}
NSString subtringFRomRange = substringWithRange(range);
Collator collator = Collator.getInstance(locale.getLocale());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(subtringFRomRange, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: localizedCompare:
* @Declaration : - (NSComparisonResult)localizedCompare:(NSString *)aString
* @Description : Compares the string and a given string using a localized comparison.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value Returns an NSComparisonResult. NSOrderedAscending the receiver precedes string in lexical ordering,
* NSOrderedSame the receiver and string are equivalent in lexical value, and NSOrderedDescending if the receiver follows
* string.
* @Discussion This method uses the current locale.
**/
public NSComparisonResult localizedCompare(NSString aString) {
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: compare:options:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask
* @Description : Compares the string with the specified string using the given options.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @param mask Options for the search—you can combine any of the following using a C bitwise OR operator: NSCaseInsensitiveSearch,
* NSLiteralSearch, NSNumericSearch. See String Programming Guide for details on these options.
* @return Return Value The result of invoking compare:options:range: with a given mask as the options and the receiver’s full extent as
* the range.
* @Discussion If you are comparing strings to present to the end-user, you should typically use localizedCompare: or
* localizedCaseInsensitiveCompare: instead, or use compare:options:range:locale: and pass the user’s locale.
**/
public NSComparisonResult compareOptions(NSString aString, NSStringCompareOptions mask) {
int strntgh = Collator.IDENTICAL;
if (mask == NSStringCompareOptions.NSCaseInsensitiveSearch) {
strntgh = Collator.SECONDARY;
} else if (mask == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
strntgh = Collator.PRIMARY;
}
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: compare:options:range:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)range
* @Description : Returns the result of invoking compare:options:range:locale: with a nil locale.
* @param aString The string with which to compare the range of the receiver specified by range. This value must not be nil. If this
* value is nil, the behavior is undefined and may change in future versions of OS X.
* @param mask Options for the search—you can combine any of the following using a C bitwise OR operator: NSCaseInsensitiveSearch,
* NSLiteralSearch, NSNumericSearch. See String Programming Guide for details on these options.
* @param range The range of the receiver over which to perform the comparison. The range must not exceed the bounds of the receiver.
* Important:Â Raises an NSRangeException if range exceeds the bounds of the receiver.
* @return Return Value The result of invoking compare:options:range:locale: with a nil locale.
* @Discussion If you are comparing strings to present to the end-user, use compare:options:range:locale: instead and pass the current
* locale.
**/
public NSComparisonResult compareOptionsRange(NSString aString, NSStringCompareOptions mask,
NSRange range) {
int strntgh = Collator.IDENTICAL;
if (mask == NSStringCompareOptions.NSCaseInsensitiveSearch) {
strntgh = Collator.SECONDARY;
} else if (mask == NSStringCompareOptions.NSDiacriticInsensitiveSearch) {
strntgh = Collator.PRIMARY;
}
NSString subtringFRomRange = substringWithRange(range);
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(subtringFRomRange, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: compare:
* @Declaration : - (NSComparisonResult)compare:(NSString *)aString
* @Description : Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
* @param aString The string with which to compare the receiver. This value must not be nil. If this value is nil, the behavior is
* undefined and may change in future versions of OS X.
* @return Return Value The result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
* @Discussion If you are comparing strings to present to the end-user, you should typically use localizedCompare: or
* localizedCaseInsensitiveCompare: instead.
**/
public NSComparisonResult compare(NSString aString) {
if (aString == null)
throw new IllegalArgumentException(" This value must not be null ");
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.IDENTICAL);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else if (comparison > 0) {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedDescending;
}
}
/**
* @Signature: localizedStandardCompare:
* @Declaration : - (NSComparisonResult)localizedStandardCompare:(NSString *)string
* @Description : Compares strings as sorted by the Finder.
* @param string The string to compare with the receiver.
* @return Return Value The result of the comparison.
* @Discussion This method should be used whenever file names or other strings are presented in lists and tables where Finder-like
* sorting is appropriate. The exact sorting behavior of this method is different under different locales and may be changed
* in future releases. This method uses the current locale.
**/
public NSComparisonResult localizedStandardCompare(NSString aString) {
Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.TERTIARY);
int comparison = collator.compare(this.wrappedString, aString.wrappedString);
if (comparison == 0) {
Log.e("NSString", "Collator sees them as the same : ");
return NSComparisonResult.NSOrderedSame;
} else {
Log.e("NSString", "Collator sees them as DIFFERENT : ");
return NSComparisonResult.NSOrderedAscending;
}
}
/**
* @Signature: hasPrefix:
* @Declaration : - (BOOL)hasPrefix:(NSString *)aString
* @Description : Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.
* @param aString A string.
* @return Return Value YES if aString matches the beginning characters of the receiver, otherwise NO. Returns NO if aString is empty.
* @Discussion This method is a convenience for comparing strings using the NSAnchoredSearch option. See String Programming Guide for
* more information.
**/
public boolean hasPrefix(NSString prefix) {
return this.wrappedString.startsWith(prefix.wrappedString);
}
/**
* @Signature: hasSuffix:
* @Declaration : - (BOOL)hasSuffix:(NSString *)aString
* @Description : Returns a Boolean value that indicates whether a given string matches the ending characters of the receiver.
* @param aString A string.
* @return Return Value YES if aString matches the ending characters of the receiver, otherwise NO. Returns NO if aString is empty.
* @Discussion This method is a convenience for comparing strings using the NSAnchoredSearch and NSBackwardsSearch options. See String
* Programming Guide for more information.
**/
public boolean hasSuffix(NSString suffix) {
return this.wrappedString.endsWith(suffix.wrappedString);
}
/**
* @Signature: isEqualToString:
* @Declaration : - (BOOL)isEqualToString:(NSString *)aString
* @Description : Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based
* comparison.
* @param aString The string with which to compare the receiver.
* @return Return Value YES if aString is equivalent to the receiver (if they have the same id or if they are NSOrderedSame in a literal
* comparison), otherwise NO.
* @Discussion The comparison uses the canonical representation of strings, which for a particular string is the length of the string
* plus the Unicode characters that make up the string. When this method compares two strings, if the individual Unicodes
* are the same, then the strings are equal, regardless of the backing store. “Literal� when applied to string comparison
* means that various Unicode decomposition rules are not applied and Unicode characters are individually compared. So, for
* instance, “Ö� represented as the composed character sequence “O� and umlaut would not compare equal to “Ö� represented as
* one Unicode character.
**/
public boolean isEqualToString(NSString myStr) {
if (myStr == null || this.wrappedString == null) {
return false;
} else {
return this.wrappedString.equals(myStr.wrappedString);
}
}
/**
* @Declaration : @property (readonly) NSUInteger hash
* @Description : An unsigned integer that can be used as a hash table address. (read-only)
* @Discussion If two string objects are equal (as determined by the isEqualToString: method), they must have the same hash value. This
* property fulfills this requirement. You should not rely on this property having the same hash value across releases of OS
* X.
**/
private int hash;
@Override
public int hash() {
hash = wrappedString.hashCode();
return hash;
}
// Getting C Strings
/**
* @Signature: cStringUsingEncoding:
* @Declaration : - (const char *)cStringUsingEncoding:(NSStringEncoding)encoding
* @Description : Returns a representation of the receiver as a C string using a given encoding.
* @param encoding The encoding for the returned C string.
* @return Return Value A C string representation of the receiver using the encoding specified by encoding. Returns NULL if the receiver
* cannot be losslessly converted to encoding.
* @Discussion The returned C string is guaranteed to be valid only until either the receiver is freed, or until the current memory is
* emptied, whichever occurs first. You should copy the C string or use getCString:maxLength:encoding: if it needs to store
* the C string beyond this time. You can use canBeConvertedToEncoding: to check whether a string can be losslessly
* converted to encoding. If it can’t, you can use dataUsingEncoding:allowLossyConversion: to get a C-string representation
* using encoding, allowing some loss of information (note that the data returned by dataUsingEncoding:allowLossyConversion:
* is not a strict C-string since it does not have a NULL terminator).
**/
public char[] cStringUsingEncoding(NSStringEncoding encoding) {
// TODO check the encoding
return this.wrappedString.toCharArray();
}
/**
* @Signature: getCString:maxLength:encoding:
* @Declaration : - (BOOL)getCString:(char *)buffer maxLength:(NSUInteger)maxBufferCount encoding:(NSStringEncoding)encoding
* @Description : Converts the receiver’s content to a given encoding and stores them in a buffer.
* @param buffer Upon return, contains the converted C-string plus the NULL termination byte. The buffer must include room for
* maxBufferCount bytes.
* @param maxBufferCount The maximum number of bytes in the string to return in buffer (including the NULL termination byte).
* @param encoding The encoding for the returned C string.
* @return Return Value YES if the operation was successful, otherwise NO. Returns NO if conversion is not possible due to encoding
* errors or if buffer is too small.
* @Discussion Note that in the treatment of the maxBufferCount argument, this method differs from the deprecated getCString:maxLength:
* method which it replaces. (The buffer should include room for maxBufferCount bytes; this number should accommodate the
* expected size of the return value plus the NULL termination byte, which this method adds.) You can use
* canBeConvertedToEncoding: to check whether a string can be losslessly converted to encoding. If it can’t, you can use
* dataUsingEncoding:allowLossyConversion: to get a C-string representation using encoding, allowing some loss of
* information (note that the data returned by dataUsingEncoding:allowLossyConversion: is not a strict C-string since it
* does not have a NULL terminator).
**/
public boolean getCStringMaxLengthMaxBufferCountEncoding(char[] buffer, int maxBufferCount,
NSStringEncoding encoding) {
// FIXME check the encoding
char[] charArray = this.wrappedString.toCharArray();
int minLength = Math.min(charArray.length, maxBufferCount);
buffer = Arrays.copyOfRange(charArray, 0, minLength);
if (buffer.length > 0) {
return true;
} else {
return false;
}
}
/**
* @Declaration : @property (readonly) __strong const char *UTF8String
* @Description : A null-terminated UTF8 representation of the string. (read-only)
* @Discussion This C string is a pointer to a structure inside the string object, which may have a lifetime shorter than the string
* object and will certainly not have a longer lifetime. Therefore, you should copy the C string if it needs to be stored
* outside of the memory context in which you use this property.
**/
private String UTF8String;
public String UTF8String() {
// UTF-8 is the default encoding
UTF8String = this.wrappedString;
return UTF8String;
}
/**
* @Signature: cString
* @Declaration : - (const char *)cString
* @Description : Returns a representation of the receiver as a C string in the default C-string encoding. (Deprecated in iOS 2.0. Use
* cStringUsingEncoding: or UTF8String instead.)
* @Discussion The returned C string will be automatically freed just as a returned object would be released; your code should copy the
* C string or use getCString: if it needs to store the C string outside of the autorelease context in which the C string is
* created. Raises an NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding
* without loss of information. Use canBeConvertedToEncoding: if necessary to check whether a string can be losslessly
* converted to the default C-string encoding. If it can’t, use lossyCString or dataUsingEncoding:allowLossyConversion: to
* get a C-string representation with some loss of information.
**/
public char[] cString() {
return this.wrappedString.toCharArray();
}
/**
* @Signature: cStringLength
* @Declaration : - (NSUInteger)cStringLength
* @Description : Returns the length in char-sized units of the receiver’s C-string representation in the default C-string encoding.
* (Deprecated in iOS 2.0. Use lengthOfBytesUsingEncoding: or maximumLengthOfBytesUsingEncoding: instead.)
* @Discussion Raises if the receiver can’t be represented in the default C-string encoding without loss of information. You can also
* use canBeConvertedToEncoding: to check whether a string can be losslessly converted to the default C-string encoding. If
* it can’t, use lossyCString to get a C-string representation with some loss of information, then check its length
* explicitly using the ANSI function strlen().
**/
public int cStringLength() {
return wrappedString.toCharArray().length;
}
/**
* @Signature: getCString:
* @Declaration : - (void)getCString:(char *)buffer
* @Description : Invokes getCString:maxLength:range:remainingRange: with NSMaximumStringLength as the maximum length, the receiver’s
* entire extent as the range, and NULL for the remaining range. (Deprecated in iOS 2.0. Use cStringUsingEncoding: or
* dataUsingEncoding:allowLossyConversion: instead.)
* @Discussion buffer must be large enough to contain the resulting C-string plus a terminating NULL character (which this method
* adds—[string cStringLength]). Raises an NSCharacterConversionException if the receiver can’t be represented in the
* default C-string encoding without loss of information. Use canBeConvertedToEncoding: if necessary to check whether a
* string can be losslessly converted to the default C-string encoding. If it can’t, use lossyCString or
* dataUsingEncoding:allowLossyConversion: to get a C-string representation with some loss of information.
**/
public void getCString(char[] buffer) {
// FIXME check the encoding
buffer = this.wrappedString.toCharArray();
}
public void getCString(String buffer) {
// FIXME check the encoding
buffer = this.wrappedString;
}
/**
* @Signature: getCString:maxLength:
* @Declaration : - (void)getCString:(char *)buffer maxLength:(NSUInteger)maxLength
* @Description : Invokes getCString:maxLength:range:remainingRange: with maxLength as the maximum length in char-sized units, the
* receiver’s entire extent as the range, and NULL for the remaining range. (Deprecated in iOS 2.0. Use
* getCString:maxLength:encoding: instead.)
* @Discussion buffer must be large enough to contain maxLength chars plus a terminating zero char (which this method adds). Raises an
* NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding without loss of
* information. Use canBeConvertedToEncoding: if necessary to check whether a string can be losslessly converted to the
* default C-string encoding. If it can’t, use lossyCString or dataUsingEncoding:allowLossyConversion: to get a C-string
* representation with some loss of information.
**/
public void getCStringMaxLength(char[] buffer, int maxLength) {
char[] charArray = this.wrappedString.toCharArray();
int minLength = Math.min(charArray.length, maxLength);
buffer = Arrays.copyOfRange(this.wrappedString.toCharArray(), 0, minLength - 1);
char[] anotherCharArray = new char[minLength + 1];
for (int i = 0; i < anotherCharArray.length; i++) {
if (i == anotherCharArray.length - 1) {
anotherCharArray[i] = 0;
} else {
anotherCharArray[i] = buffer[i];
}
}
buffer = anotherCharArray;
}
/**
* @Signature: getCString:maxLength:range:remainingRange:
* @Declaration : - (void)getCString:(char *)buffer maxLength:(NSUInteger)maxLength range:(NSRange)aRange
* remainingRange:(NSRangePointer)leftoverRange
* @Description : Converts the receiver’s content to the default C-string encoding and stores them in a given buffer. (Deprecated in iOS
* 2.0. Use getCString:maxLength:encoding: instead.)
* @Discussion buffer must be large enough to contain maxLength bytes plus a terminating zero character (which this method adds). Copies
* and converts as many characters as possible from aRange and stores the range of those not converted in the range given by
* leftoverRange (if it’s non-nil). Raises an NSRangeException if any part of aRange lies beyond the end of the string.
* Raises an NSCharacterConversionException if the receiver can’t be represented in the default C-string encoding without
* loss of information. Use canBeConvertedToEncoding: if necessary to check whether a string can be losslessly converted to
* the default C-string encoding. If it can’t, use lossyCString or dataUsingEncoding:allowLossyConversion: to get a C-string
* representation with some loss of information.
**/
public void getCStringMaxLengthRangeRemainingRange(char[] buffer, int maxLength, NSRange aRange,
NSRangePointer leftoverRange) {
char[] charArray = this.wrappedString.toCharArray();
int start = aRange.location;
int end = aRange.location + aRange.length;
int minLength = Math.min(charArray.length, maxLength);
minLength = Math.min(minLength, aRange.length);
char[] anotherCharArray = Arrays.copyOfRange(this.wrappedString.toCharArray(), start, end);
// buffer = new String[minLength + 1];
for (int i = 0; i < buffer.length; i++) {
if (i == buffer.length - 1) {
buffer[i] = '0';
} else {
buffer[i] = anotherCharArray[i];
}
}
}
/**
* @Signature: lossyCString
* @Declaration : - (const char *)lossyCString
* @Description : Returns a representation of the receiver as a C string in the default C-string encoding, possibly losing information
* in converting to that encoding. (Deprecated in iOS 2.0. Use cStringUsingEncoding: or
* dataUsingEncoding:allowLossyConversion: instead.)
* @Discussion This method does not raise an exception if the conversion is lossy. The returned C string will be automatically freed
* just as a returned object would be released; your code should copy the C string or use getCString: if it needs to store
* the C string outside of the autorelease context in which the C string is created.
**/
public void lossyCString(char[] buffer) {
buffer = this.wrappedString.toCharArray();
}
// Getting a Shared Prefix
/**
* @Signature: commonPrefixWithString:options:
* @Declaration : - (NSString *)commonPrefixWithString:(NSString *)aString options:(NSStringCompareOptions)mask
* @Description : Returns a string containing characters the receiver and a given string have in common, starting from the beginning of
* each up to the first characters that aren’t equivalent.
* @param aString The string with which to compare the receiver.
* @param mask Options for the comparison. The following search options may be specified by combining them with the C bitwise OR
* operator: NSCaseInsensitiveSearch, NSLiteralSearch. See String Programming Guide for details on these options.
* @return Return Value A string containing characters the receiver and aString have in common, starting from the beginning of each up
* to the first characters that aren’t equivalent.
* @Discussion The returned string is based on the characters of the receiver. For example, if the receiver is “Ma¨dchen� and aString is
* “Mädchenschule�, the string returned is “Ma¨dchen�, not “Mädchen�.
**/
public NSString commonPrefixWithStringOptions(NSString myStr, int mask) {
char[] myStrCharArray = Normalizer.normalize(myStr.wrappedString, Normalizer.Form.NFD)
.toCharArray();
char[] thisStrCharArray = Normalizer.normalize(this.wrappedString, Normalizer.Form.NFD)
.toCharArray();
StringBuilder strBdr = new StringBuilder();
int minLength = Math.min(myStrCharArray.length, thisStrCharArray.length);
for (int i = 0; i < minLength; i++) {
if (thisStrCharArray[i] == myStrCharArray[i]) {
strBdr.append(myStrCharArray[i]);
}
}
return new NSString(strBdr.toString());
}
// Getting Strings with Mapping
/**
* @Declaration : @property (readonly, copy) NSString *decomposedStringWithCanonicalMapping
* @Description : A string made by normalizing the string’s contents using the Unicode Normalization Form D. (read-only)
**/
private NSString decomposedStringWithCanonicalMapping;
public NSString decomposedStringWithCanonicalMapping() {
decomposedStringWithCanonicalMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFD));
return decomposedStringWithCanonicalMapping;
}
/**
* @Declaration : @property (readonly, copy) NSString *decomposedStringWithCompatibilityMapping
* @Description : A string made by normalizing the receiver’s contents using the Unicode Normalization Form KD. (read-only)
**/
private NSString decomposedStringWithCompatibilityMapping;
public NSString decomposedStringWithCompatibilityMapping() {
decomposedStringWithCompatibilityMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFKD));
return decomposedStringWithCompatibilityMapping;
}
/**
* @Declaration : @property (readonly, copy) NSString *precomposedStringWithCanonicalMapping
* @Description : A string made by normalizing the string’s contents using the Unicode Normalization Form C. (read-only)
**/
private NSString precomposedStringWithCanonicalMapping;
public NSString precomposedStringWithCanonicalMapping() {
precomposedStringWithCanonicalMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFC));
return precomposedStringWithCanonicalMapping;
}
/**
* @Declaration : @property (readonly, copy) NSString *precomposedStringWithCompatibilityMappin
* @Description : A string made by normalizing the receiver’s contents using the Unicode Normalization Form KC. (read-only)
**/
private NSString precomposedStringWithCompatibilityMapping;
public NSString precomposedStringWithCompatibilityMapping() {
precomposedStringWithCompatibilityMapping = new NSString(
Normalizer.normalize(this.wrappedString, Normalizer.Form.NFKC));
return precomposedStringWithCompatibilityMapping;
}
// Working with Encodings
/**
* @Signature: availableStringEncodings
* @Declaration : + (const NSStringEncoding *)availableStringEncodings
* @Description : Returns a zero-terminated list of the encodings string objects support in the application’s environment.
* @return Return Value A zero-terminated list of the encodings string objects support in the application’s environment.
* @Discussion Among the more commonly used encodings are: NSASCIIStringEncoding NSUnicodeStringEncoding NSISOLatin1StringEncoding
* NSISOLatin2StringEncoding NSSymbolStringEncoding See the “Constants� section for a larger list and descriptions of many
* supported encodings. In addition to those encodings listed here, you can also use the encodings defined for CFString in
* Core Foundation; you just need to call the CFStringConvertEncodingToNSStringEncoding function to convert them to a usable
* format.
**/
public static int[] availableStringEncodings() {
SortedMap<String, Charset> availableCharsetEntry = Charset.availableCharsets();
Set<String> availableCharsetKey = availableCharsetEntry.keySet();
int[] available = new int[availableCharsetKey.size()];
int i = 0;
for (String string : availableCharsetKey) {
available[i++] = NSStringEncoding.getIntFromCharset(string);
}
return available;
}
/**
* @Signature: defaultCStringEncoding
* @Declaration : + (NSStringEncoding)defaultCStringEncoding
* @Description : Returns the C-string encoding assumed for any method accepting a C string as an argument.
* @return Return Value The C-string encoding assumed for any method accepting a C string as an argument.
* @Discussion This method returns a user-dependent encoding who value is derived from user's default language and potentially other
* factors. You might sometimes need to use this encoding when interpreting user documents with unknown encodings, in the
* absence of other hints, but in general this encoding should be used rarely, if at all. Note that some potential values
* might result in unexpected encoding conversions of even fairly straightforward NSString content—for example, punctuation
* characters with a bidirectional encoding. Methods that accept a C string as an argument use ...CString... in the keywords
* for such arguments: for example, stringWithCString:—note, though, that these are deprecated. The default C-string
* encoding is determined from system information and can’t be changed programmatically for an individual process. See
* “String Encodings� for a full list of supported encodings.
**/
public static NSStringEncoding defaultCStringEncoding() {
return new NSStringEncoding();
}
/**
* @Signature: localizedNameOfStringEncoding:
* @Declaration : + (NSString *)localizedNameOfStringEncoding:(NSStringEncoding)encoding
* @Description : Returns a human-readable string giving the name of a given encoding.
* @param encoding A string encoding.
* @return Return Value A human-readable string giving the name of encoding in the current locale.
**/
public static NSString localizedNameOfStringEncoding(int encoding) {
return new NSString(NSStringEncoding.getCharsetFromInt(encoding).name());
}
/**
* @Signature: canBeConvertedToEncoding:
* @Declaration : - (BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding
* @Description : Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of
* information.
* @param encoding A string encoding.
* @return Return Value YES if the receiver can be converted to encoding without loss of information. Returns NO if characters would
* have to be changed or deleted in the process of changing encodings.
* @Discussion If you plan to actually convert a string, the dataUsingEncoding:... methods return nil on failure, so you can avoid the
* overhead of invoking this method yourself by simply trying to convert the string.
**/
public boolean canBeConvertedToEncoding(int encoding) {
// we encode the string
byte[] bytes = this.wrappedString.getBytes(NSStringEncoding.getCharsetFromInt(encoding)); // Charset to encode into
// Now we decode it :
String decodedString;
try {
decodedString = new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
return false;
} // Charset with which bytes were encoded
return this.wrappedString.equals(decodedString) ? true : false;
}
/**
* @Signature: dataUsingEncoding:
* @Declaration : - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding
* @Description : Returns an NSData object containing a representation of the receiver encoded using a given encoding.
* @param encoding A string encoding.
* @return Return Value The result of invoking dataUsingEncoding:allowLossyConversion: with NO as the second argument (that is,
* requiring lossless conversion).
**/
public NSData dataUsingEncoding(int encoding) {
byte[] bytes = this.wrappedString.getBytes(NSStringEncoding.getCharsetFromInt(encoding));
return new NSData(bytes);
}
/**
* @Signature: dataUsingEncoding:allowLossyConversion:
* @Declaration : - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding allowLossyConversion:(BOOL)flag
* @Description : Returns an NSData object containing a representation of the receiver encoded using a given encoding.
* @param encoding A string encoding.
* @param flag If YES, then allows characters to be removed or altered in conversion.
* @return Return Value An NSData object containing a representation of the receiver encoded using encoding. Returns nil if flag is NO
* and the receiver can’t be converted without losing some information (such as accents or case).
* @Discussion If flag is YES and the receiver can’t be converted without losing some information, some characters may be removed or
* altered in conversion. For example, in converting a character from NSUnicodeStringEncoding to NSASCIIStringEncoding, the
* character ‘�’ becomes ‘A’, losing the accent. This method creates an external representation (with a byte order marker,
* if necessary, to indicate endianness) to ensure that the resulting NSData object can be written out to a file safely. The
* result of this method, when lossless conversion is made, is the default “plain text� format for encoding and is the
* recommended way to save or transmit a string object.
**/
public NSData dataUsingEncodingAllowLossyConversion(int encoding, boolean flag) {
// FIXME check if it's possible to enable lossyConversion
return new NSData(
this.wrappedString.getBytes(NSStringEncoding.getCharsetFromInt(encoding)));
}
/**
* @Declaration : @property (readonly, copy) NSString *description
* @Description : This NSString object. (read-only)
**/
private NSString description;
@Override
public NSString description() {
description = new NSString(wrappedString);
return description;
}
/**
* @Declaration : @property (readonly) NSStringEncoding fastestEncoding
* @Description : The fastest encoding to which the receiver may be converted without loss of information. (read-only)
* @Discussion “Fastest� applies to retrieval of characters from the string. This encoding may not be space efficient.
**/
transient private NSStringEncoding fastestEncoding;
public NSStringEncoding fastestEncoding() {
// NOTMAPPED RETURNS THE DEFAULT ENCODING
return fastestEncoding = new NSStringEncoding();
}
/**
* @Declaration : @property (readonly) NSStringEncoding smallestEncoding
* @Description : The smallest encoding to which the receiver can be converted without loss of information. (read-only)
* @Discussion This encoding may not be the fastest for accessing characters, but is space-efficient. This property may take some time
* to access.
**/
private int smallestEncoding;
public int smallestEncoding() {
// NOTMAPPED RETURNS THE DEFAULT ENCODING
int[] encoding = this.availableStringEncodings();
int smallestEncoding = 0;
int theSmallestEncoding = 0;
for (int i = 0; i < encoding.length; i++) {
byte[] bytes = this.wrappedString
.getBytes(NSStringEncoding.getCharsetFromInt(encoding[i])); // Charset to encode into
// Now we decode it :
String decodedString;
try {
decodedString = new String(bytes, "UTF-8");
if (this.wrappedString.equals(decodedString) && smallestEncoding > bytes.length) {
smallestEncoding = bytes.length;
theSmallestEncoding = encoding[i];
}
} catch (UnsupportedEncodingException e) {
Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: "
+ Log.getStackTraceString(e));
} // Charset with which bytes were encoded
}
return theSmallestEncoding;
}
// Working with URLs
/**
* stringByAddingPercentEscapesUsingEncoding:
*
* @Returns a representation of the receiver using a given encoding to determine the percent escapes necessary to convert the receiver
* into a legal URL string. - (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
* @Parameters encoding The encoding to use for the returned string. If you are uncertain of the correct encoding you should use
* NSUTF8StringEncoding.
* @Return Value A representation of the receiver using encoding to determine the percent escapes necessary to convert the receiver into
* a legal URL string. Returns nil if encoding cannot encode a particular character.
* @Discussion It may be difficult to use this function to "clean up" unescaped or partially escaped URL strings where sequences are
* unpredictable. See CFURLCreateStringByAddingPercentEscapes for more information.
*/
public NSString stringByAddingPercentEscapesUsingEncoding(int encoding) {
encoding = NSStringEncoding.NSUTF8StringEncoding;
NSString result = new NSString();
if (getWrappedString() == null)
return null;
byte[] bytes = getWrappedString().getBytes(NSStringEncoding.getCharsetFromInt(encoding));
StringBuilder out = new StringBuilder();
for (byte b : bytes)
if ((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b >= '0' && b <= '9'))
out.append((char) b);
else
switch (b) {
case '!':
case '*':
case '\'':
case '(':
case ')':
case ';':
case ':':
case '@':
case '&':
case '=':
case '+':
case '$':
case ',':
case '/':
case '?':
case '#':
case '[':
case ']':
case '-':
case '_':
case '.':
case '~':
out.append((char) b);
break;
default:
out.append('%').append(hex((b & 0xf0) >> 4)).append(hex(b & 0xf));
}
result.wrappedString = out.toString();
return result;
}
private static char hex(int num) {
return num > 9 ? (char) (num + 55) : (char) (num + '0');
}
/**
* stringByReplacingPercentEscapesUsingEncoding:
*
* @Returns a new string made by replacing in the receiver all percent escapes with the matching characters as determined by a given
* encoding. - (NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
* @Parameters encoding The encoding to use for the returned string.
* @Return Value A new string made by replacing in the receiver all percent escapes with the matching characters as determined by the
* given encoding encoding. Returns nil if the transformation is not possible, for example, the percent escapes give a byte
* sequence not legal in encoding.
* @Discussion See CFURLCreateStringByReplacingPercentEscapes for more complex transformations.
*/
public NSString stringByReplacingPercentEscapesUsingEncoding(int encoding) {
NSString result = new NSString();
try {
result.wrappedString = URLDecoder.decode(this.wrappedString,
NSStringEncoding.getCharsetFromInt(encoding).name());
return result;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return result;
}
/**
* stringByAddingPercentEncodingWithAllowedCharacters: Returns a new string made from the receiver by replacing all characters not in
* the specified set with percent encoded characters. - (NSString *)stringByAddingPercentEncodingWithAllowedCharacters:(NSCharacterSet
* *)allowedCharacters Parameters allowedCharacters The characters not replaced in the string. Return Value Returns the encoded string
* or nil if the transformation is not possible. Discussion UTF-8 encoding is used to determine the correct percent encoded characters.
* Entire URL strings cannot be percent-encoded. This method is intended to percent-encode an URL component or subcomponent string, NOT
* the entire URL string. Any characters in allowedCharacters outside of the 7-bit ASCII range are ignored.
*/
public NSString stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet charset) {
if (getWrappedString() == null)
return null;
NSString result = new NSString();
char[] url = getWrappedString().toCharArray();
StringBuilder out = new StringBuilder();
try {
for (char c : url) {
if (charset.characterIsMember(c))
out.append(c);
else {
byte[] bytes = (c + "").getBytes("UTF-8");
for (byte b : bytes) {
out.append('%').append(hex((b & 0xf0) >> 4)).append(hex(b & 0xf));
}
}
}
result.wrappedString = out.toString();
return result;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
// e.printStackTrace();
return null;
}
}
/*
* if(!NSCharacterSet.getCharacterSet().emty) public NSString stringByAddingPercentEncodingWithAllowedCharacters(String URL,
* NSCharacterSet charset) { NSString result = new NSString(); // Converting ArrayList to String in Java using advanced for-each loop
* int hhhh = 0.5; StringBuilder sb = new StringBuilder(); for (int i = 0; i < charset.getCharacterSet().size(); i++) {
* sb.append(charset.getCharacterSet().toArray()[i]).append(';'); // separating contents using semi colon }
*
* String charsetString = sb.toString();
*
* if (URL == null) return null; try { char[] chares = URL.toCharArray();
*
* StringBuilder out = new StringBuilder(); for (char c : chares) {
*
* if (charsetString.contains(c + "")) { out.append(new String(c + "")); } else { byte[] bytes = (c + "").getBytes("UTF-8"); for (byte b
* : bytes) { out.append('%').append(hex((b & 0xf0) >> 4)).append(hex(b & 0xf)); } } } result.wrappedString = out.toString(); return
* result; } catch (UnsupportedEncodingException e) { Log.d("Exception ", "Message :" + e.getMessage() + "\n StackTrace: " +
* Log.getStackTraceString(e)); } return null; }
*/
/**
* stringByRemovingPercentEncoding
*
* @Returns a new string made from the receiver by replacing all percent encoded sequences with the matching UTF-8 characters. -
* (NSString *)stringByRemovingPercentEncoding
* @Return Value A new string with the percent encoded sequences removed.
*/
public NSString stringByRemovingPercentEncoding() {
NSString result = new NSString();
try {
result.wrappedString = URLDecoder.decode(this.wrappedString, "UTF-8");
return result;
} catch (UnsupportedEncodingException e) {
Log.d("Exception ",
"Message :" + e.getMessage() + "\n StackTrace: " + Log.getStackTraceString(e));
}
return result;
}
@Override
public boolean supportsSecureCoding() {
return false;
}
@Override
public NSObject mutableCopyWithZone(NSZone zone) {
return new NSString(this.getWrappedString());
}
@Override
public String toString() {
return this.getWrappedString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((wrappedString == null) ? 0 : wrappedString.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NSString other = (NSString) obj;
if (wrappedString == null) {
if (other.wrappedString != null)
return false;
} else if (!wrappedString.equals(other.wrappedString))
return false;
return true;
}
@Override
public int compareTo(NSString another) {
NSString str = another;
return getWrappedString().compareTo(str.getWrappedString());
}
@Override
public NSObject copy() {
return new NSString(new String(wrappedString));
}
@Override
public NSObject copyWithZone(NSZone zone) {
return null;
}
// Keys for dictionaries that contain text attributes.
/**
* Key to the font in a text attributes dictionary. The corresponding value is an instance of UIFont. Use a font with size 0.0 to get
* the default font size for the current context.
*/
public static final NSString UITextAttributeFont = new NSString("UITextAttributeFont");
/**
* Key to the text color in a text attributes dictionary. The corresponding value is an instance of UIColor.
*/
public static final NSString UITextAttributeTextColor = new NSString(
"UITextAttributeTextColor");
/**
* Key to the text shadow color in a text attributes dictionary. The corresponding value is an instance of UIColor.
*/
public static final NSString UITextAttributeTextShadowColor = new NSString(
"UITextAttributeTextShadowColor");
/**
* Key to the offset used for the text shadow in a text attributes dictionary. The corresponding value is an instance of NSValue
* wrapping a UIOffset struct.
*/
public static final NSString UITextAttributeTextShadowOffset = new NSString(
"UITextAttributeTextShadowOffset");
/**
* Creates an NSString from its binary representation.
*
* @param bytes The binary representation.
* @param encoding The encoding of the binary representation, the name of a supported charset.
* @throws UnsupportedEncodingException
* @see java.lang.String
*/
public NSString(byte[] bytes, String encoding) throws UnsupportedEncodingException {
setWrappedString(new String(bytes, encoding));
}
/**
* Gets this strings content.
*
* @return This NSString as Java String object.
*/
public String getContent() {
return getWrappedString();
}
/**
* Sets the contents of this string.
*
* @param c The new content of this string object.
*/
public void setContent(String c) {
setWrappedString(c);
}
/**
* Appends a string to this string.
*
* @param s The string to append.
*/
public void append(NSString s) {
append(s.getContent());
}
/**
* Appends a string to this string.
*
* @param s The string to append.
*/
public void append(String s) {
wrappedString += s;
}
/**
* Prepends a string to this string.
*
* @param s The string to prepend.
*/
public void prepend(String s) {
wrappedString = s + wrappedString;
}
/**
* Prepends a string to this string.
*
* @param s The string to prepend.
*/
public void prepend(NSString s) {
prepend(s.getContent());
}
private static CharsetEncoder asciiEncoder, utf16beEncoder, utf8Encoder;
@Override
public void toXML(StringBuilder xml, Integer level) {
toXML(xml, level.intValue());
}
@Override
public void toXML(StringBuilder xml, int level) {
indent(xml, level);
xml.append("<string>");
// Make sure that the string is encoded in UTF-8 for the XML output
synchronized (NSString.class) {
if (utf8Encoder == null)
utf8Encoder = Charset.forName("UTF-8").newEncoder();
else
utf8Encoder.reset();
try {
ByteBuffer byteBuf = utf8Encoder.encode(CharBuffer.wrap(wrappedString));
byte[] bytes = new byte[byteBuf.remaining()];
byteBuf.get(bytes);
wrappedString = new String(bytes, "UTF-8");
} catch (Exception ex) {
Log.d("Exception ",
"Message :" + ex.getMessage() + "\n Could not encode the NSString into UTF-8");
}
}
// According to http://www.w3.org/TR/REC-xml/#syntax node values must not
// contain the characters < or &. Also the > character should be escaped.
if (wrappedString.contains("&") || wrappedString.contains("<")
|| wrappedString.contains(">")) {
xml.append("<![CDATA[");
xml.append(wrappedString.replaceAll("]]>", "]]]]><![CDATA[>"));
xml.append("]]>");
} else {
xml.append(wrappedString);
}
xml.append("</string>");
}
@Override
public void toBinary(BinaryPropertyListWriter out) throws IOException {
CharBuffer charBuf = CharBuffer.wrap(wrappedString);
int kind;
ByteBuffer byteBuf;
synchronized (NSString.class) {
if (asciiEncoder == null)
asciiEncoder = Charset.forName("ASCII").newEncoder();
else
asciiEncoder.reset();
if (asciiEncoder.canEncode(charBuf)) {
kind = 0x5; // standard ASCII
byteBuf = asciiEncoder.encode(charBuf);
} else {
if (utf16beEncoder == null)
utf16beEncoder = Charset.forName("UTF-16BE").newEncoder();
else
utf16beEncoder.reset();
kind = 0x6; // UTF-16-BE
byteBuf = utf16beEncoder.encode(charBuf);
}
}
byte[] bytes = new byte[byteBuf.remaining()];
byteBuf.get(bytes);
out.writeIntHeader(kind, wrappedString.length());
out.write(bytes);
}
@Override
public void toASCII(StringBuilder ascii, int level) {
indent(ascii, level);
ascii.append("\"");
// According to
// https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/OldStylePlists/OldStylePLists.html
// non-ASCII characters are not escaped but simply written into the
// file, thus actually violating the ASCII plain text format.
// We will escape the string anyway because current Xcode project files (ASCII property lists) also escape their
// strings.
ascii.append(escapeStringForASCII(wrappedString));
ascii.append("\"");
}
@Override
public void toASCIIGnuStep(StringBuilder ascii, int level) {
indent(ascii, level);
ascii.append("\"");
ascii.append(escapeStringForASCII(wrappedString));
ascii.append("\"");
}
/**
* Escapes a string for use in ASCII property lists.
*
* @param s The unescaped string.
* @return The escaped string.
*/
static String escapeStringForASCII(String s) {
String out = "";
char[] cArray = s.toCharArray();
for (int i = 0; i < cArray.length; i++) {
char c = cArray[i];
if (c > 127) {
// non-ASCII Unicode
out += "\\U";
String hex = Integer.toHexString(c);
while (hex.length() < 4)
hex = "0" + hex;
out += hex;
} else if (c == '\\') {
out += "\\\\";
} else if (c == '\"') {
out += "\\\"";
} else if (c == '\b') {
out += "\\b";
} else if (c == '\n') {
out += "\\n";
} else if (c == '\r') {
out += "\\r";
} else if (c == '\t') {
out += "\\t";
} else {
out += c;
}
}
return out;
}
/**
* Options for aligning text horizontally. (Deprecated. Use “NSTextAlignment� instead.)
*/
public static enum UITextAlignment {
UITextAlignmentLeft, //
UITextAlignmentCenter, //
UITextAlignmentRight;
int value;
public int getValue() {
return this.ordinal();
}
}
@Override
public NSString retain() {
return this;
}
public NSString stringByAppendingPathComponent(NSString mString) {
if (mString != null) {
StringBuilder strBuilder = new StringBuilder(getWrappedString());
if (!mString.getWrappedString().endsWith("/") && (!"".equals(mString.getWrappedString())
|| "/".equals(mString.getWrappedString())))
return new NSString(strBuilder.append("/" + mString).toString());
}
return mString;
}
@Override
public void encodeWithCoder(NSCoder encoder) {
}
@Override
public NSCoding initWithCoder(NSCoder decoder) {
return null;
}
// Addressable Methods
public static final Adressable adressable = new Adressable() {
NSError[] outError;
@Override
public NSString stringWithContentsOfURLEncodingError(NSURL url, NSStringEncoding enc,
NSError error) {
outError = new NSError[] { error };
return stringWithContentsOfURLEncodingError(url, enc, error);
}
@Override
public NSError[] getStringWithContentsOfURLEncodingErrorArray() {
return outError;
}
};
/*
* public static CGSize sizeWithFontForWidthLineBreakMode(UIFont
* font, CGSize size, int lineBreakMode) { return new CGSize(); }
*/
/**
* Returns the size of the string if it were to be rendered with the specified font on a single line.
*
* @deprecated Deprecation Statement Use sizeWithAttributes: instead.
* @Declaration OBJECTIVE-C - (CGSize)sizeWithFont:(UIFont *)font
* @Parameters font The font to use for computing the string size.
* @return Return Value The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole
* number.
* @Discussion You can use this method to obtain the layout metrics you need to draw a string in your user interface. This method does
* not actually draw the string or alter the receiver’s text in any way.
*
* In iOS 6, this method wraps text using the NSLineBreakByWordWrapping option by default. In earlier versions of iOS, this
* method does not perform any line wrapping and returns the absolute width and height of the string using the specified
* font.
*/
/*
* @Deprecated
*
* public CGSize sizeWithFont(UIFont font) { Rect bounds = new Rect(); Paint paint = new
* Paint(); paint.setTextAlign(Align.LEFT); Typeface typeface = font.typeface; paint.setTypeface(typeface); float textSize =
* font.getWrappedTextSize(); paint.setTextSize(textSize); paint.getTextBounds(getWrappedString(), 0, getWrappedString().length(),
* bounds); return new CGSize(bounds.width(), bounds.height()); }
*/
/**
* Returns the size of the string if it were rendered and constrained to the specified size.
*
* @deprecated Deprecation Statement Use boundingRectWithSize:options:attributes:context: instead. See also UILabel as a possible
* alternative for some use cases.
* @Declaration OBJECTIVE-C - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size
* @Parameters font The font to use for computing the string size. size The maximum acceptable size for the string. This value is used
* to calculate where line breaks and wrapping would occur.
* @return Return Value The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole
* number.
* @Discussion You can use this method to obtain the layout metrics you need to draw a string in your user interface. This method does
* not actually draw the string or alter the receiver’s text in any way.
*
* This method computes the metrics needed to draw the specified string. This method lays out the receiver’s text and
* attempts to make it fit the specified size using the specified font and the NSLineBreakByWordWrapping line break option.
* During layout, the method may break the text onto multiple lines to make it fit better. If the receiver’s text does not
* completely fit in the specified size, it lays out as much of the text as possible and truncates it (for layout purposes
* only) according to the specified line break mode. It then returns the size of the resulting truncated string. If the
* height specified in the size parameter is less than a single line of text, this method may return a height value that is
* bigger than the one specified.
*/
/*
* @Deprecated
*
* public CGSize sizeWithFontConstrainedToSize(UIFont font, CGSize size) { Rect bounds = new
* Rect();
*
* Paint paint = new Paint(); paint.setTextAlign(Align.LEFT); Typeface typeface = font.typeface; paint.setTypeface(typeface); float
* textSize = font.getWrappedTextSize(); paint.setTextSize(textSize); paint.getTextBounds(getWrappedString(), 0,
* getWrappedString().length(), bounds); float h = size.height(); float w = size.width(); if (size.width() > bounds.width()) { w =
* bounds.width(); } if (size.height() > bounds.height()) { h = bounds.height(); } return new CGSize(w, h); }
*/
/**
* Returns the size of the string if it were rendered with the specified constraints.
*
* @deprecated Deprecation Statement Use boundingRectWithSize:options:attributes:context: instead.
* @Declaration OBJECTIVE-C - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size
* lineBreakMode:(NSLineBreakMode)lineBreakMode
* @Parameters font The font to use for computing the string size.<br>
* size The maximum acceptable size for the string. This value is used to calculate where line breaks and wrapping would
* occur.<br>
* lineBreakMode The line break options for computing the size of the string. For a list of possible values, see
* NSLineBreakMode.<br>
* @return Return Value The width and height of the resulting string’s bounding box. These values may be rounded up to the nearest whole
* number.
* @Discussion You can use this method to obtain the layout metrics you need to draw a string in your user interface. This method does
* not actually draw the string or alter the receiver’s text in any way.
*
* This method computes the metrics needed to draw the specified string. This method lays out the receiver’s text and
* attempts to make it fit the specified size using the specified font and line break options. During layout, the method may
* break the text onto multiple lines to make it fit better. If the receiver’s text does not completely fit in the specified
* size, it lays out as much of the text as possible and truncates it (for layout purposes only) according to the specified
* line break mode. It then returns the size of the resulting truncated string. If the height specified in the size
* parameter is less than a single line of text, this method may return a height value that is bigger than the one
* specified.
*/
/*
* @Deprecated
*
* public CGSize sizeWithFontConstrainedToSizeLineBreakMode(UIFont
* font, CGSize size, NSLineBreakMode lineBreakMode) { // By default android takes lines breaks in the measure return
* sizeWithFontConstrainedToSize(font, size); }
*/
/**
* Draws the string in a single line at the specified point in the current graphics context using the specified font.
*
* @deprecated Deprecation Statement Use drawAtPoint:withAttributes: instead.
* @Declaration OBJECTIVE-C - (CGSize)drawAtPoint:(CGPoint)point withFont:(UIFont *)font
* @Parameters point The location (in the coordinate system of the current graphics context) at which to draw the string. This point
* represents the top-left corner of the string’s bounding box. font The font to use for rendering.
* @return Return Value The size of the rendered string. The returned values may be rounded up to the nearest whole number.
* @Discussion This method draws only a single line of text, drawing as much of the string as possible using the given font. This method
* does not perform any line wrapping during drawing.
*/
/*
* @Deprecated
*
* public CGSize drawAtPointWithFont(CGPoint point, UIFont font) { Paint paint = new
* Paint(); paint.setTextAlign(Align.LEFT); View view =
* GenericMainContext.sharedContext.getWindow().getDecorView().findViewById(android.R.id.content); Canvas canvas = new Canvas();
* canvas.drawText(getWrappedString(), point.getX(), point.getY(), paint); return sizeWithFont(font); }
*/
// Depricated UIKit Additions
/**
* @Signature: boundingRectWithSize:options:context:
* @Declaration : - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options context:(NSStringDrawingContext
* *)context
* @Description : Returns the bounding rectangle required to draw the string.
* @Discussion You can use this method to compute the space required to draw the string. The constraints you specify in the size
* parameter are a guide for the renderer for how to size the string. However, the actual bounding rectangle returned by
* this method can be larger than the constraints if additional space is needed to render the entire string. Typically, the
* renderer preserves the width constraint and adjusts the height constraint as needed. In iOS 7 and later, this method
* returns fractional sizes (in the size component of the returned CGRect); to use a returned size to size views, you must
* use raise its value to the nearest higher integer using the ceil function.
**/
public CGRect boundingRectWithSizeOptionsContext(CGSize size, NSStringDrawingOptions options,
NSStringDrawingContext context) {
return null;
}
/**
* @Signature: drawAtPoint:
* @Declaration : - (void)drawAtPoint:(CGPoint)point
* @Description : Draws the attributed string starting at the specified point in the current graphics context.
* @Discussion This method draws the entire string starting at the specified point. This method draws the line using the attributes
* specified in the attributed string itself. If newline characters are present in the string, those characters are honored
* and cause subsequent text to be placed on the next line underneath the starting point.
**/
public void drawAtPoint(CGPoint point) {
}
/**
* @Signature: drawInRect:
* @Declaration : - (void)drawInRect:(CGRect)rect
* @Description : Draws the attributed string inside the specified bounding rectangle in the current graphics context.
* @Discussion This method draws as much of the string as it can inside the specified rectangle, wrapping the string text as needed to
* make it fit. If the string is too long to fit inside the rectangle, the method renders as much as possible and clips the
* rest. This method draws the line using the attributes specified in the attributed string itself. If newline characters
* are present in the string, those characters are honored and cause subsequent text to be placed on the next line
* underneath the starting point.
**/
public void drawInRect(CGRect rect) {
}
/**
* @Signature: drawWithRect:options:context:
* @Declaration : - (void)drawWithRect:(CGRect)rect options:(NSStringDrawingOptions)options context:(NSStringDrawingContext *)context
* @Description : Draws the attributed string in the specified bounding rectangle using the provided options.
* @Discussion This method draws as much of the string as it can inside the specified rectangle. If
* NSStringDrawingUsesLineFragmentOrigin is specified in options, it wraps the string text as needed to make it fit. If the
* string is too big to fit completely inside the rectangle, the method scales the font or adjusts the letter spacing to
* make the string fit within the given bounds. This method draws the line using the attributes specified in the attributed
* string itself. If newline characters are present in the string, those characters are honored and cause subsequent text to
* be placed on the next line underneath the starting point.
**/
public void drawWithRectOptionsContext(CGRect rect, NSStringDrawingOptions options,
NSStringDrawingContext context) {
}
/**
* @Signature: size
* @Declaration : - (CGSize)size
* @Description : Returns the size required to draw the string.
* @Discussion You can use this method prior to drawing to compute how much space is required to draw the string. In iOS 7 and later,
* this method returns fractional sizes; to use a returned size to size views, you must use raise its value to the nearest
* higher integer using the ceil function.
**/
public CGSize size() {
return null;
}
// UIKit Addition
// 1
/**
* @Signature: boundingRectWithSize:options:attributes:context:
* @Declaration : - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary
* *)attributes context:(NSStringDrawingContext *)context
* @Description : Calculates and returns the bounding rect for the receiver drawn using the given options and display characteristics,
* within the specified rectangle in the current graphics context.
* @Discussion To correctly draw and size multi-line text, pass NSStringDrawingUsesLineFragmentOrigin in the options parameter. This
* method returns fractional sizes (in the size component of the returned CGRect); to use a returned size to size views, you
* must raise its value to the nearest higher integer using the ceil function.
**/
public CGRect boundingRectWithSizeOptionsAttributesContext(CGSize size,
NSStringDrawingOptions options, NSDictionary attributes,
NSStringDrawingContext context) {
return null;
}
// 2
/**
* @Signature: drawAtPoint:withAttributes:
* @Declaration : - (void)drawAtPoint:(CGPoint)point withAttributes:(NSDictionary *)attrs
* @Description : Draws the receiver with the font and other display characteristics of the given attributes, at the specified point in
* the current graphics context.
* @Discussion The width (height for vertical layout) of the rendering area is unlimited, unlike drawInRect:withAttributes:, which uses
* a bounding rectangle. As a result, this method renders the text in a single line. However, if newline characters are
* present in the string, those characters are honored and cause subsequent text to be placed on the next line underneath
* the starting point.
**/
public void drawAtPointWithAttributes(CGPoint point, NSDictionary attrs) {
}
// 3
/**
* @Signature: drawInRect:withAttributes:
* @Declaration : - (void)drawInRect:(CGRect)rect withAttributes:(NSDictionary *)attrs
* @Description : Draws the attributed string inside the specified bounding rectangle in the current graphics context.
* @Discussion This method draws as much of the string as it can inside the specified rectangle, wrapping the string text as needed to
* make it fit. If the string is too long to fit inside the rectangle, the method renders as much as possible and clips the
* rest. If newline characters are present in the string, those characters are honored and cause subsequent text to be
* placed on the next line underneath the starting point.
**/
public void drawInRectWithAttributes(CGRect rect, NSDictionary attrs) {
}
// 4
/**
* @Signature: drawWithRect:options:attributes:context:
* @Declaration : - (void)drawWithRect:(CGRect)rect options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes
* context:(NSStringDrawingContext *)context
* @Description : Draws the attributed string in the specified bounding rectangle using the provided options.
* @Discussion This method draws as much of the string as it can inside the specified rectangle, wrapping the string text as needed to
* make it fit. If the string is too big to fit completely inside the rectangle, the method scales the font or adjusts the
* letter spacing to make the string fit within the given bounds. If newline characters are present in the string, those
* characters are honored and cause subsequent text to be placed on the next line underneath the starting point. To
* correctly draw and size multi-line text, pass NSStringDrawingUsesLineFragmentOrigin in the options parameter.
**/
public void drawWithRectOptionsAttributesContext(CGRect rect, NSStringDrawingOptions options,
NSDictionary attributes, NSStringDrawingContext context) {
}
// 5
/**
* @Signature: sizeWithAttributes:
* @Declaration : - (CGSize)sizeWithAttributes:(NSDictionary *)attrs
* @Description : Returns the bounding box size the receiver occupies when drawn with the given attributes.
* @Discussion This method returns fractional sizes; to use a returned size to size views, you must raise its value to the nearest
* higher integer using the ceil function.
**/
public CGSize sizeWithAttributes(NSDictionary attrs) {
return null;
}
public boolean containsString(NSString aString) {
if (aString != null && aString.getWrappedString() != null) {
if (this.getWrappedString() != null) {
return this.getWrappedString().contains(aString.getWrappedString());
}
}
return false;
}
} | 238,008 | 0.710957 | 0.709003 | 4,576 | 49.670891 | 46.523247 | 180 | false | false | 0 | 0 | 0 | 0 | 74 | 0.000584 | 2.018357 | false | false | 13 |
d78b239edf50699295869615f6eeda56a16419dd | 27,367,531,679,730 | 01516cee0414eb9258e95aa800ca9c80209345cb | /app/src/main/java/com/zhongchuang/canting/easeui/widget/ChatRowRedPacketAck.java | e383ead92a5c4f454331c573ab2143e24605490e | [] | no_license | P79N6A/CantingGit | https://github.com/P79N6A/CantingGit | ecb01e086e50b731501b583d398b7fa4067fbd42 | aa7dc4891f43d974f71239bfd9816efd91302de7 | refs/heads/master | 2020-04-27T12:07:58.499000 | 2019-03-07T10:15:40 | 2019-03-07T10:15:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zhongchuang.canting.easeui.widget;
import android.content.Context;
import android.text.Html;
import android.text.Spanned;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMMessage;
import com.zhongchuang.canting.R;;
import com.zhongchuang.canting.easeui.EaseConstant;
import com.zhongchuang.canting.easeui.widget.chatrow.EaseChatRow;
public class ChatRowRedPacketAck extends EaseChatRow {
private TextView mTvMessage;
public ChatRowRedPacketAck(Context context, EMMessage message, int position, BaseAdapter adapter) {
super(context, message, position, adapter);
}
@Override
protected void onInflateView() {
if (message.getBooleanAttribute(EaseConstant.EXTRA_RED, false)) {
inflater.inflate(message.direct() == EMMessage.Direct.RECEIVE ?
R.layout.em_row_red_packet_ack_message : R.layout.em_row_red_packet_ack_message, this);
}
}
@Override
protected void onFindViewById() {
mTvMessage = (TextView) findViewById(R.id.ease_tv_money_msg);
}
@Override
protected void onSetUpView() {
String currentUser = EMClient.getInstance().getCurrentUser();
String fromUser = message.getStringAttribute(EaseConstant.EXTRA_SEND, "");//红包发送者
String toUser = message.getStringAttribute(EaseConstant.EXTRA_NAME, "");//红包接收者
String sendId = message.getStringAttribute(EaseConstant.EXTRA_USER_ID, "");//发红包人的id
String senderId = message.getStringAttribute(EaseConstant.EXTRA_GRAPID, "");//抢红包id
String type=message.getStringAttribute(EaseConstant.EXTRA_RED_TYPE,null);
int isAll=message.getIntAttribute(EaseConstant.EXTRA_RED_IS_ALL,0);
if (!(message.direct() == EMMessage.Direct.SEND)) {
if (message.getChatType().equals(EMMessage.ChatType.GroupChat)) {
if (!sendId.equals(currentUser)) {
if(type.equals("1")){
String str1="";
String str2="";
str1=toUser+"领取了"+fromUser+"的";
str2=","+fromUser+"的红包已被领完。";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>"+str2;
mTvMessage.setText( Html.fromHtml(content));
}else {
String str1="";
str1=toUser+"领取了"+fromUser+"的";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
} else {
if(type.equals("1")){
String str1="";
String str2="";
str1=toUser+"领取了你的";
str2=",你的红包已被领完。";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>"+str2;
mTvMessage.setText( Html.fromHtml(content));
}else {
String str1="";
str1=toUser+"领取了你的";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
}
} else {
String str1="";
str1=toUser+"领取了你的";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
} else {
if(type.equals("1")){
String str1="";
String str2="";
str1="你领取了"+fromUser;
str2=","+fromUser+"的红包已被领完。";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>"+str2;
mTvMessage.setText( Html.fromHtml(content));
}else {
String str1="";
String str2="";
str1="你领取了"+fromUser;
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
}
}
@Override
protected void onUpdateView() {
}
@Override
protected void onBubbleClick() {
}
}
| UTF-8 | Java | 4,647 | java | ChatRowRedPacketAck.java | Java | [] | null | [] | package com.zhongchuang.canting.easeui.widget;
import android.content.Context;
import android.text.Html;
import android.text.Spanned;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMMessage;
import com.zhongchuang.canting.R;;
import com.zhongchuang.canting.easeui.EaseConstant;
import com.zhongchuang.canting.easeui.widget.chatrow.EaseChatRow;
public class ChatRowRedPacketAck extends EaseChatRow {
private TextView mTvMessage;
public ChatRowRedPacketAck(Context context, EMMessage message, int position, BaseAdapter adapter) {
super(context, message, position, adapter);
}
@Override
protected void onInflateView() {
if (message.getBooleanAttribute(EaseConstant.EXTRA_RED, false)) {
inflater.inflate(message.direct() == EMMessage.Direct.RECEIVE ?
R.layout.em_row_red_packet_ack_message : R.layout.em_row_red_packet_ack_message, this);
}
}
@Override
protected void onFindViewById() {
mTvMessage = (TextView) findViewById(R.id.ease_tv_money_msg);
}
@Override
protected void onSetUpView() {
String currentUser = EMClient.getInstance().getCurrentUser();
String fromUser = message.getStringAttribute(EaseConstant.EXTRA_SEND, "");//红包发送者
String toUser = message.getStringAttribute(EaseConstant.EXTRA_NAME, "");//红包接收者
String sendId = message.getStringAttribute(EaseConstant.EXTRA_USER_ID, "");//发红包人的id
String senderId = message.getStringAttribute(EaseConstant.EXTRA_GRAPID, "");//抢红包id
String type=message.getStringAttribute(EaseConstant.EXTRA_RED_TYPE,null);
int isAll=message.getIntAttribute(EaseConstant.EXTRA_RED_IS_ALL,0);
if (!(message.direct() == EMMessage.Direct.SEND)) {
if (message.getChatType().equals(EMMessage.ChatType.GroupChat)) {
if (!sendId.equals(currentUser)) {
if(type.equals("1")){
String str1="";
String str2="";
str1=toUser+"领取了"+fromUser+"的";
str2=","+fromUser+"的红包已被领完。";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>"+str2;
mTvMessage.setText( Html.fromHtml(content));
}else {
String str1="";
str1=toUser+"领取了"+fromUser+"的";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
} else {
if(type.equals("1")){
String str1="";
String str2="";
str1=toUser+"领取了你的";
str2=",你的红包已被领完。";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>"+str2;
mTvMessage.setText( Html.fromHtml(content));
}else {
String str1="";
str1=toUser+"领取了你的";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
}
} else {
String str1="";
str1=toUser+"领取了你的";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
} else {
if(type.equals("1")){
String str1="";
String str2="";
str1="你领取了"+fromUser;
str2=","+fromUser+"的红包已被领完。";
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>"+str2;
mTvMessage.setText( Html.fromHtml(content));
}else {
String str1="";
String str2="";
str1="你领取了"+fromUser;
String content=str1+"<font color=\"#F9A33C\">" + "红包" + "</font>";
mTvMessage.setText( Html.fromHtml(content));
}
}
}
@Override
protected void onUpdateView() {
}
@Override
protected void onBubbleClick() {
}
}
| 4,647 | 0.526304 | 0.513768 | 122 | 35.614754 | 29.997389 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.598361 | false | false | 13 |
aab3f66434dcd3bf0079d2ff35d7af8ca7235e3b | 19,559,281,075,222 | 07531940f9a5cca97b40bfe5c44ba21b64fcc717 | /app/src/main/java/com/sd/heinhtetoo/mytestapp/data/Model/EventModel.java | b49b9ca51c575bf0cf6f42d95ecd50ff4959014e | [] | no_license | heinhtetoo/uniEvent | https://github.com/heinhtetoo/uniEvent | ae7ea899cfb8f3ff049d5816249346c84e539355 | aca924f9bb5a56dceb2a085f34de33c70ab27b36 | refs/heads/master | 2021-01-18T22:14:19.073000 | 2016-11-22T06:26:35 | 2016-11-22T06:26:35 | 73,670,314 | 0 | 0 | null | false | 2016-11-21T08:21:21 | 2016-11-14T05:35:51 | 2016-11-14T05:41:28 | 2016-11-21T08:21:21 | 106 | 0 | 0 | 0 | Java | null | null | package com.sd.heinhtetoo.mytestapp.data.Model;
import com.sd.heinhtetoo.mytestapp.data.Event;
import java.util.ArrayList;
/**
* Created by HeinHtetOo on 14/11/2016.
*/
public interface EventModel {
void saveEvent(Event e);
ArrayList<Event> getEvent();
void getEvent(EventModelImpl.Callback c);
}
| UTF-8 | Java | 317 | java | EventModel.java | Java | [
{
"context": "t;\n\nimport java.util.ArrayList;\n\n/**\n * Created by HeinHtetOo on 14/11/2016.\n */\n\npublic interface EventModel {",
"end": 154,
"score": 0.9779520034790039,
"start": 144,
"tag": "USERNAME",
"value": "HeinHtetOo"
}
] | null | [] | package com.sd.heinhtetoo.mytestapp.data.Model;
import com.sd.heinhtetoo.mytestapp.data.Event;
import java.util.ArrayList;
/**
* Created by HeinHtetOo on 14/11/2016.
*/
public interface EventModel {
void saveEvent(Event e);
ArrayList<Event> getEvent();
void getEvent(EventModelImpl.Callback c);
}
| 317 | 0.731861 | 0.706625 | 17 | 17.647058 | 18.745796 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 13 |
89ec425d2d3554e931cb6ba09e311ae63b165c4e | 28,492,813,063,339 | efb5eb14065b0f014de150aeca06c31692c740fb | /sistemas-relacionados/tengyifei-dcpabe-web/jpbc/it/unisa/dia/gas/plaf/jpbc/field/gt/GTFiniteField.java | 5784ed4949da19d0d6cacbd4593bfa691dde3d12 | [
"MIT"
] | permissive | brunoarruda/PGC | https://github.com/brunoarruda/PGC | 29c520f10a90c0f38d83e01a18714aa5e0c0ddbc | 7e9f5f1620aa6c0e9a407ac42f8092c052e5f045 | refs/heads/master | 2021-06-22T05:32:03.291000 | 2021-01-03T23:14:48 | 2021-01-03T23:14:48 | 174,251,658 | 3 | 0 | MIT | false | 2019-08-26T21:06:01 | 2019-03-07T01:50:57 | 2019-08-23T01:45:59 | 2019-08-26T21:05:59 | 2,285 | 1 | 0 | 8 | Java | false | false | package it.unisa.dia.gas.plaf.jpbc.field.gt;
import it.unisa.dia.gas.jpbc.Field;
import it.unisa.dia.gas.plaf.jpbc.field.base.AbstractFieldOver;
import it.unisa.dia.gas.plaf.jpbc.pairing.map.PairingMap;
import java.math.BigInteger;
import java.util.Random;
/**
* @author Angelo De Caro (angelo.decaro@gmail.com)
*/
public class GTFiniteField<F extends Field> extends AbstractFieldOver<F, GTFiniteElement> {
/**
*
*/
private static final long serialVersionUID = -8768043945049752326L;
protected PairingMap pairing;
protected BigInteger order;
public GTFiniteField(){}
public GTFiniteField(Random random, BigInteger order, PairingMap pairing, Field targetField) {
super(random, (F) targetField);
this.order = order;
this.pairing = pairing;
}
public GTFiniteElement newElement() {
return new GTFiniteElement(pairing, this);
}
public BigInteger getOrder() {
return order;
}
public GTFiniteElement getNqr() {
throw new IllegalStateException("Not Implemented yet!!!");
}
public int getLengthInBytes() {
return getTargetField().getLengthInBytes();
}
}
| UTF-8 | Java | 1,182 | java | GTFiniteField.java | Java | [
{
"context": "gInteger;\nimport java.util.Random;\n\n/**\n * @author Angelo De Caro (angelo.decaro@gmail.com)\n */\npublic class GTFini",
"end": 289,
"score": 0.9998844265937805,
"start": 275,
"tag": "NAME",
"value": "Angelo De Caro"
},
{
"context": "java.util.Random;\n\n/**\n * @aut... | null | [] | package it.unisa.dia.gas.plaf.jpbc.field.gt;
import it.unisa.dia.gas.jpbc.Field;
import it.unisa.dia.gas.plaf.jpbc.field.base.AbstractFieldOver;
import it.unisa.dia.gas.plaf.jpbc.pairing.map.PairingMap;
import java.math.BigInteger;
import java.util.Random;
/**
* @author <NAME> (<EMAIL>)
*/
public class GTFiniteField<F extends Field> extends AbstractFieldOver<F, GTFiniteElement> {
/**
*
*/
private static final long serialVersionUID = -8768043945049752326L;
protected PairingMap pairing;
protected BigInteger order;
public GTFiniteField(){}
public GTFiniteField(Random random, BigInteger order, PairingMap pairing, Field targetField) {
super(random, (F) targetField);
this.order = order;
this.pairing = pairing;
}
public GTFiniteElement newElement() {
return new GTFiniteElement(pairing, this);
}
public BigInteger getOrder() {
return order;
}
public GTFiniteElement getNqr() {
throw new IllegalStateException("Not Implemented yet!!!");
}
public int getLengthInBytes() {
return getTargetField().getLengthInBytes();
}
}
| 1,158 | 0.692047 | 0.675973 | 47 | 24.148935 | 25.633238 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553191 | false | false | 13 |
c96c67d2df5cf95e5380d38a88a612ffee9f0901 | 13,838,384,651,855 | 6ef4869c6bc2ce2e77b422242e347819f6a5f665 | /devices/google/Pixel 2/29/QPP6.190730.005/src/framework/android/content/pm/IPackageManager.java | 933b6828c88e8d81dbe83b51998cb18f1522f938 | [] | no_license | hacking-android/frameworks | https://github.com/hacking-android/frameworks | 40e40396bb2edacccabf8a920fa5722b021fb060 | 943f0b4d46f72532a419fb6171e40d1c93984c8e | refs/heads/master | 2020-07-03T19:32:28.876000 | 2019-08-13T03:31:06 | 2019-08-13T03:31:06 | 202,017,534 | 2 | 0 | null | false | 2019-08-13T03:33:19 | 2019-08-12T22:19:30 | 2019-08-13T03:31:53 | 2019-08-13T03:33:18 | 63,898 | 0 | 0 | 0 | Java | false | false | /*
* Decompiled with CFR 0.145.
*/
package android.content.pm;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ChangedPackages;
import android.content.pm.IDexModuleRegisterCallback;
import android.content.pm.IOnPermissionsChangeListener;
import android.content.pm.IPackageDataObserver;
import android.content.pm.IPackageDeleteObserver;
import android.content.pm.IPackageDeleteObserver2;
import android.content.pm.IPackageInstaller;
import android.content.pm.IPackageMoveObserver;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.InstrumentationInfo;
import android.content.pm.KeySet;
import android.content.pm.ModuleInfo;
import android.content.pm.PackageInfo;
import android.content.pm.ParceledListSlice;
import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.pm.SuspendDialogInfo;
import android.content.pm.VerifierDeviceIdentity;
import android.content.pm.VersionedPackage;
import android.content.pm.dex.IArtManager;
import android.graphics.Bitmap;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.List;
public interface IPackageManager
extends IInterface {
public boolean activitySupportsIntent(ComponentName var1, Intent var2, String var3) throws RemoteException;
public void addCrossProfileIntentFilter(IntentFilter var1, String var2, int var3, int var4, int var5) throws RemoteException;
public void addOnPermissionsChangeListener(IOnPermissionsChangeListener var1) throws RemoteException;
@UnsupportedAppUsage
public boolean addPermission(PermissionInfo var1) throws RemoteException;
@UnsupportedAppUsage
public boolean addPermissionAsync(PermissionInfo var1) throws RemoteException;
public void addPersistentPreferredActivity(IntentFilter var1, ComponentName var2, int var3) throws RemoteException;
public void addPreferredActivity(IntentFilter var1, int var2, ComponentName[] var3, ComponentName var4, int var5) throws RemoteException;
public boolean addWhitelistedRestrictedPermission(String var1, String var2, int var3, int var4) throws RemoteException;
public boolean canForwardTo(Intent var1, String var2, int var3, int var4) throws RemoteException;
public boolean canRequestPackageInstalls(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public String[] canonicalToCurrentPackageNames(String[] var1) throws RemoteException;
public void checkPackageStartable(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public int checkPermission(String var1, String var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public int checkSignatures(String var1, String var2) throws RemoteException;
public int checkUidPermission(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public int checkUidSignatures(int var1, int var2) throws RemoteException;
public void clearApplicationProfileData(String var1) throws RemoteException;
public void clearApplicationUserData(String var1, IPackageDataObserver var2, int var3) throws RemoteException;
public void clearCrossProfileIntentFilters(int var1, String var2) throws RemoteException;
public void clearPackagePersistentPreferredActivities(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public void clearPackagePreferredActivities(String var1) throws RemoteException;
public boolean compileLayouts(String var1) throws RemoteException;
@UnsupportedAppUsage
public String[] currentToCanonicalPackageNames(String[] var1) throws RemoteException;
@UnsupportedAppUsage
public void deleteApplicationCacheFiles(String var1, IPackageDataObserver var2) throws RemoteException;
public void deleteApplicationCacheFilesAsUser(String var1, int var2, IPackageDataObserver var3) throws RemoteException;
public void deletePackageAsUser(String var1, int var2, IPackageDeleteObserver var3, int var4, int var5) throws RemoteException;
public void deletePackageVersioned(VersionedPackage var1, IPackageDeleteObserver2 var2, int var3, int var4) throws RemoteException;
public void deletePreloadsFileCache() throws RemoteException;
public void dumpProfiles(String var1) throws RemoteException;
public void enterSafeMode() throws RemoteException;
public void extendVerificationTimeout(int var1, int var2, long var3) throws RemoteException;
public ResolveInfo findPersistentPreferredActivity(Intent var1, int var2) throws RemoteException;
public void finishPackageInstall(int var1, boolean var2) throws RemoteException;
public void flushPackageRestrictionsAsUser(int var1) throws RemoteException;
public void forceDexOpt(String var1) throws RemoteException;
public void freeStorage(String var1, long var2, int var4, IntentSender var5) throws RemoteException;
public void freeStorageAndNotify(String var1, long var2, int var4, IPackageDataObserver var5) throws RemoteException;
@UnsupportedAppUsage
public ActivityInfo getActivityInfo(ComponentName var1, int var2, int var3) throws RemoteException;
public ParceledListSlice getAllIntentFilters(String var1) throws RemoteException;
public List<String> getAllPackages() throws RemoteException;
public ParceledListSlice getAllPermissionGroups(int var1) throws RemoteException;
@UnsupportedAppUsage
public String[] getAppOpPermissionPackages(String var1) throws RemoteException;
public String getAppPredictionServicePackageName() throws RemoteException;
@UnsupportedAppUsage
public int getApplicationEnabledSetting(String var1, int var2) throws RemoteException;
public boolean getApplicationHiddenSettingAsUser(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ApplicationInfo getApplicationInfo(String var1, int var2, int var3) throws RemoteException;
public IArtManager getArtManager() throws RemoteException;
public String getAttentionServicePackageName() throws RemoteException;
@UnsupportedAppUsage
public boolean getBlockUninstallForUser(String var1, int var2) throws RemoteException;
public ChangedPackages getChangedPackages(int var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public int getComponentEnabledSetting(ComponentName var1, int var2) throws RemoteException;
public ParceledListSlice getDeclaredSharedLibraries(String var1, int var2, int var3) throws RemoteException;
public byte[] getDefaultAppsBackup(int var1) throws RemoteException;
public String getDefaultBrowserPackageName(int var1) throws RemoteException;
@UnsupportedAppUsage
public int getFlagsForUid(int var1) throws RemoteException;
public CharSequence getHarmfulAppWarning(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ComponentName getHomeActivities(List<ResolveInfo> var1) throws RemoteException;
public String getIncidentReportApproverPackageName() throws RemoteException;
@UnsupportedAppUsage
public int getInstallLocation() throws RemoteException;
public int getInstallReason(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice getInstalledApplications(int var1, int var2) throws RemoteException;
public List<ModuleInfo> getInstalledModules(int var1) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice getInstalledPackages(int var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public String getInstallerPackageName(String var1) throws RemoteException;
public String getInstantAppAndroidId(String var1, int var2) throws RemoteException;
public byte[] getInstantAppCookie(String var1, int var2) throws RemoteException;
public Bitmap getInstantAppIcon(String var1, int var2) throws RemoteException;
public ComponentName getInstantAppInstallerComponent() throws RemoteException;
public ComponentName getInstantAppResolverComponent() throws RemoteException;
public ComponentName getInstantAppResolverSettingsComponent() throws RemoteException;
public ParceledListSlice getInstantApps(int var1) throws RemoteException;
@UnsupportedAppUsage
public InstrumentationInfo getInstrumentationInfo(ComponentName var1, int var2) throws RemoteException;
public byte[] getIntentFilterVerificationBackup(int var1) throws RemoteException;
public ParceledListSlice getIntentFilterVerifications(String var1) throws RemoteException;
public int getIntentVerificationStatus(String var1, int var2) throws RemoteException;
public KeySet getKeySetByAlias(String var1, String var2) throws RemoteException;
@UnsupportedAppUsage
public ResolveInfo getLastChosenActivity(Intent var1, String var2, int var3) throws RemoteException;
public ModuleInfo getModuleInfo(String var1, int var2) throws RemoteException;
public int getMoveStatus(int var1) throws RemoteException;
@UnsupportedAppUsage
public String getNameForUid(int var1) throws RemoteException;
public String[] getNamesForUids(int[] var1) throws RemoteException;
public int[] getPackageGids(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public PackageInfo getPackageInfo(String var1, int var2, int var3) throws RemoteException;
public PackageInfo getPackageInfoVersioned(VersionedPackage var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public IPackageInstaller getPackageInstaller() throws RemoteException;
public void getPackageSizeInfo(String var1, int var2, IPackageStatsObserver var3) throws RemoteException;
@UnsupportedAppUsage
public int getPackageUid(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String[] getPackagesForUid(int var1) throws RemoteException;
public ParceledListSlice getPackagesHoldingPermissions(String[] var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String getPermissionControllerPackageName() throws RemoteException;
public int getPermissionFlags(String var1, String var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public PermissionGroupInfo getPermissionGroupInfo(String var1, int var2) throws RemoteException;
public PermissionInfo getPermissionInfo(String var1, String var2, int var3) throws RemoteException;
public ParceledListSlice getPersistentApplications(int var1) throws RemoteException;
@UnsupportedAppUsage
public int getPreferredActivities(List<IntentFilter> var1, List<ComponentName> var2, String var3) throws RemoteException;
public byte[] getPreferredActivityBackup(int var1) throws RemoteException;
public int getPrivateFlagsForUid(int var1) throws RemoteException;
@UnsupportedAppUsage
public ProviderInfo getProviderInfo(ComponentName var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public ActivityInfo getReceiverInfo(ComponentName var1, int var2, int var3) throws RemoteException;
public int getRuntimePermissionsVersion(int var1) throws RemoteException;
@UnsupportedAppUsage
public ServiceInfo getServiceInfo(ComponentName var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String getServicesSystemSharedLibraryPackageName() throws RemoteException;
public ParceledListSlice getSharedLibraries(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String getSharedSystemSharedLibraryPackageName() throws RemoteException;
public KeySet getSigningKeySet(String var1) throws RemoteException;
public PersistableBundle getSuspendedPackageAppExtras(String var1, int var2) throws RemoteException;
public ParceledListSlice getSystemAvailableFeatures() throws RemoteException;
public String getSystemCaptionsServicePackageName() throws RemoteException;
@UnsupportedAppUsage
public String[] getSystemSharedLibraryNames() throws RemoteException;
public String getSystemTextClassifierPackageName() throws RemoteException;
@UnsupportedAppUsage
public int getUidForSharedUser(String var1) throws RemoteException;
public String[] getUnsuspendablePackagesForUser(String[] var1, int var2) throws RemoteException;
public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException;
public String getWellbeingPackageName() throws RemoteException;
public List<String> getWhitelistedRestrictedPermissions(String var1, int var2, int var3) throws RemoteException;
public void grantDefaultPermissionsToActiveLuiApp(String var1, int var2) throws RemoteException;
public void grantDefaultPermissionsToEnabledCarrierApps(String[] var1, int var2) throws RemoteException;
public void grantDefaultPermissionsToEnabledImsServices(String[] var1, int var2) throws RemoteException;
public void grantDefaultPermissionsToEnabledTelephonyDataServices(String[] var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public void grantRuntimePermission(String var1, String var2, int var3) throws RemoteException;
public boolean hasSigningCertificate(String var1, byte[] var2, int var3) throws RemoteException;
public boolean hasSystemFeature(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public boolean hasSystemUidErrors() throws RemoteException;
public boolean hasUidSigningCertificate(int var1, byte[] var2, int var3) throws RemoteException;
public int installExistingPackageAsUser(String var1, int var2, int var3, int var4, List<String> var5) throws RemoteException;
public boolean isDeviceUpgrading() throws RemoteException;
public boolean isFirstBoot() throws RemoteException;
public boolean isInstantApp(String var1, int var2) throws RemoteException;
public boolean isOnlyCoreApps() throws RemoteException;
@UnsupportedAppUsage
public boolean isPackageAvailable(String var1, int var2) throws RemoteException;
public boolean isPackageDeviceAdminOnAnyUser(String var1) throws RemoteException;
public boolean isPackageSignedByKeySet(String var1, KeySet var2) throws RemoteException;
public boolean isPackageSignedByKeySetExactly(String var1, KeySet var2) throws RemoteException;
public boolean isPackageStateProtected(String var1, int var2) throws RemoteException;
public boolean isPackageSuspendedForUser(String var1, int var2) throws RemoteException;
public boolean isPermissionEnforced(String var1) throws RemoteException;
public boolean isPermissionRevokedByPolicy(String var1, String var2, int var3) throws RemoteException;
public boolean isProtectedBroadcast(String var1) throws RemoteException;
@UnsupportedAppUsage
public boolean isSafeMode() throws RemoteException;
@UnsupportedAppUsage
public boolean isStorageLow() throws RemoteException;
@UnsupportedAppUsage
public boolean isUidPrivileged(int var1) throws RemoteException;
public void logAppProcessStartIfNeeded(String var1, int var2, String var3, String var4, int var5) throws RemoteException;
public int movePackage(String var1, String var2) throws RemoteException;
public int movePrimaryStorage(String var1) throws RemoteException;
public void notifyDexLoad(String var1, List<String> var2, List<String> var3, String var4) throws RemoteException;
public void notifyPackageUse(String var1, int var2) throws RemoteException;
public void notifyPackagesReplacedReceived(String[] var1) throws RemoteException;
public boolean performDexOptMode(String var1, boolean var2, String var3, boolean var4, boolean var5, String var6) throws RemoteException;
public boolean performDexOptSecondary(String var1, String var2, boolean var3) throws RemoteException;
public void performFstrimIfNeeded() throws RemoteException;
public ParceledListSlice queryContentProviders(String var1, int var2, int var3, String var4) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice queryInstrumentation(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice queryIntentActivities(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryIntentActivityOptions(ComponentName var1, Intent[] var2, String[] var3, Intent var4, String var5, int var6, int var7) throws RemoteException;
public ParceledListSlice queryIntentContentProviders(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryIntentReceivers(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryIntentServices(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryPermissionsByGroup(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public void querySyncProviders(List<String> var1, List<ProviderInfo> var2) throws RemoteException;
public void reconcileSecondaryDexFiles(String var1) throws RemoteException;
public void registerDexModule(String var1, String var2, boolean var3, IDexModuleRegisterCallback var4) throws RemoteException;
public void registerMoveCallback(IPackageMoveObserver var1) throws RemoteException;
public void removeOnPermissionsChangeListener(IOnPermissionsChangeListener var1) throws RemoteException;
@UnsupportedAppUsage
public void removePermission(String var1) throws RemoteException;
public boolean removeWhitelistedRestrictedPermission(String var1, String var2, int var3, int var4) throws RemoteException;
@UnsupportedAppUsage
public void replacePreferredActivity(IntentFilter var1, int var2, ComponentName[] var3, ComponentName var4, int var5) throws RemoteException;
public void resetApplicationPreferences(int var1) throws RemoteException;
public void resetRuntimePermissions() throws RemoteException;
public ProviderInfo resolveContentProvider(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public ResolveInfo resolveIntent(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ResolveInfo resolveService(Intent var1, String var2, int var3, int var4) throws RemoteException;
public void restoreDefaultApps(byte[] var1, int var2) throws RemoteException;
public void restoreIntentFilterVerification(byte[] var1, int var2) throws RemoteException;
public void restorePreferredActivities(byte[] var1, int var2) throws RemoteException;
public void revokeDefaultPermissionsFromDisabledTelephonyDataServices(String[] var1, int var2) throws RemoteException;
public void revokeDefaultPermissionsFromLuiApps(String[] var1, int var2) throws RemoteException;
public void revokeRuntimePermission(String var1, String var2, int var3) throws RemoteException;
public boolean runBackgroundDexoptJob(List<String> var1) throws RemoteException;
public void sendDeviceCustomizationReadyBroadcast() throws RemoteException;
public void setApplicationCategoryHint(String var1, int var2, String var3) throws RemoteException;
@UnsupportedAppUsage
public void setApplicationEnabledSetting(String var1, int var2, int var3, int var4, String var5) throws RemoteException;
@UnsupportedAppUsage
public boolean setApplicationHiddenSettingAsUser(String var1, boolean var2, int var3) throws RemoteException;
public boolean setBlockUninstallForUser(String var1, boolean var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public void setComponentEnabledSetting(ComponentName var1, int var2, int var3, int var4) throws RemoteException;
public boolean setDefaultBrowserPackageName(String var1, int var2) throws RemoteException;
public String[] setDistractingPackageRestrictionsAsUser(String[] var1, int var2, int var3) throws RemoteException;
public void setHarmfulAppWarning(String var1, CharSequence var2, int var3) throws RemoteException;
public void setHomeActivity(ComponentName var1, int var2) throws RemoteException;
public boolean setInstallLocation(int var1) throws RemoteException;
@UnsupportedAppUsage
public void setInstallerPackageName(String var1, String var2) throws RemoteException;
public boolean setInstantAppCookie(String var1, byte[] var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public void setLastChosenActivity(Intent var1, String var2, int var3, IntentFilter var4, int var5, ComponentName var6) throws RemoteException;
@UnsupportedAppUsage
public void setPackageStoppedState(String var1, boolean var2, int var3) throws RemoteException;
public String[] setPackagesSuspendedAsUser(String[] var1, boolean var2, PersistableBundle var3, PersistableBundle var4, SuspendDialogInfo var5, String var6, int var7) throws RemoteException;
public void setPermissionEnforced(String var1, boolean var2) throws RemoteException;
public boolean setRequiredForSystemUser(String var1, boolean var2) throws RemoteException;
public void setRuntimePermissionsVersion(int var1, int var2) throws RemoteException;
public void setSystemAppHiddenUntilInstalled(String var1, boolean var2) throws RemoteException;
public boolean setSystemAppInstallState(String var1, boolean var2, int var3) throws RemoteException;
public void setUpdateAvailable(String var1, boolean var2) throws RemoteException;
public boolean shouldShowRequestPermissionRationale(String var1, String var2, int var3) throws RemoteException;
public void systemReady() throws RemoteException;
public void unregisterMoveCallback(IPackageMoveObserver var1) throws RemoteException;
public boolean updateIntentVerificationStatus(String var1, int var2, int var3) throws RemoteException;
public void updatePackagesIfNeeded() throws RemoteException;
public void updatePermissionFlags(String var1, String var2, int var3, int var4, boolean var5, int var6) throws RemoteException;
public void updatePermissionFlagsForAllApps(int var1, int var2, int var3) throws RemoteException;
public void verifyIntentFilter(int var1, int var2, List<String> var3) throws RemoteException;
public void verifyPendingInstall(int var1, int var2) throws RemoteException;
public static class Default
implements IPackageManager {
@Override
public boolean activitySupportsIntent(ComponentName componentName, Intent intent, String string2) throws RemoteException {
return false;
}
@Override
public void addCrossProfileIntentFilter(IntentFilter intentFilter, String string2, int n, int n2, int n3) throws RemoteException {
}
@Override
public void addOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
}
@Override
public boolean addPermission(PermissionInfo permissionInfo) throws RemoteException {
return false;
}
@Override
public boolean addPermissionAsync(PermissionInfo permissionInfo) throws RemoteException {
return false;
}
@Override
public void addPersistentPreferredActivity(IntentFilter intentFilter, ComponentName componentName, int n) throws RemoteException {
}
@Override
public void addPreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
}
@Override
public boolean addWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
return false;
}
@Override
public IBinder asBinder() {
return null;
}
@Override
public boolean canForwardTo(Intent intent, String string2, int n, int n2) throws RemoteException {
return false;
}
@Override
public boolean canRequestPackageInstalls(String string2, int n) throws RemoteException {
return false;
}
@Override
public String[] canonicalToCurrentPackageNames(String[] arrstring) throws RemoteException {
return null;
}
@Override
public void checkPackageStartable(String string2, int n) throws RemoteException {
}
@Override
public int checkPermission(String string2, String string3, int n) throws RemoteException {
return 0;
}
@Override
public int checkSignatures(String string2, String string3) throws RemoteException {
return 0;
}
@Override
public int checkUidPermission(String string2, int n) throws RemoteException {
return 0;
}
@Override
public int checkUidSignatures(int n, int n2) throws RemoteException {
return 0;
}
@Override
public void clearApplicationProfileData(String string2) throws RemoteException {
}
@Override
public void clearApplicationUserData(String string2, IPackageDataObserver iPackageDataObserver, int n) throws RemoteException {
}
@Override
public void clearCrossProfileIntentFilters(int n, String string2) throws RemoteException {
}
@Override
public void clearPackagePersistentPreferredActivities(String string2, int n) throws RemoteException {
}
@Override
public void clearPackagePreferredActivities(String string2) throws RemoteException {
}
@Override
public boolean compileLayouts(String string2) throws RemoteException {
return false;
}
@Override
public String[] currentToCanonicalPackageNames(String[] arrstring) throws RemoteException {
return null;
}
@Override
public void deleteApplicationCacheFiles(String string2, IPackageDataObserver iPackageDataObserver) throws RemoteException {
}
@Override
public void deleteApplicationCacheFilesAsUser(String string2, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
}
@Override
public void deletePackageAsUser(String string2, int n, IPackageDeleteObserver iPackageDeleteObserver, int n2, int n3) throws RemoteException {
}
@Override
public void deletePackageVersioned(VersionedPackage versionedPackage, IPackageDeleteObserver2 iPackageDeleteObserver2, int n, int n2) throws RemoteException {
}
@Override
public void deletePreloadsFileCache() throws RemoteException {
}
@Override
public void dumpProfiles(String string2) throws RemoteException {
}
@Override
public void enterSafeMode() throws RemoteException {
}
@Override
public void extendVerificationTimeout(int n, int n2, long l) throws RemoteException {
}
@Override
public ResolveInfo findPersistentPreferredActivity(Intent intent, int n) throws RemoteException {
return null;
}
@Override
public void finishPackageInstall(int n, boolean bl) throws RemoteException {
}
@Override
public void flushPackageRestrictionsAsUser(int n) throws RemoteException {
}
@Override
public void forceDexOpt(String string2) throws RemoteException {
}
@Override
public void freeStorage(String string2, long l, int n, IntentSender intentSender) throws RemoteException {
}
@Override
public void freeStorageAndNotify(String string2, long l, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
}
@Override
public ActivityInfo getActivityInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getAllIntentFilters(String string2) throws RemoteException {
return null;
}
@Override
public List<String> getAllPackages() throws RemoteException {
return null;
}
@Override
public ParceledListSlice getAllPermissionGroups(int n) throws RemoteException {
return null;
}
@Override
public String[] getAppOpPermissionPackages(String string2) throws RemoteException {
return null;
}
@Override
public String getAppPredictionServicePackageName() throws RemoteException {
return null;
}
@Override
public int getApplicationEnabledSetting(String string2, int n) throws RemoteException {
return 0;
}
@Override
public boolean getApplicationHiddenSettingAsUser(String string2, int n) throws RemoteException {
return false;
}
@Override
public ApplicationInfo getApplicationInfo(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public IArtManager getArtManager() throws RemoteException {
return null;
}
@Override
public String getAttentionServicePackageName() throws RemoteException {
return null;
}
@Override
public boolean getBlockUninstallForUser(String string2, int n) throws RemoteException {
return false;
}
@Override
public ChangedPackages getChangedPackages(int n, int n2) throws RemoteException {
return null;
}
@Override
public int getComponentEnabledSetting(ComponentName componentName, int n) throws RemoteException {
return 0;
}
@Override
public ParceledListSlice getDeclaredSharedLibraries(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public byte[] getDefaultAppsBackup(int n) throws RemoteException {
return null;
}
@Override
public String getDefaultBrowserPackageName(int n) throws RemoteException {
return null;
}
@Override
public int getFlagsForUid(int n) throws RemoteException {
return 0;
}
@Override
public CharSequence getHarmfulAppWarning(String string2, int n) throws RemoteException {
return null;
}
@Override
public ComponentName getHomeActivities(List<ResolveInfo> list) throws RemoteException {
return null;
}
@Override
public String getIncidentReportApproverPackageName() throws RemoteException {
return null;
}
@Override
public int getInstallLocation() throws RemoteException {
return 0;
}
@Override
public int getInstallReason(String string2, int n) throws RemoteException {
return 0;
}
@Override
public ParceledListSlice getInstalledApplications(int n, int n2) throws RemoteException {
return null;
}
@Override
public List<ModuleInfo> getInstalledModules(int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getInstalledPackages(int n, int n2) throws RemoteException {
return null;
}
@Override
public String getInstallerPackageName(String string2) throws RemoteException {
return null;
}
@Override
public String getInstantAppAndroidId(String string2, int n) throws RemoteException {
return null;
}
@Override
public byte[] getInstantAppCookie(String string2, int n) throws RemoteException {
return null;
}
@Override
public Bitmap getInstantAppIcon(String string2, int n) throws RemoteException {
return null;
}
@Override
public ComponentName getInstantAppInstallerComponent() throws RemoteException {
return null;
}
@Override
public ComponentName getInstantAppResolverComponent() throws RemoteException {
return null;
}
@Override
public ComponentName getInstantAppResolverSettingsComponent() throws RemoteException {
return null;
}
@Override
public ParceledListSlice getInstantApps(int n) throws RemoteException {
return null;
}
@Override
public InstrumentationInfo getInstrumentationInfo(ComponentName componentName, int n) throws RemoteException {
return null;
}
@Override
public byte[] getIntentFilterVerificationBackup(int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getIntentFilterVerifications(String string2) throws RemoteException {
return null;
}
@Override
public int getIntentVerificationStatus(String string2, int n) throws RemoteException {
return 0;
}
@Override
public KeySet getKeySetByAlias(String string2, String string3) throws RemoteException {
return null;
}
@Override
public ResolveInfo getLastChosenActivity(Intent intent, String string2, int n) throws RemoteException {
return null;
}
@Override
public ModuleInfo getModuleInfo(String string2, int n) throws RemoteException {
return null;
}
@Override
public int getMoveStatus(int n) throws RemoteException {
return 0;
}
@Override
public String getNameForUid(int n) throws RemoteException {
return null;
}
@Override
public String[] getNamesForUids(int[] arrn) throws RemoteException {
return null;
}
@Override
public int[] getPackageGids(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public PackageInfo getPackageInfo(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public PackageInfo getPackageInfoVersioned(VersionedPackage versionedPackage, int n, int n2) throws RemoteException {
return null;
}
@Override
public IPackageInstaller getPackageInstaller() throws RemoteException {
return null;
}
@Override
public void getPackageSizeInfo(String string2, int n, IPackageStatsObserver iPackageStatsObserver) throws RemoteException {
}
@Override
public int getPackageUid(String string2, int n, int n2) throws RemoteException {
return 0;
}
@Override
public String[] getPackagesForUid(int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getPackagesHoldingPermissions(String[] arrstring, int n, int n2) throws RemoteException {
return null;
}
@Override
public String getPermissionControllerPackageName() throws RemoteException {
return null;
}
@Override
public int getPermissionFlags(String string2, String string3, int n) throws RemoteException {
return 0;
}
@Override
public PermissionGroupInfo getPermissionGroupInfo(String string2, int n) throws RemoteException {
return null;
}
@Override
public PermissionInfo getPermissionInfo(String string2, String string3, int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getPersistentApplications(int n) throws RemoteException {
return null;
}
@Override
public int getPreferredActivities(List<IntentFilter> list, List<ComponentName> list2, String string2) throws RemoteException {
return 0;
}
@Override
public byte[] getPreferredActivityBackup(int n) throws RemoteException {
return null;
}
@Override
public int getPrivateFlagsForUid(int n) throws RemoteException {
return 0;
}
@Override
public ProviderInfo getProviderInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public ActivityInfo getReceiverInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public int getRuntimePermissionsVersion(int n) throws RemoteException {
return 0;
}
@Override
public ServiceInfo getServiceInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public String getServicesSystemSharedLibraryPackageName() throws RemoteException {
return null;
}
@Override
public ParceledListSlice getSharedLibraries(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public String getSharedSystemSharedLibraryPackageName() throws RemoteException {
return null;
}
@Override
public KeySet getSigningKeySet(String string2) throws RemoteException {
return null;
}
@Override
public PersistableBundle getSuspendedPackageAppExtras(String string2, int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getSystemAvailableFeatures() throws RemoteException {
return null;
}
@Override
public String getSystemCaptionsServicePackageName() throws RemoteException {
return null;
}
@Override
public String[] getSystemSharedLibraryNames() throws RemoteException {
return null;
}
@Override
public String getSystemTextClassifierPackageName() throws RemoteException {
return null;
}
@Override
public int getUidForSharedUser(String string2) throws RemoteException {
return 0;
}
@Override
public String[] getUnsuspendablePackagesForUser(String[] arrstring, int n) throws RemoteException {
return null;
}
@Override
public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException {
return null;
}
@Override
public String getWellbeingPackageName() throws RemoteException {
return null;
}
@Override
public List<String> getWhitelistedRestrictedPermissions(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public void grantDefaultPermissionsToActiveLuiApp(String string2, int n) throws RemoteException {
}
@Override
public void grantDefaultPermissionsToEnabledCarrierApps(String[] arrstring, int n) throws RemoteException {
}
@Override
public void grantDefaultPermissionsToEnabledImsServices(String[] arrstring, int n) throws RemoteException {
}
@Override
public void grantDefaultPermissionsToEnabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
}
@Override
public void grantRuntimePermission(String string2, String string3, int n) throws RemoteException {
}
@Override
public boolean hasSigningCertificate(String string2, byte[] arrby, int n) throws RemoteException {
return false;
}
@Override
public boolean hasSystemFeature(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean hasSystemUidErrors() throws RemoteException {
return false;
}
@Override
public boolean hasUidSigningCertificate(int n, byte[] arrby, int n2) throws RemoteException {
return false;
}
@Override
public int installExistingPackageAsUser(String string2, int n, int n2, int n3, List<String> list) throws RemoteException {
return 0;
}
@Override
public boolean isDeviceUpgrading() throws RemoteException {
return false;
}
@Override
public boolean isFirstBoot() throws RemoteException {
return false;
}
@Override
public boolean isInstantApp(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isOnlyCoreApps() throws RemoteException {
return false;
}
@Override
public boolean isPackageAvailable(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isPackageDeviceAdminOnAnyUser(String string2) throws RemoteException {
return false;
}
@Override
public boolean isPackageSignedByKeySet(String string2, KeySet keySet) throws RemoteException {
return false;
}
@Override
public boolean isPackageSignedByKeySetExactly(String string2, KeySet keySet) throws RemoteException {
return false;
}
@Override
public boolean isPackageStateProtected(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isPackageSuspendedForUser(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isPermissionEnforced(String string2) throws RemoteException {
return false;
}
@Override
public boolean isPermissionRevokedByPolicy(String string2, String string3, int n) throws RemoteException {
return false;
}
@Override
public boolean isProtectedBroadcast(String string2) throws RemoteException {
return false;
}
@Override
public boolean isSafeMode() throws RemoteException {
return false;
}
@Override
public boolean isStorageLow() throws RemoteException {
return false;
}
@Override
public boolean isUidPrivileged(int n) throws RemoteException {
return false;
}
@Override
public void logAppProcessStartIfNeeded(String string2, int n, String string3, String string4, int n2) throws RemoteException {
}
@Override
public int movePackage(String string2, String string3) throws RemoteException {
return 0;
}
@Override
public int movePrimaryStorage(String string2) throws RemoteException {
return 0;
}
@Override
public void notifyDexLoad(String string2, List<String> list, List<String> list2, String string3) throws RemoteException {
}
@Override
public void notifyPackageUse(String string2, int n) throws RemoteException {
}
@Override
public void notifyPackagesReplacedReceived(String[] arrstring) throws RemoteException {
}
@Override
public boolean performDexOptMode(String string2, boolean bl, String string3, boolean bl2, boolean bl3, String string4) throws RemoteException {
return false;
}
@Override
public boolean performDexOptSecondary(String string2, String string3, boolean bl) throws RemoteException {
return false;
}
@Override
public void performFstrimIfNeeded() throws RemoteException {
}
@Override
public ParceledListSlice queryContentProviders(String string2, int n, int n2, String string3) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryInstrumentation(String string2, int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentActivities(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentActivityOptions(ComponentName componentName, Intent[] arrintent, String[] arrstring, Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentContentProviders(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentReceivers(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentServices(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryPermissionsByGroup(String string2, int n) throws RemoteException {
return null;
}
@Override
public void querySyncProviders(List<String> list, List<ProviderInfo> list2) throws RemoteException {
}
@Override
public void reconcileSecondaryDexFiles(String string2) throws RemoteException {
}
@Override
public void registerDexModule(String string2, String string3, boolean bl, IDexModuleRegisterCallback iDexModuleRegisterCallback) throws RemoteException {
}
@Override
public void registerMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
}
@Override
public void removeOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
}
@Override
public void removePermission(String string2) throws RemoteException {
}
@Override
public boolean removeWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
return false;
}
@Override
public void replacePreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
}
@Override
public void resetApplicationPreferences(int n) throws RemoteException {
}
@Override
public void resetRuntimePermissions() throws RemoteException {
}
@Override
public ProviderInfo resolveContentProvider(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ResolveInfo resolveIntent(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ResolveInfo resolveService(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public void restoreDefaultApps(byte[] arrby, int n) throws RemoteException {
}
@Override
public void restoreIntentFilterVerification(byte[] arrby, int n) throws RemoteException {
}
@Override
public void restorePreferredActivities(byte[] arrby, int n) throws RemoteException {
}
@Override
public void revokeDefaultPermissionsFromDisabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
}
@Override
public void revokeDefaultPermissionsFromLuiApps(String[] arrstring, int n) throws RemoteException {
}
@Override
public void revokeRuntimePermission(String string2, String string3, int n) throws RemoteException {
}
@Override
public boolean runBackgroundDexoptJob(List<String> list) throws RemoteException {
return false;
}
@Override
public void sendDeviceCustomizationReadyBroadcast() throws RemoteException {
}
@Override
public void setApplicationCategoryHint(String string2, int n, String string3) throws RemoteException {
}
@Override
public void setApplicationEnabledSetting(String string2, int n, int n2, int n3, String string3) throws RemoteException {
}
@Override
public boolean setApplicationHiddenSettingAsUser(String string2, boolean bl, int n) throws RemoteException {
return false;
}
@Override
public boolean setBlockUninstallForUser(String string2, boolean bl, int n) throws RemoteException {
return false;
}
@Override
public void setComponentEnabledSetting(ComponentName componentName, int n, int n2, int n3) throws RemoteException {
}
@Override
public boolean setDefaultBrowserPackageName(String string2, int n) throws RemoteException {
return false;
}
@Override
public String[] setDistractingPackageRestrictionsAsUser(String[] arrstring, int n, int n2) throws RemoteException {
return null;
}
@Override
public void setHarmfulAppWarning(String string2, CharSequence charSequence, int n) throws RemoteException {
}
@Override
public void setHomeActivity(ComponentName componentName, int n) throws RemoteException {
}
@Override
public boolean setInstallLocation(int n) throws RemoteException {
return false;
}
@Override
public void setInstallerPackageName(String string2, String string3) throws RemoteException {
}
@Override
public boolean setInstantAppCookie(String string2, byte[] arrby, int n) throws RemoteException {
return false;
}
@Override
public void setLastChosenActivity(Intent intent, String string2, int n, IntentFilter intentFilter, int n2, ComponentName componentName) throws RemoteException {
}
@Override
public void setPackageStoppedState(String string2, boolean bl, int n) throws RemoteException {
}
@Override
public String[] setPackagesSuspendedAsUser(String[] arrstring, boolean bl, PersistableBundle persistableBundle, PersistableBundle persistableBundle2, SuspendDialogInfo suspendDialogInfo, String string2, int n) throws RemoteException {
return null;
}
@Override
public void setPermissionEnforced(String string2, boolean bl) throws RemoteException {
}
@Override
public boolean setRequiredForSystemUser(String string2, boolean bl) throws RemoteException {
return false;
}
@Override
public void setRuntimePermissionsVersion(int n, int n2) throws RemoteException {
}
@Override
public void setSystemAppHiddenUntilInstalled(String string2, boolean bl) throws RemoteException {
}
@Override
public boolean setSystemAppInstallState(String string2, boolean bl, int n) throws RemoteException {
return false;
}
@Override
public void setUpdateAvailable(String string2, boolean bl) throws RemoteException {
}
@Override
public boolean shouldShowRequestPermissionRationale(String string2, String string3, int n) throws RemoteException {
return false;
}
@Override
public void systemReady() throws RemoteException {
}
@Override
public void unregisterMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
}
@Override
public boolean updateIntentVerificationStatus(String string2, int n, int n2) throws RemoteException {
return false;
}
@Override
public void updatePackagesIfNeeded() throws RemoteException {
}
@Override
public void updatePermissionFlags(String string2, String string3, int n, int n2, boolean bl, int n3) throws RemoteException {
}
@Override
public void updatePermissionFlagsForAllApps(int n, int n2, int n3) throws RemoteException {
}
@Override
public void verifyIntentFilter(int n, int n2, List<String> list) throws RemoteException {
}
@Override
public void verifyPendingInstall(int n, int n2) throws RemoteException {
}
}
public static abstract class Stub
extends Binder
implements IPackageManager {
private static final String DESCRIPTOR = "android.content.pm.IPackageManager";
static final int TRANSACTION_activitySupportsIntent = 15;
static final int TRANSACTION_addCrossProfileIntentFilter = 78;
static final int TRANSACTION_addOnPermissionsChangeListener = 162;
static final int TRANSACTION_addPermission = 21;
static final int TRANSACTION_addPermissionAsync = 131;
static final int TRANSACTION_addPersistentPreferredActivity = 76;
static final int TRANSACTION_addPreferredActivity = 72;
static final int TRANSACTION_addWhitelistedRestrictedPermission = 30;
static final int TRANSACTION_canForwardTo = 47;
static final int TRANSACTION_canRequestPackageInstalls = 186;
static final int TRANSACTION_canonicalToCurrentPackageNames = 8;
static final int TRANSACTION_checkPackageStartable = 1;
static final int TRANSACTION_checkPermission = 19;
static final int TRANSACTION_checkSignatures = 34;
static final int TRANSACTION_checkUidPermission = 20;
static final int TRANSACTION_checkUidSignatures = 35;
static final int TRANSACTION_clearApplicationProfileData = 105;
static final int TRANSACTION_clearApplicationUserData = 104;
static final int TRANSACTION_clearCrossProfileIntentFilters = 79;
static final int TRANSACTION_clearPackagePersistentPreferredActivities = 77;
static final int TRANSACTION_clearPackagePreferredActivities = 74;
static final int TRANSACTION_compileLayouts = 121;
static final int TRANSACTION_currentToCanonicalPackageNames = 7;
static final int TRANSACTION_deleteApplicationCacheFiles = 102;
static final int TRANSACTION_deleteApplicationCacheFilesAsUser = 103;
static final int TRANSACTION_deletePackageAsUser = 66;
static final int TRANSACTION_deletePackageVersioned = 67;
static final int TRANSACTION_deletePreloadsFileCache = 187;
static final int TRANSACTION_dumpProfiles = 122;
static final int TRANSACTION_enterSafeMode = 110;
static final int TRANSACTION_extendVerificationTimeout = 136;
static final int TRANSACTION_findPersistentPreferredActivity = 46;
static final int TRANSACTION_finishPackageInstall = 63;
static final int TRANSACTION_flushPackageRestrictionsAsUser = 98;
static final int TRANSACTION_forceDexOpt = 123;
static final int TRANSACTION_freeStorage = 101;
static final int TRANSACTION_freeStorageAndNotify = 100;
static final int TRANSACTION_getActivityInfo = 14;
static final int TRANSACTION_getAllIntentFilters = 141;
static final int TRANSACTION_getAllPackages = 36;
static final int TRANSACTION_getAllPermissionGroups = 12;
static final int TRANSACTION_getAppOpPermissionPackages = 44;
static final int TRANSACTION_getAppPredictionServicePackageName = 200;
static final int TRANSACTION_getApplicationEnabledSetting = 96;
static final int TRANSACTION_getApplicationHiddenSettingAsUser = 152;
static final int TRANSACTION_getApplicationInfo = 13;
static final int TRANSACTION_getArtManager = 192;
static final int TRANSACTION_getAttentionServicePackageName = 198;
static final int TRANSACTION_getBlockUninstallForUser = 157;
static final int TRANSACTION_getChangedPackages = 181;
static final int TRANSACTION_getComponentEnabledSetting = 94;
static final int TRANSACTION_getDeclaredSharedLibraries = 185;
static final int TRANSACTION_getDefaultAppsBackup = 87;
static final int TRANSACTION_getDefaultBrowserPackageName = 143;
static final int TRANSACTION_getFlagsForUid = 41;
static final int TRANSACTION_getHarmfulAppWarning = 194;
static final int TRANSACTION_getHomeActivities = 91;
static final int TRANSACTION_getIncidentReportApproverPackageName = 202;
static final int TRANSACTION_getInstallLocation = 133;
static final int TRANSACTION_getInstallReason = 183;
static final int TRANSACTION_getInstalledApplications = 56;
static final int TRANSACTION_getInstalledModules = 205;
static final int TRANSACTION_getInstalledPackages = 54;
static final int TRANSACTION_getInstallerPackageName = 68;
static final int TRANSACTION_getInstantAppAndroidId = 191;
static final int TRANSACTION_getInstantAppCookie = 173;
static final int TRANSACTION_getInstantAppIcon = 175;
static final int TRANSACTION_getInstantAppInstallerComponent = 190;
static final int TRANSACTION_getInstantAppResolverComponent = 188;
static final int TRANSACTION_getInstantAppResolverSettingsComponent = 189;
static final int TRANSACTION_getInstantApps = 172;
static final int TRANSACTION_getInstrumentationInfo = 61;
static final int TRANSACTION_getIntentFilterVerificationBackup = 89;
static final int TRANSACTION_getIntentFilterVerifications = 140;
static final int TRANSACTION_getIntentVerificationStatus = 138;
static final int TRANSACTION_getKeySetByAlias = 158;
static final int TRANSACTION_getLastChosenActivity = 70;
static final int TRANSACTION_getModuleInfo = 206;
static final int TRANSACTION_getMoveStatus = 126;
static final int TRANSACTION_getNameForUid = 38;
static final int TRANSACTION_getNamesForUids = 39;
static final int TRANSACTION_getPackageGids = 6;
static final int TRANSACTION_getPackageInfo = 3;
static final int TRANSACTION_getPackageInfoVersioned = 4;
static final int TRANSACTION_getPackageInstaller = 155;
static final int TRANSACTION_getPackageSizeInfo = 106;
static final int TRANSACTION_getPackageUid = 5;
static final int TRANSACTION_getPackagesForUid = 37;
static final int TRANSACTION_getPackagesHoldingPermissions = 55;
static final int TRANSACTION_getPermissionControllerPackageName = 171;
static final int TRANSACTION_getPermissionFlags = 26;
static final int TRANSACTION_getPermissionGroupInfo = 11;
static final int TRANSACTION_getPermissionInfo = 9;
static final int TRANSACTION_getPersistentApplications = 57;
static final int TRANSACTION_getPreferredActivities = 75;
static final int TRANSACTION_getPreferredActivityBackup = 85;
static final int TRANSACTION_getPrivateFlagsForUid = 42;
static final int TRANSACTION_getProviderInfo = 18;
static final int TRANSACTION_getReceiverInfo = 16;
static final int TRANSACTION_getRuntimePermissionsVersion = 207;
static final int TRANSACTION_getServiceInfo = 17;
static final int TRANSACTION_getServicesSystemSharedLibraryPackageName = 179;
static final int TRANSACTION_getSharedLibraries = 184;
static final int TRANSACTION_getSharedSystemSharedLibraryPackageName = 180;
static final int TRANSACTION_getSigningKeySet = 159;
static final int TRANSACTION_getSuspendedPackageAppExtras = 84;
static final int TRANSACTION_getSystemAvailableFeatures = 108;
static final int TRANSACTION_getSystemCaptionsServicePackageName = 201;
static final int TRANSACTION_getSystemSharedLibraryNames = 107;
static final int TRANSACTION_getSystemTextClassifierPackageName = 197;
static final int TRANSACTION_getUidForSharedUser = 40;
static final int TRANSACTION_getUnsuspendablePackagesForUser = 82;
static final int TRANSACTION_getVerifierDeviceIdentity = 144;
static final int TRANSACTION_getWellbeingPackageName = 199;
static final int TRANSACTION_getWhitelistedRestrictedPermissions = 29;
static final int TRANSACTION_grantDefaultPermissionsToActiveLuiApp = 168;
static final int TRANSACTION_grantDefaultPermissionsToEnabledCarrierApps = 164;
static final int TRANSACTION_grantDefaultPermissionsToEnabledImsServices = 165;
static final int TRANSACTION_grantDefaultPermissionsToEnabledTelephonyDataServices = 166;
static final int TRANSACTION_grantRuntimePermission = 23;
static final int TRANSACTION_hasSigningCertificate = 195;
static final int TRANSACTION_hasSystemFeature = 109;
static final int TRANSACTION_hasSystemUidErrors = 113;
static final int TRANSACTION_hasUidSigningCertificate = 196;
static final int TRANSACTION_installExistingPackageAsUser = 134;
static final int TRANSACTION_isDeviceUpgrading = 147;
static final int TRANSACTION_isFirstBoot = 145;
static final int TRANSACTION_isInstantApp = 176;
static final int TRANSACTION_isOnlyCoreApps = 146;
static final int TRANSACTION_isPackageAvailable = 2;
static final int TRANSACTION_isPackageDeviceAdminOnAnyUser = 182;
static final int TRANSACTION_isPackageSignedByKeySet = 160;
static final int TRANSACTION_isPackageSignedByKeySetExactly = 161;
static final int TRANSACTION_isPackageStateProtected = 203;
static final int TRANSACTION_isPackageSuspendedForUser = 83;
static final int TRANSACTION_isPermissionEnforced = 149;
static final int TRANSACTION_isPermissionRevokedByPolicy = 170;
static final int TRANSACTION_isProtectedBroadcast = 33;
static final int TRANSACTION_isSafeMode = 111;
static final int TRANSACTION_isStorageLow = 150;
static final int TRANSACTION_isUidPrivileged = 43;
static final int TRANSACTION_logAppProcessStartIfNeeded = 97;
static final int TRANSACTION_movePackage = 129;
static final int TRANSACTION_movePrimaryStorage = 130;
static final int TRANSACTION_notifyDexLoad = 117;
static final int TRANSACTION_notifyPackageUse = 116;
static final int TRANSACTION_notifyPackagesReplacedReceived = 209;
static final int TRANSACTION_performDexOptMode = 119;
static final int TRANSACTION_performDexOptSecondary = 120;
static final int TRANSACTION_performFstrimIfNeeded = 114;
static final int TRANSACTION_queryContentProviders = 60;
static final int TRANSACTION_queryInstrumentation = 62;
static final int TRANSACTION_queryIntentActivities = 48;
static final int TRANSACTION_queryIntentActivityOptions = 49;
static final int TRANSACTION_queryIntentContentProviders = 53;
static final int TRANSACTION_queryIntentReceivers = 50;
static final int TRANSACTION_queryIntentServices = 52;
static final int TRANSACTION_queryPermissionsByGroup = 10;
static final int TRANSACTION_querySyncProviders = 59;
static final int TRANSACTION_reconcileSecondaryDexFiles = 125;
static final int TRANSACTION_registerDexModule = 118;
static final int TRANSACTION_registerMoveCallback = 127;
static final int TRANSACTION_removeOnPermissionsChangeListener = 163;
static final int TRANSACTION_removePermission = 22;
static final int TRANSACTION_removeWhitelistedRestrictedPermission = 31;
static final int TRANSACTION_replacePreferredActivity = 73;
static final int TRANSACTION_resetApplicationPreferences = 69;
static final int TRANSACTION_resetRuntimePermissions = 25;
static final int TRANSACTION_resolveContentProvider = 58;
static final int TRANSACTION_resolveIntent = 45;
static final int TRANSACTION_resolveService = 51;
static final int TRANSACTION_restoreDefaultApps = 88;
static final int TRANSACTION_restoreIntentFilterVerification = 90;
static final int TRANSACTION_restorePreferredActivities = 86;
static final int TRANSACTION_revokeDefaultPermissionsFromDisabledTelephonyDataServices = 167;
static final int TRANSACTION_revokeDefaultPermissionsFromLuiApps = 169;
static final int TRANSACTION_revokeRuntimePermission = 24;
static final int TRANSACTION_runBackgroundDexoptJob = 124;
static final int TRANSACTION_sendDeviceCustomizationReadyBroadcast = 204;
static final int TRANSACTION_setApplicationCategoryHint = 65;
static final int TRANSACTION_setApplicationEnabledSetting = 95;
static final int TRANSACTION_setApplicationHiddenSettingAsUser = 151;
static final int TRANSACTION_setBlockUninstallForUser = 156;
static final int TRANSACTION_setComponentEnabledSetting = 93;
static final int TRANSACTION_setDefaultBrowserPackageName = 142;
static final int TRANSACTION_setDistractingPackageRestrictionsAsUser = 80;
static final int TRANSACTION_setHarmfulAppWarning = 193;
static final int TRANSACTION_setHomeActivity = 92;
static final int TRANSACTION_setInstallLocation = 132;
static final int TRANSACTION_setInstallerPackageName = 64;
static final int TRANSACTION_setInstantAppCookie = 174;
static final int TRANSACTION_setLastChosenActivity = 71;
static final int TRANSACTION_setPackageStoppedState = 99;
static final int TRANSACTION_setPackagesSuspendedAsUser = 81;
static final int TRANSACTION_setPermissionEnforced = 148;
static final int TRANSACTION_setRequiredForSystemUser = 177;
static final int TRANSACTION_setRuntimePermissionsVersion = 208;
static final int TRANSACTION_setSystemAppHiddenUntilInstalled = 153;
static final int TRANSACTION_setSystemAppInstallState = 154;
static final int TRANSACTION_setUpdateAvailable = 178;
static final int TRANSACTION_shouldShowRequestPermissionRationale = 32;
static final int TRANSACTION_systemReady = 112;
static final int TRANSACTION_unregisterMoveCallback = 128;
static final int TRANSACTION_updateIntentVerificationStatus = 139;
static final int TRANSACTION_updatePackagesIfNeeded = 115;
static final int TRANSACTION_updatePermissionFlags = 27;
static final int TRANSACTION_updatePermissionFlagsForAllApps = 28;
static final int TRANSACTION_verifyIntentFilter = 137;
static final int TRANSACTION_verifyPendingInstall = 135;
public Stub() {
this.attachInterface(this, DESCRIPTOR);
}
public static IPackageManager asInterface(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface iInterface = iBinder.queryLocalInterface(DESCRIPTOR);
if (iInterface != null && iInterface instanceof IPackageManager) {
return (IPackageManager)iInterface;
}
return new Proxy(iBinder);
}
public static IPackageManager getDefaultImpl() {
return Proxy.sDefaultImpl;
}
public static String getDefaultTransactionName(int n) {
switch (n) {
default: {
return null;
}
case 209: {
return "notifyPackagesReplacedReceived";
}
case 208: {
return "setRuntimePermissionsVersion";
}
case 207: {
return "getRuntimePermissionsVersion";
}
case 206: {
return "getModuleInfo";
}
case 205: {
return "getInstalledModules";
}
case 204: {
return "sendDeviceCustomizationReadyBroadcast";
}
case 203: {
return "isPackageStateProtected";
}
case 202: {
return "getIncidentReportApproverPackageName";
}
case 201: {
return "getSystemCaptionsServicePackageName";
}
case 200: {
return "getAppPredictionServicePackageName";
}
case 199: {
return "getWellbeingPackageName";
}
case 198: {
return "getAttentionServicePackageName";
}
case 197: {
return "getSystemTextClassifierPackageName";
}
case 196: {
return "hasUidSigningCertificate";
}
case 195: {
return "hasSigningCertificate";
}
case 194: {
return "getHarmfulAppWarning";
}
case 193: {
return "setHarmfulAppWarning";
}
case 192: {
return "getArtManager";
}
case 191: {
return "getInstantAppAndroidId";
}
case 190: {
return "getInstantAppInstallerComponent";
}
case 189: {
return "getInstantAppResolverSettingsComponent";
}
case 188: {
return "getInstantAppResolverComponent";
}
case 187: {
return "deletePreloadsFileCache";
}
case 186: {
return "canRequestPackageInstalls";
}
case 185: {
return "getDeclaredSharedLibraries";
}
case 184: {
return "getSharedLibraries";
}
case 183: {
return "getInstallReason";
}
case 182: {
return "isPackageDeviceAdminOnAnyUser";
}
case 181: {
return "getChangedPackages";
}
case 180: {
return "getSharedSystemSharedLibraryPackageName";
}
case 179: {
return "getServicesSystemSharedLibraryPackageName";
}
case 178: {
return "setUpdateAvailable";
}
case 177: {
return "setRequiredForSystemUser";
}
case 176: {
return "isInstantApp";
}
case 175: {
return "getInstantAppIcon";
}
case 174: {
return "setInstantAppCookie";
}
case 173: {
return "getInstantAppCookie";
}
case 172: {
return "getInstantApps";
}
case 171: {
return "getPermissionControllerPackageName";
}
case 170: {
return "isPermissionRevokedByPolicy";
}
case 169: {
return "revokeDefaultPermissionsFromLuiApps";
}
case 168: {
return "grantDefaultPermissionsToActiveLuiApp";
}
case 167: {
return "revokeDefaultPermissionsFromDisabledTelephonyDataServices";
}
case 166: {
return "grantDefaultPermissionsToEnabledTelephonyDataServices";
}
case 165: {
return "grantDefaultPermissionsToEnabledImsServices";
}
case 164: {
return "grantDefaultPermissionsToEnabledCarrierApps";
}
case 163: {
return "removeOnPermissionsChangeListener";
}
case 162: {
return "addOnPermissionsChangeListener";
}
case 161: {
return "isPackageSignedByKeySetExactly";
}
case 160: {
return "isPackageSignedByKeySet";
}
case 159: {
return "getSigningKeySet";
}
case 158: {
return "getKeySetByAlias";
}
case 157: {
return "getBlockUninstallForUser";
}
case 156: {
return "setBlockUninstallForUser";
}
case 155: {
return "getPackageInstaller";
}
case 154: {
return "setSystemAppInstallState";
}
case 153: {
return "setSystemAppHiddenUntilInstalled";
}
case 152: {
return "getApplicationHiddenSettingAsUser";
}
case 151: {
return "setApplicationHiddenSettingAsUser";
}
case 150: {
return "isStorageLow";
}
case 149: {
return "isPermissionEnforced";
}
case 148: {
return "setPermissionEnforced";
}
case 147: {
return "isDeviceUpgrading";
}
case 146: {
return "isOnlyCoreApps";
}
case 145: {
return "isFirstBoot";
}
case 144: {
return "getVerifierDeviceIdentity";
}
case 143: {
return "getDefaultBrowserPackageName";
}
case 142: {
return "setDefaultBrowserPackageName";
}
case 141: {
return "getAllIntentFilters";
}
case 140: {
return "getIntentFilterVerifications";
}
case 139: {
return "updateIntentVerificationStatus";
}
case 138: {
return "getIntentVerificationStatus";
}
case 137: {
return "verifyIntentFilter";
}
case 136: {
return "extendVerificationTimeout";
}
case 135: {
return "verifyPendingInstall";
}
case 134: {
return "installExistingPackageAsUser";
}
case 133: {
return "getInstallLocation";
}
case 132: {
return "setInstallLocation";
}
case 131: {
return "addPermissionAsync";
}
case 130: {
return "movePrimaryStorage";
}
case 129: {
return "movePackage";
}
case 128: {
return "unregisterMoveCallback";
}
case 127: {
return "registerMoveCallback";
}
case 126: {
return "getMoveStatus";
}
case 125: {
return "reconcileSecondaryDexFiles";
}
case 124: {
return "runBackgroundDexoptJob";
}
case 123: {
return "forceDexOpt";
}
case 122: {
return "dumpProfiles";
}
case 121: {
return "compileLayouts";
}
case 120: {
return "performDexOptSecondary";
}
case 119: {
return "performDexOptMode";
}
case 118: {
return "registerDexModule";
}
case 117: {
return "notifyDexLoad";
}
case 116: {
return "notifyPackageUse";
}
case 115: {
return "updatePackagesIfNeeded";
}
case 114: {
return "performFstrimIfNeeded";
}
case 113: {
return "hasSystemUidErrors";
}
case 112: {
return "systemReady";
}
case 111: {
return "isSafeMode";
}
case 110: {
return "enterSafeMode";
}
case 109: {
return "hasSystemFeature";
}
case 108: {
return "getSystemAvailableFeatures";
}
case 107: {
return "getSystemSharedLibraryNames";
}
case 106: {
return "getPackageSizeInfo";
}
case 105: {
return "clearApplicationProfileData";
}
case 104: {
return "clearApplicationUserData";
}
case 103: {
return "deleteApplicationCacheFilesAsUser";
}
case 102: {
return "deleteApplicationCacheFiles";
}
case 101: {
return "freeStorage";
}
case 100: {
return "freeStorageAndNotify";
}
case 99: {
return "setPackageStoppedState";
}
case 98: {
return "flushPackageRestrictionsAsUser";
}
case 97: {
return "logAppProcessStartIfNeeded";
}
case 96: {
return "getApplicationEnabledSetting";
}
case 95: {
return "setApplicationEnabledSetting";
}
case 94: {
return "getComponentEnabledSetting";
}
case 93: {
return "setComponentEnabledSetting";
}
case 92: {
return "setHomeActivity";
}
case 91: {
return "getHomeActivities";
}
case 90: {
return "restoreIntentFilterVerification";
}
case 89: {
return "getIntentFilterVerificationBackup";
}
case 88: {
return "restoreDefaultApps";
}
case 87: {
return "getDefaultAppsBackup";
}
case 86: {
return "restorePreferredActivities";
}
case 85: {
return "getPreferredActivityBackup";
}
case 84: {
return "getSuspendedPackageAppExtras";
}
case 83: {
return "isPackageSuspendedForUser";
}
case 82: {
return "getUnsuspendablePackagesForUser";
}
case 81: {
return "setPackagesSuspendedAsUser";
}
case 80: {
return "setDistractingPackageRestrictionsAsUser";
}
case 79: {
return "clearCrossProfileIntentFilters";
}
case 78: {
return "addCrossProfileIntentFilter";
}
case 77: {
return "clearPackagePersistentPreferredActivities";
}
case 76: {
return "addPersistentPreferredActivity";
}
case 75: {
return "getPreferredActivities";
}
case 74: {
return "clearPackagePreferredActivities";
}
case 73: {
return "replacePreferredActivity";
}
case 72: {
return "addPreferredActivity";
}
case 71: {
return "setLastChosenActivity";
}
case 70: {
return "getLastChosenActivity";
}
case 69: {
return "resetApplicationPreferences";
}
case 68: {
return "getInstallerPackageName";
}
case 67: {
return "deletePackageVersioned";
}
case 66: {
return "deletePackageAsUser";
}
case 65: {
return "setApplicationCategoryHint";
}
case 64: {
return "setInstallerPackageName";
}
case 63: {
return "finishPackageInstall";
}
case 62: {
return "queryInstrumentation";
}
case 61: {
return "getInstrumentationInfo";
}
case 60: {
return "queryContentProviders";
}
case 59: {
return "querySyncProviders";
}
case 58: {
return "resolveContentProvider";
}
case 57: {
return "getPersistentApplications";
}
case 56: {
return "getInstalledApplications";
}
case 55: {
return "getPackagesHoldingPermissions";
}
case 54: {
return "getInstalledPackages";
}
case 53: {
return "queryIntentContentProviders";
}
case 52: {
return "queryIntentServices";
}
case 51: {
return "resolveService";
}
case 50: {
return "queryIntentReceivers";
}
case 49: {
return "queryIntentActivityOptions";
}
case 48: {
return "queryIntentActivities";
}
case 47: {
return "canForwardTo";
}
case 46: {
return "findPersistentPreferredActivity";
}
case 45: {
return "resolveIntent";
}
case 44: {
return "getAppOpPermissionPackages";
}
case 43: {
return "isUidPrivileged";
}
case 42: {
return "getPrivateFlagsForUid";
}
case 41: {
return "getFlagsForUid";
}
case 40: {
return "getUidForSharedUser";
}
case 39: {
return "getNamesForUids";
}
case 38: {
return "getNameForUid";
}
case 37: {
return "getPackagesForUid";
}
case 36: {
return "getAllPackages";
}
case 35: {
return "checkUidSignatures";
}
case 34: {
return "checkSignatures";
}
case 33: {
return "isProtectedBroadcast";
}
case 32: {
return "shouldShowRequestPermissionRationale";
}
case 31: {
return "removeWhitelistedRestrictedPermission";
}
case 30: {
return "addWhitelistedRestrictedPermission";
}
case 29: {
return "getWhitelistedRestrictedPermissions";
}
case 28: {
return "updatePermissionFlagsForAllApps";
}
case 27: {
return "updatePermissionFlags";
}
case 26: {
return "getPermissionFlags";
}
case 25: {
return "resetRuntimePermissions";
}
case 24: {
return "revokeRuntimePermission";
}
case 23: {
return "grantRuntimePermission";
}
case 22: {
return "removePermission";
}
case 21: {
return "addPermission";
}
case 20: {
return "checkUidPermission";
}
case 19: {
return "checkPermission";
}
case 18: {
return "getProviderInfo";
}
case 17: {
return "getServiceInfo";
}
case 16: {
return "getReceiverInfo";
}
case 15: {
return "activitySupportsIntent";
}
case 14: {
return "getActivityInfo";
}
case 13: {
return "getApplicationInfo";
}
case 12: {
return "getAllPermissionGroups";
}
case 11: {
return "getPermissionGroupInfo";
}
case 10: {
return "queryPermissionsByGroup";
}
case 9: {
return "getPermissionInfo";
}
case 8: {
return "canonicalToCurrentPackageNames";
}
case 7: {
return "currentToCanonicalPackageNames";
}
case 6: {
return "getPackageGids";
}
case 5: {
return "getPackageUid";
}
case 4: {
return "getPackageInfoVersioned";
}
case 3: {
return "getPackageInfo";
}
case 2: {
return "isPackageAvailable";
}
case 1:
}
return "checkPackageStartable";
}
public static boolean setDefaultImpl(IPackageManager iPackageManager) {
if (Proxy.sDefaultImpl == null && iPackageManager != null) {
Proxy.sDefaultImpl = iPackageManager;
return true;
}
return false;
}
@Override
public IBinder asBinder() {
return this;
}
@Override
public String getTransactionName(int n) {
return Stub.getDefaultTransactionName(n);
}
@Override
public boolean onTransact(int n, Parcel object, Parcel object2, int n2) throws RemoteException {
if (n != 1598968902) {
Object object3 = null;
Object object4 = null;
boolean bl = false;
boolean bl2 = false;
boolean bl3 = false;
boolean bl4 = false;
boolean bl5 = false;
boolean bl6 = false;
boolean bl7 = false;
boolean bl8 = false;
boolean bl9 = false;
boolean bl10 = false;
boolean bl11 = false;
switch (n) {
default: {
return super.onTransact(n, (Parcel)object, (Parcel)object2, n2);
}
case 209: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.notifyPackagesReplacedReceived(((Parcel)object).createStringArray());
((Parcel)object2).writeNoException();
return true;
}
case 208: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setRuntimePermissionsVersion(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 207: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getRuntimePermissionsVersion(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 206: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getModuleInfo(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ModuleInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 205: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstalledModules(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeTypedList(object);
return true;
}
case 204: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.sendDeviceCustomizationReadyBroadcast();
((Parcel)object2).writeNoException();
return true;
}
case 203: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageStateProtected(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 202: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getIncidentReportApproverPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 201: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemCaptionsServicePackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 200: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAppPredictionServicePackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 199: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getWellbeingPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 198: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAttentionServicePackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 197: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemTextClassifierPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 196: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasUidSigningCertificate(((Parcel)object).readInt(), ((Parcel)object).createByteArray(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 195: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasSigningCertificate(((Parcel)object).readString(), ((Parcel)object).createByteArray(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 194: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getHarmfulAppWarning(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
TextUtils.writeToParcel((CharSequence)object, (Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 193: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = ((Parcel)object).readString();
object4 = ((Parcel)object).readInt() != 0 ? TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel((Parcel)object) : null;
this.setHarmfulAppWarning((String)object3, (CharSequence)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 192: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = this.getArtManager();
((Parcel)object2).writeNoException();
object = object4;
if (object3 != null) {
object = object3.asBinder();
}
((Parcel)object2).writeStrongBinder((IBinder)object);
return true;
}
case 191: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppAndroidId(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 190: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppInstallerComponent();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 189: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppResolverSettingsComponent();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 188: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppResolverComponent();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 187: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deletePreloadsFileCache();
((Parcel)object2).writeNoException();
return true;
}
case 186: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.canRequestPackageInstalls(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 185: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getDeclaredSharedLibraries(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 184: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSharedLibraries(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 183: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getInstallReason(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 182: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageDeviceAdminOnAnyUser(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 181: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getChangedPackages(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ChangedPackages)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 180: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSharedSystemSharedLibraryPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 179: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getServicesSystemSharedLibraryPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 178: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setUpdateAvailable((String)object4, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 177: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setRequiredForSystemUser((String)object4, bl11) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 176: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isInstantApp(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 175: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppIcon(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((Bitmap)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 174: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.setInstantAppCookie(((Parcel)object).readString(), ((Parcel)object).createByteArray(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 173: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppCookie(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 172: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantApps(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 171: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPermissionControllerPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 170: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPermissionRevokedByPolicy(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 169: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.revokeDefaultPermissionsFromLuiApps(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 168: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToActiveLuiApp(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 167: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.revokeDefaultPermissionsFromDisabledTelephonyDataServices(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 166: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToEnabledTelephonyDataServices(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 165: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToEnabledImsServices(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 164: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToEnabledCarrierApps(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 163: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.removeOnPermissionsChangeListener(IOnPermissionsChangeListener.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 162: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.addOnPermissionsChangeListener(IOnPermissionsChangeListener.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 161: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
object = ((Parcel)object).readInt() != 0 ? KeySet.CREATOR.createFromParcel((Parcel)object) : null;
n = this.isPackageSignedByKeySetExactly((String)object4, (KeySet)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 160: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
object = ((Parcel)object).readInt() != 0 ? KeySet.CREATOR.createFromParcel((Parcel)object) : null;
n = this.isPackageSignedByKeySet((String)object4, (KeySet)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 159: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSigningKeySet(((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((KeySet)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 158: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getKeySetByAlias(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((KeySet)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 157: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getBlockUninstallForUser(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 156: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl2;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setBlockUninstallForUser((String)object4, bl11, ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 155: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = this.getPackageInstaller();
((Parcel)object2).writeNoException();
object = object3;
if (object4 != null) {
object = object4.asBinder();
}
((Parcel)object2).writeStrongBinder((IBinder)object);
return true;
}
case 154: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl3;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setSystemAppInstallState((String)object4, bl11, ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 153: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl4;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setSystemAppHiddenUntilInstalled((String)object4, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 152: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getApplicationHiddenSettingAsUser(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 151: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl5;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setApplicationHiddenSettingAsUser((String)object4, bl11, ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 150: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isStorageLow() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 149: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPermissionEnforced(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 148: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl6;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setPermissionEnforced((String)object4, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 147: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isDeviceUpgrading() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 146: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isOnlyCoreApps() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 145: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isFirstBoot() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 144: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getVerifierDeviceIdentity();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((VerifierDeviceIdentity)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 143: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getDefaultBrowserPackageName(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 142: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.setDefaultBrowserPackageName(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 141: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAllIntentFilters(((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 140: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getIntentFilterVerifications(((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 139: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.updateIntentVerificationStatus(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 138: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getIntentVerificationStatus(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 137: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.verifyIntentFilter(((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).createStringArrayList());
((Parcel)object2).writeNoException();
return true;
}
case 136: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.extendVerificationTimeout(((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readLong());
((Parcel)object2).writeNoException();
return true;
}
case 135: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.verifyPendingInstall(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 134: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.installExistingPackageAsUser(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).createStringArrayList());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 133: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getInstallLocation();
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 132: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.setInstallLocation(((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 131: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = ((Parcel)object).readInt() != 0 ? PermissionInfo.CREATOR.createFromParcel((Parcel)object) : null;
n = this.addPermissionAsync((PermissionInfo)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 130: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.movePrimaryStorage(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 129: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.movePackage(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 128: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.unregisterMoveCallback(IPackageMoveObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 127: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.registerMoveCallback(IPackageMoveObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 126: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getMoveStatus(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 125: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.reconcileSecondaryDexFiles(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 124: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.runBackgroundDexoptJob(((Parcel)object).createStringArrayList()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 123: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.forceDexOpt(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 122: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.dumpProfiles(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 121: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.compileLayouts(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 120: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = ((Parcel)object).readString();
object4 = ((Parcel)object).readString();
bl11 = bl7;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.performDexOptSecondary((String)object3, (String)object4, bl11) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 119: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = ((Parcel)object).readInt() != 0;
object3 = ((Parcel)object).readString();
bl = ((Parcel)object).readInt() != 0;
bl2 = ((Parcel)object).readInt() != 0;
n = this.performDexOptMode((String)object4, bl11, (String)object3, bl, bl2, ((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 118: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object2 = ((Parcel)object).readString();
object4 = ((Parcel)object).readString();
bl11 = bl8;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.registerDexModule((String)object2, (String)object4, bl11, IDexModuleRegisterCallback.Stub.asInterface(((Parcel)object).readStrongBinder()));
return true;
}
case 117: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.notifyDexLoad(((Parcel)object).readString(), ((Parcel)object).createStringArrayList(), ((Parcel)object).createStringArrayList(), ((Parcel)object).readString());
return true;
}
case 116: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.notifyPackageUse(((Parcel)object).readString(), ((Parcel)object).readInt());
return true;
}
case 115: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.updatePackagesIfNeeded();
((Parcel)object2).writeNoException();
return true;
}
case 114: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.performFstrimIfNeeded();
((Parcel)object2).writeNoException();
return true;
}
case 113: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasSystemUidErrors() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 112: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.systemReady();
((Parcel)object2).writeNoException();
return true;
}
case 111: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isSafeMode() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 110: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.enterSafeMode();
((Parcel)object2).writeNoException();
return true;
}
case 109: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasSystemFeature(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 108: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemAvailableFeatures();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 107: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemSharedLibraryNames();
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 106: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.getPackageSizeInfo(((Parcel)object).readString(), ((Parcel)object).readInt(), IPackageStatsObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 105: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearApplicationProfileData(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 104: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearApplicationUserData(((Parcel)object).readString(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 103: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deleteApplicationCacheFilesAsUser(((Parcel)object).readString(), ((Parcel)object).readInt(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 102: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deleteApplicationCacheFiles(((Parcel)object).readString(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 101: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
long l = ((Parcel)object).readLong();
n = ((Parcel)object).readInt();
object = ((Parcel)object).readInt() != 0 ? IntentSender.CREATOR.createFromParcel((Parcel)object) : null;
this.freeStorage((String)object4, l, n, (IntentSender)object);
((Parcel)object2).writeNoException();
return true;
}
case 100: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.freeStorageAndNotify(((Parcel)object).readString(), ((Parcel)object).readLong(), ((Parcel)object).readInt(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 99: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl9;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setPackageStoppedState((String)object4, bl11, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 98: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.flushPackageRestrictionsAsUser(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 97: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.logAppProcessStartIfNeeded(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 96: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getApplicationEnabledSetting(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 95: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setApplicationEnabledSetting(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 94: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
n = this.getComponentEnabledSetting((ComponentName)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 93: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.setComponentEnabledSetting((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 92: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.setHomeActivity((ComponentName)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 91: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = new ArrayList();
object4 = this.getHomeActivities((List<ResolveInfo>)object);
((Parcel)object2).writeNoException();
if (object4 != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object4).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
((Parcel)object2).writeTypedList(object);
return true;
}
case 90: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.restoreIntentFilterVerification(((Parcel)object).createByteArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 89: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getIntentFilterVerificationBackup(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 88: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.restoreDefaultApps(((Parcel)object).createByteArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 87: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getDefaultAppsBackup(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 86: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.restorePreferredActivities(((Parcel)object).createByteArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 85: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPreferredActivityBackup(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 84: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSuspendedPackageAppExtras(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PersistableBundle)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 83: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageSuspendedForUser(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 82: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getUnsuspendablePackagesForUser(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 81: {
((Parcel)object).enforceInterface(DESCRIPTOR);
String[] arrstring = ((Parcel)object).createStringArray();
bl11 = ((Parcel)object).readInt() != 0;
object4 = ((Parcel)object).readInt() != 0 ? PersistableBundle.CREATOR.createFromParcel((Parcel)object) : null;
object3 = ((Parcel)object).readInt() != 0 ? PersistableBundle.CREATOR.createFromParcel((Parcel)object) : null;
SuspendDialogInfo suspendDialogInfo = ((Parcel)object).readInt() != 0 ? SuspendDialogInfo.CREATOR.createFromParcel((Parcel)object) : null;
object = this.setPackagesSuspendedAsUser(arrstring, bl11, (PersistableBundle)object4, (PersistableBundle)object3, suspendDialogInfo, ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 80: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.setDistractingPackageRestrictionsAsUser(((Parcel)object).createStringArray(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 79: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearCrossProfileIntentFilters(((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 78: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
this.addCrossProfileIntentFilter((IntentFilter)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 77: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearPackagePersistentPreferredActivities(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 76: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
object3 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.addPersistentPreferredActivity((IntentFilter)object4, (ComponentName)object3, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 75: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = new ArrayList();
object4 = new ArrayList();
n = this.getPreferredActivities((List<IntentFilter>)object3, (List<ComponentName>)object4, ((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
((Parcel)object2).writeTypedList(object3);
((Parcel)object2).writeTypedList(object4);
return true;
}
case 74: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearPackagePreferredActivities(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 73: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
n = ((Parcel)object).readInt();
ComponentName[] arrcomponentName = ((Parcel)object).createTypedArray(ComponentName.CREATOR);
object3 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.replacePreferredActivity((IntentFilter)object4, n, arrcomponentName, (ComponentName)object3, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 72: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
n = ((Parcel)object).readInt();
ComponentName[] arrcomponentName = ((Parcel)object).createTypedArray(ComponentName.CREATOR);
object3 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.addPreferredActivity((IntentFilter)object4, n, arrcomponentName, (ComponentName)object3, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 71: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
String string2 = ((Parcel)object).readString();
n2 = ((Parcel)object).readInt();
object3 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
n = ((Parcel)object).readInt();
object = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.setLastChosenActivity((Intent)object4, string2, n2, (IntentFilter)object3, n, (ComponentName)object);
((Parcel)object2).writeNoException();
return true;
}
case 70: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getLastChosenActivity((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 69: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.resetApplicationPreferences(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 68: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstallerPackageName(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 67: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? VersionedPackage.CREATOR.createFromParcel((Parcel)object) : null;
this.deletePackageVersioned((VersionedPackage)object4, IPackageDeleteObserver2.Stub.asInterface(((Parcel)object).readStrongBinder()), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 66: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deletePackageAsUser(((Parcel)object).readString(), ((Parcel)object).readInt(), IPackageDeleteObserver.Stub.asInterface(((Parcel)object).readStrongBinder()), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 65: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setApplicationCategoryHint(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 64: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setInstallerPackageName(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 63: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = ((Parcel)object).readInt();
bl11 = bl10;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.finishPackageInstall(n, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 62: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.queryInstrumentation(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 61: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getInstrumentationInfo((ComponentName)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((InstrumentationInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 60: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.queryContentProviders(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 59: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).createStringArrayList();
object = ((Parcel)object).createTypedArrayList(ProviderInfo.CREATOR);
this.querySyncProviders((List<String>)object4, (List<ProviderInfo>)object);
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringList((List<String>)object4);
((Parcel)object2).writeTypedList(object);
return true;
}
case 58: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.resolveContentProvider(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ProviderInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 57: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPersistentApplications(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 56: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstalledApplications(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 55: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackagesHoldingPermissions(((Parcel)object).createStringArray(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 54: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstalledPackages(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 53: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentContentProviders((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 52: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentServices((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 51: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.resolveService((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 50: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentReceivers((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 49: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
Intent[] arrintent = ((Parcel)object).createTypedArray(Intent.CREATOR);
String[] arrstring = ((Parcel)object).createStringArray();
object3 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentActivityOptions((ComponentName)object4, arrintent, arrstring, (Intent)object3, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 48: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentActivities((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 47: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
n = this.canForwardTo((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 46: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.findPersistentPreferredActivity((Intent)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 45: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.resolveIntent((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 44: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAppOpPermissionPackages(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 43: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isUidPrivileged(((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 42: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getPrivateFlagsForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 41: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getFlagsForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 40: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getUidForSharedUser(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 39: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getNamesForUids(((Parcel)object).createIntArray());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 38: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getNameForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 37: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackagesForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 36: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAllPackages();
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringList((List<String>)object);
return true;
}
case 35: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkUidSignatures(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 34: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkSignatures(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 33: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isProtectedBroadcast(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 32: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.shouldShowRequestPermissionRationale(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 31: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.removeWhitelistedRestrictedPermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 30: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.addWhitelistedRestrictedPermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 29: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getWhitelistedRestrictedPermissions(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringList((List<String>)object);
return true;
}
case 28: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.updatePermissionFlagsForAllApps(((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 27: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
object3 = ((Parcel)object).readString();
n2 = ((Parcel)object).readInt();
n = ((Parcel)object).readInt();
bl11 = ((Parcel)object).readInt() != 0;
this.updatePermissionFlags((String)object4, (String)object3, n2, n, bl11, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 26: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getPermissionFlags(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 25: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.resetRuntimePermissions();
((Parcel)object2).writeNoException();
return true;
}
case 24: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.revokeRuntimePermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 23: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantRuntimePermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 22: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.removePermission(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 21: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = ((Parcel)object).readInt() != 0 ? PermissionInfo.CREATOR.createFromParcel((Parcel)object) : null;
n = this.addPermission((PermissionInfo)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 20: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkUidPermission(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 19: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkPermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 18: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getProviderInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ProviderInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 17: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getServiceInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ServiceInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 16: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getReceiverInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ActivityInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 15: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object3 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
n = this.activitySupportsIntent((ComponentName)object4, (Intent)object3, ((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 14: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getActivityInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ActivityInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 13: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getApplicationInfo(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ApplicationInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 12: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAllPermissionGroups(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 11: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPermissionGroupInfo(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PermissionGroupInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 10: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.queryPermissionsByGroup(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 9: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPermissionInfo(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PermissionInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 8: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.canonicalToCurrentPackageNames(((Parcel)object).createStringArray());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 7: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.currentToCanonicalPackageNames(((Parcel)object).createStringArray());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 6: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackageGids(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeIntArray((int[])object);
return true;
}
case 5: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getPackageUid(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 4: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? VersionedPackage.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getPackageInfoVersioned((VersionedPackage)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PackageInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 3: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackageInfo(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PackageInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 2: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageAvailable(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 1:
}
((Parcel)object).enforceInterface(DESCRIPTOR);
this.checkPackageStartable(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
((Parcel)object2).writeString(DESCRIPTOR);
return true;
}
private static class Proxy
implements IPackageManager {
public static IPackageManager sDefaultImpl;
private IBinder mRemote;
Proxy(IBinder iBinder) {
this.mRemote = iBinder;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean activitySupportsIntent(ComponentName componentName, Intent intent, String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (intent != null) {
parcel.writeInt(1);
intent.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString(string2);
if (!this.mRemote.transact(15, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().activitySupportsIntent(componentName, intent, string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void addCrossProfileIntentFilter(IntentFilter intentFilter, String string2, int n, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(78, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addCrossProfileIntentFilter(intentFilter, string2, n, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void addOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iOnPermissionsChangeListener != null ? iOnPermissionsChangeListener.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(162, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addOnPermissionsChangeListener(iOnPermissionsChangeListener);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean addPermission(PermissionInfo permissionInfo) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (permissionInfo != null) {
parcel.writeInt(1);
permissionInfo.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(21, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().addPermission(permissionInfo);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean addPermissionAsync(PermissionInfo permissionInfo) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (permissionInfo != null) {
parcel.writeInt(1);
permissionInfo.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(131, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().addPermissionAsync(permissionInfo);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void addPersistentPreferredActivity(IntentFilter intentFilter, ComponentName componentName, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(76, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addPersistentPreferredActivity(intentFilter, componentName, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void addPreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
parcel.writeTypedArray((Parcelable[])arrcomponentName, 0);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n2);
if (!this.mRemote.transact(72, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addPreferredActivity(intentFilter, n, arrcomponentName, componentName, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean addWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeString(string3);
parcel2.writeInt(n);
parcel2.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(30, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().addWhitelistedRestrictedPermission(string2, string3, n, n2);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public IBinder asBinder() {
return this.mRemote;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean canForwardTo(Intent intent, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (intent != null) {
parcel.writeInt(1);
intent.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(47, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().canForwardTo(intent, string2, n, n2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public boolean canRequestPackageInstalls(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(186, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().canRequestPackageInstalls(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public String[] canonicalToCurrentPackageNames(String[] arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
if (!this.mRemote.transact(8, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().canonicalToCurrentPackageNames(arrstring);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void checkPackageStartable(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(1, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().checkPackageStartable(string2, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkPermission(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(19, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().checkPermission(string2, string3, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkSignatures(String string2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
if (!this.mRemote.transact(34, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().checkSignatures(string2, string3);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkUidPermission(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(20, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().checkUidPermission(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkUidSignatures(int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(35, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().checkUidSignatures(n, n2);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearApplicationProfileData(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(105, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearApplicationProfileData(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void clearApplicationUserData(String string2, IPackageDataObserver iPackageDataObserver, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
parcel.writeInt(n);
if (!this.mRemote.transact(104, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearApplicationUserData(string2, iPackageDataObserver, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearCrossProfileIntentFilters(int n, String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeString(string2);
if (!this.mRemote.transact(79, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearCrossProfileIntentFilters(n, string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearPackagePersistentPreferredActivities(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(77, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearPackagePersistentPreferredActivities(string2, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearPackagePreferredActivities(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(74, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearPackagePreferredActivities(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean compileLayouts(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(121, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().compileLayouts(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public String[] currentToCanonicalPackageNames(String[] arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
if (!this.mRemote.transact(7, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().currentToCanonicalPackageNames(arrstring);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deleteApplicationCacheFiles(String string2, IPackageDataObserver iPackageDataObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(102, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deleteApplicationCacheFiles(string2, iPackageDataObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deleteApplicationCacheFilesAsUser(String string2, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(103, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deleteApplicationCacheFilesAsUser(string2, n, iPackageDataObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deletePackageAsUser(String string2, int n, IPackageDeleteObserver iPackageDeleteObserver, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
IBinder iBinder = iPackageDeleteObserver != null ? iPackageDeleteObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(66, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deletePackageAsUser(string2, n, iPackageDeleteObserver, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deletePackageVersioned(VersionedPackage versionedPackage, IPackageDeleteObserver2 iPackageDeleteObserver2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (versionedPackage != null) {
parcel.writeInt(1);
versionedPackage.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
IBinder iBinder = iPackageDeleteObserver2 != null ? iPackageDeleteObserver2.asBinder() : null;
parcel.writeStrongBinder(iBinder);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(67, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deletePackageVersioned(versionedPackage, iPackageDeleteObserver2, n, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void deletePreloadsFileCache() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(187, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deletePreloadsFileCache();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void dumpProfiles(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(122, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().dumpProfiles(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void enterSafeMode() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(110, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().enterSafeMode();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void extendVerificationTimeout(int n, int n2, long l) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeLong(l);
if (!this.mRemote.transact(136, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().extendVerificationTimeout(n, n2, l);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo findPersistentPreferredActivity(Intent parcelable, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
if (!this.mRemote.transact(46, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().findPersistentPreferredActivity((Intent)parcelable, (int)var2_7);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void finishPackageInstall(int n, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
int n2 = bl ? 1 : 0;
try {
parcel.writeInt(n2);
if (!this.mRemote.transact(63, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().finishPackageInstall(n, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void flushPackageRestrictionsAsUser(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(98, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().flushPackageRestrictionsAsUser(n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void forceDexOpt(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(123, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().forceDexOpt(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void freeStorage(String string2, long l, int n, IntentSender intentSender) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeLong(l);
parcel.writeInt(n);
if (intentSender != null) {
parcel.writeInt(1);
intentSender.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(101, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().freeStorage(string2, l, n, intentSender);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void freeStorageAndNotify(String string2, long l, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeLong(l);
parcel.writeInt(n);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(100, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().freeStorageAndNotify(string2, l, n, iPackageDataObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ActivityInfo getActivityInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(14, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ActivityInfo activityInfo = Stub.getDefaultImpl().getActivityInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return activityInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ActivityInfo activityInfo = ActivityInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public ParceledListSlice getAllIntentFilters(String parceledListSlice) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
if (this.mRemote.transact(141, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getAllIntentFilters((String)((Object)parceledListSlice));
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public List<String> getAllPackages() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(36, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
List<String> list = Stub.getDefaultImpl().getAllPackages();
return list;
}
parcel2.readException();
ArrayList<String> arrayList = parcel2.createStringArrayList();
return arrayList;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getAllPermissionGroups(int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (this.mRemote.transact(12, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getAllPermissionGroups(n);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
ParceledListSlice parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public String[] getAppOpPermissionPackages(String arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)arrstring);
if (!this.mRemote.transact(44, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().getAppOpPermissionPackages((String)arrstring);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getAppPredictionServicePackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(200, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getAppPredictionServicePackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getApplicationEnabledSetting(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(96, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getApplicationEnabledSetting(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean getApplicationHiddenSettingAsUser(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(152, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().getApplicationHiddenSettingAsUser(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public ApplicationInfo getApplicationInfo(String object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(13, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getApplicationInfo((String)object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? ApplicationInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public IArtManager getArtManager() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(192, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
IArtManager iArtManager = Stub.getDefaultImpl().getArtManager();
return iArtManager;
}
parcel2.readException();
IArtManager iArtManager = IArtManager.Stub.asInterface(parcel2.readStrongBinder());
return iArtManager;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getAttentionServicePackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(198, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getAttentionServicePackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean getBlockUninstallForUser(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(157, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().getBlockUninstallForUser(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public ChangedPackages getChangedPackages(int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeInt(n);
parcel2.writeInt(n2);
if (this.mRemote.transact(181, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ChangedPackages changedPackages = Stub.getDefaultImpl().getChangedPackages(n, n2);
parcel.recycle();
parcel2.recycle();
return changedPackages;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ChangedPackages changedPackages = parcel.readInt() != 0 ? ChangedPackages.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return changedPackages;
}
@Override
public int getComponentEnabledSetting(ComponentName componentName, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(94, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getComponentEnabledSetting(componentName, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getDeclaredSharedLibraries(String parceledListSlice, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(185, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getDeclaredSharedLibraries((String)((Object)parceledListSlice), n, n2);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public byte[] getDefaultAppsBackup(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(87, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
byte[] arrby = Stub.getDefaultImpl().getDefaultAppsBackup(n);
return arrby;
}
parcel2.readException();
byte[] arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getDefaultBrowserPackageName(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(143, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getDefaultBrowserPackageName(n);
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getFlagsForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(41, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getFlagsForUid(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public CharSequence getHarmfulAppWarning(String charSequence, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)charSequence);
parcel2.writeInt(n);
if (this.mRemote.transact(194, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
charSequence = Stub.getDefaultImpl().getHarmfulAppWarning((String)charSequence, n);
parcel.recycle();
parcel2.recycle();
return charSequence;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
charSequence = parcel.readInt() != 0 ? TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return charSequence;
}
@Override
public ComponentName getHomeActivities(List<ResolveInfo> object) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(91, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
object = Stub.getDefaultImpl().getHomeActivities((List<ResolveInfo>)object);
return object;
}
parcel2.readException();
ComponentName componentName = parcel2.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel2) : null;
parcel2.readTypedList(object, ResolveInfo.CREATOR);
return componentName;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getIncidentReportApproverPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(202, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getIncidentReportApproverPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getInstallLocation() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(133, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().getInstallLocation();
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getInstallReason(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(183, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getInstallReason(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getInstalledApplications(int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeInt(n);
parcel2.writeInt(n2);
if (this.mRemote.transact(56, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getInstalledApplications(n, n2);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ParceledListSlice parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public List<ModuleInfo> getInstalledModules(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(205, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
List<ModuleInfo> list = Stub.getDefaultImpl().getInstalledModules(n);
return list;
}
parcel2.readException();
ArrayList<ModuleInfo> arrayList = parcel2.createTypedArrayList(ModuleInfo.CREATOR);
return arrayList;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getInstalledPackages(int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeInt(n);
parcel2.writeInt(n2);
if (this.mRemote.transact(54, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getInstalledPackages(n, n2);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ParceledListSlice parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public String getInstallerPackageName(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(68, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
string2 = Stub.getDefaultImpl().getInstallerPackageName(string2);
return string2;
}
parcel2.readException();
string2 = parcel2.readString();
return string2;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getInstantAppAndroidId(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(191, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
string2 = Stub.getDefaultImpl().getInstantAppAndroidId(string2, n);
return string2;
}
parcel2.readException();
string2 = parcel2.readString();
return string2;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public byte[] getInstantAppCookie(String arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(173, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrby = Stub.getDefaultImpl().getInstantAppCookie((String)arrby, n);
return arrby;
}
parcel2.readException();
arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public Bitmap getInstantAppIcon(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(175, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getInstantAppIcon((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? Bitmap.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public ComponentName getInstantAppInstallerComponent() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(190, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ComponentName componentName = Stub.getDefaultImpl().getInstantAppInstallerComponent();
parcel.recycle();
parcel2.recycle();
return componentName;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ComponentName componentName = parcel.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return componentName;
}
@Override
public ComponentName getInstantAppResolverComponent() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(188, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ComponentName componentName = Stub.getDefaultImpl().getInstantAppResolverComponent();
parcel.recycle();
parcel2.recycle();
return componentName;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ComponentName componentName = parcel.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return componentName;
}
@Override
public ComponentName getInstantAppResolverSettingsComponent() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(189, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ComponentName componentName = Stub.getDefaultImpl().getInstantAppResolverSettingsComponent();
parcel.recycle();
parcel2.recycle();
return componentName;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ComponentName componentName = parcel.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return componentName;
}
@Override
public ParceledListSlice getInstantApps(int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (this.mRemote.transact(172, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getInstantApps(n);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
ParceledListSlice parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public InstrumentationInfo getInstrumentationInfo(ComponentName parcelable, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
if (!this.mRemote.transact(61, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
InstrumentationInfo instrumentationInfo = Stub.getDefaultImpl().getInstrumentationInfo((ComponentName)parcelable, (int)var2_7);
parcel2.recycle();
parcel.recycle();
return instrumentationInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
InstrumentationInfo instrumentationInfo = InstrumentationInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public byte[] getIntentFilterVerificationBackup(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(89, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
byte[] arrby = Stub.getDefaultImpl().getIntentFilterVerificationBackup(n);
return arrby;
}
parcel2.readException();
byte[] arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getIntentFilterVerifications(String parceledListSlice) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
if (this.mRemote.transact(140, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getIntentFilterVerifications((String)((Object)parceledListSlice));
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public int getIntentVerificationStatus(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(138, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getIntentVerificationStatus(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
public String getInterfaceDescriptor() {
return Stub.DESCRIPTOR;
}
@Override
public KeySet getKeySetByAlias(String object, String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeString(string2);
if (this.mRemote.transact(158, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getKeySetByAlias((String)object, string2);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? KeySet.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo getLastChosenActivity(Intent parcelable, String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(70, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().getLastChosenActivity((Intent)parcelable, (String)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public ModuleInfo getModuleInfo(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(206, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getModuleInfo((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? ModuleInfo.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public int getMoveStatus(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(126, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getMoveStatus(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getNameForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(38, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getNameForUid(n);
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getNamesForUids(int[] arrobject) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeIntArray((int[])arrobject);
if (!this.mRemote.transact(39, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrobject = Stub.getDefaultImpl().getNamesForUids((int[])arrobject);
return arrobject;
}
parcel2.readException();
arrobject = parcel2.createStringArray();
return arrobject;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int[] getPackageGids(String arrn, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)arrn);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(6, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrn = Stub.getDefaultImpl().getPackageGids((String)arrn, n, n2);
return arrn;
}
parcel2.readException();
arrn = parcel2.createIntArray();
return arrn;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public PackageInfo getPackageInfo(String object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(3, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPackageInfo((String)object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? PackageInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public PackageInfo getPackageInfoVersioned(VersionedPackage parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((VersionedPackage)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(4, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
PackageInfo packageInfo = Stub.getDefaultImpl().getPackageInfoVersioned((VersionedPackage)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return packageInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
PackageInfo packageInfo = PackageInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public IPackageInstaller getPackageInstaller() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(155, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
IPackageInstaller iPackageInstaller = Stub.getDefaultImpl().getPackageInstaller();
return iPackageInstaller;
}
parcel2.readException();
IPackageInstaller iPackageInstaller = IPackageInstaller.Stub.asInterface(parcel2.readStrongBinder());
return iPackageInstaller;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void getPackageSizeInfo(String string2, int n, IPackageStatsObserver iPackageStatsObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
IBinder iBinder = iPackageStatsObserver != null ? iPackageStatsObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(106, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().getPackageSizeInfo(string2, n, iPackageStatsObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getPackageUid(String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(5, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getPackageUid(string2, n, n2);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getPackagesForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(37, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String[] arrstring = Stub.getDefaultImpl().getPackagesForUid(n);
return arrstring;
}
parcel2.readException();
String[] arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getPackagesHoldingPermissions(String[] object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray((String[])object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(55, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPackagesHoldingPermissions((String[])object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public String getPermissionControllerPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(171, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getPermissionControllerPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getPermissionFlags(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(26, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getPermissionFlags(string2, string3, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public PermissionGroupInfo getPermissionGroupInfo(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(11, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPermissionGroupInfo((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? PermissionGroupInfo.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public PermissionInfo getPermissionInfo(String object, String string2, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeString(string2);
parcel.writeInt(n);
if (this.mRemote.transact(9, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPermissionInfo((String)object, string2, n);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? PermissionInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public ParceledListSlice getPersistentApplications(int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (this.mRemote.transact(57, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getPersistentApplications(n);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
ParceledListSlice parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public int getPreferredActivities(List<IntentFilter> list, List<ComponentName> list2, String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(75, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().getPreferredActivities(list, list2, string2);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
parcel2.readTypedList(list, IntentFilter.CREATOR);
parcel2.readTypedList(list2, ComponentName.CREATOR);
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public byte[] getPreferredActivityBackup(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(85, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
byte[] arrby = Stub.getDefaultImpl().getPreferredActivityBackup(n);
return arrby;
}
parcel2.readException();
byte[] arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getPrivateFlagsForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(42, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getPrivateFlagsForUid(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ProviderInfo getProviderInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(18, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ProviderInfo providerInfo = Stub.getDefaultImpl().getProviderInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return providerInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ProviderInfo providerInfo = ProviderInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ActivityInfo getReceiverInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(16, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ActivityInfo activityInfo = Stub.getDefaultImpl().getReceiverInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return activityInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ActivityInfo activityInfo = ActivityInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public int getRuntimePermissionsVersion(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(207, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getRuntimePermissionsVersion(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ServiceInfo getServiceInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(17, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ServiceInfo serviceInfo = Stub.getDefaultImpl().getServiceInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return serviceInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ServiceInfo serviceInfo = ServiceInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public String getServicesSystemSharedLibraryPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(179, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getServicesSystemSharedLibraryPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getSharedLibraries(String parceledListSlice, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(184, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getSharedLibraries((String)((Object)parceledListSlice), n, n2);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public String getSharedSystemSharedLibraryPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(180, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getSharedSystemSharedLibraryPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public KeySet getSigningKeySet(String object) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
if (this.mRemote.transact(159, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getSigningKeySet((String)object);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? KeySet.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public PersistableBundle getSuspendedPackageAppExtras(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(84, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getSuspendedPackageAppExtras((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? PersistableBundle.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public ParceledListSlice getSystemAvailableFeatures() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(108, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getSystemAvailableFeatures();
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ParceledListSlice parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public String getSystemCaptionsServicePackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(201, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getSystemCaptionsServicePackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getSystemSharedLibraryNames() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(107, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String[] arrstring = Stub.getDefaultImpl().getSystemSharedLibraryNames();
return arrstring;
}
parcel2.readException();
String[] arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getSystemTextClassifierPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(197, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getSystemTextClassifierPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getUidForSharedUser(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(40, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().getUidForSharedUser(string2);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getUnsuspendablePackagesForUser(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(82, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().getUnsuspendablePackagesForUser(arrstring, n);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(144, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
VerifierDeviceIdentity verifierDeviceIdentity = Stub.getDefaultImpl().getVerifierDeviceIdentity();
parcel.recycle();
parcel2.recycle();
return verifierDeviceIdentity;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
VerifierDeviceIdentity verifierDeviceIdentity = parcel.readInt() != 0 ? VerifierDeviceIdentity.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return verifierDeviceIdentity;
}
@Override
public String getWellbeingPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(199, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getWellbeingPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public List<String> getWhitelistedRestrictedPermissions(String list, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)list));
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(29, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
list = Stub.getDefaultImpl().getWhitelistedRestrictedPermissions((String)((Object)list), n, n2);
return list;
}
parcel2.readException();
list = parcel2.createStringArrayList();
return list;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToActiveLuiApp(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(168, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToActiveLuiApp(string2, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToEnabledCarrierApps(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(164, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToEnabledCarrierApps(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToEnabledImsServices(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(165, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToEnabledImsServices(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToEnabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(166, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToEnabledTelephonyDataServices(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantRuntimePermission(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(23, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantRuntimePermission(string2, string3, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean hasSigningCertificate(String string2, byte[] arrby, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(195, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasSigningCertificate(string2, arrby, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean hasSystemFeature(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(109, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasSystemFeature(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean hasSystemUidErrors() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(113, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasSystemUidErrors();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean hasUidSigningCertificate(int n, byte[] arrby, int n2) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeByteArray(arrby);
parcel.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(196, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasUidSigningCertificate(n, arrby, n2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public int installExistingPackageAsUser(String string2, int n, int n2, int n3, List<String> list) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
parcel.writeStringList(list);
if (!this.mRemote.transact(134, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().installExistingPackageAsUser(string2, n, n2, n3, list);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean isDeviceUpgrading() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(147, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isDeviceUpgrading();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isFirstBoot() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(145, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isFirstBoot();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isInstantApp(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(176, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isInstantApp(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isOnlyCoreApps() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(146, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isOnlyCoreApps();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPackageAvailable(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(2, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageAvailable(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPackageDeviceAdminOnAnyUser(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(182, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageDeviceAdminOnAnyUser(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean isPackageSignedByKeySet(String string2, KeySet keySet) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
boolean bl = true;
if (keySet != null) {
parcel.writeInt(1);
keySet.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(160, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().isPackageSignedByKeySet(string2, keySet);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean isPackageSignedByKeySetExactly(String string2, KeySet keySet) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
boolean bl = true;
if (keySet != null) {
parcel.writeInt(1);
keySet.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(161, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().isPackageSignedByKeySetExactly(string2, keySet);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public boolean isPackageStateProtected(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(203, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageStateProtected(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPackageSuspendedForUser(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(83, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageSuspendedForUser(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPermissionEnforced(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(149, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPermissionEnforced(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean isPermissionRevokedByPolicy(String string2, String string3, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(170, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPermissionRevokedByPolicy(string2, string3, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean isProtectedBroadcast(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(33, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isProtectedBroadcast(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean isSafeMode() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(111, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isSafeMode();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isStorageLow() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(150, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isStorageLow();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isUidPrivileged(int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(43, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isUidPrivileged(n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void logAppProcessStartIfNeeded(String string2, int n, String string3, String string4, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeString(string3);
parcel.writeString(string4);
parcel.writeInt(n2);
if (!this.mRemote.transact(97, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().logAppProcessStartIfNeeded(string2, n, string3, string4, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int movePackage(String string2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
if (!this.mRemote.transact(129, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().movePackage(string2, string3);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int movePrimaryStorage(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(130, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().movePrimaryStorage(string2);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void notifyDexLoad(String string2, List<String> list, List<String> list2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeStringList(list);
parcel.writeStringList(list2);
parcel.writeString(string3);
if (!this.mRemote.transact(117, parcel, null, 1) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().notifyDexLoad(string2, list, list2, string3);
return;
}
return;
}
finally {
parcel.recycle();
}
}
@Override
public void notifyPackageUse(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(116, parcel, null, 1) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().notifyPackageUse(string2, n);
return;
}
return;
}
finally {
parcel.recycle();
}
}
@Override
public void notifyPackagesReplacedReceived(String[] arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
if (!this.mRemote.transact(209, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().notifyPackagesReplacedReceived(arrstring);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public boolean performDexOptMode(String string2, boolean bl, String string3, boolean bl2, boolean bl3, String string4) throws RemoteException {
Parcel parcel;
void var1_7;
Parcel parcel2;
block12 : {
int n;
boolean bl4;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
try {
parcel2.writeString(string2);
bl4 = true;
n = bl ? 1 : 0;
parcel2.writeInt(n);
}
catch (Throwable throwable) {}
try {
parcel2.writeString(string3);
n = bl2 ? 1 : 0;
parcel2.writeInt(n);
n = bl3 ? 1 : 0;
parcel2.writeInt(n);
}
catch (Throwable throwable) {}
try {
parcel2.writeString(string4);
}
catch (Throwable throwable) {
break block12;
}
try {
if (!this.mRemote.transact(119, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().performDexOptMode(string2, bl, string3, bl2, bl3, string4);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
bl = n != 0 ? bl4 : false;
parcel.recycle();
parcel2.recycle();
return bl;
}
catch (Throwable throwable) {}
break block12;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_7;
}
@Override
public boolean performDexOptSecondary(String string2, String string3, boolean bl) throws RemoteException {
Parcel parcel;
int n;
boolean bl2;
Parcel parcel2;
block4 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
bl2 = true;
n = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n);
if (this.mRemote.transact(120, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().performDexOptSecondary(string2, string3, bl);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void performFstrimIfNeeded() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(114, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().performFstrimIfNeeded();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice queryContentProviders(String parceledListSlice, int n, int n2, String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)((Object)parceledListSlice));
parcel2.writeInt(n);
parcel2.writeInt(n2);
parcel2.writeString(string2);
if (this.mRemote.transact(60, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().queryContentProviders((String)((Object)parceledListSlice), n, n2, string2);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public ParceledListSlice queryInstrumentation(String parceledListSlice, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)((Object)parceledListSlice));
parcel2.writeInt(n);
if (this.mRemote.transact(62, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().queryInstrumentation((String)((Object)parceledListSlice), n);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentActivities(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(48, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentActivities((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public ParceledListSlice queryIntentActivityOptions(ComponentName parcelable, Intent[] arrintent, String[] arrstring, Intent intent, String string2, int n, int n2) throws RemoteException {
Parcel parcel;
void var1_10;
Parcel parcel2;
block16 : {
void var4_13;
void var3_12;
void var2_11;
block15 : {
block14 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
break block14;
}
parcel.writeInt(0);
}
try {
parcel.writeTypedArray((Parcelable[])var2_11, 0);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel.writeStringArray((String[])var3_12);
if (var4_13 != null) {
parcel.writeInt(1);
var4_13.writeToParcel(parcel, 0);
break block15;
}
parcel.writeInt(0);
}
catch (Throwable throwable) {}
}
try {
void var5_14;
void var6_15;
void var1_5;
void var7_16;
parcel.writeString((String)var5_14);
parcel.writeInt((int)var6_15);
parcel.writeInt((int)var7_16);
if (!this.mRemote.transact(49, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentActivityOptions((ComponentName)parcelable, (Intent[])var2_11, (String[])var3_12, (Intent)var4_13, (String)var5_14, (int)var6_15, (int)var7_16);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {}
break block16;
catch (Throwable throwable) {
// empty catch block
}
}
parcel2.recycle();
parcel.recycle();
throw var1_10;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentContentProviders(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(53, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentContentProviders((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentReceivers(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(50, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentReceivers((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentServices(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(52, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentServices((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public ParceledListSlice queryPermissionsByGroup(String parceledListSlice, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)((Object)parceledListSlice));
parcel2.writeInt(n);
if (this.mRemote.transact(10, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().queryPermissionsByGroup((String)((Object)parceledListSlice), n);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public void querySyncProviders(List<String> list, List<ProviderInfo> list2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringList(list);
parcel.writeTypedList(list2);
if (!this.mRemote.transact(59, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().querySyncProviders(list, list2);
return;
}
parcel2.readException();
parcel2.readStringList(list);
parcel2.readTypedList(list2, ProviderInfo.CREATOR);
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void reconcileSecondaryDexFiles(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(125, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().reconcileSecondaryDexFiles(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void registerDexModule(String string2, String string3, boolean bl, IDexModuleRegisterCallback iDexModuleRegisterCallback) throws RemoteException {
Parcel parcel = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
int n = bl ? 1 : 0;
parcel.writeInt(n);
IBinder iBinder = iDexModuleRegisterCallback != null ? iDexModuleRegisterCallback.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (this.mRemote.transact(118, parcel, null, 1)) return;
if (Stub.getDefaultImpl() == null) return;
Stub.getDefaultImpl().registerDexModule(string2, string3, bl, iDexModuleRegisterCallback);
return;
}
finally {
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void registerMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iPackageMoveObserver != null ? iPackageMoveObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(127, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().registerMoveCallback(iPackageMoveObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void removeOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iOnPermissionsChangeListener != null ? iOnPermissionsChangeListener.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(163, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().removeOnPermissionsChangeListener(iOnPermissionsChangeListener);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void removePermission(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(22, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().removePermission(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean removeWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeString(string3);
parcel2.writeInt(n);
parcel2.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(31, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().removeWhitelistedRestrictedPermission(string2, string3, n, n2);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public void replacePreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
parcel.writeTypedArray((Parcelable[])arrcomponentName, 0);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n2);
if (!this.mRemote.transact(73, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().replacePreferredActivity(intentFilter, n, arrcomponentName, componentName, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void resetApplicationPreferences(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(69, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().resetApplicationPreferences(n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void resetRuntimePermissions() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(25, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().resetRuntimePermissions();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ProviderInfo resolveContentProvider(String object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(58, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().resolveContentProvider((String)object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? ProviderInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo resolveIntent(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(45, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().resolveIntent((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo resolveService(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(51, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().resolveService((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void restoreDefaultApps(byte[] arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(88, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().restoreDefaultApps(arrby, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void restoreIntentFilterVerification(byte[] arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(90, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().restoreIntentFilterVerification(arrby, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void restorePreferredActivities(byte[] arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(86, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().restorePreferredActivities(arrby, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void revokeDefaultPermissionsFromDisabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(167, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().revokeDefaultPermissionsFromDisabledTelephonyDataServices(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void revokeDefaultPermissionsFromLuiApps(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(169, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().revokeDefaultPermissionsFromLuiApps(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void revokeRuntimePermission(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(24, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().revokeRuntimePermission(string2, string3, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean runBackgroundDexoptJob(List<String> list) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringList(list);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(124, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().runBackgroundDexoptJob(list);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void sendDeviceCustomizationReadyBroadcast() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(204, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().sendDeviceCustomizationReadyBroadcast();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setApplicationCategoryHint(String string2, int n, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeString(string3);
if (!this.mRemote.transact(65, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setApplicationCategoryHint(string2, n, string3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setApplicationEnabledSetting(String string2, int n, int n2, int n3, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
parcel.writeString(string3);
if (!this.mRemote.transact(95, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setApplicationEnabledSetting(string2, n, n2, n3, string3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setApplicationHiddenSettingAsUser(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel;
boolean bl2;
Parcel parcel2;
block4 : {
int n2;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
bl2 = true;
n2 = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n2);
parcel.writeInt(n);
if (this.mRemote.transact(151, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setApplicationHiddenSettingAsUser(string2, bl, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean setBlockUninstallForUser(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel;
boolean bl2;
Parcel parcel2;
block4 : {
int n2;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
bl2 = true;
n2 = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n2);
parcel.writeInt(n);
if (this.mRemote.transact(156, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setBlockUninstallForUser(string2, bl, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void setComponentEnabledSetting(ComponentName componentName, int n, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(93, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setComponentEnabledSetting(componentName, n, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setDefaultBrowserPackageName(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(142, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().setDefaultBrowserPackageName(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public String[] setDistractingPackageRestrictionsAsUser(String[] arrstring, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(80, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().setDistractingPackageRestrictionsAsUser(arrstring, n, n2);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setHarmfulAppWarning(String string2, CharSequence charSequence, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (charSequence != null) {
parcel.writeInt(1);
TextUtils.writeToParcel(charSequence, parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(193, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setHarmfulAppWarning(string2, charSequence, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setHomeActivity(ComponentName componentName, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(92, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setHomeActivity(componentName, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setInstallLocation(int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(132, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().setInstallLocation(n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void setInstallerPackageName(String string2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
if (!this.mRemote.transact(64, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setInstallerPackageName(string2, string3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setInstantAppCookie(String string2, byte[] arrby, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(174, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().setInstantAppCookie(string2, arrby, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public void setLastChosenActivity(Intent intent, String string2, int n, IntentFilter intentFilter, int n2, ComponentName componentName) throws RemoteException {
Parcel parcel;
Parcel parcel2;
void var1_6;
block16 : {
block15 : {
block14 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (intent != null) {
parcel2.writeInt(1);
intent.writeToParcel(parcel2, 0);
break block14;
}
parcel2.writeInt(0);
}
try {
parcel2.writeString(string2);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeInt(n);
if (intentFilter != null) {
parcel2.writeInt(1);
intentFilter.writeToParcel(parcel2, 0);
break block15;
}
parcel2.writeInt(0);
}
catch (Throwable throwable) {}
}
try {
parcel2.writeInt(n2);
if (componentName != null) {
parcel2.writeInt(1);
componentName.writeToParcel(parcel2, 0);
} else {
parcel2.writeInt(0);
}
if (!this.mRemote.transact(71, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setLastChosenActivity(intent, string2, n, intentFilter, n2, componentName);
parcel.recycle();
parcel2.recycle();
return;
}
parcel.readException();
parcel.recycle();
parcel2.recycle();
return;
}
catch (Throwable throwable) {}
break block16;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_6;
}
@Override
public void setPackageStoppedState(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n2 = bl ? 1 : 0;
try {
parcel.writeInt(n2);
parcel.writeInt(n);
if (!this.mRemote.transact(99, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setPackageStoppedState(string2, bl, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public String[] setPackagesSuspendedAsUser(String[] arrstring, boolean bl, PersistableBundle persistableBundle, PersistableBundle persistableBundle2, SuspendDialogInfo suspendDialogInfo, String string2, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
void var1_5;
block14 : {
block13 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
try {
parcel2.writeStringArray(arrstring);
int n2 = bl ? 1 : 0;
parcel2.writeInt(n2);
if (persistableBundle != null) {
parcel2.writeInt(1);
persistableBundle.writeToParcel(parcel2, 0);
} else {
parcel2.writeInt(0);
}
if (persistableBundle2 != null) {
parcel2.writeInt(1);
persistableBundle2.writeToParcel(parcel2, 0);
} else {
parcel2.writeInt(0);
}
if (suspendDialogInfo != null) {
parcel2.writeInt(1);
suspendDialogInfo.writeToParcel(parcel2, 0);
break block13;
}
parcel2.writeInt(0);
}
catch (Throwable throwable) {}
}
try {
parcel2.writeString(string2);
parcel2.writeInt(n);
if (!this.mRemote.transact(81, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().setPackagesSuspendedAsUser(arrstring, bl, persistableBundle, persistableBundle2, suspendDialogInfo, string2, n);
parcel.recycle();
parcel2.recycle();
return arrstring;
}
parcel.readException();
arrstring = parcel.createStringArray();
parcel.recycle();
parcel2.recycle();
return arrstring;
}
catch (Throwable throwable) {}
break block14;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_5;
}
@Override
public void setPermissionEnforced(String string2, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n = bl ? 1 : 0;
try {
parcel.writeInt(n);
if (!this.mRemote.transact(148, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setPermissionEnforced(string2, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setRequiredForSystemUser(String string2, boolean bl) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl2;
int n;
block4 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
bl2 = true;
n = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
parcel2.writeInt(n);
if (this.mRemote.transact(177, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setRequiredForSystemUser(string2, bl);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
bl = n != 0 ? bl2 : false;
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public void setRuntimePermissionsVersion(int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(208, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setRuntimePermissionsVersion(n, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setSystemAppHiddenUntilInstalled(String string2, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n = bl ? 1 : 0;
try {
parcel.writeInt(n);
if (!this.mRemote.transact(153, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setSystemAppHiddenUntilInstalled(string2, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setSystemAppInstallState(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel;
boolean bl2;
Parcel parcel2;
block4 : {
int n2;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
bl2 = true;
n2 = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n2);
parcel.writeInt(n);
if (this.mRemote.transact(154, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setSystemAppInstallState(string2, bl, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void setUpdateAvailable(String string2, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n = bl ? 1 : 0;
try {
parcel.writeInt(n);
if (!this.mRemote.transact(178, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setUpdateAvailable(string2, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean shouldShowRequestPermissionRationale(String string2, String string3, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(32, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().shouldShowRequestPermissionRationale(string2, string3, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void systemReady() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(112, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().systemReady();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void unregisterMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iPackageMoveObserver != null ? iPackageMoveObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(128, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().unregisterMoveCallback(iPackageMoveObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean updateIntentVerificationStatus(String string2, int n, int n2) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(139, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().updateIntentVerificationStatus(string2, n, n2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void updatePackagesIfNeeded() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(115, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().updatePackagesIfNeeded();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public void updatePermissionFlags(String string2, String string3, int n, int n2, boolean bl, int n3) throws RemoteException {
Parcel parcel;
void var1_9;
Parcel parcel2;
block16 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
try {
parcel2.writeString(string2);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeString(string3);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeInt(n);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeInt(n2);
int n4 = bl ? 1 : 0;
parcel2.writeInt(n4);
}
catch (Throwable throwable) {}
try {
parcel2.writeInt(n3);
}
catch (Throwable throwable) {
break block16;
}
try {
if (!this.mRemote.transact(27, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().updatePermissionFlags(string2, string3, n, n2, bl, n3);
parcel.recycle();
parcel2.recycle();
return;
}
parcel.readException();
parcel.recycle();
parcel2.recycle();
return;
}
catch (Throwable throwable) {}
break block16;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_9;
}
@Override
public void updatePermissionFlagsForAllApps(int n, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(28, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().updatePermissionFlagsForAllApps(n, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void verifyIntentFilter(int n, int n2, List<String> list) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeStringList(list);
if (!this.mRemote.transact(137, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().verifyIntentFilter(n, n2, list);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void verifyPendingInstall(int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(135, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().verifyPendingInstall(n, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
}
}
}
| UTF-8 | Java | 455,589 | java | IPackageManager.java | Java | [] | null | [] | /*
* Decompiled with CFR 0.145.
*/
package android.content.pm;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ChangedPackages;
import android.content.pm.IDexModuleRegisterCallback;
import android.content.pm.IOnPermissionsChangeListener;
import android.content.pm.IPackageDataObserver;
import android.content.pm.IPackageDeleteObserver;
import android.content.pm.IPackageDeleteObserver2;
import android.content.pm.IPackageInstaller;
import android.content.pm.IPackageMoveObserver;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.InstrumentationInfo;
import android.content.pm.KeySet;
import android.content.pm.ModuleInfo;
import android.content.pm.PackageInfo;
import android.content.pm.ParceledListSlice;
import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.pm.SuspendDialogInfo;
import android.content.pm.VerifierDeviceIdentity;
import android.content.pm.VersionedPackage;
import android.content.pm.dex.IArtManager;
import android.graphics.Bitmap;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.List;
public interface IPackageManager
extends IInterface {
public boolean activitySupportsIntent(ComponentName var1, Intent var2, String var3) throws RemoteException;
public void addCrossProfileIntentFilter(IntentFilter var1, String var2, int var3, int var4, int var5) throws RemoteException;
public void addOnPermissionsChangeListener(IOnPermissionsChangeListener var1) throws RemoteException;
@UnsupportedAppUsage
public boolean addPermission(PermissionInfo var1) throws RemoteException;
@UnsupportedAppUsage
public boolean addPermissionAsync(PermissionInfo var1) throws RemoteException;
public void addPersistentPreferredActivity(IntentFilter var1, ComponentName var2, int var3) throws RemoteException;
public void addPreferredActivity(IntentFilter var1, int var2, ComponentName[] var3, ComponentName var4, int var5) throws RemoteException;
public boolean addWhitelistedRestrictedPermission(String var1, String var2, int var3, int var4) throws RemoteException;
public boolean canForwardTo(Intent var1, String var2, int var3, int var4) throws RemoteException;
public boolean canRequestPackageInstalls(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public String[] canonicalToCurrentPackageNames(String[] var1) throws RemoteException;
public void checkPackageStartable(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public int checkPermission(String var1, String var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public int checkSignatures(String var1, String var2) throws RemoteException;
public int checkUidPermission(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public int checkUidSignatures(int var1, int var2) throws RemoteException;
public void clearApplicationProfileData(String var1) throws RemoteException;
public void clearApplicationUserData(String var1, IPackageDataObserver var2, int var3) throws RemoteException;
public void clearCrossProfileIntentFilters(int var1, String var2) throws RemoteException;
public void clearPackagePersistentPreferredActivities(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public void clearPackagePreferredActivities(String var1) throws RemoteException;
public boolean compileLayouts(String var1) throws RemoteException;
@UnsupportedAppUsage
public String[] currentToCanonicalPackageNames(String[] var1) throws RemoteException;
@UnsupportedAppUsage
public void deleteApplicationCacheFiles(String var1, IPackageDataObserver var2) throws RemoteException;
public void deleteApplicationCacheFilesAsUser(String var1, int var2, IPackageDataObserver var3) throws RemoteException;
public void deletePackageAsUser(String var1, int var2, IPackageDeleteObserver var3, int var4, int var5) throws RemoteException;
public void deletePackageVersioned(VersionedPackage var1, IPackageDeleteObserver2 var2, int var3, int var4) throws RemoteException;
public void deletePreloadsFileCache() throws RemoteException;
public void dumpProfiles(String var1) throws RemoteException;
public void enterSafeMode() throws RemoteException;
public void extendVerificationTimeout(int var1, int var2, long var3) throws RemoteException;
public ResolveInfo findPersistentPreferredActivity(Intent var1, int var2) throws RemoteException;
public void finishPackageInstall(int var1, boolean var2) throws RemoteException;
public void flushPackageRestrictionsAsUser(int var1) throws RemoteException;
public void forceDexOpt(String var1) throws RemoteException;
public void freeStorage(String var1, long var2, int var4, IntentSender var5) throws RemoteException;
public void freeStorageAndNotify(String var1, long var2, int var4, IPackageDataObserver var5) throws RemoteException;
@UnsupportedAppUsage
public ActivityInfo getActivityInfo(ComponentName var1, int var2, int var3) throws RemoteException;
public ParceledListSlice getAllIntentFilters(String var1) throws RemoteException;
public List<String> getAllPackages() throws RemoteException;
public ParceledListSlice getAllPermissionGroups(int var1) throws RemoteException;
@UnsupportedAppUsage
public String[] getAppOpPermissionPackages(String var1) throws RemoteException;
public String getAppPredictionServicePackageName() throws RemoteException;
@UnsupportedAppUsage
public int getApplicationEnabledSetting(String var1, int var2) throws RemoteException;
public boolean getApplicationHiddenSettingAsUser(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ApplicationInfo getApplicationInfo(String var1, int var2, int var3) throws RemoteException;
public IArtManager getArtManager() throws RemoteException;
public String getAttentionServicePackageName() throws RemoteException;
@UnsupportedAppUsage
public boolean getBlockUninstallForUser(String var1, int var2) throws RemoteException;
public ChangedPackages getChangedPackages(int var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public int getComponentEnabledSetting(ComponentName var1, int var2) throws RemoteException;
public ParceledListSlice getDeclaredSharedLibraries(String var1, int var2, int var3) throws RemoteException;
public byte[] getDefaultAppsBackup(int var1) throws RemoteException;
public String getDefaultBrowserPackageName(int var1) throws RemoteException;
@UnsupportedAppUsage
public int getFlagsForUid(int var1) throws RemoteException;
public CharSequence getHarmfulAppWarning(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ComponentName getHomeActivities(List<ResolveInfo> var1) throws RemoteException;
public String getIncidentReportApproverPackageName() throws RemoteException;
@UnsupportedAppUsage
public int getInstallLocation() throws RemoteException;
public int getInstallReason(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice getInstalledApplications(int var1, int var2) throws RemoteException;
public List<ModuleInfo> getInstalledModules(int var1) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice getInstalledPackages(int var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public String getInstallerPackageName(String var1) throws RemoteException;
public String getInstantAppAndroidId(String var1, int var2) throws RemoteException;
public byte[] getInstantAppCookie(String var1, int var2) throws RemoteException;
public Bitmap getInstantAppIcon(String var1, int var2) throws RemoteException;
public ComponentName getInstantAppInstallerComponent() throws RemoteException;
public ComponentName getInstantAppResolverComponent() throws RemoteException;
public ComponentName getInstantAppResolverSettingsComponent() throws RemoteException;
public ParceledListSlice getInstantApps(int var1) throws RemoteException;
@UnsupportedAppUsage
public InstrumentationInfo getInstrumentationInfo(ComponentName var1, int var2) throws RemoteException;
public byte[] getIntentFilterVerificationBackup(int var1) throws RemoteException;
public ParceledListSlice getIntentFilterVerifications(String var1) throws RemoteException;
public int getIntentVerificationStatus(String var1, int var2) throws RemoteException;
public KeySet getKeySetByAlias(String var1, String var2) throws RemoteException;
@UnsupportedAppUsage
public ResolveInfo getLastChosenActivity(Intent var1, String var2, int var3) throws RemoteException;
public ModuleInfo getModuleInfo(String var1, int var2) throws RemoteException;
public int getMoveStatus(int var1) throws RemoteException;
@UnsupportedAppUsage
public String getNameForUid(int var1) throws RemoteException;
public String[] getNamesForUids(int[] var1) throws RemoteException;
public int[] getPackageGids(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public PackageInfo getPackageInfo(String var1, int var2, int var3) throws RemoteException;
public PackageInfo getPackageInfoVersioned(VersionedPackage var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public IPackageInstaller getPackageInstaller() throws RemoteException;
public void getPackageSizeInfo(String var1, int var2, IPackageStatsObserver var3) throws RemoteException;
@UnsupportedAppUsage
public int getPackageUid(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String[] getPackagesForUid(int var1) throws RemoteException;
public ParceledListSlice getPackagesHoldingPermissions(String[] var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String getPermissionControllerPackageName() throws RemoteException;
public int getPermissionFlags(String var1, String var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public PermissionGroupInfo getPermissionGroupInfo(String var1, int var2) throws RemoteException;
public PermissionInfo getPermissionInfo(String var1, String var2, int var3) throws RemoteException;
public ParceledListSlice getPersistentApplications(int var1) throws RemoteException;
@UnsupportedAppUsage
public int getPreferredActivities(List<IntentFilter> var1, List<ComponentName> var2, String var3) throws RemoteException;
public byte[] getPreferredActivityBackup(int var1) throws RemoteException;
public int getPrivateFlagsForUid(int var1) throws RemoteException;
@UnsupportedAppUsage
public ProviderInfo getProviderInfo(ComponentName var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public ActivityInfo getReceiverInfo(ComponentName var1, int var2, int var3) throws RemoteException;
public int getRuntimePermissionsVersion(int var1) throws RemoteException;
@UnsupportedAppUsage
public ServiceInfo getServiceInfo(ComponentName var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String getServicesSystemSharedLibraryPackageName() throws RemoteException;
public ParceledListSlice getSharedLibraries(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public String getSharedSystemSharedLibraryPackageName() throws RemoteException;
public KeySet getSigningKeySet(String var1) throws RemoteException;
public PersistableBundle getSuspendedPackageAppExtras(String var1, int var2) throws RemoteException;
public ParceledListSlice getSystemAvailableFeatures() throws RemoteException;
public String getSystemCaptionsServicePackageName() throws RemoteException;
@UnsupportedAppUsage
public String[] getSystemSharedLibraryNames() throws RemoteException;
public String getSystemTextClassifierPackageName() throws RemoteException;
@UnsupportedAppUsage
public int getUidForSharedUser(String var1) throws RemoteException;
public String[] getUnsuspendablePackagesForUser(String[] var1, int var2) throws RemoteException;
public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException;
public String getWellbeingPackageName() throws RemoteException;
public List<String> getWhitelistedRestrictedPermissions(String var1, int var2, int var3) throws RemoteException;
public void grantDefaultPermissionsToActiveLuiApp(String var1, int var2) throws RemoteException;
public void grantDefaultPermissionsToEnabledCarrierApps(String[] var1, int var2) throws RemoteException;
public void grantDefaultPermissionsToEnabledImsServices(String[] var1, int var2) throws RemoteException;
public void grantDefaultPermissionsToEnabledTelephonyDataServices(String[] var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public void grantRuntimePermission(String var1, String var2, int var3) throws RemoteException;
public boolean hasSigningCertificate(String var1, byte[] var2, int var3) throws RemoteException;
public boolean hasSystemFeature(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public boolean hasSystemUidErrors() throws RemoteException;
public boolean hasUidSigningCertificate(int var1, byte[] var2, int var3) throws RemoteException;
public int installExistingPackageAsUser(String var1, int var2, int var3, int var4, List<String> var5) throws RemoteException;
public boolean isDeviceUpgrading() throws RemoteException;
public boolean isFirstBoot() throws RemoteException;
public boolean isInstantApp(String var1, int var2) throws RemoteException;
public boolean isOnlyCoreApps() throws RemoteException;
@UnsupportedAppUsage
public boolean isPackageAvailable(String var1, int var2) throws RemoteException;
public boolean isPackageDeviceAdminOnAnyUser(String var1) throws RemoteException;
public boolean isPackageSignedByKeySet(String var1, KeySet var2) throws RemoteException;
public boolean isPackageSignedByKeySetExactly(String var1, KeySet var2) throws RemoteException;
public boolean isPackageStateProtected(String var1, int var2) throws RemoteException;
public boolean isPackageSuspendedForUser(String var1, int var2) throws RemoteException;
public boolean isPermissionEnforced(String var1) throws RemoteException;
public boolean isPermissionRevokedByPolicy(String var1, String var2, int var3) throws RemoteException;
public boolean isProtectedBroadcast(String var1) throws RemoteException;
@UnsupportedAppUsage
public boolean isSafeMode() throws RemoteException;
@UnsupportedAppUsage
public boolean isStorageLow() throws RemoteException;
@UnsupportedAppUsage
public boolean isUidPrivileged(int var1) throws RemoteException;
public void logAppProcessStartIfNeeded(String var1, int var2, String var3, String var4, int var5) throws RemoteException;
public int movePackage(String var1, String var2) throws RemoteException;
public int movePrimaryStorage(String var1) throws RemoteException;
public void notifyDexLoad(String var1, List<String> var2, List<String> var3, String var4) throws RemoteException;
public void notifyPackageUse(String var1, int var2) throws RemoteException;
public void notifyPackagesReplacedReceived(String[] var1) throws RemoteException;
public boolean performDexOptMode(String var1, boolean var2, String var3, boolean var4, boolean var5, String var6) throws RemoteException;
public boolean performDexOptSecondary(String var1, String var2, boolean var3) throws RemoteException;
public void performFstrimIfNeeded() throws RemoteException;
public ParceledListSlice queryContentProviders(String var1, int var2, int var3, String var4) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice queryInstrumentation(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public ParceledListSlice queryIntentActivities(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryIntentActivityOptions(ComponentName var1, Intent[] var2, String[] var3, Intent var4, String var5, int var6, int var7) throws RemoteException;
public ParceledListSlice queryIntentContentProviders(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryIntentReceivers(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryIntentServices(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ParceledListSlice queryPermissionsByGroup(String var1, int var2) throws RemoteException;
@UnsupportedAppUsage
public void querySyncProviders(List<String> var1, List<ProviderInfo> var2) throws RemoteException;
public void reconcileSecondaryDexFiles(String var1) throws RemoteException;
public void registerDexModule(String var1, String var2, boolean var3, IDexModuleRegisterCallback var4) throws RemoteException;
public void registerMoveCallback(IPackageMoveObserver var1) throws RemoteException;
public void removeOnPermissionsChangeListener(IOnPermissionsChangeListener var1) throws RemoteException;
@UnsupportedAppUsage
public void removePermission(String var1) throws RemoteException;
public boolean removeWhitelistedRestrictedPermission(String var1, String var2, int var3, int var4) throws RemoteException;
@UnsupportedAppUsage
public void replacePreferredActivity(IntentFilter var1, int var2, ComponentName[] var3, ComponentName var4, int var5) throws RemoteException;
public void resetApplicationPreferences(int var1) throws RemoteException;
public void resetRuntimePermissions() throws RemoteException;
public ProviderInfo resolveContentProvider(String var1, int var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public ResolveInfo resolveIntent(Intent var1, String var2, int var3, int var4) throws RemoteException;
public ResolveInfo resolveService(Intent var1, String var2, int var3, int var4) throws RemoteException;
public void restoreDefaultApps(byte[] var1, int var2) throws RemoteException;
public void restoreIntentFilterVerification(byte[] var1, int var2) throws RemoteException;
public void restorePreferredActivities(byte[] var1, int var2) throws RemoteException;
public void revokeDefaultPermissionsFromDisabledTelephonyDataServices(String[] var1, int var2) throws RemoteException;
public void revokeDefaultPermissionsFromLuiApps(String[] var1, int var2) throws RemoteException;
public void revokeRuntimePermission(String var1, String var2, int var3) throws RemoteException;
public boolean runBackgroundDexoptJob(List<String> var1) throws RemoteException;
public void sendDeviceCustomizationReadyBroadcast() throws RemoteException;
public void setApplicationCategoryHint(String var1, int var2, String var3) throws RemoteException;
@UnsupportedAppUsage
public void setApplicationEnabledSetting(String var1, int var2, int var3, int var4, String var5) throws RemoteException;
@UnsupportedAppUsage
public boolean setApplicationHiddenSettingAsUser(String var1, boolean var2, int var3) throws RemoteException;
public boolean setBlockUninstallForUser(String var1, boolean var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public void setComponentEnabledSetting(ComponentName var1, int var2, int var3, int var4) throws RemoteException;
public boolean setDefaultBrowserPackageName(String var1, int var2) throws RemoteException;
public String[] setDistractingPackageRestrictionsAsUser(String[] var1, int var2, int var3) throws RemoteException;
public void setHarmfulAppWarning(String var1, CharSequence var2, int var3) throws RemoteException;
public void setHomeActivity(ComponentName var1, int var2) throws RemoteException;
public boolean setInstallLocation(int var1) throws RemoteException;
@UnsupportedAppUsage
public void setInstallerPackageName(String var1, String var2) throws RemoteException;
public boolean setInstantAppCookie(String var1, byte[] var2, int var3) throws RemoteException;
@UnsupportedAppUsage
public void setLastChosenActivity(Intent var1, String var2, int var3, IntentFilter var4, int var5, ComponentName var6) throws RemoteException;
@UnsupportedAppUsage
public void setPackageStoppedState(String var1, boolean var2, int var3) throws RemoteException;
public String[] setPackagesSuspendedAsUser(String[] var1, boolean var2, PersistableBundle var3, PersistableBundle var4, SuspendDialogInfo var5, String var6, int var7) throws RemoteException;
public void setPermissionEnforced(String var1, boolean var2) throws RemoteException;
public boolean setRequiredForSystemUser(String var1, boolean var2) throws RemoteException;
public void setRuntimePermissionsVersion(int var1, int var2) throws RemoteException;
public void setSystemAppHiddenUntilInstalled(String var1, boolean var2) throws RemoteException;
public boolean setSystemAppInstallState(String var1, boolean var2, int var3) throws RemoteException;
public void setUpdateAvailable(String var1, boolean var2) throws RemoteException;
public boolean shouldShowRequestPermissionRationale(String var1, String var2, int var3) throws RemoteException;
public void systemReady() throws RemoteException;
public void unregisterMoveCallback(IPackageMoveObserver var1) throws RemoteException;
public boolean updateIntentVerificationStatus(String var1, int var2, int var3) throws RemoteException;
public void updatePackagesIfNeeded() throws RemoteException;
public void updatePermissionFlags(String var1, String var2, int var3, int var4, boolean var5, int var6) throws RemoteException;
public void updatePermissionFlagsForAllApps(int var1, int var2, int var3) throws RemoteException;
public void verifyIntentFilter(int var1, int var2, List<String> var3) throws RemoteException;
public void verifyPendingInstall(int var1, int var2) throws RemoteException;
public static class Default
implements IPackageManager {
@Override
public boolean activitySupportsIntent(ComponentName componentName, Intent intent, String string2) throws RemoteException {
return false;
}
@Override
public void addCrossProfileIntentFilter(IntentFilter intentFilter, String string2, int n, int n2, int n3) throws RemoteException {
}
@Override
public void addOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
}
@Override
public boolean addPermission(PermissionInfo permissionInfo) throws RemoteException {
return false;
}
@Override
public boolean addPermissionAsync(PermissionInfo permissionInfo) throws RemoteException {
return false;
}
@Override
public void addPersistentPreferredActivity(IntentFilter intentFilter, ComponentName componentName, int n) throws RemoteException {
}
@Override
public void addPreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
}
@Override
public boolean addWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
return false;
}
@Override
public IBinder asBinder() {
return null;
}
@Override
public boolean canForwardTo(Intent intent, String string2, int n, int n2) throws RemoteException {
return false;
}
@Override
public boolean canRequestPackageInstalls(String string2, int n) throws RemoteException {
return false;
}
@Override
public String[] canonicalToCurrentPackageNames(String[] arrstring) throws RemoteException {
return null;
}
@Override
public void checkPackageStartable(String string2, int n) throws RemoteException {
}
@Override
public int checkPermission(String string2, String string3, int n) throws RemoteException {
return 0;
}
@Override
public int checkSignatures(String string2, String string3) throws RemoteException {
return 0;
}
@Override
public int checkUidPermission(String string2, int n) throws RemoteException {
return 0;
}
@Override
public int checkUidSignatures(int n, int n2) throws RemoteException {
return 0;
}
@Override
public void clearApplicationProfileData(String string2) throws RemoteException {
}
@Override
public void clearApplicationUserData(String string2, IPackageDataObserver iPackageDataObserver, int n) throws RemoteException {
}
@Override
public void clearCrossProfileIntentFilters(int n, String string2) throws RemoteException {
}
@Override
public void clearPackagePersistentPreferredActivities(String string2, int n) throws RemoteException {
}
@Override
public void clearPackagePreferredActivities(String string2) throws RemoteException {
}
@Override
public boolean compileLayouts(String string2) throws RemoteException {
return false;
}
@Override
public String[] currentToCanonicalPackageNames(String[] arrstring) throws RemoteException {
return null;
}
@Override
public void deleteApplicationCacheFiles(String string2, IPackageDataObserver iPackageDataObserver) throws RemoteException {
}
@Override
public void deleteApplicationCacheFilesAsUser(String string2, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
}
@Override
public void deletePackageAsUser(String string2, int n, IPackageDeleteObserver iPackageDeleteObserver, int n2, int n3) throws RemoteException {
}
@Override
public void deletePackageVersioned(VersionedPackage versionedPackage, IPackageDeleteObserver2 iPackageDeleteObserver2, int n, int n2) throws RemoteException {
}
@Override
public void deletePreloadsFileCache() throws RemoteException {
}
@Override
public void dumpProfiles(String string2) throws RemoteException {
}
@Override
public void enterSafeMode() throws RemoteException {
}
@Override
public void extendVerificationTimeout(int n, int n2, long l) throws RemoteException {
}
@Override
public ResolveInfo findPersistentPreferredActivity(Intent intent, int n) throws RemoteException {
return null;
}
@Override
public void finishPackageInstall(int n, boolean bl) throws RemoteException {
}
@Override
public void flushPackageRestrictionsAsUser(int n) throws RemoteException {
}
@Override
public void forceDexOpt(String string2) throws RemoteException {
}
@Override
public void freeStorage(String string2, long l, int n, IntentSender intentSender) throws RemoteException {
}
@Override
public void freeStorageAndNotify(String string2, long l, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
}
@Override
public ActivityInfo getActivityInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getAllIntentFilters(String string2) throws RemoteException {
return null;
}
@Override
public List<String> getAllPackages() throws RemoteException {
return null;
}
@Override
public ParceledListSlice getAllPermissionGroups(int n) throws RemoteException {
return null;
}
@Override
public String[] getAppOpPermissionPackages(String string2) throws RemoteException {
return null;
}
@Override
public String getAppPredictionServicePackageName() throws RemoteException {
return null;
}
@Override
public int getApplicationEnabledSetting(String string2, int n) throws RemoteException {
return 0;
}
@Override
public boolean getApplicationHiddenSettingAsUser(String string2, int n) throws RemoteException {
return false;
}
@Override
public ApplicationInfo getApplicationInfo(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public IArtManager getArtManager() throws RemoteException {
return null;
}
@Override
public String getAttentionServicePackageName() throws RemoteException {
return null;
}
@Override
public boolean getBlockUninstallForUser(String string2, int n) throws RemoteException {
return false;
}
@Override
public ChangedPackages getChangedPackages(int n, int n2) throws RemoteException {
return null;
}
@Override
public int getComponentEnabledSetting(ComponentName componentName, int n) throws RemoteException {
return 0;
}
@Override
public ParceledListSlice getDeclaredSharedLibraries(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public byte[] getDefaultAppsBackup(int n) throws RemoteException {
return null;
}
@Override
public String getDefaultBrowserPackageName(int n) throws RemoteException {
return null;
}
@Override
public int getFlagsForUid(int n) throws RemoteException {
return 0;
}
@Override
public CharSequence getHarmfulAppWarning(String string2, int n) throws RemoteException {
return null;
}
@Override
public ComponentName getHomeActivities(List<ResolveInfo> list) throws RemoteException {
return null;
}
@Override
public String getIncidentReportApproverPackageName() throws RemoteException {
return null;
}
@Override
public int getInstallLocation() throws RemoteException {
return 0;
}
@Override
public int getInstallReason(String string2, int n) throws RemoteException {
return 0;
}
@Override
public ParceledListSlice getInstalledApplications(int n, int n2) throws RemoteException {
return null;
}
@Override
public List<ModuleInfo> getInstalledModules(int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getInstalledPackages(int n, int n2) throws RemoteException {
return null;
}
@Override
public String getInstallerPackageName(String string2) throws RemoteException {
return null;
}
@Override
public String getInstantAppAndroidId(String string2, int n) throws RemoteException {
return null;
}
@Override
public byte[] getInstantAppCookie(String string2, int n) throws RemoteException {
return null;
}
@Override
public Bitmap getInstantAppIcon(String string2, int n) throws RemoteException {
return null;
}
@Override
public ComponentName getInstantAppInstallerComponent() throws RemoteException {
return null;
}
@Override
public ComponentName getInstantAppResolverComponent() throws RemoteException {
return null;
}
@Override
public ComponentName getInstantAppResolverSettingsComponent() throws RemoteException {
return null;
}
@Override
public ParceledListSlice getInstantApps(int n) throws RemoteException {
return null;
}
@Override
public InstrumentationInfo getInstrumentationInfo(ComponentName componentName, int n) throws RemoteException {
return null;
}
@Override
public byte[] getIntentFilterVerificationBackup(int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getIntentFilterVerifications(String string2) throws RemoteException {
return null;
}
@Override
public int getIntentVerificationStatus(String string2, int n) throws RemoteException {
return 0;
}
@Override
public KeySet getKeySetByAlias(String string2, String string3) throws RemoteException {
return null;
}
@Override
public ResolveInfo getLastChosenActivity(Intent intent, String string2, int n) throws RemoteException {
return null;
}
@Override
public ModuleInfo getModuleInfo(String string2, int n) throws RemoteException {
return null;
}
@Override
public int getMoveStatus(int n) throws RemoteException {
return 0;
}
@Override
public String getNameForUid(int n) throws RemoteException {
return null;
}
@Override
public String[] getNamesForUids(int[] arrn) throws RemoteException {
return null;
}
@Override
public int[] getPackageGids(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public PackageInfo getPackageInfo(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public PackageInfo getPackageInfoVersioned(VersionedPackage versionedPackage, int n, int n2) throws RemoteException {
return null;
}
@Override
public IPackageInstaller getPackageInstaller() throws RemoteException {
return null;
}
@Override
public void getPackageSizeInfo(String string2, int n, IPackageStatsObserver iPackageStatsObserver) throws RemoteException {
}
@Override
public int getPackageUid(String string2, int n, int n2) throws RemoteException {
return 0;
}
@Override
public String[] getPackagesForUid(int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getPackagesHoldingPermissions(String[] arrstring, int n, int n2) throws RemoteException {
return null;
}
@Override
public String getPermissionControllerPackageName() throws RemoteException {
return null;
}
@Override
public int getPermissionFlags(String string2, String string3, int n) throws RemoteException {
return 0;
}
@Override
public PermissionGroupInfo getPermissionGroupInfo(String string2, int n) throws RemoteException {
return null;
}
@Override
public PermissionInfo getPermissionInfo(String string2, String string3, int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getPersistentApplications(int n) throws RemoteException {
return null;
}
@Override
public int getPreferredActivities(List<IntentFilter> list, List<ComponentName> list2, String string2) throws RemoteException {
return 0;
}
@Override
public byte[] getPreferredActivityBackup(int n) throws RemoteException {
return null;
}
@Override
public int getPrivateFlagsForUid(int n) throws RemoteException {
return 0;
}
@Override
public ProviderInfo getProviderInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public ActivityInfo getReceiverInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public int getRuntimePermissionsVersion(int n) throws RemoteException {
return 0;
}
@Override
public ServiceInfo getServiceInfo(ComponentName componentName, int n, int n2) throws RemoteException {
return null;
}
@Override
public String getServicesSystemSharedLibraryPackageName() throws RemoteException {
return null;
}
@Override
public ParceledListSlice getSharedLibraries(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public String getSharedSystemSharedLibraryPackageName() throws RemoteException {
return null;
}
@Override
public KeySet getSigningKeySet(String string2) throws RemoteException {
return null;
}
@Override
public PersistableBundle getSuspendedPackageAppExtras(String string2, int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice getSystemAvailableFeatures() throws RemoteException {
return null;
}
@Override
public String getSystemCaptionsServicePackageName() throws RemoteException {
return null;
}
@Override
public String[] getSystemSharedLibraryNames() throws RemoteException {
return null;
}
@Override
public String getSystemTextClassifierPackageName() throws RemoteException {
return null;
}
@Override
public int getUidForSharedUser(String string2) throws RemoteException {
return 0;
}
@Override
public String[] getUnsuspendablePackagesForUser(String[] arrstring, int n) throws RemoteException {
return null;
}
@Override
public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException {
return null;
}
@Override
public String getWellbeingPackageName() throws RemoteException {
return null;
}
@Override
public List<String> getWhitelistedRestrictedPermissions(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public void grantDefaultPermissionsToActiveLuiApp(String string2, int n) throws RemoteException {
}
@Override
public void grantDefaultPermissionsToEnabledCarrierApps(String[] arrstring, int n) throws RemoteException {
}
@Override
public void grantDefaultPermissionsToEnabledImsServices(String[] arrstring, int n) throws RemoteException {
}
@Override
public void grantDefaultPermissionsToEnabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
}
@Override
public void grantRuntimePermission(String string2, String string3, int n) throws RemoteException {
}
@Override
public boolean hasSigningCertificate(String string2, byte[] arrby, int n) throws RemoteException {
return false;
}
@Override
public boolean hasSystemFeature(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean hasSystemUidErrors() throws RemoteException {
return false;
}
@Override
public boolean hasUidSigningCertificate(int n, byte[] arrby, int n2) throws RemoteException {
return false;
}
@Override
public int installExistingPackageAsUser(String string2, int n, int n2, int n3, List<String> list) throws RemoteException {
return 0;
}
@Override
public boolean isDeviceUpgrading() throws RemoteException {
return false;
}
@Override
public boolean isFirstBoot() throws RemoteException {
return false;
}
@Override
public boolean isInstantApp(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isOnlyCoreApps() throws RemoteException {
return false;
}
@Override
public boolean isPackageAvailable(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isPackageDeviceAdminOnAnyUser(String string2) throws RemoteException {
return false;
}
@Override
public boolean isPackageSignedByKeySet(String string2, KeySet keySet) throws RemoteException {
return false;
}
@Override
public boolean isPackageSignedByKeySetExactly(String string2, KeySet keySet) throws RemoteException {
return false;
}
@Override
public boolean isPackageStateProtected(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isPackageSuspendedForUser(String string2, int n) throws RemoteException {
return false;
}
@Override
public boolean isPermissionEnforced(String string2) throws RemoteException {
return false;
}
@Override
public boolean isPermissionRevokedByPolicy(String string2, String string3, int n) throws RemoteException {
return false;
}
@Override
public boolean isProtectedBroadcast(String string2) throws RemoteException {
return false;
}
@Override
public boolean isSafeMode() throws RemoteException {
return false;
}
@Override
public boolean isStorageLow() throws RemoteException {
return false;
}
@Override
public boolean isUidPrivileged(int n) throws RemoteException {
return false;
}
@Override
public void logAppProcessStartIfNeeded(String string2, int n, String string3, String string4, int n2) throws RemoteException {
}
@Override
public int movePackage(String string2, String string3) throws RemoteException {
return 0;
}
@Override
public int movePrimaryStorage(String string2) throws RemoteException {
return 0;
}
@Override
public void notifyDexLoad(String string2, List<String> list, List<String> list2, String string3) throws RemoteException {
}
@Override
public void notifyPackageUse(String string2, int n) throws RemoteException {
}
@Override
public void notifyPackagesReplacedReceived(String[] arrstring) throws RemoteException {
}
@Override
public boolean performDexOptMode(String string2, boolean bl, String string3, boolean bl2, boolean bl3, String string4) throws RemoteException {
return false;
}
@Override
public boolean performDexOptSecondary(String string2, String string3, boolean bl) throws RemoteException {
return false;
}
@Override
public void performFstrimIfNeeded() throws RemoteException {
}
@Override
public ParceledListSlice queryContentProviders(String string2, int n, int n2, String string3) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryInstrumentation(String string2, int n) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentActivities(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentActivityOptions(ComponentName componentName, Intent[] arrintent, String[] arrstring, Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentContentProviders(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentReceivers(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryIntentServices(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ParceledListSlice queryPermissionsByGroup(String string2, int n) throws RemoteException {
return null;
}
@Override
public void querySyncProviders(List<String> list, List<ProviderInfo> list2) throws RemoteException {
}
@Override
public void reconcileSecondaryDexFiles(String string2) throws RemoteException {
}
@Override
public void registerDexModule(String string2, String string3, boolean bl, IDexModuleRegisterCallback iDexModuleRegisterCallback) throws RemoteException {
}
@Override
public void registerMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
}
@Override
public void removeOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
}
@Override
public void removePermission(String string2) throws RemoteException {
}
@Override
public boolean removeWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
return false;
}
@Override
public void replacePreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
}
@Override
public void resetApplicationPreferences(int n) throws RemoteException {
}
@Override
public void resetRuntimePermissions() throws RemoteException {
}
@Override
public ProviderInfo resolveContentProvider(String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ResolveInfo resolveIntent(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public ResolveInfo resolveService(Intent intent, String string2, int n, int n2) throws RemoteException {
return null;
}
@Override
public void restoreDefaultApps(byte[] arrby, int n) throws RemoteException {
}
@Override
public void restoreIntentFilterVerification(byte[] arrby, int n) throws RemoteException {
}
@Override
public void restorePreferredActivities(byte[] arrby, int n) throws RemoteException {
}
@Override
public void revokeDefaultPermissionsFromDisabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
}
@Override
public void revokeDefaultPermissionsFromLuiApps(String[] arrstring, int n) throws RemoteException {
}
@Override
public void revokeRuntimePermission(String string2, String string3, int n) throws RemoteException {
}
@Override
public boolean runBackgroundDexoptJob(List<String> list) throws RemoteException {
return false;
}
@Override
public void sendDeviceCustomizationReadyBroadcast() throws RemoteException {
}
@Override
public void setApplicationCategoryHint(String string2, int n, String string3) throws RemoteException {
}
@Override
public void setApplicationEnabledSetting(String string2, int n, int n2, int n3, String string3) throws RemoteException {
}
@Override
public boolean setApplicationHiddenSettingAsUser(String string2, boolean bl, int n) throws RemoteException {
return false;
}
@Override
public boolean setBlockUninstallForUser(String string2, boolean bl, int n) throws RemoteException {
return false;
}
@Override
public void setComponentEnabledSetting(ComponentName componentName, int n, int n2, int n3) throws RemoteException {
}
@Override
public boolean setDefaultBrowserPackageName(String string2, int n) throws RemoteException {
return false;
}
@Override
public String[] setDistractingPackageRestrictionsAsUser(String[] arrstring, int n, int n2) throws RemoteException {
return null;
}
@Override
public void setHarmfulAppWarning(String string2, CharSequence charSequence, int n) throws RemoteException {
}
@Override
public void setHomeActivity(ComponentName componentName, int n) throws RemoteException {
}
@Override
public boolean setInstallLocation(int n) throws RemoteException {
return false;
}
@Override
public void setInstallerPackageName(String string2, String string3) throws RemoteException {
}
@Override
public boolean setInstantAppCookie(String string2, byte[] arrby, int n) throws RemoteException {
return false;
}
@Override
public void setLastChosenActivity(Intent intent, String string2, int n, IntentFilter intentFilter, int n2, ComponentName componentName) throws RemoteException {
}
@Override
public void setPackageStoppedState(String string2, boolean bl, int n) throws RemoteException {
}
@Override
public String[] setPackagesSuspendedAsUser(String[] arrstring, boolean bl, PersistableBundle persistableBundle, PersistableBundle persistableBundle2, SuspendDialogInfo suspendDialogInfo, String string2, int n) throws RemoteException {
return null;
}
@Override
public void setPermissionEnforced(String string2, boolean bl) throws RemoteException {
}
@Override
public boolean setRequiredForSystemUser(String string2, boolean bl) throws RemoteException {
return false;
}
@Override
public void setRuntimePermissionsVersion(int n, int n2) throws RemoteException {
}
@Override
public void setSystemAppHiddenUntilInstalled(String string2, boolean bl) throws RemoteException {
}
@Override
public boolean setSystemAppInstallState(String string2, boolean bl, int n) throws RemoteException {
return false;
}
@Override
public void setUpdateAvailable(String string2, boolean bl) throws RemoteException {
}
@Override
public boolean shouldShowRequestPermissionRationale(String string2, String string3, int n) throws RemoteException {
return false;
}
@Override
public void systemReady() throws RemoteException {
}
@Override
public void unregisterMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
}
@Override
public boolean updateIntentVerificationStatus(String string2, int n, int n2) throws RemoteException {
return false;
}
@Override
public void updatePackagesIfNeeded() throws RemoteException {
}
@Override
public void updatePermissionFlags(String string2, String string3, int n, int n2, boolean bl, int n3) throws RemoteException {
}
@Override
public void updatePermissionFlagsForAllApps(int n, int n2, int n3) throws RemoteException {
}
@Override
public void verifyIntentFilter(int n, int n2, List<String> list) throws RemoteException {
}
@Override
public void verifyPendingInstall(int n, int n2) throws RemoteException {
}
}
public static abstract class Stub
extends Binder
implements IPackageManager {
private static final String DESCRIPTOR = "android.content.pm.IPackageManager";
static final int TRANSACTION_activitySupportsIntent = 15;
static final int TRANSACTION_addCrossProfileIntentFilter = 78;
static final int TRANSACTION_addOnPermissionsChangeListener = 162;
static final int TRANSACTION_addPermission = 21;
static final int TRANSACTION_addPermissionAsync = 131;
static final int TRANSACTION_addPersistentPreferredActivity = 76;
static final int TRANSACTION_addPreferredActivity = 72;
static final int TRANSACTION_addWhitelistedRestrictedPermission = 30;
static final int TRANSACTION_canForwardTo = 47;
static final int TRANSACTION_canRequestPackageInstalls = 186;
static final int TRANSACTION_canonicalToCurrentPackageNames = 8;
static final int TRANSACTION_checkPackageStartable = 1;
static final int TRANSACTION_checkPermission = 19;
static final int TRANSACTION_checkSignatures = 34;
static final int TRANSACTION_checkUidPermission = 20;
static final int TRANSACTION_checkUidSignatures = 35;
static final int TRANSACTION_clearApplicationProfileData = 105;
static final int TRANSACTION_clearApplicationUserData = 104;
static final int TRANSACTION_clearCrossProfileIntentFilters = 79;
static final int TRANSACTION_clearPackagePersistentPreferredActivities = 77;
static final int TRANSACTION_clearPackagePreferredActivities = 74;
static final int TRANSACTION_compileLayouts = 121;
static final int TRANSACTION_currentToCanonicalPackageNames = 7;
static final int TRANSACTION_deleteApplicationCacheFiles = 102;
static final int TRANSACTION_deleteApplicationCacheFilesAsUser = 103;
static final int TRANSACTION_deletePackageAsUser = 66;
static final int TRANSACTION_deletePackageVersioned = 67;
static final int TRANSACTION_deletePreloadsFileCache = 187;
static final int TRANSACTION_dumpProfiles = 122;
static final int TRANSACTION_enterSafeMode = 110;
static final int TRANSACTION_extendVerificationTimeout = 136;
static final int TRANSACTION_findPersistentPreferredActivity = 46;
static final int TRANSACTION_finishPackageInstall = 63;
static final int TRANSACTION_flushPackageRestrictionsAsUser = 98;
static final int TRANSACTION_forceDexOpt = 123;
static final int TRANSACTION_freeStorage = 101;
static final int TRANSACTION_freeStorageAndNotify = 100;
static final int TRANSACTION_getActivityInfo = 14;
static final int TRANSACTION_getAllIntentFilters = 141;
static final int TRANSACTION_getAllPackages = 36;
static final int TRANSACTION_getAllPermissionGroups = 12;
static final int TRANSACTION_getAppOpPermissionPackages = 44;
static final int TRANSACTION_getAppPredictionServicePackageName = 200;
static final int TRANSACTION_getApplicationEnabledSetting = 96;
static final int TRANSACTION_getApplicationHiddenSettingAsUser = 152;
static final int TRANSACTION_getApplicationInfo = 13;
static final int TRANSACTION_getArtManager = 192;
static final int TRANSACTION_getAttentionServicePackageName = 198;
static final int TRANSACTION_getBlockUninstallForUser = 157;
static final int TRANSACTION_getChangedPackages = 181;
static final int TRANSACTION_getComponentEnabledSetting = 94;
static final int TRANSACTION_getDeclaredSharedLibraries = 185;
static final int TRANSACTION_getDefaultAppsBackup = 87;
static final int TRANSACTION_getDefaultBrowserPackageName = 143;
static final int TRANSACTION_getFlagsForUid = 41;
static final int TRANSACTION_getHarmfulAppWarning = 194;
static final int TRANSACTION_getHomeActivities = 91;
static final int TRANSACTION_getIncidentReportApproverPackageName = 202;
static final int TRANSACTION_getInstallLocation = 133;
static final int TRANSACTION_getInstallReason = 183;
static final int TRANSACTION_getInstalledApplications = 56;
static final int TRANSACTION_getInstalledModules = 205;
static final int TRANSACTION_getInstalledPackages = 54;
static final int TRANSACTION_getInstallerPackageName = 68;
static final int TRANSACTION_getInstantAppAndroidId = 191;
static final int TRANSACTION_getInstantAppCookie = 173;
static final int TRANSACTION_getInstantAppIcon = 175;
static final int TRANSACTION_getInstantAppInstallerComponent = 190;
static final int TRANSACTION_getInstantAppResolverComponent = 188;
static final int TRANSACTION_getInstantAppResolverSettingsComponent = 189;
static final int TRANSACTION_getInstantApps = 172;
static final int TRANSACTION_getInstrumentationInfo = 61;
static final int TRANSACTION_getIntentFilterVerificationBackup = 89;
static final int TRANSACTION_getIntentFilterVerifications = 140;
static final int TRANSACTION_getIntentVerificationStatus = 138;
static final int TRANSACTION_getKeySetByAlias = 158;
static final int TRANSACTION_getLastChosenActivity = 70;
static final int TRANSACTION_getModuleInfo = 206;
static final int TRANSACTION_getMoveStatus = 126;
static final int TRANSACTION_getNameForUid = 38;
static final int TRANSACTION_getNamesForUids = 39;
static final int TRANSACTION_getPackageGids = 6;
static final int TRANSACTION_getPackageInfo = 3;
static final int TRANSACTION_getPackageInfoVersioned = 4;
static final int TRANSACTION_getPackageInstaller = 155;
static final int TRANSACTION_getPackageSizeInfo = 106;
static final int TRANSACTION_getPackageUid = 5;
static final int TRANSACTION_getPackagesForUid = 37;
static final int TRANSACTION_getPackagesHoldingPermissions = 55;
static final int TRANSACTION_getPermissionControllerPackageName = 171;
static final int TRANSACTION_getPermissionFlags = 26;
static final int TRANSACTION_getPermissionGroupInfo = 11;
static final int TRANSACTION_getPermissionInfo = 9;
static final int TRANSACTION_getPersistentApplications = 57;
static final int TRANSACTION_getPreferredActivities = 75;
static final int TRANSACTION_getPreferredActivityBackup = 85;
static final int TRANSACTION_getPrivateFlagsForUid = 42;
static final int TRANSACTION_getProviderInfo = 18;
static final int TRANSACTION_getReceiverInfo = 16;
static final int TRANSACTION_getRuntimePermissionsVersion = 207;
static final int TRANSACTION_getServiceInfo = 17;
static final int TRANSACTION_getServicesSystemSharedLibraryPackageName = 179;
static final int TRANSACTION_getSharedLibraries = 184;
static final int TRANSACTION_getSharedSystemSharedLibraryPackageName = 180;
static final int TRANSACTION_getSigningKeySet = 159;
static final int TRANSACTION_getSuspendedPackageAppExtras = 84;
static final int TRANSACTION_getSystemAvailableFeatures = 108;
static final int TRANSACTION_getSystemCaptionsServicePackageName = 201;
static final int TRANSACTION_getSystemSharedLibraryNames = 107;
static final int TRANSACTION_getSystemTextClassifierPackageName = 197;
static final int TRANSACTION_getUidForSharedUser = 40;
static final int TRANSACTION_getUnsuspendablePackagesForUser = 82;
static final int TRANSACTION_getVerifierDeviceIdentity = 144;
static final int TRANSACTION_getWellbeingPackageName = 199;
static final int TRANSACTION_getWhitelistedRestrictedPermissions = 29;
static final int TRANSACTION_grantDefaultPermissionsToActiveLuiApp = 168;
static final int TRANSACTION_grantDefaultPermissionsToEnabledCarrierApps = 164;
static final int TRANSACTION_grantDefaultPermissionsToEnabledImsServices = 165;
static final int TRANSACTION_grantDefaultPermissionsToEnabledTelephonyDataServices = 166;
static final int TRANSACTION_grantRuntimePermission = 23;
static final int TRANSACTION_hasSigningCertificate = 195;
static final int TRANSACTION_hasSystemFeature = 109;
static final int TRANSACTION_hasSystemUidErrors = 113;
static final int TRANSACTION_hasUidSigningCertificate = 196;
static final int TRANSACTION_installExistingPackageAsUser = 134;
static final int TRANSACTION_isDeviceUpgrading = 147;
static final int TRANSACTION_isFirstBoot = 145;
static final int TRANSACTION_isInstantApp = 176;
static final int TRANSACTION_isOnlyCoreApps = 146;
static final int TRANSACTION_isPackageAvailable = 2;
static final int TRANSACTION_isPackageDeviceAdminOnAnyUser = 182;
static final int TRANSACTION_isPackageSignedByKeySet = 160;
static final int TRANSACTION_isPackageSignedByKeySetExactly = 161;
static final int TRANSACTION_isPackageStateProtected = 203;
static final int TRANSACTION_isPackageSuspendedForUser = 83;
static final int TRANSACTION_isPermissionEnforced = 149;
static final int TRANSACTION_isPermissionRevokedByPolicy = 170;
static final int TRANSACTION_isProtectedBroadcast = 33;
static final int TRANSACTION_isSafeMode = 111;
static final int TRANSACTION_isStorageLow = 150;
static final int TRANSACTION_isUidPrivileged = 43;
static final int TRANSACTION_logAppProcessStartIfNeeded = 97;
static final int TRANSACTION_movePackage = 129;
static final int TRANSACTION_movePrimaryStorage = 130;
static final int TRANSACTION_notifyDexLoad = 117;
static final int TRANSACTION_notifyPackageUse = 116;
static final int TRANSACTION_notifyPackagesReplacedReceived = 209;
static final int TRANSACTION_performDexOptMode = 119;
static final int TRANSACTION_performDexOptSecondary = 120;
static final int TRANSACTION_performFstrimIfNeeded = 114;
static final int TRANSACTION_queryContentProviders = 60;
static final int TRANSACTION_queryInstrumentation = 62;
static final int TRANSACTION_queryIntentActivities = 48;
static final int TRANSACTION_queryIntentActivityOptions = 49;
static final int TRANSACTION_queryIntentContentProviders = 53;
static final int TRANSACTION_queryIntentReceivers = 50;
static final int TRANSACTION_queryIntentServices = 52;
static final int TRANSACTION_queryPermissionsByGroup = 10;
static final int TRANSACTION_querySyncProviders = 59;
static final int TRANSACTION_reconcileSecondaryDexFiles = 125;
static final int TRANSACTION_registerDexModule = 118;
static final int TRANSACTION_registerMoveCallback = 127;
static final int TRANSACTION_removeOnPermissionsChangeListener = 163;
static final int TRANSACTION_removePermission = 22;
static final int TRANSACTION_removeWhitelistedRestrictedPermission = 31;
static final int TRANSACTION_replacePreferredActivity = 73;
static final int TRANSACTION_resetApplicationPreferences = 69;
static final int TRANSACTION_resetRuntimePermissions = 25;
static final int TRANSACTION_resolveContentProvider = 58;
static final int TRANSACTION_resolveIntent = 45;
static final int TRANSACTION_resolveService = 51;
static final int TRANSACTION_restoreDefaultApps = 88;
static final int TRANSACTION_restoreIntentFilterVerification = 90;
static final int TRANSACTION_restorePreferredActivities = 86;
static final int TRANSACTION_revokeDefaultPermissionsFromDisabledTelephonyDataServices = 167;
static final int TRANSACTION_revokeDefaultPermissionsFromLuiApps = 169;
static final int TRANSACTION_revokeRuntimePermission = 24;
static final int TRANSACTION_runBackgroundDexoptJob = 124;
static final int TRANSACTION_sendDeviceCustomizationReadyBroadcast = 204;
static final int TRANSACTION_setApplicationCategoryHint = 65;
static final int TRANSACTION_setApplicationEnabledSetting = 95;
static final int TRANSACTION_setApplicationHiddenSettingAsUser = 151;
static final int TRANSACTION_setBlockUninstallForUser = 156;
static final int TRANSACTION_setComponentEnabledSetting = 93;
static final int TRANSACTION_setDefaultBrowserPackageName = 142;
static final int TRANSACTION_setDistractingPackageRestrictionsAsUser = 80;
static final int TRANSACTION_setHarmfulAppWarning = 193;
static final int TRANSACTION_setHomeActivity = 92;
static final int TRANSACTION_setInstallLocation = 132;
static final int TRANSACTION_setInstallerPackageName = 64;
static final int TRANSACTION_setInstantAppCookie = 174;
static final int TRANSACTION_setLastChosenActivity = 71;
static final int TRANSACTION_setPackageStoppedState = 99;
static final int TRANSACTION_setPackagesSuspendedAsUser = 81;
static final int TRANSACTION_setPermissionEnforced = 148;
static final int TRANSACTION_setRequiredForSystemUser = 177;
static final int TRANSACTION_setRuntimePermissionsVersion = 208;
static final int TRANSACTION_setSystemAppHiddenUntilInstalled = 153;
static final int TRANSACTION_setSystemAppInstallState = 154;
static final int TRANSACTION_setUpdateAvailable = 178;
static final int TRANSACTION_shouldShowRequestPermissionRationale = 32;
static final int TRANSACTION_systemReady = 112;
static final int TRANSACTION_unregisterMoveCallback = 128;
static final int TRANSACTION_updateIntentVerificationStatus = 139;
static final int TRANSACTION_updatePackagesIfNeeded = 115;
static final int TRANSACTION_updatePermissionFlags = 27;
static final int TRANSACTION_updatePermissionFlagsForAllApps = 28;
static final int TRANSACTION_verifyIntentFilter = 137;
static final int TRANSACTION_verifyPendingInstall = 135;
public Stub() {
this.attachInterface(this, DESCRIPTOR);
}
public static IPackageManager asInterface(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface iInterface = iBinder.queryLocalInterface(DESCRIPTOR);
if (iInterface != null && iInterface instanceof IPackageManager) {
return (IPackageManager)iInterface;
}
return new Proxy(iBinder);
}
public static IPackageManager getDefaultImpl() {
return Proxy.sDefaultImpl;
}
public static String getDefaultTransactionName(int n) {
switch (n) {
default: {
return null;
}
case 209: {
return "notifyPackagesReplacedReceived";
}
case 208: {
return "setRuntimePermissionsVersion";
}
case 207: {
return "getRuntimePermissionsVersion";
}
case 206: {
return "getModuleInfo";
}
case 205: {
return "getInstalledModules";
}
case 204: {
return "sendDeviceCustomizationReadyBroadcast";
}
case 203: {
return "isPackageStateProtected";
}
case 202: {
return "getIncidentReportApproverPackageName";
}
case 201: {
return "getSystemCaptionsServicePackageName";
}
case 200: {
return "getAppPredictionServicePackageName";
}
case 199: {
return "getWellbeingPackageName";
}
case 198: {
return "getAttentionServicePackageName";
}
case 197: {
return "getSystemTextClassifierPackageName";
}
case 196: {
return "hasUidSigningCertificate";
}
case 195: {
return "hasSigningCertificate";
}
case 194: {
return "getHarmfulAppWarning";
}
case 193: {
return "setHarmfulAppWarning";
}
case 192: {
return "getArtManager";
}
case 191: {
return "getInstantAppAndroidId";
}
case 190: {
return "getInstantAppInstallerComponent";
}
case 189: {
return "getInstantAppResolverSettingsComponent";
}
case 188: {
return "getInstantAppResolverComponent";
}
case 187: {
return "deletePreloadsFileCache";
}
case 186: {
return "canRequestPackageInstalls";
}
case 185: {
return "getDeclaredSharedLibraries";
}
case 184: {
return "getSharedLibraries";
}
case 183: {
return "getInstallReason";
}
case 182: {
return "isPackageDeviceAdminOnAnyUser";
}
case 181: {
return "getChangedPackages";
}
case 180: {
return "getSharedSystemSharedLibraryPackageName";
}
case 179: {
return "getServicesSystemSharedLibraryPackageName";
}
case 178: {
return "setUpdateAvailable";
}
case 177: {
return "setRequiredForSystemUser";
}
case 176: {
return "isInstantApp";
}
case 175: {
return "getInstantAppIcon";
}
case 174: {
return "setInstantAppCookie";
}
case 173: {
return "getInstantAppCookie";
}
case 172: {
return "getInstantApps";
}
case 171: {
return "getPermissionControllerPackageName";
}
case 170: {
return "isPermissionRevokedByPolicy";
}
case 169: {
return "revokeDefaultPermissionsFromLuiApps";
}
case 168: {
return "grantDefaultPermissionsToActiveLuiApp";
}
case 167: {
return "revokeDefaultPermissionsFromDisabledTelephonyDataServices";
}
case 166: {
return "grantDefaultPermissionsToEnabledTelephonyDataServices";
}
case 165: {
return "grantDefaultPermissionsToEnabledImsServices";
}
case 164: {
return "grantDefaultPermissionsToEnabledCarrierApps";
}
case 163: {
return "removeOnPermissionsChangeListener";
}
case 162: {
return "addOnPermissionsChangeListener";
}
case 161: {
return "isPackageSignedByKeySetExactly";
}
case 160: {
return "isPackageSignedByKeySet";
}
case 159: {
return "getSigningKeySet";
}
case 158: {
return "getKeySetByAlias";
}
case 157: {
return "getBlockUninstallForUser";
}
case 156: {
return "setBlockUninstallForUser";
}
case 155: {
return "getPackageInstaller";
}
case 154: {
return "setSystemAppInstallState";
}
case 153: {
return "setSystemAppHiddenUntilInstalled";
}
case 152: {
return "getApplicationHiddenSettingAsUser";
}
case 151: {
return "setApplicationHiddenSettingAsUser";
}
case 150: {
return "isStorageLow";
}
case 149: {
return "isPermissionEnforced";
}
case 148: {
return "setPermissionEnforced";
}
case 147: {
return "isDeviceUpgrading";
}
case 146: {
return "isOnlyCoreApps";
}
case 145: {
return "isFirstBoot";
}
case 144: {
return "getVerifierDeviceIdentity";
}
case 143: {
return "getDefaultBrowserPackageName";
}
case 142: {
return "setDefaultBrowserPackageName";
}
case 141: {
return "getAllIntentFilters";
}
case 140: {
return "getIntentFilterVerifications";
}
case 139: {
return "updateIntentVerificationStatus";
}
case 138: {
return "getIntentVerificationStatus";
}
case 137: {
return "verifyIntentFilter";
}
case 136: {
return "extendVerificationTimeout";
}
case 135: {
return "verifyPendingInstall";
}
case 134: {
return "installExistingPackageAsUser";
}
case 133: {
return "getInstallLocation";
}
case 132: {
return "setInstallLocation";
}
case 131: {
return "addPermissionAsync";
}
case 130: {
return "movePrimaryStorage";
}
case 129: {
return "movePackage";
}
case 128: {
return "unregisterMoveCallback";
}
case 127: {
return "registerMoveCallback";
}
case 126: {
return "getMoveStatus";
}
case 125: {
return "reconcileSecondaryDexFiles";
}
case 124: {
return "runBackgroundDexoptJob";
}
case 123: {
return "forceDexOpt";
}
case 122: {
return "dumpProfiles";
}
case 121: {
return "compileLayouts";
}
case 120: {
return "performDexOptSecondary";
}
case 119: {
return "performDexOptMode";
}
case 118: {
return "registerDexModule";
}
case 117: {
return "notifyDexLoad";
}
case 116: {
return "notifyPackageUse";
}
case 115: {
return "updatePackagesIfNeeded";
}
case 114: {
return "performFstrimIfNeeded";
}
case 113: {
return "hasSystemUidErrors";
}
case 112: {
return "systemReady";
}
case 111: {
return "isSafeMode";
}
case 110: {
return "enterSafeMode";
}
case 109: {
return "hasSystemFeature";
}
case 108: {
return "getSystemAvailableFeatures";
}
case 107: {
return "getSystemSharedLibraryNames";
}
case 106: {
return "getPackageSizeInfo";
}
case 105: {
return "clearApplicationProfileData";
}
case 104: {
return "clearApplicationUserData";
}
case 103: {
return "deleteApplicationCacheFilesAsUser";
}
case 102: {
return "deleteApplicationCacheFiles";
}
case 101: {
return "freeStorage";
}
case 100: {
return "freeStorageAndNotify";
}
case 99: {
return "setPackageStoppedState";
}
case 98: {
return "flushPackageRestrictionsAsUser";
}
case 97: {
return "logAppProcessStartIfNeeded";
}
case 96: {
return "getApplicationEnabledSetting";
}
case 95: {
return "setApplicationEnabledSetting";
}
case 94: {
return "getComponentEnabledSetting";
}
case 93: {
return "setComponentEnabledSetting";
}
case 92: {
return "setHomeActivity";
}
case 91: {
return "getHomeActivities";
}
case 90: {
return "restoreIntentFilterVerification";
}
case 89: {
return "getIntentFilterVerificationBackup";
}
case 88: {
return "restoreDefaultApps";
}
case 87: {
return "getDefaultAppsBackup";
}
case 86: {
return "restorePreferredActivities";
}
case 85: {
return "getPreferredActivityBackup";
}
case 84: {
return "getSuspendedPackageAppExtras";
}
case 83: {
return "isPackageSuspendedForUser";
}
case 82: {
return "getUnsuspendablePackagesForUser";
}
case 81: {
return "setPackagesSuspendedAsUser";
}
case 80: {
return "setDistractingPackageRestrictionsAsUser";
}
case 79: {
return "clearCrossProfileIntentFilters";
}
case 78: {
return "addCrossProfileIntentFilter";
}
case 77: {
return "clearPackagePersistentPreferredActivities";
}
case 76: {
return "addPersistentPreferredActivity";
}
case 75: {
return "getPreferredActivities";
}
case 74: {
return "clearPackagePreferredActivities";
}
case 73: {
return "replacePreferredActivity";
}
case 72: {
return "addPreferredActivity";
}
case 71: {
return "setLastChosenActivity";
}
case 70: {
return "getLastChosenActivity";
}
case 69: {
return "resetApplicationPreferences";
}
case 68: {
return "getInstallerPackageName";
}
case 67: {
return "deletePackageVersioned";
}
case 66: {
return "deletePackageAsUser";
}
case 65: {
return "setApplicationCategoryHint";
}
case 64: {
return "setInstallerPackageName";
}
case 63: {
return "finishPackageInstall";
}
case 62: {
return "queryInstrumentation";
}
case 61: {
return "getInstrumentationInfo";
}
case 60: {
return "queryContentProviders";
}
case 59: {
return "querySyncProviders";
}
case 58: {
return "resolveContentProvider";
}
case 57: {
return "getPersistentApplications";
}
case 56: {
return "getInstalledApplications";
}
case 55: {
return "getPackagesHoldingPermissions";
}
case 54: {
return "getInstalledPackages";
}
case 53: {
return "queryIntentContentProviders";
}
case 52: {
return "queryIntentServices";
}
case 51: {
return "resolveService";
}
case 50: {
return "queryIntentReceivers";
}
case 49: {
return "queryIntentActivityOptions";
}
case 48: {
return "queryIntentActivities";
}
case 47: {
return "canForwardTo";
}
case 46: {
return "findPersistentPreferredActivity";
}
case 45: {
return "resolveIntent";
}
case 44: {
return "getAppOpPermissionPackages";
}
case 43: {
return "isUidPrivileged";
}
case 42: {
return "getPrivateFlagsForUid";
}
case 41: {
return "getFlagsForUid";
}
case 40: {
return "getUidForSharedUser";
}
case 39: {
return "getNamesForUids";
}
case 38: {
return "getNameForUid";
}
case 37: {
return "getPackagesForUid";
}
case 36: {
return "getAllPackages";
}
case 35: {
return "checkUidSignatures";
}
case 34: {
return "checkSignatures";
}
case 33: {
return "isProtectedBroadcast";
}
case 32: {
return "shouldShowRequestPermissionRationale";
}
case 31: {
return "removeWhitelistedRestrictedPermission";
}
case 30: {
return "addWhitelistedRestrictedPermission";
}
case 29: {
return "getWhitelistedRestrictedPermissions";
}
case 28: {
return "updatePermissionFlagsForAllApps";
}
case 27: {
return "updatePermissionFlags";
}
case 26: {
return "getPermissionFlags";
}
case 25: {
return "resetRuntimePermissions";
}
case 24: {
return "revokeRuntimePermission";
}
case 23: {
return "grantRuntimePermission";
}
case 22: {
return "removePermission";
}
case 21: {
return "addPermission";
}
case 20: {
return "checkUidPermission";
}
case 19: {
return "checkPermission";
}
case 18: {
return "getProviderInfo";
}
case 17: {
return "getServiceInfo";
}
case 16: {
return "getReceiverInfo";
}
case 15: {
return "activitySupportsIntent";
}
case 14: {
return "getActivityInfo";
}
case 13: {
return "getApplicationInfo";
}
case 12: {
return "getAllPermissionGroups";
}
case 11: {
return "getPermissionGroupInfo";
}
case 10: {
return "queryPermissionsByGroup";
}
case 9: {
return "getPermissionInfo";
}
case 8: {
return "canonicalToCurrentPackageNames";
}
case 7: {
return "currentToCanonicalPackageNames";
}
case 6: {
return "getPackageGids";
}
case 5: {
return "getPackageUid";
}
case 4: {
return "getPackageInfoVersioned";
}
case 3: {
return "getPackageInfo";
}
case 2: {
return "isPackageAvailable";
}
case 1:
}
return "checkPackageStartable";
}
public static boolean setDefaultImpl(IPackageManager iPackageManager) {
if (Proxy.sDefaultImpl == null && iPackageManager != null) {
Proxy.sDefaultImpl = iPackageManager;
return true;
}
return false;
}
@Override
public IBinder asBinder() {
return this;
}
@Override
public String getTransactionName(int n) {
return Stub.getDefaultTransactionName(n);
}
@Override
public boolean onTransact(int n, Parcel object, Parcel object2, int n2) throws RemoteException {
if (n != 1598968902) {
Object object3 = null;
Object object4 = null;
boolean bl = false;
boolean bl2 = false;
boolean bl3 = false;
boolean bl4 = false;
boolean bl5 = false;
boolean bl6 = false;
boolean bl7 = false;
boolean bl8 = false;
boolean bl9 = false;
boolean bl10 = false;
boolean bl11 = false;
switch (n) {
default: {
return super.onTransact(n, (Parcel)object, (Parcel)object2, n2);
}
case 209: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.notifyPackagesReplacedReceived(((Parcel)object).createStringArray());
((Parcel)object2).writeNoException();
return true;
}
case 208: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setRuntimePermissionsVersion(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 207: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getRuntimePermissionsVersion(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 206: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getModuleInfo(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ModuleInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 205: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstalledModules(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeTypedList(object);
return true;
}
case 204: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.sendDeviceCustomizationReadyBroadcast();
((Parcel)object2).writeNoException();
return true;
}
case 203: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageStateProtected(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 202: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getIncidentReportApproverPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 201: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemCaptionsServicePackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 200: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAppPredictionServicePackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 199: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getWellbeingPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 198: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAttentionServicePackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 197: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemTextClassifierPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 196: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasUidSigningCertificate(((Parcel)object).readInt(), ((Parcel)object).createByteArray(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 195: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasSigningCertificate(((Parcel)object).readString(), ((Parcel)object).createByteArray(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 194: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getHarmfulAppWarning(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
TextUtils.writeToParcel((CharSequence)object, (Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 193: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = ((Parcel)object).readString();
object4 = ((Parcel)object).readInt() != 0 ? TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel((Parcel)object) : null;
this.setHarmfulAppWarning((String)object3, (CharSequence)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 192: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = this.getArtManager();
((Parcel)object2).writeNoException();
object = object4;
if (object3 != null) {
object = object3.asBinder();
}
((Parcel)object2).writeStrongBinder((IBinder)object);
return true;
}
case 191: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppAndroidId(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 190: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppInstallerComponent();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 189: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppResolverSettingsComponent();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 188: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppResolverComponent();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 187: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deletePreloadsFileCache();
((Parcel)object2).writeNoException();
return true;
}
case 186: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.canRequestPackageInstalls(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 185: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getDeclaredSharedLibraries(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 184: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSharedLibraries(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 183: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getInstallReason(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 182: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageDeviceAdminOnAnyUser(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 181: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getChangedPackages(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ChangedPackages)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 180: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSharedSystemSharedLibraryPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 179: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getServicesSystemSharedLibraryPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 178: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setUpdateAvailable((String)object4, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 177: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setRequiredForSystemUser((String)object4, bl11) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 176: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isInstantApp(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 175: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppIcon(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((Bitmap)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 174: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.setInstantAppCookie(((Parcel)object).readString(), ((Parcel)object).createByteArray(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 173: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantAppCookie(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 172: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstantApps(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 171: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPermissionControllerPackageName();
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 170: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPermissionRevokedByPolicy(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 169: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.revokeDefaultPermissionsFromLuiApps(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 168: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToActiveLuiApp(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 167: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.revokeDefaultPermissionsFromDisabledTelephonyDataServices(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 166: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToEnabledTelephonyDataServices(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 165: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToEnabledImsServices(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 164: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantDefaultPermissionsToEnabledCarrierApps(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 163: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.removeOnPermissionsChangeListener(IOnPermissionsChangeListener.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 162: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.addOnPermissionsChangeListener(IOnPermissionsChangeListener.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 161: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
object = ((Parcel)object).readInt() != 0 ? KeySet.CREATOR.createFromParcel((Parcel)object) : null;
n = this.isPackageSignedByKeySetExactly((String)object4, (KeySet)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 160: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
object = ((Parcel)object).readInt() != 0 ? KeySet.CREATOR.createFromParcel((Parcel)object) : null;
n = this.isPackageSignedByKeySet((String)object4, (KeySet)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 159: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSigningKeySet(((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((KeySet)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 158: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getKeySetByAlias(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((KeySet)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 157: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getBlockUninstallForUser(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 156: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl2;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setBlockUninstallForUser((String)object4, bl11, ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 155: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = this.getPackageInstaller();
((Parcel)object2).writeNoException();
object = object3;
if (object4 != null) {
object = object4.asBinder();
}
((Parcel)object2).writeStrongBinder((IBinder)object);
return true;
}
case 154: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl3;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setSystemAppInstallState((String)object4, bl11, ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 153: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl4;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setSystemAppHiddenUntilInstalled((String)object4, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 152: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getApplicationHiddenSettingAsUser(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 151: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl5;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.setApplicationHiddenSettingAsUser((String)object4, bl11, ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 150: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isStorageLow() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 149: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPermissionEnforced(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 148: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl6;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setPermissionEnforced((String)object4, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 147: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isDeviceUpgrading() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 146: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isOnlyCoreApps() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 145: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isFirstBoot() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 144: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getVerifierDeviceIdentity();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((VerifierDeviceIdentity)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 143: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getDefaultBrowserPackageName(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 142: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.setDefaultBrowserPackageName(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 141: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAllIntentFilters(((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 140: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getIntentFilterVerifications(((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 139: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.updateIntentVerificationStatus(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 138: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getIntentVerificationStatus(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 137: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.verifyIntentFilter(((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).createStringArrayList());
((Parcel)object2).writeNoException();
return true;
}
case 136: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.extendVerificationTimeout(((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readLong());
((Parcel)object2).writeNoException();
return true;
}
case 135: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.verifyPendingInstall(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 134: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.installExistingPackageAsUser(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).createStringArrayList());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 133: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getInstallLocation();
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 132: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.setInstallLocation(((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 131: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = ((Parcel)object).readInt() != 0 ? PermissionInfo.CREATOR.createFromParcel((Parcel)object) : null;
n = this.addPermissionAsync((PermissionInfo)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 130: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.movePrimaryStorage(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 129: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.movePackage(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 128: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.unregisterMoveCallback(IPackageMoveObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 127: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.registerMoveCallback(IPackageMoveObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 126: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getMoveStatus(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 125: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.reconcileSecondaryDexFiles(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 124: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.runBackgroundDexoptJob(((Parcel)object).createStringArrayList()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 123: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.forceDexOpt(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 122: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.dumpProfiles(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 121: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.compileLayouts(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 120: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = ((Parcel)object).readString();
object4 = ((Parcel)object).readString();
bl11 = bl7;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
n = this.performDexOptSecondary((String)object3, (String)object4, bl11) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 119: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = ((Parcel)object).readInt() != 0;
object3 = ((Parcel)object).readString();
bl = ((Parcel)object).readInt() != 0;
bl2 = ((Parcel)object).readInt() != 0;
n = this.performDexOptMode((String)object4, bl11, (String)object3, bl, bl2, ((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 118: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object2 = ((Parcel)object).readString();
object4 = ((Parcel)object).readString();
bl11 = bl8;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.registerDexModule((String)object2, (String)object4, bl11, IDexModuleRegisterCallback.Stub.asInterface(((Parcel)object).readStrongBinder()));
return true;
}
case 117: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.notifyDexLoad(((Parcel)object).readString(), ((Parcel)object).createStringArrayList(), ((Parcel)object).createStringArrayList(), ((Parcel)object).readString());
return true;
}
case 116: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.notifyPackageUse(((Parcel)object).readString(), ((Parcel)object).readInt());
return true;
}
case 115: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.updatePackagesIfNeeded();
((Parcel)object2).writeNoException();
return true;
}
case 114: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.performFstrimIfNeeded();
((Parcel)object2).writeNoException();
return true;
}
case 113: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasSystemUidErrors() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 112: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.systemReady();
((Parcel)object2).writeNoException();
return true;
}
case 111: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isSafeMode() ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 110: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.enterSafeMode();
((Parcel)object2).writeNoException();
return true;
}
case 109: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.hasSystemFeature(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 108: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemAvailableFeatures();
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 107: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSystemSharedLibraryNames();
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 106: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.getPackageSizeInfo(((Parcel)object).readString(), ((Parcel)object).readInt(), IPackageStatsObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 105: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearApplicationProfileData(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 104: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearApplicationUserData(((Parcel)object).readString(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 103: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deleteApplicationCacheFilesAsUser(((Parcel)object).readString(), ((Parcel)object).readInt(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 102: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deleteApplicationCacheFiles(((Parcel)object).readString(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 101: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
long l = ((Parcel)object).readLong();
n = ((Parcel)object).readInt();
object = ((Parcel)object).readInt() != 0 ? IntentSender.CREATOR.createFromParcel((Parcel)object) : null;
this.freeStorage((String)object4, l, n, (IntentSender)object);
((Parcel)object2).writeNoException();
return true;
}
case 100: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.freeStorageAndNotify(((Parcel)object).readString(), ((Parcel)object).readLong(), ((Parcel)object).readInt(), IPackageDataObserver.Stub.asInterface(((Parcel)object).readStrongBinder()));
((Parcel)object2).writeNoException();
return true;
}
case 99: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
bl11 = bl9;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.setPackageStoppedState((String)object4, bl11, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 98: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.flushPackageRestrictionsAsUser(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 97: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.logAppProcessStartIfNeeded(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 96: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getApplicationEnabledSetting(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 95: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setApplicationEnabledSetting(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 94: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
n = this.getComponentEnabledSetting((ComponentName)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 93: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.setComponentEnabledSetting((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 92: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.setHomeActivity((ComponentName)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 91: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = new ArrayList();
object4 = this.getHomeActivities((List<ResolveInfo>)object);
((Parcel)object2).writeNoException();
if (object4 != null) {
((Parcel)object2).writeInt(1);
((ComponentName)object4).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
((Parcel)object2).writeTypedList(object);
return true;
}
case 90: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.restoreIntentFilterVerification(((Parcel)object).createByteArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 89: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getIntentFilterVerificationBackup(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 88: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.restoreDefaultApps(((Parcel)object).createByteArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 87: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getDefaultAppsBackup(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 86: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.restorePreferredActivities(((Parcel)object).createByteArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 85: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPreferredActivityBackup(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeByteArray((byte[])object);
return true;
}
case 84: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getSuspendedPackageAppExtras(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PersistableBundle)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 83: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageSuspendedForUser(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 82: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getUnsuspendablePackagesForUser(((Parcel)object).createStringArray(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 81: {
((Parcel)object).enforceInterface(DESCRIPTOR);
String[] arrstring = ((Parcel)object).createStringArray();
bl11 = ((Parcel)object).readInt() != 0;
object4 = ((Parcel)object).readInt() != 0 ? PersistableBundle.CREATOR.createFromParcel((Parcel)object) : null;
object3 = ((Parcel)object).readInt() != 0 ? PersistableBundle.CREATOR.createFromParcel((Parcel)object) : null;
SuspendDialogInfo suspendDialogInfo = ((Parcel)object).readInt() != 0 ? SuspendDialogInfo.CREATOR.createFromParcel((Parcel)object) : null;
object = this.setPackagesSuspendedAsUser(arrstring, bl11, (PersistableBundle)object4, (PersistableBundle)object3, suspendDialogInfo, ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 80: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.setDistractingPackageRestrictionsAsUser(((Parcel)object).createStringArray(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 79: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearCrossProfileIntentFilters(((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 78: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
this.addCrossProfileIntentFilter((IntentFilter)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 77: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearPackagePersistentPreferredActivities(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 76: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
object3 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.addPersistentPreferredActivity((IntentFilter)object4, (ComponentName)object3, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 75: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object3 = new ArrayList();
object4 = new ArrayList();
n = this.getPreferredActivities((List<IntentFilter>)object3, (List<ComponentName>)object4, ((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
((Parcel)object2).writeTypedList(object3);
((Parcel)object2).writeTypedList(object4);
return true;
}
case 74: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.clearPackagePreferredActivities(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 73: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
n = ((Parcel)object).readInt();
ComponentName[] arrcomponentName = ((Parcel)object).createTypedArray(ComponentName.CREATOR);
object3 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.replacePreferredActivity((IntentFilter)object4, n, arrcomponentName, (ComponentName)object3, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 72: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
n = ((Parcel)object).readInt();
ComponentName[] arrcomponentName = ((Parcel)object).createTypedArray(ComponentName.CREATOR);
object3 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.addPreferredActivity((IntentFilter)object4, n, arrcomponentName, (ComponentName)object3, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 71: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
String string2 = ((Parcel)object).readString();
n2 = ((Parcel)object).readInt();
object3 = ((Parcel)object).readInt() != 0 ? IntentFilter.CREATOR.createFromParcel((Parcel)object) : null;
n = ((Parcel)object).readInt();
object = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
this.setLastChosenActivity((Intent)object4, string2, n2, (IntentFilter)object3, n, (ComponentName)object);
((Parcel)object2).writeNoException();
return true;
}
case 70: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getLastChosenActivity((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 69: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.resetApplicationPreferences(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 68: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstallerPackageName(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 67: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? VersionedPackage.CREATOR.createFromParcel((Parcel)object) : null;
this.deletePackageVersioned((VersionedPackage)object4, IPackageDeleteObserver2.Stub.asInterface(((Parcel)object).readStrongBinder()), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 66: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.deletePackageAsUser(((Parcel)object).readString(), ((Parcel)object).readInt(), IPackageDeleteObserver.Stub.asInterface(((Parcel)object).readStrongBinder()), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 65: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setApplicationCategoryHint(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 64: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.setInstallerPackageName(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 63: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = ((Parcel)object).readInt();
bl11 = bl10;
if (((Parcel)object).readInt() != 0) {
bl11 = true;
}
this.finishPackageInstall(n, bl11);
((Parcel)object2).writeNoException();
return true;
}
case 62: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.queryInstrumentation(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 61: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getInstrumentationInfo((ComponentName)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((InstrumentationInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 60: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.queryContentProviders(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 59: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).createStringArrayList();
object = ((Parcel)object).createTypedArrayList(ProviderInfo.CREATOR);
this.querySyncProviders((List<String>)object4, (List<ProviderInfo>)object);
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringList((List<String>)object4);
((Parcel)object2).writeTypedList(object);
return true;
}
case 58: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.resolveContentProvider(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ProviderInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 57: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPersistentApplications(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 56: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstalledApplications(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 55: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackagesHoldingPermissions(((Parcel)object).createStringArray(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 54: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getInstalledPackages(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 53: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentContentProviders((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 52: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentServices((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 51: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.resolveService((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 50: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentReceivers((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 49: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
Intent[] arrintent = ((Parcel)object).createTypedArray(Intent.CREATOR);
String[] arrstring = ((Parcel)object).createStringArray();
object3 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentActivityOptions((ComponentName)object4, arrintent, arrstring, (Intent)object3, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 48: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.queryIntentActivities((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 47: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
n = this.canForwardTo((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 46: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.findPersistentPreferredActivity((Intent)object4, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 45: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
object = this.resolveIntent((Intent)object4, ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ResolveInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 44: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAppOpPermissionPackages(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 43: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isUidPrivileged(((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 42: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getPrivateFlagsForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 41: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getFlagsForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 40: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getUidForSharedUser(((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 39: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getNamesForUids(((Parcel)object).createIntArray());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 38: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getNameForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeString((String)object);
return true;
}
case 37: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackagesForUid(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 36: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAllPackages();
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringList((List<String>)object);
return true;
}
case 35: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkUidSignatures(((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 34: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkSignatures(((Parcel)object).readString(), ((Parcel)object).readString());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 33: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isProtectedBroadcast(((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 32: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.shouldShowRequestPermissionRationale(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 31: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.removeWhitelistedRestrictedPermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 30: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.addWhitelistedRestrictedPermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 29: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getWhitelistedRestrictedPermissions(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringList((List<String>)object);
return true;
}
case 28: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.updatePermissionFlagsForAllApps(((Parcel)object).readInt(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 27: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readString();
object3 = ((Parcel)object).readString();
n2 = ((Parcel)object).readInt();
n = ((Parcel)object).readInt();
bl11 = ((Parcel)object).readInt() != 0;
this.updatePermissionFlags((String)object4, (String)object3, n2, n, bl11, ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 26: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getPermissionFlags(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 25: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.resetRuntimePermissions();
((Parcel)object2).writeNoException();
return true;
}
case 24: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.revokeRuntimePermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 23: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.grantRuntimePermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
case 22: {
((Parcel)object).enforceInterface(DESCRIPTOR);
this.removePermission(((Parcel)object).readString());
((Parcel)object2).writeNoException();
return true;
}
case 21: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = ((Parcel)object).readInt() != 0 ? PermissionInfo.CREATOR.createFromParcel((Parcel)object) : null;
n = this.addPermission((PermissionInfo)object) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 20: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkUidPermission(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 19: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.checkPermission(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 18: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getProviderInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ProviderInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 17: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getServiceInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ServiceInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 16: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getReceiverInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ActivityInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 15: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object3 = ((Parcel)object).readInt() != 0 ? Intent.CREATOR.createFromParcel((Parcel)object) : null;
n = this.activitySupportsIntent((ComponentName)object4, (Intent)object3, ((Parcel)object).readString()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 14: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? ComponentName.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getActivityInfo((ComponentName)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ActivityInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 13: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getApplicationInfo(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ApplicationInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 12: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getAllPermissionGroups(((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 11: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPermissionGroupInfo(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PermissionGroupInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 10: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.queryPermissionsByGroup(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((ParceledListSlice)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 9: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPermissionInfo(((Parcel)object).readString(), ((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PermissionInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 8: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.canonicalToCurrentPackageNames(((Parcel)object).createStringArray());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 7: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.currentToCanonicalPackageNames(((Parcel)object).createStringArray());
((Parcel)object2).writeNoException();
((Parcel)object2).writeStringArray((String[])object);
return true;
}
case 6: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackageGids(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeIntArray((int[])object);
return true;
}
case 5: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.getPackageUid(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 4: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object4 = ((Parcel)object).readInt() != 0 ? VersionedPackage.CREATOR.createFromParcel((Parcel)object) : null;
object = this.getPackageInfoVersioned((VersionedPackage)object4, ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PackageInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 3: {
((Parcel)object).enforceInterface(DESCRIPTOR);
object = this.getPackageInfo(((Parcel)object).readString(), ((Parcel)object).readInt(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
if (object != null) {
((Parcel)object2).writeInt(1);
((PackageInfo)object).writeToParcel((Parcel)object2, 1);
} else {
((Parcel)object2).writeInt(0);
}
return true;
}
case 2: {
((Parcel)object).enforceInterface(DESCRIPTOR);
n = this.isPackageAvailable(((Parcel)object).readString(), ((Parcel)object).readInt()) ? 1 : 0;
((Parcel)object2).writeNoException();
((Parcel)object2).writeInt(n);
return true;
}
case 1:
}
((Parcel)object).enforceInterface(DESCRIPTOR);
this.checkPackageStartable(((Parcel)object).readString(), ((Parcel)object).readInt());
((Parcel)object2).writeNoException();
return true;
}
((Parcel)object2).writeString(DESCRIPTOR);
return true;
}
private static class Proxy
implements IPackageManager {
public static IPackageManager sDefaultImpl;
private IBinder mRemote;
Proxy(IBinder iBinder) {
this.mRemote = iBinder;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean activitySupportsIntent(ComponentName componentName, Intent intent, String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (intent != null) {
parcel.writeInt(1);
intent.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString(string2);
if (!this.mRemote.transact(15, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().activitySupportsIntent(componentName, intent, string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void addCrossProfileIntentFilter(IntentFilter intentFilter, String string2, int n, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(78, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addCrossProfileIntentFilter(intentFilter, string2, n, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void addOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iOnPermissionsChangeListener != null ? iOnPermissionsChangeListener.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(162, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addOnPermissionsChangeListener(iOnPermissionsChangeListener);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean addPermission(PermissionInfo permissionInfo) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (permissionInfo != null) {
parcel.writeInt(1);
permissionInfo.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(21, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().addPermission(permissionInfo);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean addPermissionAsync(PermissionInfo permissionInfo) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (permissionInfo != null) {
parcel.writeInt(1);
permissionInfo.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(131, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().addPermissionAsync(permissionInfo);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void addPersistentPreferredActivity(IntentFilter intentFilter, ComponentName componentName, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(76, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addPersistentPreferredActivity(intentFilter, componentName, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void addPreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
parcel.writeTypedArray((Parcelable[])arrcomponentName, 0);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n2);
if (!this.mRemote.transact(72, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().addPreferredActivity(intentFilter, n, arrcomponentName, componentName, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean addWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeString(string3);
parcel2.writeInt(n);
parcel2.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(30, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().addWhitelistedRestrictedPermission(string2, string3, n, n2);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public IBinder asBinder() {
return this.mRemote;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean canForwardTo(Intent intent, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
boolean bl = true;
if (intent != null) {
parcel.writeInt(1);
intent.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(47, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().canForwardTo(intent, string2, n, n2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public boolean canRequestPackageInstalls(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(186, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().canRequestPackageInstalls(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public String[] canonicalToCurrentPackageNames(String[] arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
if (!this.mRemote.transact(8, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().canonicalToCurrentPackageNames(arrstring);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void checkPackageStartable(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(1, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().checkPackageStartable(string2, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkPermission(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(19, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().checkPermission(string2, string3, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkSignatures(String string2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
if (!this.mRemote.transact(34, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().checkSignatures(string2, string3);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkUidPermission(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(20, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().checkUidPermission(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int checkUidSignatures(int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(35, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().checkUidSignatures(n, n2);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearApplicationProfileData(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(105, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearApplicationProfileData(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void clearApplicationUserData(String string2, IPackageDataObserver iPackageDataObserver, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
parcel.writeInt(n);
if (!this.mRemote.transact(104, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearApplicationUserData(string2, iPackageDataObserver, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearCrossProfileIntentFilters(int n, String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeString(string2);
if (!this.mRemote.transact(79, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearCrossProfileIntentFilters(n, string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearPackagePersistentPreferredActivities(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(77, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearPackagePersistentPreferredActivities(string2, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void clearPackagePreferredActivities(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(74, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().clearPackagePreferredActivities(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean compileLayouts(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(121, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().compileLayouts(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public String[] currentToCanonicalPackageNames(String[] arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
if (!this.mRemote.transact(7, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().currentToCanonicalPackageNames(arrstring);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deleteApplicationCacheFiles(String string2, IPackageDataObserver iPackageDataObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(102, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deleteApplicationCacheFiles(string2, iPackageDataObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deleteApplicationCacheFilesAsUser(String string2, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(103, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deleteApplicationCacheFilesAsUser(string2, n, iPackageDataObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deletePackageAsUser(String string2, int n, IPackageDeleteObserver iPackageDeleteObserver, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
IBinder iBinder = iPackageDeleteObserver != null ? iPackageDeleteObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(66, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deletePackageAsUser(string2, n, iPackageDeleteObserver, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void deletePackageVersioned(VersionedPackage versionedPackage, IPackageDeleteObserver2 iPackageDeleteObserver2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (versionedPackage != null) {
parcel.writeInt(1);
versionedPackage.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
IBinder iBinder = iPackageDeleteObserver2 != null ? iPackageDeleteObserver2.asBinder() : null;
parcel.writeStrongBinder(iBinder);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(67, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deletePackageVersioned(versionedPackage, iPackageDeleteObserver2, n, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void deletePreloadsFileCache() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(187, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().deletePreloadsFileCache();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void dumpProfiles(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(122, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().dumpProfiles(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void enterSafeMode() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(110, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().enterSafeMode();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void extendVerificationTimeout(int n, int n2, long l) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeLong(l);
if (!this.mRemote.transact(136, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().extendVerificationTimeout(n, n2, l);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo findPersistentPreferredActivity(Intent parcelable, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
if (!this.mRemote.transact(46, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().findPersistentPreferredActivity((Intent)parcelable, (int)var2_7);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void finishPackageInstall(int n, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
int n2 = bl ? 1 : 0;
try {
parcel.writeInt(n2);
if (!this.mRemote.transact(63, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().finishPackageInstall(n, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void flushPackageRestrictionsAsUser(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(98, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().flushPackageRestrictionsAsUser(n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void forceDexOpt(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(123, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().forceDexOpt(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void freeStorage(String string2, long l, int n, IntentSender intentSender) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeLong(l);
parcel.writeInt(n);
if (intentSender != null) {
parcel.writeInt(1);
intentSender.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(101, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().freeStorage(string2, l, n, intentSender);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void freeStorageAndNotify(String string2, long l, int n, IPackageDataObserver iPackageDataObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeLong(l);
parcel.writeInt(n);
IBinder iBinder = iPackageDataObserver != null ? iPackageDataObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(100, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().freeStorageAndNotify(string2, l, n, iPackageDataObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ActivityInfo getActivityInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(14, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ActivityInfo activityInfo = Stub.getDefaultImpl().getActivityInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return activityInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ActivityInfo activityInfo = ActivityInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public ParceledListSlice getAllIntentFilters(String parceledListSlice) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
if (this.mRemote.transact(141, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getAllIntentFilters((String)((Object)parceledListSlice));
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public List<String> getAllPackages() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(36, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
List<String> list = Stub.getDefaultImpl().getAllPackages();
return list;
}
parcel2.readException();
ArrayList<String> arrayList = parcel2.createStringArrayList();
return arrayList;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getAllPermissionGroups(int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (this.mRemote.transact(12, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getAllPermissionGroups(n);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
ParceledListSlice parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public String[] getAppOpPermissionPackages(String arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)arrstring);
if (!this.mRemote.transact(44, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().getAppOpPermissionPackages((String)arrstring);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getAppPredictionServicePackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(200, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getAppPredictionServicePackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getApplicationEnabledSetting(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(96, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getApplicationEnabledSetting(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean getApplicationHiddenSettingAsUser(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(152, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().getApplicationHiddenSettingAsUser(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public ApplicationInfo getApplicationInfo(String object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(13, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getApplicationInfo((String)object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? ApplicationInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public IArtManager getArtManager() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(192, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
IArtManager iArtManager = Stub.getDefaultImpl().getArtManager();
return iArtManager;
}
parcel2.readException();
IArtManager iArtManager = IArtManager.Stub.asInterface(parcel2.readStrongBinder());
return iArtManager;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getAttentionServicePackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(198, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getAttentionServicePackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean getBlockUninstallForUser(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(157, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().getBlockUninstallForUser(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public ChangedPackages getChangedPackages(int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeInt(n);
parcel2.writeInt(n2);
if (this.mRemote.transact(181, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ChangedPackages changedPackages = Stub.getDefaultImpl().getChangedPackages(n, n2);
parcel.recycle();
parcel2.recycle();
return changedPackages;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ChangedPackages changedPackages = parcel.readInt() != 0 ? ChangedPackages.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return changedPackages;
}
@Override
public int getComponentEnabledSetting(ComponentName componentName, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(94, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getComponentEnabledSetting(componentName, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getDeclaredSharedLibraries(String parceledListSlice, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(185, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getDeclaredSharedLibraries((String)((Object)parceledListSlice), n, n2);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public byte[] getDefaultAppsBackup(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(87, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
byte[] arrby = Stub.getDefaultImpl().getDefaultAppsBackup(n);
return arrby;
}
parcel2.readException();
byte[] arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getDefaultBrowserPackageName(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(143, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getDefaultBrowserPackageName(n);
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getFlagsForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(41, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getFlagsForUid(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public CharSequence getHarmfulAppWarning(String charSequence, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)charSequence);
parcel2.writeInt(n);
if (this.mRemote.transact(194, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
charSequence = Stub.getDefaultImpl().getHarmfulAppWarning((String)charSequence, n);
parcel.recycle();
parcel2.recycle();
return charSequence;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
charSequence = parcel.readInt() != 0 ? TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return charSequence;
}
@Override
public ComponentName getHomeActivities(List<ResolveInfo> object) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(91, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
object = Stub.getDefaultImpl().getHomeActivities((List<ResolveInfo>)object);
return object;
}
parcel2.readException();
ComponentName componentName = parcel2.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel2) : null;
parcel2.readTypedList(object, ResolveInfo.CREATOR);
return componentName;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getIncidentReportApproverPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(202, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getIncidentReportApproverPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getInstallLocation() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(133, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().getInstallLocation();
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getInstallReason(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(183, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getInstallReason(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getInstalledApplications(int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeInt(n);
parcel2.writeInt(n2);
if (this.mRemote.transact(56, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getInstalledApplications(n, n2);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ParceledListSlice parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public List<ModuleInfo> getInstalledModules(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(205, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
List<ModuleInfo> list = Stub.getDefaultImpl().getInstalledModules(n);
return list;
}
parcel2.readException();
ArrayList<ModuleInfo> arrayList = parcel2.createTypedArrayList(ModuleInfo.CREATOR);
return arrayList;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getInstalledPackages(int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeInt(n);
parcel2.writeInt(n2);
if (this.mRemote.transact(54, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getInstalledPackages(n, n2);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ParceledListSlice parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public String getInstallerPackageName(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(68, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
string2 = Stub.getDefaultImpl().getInstallerPackageName(string2);
return string2;
}
parcel2.readException();
string2 = parcel2.readString();
return string2;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getInstantAppAndroidId(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(191, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
string2 = Stub.getDefaultImpl().getInstantAppAndroidId(string2, n);
return string2;
}
parcel2.readException();
string2 = parcel2.readString();
return string2;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public byte[] getInstantAppCookie(String arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(173, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrby = Stub.getDefaultImpl().getInstantAppCookie((String)arrby, n);
return arrby;
}
parcel2.readException();
arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public Bitmap getInstantAppIcon(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(175, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getInstantAppIcon((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? Bitmap.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public ComponentName getInstantAppInstallerComponent() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(190, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ComponentName componentName = Stub.getDefaultImpl().getInstantAppInstallerComponent();
parcel.recycle();
parcel2.recycle();
return componentName;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ComponentName componentName = parcel.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return componentName;
}
@Override
public ComponentName getInstantAppResolverComponent() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(188, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ComponentName componentName = Stub.getDefaultImpl().getInstantAppResolverComponent();
parcel.recycle();
parcel2.recycle();
return componentName;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ComponentName componentName = parcel.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return componentName;
}
@Override
public ComponentName getInstantAppResolverSettingsComponent() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(189, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ComponentName componentName = Stub.getDefaultImpl().getInstantAppResolverSettingsComponent();
parcel.recycle();
parcel2.recycle();
return componentName;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ComponentName componentName = parcel.readInt() != 0 ? ComponentName.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return componentName;
}
@Override
public ParceledListSlice getInstantApps(int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (this.mRemote.transact(172, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getInstantApps(n);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
ParceledListSlice parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public InstrumentationInfo getInstrumentationInfo(ComponentName parcelable, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
if (!this.mRemote.transact(61, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
InstrumentationInfo instrumentationInfo = Stub.getDefaultImpl().getInstrumentationInfo((ComponentName)parcelable, (int)var2_7);
parcel2.recycle();
parcel.recycle();
return instrumentationInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
InstrumentationInfo instrumentationInfo = InstrumentationInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public byte[] getIntentFilterVerificationBackup(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(89, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
byte[] arrby = Stub.getDefaultImpl().getIntentFilterVerificationBackup(n);
return arrby;
}
parcel2.readException();
byte[] arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getIntentFilterVerifications(String parceledListSlice) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
if (this.mRemote.transact(140, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getIntentFilterVerifications((String)((Object)parceledListSlice));
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public int getIntentVerificationStatus(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(138, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getIntentVerificationStatus(string2, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
public String getInterfaceDescriptor() {
return Stub.DESCRIPTOR;
}
@Override
public KeySet getKeySetByAlias(String object, String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeString(string2);
if (this.mRemote.transact(158, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getKeySetByAlias((String)object, string2);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? KeySet.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo getLastChosenActivity(Intent parcelable, String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(70, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().getLastChosenActivity((Intent)parcelable, (String)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public ModuleInfo getModuleInfo(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(206, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getModuleInfo((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? ModuleInfo.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public int getMoveStatus(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(126, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getMoveStatus(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getNameForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(38, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getNameForUid(n);
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getNamesForUids(int[] arrobject) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeIntArray((int[])arrobject);
if (!this.mRemote.transact(39, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrobject = Stub.getDefaultImpl().getNamesForUids((int[])arrobject);
return arrobject;
}
parcel2.readException();
arrobject = parcel2.createStringArray();
return arrobject;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int[] getPackageGids(String arrn, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)arrn);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(6, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrn = Stub.getDefaultImpl().getPackageGids((String)arrn, n, n2);
return arrn;
}
parcel2.readException();
arrn = parcel2.createIntArray();
return arrn;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public PackageInfo getPackageInfo(String object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(3, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPackageInfo((String)object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? PackageInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public PackageInfo getPackageInfoVersioned(VersionedPackage parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((VersionedPackage)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(4, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
PackageInfo packageInfo = Stub.getDefaultImpl().getPackageInfoVersioned((VersionedPackage)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return packageInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
PackageInfo packageInfo = PackageInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public IPackageInstaller getPackageInstaller() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(155, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
IPackageInstaller iPackageInstaller = Stub.getDefaultImpl().getPackageInstaller();
return iPackageInstaller;
}
parcel2.readException();
IPackageInstaller iPackageInstaller = IPackageInstaller.Stub.asInterface(parcel2.readStrongBinder());
return iPackageInstaller;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void getPackageSizeInfo(String string2, int n, IPackageStatsObserver iPackageStatsObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
IBinder iBinder = iPackageStatsObserver != null ? iPackageStatsObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(106, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().getPackageSizeInfo(string2, n, iPackageStatsObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getPackageUid(String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(5, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getPackageUid(string2, n, n2);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getPackagesForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(37, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String[] arrstring = Stub.getDefaultImpl().getPackagesForUid(n);
return arrstring;
}
parcel2.readException();
String[] arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getPackagesHoldingPermissions(String[] object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray((String[])object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(55, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPackagesHoldingPermissions((String[])object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public String getPermissionControllerPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(171, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getPermissionControllerPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getPermissionFlags(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(26, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getPermissionFlags(string2, string3, n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public PermissionGroupInfo getPermissionGroupInfo(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(11, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPermissionGroupInfo((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? PermissionGroupInfo.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public PermissionInfo getPermissionInfo(String object, String string2, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeString(string2);
parcel.writeInt(n);
if (this.mRemote.transact(9, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getPermissionInfo((String)object, string2, n);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? PermissionInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public ParceledListSlice getPersistentApplications(int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (this.mRemote.transact(57, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getPersistentApplications(n);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
ParceledListSlice parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public int getPreferredActivities(List<IntentFilter> list, List<ComponentName> list2, String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(75, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().getPreferredActivities(list, list2, string2);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
parcel2.readTypedList(list, IntentFilter.CREATOR);
parcel2.readTypedList(list2, ComponentName.CREATOR);
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public byte[] getPreferredActivityBackup(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(85, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
byte[] arrby = Stub.getDefaultImpl().getPreferredActivityBackup(n);
return arrby;
}
parcel2.readException();
byte[] arrby = parcel2.createByteArray();
return arrby;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getPrivateFlagsForUid(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(42, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getPrivateFlagsForUid(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ProviderInfo getProviderInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(18, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ProviderInfo providerInfo = Stub.getDefaultImpl().getProviderInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return providerInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ProviderInfo providerInfo = ProviderInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ActivityInfo getReceiverInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(16, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ActivityInfo activityInfo = Stub.getDefaultImpl().getReceiverInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return activityInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ActivityInfo activityInfo = ActivityInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public int getRuntimePermissionsVersion(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(207, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().getRuntimePermissionsVersion(n);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ServiceInfo getServiceInfo(ComponentName parcelable, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt((int)var2_7);
parcel.writeInt((int)var3_8);
if (!this.mRemote.transact(17, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ServiceInfo serviceInfo = Stub.getDefaultImpl().getServiceInfo((ComponentName)parcelable, (int)var2_7, (int)var3_8);
parcel2.recycle();
parcel.recycle();
return serviceInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ServiceInfo serviceInfo = ServiceInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public String getServicesSystemSharedLibraryPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(179, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getServicesSystemSharedLibraryPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice getSharedLibraries(String parceledListSlice, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)parceledListSlice));
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(184, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().getSharedLibraries((String)((Object)parceledListSlice), n, n2);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
parceledListSlice = parcel2.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
@Override
public String getSharedSystemSharedLibraryPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(180, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getSharedSystemSharedLibraryPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public KeySet getSigningKeySet(String object) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
if (this.mRemote.transact(159, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getSigningKeySet((String)object);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? KeySet.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
@Override
public PersistableBundle getSuspendedPackageAppExtras(String object, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)object);
parcel2.writeInt(n);
if (this.mRemote.transact(84, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().getSuspendedPackageAppExtras((String)object, n);
parcel.recycle();
parcel2.recycle();
return object;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
object = parcel.readInt() != 0 ? PersistableBundle.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return object;
}
@Override
public ParceledListSlice getSystemAvailableFeatures() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(108, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().getSystemAvailableFeatures();
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
ParceledListSlice parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public String getSystemCaptionsServicePackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(201, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getSystemCaptionsServicePackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getSystemSharedLibraryNames() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(107, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String[] arrstring = Stub.getDefaultImpl().getSystemSharedLibraryNames();
return arrstring;
}
parcel2.readException();
String[] arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String getSystemTextClassifierPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(197, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getSystemTextClassifierPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int getUidForSharedUser(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(40, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().getUidForSharedUser(string2);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public String[] getUnsuspendablePackagesForUser(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(82, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().getUnsuspendablePackagesForUser(arrstring, n);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public VerifierDeviceIdentity getVerifierDeviceIdentity() throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (this.mRemote.transact(144, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
VerifierDeviceIdentity verifierDeviceIdentity = Stub.getDefaultImpl().getVerifierDeviceIdentity();
parcel.recycle();
parcel2.recycle();
return verifierDeviceIdentity;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
VerifierDeviceIdentity verifierDeviceIdentity = parcel.readInt() != 0 ? VerifierDeviceIdentity.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return verifierDeviceIdentity;
}
@Override
public String getWellbeingPackageName() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(199, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
String string2 = Stub.getDefaultImpl().getWellbeingPackageName();
return string2;
}
parcel2.readException();
String string3 = parcel2.readString();
return string3;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public List<String> getWhitelistedRestrictedPermissions(String list, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)((Object)list));
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(29, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
list = Stub.getDefaultImpl().getWhitelistedRestrictedPermissions((String)((Object)list), n, n2);
return list;
}
parcel2.readException();
list = parcel2.createStringArrayList();
return list;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToActiveLuiApp(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(168, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToActiveLuiApp(string2, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToEnabledCarrierApps(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(164, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToEnabledCarrierApps(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToEnabledImsServices(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(165, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToEnabledImsServices(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantDefaultPermissionsToEnabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(166, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantDefaultPermissionsToEnabledTelephonyDataServices(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void grantRuntimePermission(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(23, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().grantRuntimePermission(string2, string3, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean hasSigningCertificate(String string2, byte[] arrby, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(195, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasSigningCertificate(string2, arrby, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean hasSystemFeature(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(109, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasSystemFeature(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean hasSystemUidErrors() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(113, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasSystemUidErrors();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean hasUidSigningCertificate(int n, byte[] arrby, int n2) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeByteArray(arrby);
parcel.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(196, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().hasUidSigningCertificate(n, arrby, n2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public int installExistingPackageAsUser(String string2, int n, int n2, int n3, List<String> list) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
parcel.writeStringList(list);
if (!this.mRemote.transact(134, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
n = Stub.getDefaultImpl().installExistingPackageAsUser(string2, n, n2, n3, list);
return n;
}
parcel2.readException();
n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean isDeviceUpgrading() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(147, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isDeviceUpgrading();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isFirstBoot() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(145, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isFirstBoot();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isInstantApp(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(176, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isInstantApp(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isOnlyCoreApps() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(146, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isOnlyCoreApps();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPackageAvailable(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(2, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageAvailable(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPackageDeviceAdminOnAnyUser(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(182, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageDeviceAdminOnAnyUser(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean isPackageSignedByKeySet(String string2, KeySet keySet) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
boolean bl = true;
if (keySet != null) {
parcel.writeInt(1);
keySet.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(160, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().isPackageSignedByKeySet(string2, keySet);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public boolean isPackageSignedByKeySetExactly(String string2, KeySet keySet) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
boolean bl = true;
if (keySet != null) {
parcel.writeInt(1);
keySet.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
if (!this.mRemote.transact(161, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().isPackageSignedByKeySetExactly(string2, keySet);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n == 0) {
bl = false;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public boolean isPackageStateProtected(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(203, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageStateProtected(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPackageSuspendedForUser(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(83, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPackageSuspendedForUser(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isPermissionEnforced(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(149, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPermissionEnforced(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean isPermissionRevokedByPolicy(String string2, String string3, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(170, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isPermissionRevokedByPolicy(string2, string3, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean isProtectedBroadcast(String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(33, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isProtectedBroadcast(string2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean isSafeMode() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(111, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isSafeMode();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isStorageLow() throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(150, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isStorageLow();
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
int n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public boolean isUidPrivileged(int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(43, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().isUidPrivileged(n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void logAppProcessStartIfNeeded(String string2, int n, String string3, String string4, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeString(string3);
parcel.writeString(string4);
parcel.writeInt(n2);
if (!this.mRemote.transact(97, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().logAppProcessStartIfNeeded(string2, n, string3, string4, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int movePackage(String string2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
if (!this.mRemote.transact(129, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().movePackage(string2, string3);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public int movePrimaryStorage(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(130, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
int n = Stub.getDefaultImpl().movePrimaryStorage(string2);
return n;
}
parcel2.readException();
int n = parcel2.readInt();
return n;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void notifyDexLoad(String string2, List<String> list, List<String> list2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeStringList(list);
parcel.writeStringList(list2);
parcel.writeString(string3);
if (!this.mRemote.transact(117, parcel, null, 1) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().notifyDexLoad(string2, list, list2, string3);
return;
}
return;
}
finally {
parcel.recycle();
}
}
@Override
public void notifyPackageUse(String string2, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
if (!this.mRemote.transact(116, parcel, null, 1) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().notifyPackageUse(string2, n);
return;
}
return;
}
finally {
parcel.recycle();
}
}
@Override
public void notifyPackagesReplacedReceived(String[] arrstring) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
if (!this.mRemote.transact(209, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().notifyPackagesReplacedReceived(arrstring);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public boolean performDexOptMode(String string2, boolean bl, String string3, boolean bl2, boolean bl3, String string4) throws RemoteException {
Parcel parcel;
void var1_7;
Parcel parcel2;
block12 : {
int n;
boolean bl4;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
try {
parcel2.writeString(string2);
bl4 = true;
n = bl ? 1 : 0;
parcel2.writeInt(n);
}
catch (Throwable throwable) {}
try {
parcel2.writeString(string3);
n = bl2 ? 1 : 0;
parcel2.writeInt(n);
n = bl3 ? 1 : 0;
parcel2.writeInt(n);
}
catch (Throwable throwable) {}
try {
parcel2.writeString(string4);
}
catch (Throwable throwable) {
break block12;
}
try {
if (!this.mRemote.transact(119, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
bl = Stub.getDefaultImpl().performDexOptMode(string2, bl, string3, bl2, bl3, string4);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
bl = n != 0 ? bl4 : false;
parcel.recycle();
parcel2.recycle();
return bl;
}
catch (Throwable throwable) {}
break block12;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_7;
}
@Override
public boolean performDexOptSecondary(String string2, String string3, boolean bl) throws RemoteException {
Parcel parcel;
int n;
boolean bl2;
Parcel parcel2;
block4 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
bl2 = true;
n = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n);
if (this.mRemote.transact(120, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().performDexOptSecondary(string2, string3, bl);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void performFstrimIfNeeded() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(114, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().performFstrimIfNeeded();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ParceledListSlice queryContentProviders(String parceledListSlice, int n, int n2, String string2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)((Object)parceledListSlice));
parcel2.writeInt(n);
parcel2.writeInt(n2);
parcel2.writeString(string2);
if (this.mRemote.transact(60, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().queryContentProviders((String)((Object)parceledListSlice), n, n2, string2);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public ParceledListSlice queryInstrumentation(String parceledListSlice, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)((Object)parceledListSlice));
parcel2.writeInt(n);
if (this.mRemote.transact(62, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().queryInstrumentation((String)((Object)parceledListSlice), n);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentActivities(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(48, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentActivities((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public ParceledListSlice queryIntentActivityOptions(ComponentName parcelable, Intent[] arrintent, String[] arrstring, Intent intent, String string2, int n, int n2) throws RemoteException {
Parcel parcel;
void var1_10;
Parcel parcel2;
block16 : {
void var4_13;
void var3_12;
void var2_11;
block15 : {
block14 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((ComponentName)parcelable).writeToParcel(parcel, 0);
break block14;
}
parcel.writeInt(0);
}
try {
parcel.writeTypedArray((Parcelable[])var2_11, 0);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel.writeStringArray((String[])var3_12);
if (var4_13 != null) {
parcel.writeInt(1);
var4_13.writeToParcel(parcel, 0);
break block15;
}
parcel.writeInt(0);
}
catch (Throwable throwable) {}
}
try {
void var5_14;
void var6_15;
void var1_5;
void var7_16;
parcel.writeString((String)var5_14);
parcel.writeInt((int)var6_15);
parcel.writeInt((int)var7_16);
if (!this.mRemote.transact(49, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentActivityOptions((ComponentName)parcelable, (Intent[])var2_11, (String[])var3_12, (Intent)var4_13, (String)var5_14, (int)var6_15, (int)var7_16);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {}
break block16;
catch (Throwable throwable) {
// empty catch block
}
}
parcel2.recycle();
parcel.recycle();
throw var1_10;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentContentProviders(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(53, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentContentProviders((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentReceivers(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(50, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentReceivers((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ParceledListSlice queryIntentServices(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(52, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ParceledListSlice parceledListSlice = Stub.getDefaultImpl().queryIntentServices((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return parceledListSlice;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ParceledListSlice parceledListSlice = (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public ParceledListSlice queryPermissionsByGroup(String parceledListSlice, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString((String)((Object)parceledListSlice));
parcel2.writeInt(n);
if (this.mRemote.transact(10, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block3;
parceledListSlice = Stub.getDefaultImpl().queryPermissionsByGroup((String)((Object)parceledListSlice), n);
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
}
parcel.readException();
parceledListSlice = parcel.readInt() != 0 ? (ParceledListSlice)ParceledListSlice.CREATOR.createFromParcel(parcel) : null;
parcel.recycle();
parcel2.recycle();
return parceledListSlice;
}
@Override
public void querySyncProviders(List<String> list, List<ProviderInfo> list2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringList(list);
parcel.writeTypedList(list2);
if (!this.mRemote.transact(59, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().querySyncProviders(list, list2);
return;
}
parcel2.readException();
parcel2.readStringList(list);
parcel2.readTypedList(list2, ProviderInfo.CREATOR);
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void reconcileSecondaryDexFiles(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(125, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().reconcileSecondaryDexFiles(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void registerDexModule(String string2, String string3, boolean bl, IDexModuleRegisterCallback iDexModuleRegisterCallback) throws RemoteException {
Parcel parcel = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
int n = bl ? 1 : 0;
parcel.writeInt(n);
IBinder iBinder = iDexModuleRegisterCallback != null ? iDexModuleRegisterCallback.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (this.mRemote.transact(118, parcel, null, 1)) return;
if (Stub.getDefaultImpl() == null) return;
Stub.getDefaultImpl().registerDexModule(string2, string3, bl, iDexModuleRegisterCallback);
return;
}
finally {
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void registerMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iPackageMoveObserver != null ? iPackageMoveObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(127, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().registerMoveCallback(iPackageMoveObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void removeOnPermissionsChangeListener(IOnPermissionsChangeListener iOnPermissionsChangeListener) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iOnPermissionsChangeListener != null ? iOnPermissionsChangeListener.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(163, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().removeOnPermissionsChangeListener(iOnPermissionsChangeListener);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void removePermission(String string2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (!this.mRemote.transact(22, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().removePermission(string2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean removeWhitelistedRestrictedPermission(String string2, String string3, int n, int n2) throws RemoteException {
boolean bl;
Parcel parcel;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeString(string3);
parcel2.writeInt(n);
parcel2.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(31, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().removeWhitelistedRestrictedPermission(string2, string3, n, n2);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public void replacePreferredActivity(IntentFilter intentFilter, int n, ComponentName[] arrcomponentName, ComponentName componentName, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (intentFilter != null) {
parcel.writeInt(1);
intentFilter.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
parcel.writeTypedArray((Parcelable[])arrcomponentName, 0);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n2);
if (!this.mRemote.transact(73, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().replacePreferredActivity(intentFilter, n, arrcomponentName, componentName, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void resetApplicationPreferences(int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
if (!this.mRemote.transact(69, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().resetApplicationPreferences(n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void resetRuntimePermissions() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(25, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().resetRuntimePermissions();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public ProviderInfo resolveContentProvider(String object, int n, int n2) throws RemoteException {
Parcel parcel;
Parcel parcel2;
block3 : {
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString((String)object);
parcel.writeInt(n);
parcel.writeInt(n2);
if (this.mRemote.transact(58, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block3;
object = Stub.getDefaultImpl().resolveContentProvider((String)object, n, n2);
parcel2.recycle();
parcel.recycle();
return object;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
parcel2.readException();
object = parcel2.readInt() != 0 ? ProviderInfo.CREATOR.createFromParcel(parcel2) : null;
parcel2.recycle();
parcel.recycle();
return object;
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo resolveIntent(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(45, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().resolveIntent((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
/*
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public ResolveInfo resolveService(Intent parcelable, String string2, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
void var3_8;
void var2_7;
void var4_9;
void var1_5;
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (parcelable != null) {
parcel.writeInt(1);
((Intent)parcelable).writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeString((String)var2_7);
parcel.writeInt((int)var3_8);
parcel.writeInt((int)var4_9);
if (!this.mRemote.transact(51, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
ResolveInfo resolveInfo = Stub.getDefaultImpl().resolveService((Intent)parcelable, (String)var2_7, (int)var3_8, (int)var4_9);
parcel2.recycle();
parcel.recycle();
return resolveInfo;
}
parcel2.readException();
if (parcel2.readInt() != 0) {
ResolveInfo resolveInfo = ResolveInfo.CREATOR.createFromParcel(parcel2);
} else {
Object var1_4 = null;
}
parcel2.recycle();
parcel.recycle();
return var1_5;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
}
@Override
public void restoreDefaultApps(byte[] arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(88, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().restoreDefaultApps(arrby, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void restoreIntentFilterVerification(byte[] arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(90, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().restoreIntentFilterVerification(arrby, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void restorePreferredActivities(byte[] arrby, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
if (!this.mRemote.transact(86, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().restorePreferredActivities(arrby, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void revokeDefaultPermissionsFromDisabledTelephonyDataServices(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(167, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().revokeDefaultPermissionsFromDisabledTelephonyDataServices(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void revokeDefaultPermissionsFromLuiApps(String[] arrstring, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
if (!this.mRemote.transact(169, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().revokeDefaultPermissionsFromLuiApps(arrstring, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void revokeRuntimePermission(String string2, String string3, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
if (!this.mRemote.transact(24, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().revokeRuntimePermission(string2, string3, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean runBackgroundDexoptJob(List<String> list) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringList(list);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(124, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().runBackgroundDexoptJob(list);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
int n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void sendDeviceCustomizationReadyBroadcast() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(204, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().sendDeviceCustomizationReadyBroadcast();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setApplicationCategoryHint(String string2, int n, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeString(string3);
if (!this.mRemote.transact(65, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setApplicationCategoryHint(string2, n, string3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setApplicationEnabledSetting(String string2, int n, int n2, int n3, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
parcel.writeString(string3);
if (!this.mRemote.transact(95, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setApplicationEnabledSetting(string2, n, n2, n3, string3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setApplicationHiddenSettingAsUser(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel;
boolean bl2;
Parcel parcel2;
block4 : {
int n2;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
bl2 = true;
n2 = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n2);
parcel.writeInt(n);
if (this.mRemote.transact(151, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setApplicationHiddenSettingAsUser(string2, bl, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public boolean setBlockUninstallForUser(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel;
boolean bl2;
Parcel parcel2;
block4 : {
int n2;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
bl2 = true;
n2 = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n2);
parcel.writeInt(n);
if (this.mRemote.transact(156, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setBlockUninstallForUser(string2, bl, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void setComponentEnabledSetting(ComponentName componentName, int n, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(93, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setComponentEnabledSetting(componentName, n, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setDefaultBrowserPackageName(String string2, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
parcel2.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
if (iBinder.transact(142, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().setDefaultBrowserPackageName(string2, n);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
if (n != 0) {
bl = true;
}
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public String[] setDistractingPackageRestrictionsAsUser(String[] arrstring, int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeStringArray(arrstring);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(80, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().setDistractingPackageRestrictionsAsUser(arrstring, n, n2);
return arrstring;
}
parcel2.readException();
arrstring = parcel2.createStringArray();
return arrstring;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setHarmfulAppWarning(String string2, CharSequence charSequence, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
if (charSequence != null) {
parcel.writeInt(1);
TextUtils.writeToParcel(charSequence, parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(193, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setHarmfulAppWarning(string2, charSequence, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setHomeActivity(ComponentName componentName, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (componentName != null) {
parcel.writeInt(1);
componentName.writeToParcel(parcel, 0);
} else {
parcel.writeInt(0);
}
parcel.writeInt(n);
if (!this.mRemote.transact(92, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setHomeActivity(componentName, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setInstallLocation(int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(132, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().setInstallLocation(n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void setInstallerPackageName(String string2, String string3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
if (!this.mRemote.transact(64, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setInstallerPackageName(string2, string3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setInstantAppCookie(String string2, byte[] arrby, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeByteArray(arrby);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(174, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().setInstantAppCookie(string2, arrby, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public void setLastChosenActivity(Intent intent, String string2, int n, IntentFilter intentFilter, int n2, ComponentName componentName) throws RemoteException {
Parcel parcel;
Parcel parcel2;
void var1_6;
block16 : {
block15 : {
block14 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
if (intent != null) {
parcel2.writeInt(1);
intent.writeToParcel(parcel2, 0);
break block14;
}
parcel2.writeInt(0);
}
try {
parcel2.writeString(string2);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeInt(n);
if (intentFilter != null) {
parcel2.writeInt(1);
intentFilter.writeToParcel(parcel2, 0);
break block15;
}
parcel2.writeInt(0);
}
catch (Throwable throwable) {}
}
try {
parcel2.writeInt(n2);
if (componentName != null) {
parcel2.writeInt(1);
componentName.writeToParcel(parcel2, 0);
} else {
parcel2.writeInt(0);
}
if (!this.mRemote.transact(71, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setLastChosenActivity(intent, string2, n, intentFilter, n2, componentName);
parcel.recycle();
parcel2.recycle();
return;
}
parcel.readException();
parcel.recycle();
parcel2.recycle();
return;
}
catch (Throwable throwable) {}
break block16;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_6;
}
@Override
public void setPackageStoppedState(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n2 = bl ? 1 : 0;
try {
parcel.writeInt(n2);
parcel.writeInt(n);
if (!this.mRemote.transact(99, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setPackageStoppedState(string2, bl, n);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public String[] setPackagesSuspendedAsUser(String[] arrstring, boolean bl, PersistableBundle persistableBundle, PersistableBundle persistableBundle2, SuspendDialogInfo suspendDialogInfo, String string2, int n) throws RemoteException {
Parcel parcel;
Parcel parcel2;
void var1_5;
block14 : {
block13 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
try {
parcel2.writeStringArray(arrstring);
int n2 = bl ? 1 : 0;
parcel2.writeInt(n2);
if (persistableBundle != null) {
parcel2.writeInt(1);
persistableBundle.writeToParcel(parcel2, 0);
} else {
parcel2.writeInt(0);
}
if (persistableBundle2 != null) {
parcel2.writeInt(1);
persistableBundle2.writeToParcel(parcel2, 0);
} else {
parcel2.writeInt(0);
}
if (suspendDialogInfo != null) {
parcel2.writeInt(1);
suspendDialogInfo.writeToParcel(parcel2, 0);
break block13;
}
parcel2.writeInt(0);
}
catch (Throwable throwable) {}
}
try {
parcel2.writeString(string2);
parcel2.writeInt(n);
if (!this.mRemote.transact(81, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
arrstring = Stub.getDefaultImpl().setPackagesSuspendedAsUser(arrstring, bl, persistableBundle, persistableBundle2, suspendDialogInfo, string2, n);
parcel.recycle();
parcel2.recycle();
return arrstring;
}
parcel.readException();
arrstring = parcel.createStringArray();
parcel.recycle();
parcel2.recycle();
return arrstring;
}
catch (Throwable throwable) {}
break block14;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_5;
}
@Override
public void setPermissionEnforced(String string2, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n = bl ? 1 : 0;
try {
parcel.writeInt(n);
if (!this.mRemote.transact(148, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setPermissionEnforced(string2, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setRequiredForSystemUser(String string2, boolean bl) throws RemoteException {
Parcel parcel;
Parcel parcel2;
boolean bl2;
int n;
block4 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
try {
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
parcel2.writeString(string2);
bl2 = true;
n = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel.recycle();
parcel2.recycle();
throw throwable;
}
parcel2.writeInt(n);
if (this.mRemote.transact(177, parcel2, parcel, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setRequiredForSystemUser(string2, bl);
parcel.recycle();
parcel2.recycle();
return bl;
}
parcel.readException();
n = parcel.readInt();
bl = n != 0 ? bl2 : false;
parcel.recycle();
parcel2.recycle();
return bl;
}
@Override
public void setRuntimePermissionsVersion(int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(208, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setRuntimePermissionsVersion(n, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void setSystemAppHiddenUntilInstalled(String string2, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n = bl ? 1 : 0;
try {
parcel.writeInt(n);
if (!this.mRemote.transact(153, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setSystemAppHiddenUntilInstalled(string2, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean setSystemAppInstallState(String string2, boolean bl, int n) throws RemoteException {
Parcel parcel;
boolean bl2;
Parcel parcel2;
block4 : {
int n2;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
bl2 = true;
n2 = bl ? 1 : 0;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
parcel.writeInt(n2);
parcel.writeInt(n);
if (this.mRemote.transact(154, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block4;
bl = Stub.getDefaultImpl().setSystemAppInstallState(string2, bl, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
bl = n != 0 ? bl2 : false;
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void setUpdateAvailable(String string2, boolean bl) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
int n = bl ? 1 : 0;
try {
parcel.writeInt(n);
if (!this.mRemote.transact(178, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().setUpdateAvailable(string2, bl);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean shouldShowRequestPermissionRationale(String string2, String string3, int n) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeString(string3);
parcel.writeInt(n);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(32, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().shouldShowRequestPermissionRationale(string2, string3, n);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void systemReady() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(112, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().systemReady();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
@Override
public void unregisterMoveCallback(IPackageMoveObserver iPackageMoveObserver) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
IBinder iBinder = iPackageMoveObserver != null ? iPackageMoveObserver.asBinder() : null;
parcel.writeStrongBinder(iBinder);
if (!this.mRemote.transact(128, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().unregisterMoveCallback(iPackageMoveObserver);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public boolean updateIntentVerificationStatus(String string2, int n, int n2) throws RemoteException {
Parcel parcel;
boolean bl;
Parcel parcel2;
block5 : {
IBinder iBinder;
parcel = Parcel.obtain();
parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeString(string2);
parcel.writeInt(n);
parcel.writeInt(n2);
iBinder = this.mRemote;
bl = false;
}
catch (Throwable throwable) {
parcel2.recycle();
parcel.recycle();
throw throwable;
}
if (iBinder.transact(139, parcel, parcel2, 0) || Stub.getDefaultImpl() == null) break block5;
bl = Stub.getDefaultImpl().updateIntentVerificationStatus(string2, n, n2);
parcel2.recycle();
parcel.recycle();
return bl;
}
parcel2.readException();
n = parcel2.readInt();
if (n != 0) {
bl = true;
}
parcel2.recycle();
parcel.recycle();
return bl;
}
@Override
public void updatePackagesIfNeeded() throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
if (!this.mRemote.transact(115, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().updatePackagesIfNeeded();
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
/*
* Loose catch block
* WARNING - void declaration
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
@Override
public void updatePermissionFlags(String string2, String string3, int n, int n2, boolean bl, int n3) throws RemoteException {
Parcel parcel;
void var1_9;
Parcel parcel2;
block16 : {
parcel2 = Parcel.obtain();
parcel = Parcel.obtain();
parcel2.writeInterfaceToken(Stub.DESCRIPTOR);
try {
parcel2.writeString(string2);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeString(string3);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeInt(n);
}
catch (Throwable throwable) {
break block16;
}
try {
parcel2.writeInt(n2);
int n4 = bl ? 1 : 0;
parcel2.writeInt(n4);
}
catch (Throwable throwable) {}
try {
parcel2.writeInt(n3);
}
catch (Throwable throwable) {
break block16;
}
try {
if (!this.mRemote.transact(27, parcel2, parcel, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().updatePermissionFlags(string2, string3, n, n2, bl, n3);
parcel.recycle();
parcel2.recycle();
return;
}
parcel.readException();
parcel.recycle();
parcel2.recycle();
return;
}
catch (Throwable throwable) {}
break block16;
catch (Throwable throwable) {
// empty catch block
}
}
parcel.recycle();
parcel2.recycle();
throw var1_9;
}
@Override
public void updatePermissionFlagsForAllApps(int n, int n2, int n3) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeInt(n3);
if (!this.mRemote.transact(28, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().updatePermissionFlagsForAllApps(n, n2, n3);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void verifyIntentFilter(int n, int n2, List<String> list) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
parcel.writeStringList(list);
if (!this.mRemote.transact(137, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().verifyIntentFilter(n, n2, list);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
@Override
public void verifyPendingInstall(int n, int n2) throws RemoteException {
Parcel parcel = Parcel.obtain();
Parcel parcel2 = Parcel.obtain();
try {
parcel.writeInterfaceToken(Stub.DESCRIPTOR);
parcel.writeInt(n);
parcel.writeInt(n2);
if (!this.mRemote.transact(135, parcel, parcel2, 0) && Stub.getDefaultImpl() != null) {
Stub.getDefaultImpl().verifyPendingInstall(n, n2);
return;
}
parcel2.readException();
return;
}
finally {
parcel2.recycle();
parcel.recycle();
}
}
}
}
}
| 455,589 | 0.478267 | 0.463826 | 10,302 | 43.223259 | 31.419371 | 246 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.738692 | false | false | 13 |
8e61bce1e916544618d58b95e146d6370ab43c1d | 32,298,154,077,946 | dd2241b185d92268053c379b070b4d61411274ee | /app/src/main/java/com/example/schoolqa/EditProfileActivity.java | b00cd93c3d65ba8cc1c929480d7679be7904f8f8 | [] | no_license | CodePath-Team-5/SCHOOL-Q-A | https://github.com/CodePath-Team-5/SCHOOL-Q-A | b96f4fd8a32efe2de238fed3bd9c114e0bba4292 | 481f014d9cec04a4f6c05b025ad672bc0c4b02bf | refs/heads/main | 2023-07-18T07:52:56.278000 | 2021-08-31T09:58:54 | 2021-08-31T09:58:54 | 348,099,164 | 1 | 1 | null | false | 2021-08-15T12:52:43 | 2021-03-15T19:34:00 | 2021-08-15T12:47:21 | 2021-08-15T12:52:43 | 113,786 | 0 | 1 | 20 | Java | false | false | package com.example.schoolqa;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.FileProvider;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseUser;
import com.parse.SaveCallback;
import java.io.File;
public class EditProfileActivity extends AppCompatActivity {
public static String tag = "EditProfileActivity";
public static String updatetag = "Update user info";
public static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 42;
EditText et_username;
EditText et_major;
EditText et_year;
EditText et_intro;
EditText et_password;
ImageView iv_profile_image;
Button bttn_save;
Button bttn_photo;
private File photoFile;
public String photoFileName = "photo.jpg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_profile);
//link layout components
et_username = findViewById(R.id.editText_edit_username);
et_year = findViewById(R.id.editText_edit_year);
et_intro = findViewById(R.id.editText_edit_intro);
et_major = findViewById(R.id.editText_edit_major);
et_password = findViewById(R.id.editText_edit_password);
iv_profile_image = findViewById(R.id.iv__edit_profile_image);
bttn_save = findViewById(R.id.button_edit_save);
bttn_photo = findViewById(R.id.button_change_image);
//set user 's current info in text box & image view
initial_setup();
bttn_photo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
handle_change_profile_image(v);
}
});
bttn_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
handle_save_button(v);
} catch (ParseException e) {
Log.e(updatetag, "update failed");
}
}
});
}
public void initial_setup()
{
//fill user current info to edit texts
et_username.setText(ParseUser.getCurrentUser().getUsername());
et_year.setText(ParseUser.getCurrentUser().getString("year_experience"));
et_major.setText(ParseUser.getCurrentUser().getString("major_profession").toString());
et_intro.setText(ParseUser.getCurrentUser().getString("description"));
et_password.setText(ParseUser.getCurrentUser().getString("password"));
//get user current image
ParseFile image = ParseUser.getCurrentUser().getParseFile("user_image");
if (image != null) {
// Glide.with(context).load(post.getImage().getUrl()).into(ivImage);
Glide.with(this).load(image.getUrl()).into(iv_profile_image);
} else {
Glide.with(this).load(getApplicationContext().getResources().getDrawable(R.drawable.ic_user)).into(iv_profile_image);
}
}
public File getPhotoFileUri(String fileName) {
// Get safe storage directory for photos
// Use `getExternalFilesDir` on Context to access package-specific directories.
// This way, we don't need to request external read/write runtime permissions.
File mediaStorageDir = new File(this.getExternalFilesDir(Environment.DIRECTORY_PICTURES), tag);
// Create the storage directory if it does not exist
if (!mediaStorageDir.exists() && !mediaStorageDir.mkdirs()){
Log.d(tag, "failed to create directory");
}
// Return the file target for the photo based on filename
return new File(mediaStorageDir.getPath() + File.separator + fileName);
}
public void handle_change_profile_image(View view) {
//Change Profile Image button clicked
Log.d(tag,"Edit Profile Image button clicked");
// create Intent to take a picture and return control to the calling application
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Create a File reference for future access
photoFile = getPhotoFileUri(photoFileName);
// wrap File object into a content provider
// required for API >= 24
// See https://guides.codepath.com/android/Sharing-Content-with-Intentsharing-files-with-api-24-or-highers#
Uri fileProvider = FileProvider.getUriForFile(this, "com.codepath.fileprovider", photoFile);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider);
// If you call startActivityForResult() using an intent that no app can handle, your app will crash.
// So as long as the result is not null, it's safe to use the intent.
if (intent.resolveActivity(this.getPackageManager()) != null) {
// Start the image capture intent to take photo
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// by this point we have the camera photo on disk
Bitmap takenImage = BitmapFactory.decodeFile(photoFile.getAbsolutePath());
// RESIZE BITMAP, see section below
// Load the taken image into a preview
iv_profile_image.setImageBitmap(takenImage);
} else { // Result was a failure
Toast.makeText(this, "Picture wasn't taken!", Toast.LENGTH_SHORT).show();
}
}
}
public void handle_save_button(View view) throws ParseException {
//Save button clicked
Log.d(tag,"Save button clicked");
//username and passord cannot be empty
if(et_username.getText().toString().isEmpty()){
Toast.makeText(this, "Username cannot be empty", Toast.LENGTH_SHORT).show();
return;
}
if(et_password.getText().toString().isEmpty()){
Toast.makeText(this, "Password cannot be empty", Toast.LENGTH_SHORT).show();
return;
}
//get user input
ParseUser user = ParseUser.getCurrentUser();
user.setUsername(et_username.getText().toString());
user.setPassword(et_password.getText().toString());
user.put("major_profession", et_major.getText().toString());
user.put("year_experience", et_year.getText().toString());
user.put("description", et_intro.getText().toString());
if(photoFile!=null){
user.put("user_image",new ParseFile(photoFile));
}
//update change on back4app
user.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if(e!=null){
Log.e(updatetag, "error while saving", e);
Intent returnIntent = new Intent();
setResult(RESULT_CANCELED,returnIntent);
finish();
}
else
{
Log.i(updatetag, "save successful");
Intent returnIntent = new Intent();
setResult(RESULT_OK,returnIntent);
finish();
}
}
});
}
public void handle_back_button(View view) {
//Back button clicked
Log.d(tag,"Back button clicked");
finish(); //go back to previous screen - Search screen
}
public void handle_cancel_button(View view) {
//Cancel button clicked
Log.d(tag,"Cancel button clicked");
finish(); //go back to previous screen - Search screen
}
} | UTF-8 | Java | 8,417 | java | EditProfileActivity.java | Java | [
{
"context": "e.getText().toString());\n user.setPassword(et_password.getText().toString());\n user.put(\"major_pr",
"end": 6998,
"score": 0.7881243228912354,
"start": 6987,
"tag": "PASSWORD",
"value": "et_password"
}
] | null | [] | package com.example.schoolqa;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.FileProvider;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseUser;
import com.parse.SaveCallback;
import java.io.File;
public class EditProfileActivity extends AppCompatActivity {
public static String tag = "EditProfileActivity";
public static String updatetag = "Update user info";
public static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 42;
EditText et_username;
EditText et_major;
EditText et_year;
EditText et_intro;
EditText et_password;
ImageView iv_profile_image;
Button bttn_save;
Button bttn_photo;
private File photoFile;
public String photoFileName = "photo.jpg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_profile);
//link layout components
et_username = findViewById(R.id.editText_edit_username);
et_year = findViewById(R.id.editText_edit_year);
et_intro = findViewById(R.id.editText_edit_intro);
et_major = findViewById(R.id.editText_edit_major);
et_password = findViewById(R.id.editText_edit_password);
iv_profile_image = findViewById(R.id.iv__edit_profile_image);
bttn_save = findViewById(R.id.button_edit_save);
bttn_photo = findViewById(R.id.button_change_image);
//set user 's current info in text box & image view
initial_setup();
bttn_photo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
handle_change_profile_image(v);
}
});
bttn_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
handle_save_button(v);
} catch (ParseException e) {
Log.e(updatetag, "update failed");
}
}
});
}
public void initial_setup()
{
//fill user current info to edit texts
et_username.setText(ParseUser.getCurrentUser().getUsername());
et_year.setText(ParseUser.getCurrentUser().getString("year_experience"));
et_major.setText(ParseUser.getCurrentUser().getString("major_profession").toString());
et_intro.setText(ParseUser.getCurrentUser().getString("description"));
et_password.setText(ParseUser.getCurrentUser().getString("password"));
//get user current image
ParseFile image = ParseUser.getCurrentUser().getParseFile("user_image");
if (image != null) {
// Glide.with(context).load(post.getImage().getUrl()).into(ivImage);
Glide.with(this).load(image.getUrl()).into(iv_profile_image);
} else {
Glide.with(this).load(getApplicationContext().getResources().getDrawable(R.drawable.ic_user)).into(iv_profile_image);
}
}
public File getPhotoFileUri(String fileName) {
// Get safe storage directory for photos
// Use `getExternalFilesDir` on Context to access package-specific directories.
// This way, we don't need to request external read/write runtime permissions.
File mediaStorageDir = new File(this.getExternalFilesDir(Environment.DIRECTORY_PICTURES), tag);
// Create the storage directory if it does not exist
if (!mediaStorageDir.exists() && !mediaStorageDir.mkdirs()){
Log.d(tag, "failed to create directory");
}
// Return the file target for the photo based on filename
return new File(mediaStorageDir.getPath() + File.separator + fileName);
}
public void handle_change_profile_image(View view) {
//Change Profile Image button clicked
Log.d(tag,"Edit Profile Image button clicked");
// create Intent to take a picture and return control to the calling application
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Create a File reference for future access
photoFile = getPhotoFileUri(photoFileName);
// wrap File object into a content provider
// required for API >= 24
// See https://guides.codepath.com/android/Sharing-Content-with-Intentsharing-files-with-api-24-or-highers#
Uri fileProvider = FileProvider.getUriForFile(this, "com.codepath.fileprovider", photoFile);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider);
// If you call startActivityForResult() using an intent that no app can handle, your app will crash.
// So as long as the result is not null, it's safe to use the intent.
if (intent.resolveActivity(this.getPackageManager()) != null) {
// Start the image capture intent to take photo
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// by this point we have the camera photo on disk
Bitmap takenImage = BitmapFactory.decodeFile(photoFile.getAbsolutePath());
// RESIZE BITMAP, see section below
// Load the taken image into a preview
iv_profile_image.setImageBitmap(takenImage);
} else { // Result was a failure
Toast.makeText(this, "Picture wasn't taken!", Toast.LENGTH_SHORT).show();
}
}
}
public void handle_save_button(View view) throws ParseException {
//Save button clicked
Log.d(tag,"Save button clicked");
//username and passord cannot be empty
if(et_username.getText().toString().isEmpty()){
Toast.makeText(this, "Username cannot be empty", Toast.LENGTH_SHORT).show();
return;
}
if(et_password.getText().toString().isEmpty()){
Toast.makeText(this, "Password cannot be empty", Toast.LENGTH_SHORT).show();
return;
}
//get user input
ParseUser user = ParseUser.getCurrentUser();
user.setUsername(et_username.getText().toString());
user.setPassword(<PASSWORD>.getText().toString());
user.put("major_profession", et_major.getText().toString());
user.put("year_experience", et_year.getText().toString());
user.put("description", et_intro.getText().toString());
if(photoFile!=null){
user.put("user_image",new ParseFile(photoFile));
}
//update change on back4app
user.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if(e!=null){
Log.e(updatetag, "error while saving", e);
Intent returnIntent = new Intent();
setResult(RESULT_CANCELED,returnIntent);
finish();
}
else
{
Log.i(updatetag, "save successful");
Intent returnIntent = new Intent();
setResult(RESULT_OK,returnIntent);
finish();
}
}
});
}
public void handle_back_button(View view) {
//Back button clicked
Log.d(tag,"Back button clicked");
finish(); //go back to previous screen - Search screen
}
public void handle_cancel_button(View view) {
//Cancel button clicked
Log.d(tag,"Cancel button clicked");
finish(); //go back to previous screen - Search screen
}
} | 8,416 | 0.634787 | 0.633955 | 219 | 37.438354 | 28.300404 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.611872 | false | false | 13 |
f1a466b7b297445604448171d13225cc00cfcf9a | 12,816,182,467,633 | 6637fc4478a67c1ec9e45be2b3764870c27f9a85 | /src/test/java/com/shiro/springbootshiro/GoodsTest.java | e036359342056b7b396b5e95052292661ca21d72 | [] | no_license | WLyiyi/springboot-shiro | https://github.com/WLyiyi/springboot-shiro | 655788fe870cd3a21689f017dbbf9b10ff4fb3d2 | 41ac00325b753b94d32d888b204409ab72979da5 | refs/heads/master | 2020-05-05T07:24:20.763000 | 2019-04-16T12:54:37 | 2019-04-16T12:54:37 | 179,823,935 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.shiro.springbootshiro;
import com.shiro.springbootshiro.bean.Evaluate;
import com.shiro.springbootshiro.bean.Goods;
import com.shiro.springbootshiro.mapper.GoodsMapper;
import com.shiro.springbootshiro.service.IEvaluateService;
import com.shiro.springbootshiro.service.IGoodsService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.util.List;
/**
* 作用:
*/
public class GoodsTest extends SpringbootShiroApplicationTests {
@Resource
GoodsMapper goodsMapper;
@Test
public void test(){
List<Goods> all = goodsMapper.findAll();
for (Goods goods : all) {
System.out.println(goods);
}
}
@Autowired
IEvaluateService evaluateService;
@Test
public void test1(){
List<Evaluate> evaluateByGoodsId = evaluateService.findEvaluateByGoodsId(1);
for (Evaluate evaluate : evaluateByGoodsId) {
System.out.println(evaluate);
}
}
@Autowired
IGoodsService goodsService;
@Test
public void test2(){
Goods byId = goodsService.findById(1);
System.out.println(byId);
}
}
| UTF-8 | Java | 1,203 | java | GoodsTest.java | Java | [] | null | [] | package com.shiro.springbootshiro;
import com.shiro.springbootshiro.bean.Evaluate;
import com.shiro.springbootshiro.bean.Goods;
import com.shiro.springbootshiro.mapper.GoodsMapper;
import com.shiro.springbootshiro.service.IEvaluateService;
import com.shiro.springbootshiro.service.IGoodsService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.util.List;
/**
* 作用:
*/
public class GoodsTest extends SpringbootShiroApplicationTests {
@Resource
GoodsMapper goodsMapper;
@Test
public void test(){
List<Goods> all = goodsMapper.findAll();
for (Goods goods : all) {
System.out.println(goods);
}
}
@Autowired
IEvaluateService evaluateService;
@Test
public void test1(){
List<Evaluate> evaluateByGoodsId = evaluateService.findEvaluateByGoodsId(1);
for (Evaluate evaluate : evaluateByGoodsId) {
System.out.println(evaluate);
}
}
@Autowired
IGoodsService goodsService;
@Test
public void test2(){
Goods byId = goodsService.findById(1);
System.out.println(byId);
}
}
| 1,203 | 0.700919 | 0.697577 | 47 | 24.468084 | 21.502945 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.404255 | false | false | 9 |
f9f7bc4daa66642f5f1f4c3d21037cad53135fd2 | 31,688,268,770,358 | 61799205deb604dafe5cef98e9f7520cecf6f269 | /src/test/java/com/tvd12/reflections/testing/ReflectionsTest2.java | c1bdd282f79c1a8cc345058cb47b562f62dfb041 | [
"WTFPL"
] | permissive | tvd12/reflections | https://github.com/tvd12/reflections | c9fd641bb56959780e6e2887c9a8d767c1f65255 | f945140c5e6484da18ea084bedbe437fa96e0c6f | refs/heads/master | 2022-07-27T00:48:27.482000 | 2022-07-10T16:31:05 | 2022-07-10T16:31:05 | 157,584,190 | 1 | 0 | WTFPL | true | 2022-07-10T16:31:05 | 2018-11-14T17:15:36 | 2021-12-02T13:56:07 | 2022-07-10T16:31:05 | 317 | 1 | 0 | 0 | Java | false | false | package com.tvd12.reflections.testing;
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.junit.BeforeClass;
import org.junit.Test;
import com.tvd12.reflections.Reflections;
import com.tvd12.reflections.scanners.SubTypesScanner;
import com.tvd12.reflections.testing.TestModel.C1;
import com.tvd12.reflections.testing.TestModel.C2;
import com.tvd12.reflections.testing.TestModel.C3;
import com.tvd12.reflections.testing.TestModel.C5;
import com.tvd12.reflections.testing.TestModel.I1;
import com.tvd12.reflections.testing.TestModel.I2;
import com.tvd12.reflections.util.ClasspathHelper;
import com.tvd12.reflections.util.ConfigurationBuilder;
import com.tvd12.reflections.util.FilterBuilder;
/**
*
*/
@SuppressWarnings("unchecked")
public class ReflectionsTest2 {
public static final FilterBuilder TestModelFilter = new FilterBuilder().include("com.tvd12.reflections.testing.TestModel\\$.*");
static Reflections reflections;
@BeforeClass
public static void init() {
reflections = new Reflections(new ConfigurationBuilder()
.setUrls(asList(ClasspathHelper.forClass(TestModel.class)))
.filterInputsBy(TestModelFilter)
.setScanners(
new SubTypesScanner(false)//,
// new TypeAnnotationsScanner(),
// new FieldAnnotationsScanner(),
// new MethodAnnotationsScanner(),
// new MethodParameterScanner(),
// new MethodParameterNamesScanner(),
// new MemberUsageScanner()
));
}
@Test
public void testSubTypesOf() {
Set<Class<? extends I1>> subTypesOf = reflections.getSubTypesOf(I1.class);
assertThat(subTypesOf, are(I2.class, C1.class, C2.class, C3.class, C5.class));
assertThat(reflections.getSubTypesOf(C1.class), are(C2.class, C3.class, C5.class));
assertFalse("getAllTypes should not be empty when Reflections is configured with SubTypesScanner(false)",
reflections.getAllTypes().isEmpty());
}
private abstract static class Match<T> extends BaseMatcher<T> {
public void describeTo(Description description) { }
}
public static <T> Matcher<Set<? super T>> are(final T... ts) {
final Collection<?> c1 = Arrays.asList(ts);
return new Match<Set<? super T>>() {
public boolean matches(Object o) {
Collection<?> c2 = (Collection<?>) o;
return c1.containsAll(c2) && c2.containsAll(c1);
}
};
}
}
| UTF-8 | Java | 2,883 | java | ReflectionsTest2.java | Java | [] | null | [] | package com.tvd12.reflections.testing;
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.junit.BeforeClass;
import org.junit.Test;
import com.tvd12.reflections.Reflections;
import com.tvd12.reflections.scanners.SubTypesScanner;
import com.tvd12.reflections.testing.TestModel.C1;
import com.tvd12.reflections.testing.TestModel.C2;
import com.tvd12.reflections.testing.TestModel.C3;
import com.tvd12.reflections.testing.TestModel.C5;
import com.tvd12.reflections.testing.TestModel.I1;
import com.tvd12.reflections.testing.TestModel.I2;
import com.tvd12.reflections.util.ClasspathHelper;
import com.tvd12.reflections.util.ConfigurationBuilder;
import com.tvd12.reflections.util.FilterBuilder;
/**
*
*/
@SuppressWarnings("unchecked")
public class ReflectionsTest2 {
public static final FilterBuilder TestModelFilter = new FilterBuilder().include("com.tvd12.reflections.testing.TestModel\\$.*");
static Reflections reflections;
@BeforeClass
public static void init() {
reflections = new Reflections(new ConfigurationBuilder()
.setUrls(asList(ClasspathHelper.forClass(TestModel.class)))
.filterInputsBy(TestModelFilter)
.setScanners(
new SubTypesScanner(false)//,
// new TypeAnnotationsScanner(),
// new FieldAnnotationsScanner(),
// new MethodAnnotationsScanner(),
// new MethodParameterScanner(),
// new MethodParameterNamesScanner(),
// new MemberUsageScanner()
));
}
@Test
public void testSubTypesOf() {
Set<Class<? extends I1>> subTypesOf = reflections.getSubTypesOf(I1.class);
assertThat(subTypesOf, are(I2.class, C1.class, C2.class, C3.class, C5.class));
assertThat(reflections.getSubTypesOf(C1.class), are(C2.class, C3.class, C5.class));
assertFalse("getAllTypes should not be empty when Reflections is configured with SubTypesScanner(false)",
reflections.getAllTypes().isEmpty());
}
private abstract static class Match<T> extends BaseMatcher<T> {
public void describeTo(Description description) { }
}
public static <T> Matcher<Set<? super T>> are(final T... ts) {
final Collection<?> c1 = Arrays.asList(ts);
return new Match<Set<? super T>>() {
public boolean matches(Object o) {
Collection<?> c2 = (Collection<?>) o;
return c1.containsAll(c2) && c2.containsAll(c1);
}
};
}
}
| 2,883 | 0.672216 | 0.654873 | 76 | 36.934212 | 27.858824 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.671053 | false | false | 9 |
a4736f99616c83bf7e0a3f4225a74f1f5cdd5597 | 16,260,746,234,044 | a5fae53810cf9a9dc655f025be065bf05a4cfd4d | /Implementation/album-catalog/src/main/java/com/musicdistribution/albumcatalog/domain/models/response/ArtistResponse.java | 624388593d423a4c83920a009d472163a9687209 | [] | no_license | azizdwi/Album_Distribution | https://github.com/azizdwi/Album_Distribution | fe926145832b30131ce55c8963170353b927f9cd | 136549554e06d9b8ecccfb666830d62fd81ec6cb | refs/heads/master | 2023-08-28T13:12:48.844000 | 2021-11-01T15:40:40 | 2021-11-01T15:40:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.musicdistribution.albumcatalog.domain.models.response;
import com.musicdistribution.albumcatalog.domain.models.entity.Artist;
import com.musicdistribution.albumcatalog.domain.valueobjects.ArtistContactInfo;
import com.musicdistribution.albumcatalog.domain.valueobjects.ArtistPersonalInfo;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Data transfer object for an artist.
*/
@Data
@NoArgsConstructor
public class ArtistResponse {
private String id;
private ArtistContactInfo artistContactInfo;
private ArtistPersonalInfo artistPersonalInfo;
private String password;
public static ArtistResponse from(Artist artist) {
ArtistResponse artistResponse = new ArtistResponse();
artistResponse.setId(artist.getId().getId());
artistResponse.setArtistContactInfo(artist.getArtistContactInfo());
artistResponse.setArtistPersonalInfo(artist.getArtistPersonalInfo());
artistResponse.setPassword(artist.getPassword());
return artistResponse;
}
}
| UTF-8 | Java | 1,035 | java | ArtistResponse.java | Java | [
{
"context": "rsonalInfo());\n artistResponse.setPassword(artist.getPassword());\n\n return artistResponse;\n }\n}\n",
"end": 990,
"score": 0.9222303032875061,
"start": 972,
"tag": "PASSWORD",
"value": "artist.getPassword"
}
] | null | [] | package com.musicdistribution.albumcatalog.domain.models.response;
import com.musicdistribution.albumcatalog.domain.models.entity.Artist;
import com.musicdistribution.albumcatalog.domain.valueobjects.ArtistContactInfo;
import com.musicdistribution.albumcatalog.domain.valueobjects.ArtistPersonalInfo;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Data transfer object for an artist.
*/
@Data
@NoArgsConstructor
public class ArtistResponse {
private String id;
private ArtistContactInfo artistContactInfo;
private ArtistPersonalInfo artistPersonalInfo;
private String password;
public static ArtistResponse from(Artist artist) {
ArtistResponse artistResponse = new ArtistResponse();
artistResponse.setId(artist.getId().getId());
artistResponse.setArtistContactInfo(artist.getArtistContactInfo());
artistResponse.setArtistPersonalInfo(artist.getArtistPersonalInfo());
artistResponse.setPassword(<PASSWORD>());
return artistResponse;
}
}
| 1,027 | 0.786473 | 0.786473 | 30 | 33.5 | 28.185989 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false | 9 |
d737c0db49d8f58ad235f7c5dca6f2bdf87f4b8f | 11,252,814,367,441 | 92e7a62c54bcf24de97b5d4c1bb15b99f775bed2 | /OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/component/BonDeLivraisonSQLComponent.java | 2230ac7cf32f2b960ab81f1e3a7bda19618d3611 | [] | no_license | trespe/openconcerto | https://github.com/trespe/openconcerto | 4a9c294006187987f64dbf936f167d666e6c5d52 | 6ccd5a7b56cd75350877842998c94434083fb62f | refs/heads/master | 2021-01-13T02:06:29.609000 | 2015-04-10T08:35:31 | 2015-04-10T08:35:31 | 33,717,537 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.sales.shipment.component;
import static org.openconcerto.utils.CollectionUtils.createSet;
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
import org.openconcerto.erp.core.common.ui.DeviseField;
import org.openconcerto.erp.core.common.ui.TotalPanel;
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureItemSQLElement;
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonItemSQLElement;
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonSQLElement;
import org.openconcerto.erp.core.sales.shipment.report.BonLivraisonXmlSheet;
import org.openconcerto.erp.core.sales.shipment.ui.BonDeLivraisonItemTable;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.Type;
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
import org.openconcerto.erp.panel.PanelOOSQLComponent;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FormLayouter;
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.utils.ExceptionHandler;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import org.apache.commons.dbutils.handlers.ArrayListHandler;
public class BonDeLivraisonSQLComponent extends TransfertBaseSQLComponent {
private BonDeLivraisonItemTable tableBonItem;
private ElementComboBox selectCommande, comboClient;
private PanelOOSQLComponent panelOO;
private JUniqueTextField textNumeroUnique;
private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO");
private final DeviseField textTotalHT = new DeviseField(6);
private final DeviseField textTotalTVA = new DeviseField(6);
private final DeviseField textTotalTTC = new DeviseField(6);
private final JTextField textPoidsTotal = new JTextField(6);
private final JTextField textNom = new JTextField(25);
public BonDeLivraisonSQLComponent() {
super(Configuration.getInstance().getDirectory().getElement("BON_DE_LIVRAISON"));
}
@Override
protected RowValuesTable getRowValuesTable() {
return this.tableBonItem.getRowValuesTable();
}
@Override
protected SQLRowValues createDefaults() {
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass()));
this.tableBonItem.getModel().clearRows();
return super.createDefaults();
}
public void addViews() {
this.textTotalHT.setOpaque(false);
this.textTotalTVA.setOpaque(false);
this.textTotalTTC.setOpaque(false);
this.selectCommande = new ElementComboBox();
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
// Champ Module
c.gridx = 0;
c.gridy++;
c.gridwidth = GridBagConstraints.REMAINDER;
final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
this.setAdditionalFieldsPanel(new FormLayouter(addP, 2));
this.add(addP, c);
c.gridy++;
c.gridwidth = 1;
// Numero
JLabel labelNum = new JLabel(getLabelFor("NUMERO"));
labelNum.setHorizontalAlignment(SwingConstants.RIGHT);
this.add(labelNum, c);
this.textNumeroUnique = new JUniqueTextField(16);
c.gridx++;
c.weightx = 1;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
DefaultGridBagConstraints.lockMinimumSize(textNumeroUnique);
this.add(this.textNumeroUnique, c);
// Date
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("DATE"), SwingConstants.RIGHT), c);
JDate date = new JDate(true);
c.gridx++;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
this.add(date, c);
// Reference
c.gridy++;
c.gridx = 0;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c);
c.gridx++;
c.weightx = 1;
this.add(this.textNom, c);
if (getTable().contains("DATE_LIVRAISON")) {
// Date livraison
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("DATE_LIVRAISON"), SwingConstants.RIGHT), c);
JDate dateLivraison = new JDate(true);
c.gridx++;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
this.add(dateLivraison, c);
this.addView(dateLivraison, "DATE_LIVRAISON");
}
// Client
JLabel labelClient = new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT);
c.gridx = 0;
c.gridy++;
c.weightx = 0;
c.fill = GridBagConstraints.HORIZONTAL;
c.weighty = 0;
this.add(labelClient, c);
c.gridx++;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
this.comboClient = new ElementComboBox();
this.add(this.comboClient, c);
if (getTable().contains("SPEC_LIVRAISON")) {
// Date livraison
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("SPEC_LIVRAISON"), SwingConstants.RIGHT), c);
JTextField specLivraison = new JTextField();
c.gridx++;
c.weightx = 0;
c.weighty = 0;
this.add(specLivraison, c);
this.addView(specLivraison, "SPEC_LIVRAISON");
}
final ElementComboBox boxTarif = new ElementComboBox();
this.comboClient.addValueListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (comboClient.getElement().getTable().contains("ID_TARIF")) {
if (BonDeLivraisonSQLComponent.this.isFilling())
return;
final SQLRow row = ((SQLRequestComboBox) evt.getSource()).getSelectedRow();
if (row != null) {
// SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
// if (foreignRow.isUndefined() &&
// !row.getForeignRow("ID_DEVISE").isUndefined()) {
// SQLRowValues rowValsD = new SQLRowValues(foreignRow.getTable());
// rowValsD.put("ID_DEVISE", row.getObject("ID_DEVISE"));
// foreignRow = rowValsD;
//
// }
// tableBonItem.setTarif(foreignRow, true);
SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
if (!foreignRow.isUndefined() && (boxTarif.getSelectedRow() == null || boxTarif.getSelectedId() != foreignRow.getID())
&& JOptionPane.showConfirmDialog(null, "Appliquer les tarifs associés au client?") == JOptionPane.YES_OPTION) {
boxTarif.setValue(foreignRow.getID());
// SaisieVenteFactureSQLComponent.this.tableFacture.setTarif(foreignRow,
// true);
} else {
boxTarif.setValue(foreignRow.getID());
}
}
}
}
});
// Bouton tout livrer
JButton boutonAll = new JButton("Tout livrer");
boutonAll.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
RowValuesTableModel m = BonDeLivraisonSQLComponent.this.tableBonItem.getModel();
// on livre tout les éléments
for (int i = 0; i < m.getRowCount(); i++) {
SQLRowValues rowVals = m.getRowValuesAt(i);
Object o = rowVals.getObject("QTE");
int qte = o == null ? 0 : ((Number) o).intValue();
m.putValue(qte, i, "QTE_LIVREE");
}
}
});
// Tarif
if (this.getTable().getFieldsName().contains("ID_TARIF")) {
// TARIF
c.gridy++;
c.gridx = 0;
c.weightx = 0;
c.weighty = 0;
c.gridwidth = 1;
this.add(new JLabel("Tarif à appliquer"), c);
c.gridx++;
c.gridwidth = 1;
c.weightx = 1;
this.add(boxTarif, c);
this.addView(boxTarif, "ID_TARIF");
boxTarif.addModelListener("wantedID", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
SQLRow selectedRow = boxTarif.getRequest().getPrimaryTable().getRow(boxTarif.getWantedID());
tableBonItem.setTarif(selectedRow, !isFilling());
}
});
}
if (getTable().contains("A_ATTENTION")) {
// Date livraison
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("A_ATTENTION"), SwingConstants.RIGHT), c);
JTextField specLivraison = new JTextField();
c.gridx++;
c.weightx = 0;
c.weighty = 0;
this.add(specLivraison, c);
this.addView(specLivraison, "A_ATTENTION");
}
// Element du bon
List<JButton> l = new ArrayList<JButton>();
l.add(boutonAll);
this.tableBonItem = new BonDeLivraisonItemTable(l);
c.gridx = 0;
c.gridy++;
c.weightx = 1;
c.weighty = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.BOTH;
this.add(this.tableBonItem, c);
c.anchor = GridBagConstraints.EAST;
// Totaux
reconfigure(this.textTotalHT);
reconfigure(this.textTotalTVA);
reconfigure(this.textTotalTTC);
// Poids Total
c.gridy++;
c.gridx = 1;
c.weightx = 0;
c.weighty = 0;
c.anchor = GridBagConstraints.EAST;
c.gridwidth = 1;
c.fill = GridBagConstraints.NONE;
this.addSQLObject(this.textPoidsTotal, "TOTAL_POIDS");
this.addRequiredSQLObject(this.textTotalHT, "TOTAL_HT");
this.addRequiredSQLObject(this.textTotalTVA, "TOTAL_TVA");
this.addRequiredSQLObject(this.textTotalTTC, "TOTAL_TTC");
TotalPanel panelTotal = new TotalPanel(tableBonItem, textTotalHT, textTotalTVA, textTotalTTC, new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(),
textPoidsTotal, null);
c.gridx = 2;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 0;
c.weighty = 0;
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(panelTotal, c);
c.anchor = GridBagConstraints.WEST;
/*******************************************************************************************
* * INFORMATIONS COMPLEMENTAIRES
******************************************************************************************/
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy++;
TitledSeparator sep = new TitledSeparator("Informations complémentaires");
c.insets = new Insets(10, 2, 1, 2);
this.add(sep, c);
c.insets = new Insets(2, 2, 1, 2);
ITextArea textInfos = new ITextArea(4, 4);
c.gridx = 0;
c.gridy++;
c.gridheight = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.weighty = 0;
c.fill = GridBagConstraints.BOTH;
final JScrollPane scrollPane = new JScrollPane(textInfos);
this.add(scrollPane, c);
textInfos.setBorder(null);
DefaultGridBagConstraints.lockMinimumSize(scrollPane);
c.gridx = 0;
c.gridy++;
c.gridheight = 1;
c.gridwidth = 4;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.EAST;
this.panelOO = new PanelOOSQLComponent(this);
this.add(this.panelOO, c);
this.addRequiredSQLObject(date, "DATE");
this.addSQLObject(textInfos, "INFOS");
this.addSQLObject(this.textNom, "NOM");
this.addSQLObject(this.selectCommande, "ID_COMMANDE_CLIENT");
this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");
this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");
// Doit etre locké a la fin
DefaultGridBagConstraints.lockMinimumSize(comboClient);
}
public BonDeLivraisonItemTable getTableBonItem() {
return this.tableBonItem;
}
private void reconfigure(JTextField field) {
field.setEnabled(false);
field.setHorizontalAlignment(JTextField.RIGHT);
field.setDisabledTextColor(Color.BLACK);
field.setBorder(null);
}
public int insert(SQLRow order) {
int idBon = getSelectedID();
// on verifie qu'un bon du meme numero n'a pas été inséré entre temps
if (this.textNumeroUnique.checkValidation()) {
idBon = super.insert(order);
this.tableBonItem.updateField("ID_BON_DE_LIVRAISON", idBon);
this.tableBonItem.createArticle(idBon, this.getElement());
// generation du document
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(idBon));
bSheet.createDocumentAsynchronous();
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
// incrémentation du numéro auto
if (NumerotationAutoSQLElement.getNextNumero(BonDeLivraisonSQLElement.class).equalsIgnoreCase(this.textNumeroUnique.getText().trim())) {
SQLRowValues rowVals = new SQLRowValues(this.tableNum);
int val = this.tableNum.getRow(2).getInt("BON_L_START");
val++;
rowVals.put("BON_L_START", new Integer(val));
try {
rowVals.update(2);
} catch (SQLException e) {
e.printStackTrace();
}
}
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
try {
updateStock(idBon);
} catch (SQLException e) {
throw new IllegalStateException(e);
}
}
// updateQte(idBon);
} else {
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon de livraison existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
}
return idBon;
}
@Override
public void select(SQLRowAccessor r) {
if (r == null || r.getIDNumber() == null)
super.select(r);
else {
System.err.println(r);
final SQLRowValues rVals = r.asRowValues();
final SQLRowValues vals = new SQLRowValues(r.getTable());
vals.load(rVals, createSet("ID_CLIENT"));
vals.setID(rVals.getID());
System.err.println("Select CLIENT");
super.select(vals);
rVals.remove("ID_CLIENT");
super.select(rVals);
}
}
@Override
public void update() {
if (!this.textNumeroUnique.checkValidation()) {
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon de livraison existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
return;
}
super.update();
this.tableBonItem.updateField("ID_BON_DE_LIVRAISON", getSelectedID());
this.tableBonItem.createArticle(getSelectedID(), this.getElement());
// generation du document
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(getSelectedID()));
bSheet.createDocumentAsynchronous();
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
SQLElement eltMvtStock = Configuration.getInstance().getDirectory().getElement("MOUVEMENT_STOCK");
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
// On efface les anciens mouvements de stocks
SQLSelect sel = new SQLSelect(eltMvtStock.getTable().getBase());
sel.addSelect(eltMvtStock.getTable().getField("ID"));
Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), "=", getSelectedID());
Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName());
sel.setWhere(w.and(w2));
List l = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler());
if (l != null) {
for (int i = 0; i < l.size(); i++) {
Object[] tmp = (Object[]) l.get(i);
try {
eltMvtStock.archive(((Number) tmp[0]).intValue());
} catch (SQLException e) {
e.printStackTrace();
}
}
}
try {
updateStock(getSelectedID());
} catch (SQLException e) {
throw new IllegalStateException(e);
}
}
}
/***********************************************************************************************
* Mise à jour des quantités livrées dans les élements de facture
*
* @param idBon id du bon de livraison
* @throws SQLException
*/
public void updateQte(int idBon) throws SQLException {
SQLTable tableFactureElem = new SaisieVenteFactureItemSQLElement().getTable();
SQLSelect selBonItem = new SQLSelect(getTable().getBase());
BonDeLivraisonItemSQLElement bonElt = new BonDeLivraisonItemSQLElement();
selBonItem.addSelect(bonElt.getTable().getField("ID_SAISIE_VENTE_FACTURE_ELEMENT"));
selBonItem.addSelect(bonElt.getTable().getField("QTE_LIVREE"));
selBonItem.setWhere(bonElt.getTable().getField("ID_BON_DE_LIVRAISON"), "=", idBon);
String reqBonItem = selBonItem.asString();
Object obBonItem = getTable().getBase().getDataSource().execute(reqBonItem, new ArrayListHandler());
final List<Object[]> myListBonItem = (List<Object[]>) obBonItem;
final int size = myListBonItem.size();
for (int i = 0; i < size; i++) {
final Object[] objTmp = myListBonItem.get(i);
final SQLRow rowFactElem = tableFactureElem.getRow(((Number) objTmp[0]).intValue());
final SQLRowValues rowVals = new SQLRowValues(tableFactureElem);
rowVals.put("QTE_LIVREE", Integer.valueOf(rowFactElem.getInt("QTE_LIVREE") + ((Number) objTmp[1]).intValue()));
rowVals.update(rowFactElem.getID());
}
}
/***********************************************************************************************
* Mise à jour des quantités livrées dans les élements de facture
*
* @param idBon id du bon de livraison
* @throws SQLException
*/
public void cancelUpdateQte(int idBon) throws SQLException {
SQLTable tableFactureElem = new SaisieVenteFactureItemSQLElement().getTable();
SQLSelect selBonItem = new SQLSelect(getTable().getBase());
BonDeLivraisonItemSQLElement bonElt = new BonDeLivraisonItemSQLElement();
selBonItem.addSelect(bonElt.getTable().getField("ID_SAISIE_VENTE_FACTURE_ELEMENT"));
selBonItem.addSelect(bonElt.getTable().getField("QTE_LIVREE"));
selBonItem.setWhere(bonElt.getTable().getField("ID_BON_DE_LIVRAISON"), "=", idBon);
String reqBonItem = selBonItem.asString();
Object obBonItem = getTable().getBase().getDataSource().execute(reqBonItem, new ArrayListHandler());
final List<Object[]> myListBonItem = (List<Object[]>) obBonItem;
final int size = myListBonItem.size();
for (int i = 0; i < size; i++) {
final Object[] objTmp = myListBonItem.get(i);
final SQLRow rowFactElem = tableFactureElem.getRow(((Number) objTmp[0]).intValue());
final SQLRowValues rowVals = new SQLRowValues(tableFactureElem);
rowVals.put("QTE_LIVREE", Integer.valueOf(((Number) objTmp[1]).intValue() - rowFactElem.getInt("QTE_LIVREE")));
rowVals.update(rowFactElem.getID());
}
}
protected String getLibelleStock(SQLRowAccessor row, SQLRowAccessor rowElt) {
return "BL N°" + row.getString("NUMERO");
}
/**
* Mise à jour des stocks pour chaque article composant la facture
*
* @throws SQLException
*/
private void updateStock(int id) throws SQLException {
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
SQLRow row = getTable().getRow(id);
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
@Override
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
return getLibelleStock(rowOrigin, rowElt);
}
}, row, row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT")), Type.REAL_DELIVER);
stockUpdater.update();
}
}
}
| UTF-8 | Java | 25,437 | java | BonDeLivraisonSQLComponent.java | Java | [] | null | [] | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.sales.shipment.component;
import static org.openconcerto.utils.CollectionUtils.createSet;
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
import org.openconcerto.erp.core.common.ui.DeviseField;
import org.openconcerto.erp.core.common.ui.TotalPanel;
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureItemSQLElement;
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonItemSQLElement;
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonSQLElement;
import org.openconcerto.erp.core.sales.shipment.report.BonLivraisonXmlSheet;
import org.openconcerto.erp.core.sales.shipment.ui.BonDeLivraisonItemTable;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.Type;
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
import org.openconcerto.erp.panel.PanelOOSQLComponent;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FormLayouter;
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.utils.ExceptionHandler;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import org.apache.commons.dbutils.handlers.ArrayListHandler;
public class BonDeLivraisonSQLComponent extends TransfertBaseSQLComponent {
private BonDeLivraisonItemTable tableBonItem;
private ElementComboBox selectCommande, comboClient;
private PanelOOSQLComponent panelOO;
private JUniqueTextField textNumeroUnique;
private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO");
private final DeviseField textTotalHT = new DeviseField(6);
private final DeviseField textTotalTVA = new DeviseField(6);
private final DeviseField textTotalTTC = new DeviseField(6);
private final JTextField textPoidsTotal = new JTextField(6);
private final JTextField textNom = new JTextField(25);
public BonDeLivraisonSQLComponent() {
super(Configuration.getInstance().getDirectory().getElement("BON_DE_LIVRAISON"));
}
@Override
protected RowValuesTable getRowValuesTable() {
return this.tableBonItem.getRowValuesTable();
}
@Override
protected SQLRowValues createDefaults() {
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass()));
this.tableBonItem.getModel().clearRows();
return super.createDefaults();
}
public void addViews() {
this.textTotalHT.setOpaque(false);
this.textTotalTVA.setOpaque(false);
this.textTotalTTC.setOpaque(false);
this.selectCommande = new ElementComboBox();
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
// Champ Module
c.gridx = 0;
c.gridy++;
c.gridwidth = GridBagConstraints.REMAINDER;
final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
this.setAdditionalFieldsPanel(new FormLayouter(addP, 2));
this.add(addP, c);
c.gridy++;
c.gridwidth = 1;
// Numero
JLabel labelNum = new JLabel(getLabelFor("NUMERO"));
labelNum.setHorizontalAlignment(SwingConstants.RIGHT);
this.add(labelNum, c);
this.textNumeroUnique = new JUniqueTextField(16);
c.gridx++;
c.weightx = 1;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
DefaultGridBagConstraints.lockMinimumSize(textNumeroUnique);
this.add(this.textNumeroUnique, c);
// Date
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("DATE"), SwingConstants.RIGHT), c);
JDate date = new JDate(true);
c.gridx++;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
this.add(date, c);
// Reference
c.gridy++;
c.gridx = 0;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c);
c.gridx++;
c.weightx = 1;
this.add(this.textNom, c);
if (getTable().contains("DATE_LIVRAISON")) {
// Date livraison
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("DATE_LIVRAISON"), SwingConstants.RIGHT), c);
JDate dateLivraison = new JDate(true);
c.gridx++;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
this.add(dateLivraison, c);
this.addView(dateLivraison, "DATE_LIVRAISON");
}
// Client
JLabel labelClient = new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT);
c.gridx = 0;
c.gridy++;
c.weightx = 0;
c.fill = GridBagConstraints.HORIZONTAL;
c.weighty = 0;
this.add(labelClient, c);
c.gridx++;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
this.comboClient = new ElementComboBox();
this.add(this.comboClient, c);
if (getTable().contains("SPEC_LIVRAISON")) {
// Date livraison
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("SPEC_LIVRAISON"), SwingConstants.RIGHT), c);
JTextField specLivraison = new JTextField();
c.gridx++;
c.weightx = 0;
c.weighty = 0;
this.add(specLivraison, c);
this.addView(specLivraison, "SPEC_LIVRAISON");
}
final ElementComboBox boxTarif = new ElementComboBox();
this.comboClient.addValueListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (comboClient.getElement().getTable().contains("ID_TARIF")) {
if (BonDeLivraisonSQLComponent.this.isFilling())
return;
final SQLRow row = ((SQLRequestComboBox) evt.getSource()).getSelectedRow();
if (row != null) {
// SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
// if (foreignRow.isUndefined() &&
// !row.getForeignRow("ID_DEVISE").isUndefined()) {
// SQLRowValues rowValsD = new SQLRowValues(foreignRow.getTable());
// rowValsD.put("ID_DEVISE", row.getObject("ID_DEVISE"));
// foreignRow = rowValsD;
//
// }
// tableBonItem.setTarif(foreignRow, true);
SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
if (!foreignRow.isUndefined() && (boxTarif.getSelectedRow() == null || boxTarif.getSelectedId() != foreignRow.getID())
&& JOptionPane.showConfirmDialog(null, "Appliquer les tarifs associés au client?") == JOptionPane.YES_OPTION) {
boxTarif.setValue(foreignRow.getID());
// SaisieVenteFactureSQLComponent.this.tableFacture.setTarif(foreignRow,
// true);
} else {
boxTarif.setValue(foreignRow.getID());
}
}
}
}
});
// Bouton tout livrer
JButton boutonAll = new JButton("Tout livrer");
boutonAll.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
RowValuesTableModel m = BonDeLivraisonSQLComponent.this.tableBonItem.getModel();
// on livre tout les éléments
for (int i = 0; i < m.getRowCount(); i++) {
SQLRowValues rowVals = m.getRowValuesAt(i);
Object o = rowVals.getObject("QTE");
int qte = o == null ? 0 : ((Number) o).intValue();
m.putValue(qte, i, "QTE_LIVREE");
}
}
});
// Tarif
if (this.getTable().getFieldsName().contains("ID_TARIF")) {
// TARIF
c.gridy++;
c.gridx = 0;
c.weightx = 0;
c.weighty = 0;
c.gridwidth = 1;
this.add(new JLabel("Tarif à appliquer"), c);
c.gridx++;
c.gridwidth = 1;
c.weightx = 1;
this.add(boxTarif, c);
this.addView(boxTarif, "ID_TARIF");
boxTarif.addModelListener("wantedID", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
SQLRow selectedRow = boxTarif.getRequest().getPrimaryTable().getRow(boxTarif.getWantedID());
tableBonItem.setTarif(selectedRow, !isFilling());
}
});
}
if (getTable().contains("A_ATTENTION")) {
// Date livraison
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(new JLabel(getLabelFor("A_ATTENTION"), SwingConstants.RIGHT), c);
JTextField specLivraison = new JTextField();
c.gridx++;
c.weightx = 0;
c.weighty = 0;
this.add(specLivraison, c);
this.addView(specLivraison, "A_ATTENTION");
}
// Element du bon
List<JButton> l = new ArrayList<JButton>();
l.add(boutonAll);
this.tableBonItem = new BonDeLivraisonItemTable(l);
c.gridx = 0;
c.gridy++;
c.weightx = 1;
c.weighty = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.BOTH;
this.add(this.tableBonItem, c);
c.anchor = GridBagConstraints.EAST;
// Totaux
reconfigure(this.textTotalHT);
reconfigure(this.textTotalTVA);
reconfigure(this.textTotalTTC);
// Poids Total
c.gridy++;
c.gridx = 1;
c.weightx = 0;
c.weighty = 0;
c.anchor = GridBagConstraints.EAST;
c.gridwidth = 1;
c.fill = GridBagConstraints.NONE;
this.addSQLObject(this.textPoidsTotal, "TOTAL_POIDS");
this.addRequiredSQLObject(this.textTotalHT, "TOTAL_HT");
this.addRequiredSQLObject(this.textTotalTVA, "TOTAL_TVA");
this.addRequiredSQLObject(this.textTotalTTC, "TOTAL_TTC");
TotalPanel panelTotal = new TotalPanel(tableBonItem, textTotalHT, textTotalTVA, textTotalTTC, new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(),
textPoidsTotal, null);
c.gridx = 2;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 0;
c.weighty = 0;
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(panelTotal, c);
c.anchor = GridBagConstraints.WEST;
/*******************************************************************************************
* * INFORMATIONS COMPLEMENTAIRES
******************************************************************************************/
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy++;
TitledSeparator sep = new TitledSeparator("Informations complémentaires");
c.insets = new Insets(10, 2, 1, 2);
this.add(sep, c);
c.insets = new Insets(2, 2, 1, 2);
ITextArea textInfos = new ITextArea(4, 4);
c.gridx = 0;
c.gridy++;
c.gridheight = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.weighty = 0;
c.fill = GridBagConstraints.BOTH;
final JScrollPane scrollPane = new JScrollPane(textInfos);
this.add(scrollPane, c);
textInfos.setBorder(null);
DefaultGridBagConstraints.lockMinimumSize(scrollPane);
c.gridx = 0;
c.gridy++;
c.gridheight = 1;
c.gridwidth = 4;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.EAST;
this.panelOO = new PanelOOSQLComponent(this);
this.add(this.panelOO, c);
this.addRequiredSQLObject(date, "DATE");
this.addSQLObject(textInfos, "INFOS");
this.addSQLObject(this.textNom, "NOM");
this.addSQLObject(this.selectCommande, "ID_COMMANDE_CLIENT");
this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");
this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");
// Doit etre locké a la fin
DefaultGridBagConstraints.lockMinimumSize(comboClient);
}
public BonDeLivraisonItemTable getTableBonItem() {
return this.tableBonItem;
}
private void reconfigure(JTextField field) {
field.setEnabled(false);
field.setHorizontalAlignment(JTextField.RIGHT);
field.setDisabledTextColor(Color.BLACK);
field.setBorder(null);
}
public int insert(SQLRow order) {
int idBon = getSelectedID();
// on verifie qu'un bon du meme numero n'a pas été inséré entre temps
if (this.textNumeroUnique.checkValidation()) {
idBon = super.insert(order);
this.tableBonItem.updateField("ID_BON_DE_LIVRAISON", idBon);
this.tableBonItem.createArticle(idBon, this.getElement());
// generation du document
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(idBon));
bSheet.createDocumentAsynchronous();
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
// incrémentation du numéro auto
if (NumerotationAutoSQLElement.getNextNumero(BonDeLivraisonSQLElement.class).equalsIgnoreCase(this.textNumeroUnique.getText().trim())) {
SQLRowValues rowVals = new SQLRowValues(this.tableNum);
int val = this.tableNum.getRow(2).getInt("BON_L_START");
val++;
rowVals.put("BON_L_START", new Integer(val));
try {
rowVals.update(2);
} catch (SQLException e) {
e.printStackTrace();
}
}
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
try {
updateStock(idBon);
} catch (SQLException e) {
throw new IllegalStateException(e);
}
}
// updateQte(idBon);
} else {
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon de livraison existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
}
return idBon;
}
@Override
public void select(SQLRowAccessor r) {
if (r == null || r.getIDNumber() == null)
super.select(r);
else {
System.err.println(r);
final SQLRowValues rVals = r.asRowValues();
final SQLRowValues vals = new SQLRowValues(r.getTable());
vals.load(rVals, createSet("ID_CLIENT"));
vals.setID(rVals.getID());
System.err.println("Select CLIENT");
super.select(vals);
rVals.remove("ID_CLIENT");
super.select(rVals);
}
}
@Override
public void update() {
if (!this.textNumeroUnique.checkValidation()) {
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon de livraison existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
return;
}
super.update();
this.tableBonItem.updateField("ID_BON_DE_LIVRAISON", getSelectedID());
this.tableBonItem.createArticle(getSelectedID(), this.getElement());
// generation du document
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(getSelectedID()));
bSheet.createDocumentAsynchronous();
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
SQLElement eltMvtStock = Configuration.getInstance().getDirectory().getElement("MOUVEMENT_STOCK");
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
// On efface les anciens mouvements de stocks
SQLSelect sel = new SQLSelect(eltMvtStock.getTable().getBase());
sel.addSelect(eltMvtStock.getTable().getField("ID"));
Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), "=", getSelectedID());
Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName());
sel.setWhere(w.and(w2));
List l = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler());
if (l != null) {
for (int i = 0; i < l.size(); i++) {
Object[] tmp = (Object[]) l.get(i);
try {
eltMvtStock.archive(((Number) tmp[0]).intValue());
} catch (SQLException e) {
e.printStackTrace();
}
}
}
try {
updateStock(getSelectedID());
} catch (SQLException e) {
throw new IllegalStateException(e);
}
}
}
/***********************************************************************************************
* Mise à jour des quantités livrées dans les élements de facture
*
* @param idBon id du bon de livraison
* @throws SQLException
*/
public void updateQte(int idBon) throws SQLException {
SQLTable tableFactureElem = new SaisieVenteFactureItemSQLElement().getTable();
SQLSelect selBonItem = new SQLSelect(getTable().getBase());
BonDeLivraisonItemSQLElement bonElt = new BonDeLivraisonItemSQLElement();
selBonItem.addSelect(bonElt.getTable().getField("ID_SAISIE_VENTE_FACTURE_ELEMENT"));
selBonItem.addSelect(bonElt.getTable().getField("QTE_LIVREE"));
selBonItem.setWhere(bonElt.getTable().getField("ID_BON_DE_LIVRAISON"), "=", idBon);
String reqBonItem = selBonItem.asString();
Object obBonItem = getTable().getBase().getDataSource().execute(reqBonItem, new ArrayListHandler());
final List<Object[]> myListBonItem = (List<Object[]>) obBonItem;
final int size = myListBonItem.size();
for (int i = 0; i < size; i++) {
final Object[] objTmp = myListBonItem.get(i);
final SQLRow rowFactElem = tableFactureElem.getRow(((Number) objTmp[0]).intValue());
final SQLRowValues rowVals = new SQLRowValues(tableFactureElem);
rowVals.put("QTE_LIVREE", Integer.valueOf(rowFactElem.getInt("QTE_LIVREE") + ((Number) objTmp[1]).intValue()));
rowVals.update(rowFactElem.getID());
}
}
/***********************************************************************************************
* Mise à jour des quantités livrées dans les élements de facture
*
* @param idBon id du bon de livraison
* @throws SQLException
*/
public void cancelUpdateQte(int idBon) throws SQLException {
SQLTable tableFactureElem = new SaisieVenteFactureItemSQLElement().getTable();
SQLSelect selBonItem = new SQLSelect(getTable().getBase());
BonDeLivraisonItemSQLElement bonElt = new BonDeLivraisonItemSQLElement();
selBonItem.addSelect(bonElt.getTable().getField("ID_SAISIE_VENTE_FACTURE_ELEMENT"));
selBonItem.addSelect(bonElt.getTable().getField("QTE_LIVREE"));
selBonItem.setWhere(bonElt.getTable().getField("ID_BON_DE_LIVRAISON"), "=", idBon);
String reqBonItem = selBonItem.asString();
Object obBonItem = getTable().getBase().getDataSource().execute(reqBonItem, new ArrayListHandler());
final List<Object[]> myListBonItem = (List<Object[]>) obBonItem;
final int size = myListBonItem.size();
for (int i = 0; i < size; i++) {
final Object[] objTmp = myListBonItem.get(i);
final SQLRow rowFactElem = tableFactureElem.getRow(((Number) objTmp[0]).intValue());
final SQLRowValues rowVals = new SQLRowValues(tableFactureElem);
rowVals.put("QTE_LIVREE", Integer.valueOf(((Number) objTmp[1]).intValue() - rowFactElem.getInt("QTE_LIVREE")));
rowVals.update(rowFactElem.getID());
}
}
protected String getLibelleStock(SQLRowAccessor row, SQLRowAccessor rowElt) {
return "BL N°" + row.getString("NUMERO");
}
/**
* Mise à jour des stocks pour chaque article composant la facture
*
* @throws SQLException
*/
private void updateStock(int id) throws SQLException {
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
SQLRow row = getTable().getRow(id);
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
@Override
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
return getLibelleStock(rowOrigin, rowElt);
}
}, row, row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT")), Type.REAL_DELIVER);
stockUpdater.update();
}
}
}
| 25,437 | 0.599693 | 0.596112 | 607 | 39.866558 | 30.42852 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.787479 | false | false | 9 |
26d122ba0e48fedf746a61a2c73eaccab0277645 | 15,633,681,009,157 | 5b82e2f7c720c49dff236970aacd610e7c41a077 | /QueryReformulation-master 2/data/processed/MarkerImageProviderTest.java | ec359a4e473bebce5afd46a5a01353549ceb5591 | [] | no_license | shy942/EGITrepoOnlineVersion | https://github.com/shy942/EGITrepoOnlineVersion | 4b157da0f76dc5bbf179437242d2224d782dd267 | f88fb20497dcc30ff1add5fe359cbca772142b09 | refs/heads/master | 2021-01-20T16:04:23.509000 | 2016-07-21T20:43:22 | 2016-07-21T20:43:22 | 63,737,385 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /***/
package org.eclipse.ui.tests.adaptable;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.tests.harness.util.UITestCase;
/**
* Tests the markerImageProviders extension point.
*/
public class MarkerImageProviderTest extends UITestCase {
public MarkerImageProviderTest(String testName) {
super(testName);
}
/**
* Tests the static form of the extension, where just a file path is given.
*/
public void testStatic() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IMarker marker = null;
try {
marker = workspace.getRoot().createMarker(//$NON-NLS-1$
"org.eclipse.ui.tests.testmarker");
} catch (CoreException e) {
fail(e.getMessage());
}
IWorkbenchAdapter adapter = marker.getAdapter(IWorkbenchAdapter.class);
ImageDescriptor imageDesc = adapter.getImageDescriptor(marker);
assertNotNull(imageDesc);
//$NON-NLS-1$
assertTrue(imageDesc.toString().indexOf("anything") != -1);
}
/**
* Tests the dynamic form of the extension, where an IMarkerImageProvider class is given.
*/
public void testDynamic() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IMarker marker = null;
try {
marker = workspace.getRoot().createMarker(//$NON-NLS-1$
"org.eclipse.ui.tests.testmarker2");
} catch (CoreException e) {
fail(e.getMessage());
}
IWorkbenchAdapter adapter = marker.getAdapter(IWorkbenchAdapter.class);
ImageDescriptor imageDesc = adapter.getImageDescriptor(marker);
assertNotNull(imageDesc);
//$NON-NLS-1$
assertTrue(imageDesc.toString().indexOf("anything") != -1);
}
}
| UTF-8 | Java | 2,014 | java | MarkerImageProviderTest.java | Java | [] | null | [] | /***/
package org.eclipse.ui.tests.adaptable;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.tests.harness.util.UITestCase;
/**
* Tests the markerImageProviders extension point.
*/
public class MarkerImageProviderTest extends UITestCase {
public MarkerImageProviderTest(String testName) {
super(testName);
}
/**
* Tests the static form of the extension, where just a file path is given.
*/
public void testStatic() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IMarker marker = null;
try {
marker = workspace.getRoot().createMarker(//$NON-NLS-1$
"org.eclipse.ui.tests.testmarker");
} catch (CoreException e) {
fail(e.getMessage());
}
IWorkbenchAdapter adapter = marker.getAdapter(IWorkbenchAdapter.class);
ImageDescriptor imageDesc = adapter.getImageDescriptor(marker);
assertNotNull(imageDesc);
//$NON-NLS-1$
assertTrue(imageDesc.toString().indexOf("anything") != -1);
}
/**
* Tests the dynamic form of the extension, where an IMarkerImageProvider class is given.
*/
public void testDynamic() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IMarker marker = null;
try {
marker = workspace.getRoot().createMarker(//$NON-NLS-1$
"org.eclipse.ui.tests.testmarker2");
} catch (CoreException e) {
fail(e.getMessage());
}
IWorkbenchAdapter adapter = marker.getAdapter(IWorkbenchAdapter.class);
ImageDescriptor imageDesc = adapter.getImageDescriptor(marker);
assertNotNull(imageDesc);
//$NON-NLS-1$
assertTrue(imageDesc.toString().indexOf("anything") != -1);
}
}
| 2,014 | 0.672294 | 0.668818 | 58 | 33.724136 | 25.741951 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.465517 | false | false | 9 |
4fddfb6b10c7c5972f99dd96bc473c0f0fcd59f4 | 29,626,684,460,974 | bce06f295824f0437da53b2dfd5b7f7c7c97517f | /src/main/java/com/jifenke/lepluslive/groupon/domain/entities/GrouponRefund.java | 50689558d4a7fc980918f39c3d5e49e4de65da98 | [] | no_license | wcggit/lepluslife_back | https://github.com/wcggit/lepluslife_back | 38c1b902ba0197b7c3d26d952eb104c3a9db08b1 | a735b1901ec70926132422e03ff1775468763138 | refs/heads/master | 2020-04-03T22:37:19.083000 | 2017-07-11T06:09:06 | 2017-07-11T06:09:06 | 57,190,617 | 0 | 79 | null | false | 2017-07-11T06:09:06 | 2016-04-27T06:49:31 | 2016-04-27T06:55:57 | 2017-07-11T06:09:06 | 1,894 | 0 | 16 | 1 | Java | null | null | package com.jifenke.lepluslive.groupon.domain.entities;
import com.jifenke.lepluslive.user.domain.entities.LeJiaUser;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
* Created by wcg on 2017/6/14. 团购退款申请
*/
@Entity
@Table(name = "GROUPON_REFUND")
public class GrouponRefund {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne
private GrouponOrder grouponOrder;
private Integer state; //0 未完成 1 完成 2 驳回
private Date createDate;
private Date completeDate;
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCompleteDate() {
return completeDate;
}
public void setCompleteDate(Date completeDate) {
this.completeDate = completeDate;
}
}
| UTF-8 | Java | 1,051 | java | GrouponRefund.java | Java | [
{
"context": "import javax.persistence.Table;\n\n/**\n * Created by wcg on 2017/6/14. 团购退款申请\n */\n@Entity\n@Table(name = \"G",
"end": 413,
"score": 0.9995436072349548,
"start": 410,
"tag": "USERNAME",
"value": "wcg"
}
] | null | [] | package com.jifenke.lepluslive.groupon.domain.entities;
import com.jifenke.lepluslive.user.domain.entities.LeJiaUser;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
* Created by wcg on 2017/6/14. 团购退款申请
*/
@Entity
@Table(name = "GROUPON_REFUND")
public class GrouponRefund {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne
private GrouponOrder grouponOrder;
private Integer state; //0 未完成 1 完成 2 驳回
private Date createDate;
private Date completeDate;
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCompleteDate() {
return completeDate;
}
public void setCompleteDate(Date completeDate) {
this.completeDate = completeDate;
}
}
| 1,051 | 0.746341 | 0.736585 | 52 | 18.711538 | 17.730175 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 9 |
a8a6bc6e64a19bc5a7e4bfe67fda7b859ff24202 | 24,584,392,855,811 | c42cb028f57b273cf4e99bd4ed55ad34ad25ea52 | /src/lesson3/Lesson3_8_9AdditionalTask.java | 4f94437119292ac5a5b9cd87bbcb864a6a0121e8 | [] | no_license | Dimatokin/HomeWork | https://github.com/Dimatokin/HomeWork | 1dd93c54ea843ea5ce128356b4c5f529338aa72f | 408dc3d1d6c04406f1fe69f0359dbd21cb78bb2b | refs/heads/main | 2023-03-01T09:34:07.515000 | 2021-02-05T19:42:00 | 2021-02-05T19:42:00 | 290,986,278 | 1 | 0 | null | false | 2020-08-31T16:50:37 | 2020-08-28T07:56:26 | 2020-08-28T08:01:09 | 2020-08-31T16:50:37 | 39 | 0 | 0 | 0 | Java | false | false | /* 8) Найти второй по величине (т.е. следующий по величине за максимальным) элемент в массиве.
* 9) Найти наименьший элемент среди элементов с четными индексами массива */
package lesson3;
import java.util.Arrays;
public class Lesson3_8_9AdditionalTask {
public static void main(String[] args) {
int[] numbers = new int[10];
for (int i = 0; i < numbers.length; i++) {
int random = (int) ((Math.random() + 1) * 80);
numbers[i] = random;
}
System.out.println(Arrays.toString(numbers));
int minNum = numbers[0];
for (int i = 0; i < numbers.length; i++) {
if (i % 2 == 0) {
if (numbers[i] < minNum) {
minNum = numbers[i];
}
}
}
System.out.println("The smallest element among the elements with even array indexes: " + minNum);//наименьший элемент среди элементов с четными индексами массива
Arrays.sort(numbers);
System.out.println(Arrays.toString(numbers));
System.out.println(numbers[numbers.length - 2]);//выводим следующий по величине за максимальным
}
}
| UTF-8 | Java | 1,379 | java | Lesson3_8_9AdditionalTask.java | Java | [] | null | [] | /* 8) Найти второй по величине (т.е. следующий по величине за максимальным) элемент в массиве.
* 9) Найти наименьший элемент среди элементов с четными индексами массива */
package lesson3;
import java.util.Arrays;
public class Lesson3_8_9AdditionalTask {
public static void main(String[] args) {
int[] numbers = new int[10];
for (int i = 0; i < numbers.length; i++) {
int random = (int) ((Math.random() + 1) * 80);
numbers[i] = random;
}
System.out.println(Arrays.toString(numbers));
int minNum = numbers[0];
for (int i = 0; i < numbers.length; i++) {
if (i % 2 == 0) {
if (numbers[i] < minNum) {
minNum = numbers[i];
}
}
}
System.out.println("The smallest element among the elements with even array indexes: " + minNum);//наименьший элемент среди элементов с четными индексами массива
Arrays.sort(numbers);
System.out.println(Arrays.toString(numbers));
System.out.println(numbers[numbers.length - 2]);//выводим следующий по величине за максимальным
}
}
| 1,379 | 0.594102 | 0.579358 | 29 | 38.758621 | 36.044662 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.551724 | false | false | 9 |
ecda84fcc02792f01eba55ea3f8af50551acf764 | 22,093,311,814,399 | 397b3554b19916c56339845245f0f38fd2655c70 | /android/app/CavanMain/src/com/cavan/cavanmain/CavanAccessibilitySogou.java | eb04e345ed9bcfeda5e8e070b1efc18c6f94d59b | [] | no_license | jolin90/cavan | https://github.com/jolin90/cavan | f270e99fb42f8b08f9b9e098a73b5de631da0734 | 0af8a871cb10abd785c3b0e4e07a2d7ef85943e6 | refs/heads/master | 2021-01-20T14:19:48.816000 | 2017-05-07T18:36:15 | 2017-05-07T18:36:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cavan.cavanmain;
import java.util.List;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.cavan.android.CavanAccessibility;
import com.cavan.android.CavanPackageName;
import com.cavan.java.CavanString;
public class CavanAccessibilitySogou extends CavanAccessibilityBase<String> {
private String mLastClassName = CavanString.EMPTY_STRING;
public CavanAccessibilitySogou(CavanAccessibilityService service) {
super(service);
}
@Override
public String getPackageName() {
return CavanPackageName.SOGOU_IME;
}
@Override
public void onWindowStateChanged(AccessibilityEvent event) {
mService.setAutoOpenAppEnable(false);
if (mLastClassName.equals(mClassName)) {
return;
}
mLastClassName = mClassName;
AccessibilityNodeInfo source = event.getSource();
if (source == null) {
return;
}
if ("com.sogou.ocrplugin.OCRResultActivity".equals(mClassName)) {
List<AccessibilityNodeInfo> nodes = source.findAccessibilityNodeInfosByViewId("com.sohu.inputmethod.sogou:id/result_view");
if (nodes != null && nodes.size() > 0) {
CharSequence sequence = nodes.get(0).getText();
if (sequence != null) {
mService.doCheckContent(sequence.toString());
}
}
CavanAccessibility.recycleNodes(nodes);
}
}
@Override
protected boolean onKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
mService.setAutoOpenAppEnable(true);
}
return true;
}
return false;
}
}
| UTF-8 | Java | 1,624 | java | CavanAccessibilitySogou.java | Java | [] | null | [] | package com.cavan.cavanmain;
import java.util.List;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import com.cavan.android.CavanAccessibility;
import com.cavan.android.CavanPackageName;
import com.cavan.java.CavanString;
public class CavanAccessibilitySogou extends CavanAccessibilityBase<String> {
private String mLastClassName = CavanString.EMPTY_STRING;
public CavanAccessibilitySogou(CavanAccessibilityService service) {
super(service);
}
@Override
public String getPackageName() {
return CavanPackageName.SOGOU_IME;
}
@Override
public void onWindowStateChanged(AccessibilityEvent event) {
mService.setAutoOpenAppEnable(false);
if (mLastClassName.equals(mClassName)) {
return;
}
mLastClassName = mClassName;
AccessibilityNodeInfo source = event.getSource();
if (source == null) {
return;
}
if ("com.sogou.ocrplugin.OCRResultActivity".equals(mClassName)) {
List<AccessibilityNodeInfo> nodes = source.findAccessibilityNodeInfosByViewId("com.sohu.inputmethod.sogou:id/result_view");
if (nodes != null && nodes.size() > 0) {
CharSequence sequence = nodes.get(0).getText();
if (sequence != null) {
mService.doCheckContent(sequence.toString());
}
}
CavanAccessibility.recycleNodes(nodes);
}
}
@Override
protected boolean onKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
mService.setAutoOpenAppEnable(true);
}
return true;
}
return false;
}
}
| 1,624 | 0.748768 | 0.747537 | 66 | 23.60606 | 25.903597 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.681818 | false | false | 9 |
71eb59075aaa880e712993ece082feca48812e36 | 33,225,867,027,792 | 75658a5b580a1f4efdb7c193c534603fc79b893d | /src/cx/myhome/yak/ghsc/SettingsActivity.java | 752af24874ea9243f8d10bdeb9fbcd50c71eced3 | [
"BSD-2-Clause"
] | permissive | yak1ex/ghsc | https://github.com/yak1ex/ghsc | 75e44b1741dcca7c1ee48f43011d163b86fd3a90 | 706c1b3c345561dddfec40f5c6b827311b51cb60 | refs/heads/master | 2016-09-05T15:22:26.796000 | 2014-05-16T16:20:00 | 2014-05-16T16:20:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cx.myhome.yak.ghsc;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.TimeZone;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
private String getOffsetDesc(int offset)
{
int absOffset = Math.abs(offset);
String sign = offset >= 0 ? "+" : "-";
return String.format("GMT%s%d:%02d", sign, absOffset / 3600000, absOffset / 60000 % 60);
}
private String getTimezoneDesc(String timezoneID, String delimiter)
{
TimeZone tz = TimeZone.getTimeZone(timezoneID);
Date current = new Date();
int rawOffset = tz.getRawOffset();
if(tz.inDaylightTime(current)) {
return String.format("%s%s%s (DST)%s(ST: %s)", timezoneID, delimiter, getOffsetDesc(rawOffset + tz.getDSTSavings()), delimiter, getOffsetDesc(rawOffset));
} else {
return String.format("%s%s%s", timezoneID, delimiter, getOffsetDesc(rawOffset));
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
CharSequence timezone_key = getText(R.string.timezone_key);
ListPreference timezonePref = (ListPreference)getPreferenceScreen().findPreference(timezone_key);
String[] timezone = getResources().getStringArray(R.array.timezone_ids);
// Sort by effective offsets
TimeZone[] tz = new TimeZone[timezone.length];
for(int i = 0; i < timezone.length; ++i) {
tz[i] = TimeZone.getTimeZone(timezone[i]);
}
final Date d = new Date();
Arrays.sort(tz, new Comparator<TimeZone>() {
public int compare(TimeZone a, TimeZone b) {
long a_ = a.getOffset(d.getTime());
long b_ = b.getOffset(d.getTime());
return a_ < b_ ? -1 : a_ > b_ ? 1 : 0;
}
});
// Back to string array
for(int i = 0; i < timezone.length; ++i) {
timezone[i] = tz[i].getID();
}
timezonePref.setEntryValues(timezone);
String[] timezoneDesc = new String[timezone.length];
for(int i = 0; i < timezone.length; ++i) {
timezoneDesc[i] = getTimezoneDesc(timezone[i], "\n");
}
timezonePref.setEntries(timezoneDesc);
// NOTE: I'm not sure the reason but setDefaultValue() seems to have no effect here
if(getTimezone(this).equals("")) {
timezonePref.setValue(TimeZone.getDefault().getID());
}
updateSummary(null);
setResult(RESULT_OK);
}
@Override
protected void onResume() {
super.onResume();
getPreferenceScreen().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(this);
}
@Override
protected void onPause() {
super.onPause();
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{
updateSummary(key);
setResult(RESULT_FIRST_USER);
}
private void updateSummary(String key) {
String account_key = (String)getText(R.string.account_key);
String timezone_key = (String)getText(R.string.timezone_key);
if(key == null || key.equals(account_key)) {
Preference accountPref = getPreferenceScreen().findPreference(account_key);
accountPref.setSummary(getPreferenceScreen().getSharedPreferences().getString(account_key, ""));
}
if(key == null || key.equals(timezone_key)) {
Preference timezonePref = getPreferenceScreen().findPreference(timezone_key);
String id = getPreferenceScreen().getSharedPreferences().getString(timezone_key, "");
timezonePref.setSummary(getTimezoneDesc(id, " "));
}
}
static String getAccount(Context context) {
String key = (String)context.getText(R.string.account_key);
return PreferenceManager.getDefaultSharedPreferences(context).getString(key, "");
}
static String getTimezone(Context context) {
String key = (String)context.getText(R.string.timezone_key);
return PreferenceManager.getDefaultSharedPreferences(context).getString(key, "");
}
} | UTF-8 | Java | 4,384 | java | SettingsActivity.java | Java | [] | null | [] | package cx.myhome.yak.ghsc;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.TimeZone;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
private String getOffsetDesc(int offset)
{
int absOffset = Math.abs(offset);
String sign = offset >= 0 ? "+" : "-";
return String.format("GMT%s%d:%02d", sign, absOffset / 3600000, absOffset / 60000 % 60);
}
private String getTimezoneDesc(String timezoneID, String delimiter)
{
TimeZone tz = TimeZone.getTimeZone(timezoneID);
Date current = new Date();
int rawOffset = tz.getRawOffset();
if(tz.inDaylightTime(current)) {
return String.format("%s%s%s (DST)%s(ST: %s)", timezoneID, delimiter, getOffsetDesc(rawOffset + tz.getDSTSavings()), delimiter, getOffsetDesc(rawOffset));
} else {
return String.format("%s%s%s", timezoneID, delimiter, getOffsetDesc(rawOffset));
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
CharSequence timezone_key = getText(R.string.timezone_key);
ListPreference timezonePref = (ListPreference)getPreferenceScreen().findPreference(timezone_key);
String[] timezone = getResources().getStringArray(R.array.timezone_ids);
// Sort by effective offsets
TimeZone[] tz = new TimeZone[timezone.length];
for(int i = 0; i < timezone.length; ++i) {
tz[i] = TimeZone.getTimeZone(timezone[i]);
}
final Date d = new Date();
Arrays.sort(tz, new Comparator<TimeZone>() {
public int compare(TimeZone a, TimeZone b) {
long a_ = a.getOffset(d.getTime());
long b_ = b.getOffset(d.getTime());
return a_ < b_ ? -1 : a_ > b_ ? 1 : 0;
}
});
// Back to string array
for(int i = 0; i < timezone.length; ++i) {
timezone[i] = tz[i].getID();
}
timezonePref.setEntryValues(timezone);
String[] timezoneDesc = new String[timezone.length];
for(int i = 0; i < timezone.length; ++i) {
timezoneDesc[i] = getTimezoneDesc(timezone[i], "\n");
}
timezonePref.setEntries(timezoneDesc);
// NOTE: I'm not sure the reason but setDefaultValue() seems to have no effect here
if(getTimezone(this).equals("")) {
timezonePref.setValue(TimeZone.getDefault().getID());
}
updateSummary(null);
setResult(RESULT_OK);
}
@Override
protected void onResume() {
super.onResume();
getPreferenceScreen().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(this);
}
@Override
protected void onPause() {
super.onPause();
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{
updateSummary(key);
setResult(RESULT_FIRST_USER);
}
private void updateSummary(String key) {
String account_key = (String)getText(R.string.account_key);
String timezone_key = (String)getText(R.string.timezone_key);
if(key == null || key.equals(account_key)) {
Preference accountPref = getPreferenceScreen().findPreference(account_key);
accountPref.setSummary(getPreferenceScreen().getSharedPreferences().getString(account_key, ""));
}
if(key == null || key.equals(timezone_key)) {
Preference timezonePref = getPreferenceScreen().findPreference(timezone_key);
String id = getPreferenceScreen().getSharedPreferences().getString(timezone_key, "");
timezonePref.setSummary(getTimezoneDesc(id, " "));
}
}
static String getAccount(Context context) {
String key = (String)context.getText(R.string.account_key);
return PreferenceManager.getDefaultSharedPreferences(context).getString(key, "");
}
static String getTimezone(Context context) {
String key = (String)context.getText(R.string.timezone_key);
return PreferenceManager.getDefaultSharedPreferences(context).getString(key, "");
}
} | 4,384 | 0.712591 | 0.707345 | 119 | 34.857143 | 29.739 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.168067 | false | false | 9 |
9dc5735d7fa3114b1bb7f8841ad0b9d414f2618d | 9,947,144,293,101 | 582fb36e8cc9d405ecee183b38d5ba8ebf97dc8e | /ebase/src/main/java/com/dsdl/eidea/base/service/ChangelogService.java | fa4ec0bfb3c5a04e7cc4ae9f5282e4aa3507e00d | [] | no_license | ldlqdsdcn/eidea | https://github.com/ldlqdsdcn/eidea | 2dfd3db38f5d1c47388cc48a80e5f5795caf45fa | f48e7d61430956f5074c0d68f5d4052ebc40a5a1 | refs/heads/master | 2021-01-22T02:14:39.398000 | 2017-04-05T00:35:43 | 2017-04-05T00:35:43 | 81,036,209 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dsdl.eidea.base.service;
import java.util.List;
import com.dsdl.eidea.base.entity.bo.ChangelogBo;
import com.dsdl.eidea.core.entity.bo.TableColumnBo;
import com.dsdl.eidea.core.entity.po.TableColumnPo;
import com.googlecode.genericdao.search.ISearch;
public interface ChangelogService {
List<ChangelogBo> getChangelogList(ISearch search);
ChangelogBo getChangelogBo(Integer id);
List<TableColumnBo> getChangelogHeader(String tableName);
}
| UTF-8 | Java | 457 | java | ChangelogService.java | Java | [] | null | [] | package com.dsdl.eidea.base.service;
import java.util.List;
import com.dsdl.eidea.base.entity.bo.ChangelogBo;
import com.dsdl.eidea.core.entity.bo.TableColumnBo;
import com.dsdl.eidea.core.entity.po.TableColumnPo;
import com.googlecode.genericdao.search.ISearch;
public interface ChangelogService {
List<ChangelogBo> getChangelogList(ISearch search);
ChangelogBo getChangelogBo(Integer id);
List<TableColumnBo> getChangelogHeader(String tableName);
}
| 457 | 0.822757 | 0.822757 | 14 | 31.642857 | 21.651814 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false | 9 |
8b60aa3ac76edd2d7a025a404ebc4cfd21e2e315 | 32,779,190,429,216 | e49734c1cf64efe06f3426ed332b05f7625f2992 | /Project_IMS_손진영/src/kr/or/kosta/ims/model/Woods.java | 16cae621cd4039499e26440dc5ca3247206640b4 | [] | no_license | moyaiori/Kosta100ExampleProject | https://github.com/moyaiori/Kosta100ExampleProject | 965fa5ecb4b42912991063a3dd70e64d27dacd32 | 384ff69478b88a00ba024158a91718714c813b6c | refs/heads/master | 2021-01-01T19:10:09.803000 | 2015-11-17T07:05:40 | 2015-11-17T07:05:40 | 39,556,522 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kr.or.kosta.ims.model;
/**
* 합판 종류는 정해져 있으므로 열거형으로 선택
* @author 손진영
*
* 작성일 : 2015-07-31
*/
public enum Woods {
ROSEWOOD, MAPLE, MAHOGANY, COCOBOLO, ALDER;
}
| UTF-8 | Java | 222 | java | Woods.java | Java | [
{
"context": ".model;\n/**\n * 합판 종류는 정해져 있으므로 열거형으로 선택\n * @author 손진영\n *\n * 작성일 : 2015-07-31\n */\npublic enum Woods {\n\tR",
"end": 77,
"score": 0.9994250535964966,
"start": 74,
"tag": "NAME",
"value": "손진영"
}
] | null | [] | package kr.or.kosta.ims.model;
/**
* 합판 종류는 정해져 있으므로 열거형으로 선택
* @author 손진영
*
* 작성일 : 2015-07-31
*/
public enum Woods {
ROSEWOOD, MAPLE, MAHOGANY, COCOBOLO, ALDER;
}
| 222 | 0.651163 | 0.604651 | 10 | 16.200001 | 13.717142 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 9 |
29a8b91e89f6d2d0c022970a26cae33bfc4c8195 | 2,619,930,074,904 | c96434acfb4fcaf00abd0135b7d84cef3beed004 | /app/src/main/java/com/pro/xtl1889/lifebang/ui/adapter/NewsHoemAdaper.java | 20dbbf24acc0e94541adbc71eb8769bb6a7d33c9 | [] | no_license | xtl1889/LifeBang | https://github.com/xtl1889/LifeBang | 6809ae0de89760db5956cd8a0c4c2d03b1fbee93 | c0555a174f26980d2187301b4ae607c07b27a3ca | refs/heads/master | 2020-07-07T08:52:59.533000 | 2017-01-24T09:59:48 | 2017-01-24T09:59:48 | 73,922,758 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pro.xtl1889.lifebang.ui.adapter;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.facebook.drawee.view.SimpleDraweeView;
import com.pro.xtl1889.lifebang.R;
import com.pro.xtl1889.lifebang.model.NewslistBean;
import com.pro.xtl1889.lifebang.ui.NewsDetailedActivity;
import com.pro.xtl1889.lifebang.ui.base.BaseRecyclerAdapter;
import com.pro.xtl1889.lifebang.util.LogUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by xtl1889 on 16-8-23.
*/
public class NewsHoemAdaper extends BaseRecyclerAdapter<NewslistBean> {
// private Context mContext;
public NewsHoemAdaper(Context context) {
super(context);
// this.mContext=context;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
RecyclerView.ViewHolder viewHolder=null;
viewHolder=new NewsViewHolder(LayoutInflater.from(mContext).inflate(R.layout.home_item, parent, false));
return viewHolder;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
final NewslistBean newslistBean=getItem(position);
NewsViewHolder viewHolder= (NewsViewHolder) holder;
LogUtils.LOGD("------------baidu-adapter--size" + getList());
if (!TextUtils.isEmpty(newslistBean.getTitle())){
viewHolder.tv_title.setText(newslistBean.getTitle());
}
if (!TextUtils.isEmpty(newslistBean.getCtime())){
viewHolder.tv_time.setText(newslistBean.getCtime());
}
if (!TextUtils.isEmpty(newslistBean.getPicUrl())){
viewHolder.iv.setImageURI(newslistBean.getPicUrl());
}
if (!TextUtils.isEmpty(newslistBean.getDescription())){
viewHolder.tv_from.setText("来自:"+newslistBean.getDescription());
}
viewHolder.news_item.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!TextUtils.isEmpty(newslistBean.getUrl())){
Intent intent=new Intent(mContext, NewsDetailedActivity.class);
intent.putExtra("newUrl",newslistBean.getUrl());
mContext.startActivity(intent);
}else {
Toast.makeText(mContext,"暂无数据",Toast.LENGTH_SHORT).show();
}
}
});
}
class NewsViewHolder extends RecyclerView.ViewHolder{
@BindView(R.id.news_item)
RelativeLayout news_item;
@BindView(R.id.news_item_iv)
SimpleDraweeView iv;
@BindView(R.id.news_item_title)
TextView tv_title;
@BindView(R.id.news_item_time)
TextView tv_time;
@BindView(R.id.news_item_from)
TextView tv_from;
public NewsViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
| UTF-8 | Java | 3,253 | java | NewsHoemAdaper.java | Java | [
{
"context": "import butterknife.ButterKnife;\n\n/**\n * Created by xtl1889 on 16-8-23.\n */\npublic class NewsHoemAdaper exten",
"end": 770,
"score": 0.9995818734169006,
"start": 763,
"tag": "USERNAME",
"value": "xtl1889"
}
] | null | [] | package com.pro.xtl1889.lifebang.ui.adapter;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.facebook.drawee.view.SimpleDraweeView;
import com.pro.xtl1889.lifebang.R;
import com.pro.xtl1889.lifebang.model.NewslistBean;
import com.pro.xtl1889.lifebang.ui.NewsDetailedActivity;
import com.pro.xtl1889.lifebang.ui.base.BaseRecyclerAdapter;
import com.pro.xtl1889.lifebang.util.LogUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by xtl1889 on 16-8-23.
*/
public class NewsHoemAdaper extends BaseRecyclerAdapter<NewslistBean> {
// private Context mContext;
public NewsHoemAdaper(Context context) {
super(context);
// this.mContext=context;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
RecyclerView.ViewHolder viewHolder=null;
viewHolder=new NewsViewHolder(LayoutInflater.from(mContext).inflate(R.layout.home_item, parent, false));
return viewHolder;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
final NewslistBean newslistBean=getItem(position);
NewsViewHolder viewHolder= (NewsViewHolder) holder;
LogUtils.LOGD("------------baidu-adapter--size" + getList());
if (!TextUtils.isEmpty(newslistBean.getTitle())){
viewHolder.tv_title.setText(newslistBean.getTitle());
}
if (!TextUtils.isEmpty(newslistBean.getCtime())){
viewHolder.tv_time.setText(newslistBean.getCtime());
}
if (!TextUtils.isEmpty(newslistBean.getPicUrl())){
viewHolder.iv.setImageURI(newslistBean.getPicUrl());
}
if (!TextUtils.isEmpty(newslistBean.getDescription())){
viewHolder.tv_from.setText("来自:"+newslistBean.getDescription());
}
viewHolder.news_item.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!TextUtils.isEmpty(newslistBean.getUrl())){
Intent intent=new Intent(mContext, NewsDetailedActivity.class);
intent.putExtra("newUrl",newslistBean.getUrl());
mContext.startActivity(intent);
}else {
Toast.makeText(mContext,"暂无数据",Toast.LENGTH_SHORT).show();
}
}
});
}
class NewsViewHolder extends RecyclerView.ViewHolder{
@BindView(R.id.news_item)
RelativeLayout news_item;
@BindView(R.id.news_item_iv)
SimpleDraweeView iv;
@BindView(R.id.news_item_title)
TextView tv_title;
@BindView(R.id.news_item_time)
TextView tv_time;
@BindView(R.id.news_item_from)
TextView tv_from;
public NewsViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
| 3,253 | 0.666564 | 0.656067 | 100 | 31.389999 | 25.96224 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.53 | false | false | 9 |
a67da285d6ce2ebcacc29bbf3c3693bc96f9714e | 7,138,235,677,289 | 132b9a90156b7b8c0e24e000c177abdb30a92869 | /src/sit/int675/demo/jdbc/Customer.java | 88f95a8185afc72cabf2d40a3a494ae8be9bfe22 | [] | no_license | mickeymix/java_675 | https://github.com/mickeymix/java_675 | 19e6ec6656fb54445c039e1e5aa8e83d33221674 | 0630b39907159ac40e1f52bf304ec193d944e644 | refs/heads/master | 2021-07-19T11:39:19.898000 | 2017-10-29T03:14:30 | 2017-10-29T03:14:30 | 106,989,468 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 sit.int675.demo.jdbc;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author INT675
*/
public class Customer extends CustomerDao {
private int customerId ;
private String discountCode ;
private String zip;
private String name ;
private String adddressLine1 ;
private String adddressLine2 ;
private String city ;
private String state ;
private String phone ;
private String fax ;
private String email ;
private int creditLimit ;
public Customer() {
}
Customer(ResultSet rs) throws SQLException {
this.customerId = rs.getInt("customer_id") ;
this.discountCode = rs.getString("discount_code") ;
this.zip = rs.getString("zip");
this.name = rs.getString("name");
this.adddressLine1 = rs.getString("addressline1");
this.adddressLine2 = rs.getString("addressline2");
this.city = rs.getString("city");
this.state = rs.getString("state");
this.phone = rs.getString("phone");
this.fax = rs.getString("fax");
this.email = rs.getString("email");
this.creditLimit = rs.getInt("credit_limit") ;
}
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public String getDiscountCode() {
return discountCode;
}
public void setDiscountCode(String discountCode) {
this.discountCode = discountCode;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAdddressLine1() {
return adddressLine1;
}
public void setAdddressLine1(String adddressLine1) {
this.adddressLine1 = adddressLine1;
}
public String getAdddressLine2() {
return adddressLine2;
}
public void setAdddressLine2(String adddressLine2) {
this.adddressLine2 = adddressLine2;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getCreditLimit() {
return creditLimit;
}
public void setCreditLimit(int creditLimit) {
this.creditLimit = creditLimit;
}
public boolean update() throws SQLException{
return update(this);
}
}
| UTF-8 | Java | 3,253 | java | Customer.java | Java | [
{
"context": ";\nimport java.sql.SQLException;\n\n/**\n *\n * @author INT675\n */\npublic class Customer extends CustomerDao {\n ",
"end": 298,
"score": 0.9994668960571289,
"start": 292,
"tag": "USERNAME",
"value": "INT675"
}
] | null | [] | /*
* 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 sit.int675.demo.jdbc;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author INT675
*/
public class Customer extends CustomerDao {
private int customerId ;
private String discountCode ;
private String zip;
private String name ;
private String adddressLine1 ;
private String adddressLine2 ;
private String city ;
private String state ;
private String phone ;
private String fax ;
private String email ;
private int creditLimit ;
public Customer() {
}
Customer(ResultSet rs) throws SQLException {
this.customerId = rs.getInt("customer_id") ;
this.discountCode = rs.getString("discount_code") ;
this.zip = rs.getString("zip");
this.name = rs.getString("name");
this.adddressLine1 = rs.getString("addressline1");
this.adddressLine2 = rs.getString("addressline2");
this.city = rs.getString("city");
this.state = rs.getString("state");
this.phone = rs.getString("phone");
this.fax = rs.getString("fax");
this.email = rs.getString("email");
this.creditLimit = rs.getInt("credit_limit") ;
}
public int getCustomerId() {
return customerId;
}
public void setCustomerId(int customerId) {
this.customerId = customerId;
}
public String getDiscountCode() {
return discountCode;
}
public void setDiscountCode(String discountCode) {
this.discountCode = discountCode;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAdddressLine1() {
return adddressLine1;
}
public void setAdddressLine1(String adddressLine1) {
this.adddressLine1 = adddressLine1;
}
public String getAdddressLine2() {
return adddressLine2;
}
public void setAdddressLine2(String adddressLine2) {
this.adddressLine2 = adddressLine2;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getCreditLimit() {
return creditLimit;
}
public void setCreditLimit(int creditLimit) {
this.creditLimit = creditLimit;
}
public boolean update() throws SQLException{
return update(this);
}
}
| 3,253 | 0.61205 | 0.604673 | 147 | 21.129251 | 18.376736 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37415 | false | false | 9 |
156e7cbe4fb52fa6459078148ab34aeea0c42f08 | 8,349,416,457,125 | b6854f5d0c8447052af5301bd9c0d0e4e2eaa5db | /pattern2/CircularShifter.java | ef77c28013fe70e1b60ae7404f05ca99750cfb18 | [] | no_license | java-wei/KWIC | https://github.com/java-wei/KWIC | b57ba8fb4f6baaaaf85336b1177d88d65b65106e | d649d2e7ab2fd94dac7b5b3384d9b04e9aee53e1 | refs/heads/master | 2020-04-25T13:32:03.194000 | 2015-09-03T15:10:22 | 2015-09-03T15:10:22 | 41,277,023 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pattern2;
import java.util.ArrayList;
/**
* @author Charles Cheng
*
*/
public class CircularShifter {
private Title titles;
public CircularShifter(Title object) {
titles = object;
}
public void addWordsToIgnore(String s) {
String[] arr = s.split(",");
int length = arr.length;
for (int i=0; i<length; i++) {
Lines.addWordsToIgnore(arr[i].trim().toLowerCase());
}
}
public void circularShift(int start, int end) {
ArrayList<String> shiftedLines = new ArrayList<String>();
for (int k = start; k < end; k++) {
String title = titles.getTitle(k);
String[] arr = capitalizeFirstCharacter(title.split(" "));
int length = arr.length;
for(int i=0; i<length; i++) {
String shiftedLine = "";
for(int j=0; j<length; j++) {
int index = (i+j)%length;
shiftedLine += arr[index] + " ";
}
shiftedLines.add(shiftedLine);
}
}
Lines.insert(shiftedLines);
Alphabetizer.sort();
}
// Capitalize first character of the keyword that is not an ignored word
private String[] capitalizeFirstCharacter(String[] arr) {
for (int i=0; i<arr.length; i++) {
String word = arr[i].replaceAll("\\s", "");
if(!word.equals("") && !word.equals(" ")) {
String firstCharacter = word.substring(0,1);
arr[i] = firstCharacter.toUpperCase() + word.substring(1);
}
}
return arr;
}
public void clearIgnoredWords() {
Lines.clearIgnoredWords();
}
public void clearLines() {
Lines.clearLines();
}
}
| UTF-8 | Java | 1,499 | java | CircularShifter.java | Java | [
{
"context": "ern2;\n\nimport java.util.ArrayList;\n\n/**\n * @author Charles Cheng\n *\n */\n\npublic class CircularShifter {\n\n\tprivate ",
"end": 76,
"score": 0.9996429681777954,
"start": 63,
"tag": "NAME",
"value": "Charles Cheng"
}
] | null | [] | package pattern2;
import java.util.ArrayList;
/**
* @author <NAME>
*
*/
public class CircularShifter {
private Title titles;
public CircularShifter(Title object) {
titles = object;
}
public void addWordsToIgnore(String s) {
String[] arr = s.split(",");
int length = arr.length;
for (int i=0; i<length; i++) {
Lines.addWordsToIgnore(arr[i].trim().toLowerCase());
}
}
public void circularShift(int start, int end) {
ArrayList<String> shiftedLines = new ArrayList<String>();
for (int k = start; k < end; k++) {
String title = titles.getTitle(k);
String[] arr = capitalizeFirstCharacter(title.split(" "));
int length = arr.length;
for(int i=0; i<length; i++) {
String shiftedLine = "";
for(int j=0; j<length; j++) {
int index = (i+j)%length;
shiftedLine += arr[index] + " ";
}
shiftedLines.add(shiftedLine);
}
}
Lines.insert(shiftedLines);
Alphabetizer.sort();
}
// Capitalize first character of the keyword that is not an ignored word
private String[] capitalizeFirstCharacter(String[] arr) {
for (int i=0; i<arr.length; i++) {
String word = arr[i].replaceAll("\\s", "");
if(!word.equals("") && !word.equals(" ")) {
String firstCharacter = word.substring(0,1);
arr[i] = firstCharacter.toUpperCase() + word.substring(1);
}
}
return arr;
}
public void clearIgnoredWords() {
Lines.clearIgnoredWords();
}
public void clearLines() {
Lines.clearLines();
}
}
| 1,492 | 0.628419 | 0.623082 | 71 | 20.112677 | 19.816446 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.253521 | false | false | 9 |
af617a724094b23ea7a9f184fb89d1f471ed5ea2 | 8,349,416,460,039 | 40953e543a4527117ba01450b588c38531cc105d | /src/test/java/concurrency/threadlocal/CounterTask.java | d328664de4b0bcc02be4e69b7e6065c55fb08fea | [] | no_license | Allen-Joe/springmvc-mybatis-test | https://github.com/Allen-Joe/springmvc-mybatis-test | 9c85a2ec3b6d36b50cdc761ddfad674dff528c1c | c326a78a7d70e211c5452932bd7b752c891e1e1e | refs/heads/master | 2020-04-05T12:38:52.816000 | 2017-07-04T09:07:16 | 2017-07-04T09:07:16 | 95,209,184 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package concurrency.threadlocal;
public class CounterTask implements Runnable{
private ThreadLocalDemo threadLocalDemo;
public CounterTask(ThreadLocalDemo threadLocalDemo){
this.threadLocalDemo=threadLocalDemo;
}
public void run() {
// TODO Auto-generated method stub
for (int i = 0; i < 3; i++) {
threadLocalDemo.count();
System.out.println(Thread.currentThread()+":"+threadLocalDemo.getSum());
}
System.out.println(Thread.currentThread()+" total->:"+threadLocalDemo.getSum());
}
}
| UTF-8 | Java | 511 | java | CounterTask.java | Java | [] | null | [] | package concurrency.threadlocal;
public class CounterTask implements Runnable{
private ThreadLocalDemo threadLocalDemo;
public CounterTask(ThreadLocalDemo threadLocalDemo){
this.threadLocalDemo=threadLocalDemo;
}
public void run() {
// TODO Auto-generated method stub
for (int i = 0; i < 3; i++) {
threadLocalDemo.count();
System.out.println(Thread.currentThread()+":"+threadLocalDemo.getSum());
}
System.out.println(Thread.currentThread()+" total->:"+threadLocalDemo.getSum());
}
}
| 511 | 0.733855 | 0.729941 | 20 | 24.549999 | 25.259602 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.55 | false | false | 9 |
fc7158a63afedaa13264f2b3fb3551181312d077 | 26,353,919,342,832 | cadbf628c4b6d3a8e09c89dd301da023a11cf317 | /src/main/java/com/yucheng/cmis/grt/agent/GrtLoanguarInfoAgent.java | d7334c5749fd873fdc2dd858166fa1b252b83371 | [] | no_license | zhizhongsan/cmis-main | https://github.com/zhizhongsan/cmis-main | dfaebf6c42734e9c214f5351253ccd6d18aa1b8a | dea5ca104b22df30d095d17fb4f54144a739f8ac | refs/heads/master | 2016-08-04T22:53:28.897000 | 2013-08-27T03:18:26 | 2013-08-27T03:18:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yucheng.cmis.grt.agent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import com.ecc.emp.core.EMPException;
import com.ecc.emp.data.IndexedCollection;
import com.ecc.emp.data.KeyedCollection;
import com.ecc.emp.dbmodel.service.TableModelDAO;
import com.yucheng.cmis.ctr.cont.domain.GrtGuarCont;
import com.yucheng.cmis.grt.dao.GrtLoanguarInfoDao;
import com.yucheng.cmis.grt.domain.GrtLoanguarInfo;
import com.yucheng.cmis.pub.CMISAgent;
import com.yucheng.cmis.pub.ComponentHelper;
import com.yucheng.cmis.pub.exception.AgentException;
import com.yucheng.cmis.pub.exception.ComponentException;
public class GrtLoanguarInfoAgent extends CMISAgent {
/**
* 根据担保方式与担保合同编号查找担保金额
* */
public BigDecimal getUsedAmtByGuarWayAndContNo(String contNo, String guarWay) throws ComponentException {
GrtLoanguarInfoDao glid = (GrtLoanguarInfoDao) this.getDaoInstance("GrtLoanguarInfo");
return glid.getUsedAmtByGuarWayAndContNo(contNo, guarWay,this.getConnection());
}
public List<GrtGuarCont> getAvailableGrtContListByContNo(String contNo,String endDate) throws ComponentException{
GrtLoanguarInfoDao glid = (GrtLoanguarInfoDao) this.getDaoInstance("GrtLoanguarInfo");
return glid.getAvailableGrtContListByContNo(contNo,endDate,this.getConnection());
}
public List<GrtLoanguarInfo> getGrtLoanguarInfoDomainListByCondi (String condi )throws ComponentException{
TableModelDAO tmd = this.getTableModelDAO();
List<GrtLoanguarInfo> list = new ArrayList<GrtLoanguarInfo>();
try {
IndexedCollection iColl = tmd.queryList("GrtLoanguarInfo", condi, this.getConnection());
ComponentHelper ch = new ComponentHelper();
for(int i=0;i<iColl.size();i++){
KeyedCollection kCollTemp = (KeyedCollection)iColl.get(i);
GrtLoanguarInfo gli = new GrtLoanguarInfo();
gli = (GrtLoanguarInfo)ch.kcolTOdomain(gli, kCollTemp);
list.add(gli);
}
} catch (Exception e) {
throw new ComponentException(e);
}
return list;
}
public int updateGrtLoanguarInfoDomain(GrtLoanguarInfo gli)throws ComponentException {
return super.modifyCMISDomain(gli, "GrtLoanguarInfo");
}
/**
* 通过serno查询GRT_LOANGUAR_INFO信息
* @param serno
* @return
* @throws ComponentException
* @throws EMPException
*/
public IndexedCollection queryGrtLoanguarInfoBySerno(String serno)throws AgentException, EMPException{
TableModelDAO dao = this.getTableModelDAO();
return dao.queryList("GrtLoanguarInfo", " where serno='"+serno+"'", this.getConnection());
}
/**
* 通过kcoll添加GRT_LOANGUAR_INFO信息
* @param kcoll
* @return
* @throws AgentException
* @throws EMPException
*/
public int insertGrtLoanguarInfoByKcoll(KeyedCollection kcoll)throws AgentException, EMPException{
TableModelDAO dao = this.getTableModelDAO();
return dao.insert(kcoll, this.getConnection());
}
}
| UTF-8 | Java | 2,983 | java | GrtLoanguarInfoAgent.java | Java | [] | null | [] | package com.yucheng.cmis.grt.agent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import com.ecc.emp.core.EMPException;
import com.ecc.emp.data.IndexedCollection;
import com.ecc.emp.data.KeyedCollection;
import com.ecc.emp.dbmodel.service.TableModelDAO;
import com.yucheng.cmis.ctr.cont.domain.GrtGuarCont;
import com.yucheng.cmis.grt.dao.GrtLoanguarInfoDao;
import com.yucheng.cmis.grt.domain.GrtLoanguarInfo;
import com.yucheng.cmis.pub.CMISAgent;
import com.yucheng.cmis.pub.ComponentHelper;
import com.yucheng.cmis.pub.exception.AgentException;
import com.yucheng.cmis.pub.exception.ComponentException;
public class GrtLoanguarInfoAgent extends CMISAgent {
/**
* 根据担保方式与担保合同编号查找担保金额
* */
public BigDecimal getUsedAmtByGuarWayAndContNo(String contNo, String guarWay) throws ComponentException {
GrtLoanguarInfoDao glid = (GrtLoanguarInfoDao) this.getDaoInstance("GrtLoanguarInfo");
return glid.getUsedAmtByGuarWayAndContNo(contNo, guarWay,this.getConnection());
}
public List<GrtGuarCont> getAvailableGrtContListByContNo(String contNo,String endDate) throws ComponentException{
GrtLoanguarInfoDao glid = (GrtLoanguarInfoDao) this.getDaoInstance("GrtLoanguarInfo");
return glid.getAvailableGrtContListByContNo(contNo,endDate,this.getConnection());
}
public List<GrtLoanguarInfo> getGrtLoanguarInfoDomainListByCondi (String condi )throws ComponentException{
TableModelDAO tmd = this.getTableModelDAO();
List<GrtLoanguarInfo> list = new ArrayList<GrtLoanguarInfo>();
try {
IndexedCollection iColl = tmd.queryList("GrtLoanguarInfo", condi, this.getConnection());
ComponentHelper ch = new ComponentHelper();
for(int i=0;i<iColl.size();i++){
KeyedCollection kCollTemp = (KeyedCollection)iColl.get(i);
GrtLoanguarInfo gli = new GrtLoanguarInfo();
gli = (GrtLoanguarInfo)ch.kcolTOdomain(gli, kCollTemp);
list.add(gli);
}
} catch (Exception e) {
throw new ComponentException(e);
}
return list;
}
public int updateGrtLoanguarInfoDomain(GrtLoanguarInfo gli)throws ComponentException {
return super.modifyCMISDomain(gli, "GrtLoanguarInfo");
}
/**
* 通过serno查询GRT_LOANGUAR_INFO信息
* @param serno
* @return
* @throws ComponentException
* @throws EMPException
*/
public IndexedCollection queryGrtLoanguarInfoBySerno(String serno)throws AgentException, EMPException{
TableModelDAO dao = this.getTableModelDAO();
return dao.queryList("GrtLoanguarInfo", " where serno='"+serno+"'", this.getConnection());
}
/**
* 通过kcoll添加GRT_LOANGUAR_INFO信息
* @param kcoll
* @return
* @throws AgentException
* @throws EMPException
*/
public int insertGrtLoanguarInfoByKcoll(KeyedCollection kcoll)throws AgentException, EMPException{
TableModelDAO dao = this.getTableModelDAO();
return dao.insert(kcoll, this.getConnection());
}
}
| 2,983 | 0.760698 | 0.760356 | 78 | 35.448719 | 31.911596 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.807692 | false | false | 9 |
0af98f3bc6d47f72ddfe9bb9e0012a305e9a2163 | 29,892,972,380,266 | a1ff0766974959c23198b71725ed0f60c569a42a | /excel/src/main/java/com/king/function/excel/Excel/BaseProcess/BaseWriteXLSXExcel.java | 9715ce35a3565ec1ee624e03b4271ad4b8e3f200 | [] | no_license | king6849/functions | https://github.com/king6849/functions | a23e8ff5849f50985d076df723d92c02bbe081e1 | c377fb15a102da6afc81e6ced3c78aa2073c9112 | refs/heads/master | 2023-04-17T17:52:01.578000 | 2021-05-06T10:07:59 | 2021-05-06T10:07:59 | 359,175,524 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.king.function.excel.Excel.BaseProcess;
import com.king.function.excel.Utils.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
public abstract class BaseWriteXLSXExcel {
// 显示的导出表的标题
private String title;
// 导出表的列名
private List<String> rowName;
private List<Object[]> dataList = new ArrayList<>();
private final ExcelUtil excelUtil = new ExcelUtil();
protected PathUtil pathUtil = SpringUtil.getBean(PathUtil.class);
public BaseWriteXLSXExcel() {
}
// 构造函数,传入要导出的数据
public BaseWriteXLSXExcel(String title, List<String> rowName, List<Object[]> dataList) {
this.dataList = dataList;
this.rowName = rowName;
this.title = title;
}
// 导出数据
private void export(OutputStream out, boolean header) {
try {
XSSFWorkbook workbook = new XSSFWorkbook();
//工作页名
if (title == null) {
title = "工作表一";
}
XSSFSheet sheet = workbook.createSheet(title);
//sheet样式定义 列头样式
XSSFCellStyle columnTopStyle = this.getColumnTopStyle(workbook);
//单元格样式
XSSFCellStyle style = this.getStyle(workbook);
int columnIndex = 0;
if (header) {
//设置表头
columnIndex = 2;
putExcelHeader(sheet, columnTopStyle);
}
// 定义所需列数
int columnNum = rowName.size();
// 将列头设置到sheet的单元格中
putColumnHeader(sheet, columnTopStyle, columnIndex, columnNum);
// 将查询到的数据设置到sheet对应的单元格中
putColumnData(sheet, style, columnIndex);
// 让列宽随着导出的列长自动适应
columnAutomaticWidth(sheet, columnNum);
//写出工作Excel表
workbook.write(out);
} catch (Exception e) {
e.printStackTrace();
}
}
/***
* @description: 设置Excel表头
*/
protected void putExcelHeader(XSSFSheet sheet, XSSFCellStyle columnTopStyle) {
//合并几个单元格形成表抬头
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, (rowName.size() - 1)));
// 产生表格标题行
XSSFRow header = sheet.createRow(0);
XSSFCell cellTitle = header.createCell(0);
cellTitle.setCellStyle(columnTopStyle);
cellTitle.setCellValue(title);
}
/***
* @description: 设置列头
*/
protected void putColumnHeader(XSSFSheet sheet, XSSFCellStyle columnTopStyle, int columnNameIndex, int columnNum) {
XSSFRow rowRowName = sheet.createRow(columnNameIndex);
// 将列头设置到sheet的单元格中
for (int n = 0; n < columnNum; n++) {
XSSFCell cellRowName = rowRowName.createCell(n);
cellRowName.setCellType(HSSFCell.CELL_TYPE_STRING);
XSSFRichTextString text = new XSSFRichTextString(rowName.get(n));
cellRowName.setCellValue(text);
cellRowName.setCellStyle(columnTopStyle);
}
}
/***
* @description: 填充数据
*/
protected void putColumnData(XSSFSheet sheet, XSSFCellStyle style, int startIndex) {
// 将查询到的数据设置到sheet对应的单元格中
int dataSize = dataList.size();
for (int i = 0; i < dataSize; i++) {
// 遍历每列
Object[] columnValues = dataList.get(i);
// 创建所需的行数
XSSFRow row = sheet.createRow(i + startIndex + 1);
int colSize = columnValues.length;
for (int j = 0; j < colSize; j++) {
XSSFCell cell = row.createCell(j, XSSFCell.CELL_TYPE_STRING);
if (!"".equals(columnValues[j]) && columnValues[j] != null) {
cell.setCellValue(columnValues[j].toString());
}
cell.setCellStyle(style);
}
}
}
/***
* @description: 列宽自动宽度
*/
protected void columnAutomaticWidth(XSSFSheet sheet, int columnNum) {
//遍历每一列
for (int colNum = 0; colNum < columnNum; colNum++) {
//默认宽度
int columnWidth = sheet.getColumnWidth(colNum) / 256;
//数据行数
int lastRowNum = sheet.getLastRowNum();
//遍历该列的每一行,取宽度最大值
for (int rowNum = 0; rowNum < lastRowNum; rowNum++) {
XSSFRow currentRow = null;
if (sheet.getRow(rowNum) == null) {
currentRow = sheet.createRow(rowNum);
} else {
currentRow = sheet.getRow(rowNum);
}
if (currentRow.getCell(colNum) != null) {
XSSFCell currentCell = currentRow.getCell(colNum);
if (currentCell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
int length = currentCell.getStringCellValue().getBytes().length;
if (columnWidth < length) {
columnWidth = length;
}
}
}
}
if (colNum == 0) {
sheet.setColumnWidth(colNum, (columnWidth - 2) * 256);
} else {
sheet.setColumnWidth(colNum, (columnWidth + 4) * 256);
}
}
}
/**
* 列头单元格样式
*
* @param workbook 工作簿
* @return 样式表
*/
protected XSSFCellStyle getColumnTopStyle(XSSFWorkbook workbook) {
// 设置字体
XSSFFont font = workbook.createFont();
// 设置字体大小
font.setFontHeightInPoints((short) 11);
// 字体加粗
font.setBold(true);
// 设置字体名字
font.setFontName("Courier New");
// 设置样式
XSSFCellStyle style = workbook.createCellStyle();
// 设置低边框
// style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
// 设置低边框颜色
style.setBottomBorderColor(HSSFColor.BLACK.index);
// 设置右边框
// style.setBorderRight(HSSFCellStyle.BORDER_THIN);
// 设置顶边框
style.setTopBorderColor(HSSFColor.BLACK.index);
// 设置顶边框颜色
style.setTopBorderColor(HSSFColor.BLACK.index);
// 在样式中应用设置的字体
style.setFont(font);
// 设置自动换行
style.setWrapText(false);
// 设置水平对齐的样式为居中对齐;
// style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
return style;
}
/**
* 单元格样式
*
* @param workbook 工作簿
* @return 样式表
*/
protected XSSFCellStyle getStyle(XSSFWorkbook workbook) {
// 设置字体
XSSFFont font = workbook.createFont();
// 设置字体大小
font.setFontHeightInPoints((short) 10);
// 字体加粗
// font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
// 设置字体名字
font.setFontName("Courier New");
// 设置样式;
XSSFCellStyle style = workbook.createCellStyle();
// 设置底边框;
// style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
// 设置底边框颜色;
style.setBottomBorderColor(HSSFColor.BLACK.index);
// 设置左边框;
// style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
// 设置左边框颜色;
style.setLeftBorderColor(HSSFColor.BLACK.index);
// 设置右边框;
// style.setBorderRight(HSSFCellStyle.BORDER_THIN);
// 设置右边框颜色;
style.setRightBorderColor(HSSFColor.BLACK.index);
// 设置顶边框;
// style.setBorderTop(HSSFCellStyle.BORDER_THIN);
// 设置顶边框颜色;
style.setTopBorderColor(HSSFColor.BLACK.index);
// 在样式用应用设置的字体;
style.setFont(font);
// 设置自动换行;
style.setWrapText(false);
// 设置水平对齐的样式为居中对齐;
// style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 设置垂直对齐的样式为居中对齐;
// style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
return style;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<String> getRowName() {
return rowName;
}
public void setRowName(List<String> rowName) {
this.rowName = rowName;
}
public List<Object[]> getDataList() {
return dataList;
}
public void setDataList(List<Object[]> dataList) {
this.dataList = dataList;
}
public ExcelUtil getExcelUtil() {
return excelUtil;
}
/**
* 导出Excel
*
* @param filePath 存储路径
* @param outputStream 输出流
*/
public void exportExcelFile(String filePath, OutputStream outputStream, boolean header) throws Exception {
if (ObjectUtils.isNullStringObj(filePath)) {
filePath = pathUtil.getBase_export_path() + "\\" + excelUtil.randomFileName() + "." + BaseSaveFile.xlsx;
}
if (outputStream == null) {
export(new FileOutputStream(CreateFileUtil.createFile(filePath)), header);
} else {
export(outputStream, header);
}
}
/**
* @param filePath 存储路径
* @param header 是否需要写入Excel标题,抬头
*/
public void exportExcelFile(String filePath, boolean header) throws Exception {
exportExcelFile(filePath, null, header);
}
} | UTF-8 | Java | 10,227 | java | BaseWriteXLSXExcel.java | Java | [] | null | [] | package com.king.function.excel.Excel.BaseProcess;
import com.king.function.excel.Utils.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
public abstract class BaseWriteXLSXExcel {
// 显示的导出表的标题
private String title;
// 导出表的列名
private List<String> rowName;
private List<Object[]> dataList = new ArrayList<>();
private final ExcelUtil excelUtil = new ExcelUtil();
protected PathUtil pathUtil = SpringUtil.getBean(PathUtil.class);
public BaseWriteXLSXExcel() {
}
// 构造函数,传入要导出的数据
public BaseWriteXLSXExcel(String title, List<String> rowName, List<Object[]> dataList) {
this.dataList = dataList;
this.rowName = rowName;
this.title = title;
}
// 导出数据
private void export(OutputStream out, boolean header) {
try {
XSSFWorkbook workbook = new XSSFWorkbook();
//工作页名
if (title == null) {
title = "工作表一";
}
XSSFSheet sheet = workbook.createSheet(title);
//sheet样式定义 列头样式
XSSFCellStyle columnTopStyle = this.getColumnTopStyle(workbook);
//单元格样式
XSSFCellStyle style = this.getStyle(workbook);
int columnIndex = 0;
if (header) {
//设置表头
columnIndex = 2;
putExcelHeader(sheet, columnTopStyle);
}
// 定义所需列数
int columnNum = rowName.size();
// 将列头设置到sheet的单元格中
putColumnHeader(sheet, columnTopStyle, columnIndex, columnNum);
// 将查询到的数据设置到sheet对应的单元格中
putColumnData(sheet, style, columnIndex);
// 让列宽随着导出的列长自动适应
columnAutomaticWidth(sheet, columnNum);
//写出工作Excel表
workbook.write(out);
} catch (Exception e) {
e.printStackTrace();
}
}
/***
* @description: 设置Excel表头
*/
protected void putExcelHeader(XSSFSheet sheet, XSSFCellStyle columnTopStyle) {
//合并几个单元格形成表抬头
sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, (rowName.size() - 1)));
// 产生表格标题行
XSSFRow header = sheet.createRow(0);
XSSFCell cellTitle = header.createCell(0);
cellTitle.setCellStyle(columnTopStyle);
cellTitle.setCellValue(title);
}
/***
* @description: 设置列头
*/
protected void putColumnHeader(XSSFSheet sheet, XSSFCellStyle columnTopStyle, int columnNameIndex, int columnNum) {
XSSFRow rowRowName = sheet.createRow(columnNameIndex);
// 将列头设置到sheet的单元格中
for (int n = 0; n < columnNum; n++) {
XSSFCell cellRowName = rowRowName.createCell(n);
cellRowName.setCellType(HSSFCell.CELL_TYPE_STRING);
XSSFRichTextString text = new XSSFRichTextString(rowName.get(n));
cellRowName.setCellValue(text);
cellRowName.setCellStyle(columnTopStyle);
}
}
/***
* @description: 填充数据
*/
protected void putColumnData(XSSFSheet sheet, XSSFCellStyle style, int startIndex) {
// 将查询到的数据设置到sheet对应的单元格中
int dataSize = dataList.size();
for (int i = 0; i < dataSize; i++) {
// 遍历每列
Object[] columnValues = dataList.get(i);
// 创建所需的行数
XSSFRow row = sheet.createRow(i + startIndex + 1);
int colSize = columnValues.length;
for (int j = 0; j < colSize; j++) {
XSSFCell cell = row.createCell(j, XSSFCell.CELL_TYPE_STRING);
if (!"".equals(columnValues[j]) && columnValues[j] != null) {
cell.setCellValue(columnValues[j].toString());
}
cell.setCellStyle(style);
}
}
}
/***
* @description: 列宽自动宽度
*/
protected void columnAutomaticWidth(XSSFSheet sheet, int columnNum) {
//遍历每一列
for (int colNum = 0; colNum < columnNum; colNum++) {
//默认宽度
int columnWidth = sheet.getColumnWidth(colNum) / 256;
//数据行数
int lastRowNum = sheet.getLastRowNum();
//遍历该列的每一行,取宽度最大值
for (int rowNum = 0; rowNum < lastRowNum; rowNum++) {
XSSFRow currentRow = null;
if (sheet.getRow(rowNum) == null) {
currentRow = sheet.createRow(rowNum);
} else {
currentRow = sheet.getRow(rowNum);
}
if (currentRow.getCell(colNum) != null) {
XSSFCell currentCell = currentRow.getCell(colNum);
if (currentCell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
int length = currentCell.getStringCellValue().getBytes().length;
if (columnWidth < length) {
columnWidth = length;
}
}
}
}
if (colNum == 0) {
sheet.setColumnWidth(colNum, (columnWidth - 2) * 256);
} else {
sheet.setColumnWidth(colNum, (columnWidth + 4) * 256);
}
}
}
/**
* 列头单元格样式
*
* @param workbook 工作簿
* @return 样式表
*/
protected XSSFCellStyle getColumnTopStyle(XSSFWorkbook workbook) {
// 设置字体
XSSFFont font = workbook.createFont();
// 设置字体大小
font.setFontHeightInPoints((short) 11);
// 字体加粗
font.setBold(true);
// 设置字体名字
font.setFontName("Courier New");
// 设置样式
XSSFCellStyle style = workbook.createCellStyle();
// 设置低边框
// style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
// 设置低边框颜色
style.setBottomBorderColor(HSSFColor.BLACK.index);
// 设置右边框
// style.setBorderRight(HSSFCellStyle.BORDER_THIN);
// 设置顶边框
style.setTopBorderColor(HSSFColor.BLACK.index);
// 设置顶边框颜色
style.setTopBorderColor(HSSFColor.BLACK.index);
// 在样式中应用设置的字体
style.setFont(font);
// 设置自动换行
style.setWrapText(false);
// 设置水平对齐的样式为居中对齐;
// style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
return style;
}
/**
* 单元格样式
*
* @param workbook 工作簿
* @return 样式表
*/
protected XSSFCellStyle getStyle(XSSFWorkbook workbook) {
// 设置字体
XSSFFont font = workbook.createFont();
// 设置字体大小
font.setFontHeightInPoints((short) 10);
// 字体加粗
// font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
// 设置字体名字
font.setFontName("Courier New");
// 设置样式;
XSSFCellStyle style = workbook.createCellStyle();
// 设置底边框;
// style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
// 设置底边框颜色;
style.setBottomBorderColor(HSSFColor.BLACK.index);
// 设置左边框;
// style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
// 设置左边框颜色;
style.setLeftBorderColor(HSSFColor.BLACK.index);
// 设置右边框;
// style.setBorderRight(HSSFCellStyle.BORDER_THIN);
// 设置右边框颜色;
style.setRightBorderColor(HSSFColor.BLACK.index);
// 设置顶边框;
// style.setBorderTop(HSSFCellStyle.BORDER_THIN);
// 设置顶边框颜色;
style.setTopBorderColor(HSSFColor.BLACK.index);
// 在样式用应用设置的字体;
style.setFont(font);
// 设置自动换行;
style.setWrapText(false);
// 设置水平对齐的样式为居中对齐;
// style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 设置垂直对齐的样式为居中对齐;
// style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
return style;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<String> getRowName() {
return rowName;
}
public void setRowName(List<String> rowName) {
this.rowName = rowName;
}
public List<Object[]> getDataList() {
return dataList;
}
public void setDataList(List<Object[]> dataList) {
this.dataList = dataList;
}
public ExcelUtil getExcelUtil() {
return excelUtil;
}
/**
* 导出Excel
*
* @param filePath 存储路径
* @param outputStream 输出流
*/
public void exportExcelFile(String filePath, OutputStream outputStream, boolean header) throws Exception {
if (ObjectUtils.isNullStringObj(filePath)) {
filePath = pathUtil.getBase_export_path() + "\\" + excelUtil.randomFileName() + "." + BaseSaveFile.xlsx;
}
if (outputStream == null) {
export(new FileOutputStream(CreateFileUtil.createFile(filePath)), header);
} else {
export(outputStream, header);
}
}
/**
* @param filePath 存储路径
* @param header 是否需要写入Excel标题,抬头
*/
public void exportExcelFile(String filePath, boolean header) throws Exception {
exportExcelFile(filePath, null, header);
}
} | 10,227 | 0.575438 | 0.572212 | 289 | 31.179932 | 24.116259 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.543253 | false | false | 9 |
b275e9c92c4f7923ac4a865379bf82e1f2e37a23 | 22,488,448,780,750 | 0e374558b6a5d9416f671bad9d1050b966a3c3ab | /app/src/main/java/com/pictoslide/www/fragments/AlbumsFragment.java | c0824b756a2fff8b14495b21c8ef6d2157217138 | [] | no_license | OkeBenoitHub/pictoslide-photo-album | https://github.com/OkeBenoitHub/pictoslide-photo-album | b8bf09c85a3d3b0a0a75bc76fe7cdc9c667a8f7e | a69b0ad4c2308df042fb6048e7709794fc81286f | refs/heads/master | 2023-03-06T19:23:53.031000 | 2021-02-20T04:11:56 | 2021-02-20T04:11:56 | 340,131,143 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pictoslide.www.fragments;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.navigation.fragment.NavHostFragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.firebase.dynamiclinks.DynamicLink;
import com.google.firebase.dynamiclinks.FirebaseDynamicLinks;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QuerySnapshot;
import com.pictoslide.www.BuildConfig;
import com.pictoslide.www.R;
import com.pictoslide.www.activities.AlbumActivity;
import com.pictoslide.www.activities.AlbumViewerActivity;
import com.pictoslide.www.adapters.AlbumLibAdapter;
import com.pictoslide.www.models.Album;
import com.pictoslide.www.utils.AppConstUtils;
import com.pictoslide.www.utils.MainUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import static com.pictoslide.www.activities.AlbumActivity.ALBUM_ID_EXTRA;
import static com.pictoslide.www.activities.AlbumActivity.MUSIC_DATA_LIST_PREFS;
import static com.pictoslide.www.activities.AlbumActivity.PHOTO_ITEMS_LIST_PREFS;
import static com.pictoslide.www.activities.AlbumViewerActivity.ALBUM_SUB_OWNERS_ID_EXTRA;
import static com.pictoslide.www.activities.AlbumViewerActivity.OWNER_ALBUM_ID_EXTRA;
import static com.pictoslide.www.activities.MainActivity.IS_NEW_ALBUM_EXTRA;
import static com.pictoslide.www.activities.MainActivity.MADE_CHANGES_ALBUM_LIBRARY;
public class AlbumsFragment extends Fragment implements AlbumLibAdapter.ListItemClickListener {
private MainUtil mMainUtil;
private FirebaseFirestore mFirebaseFirestore;
private ArrayList<Album> mAlbumItems;
private ArrayList<Album> mSearchAlbumsResults;
private AlbumLibAdapter mAlbumLibAdapter;
private AlbumLibAdapter mAlbumLibAdapterByCategory;
private RecyclerView albums_lib_recycler_list;
private RecyclerView albums_lib_recycler_list_by_category;
private String mCurrentUserId;
private ProgressBar mProgressBar;
private TextView mErrorMessage;
private String mAlbumNameSearchValue;
private ArrayList<Album> mAlbumItemsByCategory;
private TextView no_albums_found_by_category;
/**
* Swipe callback on recyclerview albums items
*/
private final ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {
//Remove swiped item from list and notify the RecyclerView
int position = viewHolder.getAdapterPosition();
mAlbumLibAdapter.removeAlbumFromLibraryByPosition(position, shouldRemoveAlbumFromLibrary -> {
mAlbumItems.remove(position);
mAlbumLibAdapter.swapAlbums(mAlbumItems);
if (!shouldRemoveAlbumFromLibrary) {
NavHostFragment.findNavController(AlbumsFragment.this).navigateUp();
mMainUtil.writeDataBooleanToSharedPreferences(MADE_CHANGES_ALBUM_LIBRARY,true);
}
});
}
};
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMainUtil = new MainUtil(requireContext());
mFirebaseFirestore = FirebaseFirestore.getInstance();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_albums, container, false);
mCurrentUserId = mMainUtil.getUniqueID(requireContext());
albums_lib_recycler_list = rootView.findViewById(R.id.my_albums_recycler_list);
albums_lib_recycler_list_by_category = rootView.findViewById(R.id.my_albums_category_recycler_list);
// Set the layout for the RecyclerView to be a linear layout, which measures and
// positions items within a RecyclerView into a linear list
albums_lib_recycler_list.setLayoutManager(new LinearLayoutManager(requireContext()));
albums_lib_recycler_list_by_category.setLayoutManager(new LinearLayoutManager(requireContext()));
mAlbumItems = new ArrayList<>();
mAlbumItemsByCategory = new ArrayList<>();
// Initialize the adapter and attach it to the RecyclerView
mAlbumLibAdapter = new AlbumLibAdapter(requireContext(), mAlbumItems, this);
albums_lib_recycler_list.setAdapter(mAlbumLibAdapter);
// attach swipe to delete to recyclerview of albums
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback);
itemTouchHelper.attachToRecyclerView(albums_lib_recycler_list);
mAlbumLibAdapterByCategory = new AlbumLibAdapter(requireContext(),mAlbumItemsByCategory, this);
albums_lib_recycler_list_by_category.setAdapter(mAlbumLibAdapterByCategory);
DividerItemDecoration decoration = new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL);
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(requireContext(), R.drawable.divider)));
albums_lib_recycler_list.addItemDecoration(decoration);
albums_lib_recycler_list_by_category.addItemDecoration(decoration);
mProgressBar = rootView.findViewById(R.id.loader_bar);
mErrorMessage = rootView.findViewById(R.id.error_found_tv);
no_albums_found_by_category = rootView.findViewById(R.id.no_albums_by_category_found_tv);
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
mProgressBar.setVisibility(View.VISIBLE);
loadAlbumsDataFromDb();
return rootView;
}
private void loadAlbumsDataFromDb() {
mFirebaseFirestore.collection(AppConstUtils.ALBUMS_COLLECTION_NAME)
.orderBy("createdAtTime", Query.Direction.DESCENDING)
.addSnapshotListener((snapshot, e) -> {
if (e != null) {
return;
}
getQuerySnapshotAlbumsData(snapshot);
});
}
private void getQuerySnapshotAlbumsData(QuerySnapshot snapshot) {
if (snapshot != null) {
//Log.d(TAG, "Current data: " + snapshot.getData());
if (!snapshot.isEmpty()) {
mAlbumItems.clear();
for (DocumentSnapshot document : snapshot.getDocuments()) {
Album albumItem = document.toObject(Album.class);
List<String> albumSubOwnersId = null;
if (albumItem != null) {
albumSubOwnersId = albumItem.getSubOwnersId();
}
boolean isUserAlbumSubOwner = false;
if (albumSubOwnersId != null && albumSubOwnersId.contains(mCurrentUserId)) {
isUserAlbumSubOwner = true;
}
if (albumItem != null && (albumItem.getOwnerId().equals(mCurrentUserId) || isUserAlbumSubOwner)) {
mAlbumItems.add(albumItem);
}
}
if (!mAlbumItems.isEmpty()) {
mAlbumLibAdapter.swapAlbums(mAlbumItems);
showAlbumsData();
} else {
// no albums found
showErrorMessage(getString(R.string.no_album_found_label_text));
}
} else {
// no data found
showErrorMessage(getString(R.string.no_album_found_label_text));
}
} else {
// no data found
showErrorMessage(getString(R.string.no_album_found_label_text));
}
}
private void showAlbumsData() {
albums_lib_recycler_list.setVisibility(View.VISIBLE);
mErrorMessage.setVisibility(View.INVISIBLE);
mProgressBar.setVisibility(View.INVISIBLE);
}
private void showErrorMessage(String errorMessage) {
albums_lib_recycler_list.setVisibility(View.INVISIBLE);
mErrorMessage.setVisibility(View.VISIBLE);
mErrorMessage.setText(errorMessage);
mProgressBar.setVisibility(View.INVISIBLE);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// newAlbumFabButton tapped
view.findViewById(R.id.new_album_fab_button).setOnClickListener(view1 -> {
Intent intent = new Intent(getContext(), AlbumActivity.class);
intent.putExtra(IS_NEW_ALBUM_EXTRA, true);
startActivity(intent);
});
// sortAlbumsByButton tapped
view.findViewById(R.id.sortAlbumsByButton).setOnClickListener(view12 -> showSortAlbumsByCategoriesBox(view));
// search albums button tapped
view.findViewById(R.id.searchAlbumsButton).setOnClickListener(view15 -> showSearchAlbumsBoxLayout(view));
/*
* Search for albums by name
*/
EditText search_album_name_edit_text = view.findViewById(R.id.album_name_search_edt);
RecyclerView searchAlbumsRecyclerView = view.findViewById(R.id.albums_recycler_list_search_results);
// Set the layout for the RecyclerView to be a linear layout, which measures and
// positions items within a RecyclerView into a linear list
searchAlbumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
mSearchAlbumsResults = new ArrayList<>();
// Initialize the adapter and attach it to the RecyclerView
mAlbumLibAdapter = new AlbumLibAdapter(requireContext(),mSearchAlbumsResults,this);
searchAlbumsRecyclerView.setAdapter(mAlbumLibAdapter);
DividerItemDecoration decoration = new DividerItemDecoration(requireContext(),DividerItemDecoration.VERTICAL);
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(requireContext(), R.drawable.divider)));
searchAlbumsRecyclerView.addItemDecoration(decoration);
TextView noAlbumsFoundTv = view.findViewById(R.id.error_found_tv_2);
search_album_name_edit_text.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void afterTextChanged(Editable editable) {
mAlbumNameSearchValue = editable.toString().toLowerCase().trim();
if (!mAlbumNameSearchValue.isEmpty()) {
if (!mAlbumItems.isEmpty()) {
// do some search
int albumsFound = 0;
mSearchAlbumsResults.clear();
for (int i = 0; i < mAlbumItems.size(); i++) {
if (mAlbumItems.get(i).getName().toLowerCase().contains(mAlbumNameSearchValue)) {
albumsFound++;
mSearchAlbumsResults.add(mAlbumItems.get(i));
}
}
if (albumsFound > 0) {
searchAlbumsRecyclerView.setVisibility(View.VISIBLE);
noAlbumsFoundTv.setVisibility(View.GONE);
mAlbumLibAdapter.swapAlbums(mSearchAlbumsResults);
} else {
// no results
searchAlbumsRecyclerView.setVisibility(View.INVISIBLE);
noAlbumsFoundTv.setText(R.string.no_search_albums_found_tv);
noAlbumsFoundTv.setVisibility(View.VISIBLE);
}
} else {
// no results
searchAlbumsRecyclerView.setVisibility(View.INVISIBLE);
noAlbumsFoundTv.setText(R.string.no_search_albums_found_tv);
noAlbumsFoundTv.setVisibility(View.VISIBLE);
}
} else {
// no results
searchAlbumsRecyclerView.setVisibility(View.INVISIBLE);
noAlbumsFoundTv.setText(R.string.find_album_by_name_text);
noAlbumsFoundTv.setVisibility(View.VISIBLE);
}
}
});
view.findViewById(R.id.closeSearchAlbumsBox).setOnClickListener(view16 -> hideSearchAlbumsBoxLayout(view));
view.findViewById(R.id.closeSortAlbumsButton).setOnClickListener(view13 -> hideSortAlbumsByCategoriesBox(view));
/* Set up spinner for album categories */
Spinner spinner = view.findViewById(R.id.album_category);
String[] album_categories = getAlbumsCategories();
final List<String> album_categories_list = new ArrayList<>(Arrays.asList(album_categories));
final ArrayAdapter<String> album_category_adapter = new ArrayAdapter<String>(getContext(), R.layout.spinner_item, album_categories_list) {
@Override
public boolean isEnabled(int position) {
return position != 0;
}
@Override
public View getDropDownView(int position, View convertView,
@NonNull ViewGroup parent) {
View view = super.getDropDownView(position, convertView, parent);
TextView tv = (TextView) view;
int nightModeFlags =
requireContext().getResources().getConfiguration().uiMode &
Configuration.UI_MODE_NIGHT_MASK;
boolean isNightMode = nightModeFlags == Configuration.UI_MODE_NIGHT_YES;
if (position == 0) {
// Set the hint text color gray
tv.setTextColor(Color.GRAY);
} else {
tv.setTextColor(Color.BLACK);
if (isNightMode)
tv.setTextColor(Color.WHITE);
}
return view;
}
};
album_category_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
spinner.setAdapter(album_category_adapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position > 0) {
sortAlbumsDataByCategory(position);
} else {
albums_lib_recycler_list_by_category.setVisibility(View.INVISIBLE);
no_albums_found_by_category.setVisibility(View.VISIBLE);
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
private void sortAlbumsDataByCategory(int albumCategory) {
mAlbumItemsByCategory.clear();
if (!mAlbumItems.isEmpty()) {
for (Album albumItem: mAlbumItems) {
if (albumItem.getCategory() == albumCategory) {
mAlbumItemsByCategory.add(albumItem);
}
}
if (!mAlbumItemsByCategory.isEmpty()) {
mAlbumLibAdapterByCategory.swapAlbums(mAlbumItemsByCategory);
albums_lib_recycler_list_by_category.setVisibility(View.VISIBLE);
no_albums_found_by_category.setVisibility(View.INVISIBLE);
} else {
albums_lib_recycler_list_by_category.setVisibility(View.INVISIBLE);
no_albums_found_by_category.setVisibility(View.VISIBLE);
// no albums data for this category
no_albums_found_by_category.setText(getString(R.string.no_album_found_for_category_label_text));
}
} else {
albums_lib_recycler_list_by_category.setVisibility(View.INVISIBLE);
no_albums_found_by_category.setVisibility(View.VISIBLE);
if (albumCategory > 0) {
// no albums data for this category
no_albums_found_by_category.setText(getString(R.string.no_album_found_for_category_label_text));
} else {
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
}
}
}
private void showSortAlbumsByCategoriesBox(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.INVISIBLE);
RelativeLayout sortAlbumsByCategoriesBox = view.findViewById(R.id.sort_albums_by_categories_box);
// show albums by categories box
sortAlbumsByCategoriesBox.setVisibility(View.VISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.INVISIBLE);
}
private void showSearchAlbumsBoxLayout(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.INVISIBLE);
RelativeLayout searchAlbumsBoxLayout = view.findViewById(R.id.search_albums_box_layout);
// show search albums box layout
searchAlbumsBoxLayout.setVisibility(View.VISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.INVISIBLE);
}
private void hideSearchAlbumsBoxLayout(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.VISIBLE);
RelativeLayout searchAlbumsBoxLayout = view.findViewById(R.id.search_albums_box_layout);
// hide search albums box
searchAlbumsBoxLayout.setVisibility(View.INVISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.VISIBLE);
}
private void hideSortAlbumsByCategoriesBox(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.VISIBLE);
RelativeLayout sortAlbumsByCategoriesBox = view.findViewById(R.id.sort_albums_by_categories_box);
// hide albums by categories box
sortAlbumsByCategoriesBox.setVisibility(View.INVISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.VISIBLE);
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
}
public String[] getAlbumsCategories() {
return new String[]{
getString(R.string.album_category_head_text),
getString(R.string.at_home_text),
getString(R.string.At_work_text),
getString(R.string.at_gym_text),
getString(R.string.beach_text),
getString(R.string.birthday_text),
getString(R.string.party_text),
getString(R.string.restaurant_text),
getString(R.string.night_life_text),
getString(R.string.travel_text),
getString(R.string.holiday_text),
getString(R.string.funeral_text),
getString(R.string.family_members_text),
getString(R.string.girlfriend_text),
getString(R.string.boyfriend),
getString(R.string.wedding_text),
getString(R.string.other_text)
};
}
@Override
public void onListItemClick(int clickedItemIndex) {
Intent intent = new Intent(requireContext(),AlbumViewerActivity.class);
Album album = mAlbumItems.get(clickedItemIndex);
intent.putExtra(AlbumActivity.ALBUM_NAME_EXTRA,album.getName());
intent.putExtra(AlbumActivity.ALBUM_CATEGORY_EXTRA,album.getCategory());
intent.putExtra(AlbumActivity.ALBUM_DESCRIPTION_EXTRA,album.getDescription());
ArrayList<String> photoAbsolutePathsListData = (ArrayList<String>) album.getPhotoPathsList();
// pass photo data
intent.putExtra(PHOTO_ITEMS_LIST_PREFS,photoAbsolutePathsListData);
ArrayList<String> musicIdsDataListData = (ArrayList<String>) album.getMusicIdsList();
// pass music data data
intent.putExtra(MUSIC_DATA_LIST_PREFS,musicIdsDataListData);
ArrayList<String> albumSubOwnersId = (ArrayList<String>) album.getSubOwnersId();
// pass sub owners id data
intent.putExtra(ALBUM_SUB_OWNERS_ID_EXTRA,albumSubOwnersId);
intent.putExtra(IS_NEW_ALBUM_EXTRA,true);
intent.putExtra(OWNER_ALBUM_ID_EXTRA,album.getOwnerId());
intent.putExtra(ALBUM_ID_EXTRA,album.getAlbumId());
startActivity(intent);
}
@Override
public void onShareAlbumItem(int clickedItemIndex) {
Album albumItem = mAlbumItems.get(clickedItemIndex);
if (albumItem != null) {
shareAlbumInLibrary(albumItem);
}
}
private void shareAlbumInLibrary(Album album) {
FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("https://www.pictoslideapp.com/albumId/" + album.getAlbumId()))
.setDomainUriPrefix("https://pictoslideapp.page.link")
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder(BuildConfig.APPLICATION_ID).setMinimumVersion(1).build())
// Set parameters
// ...
.buildShortDynamicLink()
.addOnCompleteListener(requireActivity(), task -> {
if (task.isSuccessful()) {
// Short link created
Uri shortLink = task.getResult().getShortLink();
if (shortLink != null) {
String album_share_text = getString(R.string.hey_text) + "\n";
album_share_text += getString(R.string.about_app_text) + "\n";
album_share_text += getString(R.string.about_album_share_1) + "\n";
album_share_text += shortLink.toString() + "\n";
album_share_text += getString(R.string.about_album_share_2) + "\n";
album_share_text += getString(R.string.about_album_share_3) + "\n";
album_share_text += getString(R.string.app_play_store_link);
mMainUtil.shareTextData(getString(R.string.share_album_via_title_text),album_share_text);
}
} else {
// Error
mMainUtil.showToastMessage(getString(R.string.No_internet_available_text));
}
});
}
} | UTF-8 | Java | 24,482 | java | AlbumsFragment.java | Java | [] | null | [] | package com.pictoslide.www.fragments;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.navigation.fragment.NavHostFragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.firebase.dynamiclinks.DynamicLink;
import com.google.firebase.dynamiclinks.FirebaseDynamicLinks;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QuerySnapshot;
import com.pictoslide.www.BuildConfig;
import com.pictoslide.www.R;
import com.pictoslide.www.activities.AlbumActivity;
import com.pictoslide.www.activities.AlbumViewerActivity;
import com.pictoslide.www.adapters.AlbumLibAdapter;
import com.pictoslide.www.models.Album;
import com.pictoslide.www.utils.AppConstUtils;
import com.pictoslide.www.utils.MainUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import static com.pictoslide.www.activities.AlbumActivity.ALBUM_ID_EXTRA;
import static com.pictoslide.www.activities.AlbumActivity.MUSIC_DATA_LIST_PREFS;
import static com.pictoslide.www.activities.AlbumActivity.PHOTO_ITEMS_LIST_PREFS;
import static com.pictoslide.www.activities.AlbumViewerActivity.ALBUM_SUB_OWNERS_ID_EXTRA;
import static com.pictoslide.www.activities.AlbumViewerActivity.OWNER_ALBUM_ID_EXTRA;
import static com.pictoslide.www.activities.MainActivity.IS_NEW_ALBUM_EXTRA;
import static com.pictoslide.www.activities.MainActivity.MADE_CHANGES_ALBUM_LIBRARY;
public class AlbumsFragment extends Fragment implements AlbumLibAdapter.ListItemClickListener {
private MainUtil mMainUtil;
private FirebaseFirestore mFirebaseFirestore;
private ArrayList<Album> mAlbumItems;
private ArrayList<Album> mSearchAlbumsResults;
private AlbumLibAdapter mAlbumLibAdapter;
private AlbumLibAdapter mAlbumLibAdapterByCategory;
private RecyclerView albums_lib_recycler_list;
private RecyclerView albums_lib_recycler_list_by_category;
private String mCurrentUserId;
private ProgressBar mProgressBar;
private TextView mErrorMessage;
private String mAlbumNameSearchValue;
private ArrayList<Album> mAlbumItemsByCategory;
private TextView no_albums_found_by_category;
/**
* Swipe callback on recyclerview albums items
*/
private final ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {
//Remove swiped item from list and notify the RecyclerView
int position = viewHolder.getAdapterPosition();
mAlbumLibAdapter.removeAlbumFromLibraryByPosition(position, shouldRemoveAlbumFromLibrary -> {
mAlbumItems.remove(position);
mAlbumLibAdapter.swapAlbums(mAlbumItems);
if (!shouldRemoveAlbumFromLibrary) {
NavHostFragment.findNavController(AlbumsFragment.this).navigateUp();
mMainUtil.writeDataBooleanToSharedPreferences(MADE_CHANGES_ALBUM_LIBRARY,true);
}
});
}
};
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMainUtil = new MainUtil(requireContext());
mFirebaseFirestore = FirebaseFirestore.getInstance();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_albums, container, false);
mCurrentUserId = mMainUtil.getUniqueID(requireContext());
albums_lib_recycler_list = rootView.findViewById(R.id.my_albums_recycler_list);
albums_lib_recycler_list_by_category = rootView.findViewById(R.id.my_albums_category_recycler_list);
// Set the layout for the RecyclerView to be a linear layout, which measures and
// positions items within a RecyclerView into a linear list
albums_lib_recycler_list.setLayoutManager(new LinearLayoutManager(requireContext()));
albums_lib_recycler_list_by_category.setLayoutManager(new LinearLayoutManager(requireContext()));
mAlbumItems = new ArrayList<>();
mAlbumItemsByCategory = new ArrayList<>();
// Initialize the adapter and attach it to the RecyclerView
mAlbumLibAdapter = new AlbumLibAdapter(requireContext(), mAlbumItems, this);
albums_lib_recycler_list.setAdapter(mAlbumLibAdapter);
// attach swipe to delete to recyclerview of albums
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback);
itemTouchHelper.attachToRecyclerView(albums_lib_recycler_list);
mAlbumLibAdapterByCategory = new AlbumLibAdapter(requireContext(),mAlbumItemsByCategory, this);
albums_lib_recycler_list_by_category.setAdapter(mAlbumLibAdapterByCategory);
DividerItemDecoration decoration = new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL);
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(requireContext(), R.drawable.divider)));
albums_lib_recycler_list.addItemDecoration(decoration);
albums_lib_recycler_list_by_category.addItemDecoration(decoration);
mProgressBar = rootView.findViewById(R.id.loader_bar);
mErrorMessage = rootView.findViewById(R.id.error_found_tv);
no_albums_found_by_category = rootView.findViewById(R.id.no_albums_by_category_found_tv);
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
mProgressBar.setVisibility(View.VISIBLE);
loadAlbumsDataFromDb();
return rootView;
}
private void loadAlbumsDataFromDb() {
mFirebaseFirestore.collection(AppConstUtils.ALBUMS_COLLECTION_NAME)
.orderBy("createdAtTime", Query.Direction.DESCENDING)
.addSnapshotListener((snapshot, e) -> {
if (e != null) {
return;
}
getQuerySnapshotAlbumsData(snapshot);
});
}
private void getQuerySnapshotAlbumsData(QuerySnapshot snapshot) {
if (snapshot != null) {
//Log.d(TAG, "Current data: " + snapshot.getData());
if (!snapshot.isEmpty()) {
mAlbumItems.clear();
for (DocumentSnapshot document : snapshot.getDocuments()) {
Album albumItem = document.toObject(Album.class);
List<String> albumSubOwnersId = null;
if (albumItem != null) {
albumSubOwnersId = albumItem.getSubOwnersId();
}
boolean isUserAlbumSubOwner = false;
if (albumSubOwnersId != null && albumSubOwnersId.contains(mCurrentUserId)) {
isUserAlbumSubOwner = true;
}
if (albumItem != null && (albumItem.getOwnerId().equals(mCurrentUserId) || isUserAlbumSubOwner)) {
mAlbumItems.add(albumItem);
}
}
if (!mAlbumItems.isEmpty()) {
mAlbumLibAdapter.swapAlbums(mAlbumItems);
showAlbumsData();
} else {
// no albums found
showErrorMessage(getString(R.string.no_album_found_label_text));
}
} else {
// no data found
showErrorMessage(getString(R.string.no_album_found_label_text));
}
} else {
// no data found
showErrorMessage(getString(R.string.no_album_found_label_text));
}
}
private void showAlbumsData() {
albums_lib_recycler_list.setVisibility(View.VISIBLE);
mErrorMessage.setVisibility(View.INVISIBLE);
mProgressBar.setVisibility(View.INVISIBLE);
}
private void showErrorMessage(String errorMessage) {
albums_lib_recycler_list.setVisibility(View.INVISIBLE);
mErrorMessage.setVisibility(View.VISIBLE);
mErrorMessage.setText(errorMessage);
mProgressBar.setVisibility(View.INVISIBLE);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// newAlbumFabButton tapped
view.findViewById(R.id.new_album_fab_button).setOnClickListener(view1 -> {
Intent intent = new Intent(getContext(), AlbumActivity.class);
intent.putExtra(IS_NEW_ALBUM_EXTRA, true);
startActivity(intent);
});
// sortAlbumsByButton tapped
view.findViewById(R.id.sortAlbumsByButton).setOnClickListener(view12 -> showSortAlbumsByCategoriesBox(view));
// search albums button tapped
view.findViewById(R.id.searchAlbumsButton).setOnClickListener(view15 -> showSearchAlbumsBoxLayout(view));
/*
* Search for albums by name
*/
EditText search_album_name_edit_text = view.findViewById(R.id.album_name_search_edt);
RecyclerView searchAlbumsRecyclerView = view.findViewById(R.id.albums_recycler_list_search_results);
// Set the layout for the RecyclerView to be a linear layout, which measures and
// positions items within a RecyclerView into a linear list
searchAlbumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
mSearchAlbumsResults = new ArrayList<>();
// Initialize the adapter and attach it to the RecyclerView
mAlbumLibAdapter = new AlbumLibAdapter(requireContext(),mSearchAlbumsResults,this);
searchAlbumsRecyclerView.setAdapter(mAlbumLibAdapter);
DividerItemDecoration decoration = new DividerItemDecoration(requireContext(),DividerItemDecoration.VERTICAL);
decoration.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(requireContext(), R.drawable.divider)));
searchAlbumsRecyclerView.addItemDecoration(decoration);
TextView noAlbumsFoundTv = view.findViewById(R.id.error_found_tv_2);
search_album_name_edit_text.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { }
@Override
public void afterTextChanged(Editable editable) {
mAlbumNameSearchValue = editable.toString().toLowerCase().trim();
if (!mAlbumNameSearchValue.isEmpty()) {
if (!mAlbumItems.isEmpty()) {
// do some search
int albumsFound = 0;
mSearchAlbumsResults.clear();
for (int i = 0; i < mAlbumItems.size(); i++) {
if (mAlbumItems.get(i).getName().toLowerCase().contains(mAlbumNameSearchValue)) {
albumsFound++;
mSearchAlbumsResults.add(mAlbumItems.get(i));
}
}
if (albumsFound > 0) {
searchAlbumsRecyclerView.setVisibility(View.VISIBLE);
noAlbumsFoundTv.setVisibility(View.GONE);
mAlbumLibAdapter.swapAlbums(mSearchAlbumsResults);
} else {
// no results
searchAlbumsRecyclerView.setVisibility(View.INVISIBLE);
noAlbumsFoundTv.setText(R.string.no_search_albums_found_tv);
noAlbumsFoundTv.setVisibility(View.VISIBLE);
}
} else {
// no results
searchAlbumsRecyclerView.setVisibility(View.INVISIBLE);
noAlbumsFoundTv.setText(R.string.no_search_albums_found_tv);
noAlbumsFoundTv.setVisibility(View.VISIBLE);
}
} else {
// no results
searchAlbumsRecyclerView.setVisibility(View.INVISIBLE);
noAlbumsFoundTv.setText(R.string.find_album_by_name_text);
noAlbumsFoundTv.setVisibility(View.VISIBLE);
}
}
});
view.findViewById(R.id.closeSearchAlbumsBox).setOnClickListener(view16 -> hideSearchAlbumsBoxLayout(view));
view.findViewById(R.id.closeSortAlbumsButton).setOnClickListener(view13 -> hideSortAlbumsByCategoriesBox(view));
/* Set up spinner for album categories */
Spinner spinner = view.findViewById(R.id.album_category);
String[] album_categories = getAlbumsCategories();
final List<String> album_categories_list = new ArrayList<>(Arrays.asList(album_categories));
final ArrayAdapter<String> album_category_adapter = new ArrayAdapter<String>(getContext(), R.layout.spinner_item, album_categories_list) {
@Override
public boolean isEnabled(int position) {
return position != 0;
}
@Override
public View getDropDownView(int position, View convertView,
@NonNull ViewGroup parent) {
View view = super.getDropDownView(position, convertView, parent);
TextView tv = (TextView) view;
int nightModeFlags =
requireContext().getResources().getConfiguration().uiMode &
Configuration.UI_MODE_NIGHT_MASK;
boolean isNightMode = nightModeFlags == Configuration.UI_MODE_NIGHT_YES;
if (position == 0) {
// Set the hint text color gray
tv.setTextColor(Color.GRAY);
} else {
tv.setTextColor(Color.BLACK);
if (isNightMode)
tv.setTextColor(Color.WHITE);
}
return view;
}
};
album_category_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
spinner.setAdapter(album_category_adapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position > 0) {
sortAlbumsDataByCategory(position);
} else {
albums_lib_recycler_list_by_category.setVisibility(View.INVISIBLE);
no_albums_found_by_category.setVisibility(View.VISIBLE);
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
private void sortAlbumsDataByCategory(int albumCategory) {
mAlbumItemsByCategory.clear();
if (!mAlbumItems.isEmpty()) {
for (Album albumItem: mAlbumItems) {
if (albumItem.getCategory() == albumCategory) {
mAlbumItemsByCategory.add(albumItem);
}
}
if (!mAlbumItemsByCategory.isEmpty()) {
mAlbumLibAdapterByCategory.swapAlbums(mAlbumItemsByCategory);
albums_lib_recycler_list_by_category.setVisibility(View.VISIBLE);
no_albums_found_by_category.setVisibility(View.INVISIBLE);
} else {
albums_lib_recycler_list_by_category.setVisibility(View.INVISIBLE);
no_albums_found_by_category.setVisibility(View.VISIBLE);
// no albums data for this category
no_albums_found_by_category.setText(getString(R.string.no_album_found_for_category_label_text));
}
} else {
albums_lib_recycler_list_by_category.setVisibility(View.INVISIBLE);
no_albums_found_by_category.setVisibility(View.VISIBLE);
if (albumCategory > 0) {
// no albums data for this category
no_albums_found_by_category.setText(getString(R.string.no_album_found_for_category_label_text));
} else {
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
}
}
}
private void showSortAlbumsByCategoriesBox(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.INVISIBLE);
RelativeLayout sortAlbumsByCategoriesBox = view.findViewById(R.id.sort_albums_by_categories_box);
// show albums by categories box
sortAlbumsByCategoriesBox.setVisibility(View.VISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.INVISIBLE);
}
private void showSearchAlbumsBoxLayout(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.INVISIBLE);
RelativeLayout searchAlbumsBoxLayout = view.findViewById(R.id.search_albums_box_layout);
// show search albums box layout
searchAlbumsBoxLayout.setVisibility(View.VISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.INVISIBLE);
}
private void hideSearchAlbumsBoxLayout(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.VISIBLE);
RelativeLayout searchAlbumsBoxLayout = view.findViewById(R.id.search_albums_box_layout);
// hide search albums box
searchAlbumsBoxLayout.setVisibility(View.INVISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.VISIBLE);
}
private void hideSortAlbumsByCategoriesBox(View view) {
CardView topHeaderAlbumBoxLayout = view.findViewById(R.id.top_library_header);
topHeaderAlbumBoxLayout.setVisibility(View.VISIBLE);
RelativeLayout sortAlbumsByCategoriesBox = view.findViewById(R.id.sort_albums_by_categories_box);
// hide albums by categories box
sortAlbumsByCategoriesBox.setVisibility(View.INVISIBLE);
view.findViewById(R.id.new_album_fab_button).setVisibility(View.VISIBLE);
no_albums_found_by_category.setText(getString(R.string.sort_albums_by_category_head_text));
}
public String[] getAlbumsCategories() {
return new String[]{
getString(R.string.album_category_head_text),
getString(R.string.at_home_text),
getString(R.string.At_work_text),
getString(R.string.at_gym_text),
getString(R.string.beach_text),
getString(R.string.birthday_text),
getString(R.string.party_text),
getString(R.string.restaurant_text),
getString(R.string.night_life_text),
getString(R.string.travel_text),
getString(R.string.holiday_text),
getString(R.string.funeral_text),
getString(R.string.family_members_text),
getString(R.string.girlfriend_text),
getString(R.string.boyfriend),
getString(R.string.wedding_text),
getString(R.string.other_text)
};
}
@Override
public void onListItemClick(int clickedItemIndex) {
Intent intent = new Intent(requireContext(),AlbumViewerActivity.class);
Album album = mAlbumItems.get(clickedItemIndex);
intent.putExtra(AlbumActivity.ALBUM_NAME_EXTRA,album.getName());
intent.putExtra(AlbumActivity.ALBUM_CATEGORY_EXTRA,album.getCategory());
intent.putExtra(AlbumActivity.ALBUM_DESCRIPTION_EXTRA,album.getDescription());
ArrayList<String> photoAbsolutePathsListData = (ArrayList<String>) album.getPhotoPathsList();
// pass photo data
intent.putExtra(PHOTO_ITEMS_LIST_PREFS,photoAbsolutePathsListData);
ArrayList<String> musicIdsDataListData = (ArrayList<String>) album.getMusicIdsList();
// pass music data data
intent.putExtra(MUSIC_DATA_LIST_PREFS,musicIdsDataListData);
ArrayList<String> albumSubOwnersId = (ArrayList<String>) album.getSubOwnersId();
// pass sub owners id data
intent.putExtra(ALBUM_SUB_OWNERS_ID_EXTRA,albumSubOwnersId);
intent.putExtra(IS_NEW_ALBUM_EXTRA,true);
intent.putExtra(OWNER_ALBUM_ID_EXTRA,album.getOwnerId());
intent.putExtra(ALBUM_ID_EXTRA,album.getAlbumId());
startActivity(intent);
}
@Override
public void onShareAlbumItem(int clickedItemIndex) {
Album albumItem = mAlbumItems.get(clickedItemIndex);
if (albumItem != null) {
shareAlbumInLibrary(albumItem);
}
}
private void shareAlbumInLibrary(Album album) {
FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse("https://www.pictoslideapp.com/albumId/" + album.getAlbumId()))
.setDomainUriPrefix("https://pictoslideapp.page.link")
.setAndroidParameters(new DynamicLink.AndroidParameters.Builder(BuildConfig.APPLICATION_ID).setMinimumVersion(1).build())
// Set parameters
// ...
.buildShortDynamicLink()
.addOnCompleteListener(requireActivity(), task -> {
if (task.isSuccessful()) {
// Short link created
Uri shortLink = task.getResult().getShortLink();
if (shortLink != null) {
String album_share_text = getString(R.string.hey_text) + "\n";
album_share_text += getString(R.string.about_app_text) + "\n";
album_share_text += getString(R.string.about_album_share_1) + "\n";
album_share_text += shortLink.toString() + "\n";
album_share_text += getString(R.string.about_album_share_2) + "\n";
album_share_text += getString(R.string.about_album_share_3) + "\n";
album_share_text += getString(R.string.app_play_store_link);
mMainUtil.shareTextData(getString(R.string.share_album_via_title_text),album_share_text);
}
} else {
// Error
mMainUtil.showToastMessage(getString(R.string.No_internet_available_text));
}
});
}
} | 24,482 | 0.646802 | 0.64574 | 503 | 47.673958 | 32.494579 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.644135 | false | false | 9 |
d440b8f4672126503fabd69e93b795dd3b04e7da | 11,201,274,721,651 | d4688d648354068501e8bf5bcbcc9d638d87817e | /app/src/main/java/com/example/meshidzekv/popular_movies_2/DetailedActivity.java | bd6c43a57f43e37a117307b16c8e205acf023169 | [] | no_license | BoardzMaster/Movie-Project-2 | https://github.com/BoardzMaster/Movie-Project-2 | 03a490c190588296af8ca1f8056ab43dd4001e07 | 2cda305baa3c9a00bd640acbae6003fa02fde070 | refs/heads/master | 2016-09-01T05:24:32.532000 | 2015-10-28T22:17:31 | 2015-10-28T22:17:31 | 45,145,158 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.meshidzekv.popular_movies_2;
import android.content.ContentValues;
import android.content.Intent;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import android.view.View.OnClickListener;
import com.example.meshidzekv.popular_movies_2.data.MovieContract.MovieEntry;
import com.example.meshidzekv.popular_movies_2.data.MovieContract;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
public class DetailedActivity extends AppCompatActivity implements DetailedFragment.OnMovieDeletedListener{
public static final String MOVIE_KEY = "movie_data";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detailed);
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Intent Movie_Intent;
Movie_Intent = getIntent();
ContentValues MovieValues = new ContentValues();
String Movie_Name = Movie_Intent.getStringExtra(MainActivity.EXTRA_MOVIE_NAME);
String Movie_Backdrop_Path = Movie_Intent.getStringExtra(MainActivity.EXTRA_BACKDROP);
String Movie_Poster_Path = Movie_Intent.getStringExtra(MainActivity.EXTRA_POSTER);
String Movie_Synopsis = Movie_Intent.getStringExtra(MainActivity.EXTRA_SYNOPSIS);
String Movie_Release = Movie_Intent.getStringExtra(MainActivity.EXTRA_RELEASE);
String Movie_Score = Movie_Intent.getStringExtra(MainActivity.EXTRA_SCORE);
int Movie_id = Movie_Intent.getIntExtra(MainActivity.EXTRA_MOVIE_ID, 0);
ArrayList<String> Movie_Trailers = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_TRAILERS);
ArrayList<String> Movie_Trailers_Name = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_TRAILERS_NAME);
ArrayList<String> Movie_Reviews = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_REVIEW_CONTENT);
ArrayList<String> Movie_Review_Authors = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_REVIEW_AUTHOR);
Bundle arguments = new Bundle();
arguments.putInt(MainActivity.EXTRA_MOVIE_ID, Movie_id);
arguments.putString(MainActivity.EXTRA_MOVIE_NAME, Movie_Name);
arguments.putString(MainActivity.EXTRA_BACKDROP, Movie_Backdrop_Path);
arguments.putString(MainActivity.EXTRA_POSTER, Movie_Poster_Path);
arguments.putString(MainActivity.EXTRA_SYNOPSIS, Movie_Synopsis);
arguments.putString(MainActivity.EXTRA_RELEASE, Movie_Release);
arguments.putString(MainActivity.EXTRA_SCORE, Movie_Score);
arguments.putStringArrayList(MainActivity.EXTRA_TRAILERS, Movie_Trailers);
arguments.putStringArrayList(MainActivity.EXTRA_TRAILERS_NAME, Movie_Trailers_Name);
arguments.putStringArrayList(MainActivity.EXTRA_REVIEW_CONTENT, Movie_Reviews);
arguments.putStringArrayList(MainActivity.EXTRA_REVIEW_AUTHOR, Movie_Review_Authors);
DetailedFragment fragment = new DetailedFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.movie_detail_container, fragment)
.commit();
}
}
@Override
public void OnMovieDeleted(int screenSize) {
Bundle args = new Bundle();
List<Fragment> fragmentList = getSupportFragmentManager().getFragments();
getSupportFragmentManager().beginTransaction().remove(fragmentList.get(0)).commit();
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
}
| UTF-8 | Java | 4,192 | java | DetailedActivity.java | Java | [
{
"context": "package com.example.meshidzekv.popular_movies_2;\n\nimport android.content.Content",
"end": 30,
"score": 0.7131735682487488,
"start": 20,
"tag": "USERNAME",
"value": "meshidzekv"
},
{
"context": "er{\n\n\n public static final String MOVIE_KEY = \"movie_data\";\n\n ... | null | [] | package com.example.meshidzekv.popular_movies_2;
import android.content.ContentValues;
import android.content.Intent;
import android.content.res.Configuration;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import android.view.View.OnClickListener;
import com.example.meshidzekv.popular_movies_2.data.MovieContract.MovieEntry;
import com.example.meshidzekv.popular_movies_2.data.MovieContract;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
public class DetailedActivity extends AppCompatActivity implements DetailedFragment.OnMovieDeletedListener{
public static final String MOVIE_KEY = "movie_data";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detailed);
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Intent Movie_Intent;
Movie_Intent = getIntent();
ContentValues MovieValues = new ContentValues();
String Movie_Name = Movie_Intent.getStringExtra(MainActivity.EXTRA_MOVIE_NAME);
String Movie_Backdrop_Path = Movie_Intent.getStringExtra(MainActivity.EXTRA_BACKDROP);
String Movie_Poster_Path = Movie_Intent.getStringExtra(MainActivity.EXTRA_POSTER);
String Movie_Synopsis = Movie_Intent.getStringExtra(MainActivity.EXTRA_SYNOPSIS);
String Movie_Release = Movie_Intent.getStringExtra(MainActivity.EXTRA_RELEASE);
String Movie_Score = Movie_Intent.getStringExtra(MainActivity.EXTRA_SCORE);
int Movie_id = Movie_Intent.getIntExtra(MainActivity.EXTRA_MOVIE_ID, 0);
ArrayList<String> Movie_Trailers = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_TRAILERS);
ArrayList<String> Movie_Trailers_Name = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_TRAILERS_NAME);
ArrayList<String> Movie_Reviews = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_REVIEW_CONTENT);
ArrayList<String> Movie_Review_Authors = Movie_Intent.getStringArrayListExtra(MainActivity.EXTRA_REVIEW_AUTHOR);
Bundle arguments = new Bundle();
arguments.putInt(MainActivity.EXTRA_MOVIE_ID, Movie_id);
arguments.putString(MainActivity.EXTRA_MOVIE_NAME, Movie_Name);
arguments.putString(MainActivity.EXTRA_BACKDROP, Movie_Backdrop_Path);
arguments.putString(MainActivity.EXTRA_POSTER, Movie_Poster_Path);
arguments.putString(MainActivity.EXTRA_SYNOPSIS, Movie_Synopsis);
arguments.putString(MainActivity.EXTRA_RELEASE, Movie_Release);
arguments.putString(MainActivity.EXTRA_SCORE, Movie_Score);
arguments.putStringArrayList(MainActivity.EXTRA_TRAILERS, Movie_Trailers);
arguments.putStringArrayList(MainActivity.EXTRA_TRAILERS_NAME, Movie_Trailers_Name);
arguments.putStringArrayList(MainActivity.EXTRA_REVIEW_CONTENT, Movie_Reviews);
arguments.putStringArrayList(MainActivity.EXTRA_REVIEW_AUTHOR, Movie_Review_Authors);
DetailedFragment fragment = new DetailedFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.movie_detail_container, fragment)
.commit();
}
}
@Override
public void OnMovieDeleted(int screenSize) {
Bundle args = new Bundle();
List<Fragment> fragmentList = getSupportFragmentManager().getFragments();
getSupportFragmentManager().beginTransaction().remove(fragmentList.get(0)).commit();
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
}
| 4,192 | 0.725429 | 0.72376 | 89 | 46.078651 | 35.297207 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.808989 | false | false | 9 |
9a38c965e16cf4eca29d18c64e19c66bdb8f7f3d | 17,686,675,343,414 | 7355f05f77853d6195f94a108d03852c24bb4bda | /EasyCarpool/src/com/easycarpool/redis/RedisImpl.java | 00e47e77c119c74865bfdb8600868ce56fd3ac85 | [] | no_license | ranjitjitu/EasyCarpool | https://github.com/ranjitjitu/EasyCarpool | b3a9f5d3ec0a44d6f32063b323bf7d19f072bcee | b094554606745975f38597d66b4ac2b50263ae2a | refs/heads/master | 2021-01-01T05:25:47.784000 | 2016-06-02T13:46:40 | 2016-06-02T13:46:40 | 58,963,665 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.easycarpool.redis;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Level;
import com.easycarpool.log.EasyCarpoolLogger;
import com.easycarpool.log.IEasyCarpoolLogger;
import com.easycarpool.util.ConfigUtils;
import com.easycarpool.util.EasyCarpoolConstants;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
public class RedisImpl implements RedisHelper{
private IEasyCarpoolLogger logger = EasyCarpoolLogger.getLogger();
private static String CLASS_NAME = RedisImpl.class.getName();
private static String redisHost;
private static int redisPort;
private static JedisPool pool = null;
static{
redisHost = ConfigUtils.getProperty(EasyCarpoolConstants.REDIS_HOST);
redisPort = Integer.parseInt(ConfigUtils.getProperty(EasyCarpoolConstants.REDIS_PORT));
pool = new JedisPool(redisHost, redisPort);
}
public long put(String key, String mapName, Object obj){
Jedis jedis = pool.getResource();
try {
Map<byte[],byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
retrieveMap.put(key.getBytes("UTF-8"), serialize(obj));
jedis.hmset(mapName.getBytes("UTF-8"), retrieveMap);
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "put method", "Exception in put method. Message : "+e);
return 0;
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return 1;
}
public Object get(String mapName, String key){
Jedis jedis = pool.getResource();
try {
byte[] bytesObj = jedis.hget(mapName.getBytes("UTF-8"), key.getBytes("UTF-8"));
return deserialize(bytesObj);
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "put method", "Exception in put method. Message : "+e);
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return null;
}
public List<Object> getAll(String mapName) {
ArrayList<Object> value = new ArrayList<Object>();
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<byte[],byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
for (byte[] keyMap : retrieveMap.keySet()) {
try{
if(!new String(keyMap,"UTF-8").contains("--ALL--")){
byte[] tempValue = jedis.get(retrieveMap.get(keyMap));
value.add(deserialize(tempValue));
}
}catch(Exception ex){
logger.log(Level.ERROR, CLASS_NAME, "getAll", "Exception in inner getAll method : "+ex);
}
}
return value;
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "getAll", "Exception in outer getAll method : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
return null;
}
public Map<String, Object> getMap(String mapName) {
HashMap<String, Object> newMap = new HashMap<String, Object>();
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<byte[],byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
for (byte[] keyMap : retrieveMap.keySet()) {
try{
if(!new String(keyMap,"UTF-8").contains("--ALL--")){
byte[] tempValue = jedis.get(retrieveMap.get(keyMap));
newMap.put(new String(keyMap,"UTF-8"), deserialize(tempValue));
}
}catch(Exception ex){
logger.log(Level.ERROR, CLASS_NAME, "getMap", "Exception in inner getMap method : "+ex);
}
}
HashMap<String, Object> hashMap = newMap;
return hashMap;
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "getMap", "Exception in outer getMap method : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
return newMap;
}
public long remove(String mapName,String key){
Jedis jedis = pool.getResource();
try {
return jedis.hdel(mapName.getBytes("UTF-8"),key.getBytes("UTF-8"));
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "remove method", "Exception in remove method. Message : "+e);
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return 0L;
}
public boolean containKey(String mapName,String key){
Jedis jedis = pool.getResource();
try {
return jedis.hexists(mapName.getBytes("UTF-8"),key.getBytes("UTF-8"));
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "remove method", "Exception in remove method. Message : "+e);
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return false;
}
public Set keySet(String mapName) {
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<String, String> retrieveMap = jedis.hgetAll(mapName);
Set set = retrieveMap.keySet();
return set;
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "keySet", "Exception in keySet method. Message : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
return null;
}
public void clear(String mapName) {
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<byte[], byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
for (byte[] keyMap : retrieveMap.keySet()) {
jedis.del(retrieveMap.get(keyMap));
}
jedis.del(mapName.getBytes("UTF-8"));
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "clear", "Exception in clear method. Message : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
}
private Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException{
Object obj = null;
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
try {
bis = new ByteArrayInputStream(bytes);
ois = new ObjectInputStream(bis);
obj = ois.readObject();
} finally {
if (bis != null) {
bis.close();
}
if (ois != null) {
ois.close();
}
}
return obj;
}
private byte[] serialize(Object obj) throws IOException{
byte[] bytes = null;
ByteArrayOutputStream bos = null;
ObjectOutputStream oos = null;
try {
bos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
oos.flush();
bytes = bos.toByteArray();
} finally {
if (oos != null) {
oos.close();
}
if (bos != null) {
bos.close();
}
}
return bytes;
}
}
| UTF-8 | Java | 6,647 | java | RedisImpl.java | Java | [] | null | [] | package com.easycarpool.redis;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Level;
import com.easycarpool.log.EasyCarpoolLogger;
import com.easycarpool.log.IEasyCarpoolLogger;
import com.easycarpool.util.ConfigUtils;
import com.easycarpool.util.EasyCarpoolConstants;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
public class RedisImpl implements RedisHelper{
private IEasyCarpoolLogger logger = EasyCarpoolLogger.getLogger();
private static String CLASS_NAME = RedisImpl.class.getName();
private static String redisHost;
private static int redisPort;
private static JedisPool pool = null;
static{
redisHost = ConfigUtils.getProperty(EasyCarpoolConstants.REDIS_HOST);
redisPort = Integer.parseInt(ConfigUtils.getProperty(EasyCarpoolConstants.REDIS_PORT));
pool = new JedisPool(redisHost, redisPort);
}
public long put(String key, String mapName, Object obj){
Jedis jedis = pool.getResource();
try {
Map<byte[],byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
retrieveMap.put(key.getBytes("UTF-8"), serialize(obj));
jedis.hmset(mapName.getBytes("UTF-8"), retrieveMap);
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "put method", "Exception in put method. Message : "+e);
return 0;
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return 1;
}
public Object get(String mapName, String key){
Jedis jedis = pool.getResource();
try {
byte[] bytesObj = jedis.hget(mapName.getBytes("UTF-8"), key.getBytes("UTF-8"));
return deserialize(bytesObj);
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "put method", "Exception in put method. Message : "+e);
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return null;
}
public List<Object> getAll(String mapName) {
ArrayList<Object> value = new ArrayList<Object>();
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<byte[],byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
for (byte[] keyMap : retrieveMap.keySet()) {
try{
if(!new String(keyMap,"UTF-8").contains("--ALL--")){
byte[] tempValue = jedis.get(retrieveMap.get(keyMap));
value.add(deserialize(tempValue));
}
}catch(Exception ex){
logger.log(Level.ERROR, CLASS_NAME, "getAll", "Exception in inner getAll method : "+ex);
}
}
return value;
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "getAll", "Exception in outer getAll method : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
return null;
}
public Map<String, Object> getMap(String mapName) {
HashMap<String, Object> newMap = new HashMap<String, Object>();
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<byte[],byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
for (byte[] keyMap : retrieveMap.keySet()) {
try{
if(!new String(keyMap,"UTF-8").contains("--ALL--")){
byte[] tempValue = jedis.get(retrieveMap.get(keyMap));
newMap.put(new String(keyMap,"UTF-8"), deserialize(tempValue));
}
}catch(Exception ex){
logger.log(Level.ERROR, CLASS_NAME, "getMap", "Exception in inner getMap method : "+ex);
}
}
HashMap<String, Object> hashMap = newMap;
return hashMap;
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "getMap", "Exception in outer getMap method : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
return newMap;
}
public long remove(String mapName,String key){
Jedis jedis = pool.getResource();
try {
return jedis.hdel(mapName.getBytes("UTF-8"),key.getBytes("UTF-8"));
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "remove method", "Exception in remove method. Message : "+e);
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return 0L;
}
public boolean containKey(String mapName,String key){
Jedis jedis = pool.getResource();
try {
return jedis.hexists(mapName.getBytes("UTF-8"),key.getBytes("UTF-8"));
} catch (Exception e) {
logger.log(Level.ERROR, CLASS_NAME, "remove method", "Exception in remove method. Message : "+e);
}finally{
if(jedis.isConnected()){
jedis.close();
}
}
return false;
}
public Set keySet(String mapName) {
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<String, String> retrieveMap = jedis.hgetAll(mapName);
Set set = retrieveMap.keySet();
return set;
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "keySet", "Exception in keySet method. Message : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
return null;
}
public void clear(String mapName) {
Jedis jedis = null;
try {
jedis = pool.getResource();
Map<byte[], byte[]> retrieveMap = jedis.hgetAll(mapName.getBytes("UTF-8"));
for (byte[] keyMap : retrieveMap.keySet()) {
jedis.del(retrieveMap.get(keyMap));
}
jedis.del(mapName.getBytes("UTF-8"));
}
catch (Exception ex) {
logger.log(Level.ERROR, CLASS_NAME, "clear", "Exception in clear method. Message : "+ex);
}
finally {
if (jedis.isConnected()) {
jedis.close();
}
}
}
private Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException{
Object obj = null;
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
try {
bis = new ByteArrayInputStream(bytes);
ois = new ObjectInputStream(bis);
obj = ois.readObject();
} finally {
if (bis != null) {
bis.close();
}
if (ois != null) {
ois.close();
}
}
return obj;
}
private byte[] serialize(Object obj) throws IOException{
byte[] bytes = null;
ByteArrayOutputStream bos = null;
ObjectOutputStream oos = null;
try {
bos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
oos.flush();
bytes = bos.toByteArray();
} finally {
if (oos != null) {
oos.close();
}
if (bos != null) {
bos.close();
}
}
return bytes;
}
}
| 6,647 | 0.645253 | 0.642245 | 235 | 26.285107 | 24.880985 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.87234 | false | false | 9 |
b3657348816d1aeb8789949f6e1b46734d126204 | 13,975,823,594,328 | 3c84c7314ecaad29ff0fe5026b4aafeec14251ae | /smart-house-android/src/main/java/si/majeric/smarthouse/MessagesActivity.java | 035452f89b8c6902530db78a77e55fa0d53cb435 | [
"Apache-2.0"
] | permissive | umajeric/smart-house | https://github.com/umajeric/smart-house | 649b73f63de8b5cfcaa2292bdb7fcdf77c55aa97 | 16f7556a456d3e3e6a2c36cbaeb59ff67ab5c037 | refs/heads/master | 2021-01-11T14:12:52.126000 | 2017-03-05T10:05:40 | 2017-03-05T10:05:40 | 81,142,012 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2012 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 si.majeric.smarthouse;
import si.majeric.android.TaskCallbacks;
import si.majeric.smarthouse.client.Client;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.FragmentManager;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.PointF;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.FloatMath;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MessagesActivity extends FragmentActivity implements TaskCallbacks<String>, OnTouchListener {
private static final String MESSAGES_FRAGMENT_TAG = "messages_task";
private static final String TAG = "Touch";
@SuppressWarnings("unused")
private static final float MIN_ZOOM = 1f, MAX_ZOOM = 1f;
Client _client;
private MessagesFragment mTaskFragment;
// These matrices will be used to scale points of the image
// Matrix matrix = new Matrix();
// Matrix savedMatrix = new Matrix();
// The 3 states (events) which the user is trying to perform
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
// these PointF objects are used to record the point(s) the user is touching
PointF start = new PointF();
PointF mid = new PointF();
float oldDist = 1f;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_messages);
_client = ((SmartHouseApplication) getApplication()).getClient();
// Set up the action bar.
final ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(true);
final FragmentManager fm = getFragmentManager();
mTaskFragment = (MessagesFragment) fm.findFragmentByTag(MESSAGES_FRAGMENT_TAG);
// If the Fragment is non-null, then it is currently being
// retained across a configuration change.
if (mTaskFragment == null) {
mTaskFragment = new MessagesFragment();
fm.beginTransaction().add(mTaskFragment, MESSAGES_FRAGMENT_TAG).commit();
}
_messagesTV = (TextView) findViewById(R.id.messagesTextView);
_messagesTV.setOnTouchListener(this);
Button refreshButton = (Button) findViewById(R.id.messagesRefreshButton);
refreshButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTaskFragment.startMessagesDownload();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_messages, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case R.id.menu_send_messages:
sendMessages();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/**
* Send messages to specific email address
*/
protected void sendMessages() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"uros@majeric.si", "milos.kocbek@gmail.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "Server Logs");
StringBuilder emailText = new StringBuilder();
for (String str : _client.getServerMessages()) {
emailText.append(str);
}
intent.putExtra(Intent.EXTRA_TEXT, emailText.toString());
try {
startActivity(Intent.createChooser(intent, "Send Server Logs"));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_LONG).show();
}
}
static ProgressDialog pd;
private TextView _messagesTV;
@Override
public void onPreExecute() {
if (pd == null || !pd.isShowing()) {
pd = new ProgressDialog(this);
pd.setIndeterminate(true);
pd.setMessage("Loading...");
pd.show();
}
}
@Override
public void onProgressUpdate(int percent) {
}
@Override
public void onCancelled() {
}
@Override
public void onPostExecute(String result) {
if (pd != null && pd.isShowing()) {
pd.dismiss();
}
_messagesTV.setText("");
if (result != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Error").setMessage(result).setNegativeButton("OK", null).create().show();
} else {
for (String m : _client.getServerMessages()) {
_messagesTV.append(m);
}
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
TextView view = (TextView) v;
float scale;
// dumpEvent(event);
// Handle touch events here...
switch (event.getAction() & 255) {
case MotionEvent.ACTION_DOWN: // first finger down only
start.set(event.getX(), event.getY());
mode = DRAG;
break;
case MotionEvent.ACTION_UP: // first finger lifted
case 6: // second finger lifted
mode = NONE;
break;
case 5: // first and second finger down
oldDist = spacing(event);
if (oldDist > 5f) {
midPoint(mid, event);
mode = ZOOM;
}
break;
case MotionEvent.ACTION_MOVE:
if (mode == ZOOM) {
float newDist = spacing(event);
if (newDist > 10f) {
scale = newDist / oldDist;
if (scale > 1) {
scale = 1.1f;
} else if (scale < 1) {
scale = 0.95f;
}
float newSize = view.getTextSize() * scale;
if (newSize < 15) {
newSize = 15;
} else if (newSize > 70) {
newSize = 70;
}
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, newSize);
Log.d(TAG, "scale=" + scale + ", view.getTextSize(): " + view.getTextSize());
}
}
break;
}
return true; // indicate event was handled
}
private float spacing(MotionEvent event) {
float x = event.getX(0) - event.getX(1);
float y = event.getY(0) - event.getY(1);
return (float) Math.sqrt(x * x + y * y);
}
/*
* -------------------------------------------------------------------------- Method: midPoint Parameters: PointF object, MotionEvent Returns: void
* Description: calculates the midpoint between the two fingers ------------------------------------------------------------
*/
private void midPoint(PointF point, MotionEvent event) {
float x = event.getX(0) + event.getX(1);
float y = event.getY(0) + event.getY(1);
point.set(x / 2, y / 2);
}
}
| UTF-8 | Java | 7,096 | java | MessagesActivity.java | Java | [
{
"context": "intent.putExtra(Intent.EXTRA_EMAIL, new String[]{\"uros@majeric.si\", \"milos.kocbek@gmail.com\"});\n\t\tintent.putExtra(I",
"end": 3905,
"score": 0.999925434589386,
"start": 3890,
"tag": "EMAIL",
"value": "uros@majeric.si"
},
{
"context": "ent.EXTRA_EMAIL, new String[]... | null | [] | /*
* Copyright 2012 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 si.majeric.smarthouse;
import si.majeric.android.TaskCallbacks;
import si.majeric.smarthouse.client.Client;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.FragmentManager;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.PointF;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.FloatMath;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MessagesActivity extends FragmentActivity implements TaskCallbacks<String>, OnTouchListener {
private static final String MESSAGES_FRAGMENT_TAG = "messages_task";
private static final String TAG = "Touch";
@SuppressWarnings("unused")
private static final float MIN_ZOOM = 1f, MAX_ZOOM = 1f;
Client _client;
private MessagesFragment mTaskFragment;
// These matrices will be used to scale points of the image
// Matrix matrix = new Matrix();
// Matrix savedMatrix = new Matrix();
// The 3 states (events) which the user is trying to perform
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
// these PointF objects are used to record the point(s) the user is touching
PointF start = new PointF();
PointF mid = new PointF();
float oldDist = 1f;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_messages);
_client = ((SmartHouseApplication) getApplication()).getClient();
// Set up the action bar.
final ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(true);
final FragmentManager fm = getFragmentManager();
mTaskFragment = (MessagesFragment) fm.findFragmentByTag(MESSAGES_FRAGMENT_TAG);
// If the Fragment is non-null, then it is currently being
// retained across a configuration change.
if (mTaskFragment == null) {
mTaskFragment = new MessagesFragment();
fm.beginTransaction().add(mTaskFragment, MESSAGES_FRAGMENT_TAG).commit();
}
_messagesTV = (TextView) findViewById(R.id.messagesTextView);
_messagesTV.setOnTouchListener(this);
Button refreshButton = (Button) findViewById(R.id.messagesRefreshButton);
refreshButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTaskFragment.startMessagesDownload();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_messages, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case R.id.menu_send_messages:
sendMessages();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/**
* Send messages to specific email address
*/
protected void sendMessages() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"<EMAIL>", "<EMAIL>"});
intent.putExtra(Intent.EXTRA_SUBJECT, "Server Logs");
StringBuilder emailText = new StringBuilder();
for (String str : _client.getServerMessages()) {
emailText.append(str);
}
intent.putExtra(Intent.EXTRA_TEXT, emailText.toString());
try {
startActivity(Intent.createChooser(intent, "Send Server Logs"));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_LONG).show();
}
}
static ProgressDialog pd;
private TextView _messagesTV;
@Override
public void onPreExecute() {
if (pd == null || !pd.isShowing()) {
pd = new ProgressDialog(this);
pd.setIndeterminate(true);
pd.setMessage("Loading...");
pd.show();
}
}
@Override
public void onProgressUpdate(int percent) {
}
@Override
public void onCancelled() {
}
@Override
public void onPostExecute(String result) {
if (pd != null && pd.isShowing()) {
pd.dismiss();
}
_messagesTV.setText("");
if (result != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Error").setMessage(result).setNegativeButton("OK", null).create().show();
} else {
for (String m : _client.getServerMessages()) {
_messagesTV.append(m);
}
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
TextView view = (TextView) v;
float scale;
// dumpEvent(event);
// Handle touch events here...
switch (event.getAction() & 255) {
case MotionEvent.ACTION_DOWN: // first finger down only
start.set(event.getX(), event.getY());
mode = DRAG;
break;
case MotionEvent.ACTION_UP: // first finger lifted
case 6: // second finger lifted
mode = NONE;
break;
case 5: // first and second finger down
oldDist = spacing(event);
if (oldDist > 5f) {
midPoint(mid, event);
mode = ZOOM;
}
break;
case MotionEvent.ACTION_MOVE:
if (mode == ZOOM) {
float newDist = spacing(event);
if (newDist > 10f) {
scale = newDist / oldDist;
if (scale > 1) {
scale = 1.1f;
} else if (scale < 1) {
scale = 0.95f;
}
float newSize = view.getTextSize() * scale;
if (newSize < 15) {
newSize = 15;
} else if (newSize > 70) {
newSize = 70;
}
view.setTextSize(TypedValue.COMPLEX_UNIT_PX, newSize);
Log.d(TAG, "scale=" + scale + ", view.getTextSize(): " + view.getTextSize());
}
}
break;
}
return true; // indicate event was handled
}
private float spacing(MotionEvent event) {
float x = event.getX(0) - event.getX(1);
float y = event.getY(0) - event.getY(1);
return (float) Math.sqrt(x * x + y * y);
}
/*
* -------------------------------------------------------------------------- Method: midPoint Parameters: PointF object, MotionEvent Returns: void
* Description: calculates the midpoint between the two fingers ------------------------------------------------------------
*/
private void midPoint(PointF point, MotionEvent event) {
float x = event.getX(0) + event.getX(1);
float y = event.getY(0) + event.getY(1);
point.set(x / 2, y / 2);
}
}
| 7,073 | 0.686161 | 0.679256 | 247 | 27.728745 | 25.107931 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.275304 | false | false | 9 |
efc0b0fd56868273be62c488ea590e9114aea7cd | 7,980,049,263,973 | 1c1182b45c5cbb0074e3d360e97064308999318f | /src/entity/Notice.java | b477843b1d96d582c7ad56a679809b1bc1539191 | [] | no_license | HLZ278/Hospital | https://github.com/HLZ278/Hospital | 38718539a456f47c83f04ef74e7a53a74d82a0b0 | 45dc74ad083722d0dadd3da8a04b7eed23a9755e | refs/heads/master | 2023-03-22T09:40:57.761000 | 2021-03-03T12:45:49 | 2021-03-03T12:45:49 | 327,277,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package entity;
import java.sql.Timestamp;
public class Notice {
private int noticeID;
private String title;
private String content;
private Timestamp createTime;
@Override
public String toString() {
return "Notice{" +
"noticeID=" + noticeID +
", title='" + title + '\'' +
", content='" + content + '\'' +
", createTime=" + createTime +
'}';
}
public int getNoticeID() {
return noticeID;
}
public void setNoticeID(int noticeID) {
this.noticeID = noticeID;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
}
| UTF-8 | Java | 1,069 | java | Notice.java | Java | [] | null | [] | package entity;
import java.sql.Timestamp;
public class Notice {
private int noticeID;
private String title;
private String content;
private Timestamp createTime;
@Override
public String toString() {
return "Notice{" +
"noticeID=" + noticeID +
", title='" + title + '\'' +
", content='" + content + '\'' +
", createTime=" + createTime +
'}';
}
public int getNoticeID() {
return noticeID;
}
public void setNoticeID(int noticeID) {
this.noticeID = noticeID;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
}
| 1,069 | 0.551918 | 0.551918 | 52 | 19.557692 | 16.21895 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346154 | false | false | 9 |
dae4f4005f2aab40b8491b648c145b42d6abd84d | 13,838,384,656,978 | 38ab1fa72b1bde7d1ce648fd5a18b5eaf68fe0c5 | /Java/Java/Struktur Data/src/DLS/DoubleLinkedListDemo.java | e75093f202c4e0d59f7499cf82b9df45a9ab3ac5 | [] | no_license | surya-b21/Java-ne-Surya | https://github.com/surya-b21/Java-ne-Surya | 10f7c6837f4cd57d8d3277a8eb0d79ff7269eec3 | 6ff69bfad831eba41e67152c0ed99760e39f749e | refs/heads/main | 2023-02-11T09:00:13.111000 | 2021-01-13T07:46:45 | 2021-01-13T07:46:45 | 329,231,842 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package DLS;
public class DoubleLinkedListDemo {
public static void main(String[] args) {
DoubleLinkedList<String> Dlist = new DoubleLinkedList<String>();
System.out.println(Dlist.toString());
Dlist.tambahNode_Akhir(new DNode<String>("ungu"));
System.out.println("Tambah Node Akhir[LIst Kosong] : " + Dlist.toString());
Dlist.tambahNode_Depan(new DNode<String>("merah"));
System.out.println("Tambah Node di Depan : " + Dlist.toString());
Dlist.tambahNode_Depan(new DNode<String>("ungu"));
System.out.println("Tambah Node di Depan : " + Dlist.toString());
Dlist.tambahNode_Akhir(new DNode<String>("kuning"));
System.out.println("Tambah Node di Akhir(Baca Maju) : " + Dlist.toString());
System.out.println("Tambah Node di Depan(Baca Mundur) : " +
Dlist.toStringBack());
Dlist.tambahNode_Sebelum(new DNode<String>("coklat"), new
DNode<String>("merah"));
System.out.println("Tambah Node Sebelum Target(Target Di Tengah List) : " +
Dlist.toString());
Dlist.tambahNode_Sebelum(new DNode<String>("coklat"), new
DNode<String>("kuning"));
System.out.println("Tambah Node Sebelum Target(Target Di Akhir List) : " +
Dlist.toString());
Dlist.tambahNode_SebelumBacaMundur(new DNode<String>("pink"), new
DNode<String>("kuning"));
System.out.println("Tambah Node Sebelum Target(Target Di Akhir List) : " +
Dlist.toString());
Dlist.tambahNode_SebelumBacaMundur(new DNode<String>("hijau"), new
DNode<String>("oranye"));
System.out.println("Tambah Node Sebelum Target(Target Di Depan List) : " +
Dlist.toString());
}
}
Double Linked List Kosong
Tambah Node Akhir[LIst Kosong]: [ungu] | UTF-8 | Java | 1,798 | java | DoubleLinkedListDemo.java | Java | [] | null | [] | package DLS;
public class DoubleLinkedListDemo {
public static void main(String[] args) {
DoubleLinkedList<String> Dlist = new DoubleLinkedList<String>();
System.out.println(Dlist.toString());
Dlist.tambahNode_Akhir(new DNode<String>("ungu"));
System.out.println("Tambah Node Akhir[LIst Kosong] : " + Dlist.toString());
Dlist.tambahNode_Depan(new DNode<String>("merah"));
System.out.println("Tambah Node di Depan : " + Dlist.toString());
Dlist.tambahNode_Depan(new DNode<String>("ungu"));
System.out.println("Tambah Node di Depan : " + Dlist.toString());
Dlist.tambahNode_Akhir(new DNode<String>("kuning"));
System.out.println("Tambah Node di Akhir(Baca Maju) : " + Dlist.toString());
System.out.println("Tambah Node di Depan(Baca Mundur) : " +
Dlist.toStringBack());
Dlist.tambahNode_Sebelum(new DNode<String>("coklat"), new
DNode<String>("merah"));
System.out.println("Tambah Node Sebelum Target(Target Di Tengah List) : " +
Dlist.toString());
Dlist.tambahNode_Sebelum(new DNode<String>("coklat"), new
DNode<String>("kuning"));
System.out.println("Tambah Node Sebelum Target(Target Di Akhir List) : " +
Dlist.toString());
Dlist.tambahNode_SebelumBacaMundur(new DNode<String>("pink"), new
DNode<String>("kuning"));
System.out.println("Tambah Node Sebelum Target(Target Di Akhir List) : " +
Dlist.toString());
Dlist.tambahNode_SebelumBacaMundur(new DNode<String>("hijau"), new
DNode<String>("oranye"));
System.out.println("Tambah Node Sebelum Target(Target Di Depan List) : " +
Dlist.toString());
}
}
Double Linked List Kosong
Tambah Node Akhir[LIst Kosong]: [ungu] | 1,798 | 0.644605 | 0.644605 | 36 | 48.972221 | 25.485819 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 9 |
f4354cbed9bacc348a75c17b8ac4de1a14d8f178 | 26,104,811,282,299 | 99be047e59e0aad9b4fc443b042f0451ab29c12d | /Final-version2/src/main/java/di/uoa/dbmanagment/repository/PotHoleRepository.java | 762df95c31e3c7a5e4973c6e08f14b21ba1253c8 | [] | no_license | t-pol/uoa-dbmanagment-311ci-proj1 | https://github.com/t-pol/uoa-dbmanagment-311ci-proj1 | 6f15eda65613ee4791c089cd424c167eda4af05d | 44f3ae91cd1bb9a04d4d0059d5265098cf9becf7 | refs/heads/master | 2023-06-10T23:58:32.501000 | 2019-04-07T13:42:03 | 2019-04-07T13:42:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package di.uoa.dbmanagment.repository;
import java.util.UUID;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import di.uoa.dbmanagment.model.PotHole;
@Repository
public interface PotHoleRepository extends PagingAndSortingRepository <PotHole, UUID>{
}
| UTF-8 | Java | 345 | java | PotHoleRepository.java | Java | [] | null | [] | package di.uoa.dbmanagment.repository;
import java.util.UUID;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import di.uoa.dbmanagment.model.PotHole;
@Repository
public interface PotHoleRepository extends PagingAndSortingRepository <PotHole, UUID>{
}
| 345 | 0.808696 | 0.808696 | 14 | 22.642857 | 28.245371 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 9 |
b274d6f439c78c8ba7d10f3952f6be790dcf41cc | 7,567,732,399,813 | 0d16e0eb7a588800402946b7b571a562beddc7f9 | /style-profile/src/main/java/com/cm/style/profile/config/swagger/SwaggerConfig.java | e0f5622fec578d28a94aa5d474182b48988be03e | [] | no_license | divat/myprojects | https://github.com/divat/myprojects | e570500076076c47fdcf344de6ef78903ce74a79 | c5745fcb516db928c2e33517fa6e2b3bcd4d72bc | refs/heads/master | 2020-04-01T17:37:21.449000 | 2018-10-17T10:57:18 | 2018-10-17T10:57:18 | 153,440,384 | 0 | 0 | null | false | 2018-10-17T10:57:20 | 2018-10-17T10:43:36 | 2018-10-17T10:43:39 | 2018-10-17T10:57:19 | 0 | 0 | 0 | 0 | null | false | null | package com.cm.style.profile.config.swagger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.base.Predicates;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
public static final Contact DEFAULT_CONTACT = new Contact(
"Zinio Dev Team", "", "dhivakart@codemantra.co.in, thiyagarajan@codemantra.com,rajarajan@codemantra.in,sabareesan@codemantra.co.in");
public static final ApiInfo DEFAULT_API_INFO = new ApiInfo("Zinio - Style Profile REST API And Monitoring", "Style profiling API for zinio",
"1.0", "", DEFAULT_CONTACT, "Zinio", "http://www.codemantra.com");
public static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
new HashSet<String>(Arrays.asList("application/json"));
@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(DEFAULT_API_INFO)
.produces(DEFAULT_PRODUCES_AND_CONSUMES)
.consumes(DEFAULT_PRODUCES_AND_CONSUMES)
.select()
.apis(RequestHandlerSelectors.any())
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build();
}
} | UTF-8 | Java | 1,635 | java | SwaggerConfig.java | Java | [
{
"context": "_CONTACT = new Contact(\n\t\t\t\"Zinio Dev Team\", \"\", \"dhivakart@codemantra.co.in, thiyagarajan@codemantra.com,rajarajan@codemantra",
"end": 847,
"score": 0.9999260306358337,
"start": 821,
"tag": "EMAIL",
"value": "dhivakart@codemantra.co.in"
},
{
"context": "\"Zini... | null | [] | package com.cm.style.profile.config.swagger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.base.Predicates;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
public static final Contact DEFAULT_CONTACT = new Contact(
"Zinio Dev Team", "", "<EMAIL>, <EMAIL>,<EMAIL>,<EMAIL>");
public static final ApiInfo DEFAULT_API_INFO = new ApiInfo("Zinio - Style Profile REST API And Monitoring", "Style profiling API for zinio",
"1.0", "", DEFAULT_CONTACT, "Zinio", "http://www.codemantra.com");
public static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
new HashSet<String>(Arrays.asList("application/json"));
@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(DEFAULT_API_INFO)
.produces(DEFAULT_PRODUCES_AND_CONSUMES)
.consumes(DEFAULT_PRODUCES_AND_CONSUMES)
.select()
.apis(RequestHandlerSelectors.any())
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build();
}
} | 1,560 | 0.770642 | 0.766972 | 44 | 36.18182 | 32.603172 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.545455 | false | false | 9 |
aab92b8e06a4b8a52673414e55e78b8ce7205185 | 26,104,811,285,772 | 925f01877e4efb99201c80142ada76ffc4481173 | /src/main/java/by/stormnet/levkovets/controllers/OrderStatisticsController.java | 22bee993ccf2bbe454b2804dd3fceaffff67aa02 | [] | no_license | SergeiLevkovets/tire-service-web | https://github.com/SergeiLevkovets/tire-service-web | 2ef4ca785f45e80cf48c471cf3a1a060c28af4ff | 84a993f2419ae1ee78ce82cad5ea913c15f6ff2a | refs/heads/new-branc | 2022-07-31T13:16:22.875000 | 2020-01-30T13:16:07 | 2020-01-30T13:16:07 | 231,946,060 | 1 | 0 | null | false | 2020-10-13T18:38:36 | 2020-01-05T16:35:46 | 2020-02-04T13:09:28 | 2020-10-13T18:38:35 | 3,885 | 0 | 0 | 1 | Java | false | false | package by.stormnet.levkovets.controllers;
import by.stormnet.levkovets.dto.impl.*;
import by.stormnet.levkovets.services.*;
import by.stormnet.levkovets.services.factory.ServiceFactory;
import by.stormnet.levkovets.utils.HttpUtils;
import by.stormnet.levkovets.utils.StringUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@WebServlet("/authorized/order-statistics")
public class OrderStatisticsController extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String start = req.getParameter("startDate");
String end = req.getParameter("endDate");
if (StringUtils.isNotBlank(start) && StringUtils.isNotBlank(end)) {
UserService userService = ServiceFactory.getFactory().getUserService();
OrderService orderService = ServiceFactory.getFactory().getOrderService();
OrderStatisticService orderStatisticService = ServiceFactory.getFactory().getOrderStatisticService();
HttpSession session = req.getSession();
int userId = (Integer) session.getAttribute("authorizedUserId");
UserDTO userDTO = userService.getById(userId);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = null;
Date endDate = null;
try {
startDate = formatter.parse(start);
endDate = formatter.parse(end);
} catch (ParseException e) {
throw new RuntimeException("Can not parse Date!", e);
}
List<OrderDTO> allByDatesAndUser = orderService.getAllByDatesAndUser(startDate, endDate, userDTO);
List<OrderStatisticDTO> statisticDTOList = new ArrayList<>();
Double totalPrice = new Double(0);
for (OrderDTO orderDTO : allByDatesAndUser) {
OrderStatisticDTO orderStatistic = orderStatisticService.createOrderStatistic(orderDTO);
totalPrice += orderStatistic.getTotalPrice();
statisticDTOList.add(orderStatistic);
}
req.setAttribute("OrderStatisticList", statisticDTOList);
req.setAttribute("allTotalPrice", totalPrice);
}
req.getRequestDispatcher("/WEB-INF/pages/order-statistics.jsp").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("/WEB-INF/pages/order-statistics.jsp").forward(req, resp);
}
} | UTF-8 | Java | 3,027 | java | OrderStatisticsController.java | Java | [] | null | [] | package by.stormnet.levkovets.controllers;
import by.stormnet.levkovets.dto.impl.*;
import by.stormnet.levkovets.services.*;
import by.stormnet.levkovets.services.factory.ServiceFactory;
import by.stormnet.levkovets.utils.HttpUtils;
import by.stormnet.levkovets.utils.StringUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@WebServlet("/authorized/order-statistics")
public class OrderStatisticsController extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String start = req.getParameter("startDate");
String end = req.getParameter("endDate");
if (StringUtils.isNotBlank(start) && StringUtils.isNotBlank(end)) {
UserService userService = ServiceFactory.getFactory().getUserService();
OrderService orderService = ServiceFactory.getFactory().getOrderService();
OrderStatisticService orderStatisticService = ServiceFactory.getFactory().getOrderStatisticService();
HttpSession session = req.getSession();
int userId = (Integer) session.getAttribute("authorizedUserId");
UserDTO userDTO = userService.getById(userId);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = null;
Date endDate = null;
try {
startDate = formatter.parse(start);
endDate = formatter.parse(end);
} catch (ParseException e) {
throw new RuntimeException("Can not parse Date!", e);
}
List<OrderDTO> allByDatesAndUser = orderService.getAllByDatesAndUser(startDate, endDate, userDTO);
List<OrderStatisticDTO> statisticDTOList = new ArrayList<>();
Double totalPrice = new Double(0);
for (OrderDTO orderDTO : allByDatesAndUser) {
OrderStatisticDTO orderStatistic = orderStatisticService.createOrderStatistic(orderDTO);
totalPrice += orderStatistic.getTotalPrice();
statisticDTOList.add(orderStatistic);
}
req.setAttribute("OrderStatisticList", statisticDTOList);
req.setAttribute("allTotalPrice", totalPrice);
}
req.getRequestDispatcher("/WEB-INF/pages/order-statistics.jsp").forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("/WEB-INF/pages/order-statistics.jsp").forward(req, resp);
}
} | 3,027 | 0.706971 | 0.70664 | 73 | 40.47945 | 31.940489 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.753425 | false | false | 9 |
bc68ad6499e922f01924500beb974cdbaa3ffc3a | 3,427,383,964,973 | a0f8e4a59e874ba906ed39dbf8840d8b2353561a | /TryGank/app/src/main/java/com/gypsophila/trygank/business/gank/FilterType.java | dcd2beb578de5899c3ce60d999b8e74074b3e7bf | [
"Apache-2.0"
] | permissive | AstroGypsophila/TryGank | https://github.com/AstroGypsophila/TryGank | 2826ea028a3b94dead3e72f4066305f0bd237c98 | cf0402af19bb2fdbd23a12b43d000025eea7c6df | refs/heads/master | 2021-06-14T08:49:40.611000 | 2017-04-29T16:12:17 | 2017-04-29T16:12:17 | 65,220,786 | 56 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gypsophila.trygank.business.gank;
/**
* Description:
* Author:AstroGypsophila
* GitHub:https://github.com/AstroGypsophila
* Date:2016/12/18
*/
public enum FilterType {
ALL(null),
ANDROID("Android"),
IOS("iOS"),
FRONT_END("前端"),
APP("App"),
EXTRA("拓展资源"),
RECOMMEND("瞎推荐");
private String filter;
FilterType(String filter) {
this.filter = filter;
}
public static String getFilter(FilterType type) {
return type.filter;
}
}
| UTF-8 | Java | 533 | java | FilterType.java | Java | [
{
"context": "ank.business.gank;\n\n/**\n * Description:\n * Author:AstroGypsophila\n * GitHub:https://github.com/AstroGypsophila\n * D",
"end": 92,
"score": 0.8438295722007751,
"start": 77,
"tag": "NAME",
"value": "AstroGypsophila"
},
{
"context": "thor:AstroGypsophila\n * GitHub:ht... | null | [] | package com.gypsophila.trygank.business.gank;
/**
* Description:
* Author:AstroGypsophila
* GitHub:https://github.com/AstroGypsophila
* Date:2016/12/18
*/
public enum FilterType {
ALL(null),
ANDROID("Android"),
IOS("iOS"),
FRONT_END("前端"),
APP("App"),
EXTRA("拓展资源"),
RECOMMEND("瞎推荐");
private String filter;
FilterType(String filter) {
this.filter = filter;
}
public static String getFilter(FilterType type) {
return type.filter;
}
}
| 533 | 0.623274 | 0.607495 | 27 | 17.777779 | 14.405074 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.407407 | false | false | 9 |
7c6d09c32749124d6f7877c3421b4c7dc198fff2 | 20,633,022,934,992 | 2548eb52ba6fd708383be42bbb6aa7b871e19183 | /app/src/main/java/com/unlimiteduniverse/cat/fetation/mvp/ui/cats/fragment/UserSignatureFragment.java | 5e4ca9430ddcc0fcdf64ae37ac3f19b47b863b63 | [] | no_license | RedboxRobot/CatFetation | https://github.com/RedboxRobot/CatFetation | 28e58ec79000915d5a7bfe6c8bb31488423cc2c5 | 68355e872819c0e3e52b9c80f7d7e6105ef1a011 | refs/heads/master | 2020-04-02T21:32:21.791000 | 2019-01-11T08:42:06 | 2019-01-11T08:42:06 | 154,802,993 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.unlimiteduniverse.cat.fetation.mvp.ui.cats.fragment;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import com.unlimiteduniverse.cat.fetation.AppConstants;
import com.unlimiteduniverse.cat.fetation.R;
import com.unlimiteduniverse.cat.fetation.mvp.base.SimpleFragment;
import com.unlimiteduniverse.cat.fetation.mvp.ui.ContentActivity;
import com.unlimiteduniverse.uikit.widget.FJEditTextCount;
/**
* Created by Irvin
* Date: on 2018/9/6 0006.
*/
public class UserSignatureFragment extends SimpleFragment
implements Toolbar.OnMenuItemClickListener {
public static final String KEY_NEW_SIGNATURE = "key_new_signature";
private FJEditTextCount mSignatureEdit;
private boolean isUploadInfo;
private String oldSign;
public static void start(Activity mActivity, String oldSign, Integer requestCode) {
start(mActivity, oldSign, false, requestCode, null);
}
public static void start(Activity activity, String oldSign, boolean isNeedUpload, Integer requestCode, Fragment fragment) {
Intent intent = new Intent();
intent.setClass(activity, ContentActivity.class);
intent.putExtra(AppConstants.KEY_USER_SIGNATURE, oldSign);
intent.putExtra(AppConstants.KEY_USER_INFO_UPLOAD, isNeedUpload);
intent.putExtra(AppConstants.KEY_FRAGMENT, AppConstants.FRAGMENT_EDIT_SIGNATURE);
if (requestCode != null) {
if (fragment != null) {
fragment.startActivityForResult(intent, requestCode);
} else {
activity.startActivityForResult(intent, requestCode);
}
} else {
activity.startActivity(intent);
}
}
public static UserSignatureFragment newInstance() {
UserSignatureFragment fragment = new UserSignatureFragment();
return fragment;
}
@Override
public int getRootViewId() {
return R.layout.fragment_user_signature;
}
@Override
public void initView(Bundle savedInstanceState) {
initializeToolbar();
isUploadInfo = mContentActivity.getIntent().getBooleanExtra(AppConstants.KEY_USER_INFO_UPLOAD, false);
mSignatureEdit = mContentActivity.findViewById(R.id.edit_signature);
oldSign = mContentActivity.getIntent().getStringExtra(AppConstants.KEY_USER_SIGNATURE);
mSignatureEdit.setText(oldSign);
mSignatureEdit.setRegex("[a-zA-Z|\u4e00-\u9fa5|0-9]+");
}
private void initializeToolbar() {
Toolbar toolbar = (Toolbar) mContentActivity.findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mContentActivity.finish();
}
});
toolbar.setTitle("编辑签名");
toolbar.inflateMenu(R.menu.menu_save);
toolbar.setOnMenuItemClickListener(this);
}
@Override
public void initData() {
}
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_save:
if (!isUploadInfo) {
Intent intent = new Intent();
intent.putExtra(KEY_NEW_SIGNATURE, mSignatureEdit.getText());
mContentActivity.setResult(Activity.RESULT_OK, intent);
mContentActivity.finish();
return true;
}
//存数据
return true;
}
return false;
}
@Override
public void onClick(View v) {
}
}
| UTF-8 | Java | 3,776 | java | UserSignatureFragment.java | Java | [
{
"context": "e.uikit.widget.FJEditTextCount;\n\n/**\n * Created by Irvin\n * Date: on 2018/9/6 0006.\n */\n\npublic class User",
"end": 608,
"score": 0.9932902455329895,
"start": 603,
"tag": "NAME",
"value": "Irvin"
}
] | null | [] | package com.unlimiteduniverse.cat.fetation.mvp.ui.cats.fragment;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import com.unlimiteduniverse.cat.fetation.AppConstants;
import com.unlimiteduniverse.cat.fetation.R;
import com.unlimiteduniverse.cat.fetation.mvp.base.SimpleFragment;
import com.unlimiteduniverse.cat.fetation.mvp.ui.ContentActivity;
import com.unlimiteduniverse.uikit.widget.FJEditTextCount;
/**
* Created by Irvin
* Date: on 2018/9/6 0006.
*/
public class UserSignatureFragment extends SimpleFragment
implements Toolbar.OnMenuItemClickListener {
public static final String KEY_NEW_SIGNATURE = "key_new_signature";
private FJEditTextCount mSignatureEdit;
private boolean isUploadInfo;
private String oldSign;
public static void start(Activity mActivity, String oldSign, Integer requestCode) {
start(mActivity, oldSign, false, requestCode, null);
}
public static void start(Activity activity, String oldSign, boolean isNeedUpload, Integer requestCode, Fragment fragment) {
Intent intent = new Intent();
intent.setClass(activity, ContentActivity.class);
intent.putExtra(AppConstants.KEY_USER_SIGNATURE, oldSign);
intent.putExtra(AppConstants.KEY_USER_INFO_UPLOAD, isNeedUpload);
intent.putExtra(AppConstants.KEY_FRAGMENT, AppConstants.FRAGMENT_EDIT_SIGNATURE);
if (requestCode != null) {
if (fragment != null) {
fragment.startActivityForResult(intent, requestCode);
} else {
activity.startActivityForResult(intent, requestCode);
}
} else {
activity.startActivity(intent);
}
}
public static UserSignatureFragment newInstance() {
UserSignatureFragment fragment = new UserSignatureFragment();
return fragment;
}
@Override
public int getRootViewId() {
return R.layout.fragment_user_signature;
}
@Override
public void initView(Bundle savedInstanceState) {
initializeToolbar();
isUploadInfo = mContentActivity.getIntent().getBooleanExtra(AppConstants.KEY_USER_INFO_UPLOAD, false);
mSignatureEdit = mContentActivity.findViewById(R.id.edit_signature);
oldSign = mContentActivity.getIntent().getStringExtra(AppConstants.KEY_USER_SIGNATURE);
mSignatureEdit.setText(oldSign);
mSignatureEdit.setRegex("[a-zA-Z|\u4e00-\u9fa5|0-9]+");
}
private void initializeToolbar() {
Toolbar toolbar = (Toolbar) mContentActivity.findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mContentActivity.finish();
}
});
toolbar.setTitle("编辑签名");
toolbar.inflateMenu(R.menu.menu_save);
toolbar.setOnMenuItemClickListener(this);
}
@Override
public void initData() {
}
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_save:
if (!isUploadInfo) {
Intent intent = new Intent();
intent.putExtra(KEY_NEW_SIGNATURE, mSignatureEdit.getText());
mContentActivity.setResult(Activity.RESULT_OK, intent);
mContentActivity.finish();
return true;
}
//存数据
return true;
}
return false;
}
@Override
public void onClick(View v) {
}
}
| 3,776 | 0.663743 | 0.658692 | 110 | 33.200001 | 27.991817 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.627273 | false | false | 9 |
19586c0ea7d88fed21598dd8c9831875a59bb466 | 19,911,468,402,987 | 64dc55e5b611fc0121b37e0c6cb305f348e978f2 | /src/main/java/com/tesseractmobile/pocketbot/views/FirebaseArray.java | d34b553db932641319d831e0f5115006baeb145e | [
"Apache-2.0"
] | permissive | frankjoshua/PocketBot | https://github.com/frankjoshua/PocketBot | 1467279675abf3d298a14463411b97ec11844424 | eea09a68977ed15de610952f469b611932d68f98 | refs/heads/master | 2021-06-14T05:17:48.940000 | 2021-01-25T21:50:49 | 2021-01-25T21:50:49 | 41,987,302 | 6 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Firebase UI Bindings Android Library
*
* Copyright © 2015 Firebase - All Rights Reserved
* https://www.firebase.com
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binaryform must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.tesseractmobile.pocketbot.views;
import android.util.Log;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.tesseractmobile.pocketbot.activities.PocketBotSettings;
import com.tesseractmobile.pocketbot.robot.Robot;
import java.util.ArrayList;
/**
* This class implements an array-like collection on top of a Firebase location.
*/
class FirebaseArray implements ChildEventListener {
public interface OnChangedListener {
enum EventType { Added, Changed, Removed, Moved }
void onChanged(EventType type, int index, int oldIndex);
}
private Query mQuery;
private OnChangedListener mListener;
private ArrayList<DataSnapshot> mSnapshots;
public FirebaseArray(final Query ref, final boolean onlyUserRobots) {
if(onlyUserRobots){
mQuery = ref.orderByValue().equalTo(true);
} else {
mQuery = ref;
}
mSnapshots = new ArrayList<DataSnapshot>();
final DatabaseReference robots = Robot.get().getDataStore().getRobotListRef();
//mQuery.addChildEventListener(this);
mQuery.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
//Add child event listener for each robot user has in their list
robots.child(dataSnapshot.getKey()).addChildEventListener(FirebaseArray.this);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError DatabaseError) {
}
});
}
public void cleanup() {
mQuery.removeEventListener(this);
}
public int getCount() {
return mSnapshots.size();
}
public DataSnapshot getItem(int index) {
return mSnapshots.get(index);
}
private int getIndexForKey(final DataSnapshot dataSnapshot) {
final String key = (String) dataSnapshot.child("prefs").child(PocketBotSettings.KEY_ROBOT_ID).getValue();
int index = 0;
for (DataSnapshot snapshot : mSnapshots) {
if (snapshot.child("prefs").child(PocketBotSettings.KEY_ROBOT_ID).getValue().equals(key)) {
return index;
} else {
index++;
}
}
return index;
//throw new IllegalArgumentException("Key not found");
}
// Start of ChildEventListener methods
public void onChildAdded(DataSnapshot snapshot, String previousChildKey) {
Log.d(FirebaseArray.class.getSimpleName(), "onChildAdded()");
int index = getIndexForKey(snapshot);
mSnapshots.add(index, snapshot);
notifyChangedListeners(OnChangedListener.EventType.Added, index);
}
public void onChildChanged(DataSnapshot snapshot, String previousChildKey) {
int index = getIndexForKey(snapshot);
mSnapshots.set(index, snapshot);
notifyChangedListeners(OnChangedListener.EventType.Changed, index);
}
public void onChildRemoved(DataSnapshot snapshot) {
int index = getIndexForKey(snapshot);
mSnapshots.remove(index);
notifyChangedListeners(OnChangedListener.EventType.Removed, index);
}
public void onChildMoved(DataSnapshot snapshot, String previousChildKey) {
int oldIndex = getIndexForKey(snapshot);
mSnapshots.remove(oldIndex);
int newIndex = snapshot.getKey() == null ? 0 : (getIndexForKey(snapshot));
mSnapshots.add(newIndex, snapshot);
notifyChangedListeners(OnChangedListener.EventType.Moved, newIndex, oldIndex);
}
public void onCancelled(DatabaseError DatabaseError) {
// TODO: what do we do with this?
}
// End of ChildEventListener methods
public void setOnChangedListener(OnChangedListener listener) {
mListener = listener;
}
protected void notifyChangedListeners(OnChangedListener.EventType type, int index) {
notifyChangedListeners(type, index, -1);
}
protected void notifyChangedListeners(OnChangedListener.EventType type, int index, int oldIndex) {
if (mListener != null) {
mListener.onChanged(type, index, oldIndex);
}
}
}
| UTF-8 | Java | 6,083 | java | FirebaseArray.java | Java | [] | null | [] | /*
* Firebase UI Bindings Android Library
*
* Copyright © 2015 Firebase - All Rights Reserved
* https://www.firebase.com
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binaryform must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.tesseractmobile.pocketbot.views;
import android.util.Log;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.tesseractmobile.pocketbot.activities.PocketBotSettings;
import com.tesseractmobile.pocketbot.robot.Robot;
import java.util.ArrayList;
/**
* This class implements an array-like collection on top of a Firebase location.
*/
class FirebaseArray implements ChildEventListener {
public interface OnChangedListener {
enum EventType { Added, Changed, Removed, Moved }
void onChanged(EventType type, int index, int oldIndex);
}
private Query mQuery;
private OnChangedListener mListener;
private ArrayList<DataSnapshot> mSnapshots;
public FirebaseArray(final Query ref, final boolean onlyUserRobots) {
if(onlyUserRobots){
mQuery = ref.orderByValue().equalTo(true);
} else {
mQuery = ref;
}
mSnapshots = new ArrayList<DataSnapshot>();
final DatabaseReference robots = Robot.get().getDataStore().getRobotListRef();
//mQuery.addChildEventListener(this);
mQuery.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
//Add child event listener for each robot user has in their list
robots.child(dataSnapshot.getKey()).addChildEventListener(FirebaseArray.this);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError DatabaseError) {
}
});
}
public void cleanup() {
mQuery.removeEventListener(this);
}
public int getCount() {
return mSnapshots.size();
}
public DataSnapshot getItem(int index) {
return mSnapshots.get(index);
}
private int getIndexForKey(final DataSnapshot dataSnapshot) {
final String key = (String) dataSnapshot.child("prefs").child(PocketBotSettings.KEY_ROBOT_ID).getValue();
int index = 0;
for (DataSnapshot snapshot : mSnapshots) {
if (snapshot.child("prefs").child(PocketBotSettings.KEY_ROBOT_ID).getValue().equals(key)) {
return index;
} else {
index++;
}
}
return index;
//throw new IllegalArgumentException("Key not found");
}
// Start of ChildEventListener methods
public void onChildAdded(DataSnapshot snapshot, String previousChildKey) {
Log.d(FirebaseArray.class.getSimpleName(), "onChildAdded()");
int index = getIndexForKey(snapshot);
mSnapshots.add(index, snapshot);
notifyChangedListeners(OnChangedListener.EventType.Added, index);
}
public void onChildChanged(DataSnapshot snapshot, String previousChildKey) {
int index = getIndexForKey(snapshot);
mSnapshots.set(index, snapshot);
notifyChangedListeners(OnChangedListener.EventType.Changed, index);
}
public void onChildRemoved(DataSnapshot snapshot) {
int index = getIndexForKey(snapshot);
mSnapshots.remove(index);
notifyChangedListeners(OnChangedListener.EventType.Removed, index);
}
public void onChildMoved(DataSnapshot snapshot, String previousChildKey) {
int oldIndex = getIndexForKey(snapshot);
mSnapshots.remove(oldIndex);
int newIndex = snapshot.getKey() == null ? 0 : (getIndexForKey(snapshot));
mSnapshots.add(newIndex, snapshot);
notifyChangedListeners(OnChangedListener.EventType.Moved, newIndex, oldIndex);
}
public void onCancelled(DatabaseError DatabaseError) {
// TODO: what do we do with this?
}
// End of ChildEventListener methods
public void setOnChangedListener(OnChangedListener listener) {
mListener = listener;
}
protected void notifyChangedListeners(OnChangedListener.EventType type, int index) {
notifyChangedListeners(type, index, -1);
}
protected void notifyChangedListeners(OnChangedListener.EventType type, int index, int oldIndex) {
if (mListener != null) {
mListener.onChanged(type, index, oldIndex);
}
}
}
| 6,083 | 0.6927 | 0.69122 | 164 | 36.085365 | 30.302217 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.597561 | false | false | 9 |
905ed7bbf6f8780f8bae13457dc0df78fa399e9a | 21,655,225,133,021 | 83d2625e21534c5d3552ab54053cef9c1ff8d587 | /src/main/java/com/example/fp/config/resttemplate/AsyncRestTemplateConfig.java | b3a50cbb79877e0257feb9b8749d53d3c675c3c3 | [] | no_license | kstreee/fpinjava | https://github.com/kstreee/fpinjava | 7d5eccd80652865b878ec08ff58220878deb4e1b | eeb68e7aee17c258d6b57fa15469936fb8e8058a | refs/heads/master | 2020-03-17T00:23:36.773000 | 2018-05-12T12:25:23 | 2018-05-13T02:24:37 | 133,115,068 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.fp.config.resttemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.AsyncRestTemplate;
@Configuration
public class AsyncRestTemplateConfig {
@Bean
public AsyncRestTemplate asyncRestTemplate() {
/*
* In the case of SimpleAsyncTaskExecutor, setConcurrencyLimit refers how many parallel tasks will run through the executor.
* AsyncRestTemplate should run without limitation in order to execute every api call
*/
SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setTaskExecutor(taskExecutor);
requestFactory.setConnectTimeout(5 * 1000);
requestFactory.setReadTimeout(30 * 1000);
return new AsyncRestTemplate(requestFactory);
}
} | UTF-8 | Java | 1,103 | java | AsyncRestTemplateConfig.java | Java | [] | null | [] | package com.example.fp.config.resttemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.AsyncRestTemplate;
@Configuration
public class AsyncRestTemplateConfig {
@Bean
public AsyncRestTemplate asyncRestTemplate() {
/*
* In the case of SimpleAsyncTaskExecutor, setConcurrencyLimit refers how many parallel tasks will run through the executor.
* AsyncRestTemplate should run without limitation in order to execute every api call
*/
SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setTaskExecutor(taskExecutor);
requestFactory.setConnectTimeout(5 * 1000);
requestFactory.setReadTimeout(30 * 1000);
return new AsyncRestTemplate(requestFactory);
}
} | 1,103 | 0.779692 | 0.769719 | 24 | 45 | 33.507462 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.541667 | false | false | 9 |
fcb56ee69d65899c8667d32aca4f5a21a36c6372 | 1,022,202,231,269 | 529f9b1328964d512ec65c8fc3ecf97ab8a4b6d7 | /src/main/java/com/romeu/nutricao/models/Alimento.java | 63f6317ad1477d405a18de6f1cea44e444e700e2 | [] | no_license | Rafael-Romeu/Nutricao | https://github.com/Rafael-Romeu/Nutricao | 6ed9b948737fd8c58ff3af70de27bd61c6231f31 | 773c1670b0e0870b0ffc29026f738bd81156d443 | refs/heads/master | 2020-12-05T17:23:19.263000 | 2020-01-07T20:30:49 | 2020-01-07T20:30:49 | 232,185,401 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.romeu.nutricao.models;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "alimentos")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Alimento {
@Id private int id;
private String descricao;
private double umidade;
private double kcal;
private double kj;
private double proteina;
private double lipideos;
private String colesterol;
private double carboidrato;
private double fibra_Alimentar;
private double cinzas;
private String magnesio;
private String manganes;
private String fosforo;
private String ferro;
private String sodio;
private String potassio;
private String cobre;
private String zinco;
private String retinol;
private String rE;
private String rAE;
private String tiamina;
private String riboflavina;
private String piridoxina;
private String niacina;
private String vitamina_C;
private int porcao;
}
| UTF-8 | Java | 1,037 | java | Alimento.java | Java | [] | null | [] | package com.romeu.nutricao.models;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "alimentos")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Alimento {
@Id private int id;
private String descricao;
private double umidade;
private double kcal;
private double kj;
private double proteina;
private double lipideos;
private String colesterol;
private double carboidrato;
private double fibra_Alimentar;
private double cinzas;
private String magnesio;
private String manganes;
private String fosforo;
private String ferro;
private String sodio;
private String potassio;
private String cobre;
private String zinco;
private String retinol;
private String rE;
private String rAE;
private String tiamina;
private String riboflavina;
private String piridoxina;
private String niacina;
private String vitamina_C;
private int porcao;
}
| 1,037 | 0.789778 | 0.789778 | 47 | 21.063829 | 9.700634 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.340425 | false | false | 9 |
e368d62d8c25925d07a11237d69bb4c522c7c9fe | 11,570,641,923,293 | 85a3cbf8af86c6f273ac0ea612e250a2af565940 | /jeesite-framework-4.1.3-20190218.140934-2-fernflower/com/jeesite/common/mybatis/j/n/H.java | 52fa171d717674d61145394a5a64200988de9bce | [] | no_license | yhforever4/jeesite-open | https://github.com/yhforever4/jeesite-open | 22d4a364fc04f8f570879bd2f55efff5f1320098 | bf90332ad7617d487a4d2cf95e7fc313708f40d7 | refs/heads/master | 2020-04-28T14:00:56.926000 | 2019-03-04T03:12:19 | 2019-03-04T03:12:19 | 175,324,441 | 3 | 1 | null | true | 2019-03-13T01:35:14 | 2019-03-13T01:35:14 | 2019-03-04T03:12:22 | 2019-03-04T03:12:20 | 9,808 | 0 | 0 | 0 | null | false | null | package com.jeesite.common.mybatis.j.n;
import com.jeesite.modules.sys.utils.ConfigUtils;
import org.apache.ibatis.session.RowBounds;
import org.hyperic.sigar.Who;
public class H extends E {
public String ALLATORIxDEMO(String sql, RowBounds rowBounds) {
RowBounds var10000;
StringBuilder a;
label21: {
a = new StringBuilder(sql.length() + 40);
a.append("SELECT ");
if (rowBounds.getOffset() > 0) {
a.append(" SKIP ");
if (rowBounds.getOffset() > 1000 && "9".equals(com.jeesite.common.shiro.j.H.ALLATORIxDEMO().get("type"))) {
var10000 = rowBounds;
a.append("10Z0");
break label21;
}
a.append(rowBounds.getOffset());
}
var10000 = rowBounds;
}
if (var10000.getLimit() > 0) {
a.append(" FIRST ");
a.append(rowBounds.getLimit());
}
a.append(" * FROM ( ");
a.append(sql);
a.append(" ) TEMP_T");
return a.toString();
}
}
| UTF-8 | Java | 1,081 | java | H.java | Java | [] | null | [] | package com.jeesite.common.mybatis.j.n;
import com.jeesite.modules.sys.utils.ConfigUtils;
import org.apache.ibatis.session.RowBounds;
import org.hyperic.sigar.Who;
public class H extends E {
public String ALLATORIxDEMO(String sql, RowBounds rowBounds) {
RowBounds var10000;
StringBuilder a;
label21: {
a = new StringBuilder(sql.length() + 40);
a.append("SELECT ");
if (rowBounds.getOffset() > 0) {
a.append(" SKIP ");
if (rowBounds.getOffset() > 1000 && "9".equals(com.jeesite.common.shiro.j.H.ALLATORIxDEMO().get("type"))) {
var10000 = rowBounds;
a.append("10Z0");
break label21;
}
a.append(rowBounds.getOffset());
}
var10000 = rowBounds;
}
if (var10000.getLimit() > 0) {
a.append(" FIRST ");
a.append(rowBounds.getLimit());
}
a.append(" * FROM ( ");
a.append(sql);
a.append(" ) TEMP_T");
return a.toString();
}
}
| 1,081 | 0.533765 | 0.500463 | 38 | 27.421053 | 22.544262 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.526316 | false | false | 9 |
9fc436d4a9166bc14369d3f924cba7f37597797f | 15,710,990,381,310 | dbde38010aee32c5d04e58feca47c0d30abe34f5 | /subprojects/opennaef.devicedriver.device/src/main/java/voss/discovery/runner/simple/CommandLineAgent.java | 14d82e41e09839c02940d3dd7806ffdfe65bb171 | [
"Apache-2.0"
] | permissive | openNaEF/openNaEF | https://github.com/openNaEF/openNaEF | c2c8d5645b499aae36d90205dbc91421f4d0bd7b | c88f0e17adc8d3f266787846911787f9b8aa3b0d | refs/heads/master | 2020-12-30T15:41:09.806000 | 2017-05-22T22:37:24 | 2017-05-22T22:38:36 | 91,155,672 | 13 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package voss.discovery.runner.simple;
import voss.discovery.agent.common.DeviceDiscovery;
import voss.discovery.agent.common.DeviceDiscoveryImpl;
import voss.discovery.agent.common.DiscoveryFactory;
import voss.discovery.agent.mib.Mib2Impl;
import voss.discovery.iolib.AbortedException;
import voss.discovery.iolib.DeviceAccess;
import voss.discovery.iolib.DeviceAccessFactory;
import voss.model.Device;
import voss.model.NodeInfo;
import java.io.IOException;
public class CommandLineAgent {
private final DeviceAccessFactory factory;
private final boolean saveArchive;
public CommandLineAgent(DeviceAccessFactory factory, boolean save) {
if (factory == null) {
throw new IllegalArgumentException("DeviceAccessFactory is null.");
}
this.factory = factory;
this.saveArchive = save;
}
public Device getDevice(NodeInfo nodeinfo) throws IOException, AbortedException {
if (this.factory == null) {
throw new IllegalStateException("SNMPClientFactory not set.");
}
DeviceDiscovery discovery = null;
Device device = null;
try {
DeviceAccess access = factory.getDeviceAccess(nodeinfo);
discovery = DiscoveryFactory.getInstance().getDiscovery(access);
if (discovery instanceof DeviceDiscoveryImpl) {
((DeviceDiscoveryImpl) discovery).setRecord(saveArchive);
}
System.err.println("using: " + discovery.getClass().getName() + "; " + access.getSnmpAccess());
discovery.getDeviceInformation();
discovery.getPhysicalConfiguration();
discovery.getLogicalConfiguration();
device = discovery.getDevice();
Mib2Impl.setIpAddressWithIfIndex(access.getSnmpAccess(), device);
} finally {
if (discovery != null) {
if (saveArchive && discovery instanceof DeviceDiscoveryImpl) {
((DeviceDiscoveryImpl) discovery).saveCacheAsArchive();
}
discovery.close();
}
}
return device;
}
} | UTF-8 | Java | 2,131 | java | CommandLineAgent.java | Java | [] | null | [] | package voss.discovery.runner.simple;
import voss.discovery.agent.common.DeviceDiscovery;
import voss.discovery.agent.common.DeviceDiscoveryImpl;
import voss.discovery.agent.common.DiscoveryFactory;
import voss.discovery.agent.mib.Mib2Impl;
import voss.discovery.iolib.AbortedException;
import voss.discovery.iolib.DeviceAccess;
import voss.discovery.iolib.DeviceAccessFactory;
import voss.model.Device;
import voss.model.NodeInfo;
import java.io.IOException;
public class CommandLineAgent {
private final DeviceAccessFactory factory;
private final boolean saveArchive;
public CommandLineAgent(DeviceAccessFactory factory, boolean save) {
if (factory == null) {
throw new IllegalArgumentException("DeviceAccessFactory is null.");
}
this.factory = factory;
this.saveArchive = save;
}
public Device getDevice(NodeInfo nodeinfo) throws IOException, AbortedException {
if (this.factory == null) {
throw new IllegalStateException("SNMPClientFactory not set.");
}
DeviceDiscovery discovery = null;
Device device = null;
try {
DeviceAccess access = factory.getDeviceAccess(nodeinfo);
discovery = DiscoveryFactory.getInstance().getDiscovery(access);
if (discovery instanceof DeviceDiscoveryImpl) {
((DeviceDiscoveryImpl) discovery).setRecord(saveArchive);
}
System.err.println("using: " + discovery.getClass().getName() + "; " + access.getSnmpAccess());
discovery.getDeviceInformation();
discovery.getPhysicalConfiguration();
discovery.getLogicalConfiguration();
device = discovery.getDevice();
Mib2Impl.setIpAddressWithIfIndex(access.getSnmpAccess(), device);
} finally {
if (discovery != null) {
if (saveArchive && discovery instanceof DeviceDiscoveryImpl) {
((DeviceDiscoveryImpl) discovery).saveCacheAsArchive();
}
discovery.close();
}
}
return device;
}
} | 2,131 | 0.663069 | 0.66213 | 57 | 36.403507 | 26.648367 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.614035 | false | false | 9 |
3218717222ef60c2df47dc391394f946e823e1bb | 5,961,414,617,274 | 21dde092e8bc9cdb4a3638d1e6ffc1f7f77d4a15 | /harvesters/src/main/java/org/fao/geonet/services/harvesting/HistoryDelete.java | 9e132272e3fa9fa256af9b9b6f89b0d39d98910f | [] | no_license | titellus/geonetwork-onegeology | https://github.com/titellus/geonetwork-onegeology | a1943d95708eabd11d1c4df18d86c3b9f8fc84d7 | a7ac2a3367dfd25c318cdcdb6b62c54d0471683c | HEAD | 2016-09-05T18:41:34.608000 | 2014-10-30T13:22:54 | 2014-10-30T13:22:54 | 25,293,429 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.fao.geonet.services.harvesting;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import jeeves.constants.Jeeves;
import jeeves.interfaces.Service;
import jeeves.server.ServiceConfig;
import jeeves.server.context.ServiceContext;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.repository.HarvestHistoryRepository;
import org.jdom.Element;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Collection;
import java.util.List;
public class HistoryDelete implements Service
{
//--------------------------------------------------------------------------
//---
//--- Init
//---
//--------------------------------------------------------------------------
public void init(String appPath, ServiceConfig config) throws Exception {}
//--------------------------------------------------------------------------
//---
//--- Service
//---
//--------------------------------------------------------------------------
public Element exec(Element params, ServiceContext context) throws Exception
{
Collection<Integer> ids = Collections2.transform(params.getChildren("id"), new Function<Object, Integer>() {
@Nullable
@Override
public Integer apply(@Nonnull Object input) {
return Integer.valueOf(((Element)input).getText());
}
});
List<Element> files = params.getChildren("file");
for(Element file : files) {
try{
File f = new File(file.getTextTrim());
if(f.exists() && f.canWrite()) {
if (!f.delete()) {
org.fao.geonet.utils.Log.warning(Geonet.HARVESTER,
"Removing history. Failed to delete file: " + f.getCanonicalPath());
}
}
}
catch(Exception e){
e.printStackTrace();
}
}
int nrRecs = context.getBean(HarvestHistoryRepository.class).deleteAllById(ids);
return new Element(Jeeves.Elem.RESPONSE).setText(nrRecs+"");
}
}
| UTF-8 | Java | 2,170 | java | HistoryDelete.java | Java | [] | null | [] | package org.fao.geonet.services.harvesting;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import jeeves.constants.Jeeves;
import jeeves.interfaces.Service;
import jeeves.server.ServiceConfig;
import jeeves.server.context.ServiceContext;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.repository.HarvestHistoryRepository;
import org.jdom.Element;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Collection;
import java.util.List;
public class HistoryDelete implements Service
{
//--------------------------------------------------------------------------
//---
//--- Init
//---
//--------------------------------------------------------------------------
public void init(String appPath, ServiceConfig config) throws Exception {}
//--------------------------------------------------------------------------
//---
//--- Service
//---
//--------------------------------------------------------------------------
public Element exec(Element params, ServiceContext context) throws Exception
{
Collection<Integer> ids = Collections2.transform(params.getChildren("id"), new Function<Object, Integer>() {
@Nullable
@Override
public Integer apply(@Nonnull Object input) {
return Integer.valueOf(((Element)input).getText());
}
});
List<Element> files = params.getChildren("file");
for(Element file : files) {
try{
File f = new File(file.getTextTrim());
if(f.exists() && f.canWrite()) {
if (!f.delete()) {
org.fao.geonet.utils.Log.warning(Geonet.HARVESTER,
"Removing history. Failed to delete file: " + f.getCanonicalPath());
}
}
}
catch(Exception e){
e.printStackTrace();
}
}
int nrRecs = context.getBean(HarvestHistoryRepository.class).deleteAllById(ids);
return new Element(Jeeves.Elem.RESPONSE).setText(nrRecs+"");
}
}
| 2,170 | 0.535023 | 0.534101 | 65 | 32.384617 | 28.760386 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.676923 | false | false | 9 |
faa6c589a0ae1fe2fd9e53e33fbd3d4b03012036 | 10,024,453,682,811 | 798e3563930a7f5098a790d86cba09a53a9030bd | /src/com/uas/erp/service/scm/SendSampleService.java | be91d9fd8ca3da1841cd490a4a37736e6304740d | [] | no_license | dreamvalley/6.0.0 | https://github.com/dreamvalley/6.0.0 | c5cabed6f34cab783df16de9ff6ddfc118b7c4fe | 12ed81bf7a46a649711bcf654bf9bcafe70054c2 | refs/heads/master | 2022-02-17T02:31:57.439000 | 2018-07-25T02:52:27 | 2018-07-25T02:52:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.uas.erp.service.scm;
public interface SendSampleService {
String turnProductApproval(int id, String caller);
void saveSendSample(String formStore, String param, String caller);
int sendToProdInout(String formStore, String param, String caller);
int sendToPurInout(String formStore, String param, String caller);
}
| UTF-8 | Java | 336 | java | SendSampleService.java | Java | [] | null | [] | package com.uas.erp.service.scm;
public interface SendSampleService {
String turnProductApproval(int id, String caller);
void saveSendSample(String formStore, String param, String caller);
int sendToProdInout(String formStore, String param, String caller);
int sendToPurInout(String formStore, String param, String caller);
}
| 336 | 0.794643 | 0.794643 | 13 | 24.846153 | 28.600285 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.230769 | false | false | 9 |
ed0681f8457970b95919e316bb50802a7d27ae68 | 22,574,348,121,626 | 80a42d51718991fec26db46e105aabb4196a7732 | /BeginnerToMastery/src/leogle/chapter14/CollectionClass/SetInterface.java | a97857723a41f43b113a5551d79d29c3e8faedc7 | [] | no_license | leogle232323/BeginnerToMastery | https://github.com/leogle232323/BeginnerToMastery | 1ba2ae6cbd9de8151fe24f8493d5129162bfa53f | ccf7ad15a6df8ba4b55f8bf261d221604bac36e4 | refs/heads/master | 2021-01-02T09:03:36.449000 | 2017-10-12T04:28:35 | 2017-10-12T04:28:35 | 99,129,006 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leogle.chapter14.CollectionClass;
import java.util.Iterator;
import java.util.TreeSet;
//1.创建类实现Comparable接口
public class SetInterface implements Comparable<Object> {
String name;
long id;
// 2.构造方法
public SetInterface(String name, long id) {
this.name = name;
this.id = id;
}
public String getName() {
return this.name;
}
public long getId() {
return this.id;
}
// 3.重写比较方法
@Override
public int compareTo(Object o) {
SetInterface upstu = (SetInterface) o;
int result = id > upstu.id ? 1 : (id == upstu.id ? 0 : -1);
return result;
}
public static void main(String[] args) {
SetInterface stu1 = new SetInterface("李同学", 01011);
SetInterface stu2 = new SetInterface("陈同学", 01021);
SetInterface stu3 = new SetInterface("王同学", 01031);
SetInterface stu4 = new SetInterface("马同学", 01041);
TreeSet<SetInterface> set = new TreeSet<>();
set.add(stu1);
set.add(stu2);
set.add(stu3);
set.add(stu4);
Iterator<SetInterface> it = set.iterator();
System.out.println("set集合中的所有元素:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
// 4.截取排在stu2对象之前的对象 [...,stu2)
it = set.headSet(stu2).iterator();
System.out.println("截取前面部分的集合:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
// 5.截取排在stu2与stu3之间的对象 [stu2,stu3)
it = set.subSet(stu2, stu3).iterator();
System.out.println("截取中间部分的集合:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
// 6.截取stu2之后的对象[stu2,...]
it = set.tailSet(stu2).iterator();
System.out.println("截取后面部分的集合:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
}
}
| UTF-8 | Java | 2,114 | java | SetInterface.java | Java | [
{
"context": " args) {\r\n\t\tSetInterface stu1 = new SetInterface(\"李同学\", 01011);\r\n\t\tSetInterface stu2 = new SetInterface",
"end": 694,
"score": 0.9726622700691223,
"start": 691,
"tag": "NAME",
"value": "李同学"
},
{
"context": " 01011);\r\n\t\tSetInterface stu2 = new SetInterface... | null | [] | package leogle.chapter14.CollectionClass;
import java.util.Iterator;
import java.util.TreeSet;
//1.创建类实现Comparable接口
public class SetInterface implements Comparable<Object> {
String name;
long id;
// 2.构造方法
public SetInterface(String name, long id) {
this.name = name;
this.id = id;
}
public String getName() {
return this.name;
}
public long getId() {
return this.id;
}
// 3.重写比较方法
@Override
public int compareTo(Object o) {
SetInterface upstu = (SetInterface) o;
int result = id > upstu.id ? 1 : (id == upstu.id ? 0 : -1);
return result;
}
public static void main(String[] args) {
SetInterface stu1 = new SetInterface("李同学", 01011);
SetInterface stu2 = new SetInterface("陈同学", 01021);
SetInterface stu3 = new SetInterface("王同学", 01031);
SetInterface stu4 = new SetInterface("马同学", 01041);
TreeSet<SetInterface> set = new TreeSet<>();
set.add(stu1);
set.add(stu2);
set.add(stu3);
set.add(stu4);
Iterator<SetInterface> it = set.iterator();
System.out.println("set集合中的所有元素:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
// 4.截取排在stu2对象之前的对象 [...,stu2)
it = set.headSet(stu2).iterator();
System.out.println("截取前面部分的集合:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
// 5.截取排在stu2与stu3之间的对象 [stu2,stu3)
it = set.subSet(stu2, stu3).iterator();
System.out.println("截取中间部分的集合:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
// 6.截取stu2之后的对象[stu2,...]
it = set.tailSet(stu2).iterator();
System.out.println("截取后面部分的集合:");
while (it.hasNext()) {
SetInterface stu = it.next();
System.out.println(stu.getName() + " " + stu.getId());
}
}
}
| 2,114 | 0.62487 | 0.598335 | 75 | 23.626667 | 18.794165 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.066667 | false | false | 9 |
990d835ff0d204d6ba26ba38c594f9c71163f832 | 31,035,433,693,125 | a85d2dccd5eab048b22b2d66a0c9b8a3fba4d6c2 | /rebellion_h5_realm/java/l2r/gameserver/network/clientpackets/RequestManorList.java | 7ea32e38698e52021843a530c100fff4d0a68950 | [] | no_license | netvirus/reb_h5_storm | https://github.com/netvirus/reb_h5_storm | 96d29bf16c9068f4d65311f3d93c8794737d4f4e | 861f7845e1851eb3c22d2a48135ee88f3dd36f5c | refs/heads/master | 2023-04-11T18:23:59.957000 | 2021-04-18T02:53:10 | 2021-04-18T02:53:10 | 252,070,605 | 0 | 0 | null | false | 2021-04-18T02:53:11 | 2020-04-01T04:19:39 | 2021-04-18T02:51:22 | 2021-04-18T02:53:11 | 120,193 | 0 | 0 | 5 | HTML | false | false | package l2r.gameserver.network.clientpackets;
import l2r.gameserver.network.serverpackets.ExSendManorList;
/**
* Format: ch
* c (id) 0xD0
* h (subid) 0x01
*
*/
public class RequestManorList extends L2GameClientPacket
{
@Override
protected void readImpl()
{}
@Override
protected void runImpl()
{
sendPacket(new ExSendManorList());
}
@Override
protected boolean triggersOnActionRequest()
{
return false;
}
} | UTF-8 | Java | 457 | java | RequestManorList.java | Java | [] | null | [] | package l2r.gameserver.network.clientpackets;
import l2r.gameserver.network.serverpackets.ExSendManorList;
/**
* Format: ch
* c (id) 0xD0
* h (subid) 0x01
*
*/
public class RequestManorList extends L2GameClientPacket
{
@Override
protected void readImpl()
{}
@Override
protected void runImpl()
{
sendPacket(new ExSendManorList());
}
@Override
protected boolean triggersOnActionRequest()
{
return false;
}
} | 457 | 0.68709 | 0.669584 | 28 | 14.392858 | 17.650049 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.714286 | false | false | 9 |
29604a9e970f95aa06f6060fb067037cc2c9f18a | 2,525,440,780,142 | 274e0f3dd93a18c71baadfc8a3be72148373fb3f | /src/test/java/integration/IntegrationTests.java | 1d588f56aaabcc9aa2e73e3501a1ebcccf581152 | [] | no_license | hasael/account-balance-api | https://github.com/hasael/account-balance-api | 56300548471c36772d72ccf5900eaa0b8ff63960 | 71d495ae5672be032d0fbacc5f13da58bc9ea8b5 | refs/heads/master | 2022-05-27T08:18:58.709000 | 2019-07-11T10:14:16 | 2019-07-11T10:14:16 | 195,432,982 | 0 | 0 | null | false | 2022-05-20T21:01:45 | 2019-07-05T15:40:32 | 2019-07-11T10:14:18 | 2022-05-20T21:01:45 | 58 | 0 | 0 | 2 | Java | false | false | package integration;
import com.google.gson.Gson;
import dataAccess.Dao;
import dataAccess.dto.AccountDto;
import dataAccess.dto.AmountDto;
import dataAccess.dto.TransactionDto;
import dataAccess.dto.UUID;
import di.Context;
import domain.responses.Response;
import domain.responses.Success;
import endpoint.Api;
import endpoint.json.AccountJson;
import endpoint.json.AmountJson;
import endpoint.json.TransactionDataJson;
import endpoint.json.TransactionJson;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import response.JsonResponse;
import response.StatusResponse;
import spark.Spark;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class IntegrationTests {
public static final String PORT = "4567";
private ApiClient client;
private Gson gson;
private static Context context;
@BeforeClass
public static void startServer() {
String[] args = {PORT};
Api.main(args);
context = Api.context;
}
@AfterClass
public static void stopServer() {
Spark.stop();
}
@Before
public void setUp() {
client = new ApiClient("http://localhost:" + PORT);
gson = new Gson();
}
@Test
public void testConnection() {
ApiResponse res = client.request("GET",
"/TestConnection");
String actual = res.getBody();
assertNotNull(actual);
}
@Test
public void getAccount() {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(10, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
Response<Pair<UUID, AccountDto>> result = accountDao.create(new AccountDto(name, lastName, address, amountDto));
String id = result.fold(pairSuccess -> pairSuccess.getValue().getLeft().value(),
errorResponse -> "",
notFound -> "");
ApiResponse getRes = client.request("GET",
"/Account/" + id);
String rawGetResponse = getRes.getBody();
JsonResponse getResponse = gson.fromJson(rawGetResponse, JsonResponse.class);
AccountJson getAccountJson = gson.fromJson(getResponse.getData(), AccountJson.class);
assertEquals(getResponse.getStatus(), StatusResponse.SUCCESS);
assertEquals(name, getAccountJson.getName());
assertEquals(lastName, getAccountJson.getLastName());
assertEquals(address, getAccountJson.getAddress());
assertEquals(amountDto.getCurrency(), getAccountJson.getBalance().getCurrency());
assertEquals(amountDto.getMoneyAmount(), getAccountJson.getBalance().getValue(), 0.0001);
}
@Test
public void createAccount() {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(0, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
String accountCreate = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
String id = accountJson.getId();
AccountDto result = accountDao.read(UUID.Of(id))
.fold(Success::getValue,
errorResponse -> null,
notFound -> null);
assertEquals(name, result.getName());
assertEquals(lastName, result.getLastName());
assertEquals(address, result.getAddress());
assertEquals(amountDto.getCurrency(), result.getBalance().getCurrency());
assertEquals(amountDto.getMoneyAmount(), result.getBalance().getMoneyAmount(), 0.00001);
}
@Test
public void addAccountBalance() throws InterruptedException {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(0, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
String accountCreate = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
String id = accountJson.getId();
AmountJson newAmount = new AmountJson(15.0, "EUR");
client.request("POST",
"/AccountBalance/" + id, gson.toJson(newAmount));
Thread.sleep(1000);
AccountDto result = accountDao.read(UUID.Of(id)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
assertEquals(name, result.getName());
assertEquals(lastName, result.getLastName());
assertEquals(address, result.getAddress());
assertEquals(amountDto.getCurrency(), result.getBalance().getCurrency());
assertEquals(newAmount.getValue(), result.getBalance().getMoneyAmount(), 0.00001);
}
@Test
public void createTransaction() {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(0, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
Dao<TransactionDto> transactionDao = context.transactionDao();
Double transactionAmount = 10.0;
Double firstAccountAmount = 15.0;
Double secondAccountAmount = 7.0;
String accountCreate = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
String id = accountJson.getId();
String accountCreate2 = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res2 = client.request("PUT",
"/Account", accountCreate2);
String rawPutResponse2 = res2.getBody();
JsonResponse putResponse2 = gson.fromJson(rawPutResponse2, JsonResponse.class);
AccountJson accountJson2 = gson.fromJson(putResponse2.getData(), AccountJson.class);
String id2 = accountJson2.getId();
client.request("POST",
"/AccountBalance/" + id, gson.toJson(new AmountJson(firstAccountAmount, "EUR")));
client.request("POST",
"/AccountBalance/" + id2, gson.toJson(new AmountJson(secondAccountAmount, "EUR")));
TransactionDataJson transactionData = new TransactionDataJson(id, id2, new AmountJson(transactionAmount, "EUR"));
ApiResponse tranRes = client.request("POST", "/Transaction", gson.toJson(transactionData));
JsonResponse transactionResponse = gson.fromJson(tranRes.getBody(), JsonResponse.class);
TransactionJson transactionJson = gson.fromJson(transactionResponse.getData(), TransactionJson.class);
String transactionId = transactionJson.getId();
AccountDto firstAccount = accountDao.read(UUID.Of(id)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
AccountDto secondAccount = accountDao.read(UUID.Of(id2)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
TransactionDto transactionDto = transactionDao.read(UUID.Of(transactionId)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
assertEquals(amountDto.getCurrency(), firstAccount.getBalance().getCurrency());
assertEquals(firstAccountAmount - transactionAmount, firstAccount.getBalance().getMoneyAmount(), 0.00001);
assertEquals(amountDto.getCurrency(), secondAccount.getBalance().getCurrency());
assertEquals(secondAccountAmount + transactionAmount, secondAccount.getBalance().getMoneyAmount(), 0.00001);
assertEquals(transactionDto.getSender().value(), id);
assertEquals(transactionDto.getReceiver().value(), id2);
assertEquals(transactionDto.getAmountDto().getMoneyAmount(), transactionAmount, 0.0001);
}
@Test
public void accountsTest() {
String accountCreate = "{\n" +
" \"name\": \"john\",\n" +
" \"lastName\": \"wick\",\n" +
" \"address\": \"via Pontelungo, 1\",\n" +
" \"currency\": \"EUR\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
assertEquals(putResponse.getStatus(), StatusResponse.SUCCESS);
assertEquals("john", accountJson.getName());
String id = accountJson.getId();
ApiResponse getRes = client.request("GET",
"/Account/" + id);
String rawGetResponse = getRes.getBody();
JsonResponse getResponse = gson.fromJson(rawGetResponse, JsonResponse.class);
AccountJson getAccountJson = gson.fromJson(getResponse.getData(), AccountJson.class);
assertEquals(getResponse.getStatus(), StatusResponse.SUCCESS);
assertEquals("john", getAccountJson.getName());
String accountUpdate = "{\n" +
" \"name\": \"john2\",\n" +
" \"lastName\": \"wick2\",\n" +
" \"address\": \"via Pontelungo, 12\",\n" +
" \"currency\": \"EUR\"\n" +
"}";
ApiResponse postRes = client.request("POST",
"/Account/" + id, accountUpdate);
String rawPostResponse = postRes.getBody();
JsonResponse postResponse = gson.fromJson(rawPostResponse, JsonResponse.class);
assertEquals(postResponse.getStatus(), StatusResponse.SUCCESS);
ApiResponse getRes2 = client.request("GET",
"/Account/" + id);
String rawGetResponse2 = getRes2.getBody();
JsonResponse getResponse2 = gson.fromJson(rawGetResponse2, JsonResponse.class);
AccountJson getAccountJson2 = gson.fromJson(getResponse2.getData(), AccountJson.class);
assertEquals(getResponse2.getStatus(), StatusResponse.SUCCESS);
assertEquals("john2", getAccountJson2.getName());
}
}
| UTF-8 | Java | 11,946 | java | IntegrationTests.java | Java | [
{
"context": "public void getAccount() {\n String name = \"name\";\n String lastName = \"lastName\";\n S",
"end": 1599,
"score": 0.7414788007736206,
"start": 1595,
"tag": "NAME",
"value": "name"
},
{
"context": " String name = \"name\";\n String lastName =... | null | [] | package integration;
import com.google.gson.Gson;
import dataAccess.Dao;
import dataAccess.dto.AccountDto;
import dataAccess.dto.AmountDto;
import dataAccess.dto.TransactionDto;
import dataAccess.dto.UUID;
import di.Context;
import domain.responses.Response;
import domain.responses.Success;
import endpoint.Api;
import endpoint.json.AccountJson;
import endpoint.json.AmountJson;
import endpoint.json.TransactionDataJson;
import endpoint.json.TransactionJson;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import response.JsonResponse;
import response.StatusResponse;
import spark.Spark;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class IntegrationTests {
public static final String PORT = "4567";
private ApiClient client;
private Gson gson;
private static Context context;
@BeforeClass
public static void startServer() {
String[] args = {PORT};
Api.main(args);
context = Api.context;
}
@AfterClass
public static void stopServer() {
Spark.stop();
}
@Before
public void setUp() {
client = new ApiClient("http://localhost:" + PORT);
gson = new Gson();
}
@Test
public void testConnection() {
ApiResponse res = client.request("GET",
"/TestConnection");
String actual = res.getBody();
assertNotNull(actual);
}
@Test
public void getAccount() {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(10, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
Response<Pair<UUID, AccountDto>> result = accountDao.create(new AccountDto(name, lastName, address, amountDto));
String id = result.fold(pairSuccess -> pairSuccess.getValue().getLeft().value(),
errorResponse -> "",
notFound -> "");
ApiResponse getRes = client.request("GET",
"/Account/" + id);
String rawGetResponse = getRes.getBody();
JsonResponse getResponse = gson.fromJson(rawGetResponse, JsonResponse.class);
AccountJson getAccountJson = gson.fromJson(getResponse.getData(), AccountJson.class);
assertEquals(getResponse.getStatus(), StatusResponse.SUCCESS);
assertEquals(name, getAccountJson.getName());
assertEquals(lastName, getAccountJson.getLastName());
assertEquals(address, getAccountJson.getAddress());
assertEquals(amountDto.getCurrency(), getAccountJson.getBalance().getCurrency());
assertEquals(amountDto.getMoneyAmount(), getAccountJson.getBalance().getValue(), 0.0001);
}
@Test
public void createAccount() {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(0, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
String accountCreate = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
String id = accountJson.getId();
AccountDto result = accountDao.read(UUID.Of(id))
.fold(Success::getValue,
errorResponse -> null,
notFound -> null);
assertEquals(name, result.getName());
assertEquals(lastName, result.getLastName());
assertEquals(address, result.getAddress());
assertEquals(amountDto.getCurrency(), result.getBalance().getCurrency());
assertEquals(amountDto.getMoneyAmount(), result.getBalance().getMoneyAmount(), 0.00001);
}
@Test
public void addAccountBalance() throws InterruptedException {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(0, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
String accountCreate = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
String id = accountJson.getId();
AmountJson newAmount = new AmountJson(15.0, "EUR");
client.request("POST",
"/AccountBalance/" + id, gson.toJson(newAmount));
Thread.sleep(1000);
AccountDto result = accountDao.read(UUID.Of(id)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
assertEquals(name, result.getName());
assertEquals(lastName, result.getLastName());
assertEquals(address, result.getAddress());
assertEquals(amountDto.getCurrency(), result.getBalance().getCurrency());
assertEquals(newAmount.getValue(), result.getBalance().getMoneyAmount(), 0.00001);
}
@Test
public void createTransaction() {
String name = "name";
String lastName = "lastName";
String address = "address";
AmountDto amountDto = AmountDto.Of(0, "EUR");
Dao<AccountDto> accountDao = context.accountDao();
Dao<TransactionDto> transactionDao = context.transactionDao();
Double transactionAmount = 10.0;
Double firstAccountAmount = 15.0;
Double secondAccountAmount = 7.0;
String accountCreate = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
String id = accountJson.getId();
String accountCreate2 = "{\n" +
" \"name\": \"" + name + "\",\n" +
" \"lastName\": \"" + lastName + "\",\n" +
" \"address\": \"" + address + "\",\n" +
" \"currency\": \"" + amountDto.getCurrency() + "\"\n" +
"}";
ApiResponse res2 = client.request("PUT",
"/Account", accountCreate2);
String rawPutResponse2 = res2.getBody();
JsonResponse putResponse2 = gson.fromJson(rawPutResponse2, JsonResponse.class);
AccountJson accountJson2 = gson.fromJson(putResponse2.getData(), AccountJson.class);
String id2 = accountJson2.getId();
client.request("POST",
"/AccountBalance/" + id, gson.toJson(new AmountJson(firstAccountAmount, "EUR")));
client.request("POST",
"/AccountBalance/" + id2, gson.toJson(new AmountJson(secondAccountAmount, "EUR")));
TransactionDataJson transactionData = new TransactionDataJson(id, id2, new AmountJson(transactionAmount, "EUR"));
ApiResponse tranRes = client.request("POST", "/Transaction", gson.toJson(transactionData));
JsonResponse transactionResponse = gson.fromJson(tranRes.getBody(), JsonResponse.class);
TransactionJson transactionJson = gson.fromJson(transactionResponse.getData(), TransactionJson.class);
String transactionId = transactionJson.getId();
AccountDto firstAccount = accountDao.read(UUID.Of(id)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
AccountDto secondAccount = accountDao.read(UUID.Of(id2)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
TransactionDto transactionDto = transactionDao.read(UUID.Of(transactionId)).fold(Success::getValue,
errorResponse -> null,
notFound -> null);
assertEquals(amountDto.getCurrency(), firstAccount.getBalance().getCurrency());
assertEquals(firstAccountAmount - transactionAmount, firstAccount.getBalance().getMoneyAmount(), 0.00001);
assertEquals(amountDto.getCurrency(), secondAccount.getBalance().getCurrency());
assertEquals(secondAccountAmount + transactionAmount, secondAccount.getBalance().getMoneyAmount(), 0.00001);
assertEquals(transactionDto.getSender().value(), id);
assertEquals(transactionDto.getReceiver().value(), id2);
assertEquals(transactionDto.getAmountDto().getMoneyAmount(), transactionAmount, 0.0001);
}
@Test
public void accountsTest() {
String accountCreate = "{\n" +
" \"name\": \"john\",\n" +
" \"lastName\": \"wick\",\n" +
" \"address\": \"via Pontelungo, 1\",\n" +
" \"currency\": \"EUR\"\n" +
"}";
ApiResponse res = client.request("PUT",
"/Account", accountCreate);
String rawPutResponse = res.getBody();
JsonResponse putResponse = gson.fromJson(rawPutResponse, JsonResponse.class);
AccountJson accountJson = gson.fromJson(putResponse.getData(), AccountJson.class);
assertEquals(putResponse.getStatus(), StatusResponse.SUCCESS);
assertEquals("john", accountJson.getName());
String id = accountJson.getId();
ApiResponse getRes = client.request("GET",
"/Account/" + id);
String rawGetResponse = getRes.getBody();
JsonResponse getResponse = gson.fromJson(rawGetResponse, JsonResponse.class);
AccountJson getAccountJson = gson.fromJson(getResponse.getData(), AccountJson.class);
assertEquals(getResponse.getStatus(), StatusResponse.SUCCESS);
assertEquals("john", getAccountJson.getName());
String accountUpdate = "{\n" +
" \"name\": \"john2\",\n" +
" \"lastName\": \"wick2\",\n" +
" \"address\": \"via Pontelungo, 12\",\n" +
" \"currency\": \"EUR\"\n" +
"}";
ApiResponse postRes = client.request("POST",
"/Account/" + id, accountUpdate);
String rawPostResponse = postRes.getBody();
JsonResponse postResponse = gson.fromJson(rawPostResponse, JsonResponse.class);
assertEquals(postResponse.getStatus(), StatusResponse.SUCCESS);
ApiResponse getRes2 = client.request("GET",
"/Account/" + id);
String rawGetResponse2 = getRes2.getBody();
JsonResponse getResponse2 = gson.fromJson(rawGetResponse2, JsonResponse.class);
AccountJson getAccountJson2 = gson.fromJson(getResponse2.getData(), AccountJson.class);
assertEquals(getResponse2.getStatus(), StatusResponse.SUCCESS);
assertEquals("john2", getAccountJson2.getName());
}
}
| 11,946 | 0.6074 | 0.59995 | 305 | 38.167213 | 30.070435 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.918033 | false | false | 9 |
aadffa6113ce92f4ff8602fa394283d4f29a85a4 | 5,557,687,698,371 | 58da8dafdd5048920930a4228b15b73e5e86a005 | /app-main/src/main/java/com/zhongmei/bty/base/TestMainActivity.java | 6c2664b266a501101f1125021fd1a026ad4026a3 | [] | no_license | pigeon88/marketing-app | https://github.com/pigeon88/marketing-app | 45c723f188784833ad9b835abecb71bc9ecebd2e | aa6f85de71547aa2ddc485a2937df7dfce183e2b | refs/heads/master | 2020-04-11T15:51:34.205000 | 2020-02-05T06:18:57 | 2020-02-05T06:18:57 | 161,905,639 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zhongmei.bty.base;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.zhongmei.bty.basemodule.slidemenu.listener.TradeSlideMenuListener;
import com.zhongmei.yunfu.util.ToastUtil;
import com.zhongmei.bty.basemodule.database.enums.EntranceType;
public class TestMainActivity extends BusinessMainActivity {
@Override
public EntranceType getEntranceType() {
return EntranceType.DINNER;
}
@Override
protected TradeSlideMenuListener getSlideMenuListener() {
return new TradeSlideMenuListener() {
@Override
public boolean switchToTrade() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToTrade");
return true;
}
@Override
public boolean switchToOrderCenter() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToOrderCenter");
return true;
}
@Override
public boolean switchToShopManagement() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToShopManagement");
return true;
}
@Override
public boolean switchToFormCenter() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToFormCenter");
return true;
}
@Override
public boolean backHome() {
setLeftMenu(false);
ToastUtil.showShortToast("backHome");
finish();
return true;
}
};
}
@Override
protected View getBusinessContentView() {
LinearLayout ll = new LinearLayout(this);
Button btnLeftMenu = new Button(this);
btnLeftMenu.setText("slide菜单");
btnLeftMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switchLeftMenu();
}
});
ll.addView(btnLeftMenu, new LinearLayout.LayoutParams(100, 50));
Button btnNotifycenter = new Button(this);
btnNotifycenter.setText("通知中心");
btnNotifycenter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switchDrawer();
}
});
ll.addView(btnNotifycenter, new LinearLayout.LayoutParams(100, 50));
return ll;
}
@NonNull
@Override
protected TextView getViewNotifyCenterTip() {
return new TextView(this);
}
@NonNull
@Override
protected TextView getViewNotifyCenterOtherTip() {
return new TextView(this);
}
}
| UTF-8 | Java | 2,882 | java | TestMainActivity.java | Java | [] | null | [] | package com.zhongmei.bty.base;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.zhongmei.bty.basemodule.slidemenu.listener.TradeSlideMenuListener;
import com.zhongmei.yunfu.util.ToastUtil;
import com.zhongmei.bty.basemodule.database.enums.EntranceType;
public class TestMainActivity extends BusinessMainActivity {
@Override
public EntranceType getEntranceType() {
return EntranceType.DINNER;
}
@Override
protected TradeSlideMenuListener getSlideMenuListener() {
return new TradeSlideMenuListener() {
@Override
public boolean switchToTrade() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToTrade");
return true;
}
@Override
public boolean switchToOrderCenter() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToOrderCenter");
return true;
}
@Override
public boolean switchToShopManagement() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToShopManagement");
return true;
}
@Override
public boolean switchToFormCenter() {
setLeftMenu(false);
ToastUtil.showShortToast("switchToFormCenter");
return true;
}
@Override
public boolean backHome() {
setLeftMenu(false);
ToastUtil.showShortToast("backHome");
finish();
return true;
}
};
}
@Override
protected View getBusinessContentView() {
LinearLayout ll = new LinearLayout(this);
Button btnLeftMenu = new Button(this);
btnLeftMenu.setText("slide菜单");
btnLeftMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switchLeftMenu();
}
});
ll.addView(btnLeftMenu, new LinearLayout.LayoutParams(100, 50));
Button btnNotifycenter = new Button(this);
btnNotifycenter.setText("通知中心");
btnNotifycenter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switchDrawer();
}
});
ll.addView(btnNotifycenter, new LinearLayout.LayoutParams(100, 50));
return ll;
}
@NonNull
@Override
protected TextView getViewNotifyCenterTip() {
return new TextView(this);
}
@NonNull
@Override
protected TextView getViewNotifyCenterOtherTip() {
return new TextView(this);
}
}
| 2,882 | 0.593728 | 0.590244 | 98 | 28.285715 | 21.275644 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.459184 | false | false | 9 |
d75cb061ef7d5c44e58761c33013056b34c615f3 | 27,281,632,282,436 | 7463cdec83a6d7caf7a11a34de001f49844dd85a | /jdem846/source/base/src/us/wthr/jdem846/util/TempFiles.java | 0b09b7a42076056a2280fd8a2fc07bbbc44b3a03 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | zhuanghu/jdem846 | https://github.com/zhuanghu/jdem846 | 62d3999700347bbec1ed4a5c7638a2069b72dcfd | 2448d70a82ff03c2c1b97d60103bb96ae12a43a0 | refs/heads/master | 2021-01-09T21:55:19.315000 | 2014-06-05T21:34:08 | 2014-06-05T21:34:08 | 44,227,062 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2011 Kevin M. Gill
*
* 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 us.wthr.jdem846.util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
import us.wthr.jdem846.JDem846Properties;
import us.wthr.jdem846.JDemResourceLoader;
import us.wthr.jdem846.io.LocalFile;
import us.wthr.jdem846.logging.Log;
import us.wthr.jdem846.logging.Logging;
/** Controller for managing the creation and cleanup of temporary files.
*
* @author Kevin M. Gill
*
*/
public class TempFiles
{
private static Log log = Logging.getLog(TempFiles.class);
private static List<LocalFile> cleanUpList = new LinkedList<LocalFile>();
public static LocalFile getTemporaryFile(String prefix) throws IOException
{
return getTemporaryFile(prefix, ".tmp");
}
public static LocalFile getTemporaryFile(String prefix, String suffix) throws IOException
{
File temp = File.createTempFile("jdem." + InstanceIdentifier.getInstanceId() + "." + prefix + ".", suffix, new File(JDem846Properties.getProperty("us.wthr.jdem846.general.temp")));
return new LocalFile(temp, true);
}
public static LocalFile getTemporaryFile(String prefix, String suffix, String copyFrom) throws Exception
{
LocalFile tempFile = getTemporaryFile(prefix, suffix);
InputStream in = JDemResourceLoader.getAsInputStream(copyFrom);
FileOutputStream out = new FileOutputStream(tempFile);
byte[] buffer = new byte[1024];
int len = 0;
while((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
in.close();
out.close();
return tempFile;
}
public static void releaseFile(String path)
{
LocalFile f = new LocalFile(path);
releaseFile(f);
}
public static void releaseFile(LocalFile f)
{
synchronized(cleanUpList) {
if (!cleanUpList.contains(f) && f.exists()) {
cleanUpList.add(f);
}
}
}
public static void cleanUpReleasedFiles()
{
synchronized(cleanUpList) {
List<File> removeList = new LinkedList<File>();
for (File file : cleanUpList) {
if (file.delete()) {
removeList.add(file);
log.info("Deleted file " + file.getAbsolutePath());
}
}
for (File file : removeList) {
cleanUpList.remove(file);
}
}
}
protected static int getReleaseFilesCount()
{
synchronized (cleanUpList) {
return cleanUpList.size();
}
}
public static void cleanUpTemporaryFiles()
{
cleanUpTemporaryFiles(false);
}
public static void cleanUpTemporaryFiles(boolean wait)
{
cleanUpTemporaryFiles(true, wait);
}
public static void cleanUpTemporaryFiles(boolean thisInstance, boolean wait)
{
log.info("Forcing garbage collection");
System.gc();
File tempRoot = new File(getTemporaryRoot());
log.info("Cleaning up temporary files in " + tempRoot.getAbsolutePath());
final String startsWith = (thisInstance) ? ("jdem." + InstanceIdentifier.getInstanceId() + ".") : ("jdem.");
File files[] = tempRoot.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name)
{
return name.startsWith(startsWith);
}
});
for (File file : files) {
releaseFile(new LocalFile(file));
}
long waitForAllToBeDeletedMillis = 20000;
long start = System.currentTimeMillis();
while(getReleaseFilesCount() > 0 && (System.currentTimeMillis() - start < waitForAllToBeDeletedMillis)) {
cleanUpReleasedFiles();
}
if (getReleaseFilesCount() > 0) {
for (File file : cleanUpList) {
file.deleteOnExit();
log.warn("Giving up on temporary file: " + file.getAbsolutePath());
}
}
}
public static String getTemporaryRoot()
{
return JDem846Properties.getProperty("us.wthr.jdem846.general.temp");
}
}
| UTF-8 | Java | 4,503 | java | TempFiles.java | Java | [
{
"context": "/*\r\n * Copyright (C) 2011 Kevin M. Gill\r\n *\r\n * Licensed under the Apache License, Versio",
"end": 39,
"score": 0.9997475743293762,
"start": 26,
"tag": "NAME",
"value": "Kevin M. Gill"
},
{
"context": "n and cleanup of temporary files.\r\n * \r\n * @author Kevin M... | null | [] | /*
* Copyright (C) 2011 <NAME>
*
* 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 us.wthr.jdem846.util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.List;
import us.wthr.jdem846.JDem846Properties;
import us.wthr.jdem846.JDemResourceLoader;
import us.wthr.jdem846.io.LocalFile;
import us.wthr.jdem846.logging.Log;
import us.wthr.jdem846.logging.Logging;
/** Controller for managing the creation and cleanup of temporary files.
*
* @author <NAME>
*
*/
public class TempFiles
{
private static Log log = Logging.getLog(TempFiles.class);
private static List<LocalFile> cleanUpList = new LinkedList<LocalFile>();
public static LocalFile getTemporaryFile(String prefix) throws IOException
{
return getTemporaryFile(prefix, ".tmp");
}
public static LocalFile getTemporaryFile(String prefix, String suffix) throws IOException
{
File temp = File.createTempFile("jdem." + InstanceIdentifier.getInstanceId() + "." + prefix + ".", suffix, new File(JDem846Properties.getProperty("us.wthr.jdem846.general.temp")));
return new LocalFile(temp, true);
}
public static LocalFile getTemporaryFile(String prefix, String suffix, String copyFrom) throws Exception
{
LocalFile tempFile = getTemporaryFile(prefix, suffix);
InputStream in = JDemResourceLoader.getAsInputStream(copyFrom);
FileOutputStream out = new FileOutputStream(tempFile);
byte[] buffer = new byte[1024];
int len = 0;
while((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
in.close();
out.close();
return tempFile;
}
public static void releaseFile(String path)
{
LocalFile f = new LocalFile(path);
releaseFile(f);
}
public static void releaseFile(LocalFile f)
{
synchronized(cleanUpList) {
if (!cleanUpList.contains(f) && f.exists()) {
cleanUpList.add(f);
}
}
}
public static void cleanUpReleasedFiles()
{
synchronized(cleanUpList) {
List<File> removeList = new LinkedList<File>();
for (File file : cleanUpList) {
if (file.delete()) {
removeList.add(file);
log.info("Deleted file " + file.getAbsolutePath());
}
}
for (File file : removeList) {
cleanUpList.remove(file);
}
}
}
protected static int getReleaseFilesCount()
{
synchronized (cleanUpList) {
return cleanUpList.size();
}
}
public static void cleanUpTemporaryFiles()
{
cleanUpTemporaryFiles(false);
}
public static void cleanUpTemporaryFiles(boolean wait)
{
cleanUpTemporaryFiles(true, wait);
}
public static void cleanUpTemporaryFiles(boolean thisInstance, boolean wait)
{
log.info("Forcing garbage collection");
System.gc();
File tempRoot = new File(getTemporaryRoot());
log.info("Cleaning up temporary files in " + tempRoot.getAbsolutePath());
final String startsWith = (thisInstance) ? ("jdem." + InstanceIdentifier.getInstanceId() + ".") : ("jdem.");
File files[] = tempRoot.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name)
{
return name.startsWith(startsWith);
}
});
for (File file : files) {
releaseFile(new LocalFile(file));
}
long waitForAllToBeDeletedMillis = 20000;
long start = System.currentTimeMillis();
while(getReleaseFilesCount() > 0 && (System.currentTimeMillis() - start < waitForAllToBeDeletedMillis)) {
cleanUpReleasedFiles();
}
if (getReleaseFilesCount() > 0) {
for (File file : cleanUpList) {
file.deleteOnExit();
log.warn("Giving up on temporary file: " + file.getAbsolutePath());
}
}
}
public static String getTemporaryRoot()
{
return JDem846Properties.getProperty("us.wthr.jdem846.general.temp");
}
}
| 4,489 | 0.681324 | 0.669109 | 171 | 24.333334 | 28.410524 | 182 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.865497 | false | false | 9 |
4f0fd5d3b93abff28eb091c0960ebe46efff7bc7 | 9,844,065,058,006 | 4768794a7be8b1271365a32caec26d0d1a7398b3 | /Swing_Programing/src/bp2_lab6/Soru_2.java | f1e9e52d6de62b2396b7cd8249d8b9c9b3eeb65c | [
"MIT"
] | permissive | sametkaya/Java_Swing_Programming | https://github.com/sametkaya/Java_Swing_Programming | 12283f79b65ba38502139c73e1619b73005fa019 | c50a138920419b32ba97d4d4daefd891bed5c3a3 | refs/heads/master | 2020-05-27T21:20:11.371000 | 2017-05-19T15:54:33 | 2017-05-19T15:54:33 | 83,665,275 | 5 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 bp2_lab6;
import java.util.Random;
/**
*
* @author samet
*/
public class Soru_2 {
public static void main(String[] args) {
String metin = "Fatih2 Sultan3";
Random rnd = new Random();
int chindex = rnd.nextInt(metin.length());
Character ch = metin.charAt(chindex);
System.out.println("Secinlen= " + ch);
/*
if('0'<=ch && ch<= '9')
{
System.out.println("Rakamdır");
}
else
{
System.out.println("Rakam Değil");
}*/
if (Character.isDigit(ch)) {
System.out.println("Rakamdır");
} else {
System.out.println("Rakam Değil");
}
}
}
| UTF-8 | Java | 922 | java | Soru_2.java | Java | [
{
"context": "lab6;\n\nimport java.util.Random;\n\n/**\n *\n * @author samet\n */\npublic class Soru_2 {\n\n public static void",
"end": 253,
"score": 0.9993317127227783,
"start": 248,
"tag": "USERNAME",
"value": "samet"
}
] | null | [] | /*
* 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 bp2_lab6;
import java.util.Random;
/**
*
* @author samet
*/
public class Soru_2 {
public static void main(String[] args) {
String metin = "Fatih2 Sultan3";
Random rnd = new Random();
int chindex = rnd.nextInt(metin.length());
Character ch = metin.charAt(chindex);
System.out.println("Secinlen= " + ch);
/*
if('0'<=ch && ch<= '9')
{
System.out.println("Rakamdır");
}
else
{
System.out.println("Rakam Değil");
}*/
if (Character.isDigit(ch)) {
System.out.println("Rakamdır");
} else {
System.out.println("Rakam Değil");
}
}
}
| 922 | 0.535948 | 0.528322 | 43 | 20.348837 | 20.112341 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.325581 | false | false | 9 |
108d53b59b84e2dd159729a0d16b7076dec6720c | 13,322,988,566,807 | 1d3695dd090deb0423d5a0e5b25e35cf617a3baf | /arms-profiler/src/main/java/cn/chinaunicom/arms/apm/profiler/context/id/TransactionIdEncoder.java | 6134368c6d2036334c1de1c2f2c1999f745a1897 | [] | no_license | moutainhigh/arms-agent-parent | https://github.com/moutainhigh/arms-agent-parent | e19d621929a88b7af2fb5f5ce3fa07ebce96d026 | db56e3c1ff26504d72a3be80b27baf5dca1e8d44 | refs/heads/master | 2020-08-05T13:39:46.340000 | 2019-08-13T11:41:15 | 2019-08-13T11:41:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.chinaunicom.arms.apm.profiler.context.id;
public interface TransactionIdEncoder {
// TODO ByteBuffer encodeTransactionId(TraceId traceId);
}
| UTF-8 | Java | 159 | java | TransactionIdEncoder.java | Java | [] | null | [] | package cn.chinaunicom.arms.apm.profiler.context.id;
public interface TransactionIdEncoder {
// TODO ByteBuffer encodeTransactionId(TraceId traceId);
}
| 159 | 0.792453 | 0.792453 | 7 | 21.714285 | 25.426163 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 9 |
31cc4d8f9d8f03046011068a69dc795de224ab9e | 14,431,090,134,385 | 8160730dbfc837ba0f5882743c84e5ec22756879 | /cloudnet-driver/src/main/java/de/dytanic/cloudnet/driver/service/ServiceTask.java | 6ebdc97bc73678807a9d0de1b2edbaf6012ce109 | [] | no_license | derrop/CloudNet-v3 | https://github.com/derrop/CloudNet-v3 | 60198fdbade1e6a532650811f61e3e939f326163 | 754a196b07efb2a4b8574001b996d9e0a133f30c | refs/heads/master | 2020-07-25T23:00:44.559000 | 2019-06-21T12:28:55 | 2019-06-21T12:29:54 | 208,450,593 | 0 | 0 | null | true | 2019-12-22T12:40:04 | 2019-09-14T14:17:37 | 2019-09-14T14:17:38 | 2019-12-22T12:37:01 | 87,901 | 0 | 0 | 1 | null | false | false | package de.dytanic.cloudnet.driver.service;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Collection;
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ServiceTask extends ServiceConfigurationBase {
private String name;
private String runtime;
private boolean maintenance, autoDeleteOnStop, staticServices;
private Collection<String> associatedNodes;
private Collection<String> groups;
private ProcessConfiguration processConfiguration;
private int startPort, minServiceCount;
public ServiceTask(Collection<ServiceRemoteInclusion> includes, Collection<ServiceTemplate> templates, Collection<ServiceDeployment> deployments,
String name, String runtime, boolean autoDeleteOnStop, boolean staticServices, Collection<String> associatedNodes, Collection<String> groups,
ProcessConfiguration processConfiguration, int startPort, int minServiceCount)
{
this(includes, templates, deployments, name, runtime, false, autoDeleteOnStop,
staticServices, associatedNodes, groups, processConfiguration, startPort, minServiceCount);
}
public ServiceTask(Collection<ServiceRemoteInclusion> includes, Collection<ServiceTemplate> templates, Collection<ServiceDeployment> deployments,
String name, String runtime, boolean maintenance, boolean autoDeleteOnStop, boolean staticServices, Collection<String> associatedNodes, Collection<String> groups,
ProcessConfiguration processConfiguration, int startPort, int minServiceCount)
{
super(includes, templates, deployments);
this.name = name;
this.runtime = runtime;
this.maintenance = maintenance;
this.autoDeleteOnStop = autoDeleteOnStop;
this.associatedNodes = associatedNodes;
this.groups = groups;
this.processConfiguration = processConfiguration;
this.startPort = startPort;
this.minServiceCount = minServiceCount;
this.staticServices = staticServices;
}
} | UTF-8 | Java | 2,135 | java | ServiceTask.java | Java | [] | null | [] | package de.dytanic.cloudnet.driver.service;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Collection;
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ServiceTask extends ServiceConfigurationBase {
private String name;
private String runtime;
private boolean maintenance, autoDeleteOnStop, staticServices;
private Collection<String> associatedNodes;
private Collection<String> groups;
private ProcessConfiguration processConfiguration;
private int startPort, minServiceCount;
public ServiceTask(Collection<ServiceRemoteInclusion> includes, Collection<ServiceTemplate> templates, Collection<ServiceDeployment> deployments,
String name, String runtime, boolean autoDeleteOnStop, boolean staticServices, Collection<String> associatedNodes, Collection<String> groups,
ProcessConfiguration processConfiguration, int startPort, int minServiceCount)
{
this(includes, templates, deployments, name, runtime, false, autoDeleteOnStop,
staticServices, associatedNodes, groups, processConfiguration, startPort, minServiceCount);
}
public ServiceTask(Collection<ServiceRemoteInclusion> includes, Collection<ServiceTemplate> templates, Collection<ServiceDeployment> deployments,
String name, String runtime, boolean maintenance, boolean autoDeleteOnStop, boolean staticServices, Collection<String> associatedNodes, Collection<String> groups,
ProcessConfiguration processConfiguration, int startPort, int minServiceCount)
{
super(includes, templates, deployments);
this.name = name;
this.runtime = runtime;
this.maintenance = maintenance;
this.autoDeleteOnStop = autoDeleteOnStop;
this.associatedNodes = associatedNodes;
this.groups = groups;
this.processConfiguration = processConfiguration;
this.startPort = startPort;
this.minServiceCount = minServiceCount;
this.staticServices = staticServices;
}
} | 2,135 | 0.742857 | 0.742857 | 53 | 39.301888 | 44.732998 | 185 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.207547 | false | false | 9 |
8c21e05c2fcc82f6f662e9cb8d8d22546fc3253c | 29,746,943,513,576 | 8d04274b2720f3d58525074bd5b3ebe40de582fe | /src/InterviewDirectory/Tencent/constructed_huiwenStr.java | 826bcc720ca09c8a5c55baef24bacb55c5c63e73 | [] | no_license | HuaLiLiZhang/MyAlgorithms | https://github.com/HuaLiLiZhang/MyAlgorithms | 85cfc69a73c8e1f1ae07023cc4c5728dfac094bd | 1c3a7870ae59e526dba75ea76903961083283599 | refs/heads/master | 2021-06-26T15:26:06.795000 | 2019-04-27T14:53:40 | 2019-04-27T14:53:40 | 124,490,338 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package InterviewDirectory.Tencent;
import java.util.Scanner;
/**
* Created by huali on 2018/4/16.
*/
public class constructed_huiwenStr {
//构建回文序列: 最长公共子序列问题,连续,现在解决了连续子序列?
//public int deleteminNUm(String str)
//{
// if(str==null||str.equals(""))
// return 0;
// String str1 = reverse(str);
//
// int [][]dp = construted_dp(str, str1);
//
// int max = 0;
// for(int i = 0;i<str.length();i++)
// {
// for(int j=0;j<str1.length();j++)
// {
// if(dp[i][j] >max)
// {
// max = dp[i][j];
// }
// }
// }
// return str.length()-max;
//
//}
//
//public String reverse(String str)
//{
// char [] chr = str.toCharArray();
// int start = 0;
// int end = chr.length-1;
// while (start<=end)
// {
// char temp = chr[start];
// chr[start]= chr[end];
// chr[end] = temp;
// start++;
// end--;
// }
// return String.valueOf(chr);
//}
//
//
//public int[][] construted_dp(String str, String str1)
//{
// int [][]dp = new int[str.length()][str1.length()] ;
// char [] ch1 = str.toCharArray();
// char [] ch2 = str1.toCharArray();
// for(int j = 0;j<ch1.length;j++)
// {
// if(ch2[0]==ch1[j])
// dp[j][0] = 1;
// }
// for(int i = 1;i<ch1.length;i++)
// {
// if(ch2[i]==ch1[0])
// dp[0][i] = 1;
// }
// for(int i =1;i<ch1.length;i++)
// {
// for(int j = 1;j<ch2.length;j++)
// {
// if(ch1[i] == ch2[j])
// dp[i][j] = dp[i-1][j-1]+1;
// }
// }
// return dp;
//}
//翻转字符串,求两个字符串的最长子序列,不连续。是一个字符串是回文序列的最小删除字符数。
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String str = sc.nextLine();
String str1 = new constructed_huiwenStr().reverse(str);
int [][]dp = new constructed_huiwenStr().construted_dp(str, str1);
System.out.println(str.length()-dp[str.length()-1][str.length()-1]);
}
}
public int deleteminNUm(String str)
{
if(str==null||str.equals(""))
return 0;
String str1 = reverse(str);
int [][]dp = construted_dp(str, str1);
return str.length()-dp[str.length()-1][str.length()-1];
}
public String reverse(String str)
{
char [] chr = str.toCharArray();
int start = 0;
int end = chr.length-1;
while (start<=end)
{
char temp = chr[start];
chr[start]= chr[end];
chr[end] = temp;
start++;
end--;
}
return String.valueOf(chr);
}
public int[][] construted_dp(String str, String str1)
{
int [][]dp = new int[str.length()][str1.length()] ;
char [] ch1 = str.toCharArray();
char [] ch2 = str1.toCharArray();
dp[0][0] = ch1[0]==ch2[0]?1:0;
for(int i = 1;i<ch1.length;i++)
{
dp[i][0] = Math.max(dp[i-1][0],ch1[i]==ch2[0]?1:0);
}
for(int j = 1;j<ch1.length;j++)
{
dp[0][j] = Math.max(dp[0][j-1],ch1[0]==ch2[j]?1:0);
}
for(int i =1;i<ch1.length;i++)
{
for(int j = 1;j<ch2.length;j++)
{
dp[i][j]= Math.max(dp[i-1][j],dp[i][j-1]);
if(ch1[i]==ch2[j])
dp[i][j]=Math.max(dp[i][j], dp[i-1][j-1]+1);
}
}
return dp;
}
} | UTF-8 | Java | 3,904 | java | constructed_huiwenStr.java | Java | [
{
"context": "ent;\n\nimport java.util.Scanner;\n\n/**\n * Created by huali on 2018/4/16.\n */\npublic class constructed_huiwen",
"end": 87,
"score": 0.9995285272598267,
"start": 82,
"tag": "USERNAME",
"value": "huali"
}
] | null | [] | package InterviewDirectory.Tencent;
import java.util.Scanner;
/**
* Created by huali on 2018/4/16.
*/
public class constructed_huiwenStr {
//构建回文序列: 最长公共子序列问题,连续,现在解决了连续子序列?
//public int deleteminNUm(String str)
//{
// if(str==null||str.equals(""))
// return 0;
// String str1 = reverse(str);
//
// int [][]dp = construted_dp(str, str1);
//
// int max = 0;
// for(int i = 0;i<str.length();i++)
// {
// for(int j=0;j<str1.length();j++)
// {
// if(dp[i][j] >max)
// {
// max = dp[i][j];
// }
// }
// }
// return str.length()-max;
//
//}
//
//public String reverse(String str)
//{
// char [] chr = str.toCharArray();
// int start = 0;
// int end = chr.length-1;
// while (start<=end)
// {
// char temp = chr[start];
// chr[start]= chr[end];
// chr[end] = temp;
// start++;
// end--;
// }
// return String.valueOf(chr);
//}
//
//
//public int[][] construted_dp(String str, String str1)
//{
// int [][]dp = new int[str.length()][str1.length()] ;
// char [] ch1 = str.toCharArray();
// char [] ch2 = str1.toCharArray();
// for(int j = 0;j<ch1.length;j++)
// {
// if(ch2[0]==ch1[j])
// dp[j][0] = 1;
// }
// for(int i = 1;i<ch1.length;i++)
// {
// if(ch2[i]==ch1[0])
// dp[0][i] = 1;
// }
// for(int i =1;i<ch1.length;i++)
// {
// for(int j = 1;j<ch2.length;j++)
// {
// if(ch1[i] == ch2[j])
// dp[i][j] = dp[i-1][j-1]+1;
// }
// }
// return dp;
//}
//翻转字符串,求两个字符串的最长子序列,不连续。是一个字符串是回文序列的最小删除字符数。
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String str = sc.nextLine();
String str1 = new constructed_huiwenStr().reverse(str);
int [][]dp = new constructed_huiwenStr().construted_dp(str, str1);
System.out.println(str.length()-dp[str.length()-1][str.length()-1]);
}
}
public int deleteminNUm(String str)
{
if(str==null||str.equals(""))
return 0;
String str1 = reverse(str);
int [][]dp = construted_dp(str, str1);
return str.length()-dp[str.length()-1][str.length()-1];
}
public String reverse(String str)
{
char [] chr = str.toCharArray();
int start = 0;
int end = chr.length-1;
while (start<=end)
{
char temp = chr[start];
chr[start]= chr[end];
chr[end] = temp;
start++;
end--;
}
return String.valueOf(chr);
}
public int[][] construted_dp(String str, String str1)
{
int [][]dp = new int[str.length()][str1.length()] ;
char [] ch1 = str.toCharArray();
char [] ch2 = str1.toCharArray();
dp[0][0] = ch1[0]==ch2[0]?1:0;
for(int i = 1;i<ch1.length;i++)
{
dp[i][0] = Math.max(dp[i-1][0],ch1[i]==ch2[0]?1:0);
}
for(int j = 1;j<ch1.length;j++)
{
dp[0][j] = Math.max(dp[0][j-1],ch1[0]==ch2[j]?1:0);
}
for(int i =1;i<ch1.length;i++)
{
for(int j = 1;j<ch2.length;j++)
{
dp[i][j]= Math.max(dp[i-1][j],dp[i][j-1]);
if(ch1[i]==ch2[j])
dp[i][j]=Math.max(dp[i][j], dp[i-1][j-1]+1);
}
}
return dp;
}
} | 3,904 | 0.424121 | 0.397764 | 144 | 25.090279 | 18.768291 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 9 |
baf0f379021e6865f8e720c8b23d87fb9ca622a9 | 23,338,852,308,652 | f1e186537e08a49d1e4889c8d0f716863efeaffe | /src/main/java/com/taksila/veda/db/dao/TopicDAO.java | 0c868f38d0e63ef3bef021af12df885ac4a59d2f | [] | no_license | maheshmad/veda-db | https://github.com/maheshmad/veda-db | b363226974ba76a2129faa160944fbae0bcdbf5f | e7c2866b628f2401346fd14d0e9fb9682f504b9f | refs/heads/master | 2022-05-13T03:57:49.140000 | 2020-06-05T14:57:44 | 2020-06-05T14:57:44 | 79,068,278 | 0 | 0 | null | false | 2022-04-27T21:10:44 | 2017-01-16T00:11:27 | 2020-06-05T14:59:00 | 2022-04-27T21:10:43 | 9,414 | 0 | 0 | 1 | Java | false | false | /**
*
*/
package com.taksila.veda.db.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import com.taksila.veda.db.utils.TenantDBManager;
import com.taksila.veda.model.api.course.v1_0.Topic;
import com.taksila.veda.utils.CommonUtils;
/**
* @author mahesh
*
*/
@Repository
@Scope(value="prototype")
@Lazy(value = true)
public class TopicDAO implements TopicRepositoryInterface
{
@Autowired
private TenantDBManager tenantDBManager;
private String tenantId;
@Autowired
ApplicationContext applicationContext;
@Autowired
public TopicDAO(@Value("tenantId") String tenantId)
{
logger.trace(" building for tenant id = "+tenantId);
this.tenantId = tenantId;
}
private static String insert_topic_sql = "INSERT INTO TOPICS("+TOPIC_TABLE.chapterid.value()+","+
TOPIC_TABLE.topicname.value()+","+
TOPIC_TABLE.title.value()+","+
TOPIC_TABLE.subTitle.value()+","+
TOPIC_TABLE.description.value()+") "+
"VALUES (?,?,?,?,?);";
private static String update_topic_sql = "UPDATE TOPICS SET "+ TOPIC_TABLE.chapterid.value()+" = ? ,"+
TOPIC_TABLE.topicname.value()+" = ? ,"+
TOPIC_TABLE.title.value()+" = ? ,"+
TOPIC_TABLE.subTitle.value()+" = ? ,"+
TOPIC_TABLE.description.value()+" = ? "+
" WHERE "+TOPIC_TABLE.id.value()+" = ? ";
private static String delete_topic_sql = "DELETE FROM TOPICS WHERE "+TOPIC_TABLE.id.value()+" = ? ";
private static String search_topic_by_title_sql = "SELECT * FROM TOPICS WHERE "+TOPIC_TABLE.title.value()+" like ? ";
private static String search_topic_by_id_sql = "SELECT * FROM TOPICS WHERE "+TOPIC_TABLE.id.value()+" = ? ";
private static String search_topic_by_chapter_id_sql = "SELECT * FROM TOPICS WHERE "+TOPIC_TABLE.chapterid.value()+" = ? ";
private static String search_all_topics_sql = "SELECT * FROM TOPICS";
static Logger logger = LogManager.getLogger(TopicDAO.class.getName());
public enum TOPIC_TABLE
{
id("id"),
chapterid("chapterid"),
topicname("name"),
title("title"),
subTitle("sub_title"),
description("description");
private String name;
private TOPIC_TABLE(String s)
{
name = s;
}
public String value()
{
return this.name;
}
};
private Topic mapRow(ResultSet resultSet) throws SQLException
{
Topic topic = new Topic();
topic.setChapterid(String.valueOf(resultSet.getInt(TOPIC_TABLE.chapterid.value())));
topic.setId(String.valueOf(resultSet.getInt(TOPIC_TABLE.id.value())));
topic.setName(resultSet.getString(TOPIC_TABLE.topicname.value()));
topic.setTitle(resultSet.getString(TOPIC_TABLE.title.value()));
topic.setSubTitle(resultSet.getString(TOPIC_TABLE.subTitle.value()));
topic.setDescription(resultSet.getString(TOPIC_TABLE.description.value()));
return topic;
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#searchTopicsByTitle(java.lang.String)
*/
@Override
public List<Topic> searchTopicsByTitle(String q) throws Exception
{
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
String sql = "";
if (StringUtils.isNotBlank(q))
sql = search_topic_by_title_sql;
else
sql = search_all_topics_sql;
return jdbcTemplate.execute(sql,new PreparedStatementCallback<List<Topic>>()
{
@Override
public List<Topic> doInPreparedStatement(PreparedStatement stmt)
{
List<Topic> hits = new ArrayList<Topic>();
try
{
if (StringUtils.isNotBlank(q))
stmt.setString(1, q+"%");
else;
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next())
{
hits.add(mapRow(resultSet));
}
}
catch (SQLException e)
{
e.printStackTrace();
}
return hits;
}
});
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#searchTopicsByChapterid(java.lang.String)
*/
@Override
public List<Topic> searchTopicsByChapterid(String chapterid) throws Exception
{
logger.trace("searching topics by chapter id query ="+chapterid);
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
return jdbcTemplate.execute(search_topic_by_chapter_id_sql,new PreparedStatementCallback<List<Topic>>()
{
@Override
public List<Topic> doInPreparedStatement(PreparedStatement stmt)
{
List<Topic> hits = new ArrayList<Topic>();
try
{
stmt.setInt(1, Integer.parseInt(chapterid));
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next())
{
hits.add(mapRow(resultSet));
}
}
catch (SQLException e)
{
e.printStackTrace();
}
return hits;
}
});
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#getTopicById(java.lang.String)
*/
@Override
public Topic getTopicById(String id) throws Exception
{
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
return jdbcTemplate.execute(search_topic_by_id_sql,new PreparedStatementCallback<Topic>()
{
@Override
public Topic doInPreparedStatement(PreparedStatement stmt) throws SQLException
{
stmt.setInt(1, Integer.parseInt(id));
ResultSet resultSet = stmt.executeQuery();
if (resultSet.next())
{
return mapRow(resultSet);
}
return null;
}
});
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#insertTopic(com.taksila.veda.model.api.course.v1_0.Topic)
*/
@Override
public Topic insertTopic(Topic topic) throws Exception
{
logger.debug("Entering into insertTopic():::::");
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
KeyHolder holder = new GeneratedKeyHolder();
jdbcTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException
{
try
{
PreparedStatement stmt = connection.prepareStatement(insert_topic_sql, Statement.RETURN_GENERATED_KEYS);
stmt.setInt(1, Integer.parseInt(topic.getChapterid()));
stmt.setString(2, topic.getName());
stmt.setString(3, topic.getTitle());
stmt.setString(4, topic.getSubTitle());
stmt.setString(5, topic.getDescription());
return stmt;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
}, holder);
topic.setId(holder.getKey().toString());
return topic;
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#updateTopic(com.taksila.veda.model.api.course.v1_0.Topic)
*/
@Override
public boolean updateTopic(Topic topic) throws Exception
{
logger.debug("Entering into updateTopic():::::");
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
Boolean insertSuccess = jdbcTemplate.execute(update_topic_sql,new PreparedStatementCallback<Boolean>()
{
@Override
public Boolean doInPreparedStatement(PreparedStatement stmt)
{
try
{
stmt.setInt(1, Integer.parseInt(topic.getChapterid()));
stmt.setString(2, topic.getName());
stmt.setString(3, topic.getTitle());
stmt.setString(4, topic.getSubTitle());
stmt.setString(5, topic.getDescription());
stmt.setInt(6, Integer.valueOf(topic.getId()));
int t = stmt.executeUpdate();
if (t > 0)
return true;
else
return false;
}
catch (SQLException e)
{
e.printStackTrace();
return false;
}
}
});
if (!insertSuccess)
throw new Exception("Unsuccessful in adding an entry into DB, please check logs");
return insertSuccess;
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#deleteTopic(java.lang.String)
*/
@Override
public boolean deleteTopic(String id) throws Exception
{
logger.debug("Entering into deleteTopic():::::");
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
return jdbcTemplate.execute(delete_topic_sql,new PreparedStatementCallback<Boolean>()
{
@Override
public Boolean doInPreparedStatement(PreparedStatement stmt)
{
try
{
stmt.setInt(1, Integer.parseInt(id));
int t = stmt.executeUpdate();
if (t > 0)
return true;
else
return false;
}
catch (SQLException e)
{
e.printStackTrace();
return false;
}
}
});
}
}
| UTF-8 | Java | 10,542 | java | TopicDAO.java | Java | [
{
"context": "taksila.veda.utils.CommonUtils;\r\n\r\n/**\r\n * @author mahesh\r\n *\r\n */\r\n \r\n@Repository\r\n@Scope(value=\"prototype",
"end": 1197,
"score": 0.9829673171043396,
"start": 1191,
"tag": "USERNAME",
"value": "mahesh"
}
] | null | [] | /**
*
*/
package com.taksila.veda.db.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.stereotype.Repository;
import com.taksila.veda.db.utils.TenantDBManager;
import com.taksila.veda.model.api.course.v1_0.Topic;
import com.taksila.veda.utils.CommonUtils;
/**
* @author mahesh
*
*/
@Repository
@Scope(value="prototype")
@Lazy(value = true)
public class TopicDAO implements TopicRepositoryInterface
{
@Autowired
private TenantDBManager tenantDBManager;
private String tenantId;
@Autowired
ApplicationContext applicationContext;
@Autowired
public TopicDAO(@Value("tenantId") String tenantId)
{
logger.trace(" building for tenant id = "+tenantId);
this.tenantId = tenantId;
}
private static String insert_topic_sql = "INSERT INTO TOPICS("+TOPIC_TABLE.chapterid.value()+","+
TOPIC_TABLE.topicname.value()+","+
TOPIC_TABLE.title.value()+","+
TOPIC_TABLE.subTitle.value()+","+
TOPIC_TABLE.description.value()+") "+
"VALUES (?,?,?,?,?);";
private static String update_topic_sql = "UPDATE TOPICS SET "+ TOPIC_TABLE.chapterid.value()+" = ? ,"+
TOPIC_TABLE.topicname.value()+" = ? ,"+
TOPIC_TABLE.title.value()+" = ? ,"+
TOPIC_TABLE.subTitle.value()+" = ? ,"+
TOPIC_TABLE.description.value()+" = ? "+
" WHERE "+TOPIC_TABLE.id.value()+" = ? ";
private static String delete_topic_sql = "DELETE FROM TOPICS WHERE "+TOPIC_TABLE.id.value()+" = ? ";
private static String search_topic_by_title_sql = "SELECT * FROM TOPICS WHERE "+TOPIC_TABLE.title.value()+" like ? ";
private static String search_topic_by_id_sql = "SELECT * FROM TOPICS WHERE "+TOPIC_TABLE.id.value()+" = ? ";
private static String search_topic_by_chapter_id_sql = "SELECT * FROM TOPICS WHERE "+TOPIC_TABLE.chapterid.value()+" = ? ";
private static String search_all_topics_sql = "SELECT * FROM TOPICS";
static Logger logger = LogManager.getLogger(TopicDAO.class.getName());
public enum TOPIC_TABLE
{
id("id"),
chapterid("chapterid"),
topicname("name"),
title("title"),
subTitle("sub_title"),
description("description");
private String name;
private TOPIC_TABLE(String s)
{
name = s;
}
public String value()
{
return this.name;
}
};
private Topic mapRow(ResultSet resultSet) throws SQLException
{
Topic topic = new Topic();
topic.setChapterid(String.valueOf(resultSet.getInt(TOPIC_TABLE.chapterid.value())));
topic.setId(String.valueOf(resultSet.getInt(TOPIC_TABLE.id.value())));
topic.setName(resultSet.getString(TOPIC_TABLE.topicname.value()));
topic.setTitle(resultSet.getString(TOPIC_TABLE.title.value()));
topic.setSubTitle(resultSet.getString(TOPIC_TABLE.subTitle.value()));
topic.setDescription(resultSet.getString(TOPIC_TABLE.description.value()));
return topic;
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#searchTopicsByTitle(java.lang.String)
*/
@Override
public List<Topic> searchTopicsByTitle(String q) throws Exception
{
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
String sql = "";
if (StringUtils.isNotBlank(q))
sql = search_topic_by_title_sql;
else
sql = search_all_topics_sql;
return jdbcTemplate.execute(sql,new PreparedStatementCallback<List<Topic>>()
{
@Override
public List<Topic> doInPreparedStatement(PreparedStatement stmt)
{
List<Topic> hits = new ArrayList<Topic>();
try
{
if (StringUtils.isNotBlank(q))
stmt.setString(1, q+"%");
else;
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next())
{
hits.add(mapRow(resultSet));
}
}
catch (SQLException e)
{
e.printStackTrace();
}
return hits;
}
});
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#searchTopicsByChapterid(java.lang.String)
*/
@Override
public List<Topic> searchTopicsByChapterid(String chapterid) throws Exception
{
logger.trace("searching topics by chapter id query ="+chapterid);
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
return jdbcTemplate.execute(search_topic_by_chapter_id_sql,new PreparedStatementCallback<List<Topic>>()
{
@Override
public List<Topic> doInPreparedStatement(PreparedStatement stmt)
{
List<Topic> hits = new ArrayList<Topic>();
try
{
stmt.setInt(1, Integer.parseInt(chapterid));
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next())
{
hits.add(mapRow(resultSet));
}
}
catch (SQLException e)
{
e.printStackTrace();
}
return hits;
}
});
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#getTopicById(java.lang.String)
*/
@Override
public Topic getTopicById(String id) throws Exception
{
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
return jdbcTemplate.execute(search_topic_by_id_sql,new PreparedStatementCallback<Topic>()
{
@Override
public Topic doInPreparedStatement(PreparedStatement stmt) throws SQLException
{
stmt.setInt(1, Integer.parseInt(id));
ResultSet resultSet = stmt.executeQuery();
if (resultSet.next())
{
return mapRow(resultSet);
}
return null;
}
});
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#insertTopic(com.taksila.veda.model.api.course.v1_0.Topic)
*/
@Override
public Topic insertTopic(Topic topic) throws Exception
{
logger.debug("Entering into insertTopic():::::");
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
KeyHolder holder = new GeneratedKeyHolder();
jdbcTemplate.update(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException
{
try
{
PreparedStatement stmt = connection.prepareStatement(insert_topic_sql, Statement.RETURN_GENERATED_KEYS);
stmt.setInt(1, Integer.parseInt(topic.getChapterid()));
stmt.setString(2, topic.getName());
stmt.setString(3, topic.getTitle());
stmt.setString(4, topic.getSubTitle());
stmt.setString(5, topic.getDescription());
return stmt;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
}, holder);
topic.setId(holder.getKey().toString());
return topic;
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#updateTopic(com.taksila.veda.model.api.course.v1_0.Topic)
*/
@Override
public boolean updateTopic(Topic topic) throws Exception
{
logger.debug("Entering into updateTopic():::::");
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
Boolean insertSuccess = jdbcTemplate.execute(update_topic_sql,new PreparedStatementCallback<Boolean>()
{
@Override
public Boolean doInPreparedStatement(PreparedStatement stmt)
{
try
{
stmt.setInt(1, Integer.parseInt(topic.getChapterid()));
stmt.setString(2, topic.getName());
stmt.setString(3, topic.getTitle());
stmt.setString(4, topic.getSubTitle());
stmt.setString(5, topic.getDescription());
stmt.setInt(6, Integer.valueOf(topic.getId()));
int t = stmt.executeUpdate();
if (t > 0)
return true;
else
return false;
}
catch (SQLException e)
{
e.printStackTrace();
return false;
}
}
});
if (!insertSuccess)
throw new Exception("Unsuccessful in adding an entry into DB, please check logs");
return insertSuccess;
}
/* (non-Javadoc)
* @see com.taksila.veda.db.dao.TopicRepositoryInterface#deleteTopic(java.lang.String)
*/
@Override
public boolean deleteTopic(String id) throws Exception
{
logger.debug("Entering into deleteTopic():::::");
JdbcTemplate jdbcTemplate = this.tenantDBManager.getJdbcTemplate(this.tenantId);
return jdbcTemplate.execute(delete_topic_sql,new PreparedStatementCallback<Boolean>()
{
@Override
public Boolean doInPreparedStatement(PreparedStatement stmt)
{
try
{
stmt.setInt(1, Integer.parseInt(id));
int t = stmt.executeUpdate();
if (t > 0)
return true;
else
return false;
}
catch (SQLException e)
{
e.printStackTrace();
return false;
}
}
});
}
}
| 10,542 | 0.61734 | 0.614874 | 350 | 28.120001 | 28.967516 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.468571 | false | false | 9 |
c35d01134a5f1530875e07fabffe0a4d3931ba27 | 14,285,061,248,778 | bb42208f71e56bb54a72a5d2eef821986f1b7b48 | /src/frontend/editor/TextInputArea.java | 6439252738ab95d7557822e880c0fe51ff46135a | [
"MIT"
] | permissive | dylPeters15/slogo_team06 | https://github.com/dylPeters15/slogo_team06 | cb03e988c0d2db7ad81574ca44bb52c061a4a15f | 04446dd35706290320f6ec157b1d2d4460e1916a | refs/heads/master | 2021-01-18T20:47:13.607000 | 2017-03-24T04:52:18 | 2017-03-24T04:52:18 | 100,548,602 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package frontend.editor;
import javafx.geometry.Insets;
import javafx.scene.control.TextArea;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import frontend.SlogoBaseUIManager;
/**
* TextInputArea manages a TextArea object, and allows it to be covered with a
* translucent pane to prevent the user from editing the text and to signal to
* the user that the text is not editable (rather than simply making the
* TextArea not editable). Furthermore, it encapsulates the TextArea within the
* framework of the SlogoBaseUIManager that the rest of the front end classes
* use.
*
* @author Dylan Peters
*
*/
class TextInputArea extends SlogoBaseUIManager<Region> {
StackPane stackPane;
TextArea textArea;
Pane glassPane;
/**
* Creates a new instance of TextInputArea. Sets all values to default. The
* text and the prompt text in the TextArea are both set to empty.
*/
TextInputArea() {
this("", "");
}
/**
* Creates a new instance of TextInputArea. Sets the text and the prompt to
* the values specified in the constructor.
*
* @param text
* a String specifying the text to populate the TextArea with.
* @param prompt
* a String specifying the prompt text to add to the TextArea.
* The prompt text is shown when no text has been typed into the
* TextArea.
*/
TextInputArea(String text, String prompt) {
initStackPane();
initTextArea(text, prompt);
initGlassPane();
initMouseEvents();
}
/**
* Sets the prompt of the textArea to the specified value.
*
* @param prompt
* a String specifying the prompt text to add to the TextArea.
* The prompt text is shown when no text has been typed into the
* TextArea.
*/
void setPrompt(String prompt) {
textArea.setPromptText(prompt);
}
/**
* Sets the text of the textArea to the specified value.
*
* @param text
* a String specifying the text to populate the TextArea with.
*/
void setText(String text) {
textArea.setText(text);
}
/**
* Gets the text that is contained in the TextArea.
*
* @return a String representing the text currently in the TextArea.
*/
String getText() {
return textArea.getText();
}
/**
* Gets the Region object managed by this class. The region object returned
* by this method should have all the UI functionality required for the user
* to interact with the TextArea unless the TextArea is covered by the
* translucent pane.
*
* @return region object that has all the UI functionality required for the
* user to interact with the TextArea unless the TextArea is covered
* by the translucent pane.
*/
@Override
public Region getObject() {
return stackPane;
}
/**
* Called by other classes in the same package to toggle whether the
* TextArea is covered. This indicates whether the TextArea is editable by
* the user.
*
* @param grey
* boolean indicating whether the TextArea should be covered. if
* grey is true, then the TextArea gets covered, otherwise, it
* gets uncovered.
*/
void greyOut(boolean grey) {
if (grey) {
textArea.setEditable(false);
if (!stackPane.getChildren().contains(glassPane)) {
stackPane.getChildren().add(glassPane);
}
} else {
textArea.setEditable(true);
if (stackPane.getChildren().contains(glassPane)) {
stackPane.getChildren().remove(glassPane);
}
}
}
private void initStackPane() {
stackPane = new StackPane();
}
private void initTextArea(String text, String prompt) {
textArea = new TextArea(text);
textArea.setPromptText(prompt);
bindRegionToRegion(textArea, stackPane);
textArea.setWrapText(true);
stackPane.getChildren().add(textArea);
}
private void initGlassPane() {
glassPane = new Pane();
glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.5, 0.5, 0.5, 0.4), new CornerRadii(0),
new Insets(0))));
bindRegionToRegion(glassPane, stackPane);
}
private void bindRegionToRegion(Region regionToBeBound,
Region regionToBeObserved) {
regionToBeBound.prefWidthProperty().bind(
regionToBeObserved.widthProperty());
regionToBeBound.prefHeightProperty().bind(
regionToBeObserved.heightProperty());
regionToBeBound.translateXProperty().bind(
regionToBeObserved.translateXProperty());
regionToBeBound.translateYProperty().bind(
regionToBeObserved.translateYProperty());
}
private void initMouseEvents() {
stackPane.setOnMouseEntered(event -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.8, 0.8, 0.8, 0.4), new CornerRadii(0),
new Insets(0)))));
stackPane.setOnMouseExited(eevent -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.5, 0.5, 0.5, 0.4), new CornerRadii(0),
new Insets(0)))));
stackPane.setOnMousePressed(event -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.1, 0.8, 0.2, 0.4), new CornerRadii(0),
new Insets(0)))));
stackPane.setOnMouseReleased(event -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.5, 0.5, 0.5, 0.4), new CornerRadii(0),
new Insets(0)))));
}
}
| UTF-8 | Java | 5,572 | java | TextInputArea.java | Java | [
{
"context": "st of the front end classes\n * use.\n * \n * @author Dylan Peters\n *\n */\nclass TextInputArea extends SlogoBaseUIMan",
"end": 866,
"score": 0.9998262524604797,
"start": 854,
"tag": "NAME",
"value": "Dylan Peters"
}
] | null | [] | /**
*
*/
package frontend.editor;
import javafx.geometry.Insets;
import javafx.scene.control.TextArea;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import frontend.SlogoBaseUIManager;
/**
* TextInputArea manages a TextArea object, and allows it to be covered with a
* translucent pane to prevent the user from editing the text and to signal to
* the user that the text is not editable (rather than simply making the
* TextArea not editable). Furthermore, it encapsulates the TextArea within the
* framework of the SlogoBaseUIManager that the rest of the front end classes
* use.
*
* @author <NAME>
*
*/
class TextInputArea extends SlogoBaseUIManager<Region> {
StackPane stackPane;
TextArea textArea;
Pane glassPane;
/**
* Creates a new instance of TextInputArea. Sets all values to default. The
* text and the prompt text in the TextArea are both set to empty.
*/
TextInputArea() {
this("", "");
}
/**
* Creates a new instance of TextInputArea. Sets the text and the prompt to
* the values specified in the constructor.
*
* @param text
* a String specifying the text to populate the TextArea with.
* @param prompt
* a String specifying the prompt text to add to the TextArea.
* The prompt text is shown when no text has been typed into the
* TextArea.
*/
TextInputArea(String text, String prompt) {
initStackPane();
initTextArea(text, prompt);
initGlassPane();
initMouseEvents();
}
/**
* Sets the prompt of the textArea to the specified value.
*
* @param prompt
* a String specifying the prompt text to add to the TextArea.
* The prompt text is shown when no text has been typed into the
* TextArea.
*/
void setPrompt(String prompt) {
textArea.setPromptText(prompt);
}
/**
* Sets the text of the textArea to the specified value.
*
* @param text
* a String specifying the text to populate the TextArea with.
*/
void setText(String text) {
textArea.setText(text);
}
/**
* Gets the text that is contained in the TextArea.
*
* @return a String representing the text currently in the TextArea.
*/
String getText() {
return textArea.getText();
}
/**
* Gets the Region object managed by this class. The region object returned
* by this method should have all the UI functionality required for the user
* to interact with the TextArea unless the TextArea is covered by the
* translucent pane.
*
* @return region object that has all the UI functionality required for the
* user to interact with the TextArea unless the TextArea is covered
* by the translucent pane.
*/
@Override
public Region getObject() {
return stackPane;
}
/**
* Called by other classes in the same package to toggle whether the
* TextArea is covered. This indicates whether the TextArea is editable by
* the user.
*
* @param grey
* boolean indicating whether the TextArea should be covered. if
* grey is true, then the TextArea gets covered, otherwise, it
* gets uncovered.
*/
void greyOut(boolean grey) {
if (grey) {
textArea.setEditable(false);
if (!stackPane.getChildren().contains(glassPane)) {
stackPane.getChildren().add(glassPane);
}
} else {
textArea.setEditable(true);
if (stackPane.getChildren().contains(glassPane)) {
stackPane.getChildren().remove(glassPane);
}
}
}
private void initStackPane() {
stackPane = new StackPane();
}
private void initTextArea(String text, String prompt) {
textArea = new TextArea(text);
textArea.setPromptText(prompt);
bindRegionToRegion(textArea, stackPane);
textArea.setWrapText(true);
stackPane.getChildren().add(textArea);
}
private void initGlassPane() {
glassPane = new Pane();
glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.5, 0.5, 0.5, 0.4), new CornerRadii(0),
new Insets(0))));
bindRegionToRegion(glassPane, stackPane);
}
private void bindRegionToRegion(Region regionToBeBound,
Region regionToBeObserved) {
regionToBeBound.prefWidthProperty().bind(
regionToBeObserved.widthProperty());
regionToBeBound.prefHeightProperty().bind(
regionToBeObserved.heightProperty());
regionToBeBound.translateXProperty().bind(
regionToBeObserved.translateXProperty());
regionToBeBound.translateYProperty().bind(
regionToBeObserved.translateYProperty());
}
private void initMouseEvents() {
stackPane.setOnMouseEntered(event -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.8, 0.8, 0.8, 0.4), new CornerRadii(0),
new Insets(0)))));
stackPane.setOnMouseExited(eevent -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.5, 0.5, 0.5, 0.4), new CornerRadii(0),
new Insets(0)))));
stackPane.setOnMousePressed(event -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.1, 0.8, 0.2, 0.4), new CornerRadii(0),
new Insets(0)))));
stackPane.setOnMouseReleased(event -> glassPane
.setBackground(new Background(new BackgroundFill((Paint) Color
.color(0.5, 0.5, 0.5, 0.4), new CornerRadii(0),
new Insets(0)))));
}
}
| 5,566 | 0.700108 | 0.691134 | 183 | 29.448088 | 25.3234 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.896175 | false | false | 9 |
fa63d2739065a3c84e7fd3bda241238b52cfceb8 | 29,119,878,318,875 | 373784538c9408521c3ff837d588df4a4775de77 | /M226_02/grafikeditor/src/com/company/Factory/RectangleFactory.java | 1c35cd5754a59273e0efca66f740ec46d03eb97d | [] | no_license | OlivierWinkler/iet-gibb | https://github.com/OlivierWinkler/iet-gibb | 2cd9baefe1691bff1f6734c045d5220c913fed67 | 6e4df1c432089697abe601fb049655d64d0e7a76 | refs/heads/master | 2023-08-20T14:36:44.082000 | 2022-09-06T08:46:49 | 2022-09-06T08:46:49 | 298,840,960 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.company.Factory;
import com.company.Figures.Figure;
import com.company.Figures.Rectangle;
import java.awt.*;
public class RectangleFactory implements FigureFactory{
@Override
public Figure create(Point firstPoint, Point secondPoint) {
return new Rectangle(firstPoint, secondPoint, Color.BLUE);
}
}
| UTF-8 | Java | 333 | java | RectangleFactory.java | Java | [] | null | [] | package com.company.Factory;
import com.company.Figures.Figure;
import com.company.Figures.Rectangle;
import java.awt.*;
public class RectangleFactory implements FigureFactory{
@Override
public Figure create(Point firstPoint, Point secondPoint) {
return new Rectangle(firstPoint, secondPoint, Color.BLUE);
}
}
| 333 | 0.75976 | 0.75976 | 13 | 24.615385 | 23.698551 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.615385 | false | false | 9 |
cd4642918117f0f0b21a690f806b182378eeed5d | 30,408,368,462,474 | 311f1237e7498e7d1d195af5f4bcd49165afa63a | /sourcedata/camel-camel-1.4.0/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcErrorLogger.java | b9fe0514a1d517813291a3be955f284a70ac75c8 | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | DXYyang/SDP | https://github.com/DXYyang/SDP | 86ee0e9fb7032a0638b8bd825bcf7585bccc8021 | 6ad0daf242d4062888ceca6d4a1bd4c41fd99b63 | refs/heads/master | 2023-01-11T02:29:36.328000 | 2019-11-02T09:38:34 | 2019-11-02T09:38:34 | 219,128,146 | 10 | 1 | Apache-2.0 | false | 2023-01-02T21:53:42 | 2019-11-02T08:54:26 | 2022-11-01T04:11:44 | 2023-01-02T21:53:39 | 49,526 | 8 | 0 | 48 | Java | false | false | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.component.irc;
import org.apache.commons.logging.Log;
import org.schwering.irc.lib.IRCEventAdapter;
import org.schwering.irc.lib.IRCModeParser;
import org.schwering.irc.lib.IRCUser;
/**
* A helper class which logs errors
*
* @version $Revision$
*/
public class IrcErrorLogger extends IRCEventAdapter {
private Log log;
public IrcErrorLogger(Log log) {
this.log = log;
}
@Override
public void onRegistered() {
super.onRegistered();
log.info("onRegistered");
}
@Override
public void onDisconnected() {
super.onDisconnected();
log.info("onDisconnected");
}
@Override
public void onMode(String string, IRCUser ircUser, IRCModeParser ircModeParser) {
super.onMode(string, ircUser, ircModeParser);
log.info("onMode.string = " + string);
log.info("onMode.ircUser = " + ircUser);
log.info("onMode.ircModeParser = " + ircModeParser);
}
@Override
public void onMode(IRCUser ircUser, String string, String string1) {
super.onMode(ircUser, string, string1);
log.info("onMode.ircUser = " + ircUser);
log.info("onMode.string = " + string);
log.info("onMode.string1 = " + string1);
}
@Override
public void onPing(String string) {
super.onPing(string);
log.info("onPing.string = " + string);
}
@Override
public void onError(String string) {
log.info("onError.string = " + string);
}
@Override
public void onError(int i, String string) {
super.onError(i, string);
log.error("onError.i = " + i);
log.error("onError.string = " + string);
}
@Override
public void unknown(String string, String string1, String string2, String string3) {
super.unknown(string, string1, string2, string3);
log.error("unknown.string = " + string);
log.error("unknown.string1 = " + string1);
log.error("unknown.string2 = " + string2);
log.error("unknown.string3 = " + string3);
}
}
| UTF-8 | Java | 2,884 | java | IrcErrorLogger.java | Java | [] | null | [] | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.component.irc;
import org.apache.commons.logging.Log;
import org.schwering.irc.lib.IRCEventAdapter;
import org.schwering.irc.lib.IRCModeParser;
import org.schwering.irc.lib.IRCUser;
/**
* A helper class which logs errors
*
* @version $Revision$
*/
public class IrcErrorLogger extends IRCEventAdapter {
private Log log;
public IrcErrorLogger(Log log) {
this.log = log;
}
@Override
public void onRegistered() {
super.onRegistered();
log.info("onRegistered");
}
@Override
public void onDisconnected() {
super.onDisconnected();
log.info("onDisconnected");
}
@Override
public void onMode(String string, IRCUser ircUser, IRCModeParser ircModeParser) {
super.onMode(string, ircUser, ircModeParser);
log.info("onMode.string = " + string);
log.info("onMode.ircUser = " + ircUser);
log.info("onMode.ircModeParser = " + ircModeParser);
}
@Override
public void onMode(IRCUser ircUser, String string, String string1) {
super.onMode(ircUser, string, string1);
log.info("onMode.ircUser = " + ircUser);
log.info("onMode.string = " + string);
log.info("onMode.string1 = " + string1);
}
@Override
public void onPing(String string) {
super.onPing(string);
log.info("onPing.string = " + string);
}
@Override
public void onError(String string) {
log.info("onError.string = " + string);
}
@Override
public void onError(int i, String string) {
super.onError(i, string);
log.error("onError.i = " + i);
log.error("onError.string = " + string);
}
@Override
public void unknown(String string, String string1, String string2, String string3) {
super.unknown(string, string1, string2, string3);
log.error("unknown.string = " + string);
log.error("unknown.string1 = " + string1);
log.error("unknown.string2 = " + string2);
log.error("unknown.string3 = " + string3);
}
}
| 2,884 | 0.660888 | 0.653953 | 90 | 31.044445 | 25.071415 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.566667 | false | false | 9 |
f15f72622b5a25cfd29d5ea6ced7419508e98ec8 | 30,408,368,463,185 | 5f59b618cdf25126bf310e66af89c8d54d1a9f5a | /src/POO/Cachorro.java | 4ac2aaaa6847667be18fdc37e4d7167180c26d27 | [] | no_license | Daniel-Dos/Universidade-XTI---JAVA- | https://github.com/Daniel-Dos/Universidade-XTI---JAVA- | 90d6e4d7e47964011f7119de1af59a74144b782f | 8bb39e6d141b38165716c80f60b1064df5b9cbe2 | refs/heads/master | 2016-09-07T00:29:49.705000 | 2015-03-25T04:10:32 | 2015-03-25T04:10:32 | 32,841,512 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package POO;
public class Cachorro {
int tamanho;//atributos do objeto Cachorro
String raša;//atributos do objeto Cachorro
void latir(){ // metodo que nao retorna nada e nao tem paramentros.
System.out.println("Au Au,Au!!");
}
}
| IBM852 | Java | 251 | java | Cachorro.java | Java | [] | null | [] | package POO;
public class Cachorro {
int tamanho;//atributos do objeto Cachorro
String raša;//atributos do objeto Cachorro
void latir(){ // metodo que nao retorna nada e nao tem paramentros.
System.out.println("Au Au,Au!!");
}
}
| 251 | 0.684 | 0.684 | 11 | 20.727272 | 22.36105 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.090909 | false | false | 9 |
5c8019759ab2882e73a8091771609c8b5e94ee12 | 1,168,231,126,203 | a4bdd6154c9b33559ac8a3f0c20107469e48f112 | /src/level1/Marathon.java | 7790a35e5d5b84ecaafc759b91e4700f73d03cf0 | [] | no_license | nimkoes/programmers_code_noah | https://github.com/nimkoes/programmers_code_noah | d679f5ea776a45653fbf29b0b41ebc7807e5ef7a | 0d9e82dad7d18e46dc70041403555cd98d9214a5 | refs/heads/master | 2023-04-24T05:01:01.429000 | 2021-05-13T23:53:42 | 2021-05-13T23:53:42 | 367,200,404 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package level1;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class Marathon {
/// Fields
private String[] participant;
private String[] completion;
/// Constructor
public Marathon(){
System.out.println("Create Default Constructor");
problem();
}
/// Method
public void problem(){
/**
* 마라톤 경기에 참여한 선수의 수는 1명 이상 100,000명 이하입니다.
* completion의 길이는 participant의 길이보다 1 작습니다.
* 참가자의 이름은 1개 이상 20개 이하의 알파벳 소문자로 이루어져 있습니다.
* 참가자 중에는 동명이인이 있을 수 있습니다.
*/
int caseNo = 2;
String caseSol = "Map"; // 처리할 객체 선택 List : ArrayList, Map : HashMap;
switch (caseNo) {
case 1:
participant = new String[] {"leo", "kiki", "eden"};
completion = new String[] {"eden", "kiki"};
break;
case 2:
participant = new String[] {"marina", "josipa", "nikola", "vinko", "filipa"};
completion = new String[] {"josipa", "filipa", "marina", "nikola"};
break;
case 3:
participant = new String[] {"mislav", "stanko", "mislav", "ana"};
completion = new String[] {"stanko", "ana", "mislav"};
break;
}
String answer = "";
switch (caseSol) {
case "List":
answer = solutionList(participant, completion);
break;
case "Map":
answer = solutionMap(participant, completion);
break;
default:
break;
}
System.out.println(answer);
}
public String solutionList(String[] participant, String[] completion){
String answer = "";
// 완주한 사람들 리스트화
List<String> compList = new ArrayList<String>(Arrays.asList(completion));
// 참가자 사람들 만큼 도는 for문
for(String part : participant){
// 완주리스트에서 참가자가 포함되어 있는지 체크
if(compList.contains(part)){
// 포함되어 있으면 완주리스트 에서 제거
compList.remove(part);
} else {
// 포함되어 있지 않은경우 답으로 세팅
answer = part;
}
}
return answer;
}
public String solutionMap(String[] participant, String[] completion){
// ★ 중요한 기본 개념 : HashMap은 중복을 허용하지 않는다는 점을 이용한 알고리즘
String answer = "";
HashMap<String,Integer> hsm = new HashMap<String,Integer>();
// 참가자 리스트를 HashMap에 저장 (단, 같인 키값 존재시 +1 처리 업데이트 처리)
for(String part : participant) hsm.put(part, hsm.getOrDefault(part, 0)+1);
// 완주자 리스트를 HashMap에 저장 (단, 같은 키값 존재시 -1 처리 업데이트)
for(String comp : completion) hsm.put(comp, hsm.get(comp)-1);
// 저장한 데이터 디버깅용 (프로그래머스 테스트시 주석처리 하시면 됩니다.)
// System.out.println("Map : " + hsm.toString());
// hsm의 키값 Iterator 객체화
Iterator<String> keySet = hsm.keySet().iterator();
// 가지고 있는 key 개수 만큼 동작하는 반복문
while(keySet.hasNext()){
// getKey
String key = keySet.next();
// 완주한 사람은 0이므로 완주하지 못한 사람을 얻을 수 있음.
if(hsm.get(key)!=0) answer = key;
}
// 완주하지 못한 사람 리턴
return answer;
}
}
| UTF-8 | Java | 4,050 | java | Marathon.java | Java | [
{
"context": "se 1:\n participant = new String[] {\"leo\", \"kiki\", \"eden\"};\n completion = ne",
"end": 847,
"score": 0.9989005923271179,
"start": 844,
"tag": "NAME",
"value": "leo"
},
{
"context": " participant = new String[] {\"leo\", \"k... | null | [] | package level1;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class Marathon {
/// Fields
private String[] participant;
private String[] completion;
/// Constructor
public Marathon(){
System.out.println("Create Default Constructor");
problem();
}
/// Method
public void problem(){
/**
* 마라톤 경기에 참여한 선수의 수는 1명 이상 100,000명 이하입니다.
* completion의 길이는 participant의 길이보다 1 작습니다.
* 참가자의 이름은 1개 이상 20개 이하의 알파벳 소문자로 이루어져 있습니다.
* 참가자 중에는 동명이인이 있을 수 있습니다.
*/
int caseNo = 2;
String caseSol = "Map"; // 처리할 객체 선택 List : ArrayList, Map : HashMap;
switch (caseNo) {
case 1:
participant = new String[] {"leo", "kiki", "eden"};
completion = new String[] {"eden", "kiki"};
break;
case 2:
participant = new String[] {"marina", "josipa", "nikola", "vinko", "filipa"};
completion = new String[] {"josipa", "filipa", "marina", "nikola"};
break;
case 3:
participant = new String[] {"mislav", "stanko", "mislav", "ana"};
completion = new String[] {"stanko", "ana", "mislav"};
break;
}
String answer = "";
switch (caseSol) {
case "List":
answer = solutionList(participant, completion);
break;
case "Map":
answer = solutionMap(participant, completion);
break;
default:
break;
}
System.out.println(answer);
}
public String solutionList(String[] participant, String[] completion){
String answer = "";
// 완주한 사람들 리스트화
List<String> compList = new ArrayList<String>(Arrays.asList(completion));
// 참가자 사람들 만큼 도는 for문
for(String part : participant){
// 완주리스트에서 참가자가 포함되어 있는지 체크
if(compList.contains(part)){
// 포함되어 있으면 완주리스트 에서 제거
compList.remove(part);
} else {
// 포함되어 있지 않은경우 답으로 세팅
answer = part;
}
}
return answer;
}
public String solutionMap(String[] participant, String[] completion){
// ★ 중요한 기본 개념 : HashMap은 중복을 허용하지 않는다는 점을 이용한 알고리즘
String answer = "";
HashMap<String,Integer> hsm = new HashMap<String,Integer>();
// 참가자 리스트를 HashMap에 저장 (단, 같인 키값 존재시 +1 처리 업데이트 처리)
for(String part : participant) hsm.put(part, hsm.getOrDefault(part, 0)+1);
// 완주자 리스트를 HashMap에 저장 (단, 같은 키값 존재시 -1 처리 업데이트)
for(String comp : completion) hsm.put(comp, hsm.get(comp)-1);
// 저장한 데이터 디버깅용 (프로그래머스 테스트시 주석처리 하시면 됩니다.)
// System.out.println("Map : " + hsm.toString());
// hsm의 키값 Iterator 객체화
Iterator<String> keySet = hsm.keySet().iterator();
// 가지고 있는 key 개수 만큼 동작하는 반복문
while(keySet.hasNext()){
// getKey
String key = keySet.next();
// 완주한 사람은 0이므로 완주하지 못한 사람을 얻을 수 있음.
if(hsm.get(key)!=0) answer = key;
}
// 완주하지 못한 사람 리턴
return answer;
}
}
| 4,050 | 0.509712 | 0.502943 | 113 | 29.070797 | 23.903463 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.628319 | false | false | 9 |
7f9e52d264e65b2771866a1c08dff6d03d466649 | 14,448,270,047,289 | 7767b9792f3c253b73cb6719d955087a7f1d3870 | /src/main/java/Constants.java | 4199e2bd15430ada1e9e8bc81219cba65796f399 | [] | no_license | zhtaoang/HVAC | https://github.com/zhtaoang/HVAC | bde6c59f3c10b254a06ac85895ab7ecd6486827c | cce36215d1c407e23f321b925f398bd1f66abf64 | refs/heads/master | 2021-01-24T02:46:08.038000 | 2016-06-16T19:58:24 | 2016-06-16T19:58:24 | 61,158,778 | 0 | 0 | null | true | 2016-06-14T22:04:01 | 2016-06-14T22:03:59 | 2016-06-13T04:07:07 | 2016-06-13T04:07:07 | 94 | 0 | 0 | 0 | null | null | null | public class Constants {
public static final String INVALID_TEMP_RANGE_MESSAGE = "Max temperature should be at least five degrees warmer than min temperature.";
public static final int PORT = 9999;
public static String getInvalidTempRangeMessage() {
return INVALID_TEMP_RANGE_MESSAGE;
}
public static int getPORT() {
return PORT;
}
}
| UTF-8 | Java | 350 | java | Constants.java | Java | [] | null | [] | public class Constants {
public static final String INVALID_TEMP_RANGE_MESSAGE = "Max temperature should be at least five degrees warmer than min temperature.";
public static final int PORT = 9999;
public static String getInvalidTempRangeMessage() {
return INVALID_TEMP_RANGE_MESSAGE;
}
public static int getPORT() {
return PORT;
}
}
| 350 | 0.751429 | 0.74 | 16 | 20.875 | 34.071388 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false | 9 |
ac9a587c9c19854fd5620b8ec990eb2580e52970 | 11,278,584,179,618 | 05a4fd0588a1b6ee65cc81506e0fe01679bf0aa4 | /src/main/java/com/novli/netty/chat/vo/MyFriendsVo.java | 68d1a5631b18bf5532fe2f2081044ec34b475463 | [] | no_license | FatLi1989/netty-chat | https://github.com/FatLi1989/netty-chat | 804f605d99e9fe07d3bd213f299fcff728e22155 | 0182ffc44ef935db5d318c752475653eb865fb7e | refs/heads/master | 2020-05-27T21:48:05.156000 | 2019-07-08T00:20:09 | 2019-07-08T00:20:09 | 188,799,496 | 0 | 0 | null | false | 2019-10-30T00:55:06 | 2019-05-27T08:06:30 | 2019-07-08T00:20:28 | 2019-10-30T00:55:05 | 78 | 0 | 0 | 1 | Java | false | false | package com.novli.netty.chat.vo;
import lombok.Data;
@Data
public class MyFriendsVo {
private String myFriendUserId;
private String myFriendUserName;
private String myFriendFaceImage;
private String myFriendNickName;
}
| UTF-8 | Java | 237 | java | MyFriendsVo.java | Java | [
{
"context": "String myFriendUserId;\n private String myFriendUserName;\n private String myFriendFaceImage;\n privat",
"end": 158,
"score": 0.7079179883003235,
"start": 150,
"tag": "USERNAME",
"value": "UserName"
}
] | null | [] | package com.novli.netty.chat.vo;
import lombok.Data;
@Data
public class MyFriendsVo {
private String myFriendUserId;
private String myFriendUserName;
private String myFriendFaceImage;
private String myFriendNickName;
}
| 237 | 0.772152 | 0.772152 | 11 | 20.545454 | 15.257568 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 9 |
edf294c42dd172438bb7693584ac88f82eaa8c48 | 17,136,919,567,472 | 2d2ef4e52a6576d48cee1292120a9058d4a66d6e | /rate-limiter/src/main/java/com/ratelimiter/controller/HealthCheck.java | fafcbd0bdca54fe969708bf225a49299466bb7f5 | [] | no_license | PeacefulAbhyasi/System-Design | https://github.com/PeacefulAbhyasi/System-Design | ee2db2c278383bb10d3a5e3034a781c4552ebae6 | 2a5f991a078d648305fdcd783d6a170ebc46f3e0 | refs/heads/master | 2022-10-23T07:02:31.713000 | 2020-06-16T19:38:34 | 2020-06-16T19:38:34 | 33,315,025 | 0 | 0 | null | false | 2020-06-16T19:38:35 | 2015-04-02T15:03:15 | 2020-06-16T19:07:08 | 2020-06-16T19:38:34 | 0 | 0 | 0 | 0 | null | false | false | package com.ratelimiter.controller;
import com.ratelimiter.constant.ApiConstant;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(ApiConstant.BASE_URL)
public class HealthCheck {
@GetMapping(ApiConstant.HEALTH_CHECK)
public ResponseEntity<String> healthCheck() {
return new ResponseEntity(new String("{\"status\":\"UP\"}"), HttpStatus.OK);
}
}
| UTF-8 | Java | 627 | java | HealthCheck.java | Java | [] | null | [] | package com.ratelimiter.controller;
import com.ratelimiter.constant.ApiConstant;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(ApiConstant.BASE_URL)
public class HealthCheck {
@GetMapping(ApiConstant.HEALTH_CHECK)
public ResponseEntity<String> healthCheck() {
return new ResponseEntity(new String("{\"status\":\"UP\"}"), HttpStatus.OK);
}
}
| 627 | 0.797448 | 0.797448 | 18 | 33.833332 | 24.833334 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
02517cc3f150949c12d303d2a407b8035e93bd90 | 33,612,414,108,119 | 20835457e672fcf4b300f006b570507644df8851 | /src/com/window/mainWindow.java | fab8bf032e62034919506cc0e9b6307af87d02d9 | [] | no_license | CSU-512/Operating-system | https://github.com/CSU-512/Operating-system | 3b30adfd9dd55017d43e44e0c9817e1a1489cbf4 | 6690d229601a1c383a7d1f8a2a75994d9f843d1b | refs/heads/master | 2020-03-22T11:03:48.710000 | 2018-07-09T17:46:34 | 2018-07-09T17:46:34 | 139,943,918 | 0 | 0 | null | false | 2018-07-07T08:01:36 | 2018-07-06T06:42:03 | 2018-07-07T07:59:11 | 2018-07-07T07:59:10 | 36 | 0 | 0 | 0 | Java | false | null | package com.window;
import com.exception.InternalStorageOutOfStorageException;
import com.exception.OSException;
import com.fileSystem.FilePrivilege;
import com.fileSystem.FileSystem;
import com.fileSystem.FileTypeEnum;
import com.fileSystem.INode;
import com.userManagement.User;
import com.userManagement.UserManagement;
import javafx.util.Pair;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Style;
import javax.swing.text.StyledDocument;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
class FileNode extends DefaultMutableTreeNode{
private int type; //文件类型,目录or文件,0为目录,1为文件
@Override
public boolean isLeaf() {
if(type == 1){
return true;
}else{
return false;
}
}
public FileNode(String name){
super(name);
}
public void setType(int i){
type = i;
}
}
public class mainWindow extends JFrame{
private UserManagement userManagement;
private User currentUser;
private JTree fileTree;
private JPopupMenu popupMenu;
private JTextPane fileDisplay, commandLine;
private FileSystem fileSystem;
private static boolean DELETING = false;
private TreePath pastePath; //用于粘贴的地址
private int pastePrefix = 0; //粘贴前缀,无,复制,剪切
private String commandPath = "~";
private Set<String> keywords;
private JButton openButton = new JButton("打开");
private JButton editButton = new JButton("修改");
private JButton saveButton = new JButton("保存");
private JButton cancelButton = new JButton("取消");
public mainWindow(UserManagement userManagement, User currentUser){
this.userManagement = userManagement;
this.currentUser = currentUser;
this.setLayout(null);
this.setSize(1000,1000);
this.setTitle("UNIX FileSystem | username: " + currentUser.getUserName() + " UID: " + currentUser.getUID());
this.setLocationRelativeTo(null);
fileSystem = new FileSystem(userManagement, currentUser);
try {
org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF();
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//SwingUtilities.updateComponentTreeUI(this);
} catch (Exception e) {
e.printStackTrace();
}
fileDisplay = new JTextPane();
commandLine = new JTextPane();
JScrollPane jscForDisplay = new JScrollPane(fileDisplay);
JScrollPane jscForCommand = new JScrollPane(commandLine);
JLabel menuLabel = new JLabel("目录");
JLabel contentLabel = new JLabel("文件内容");
JLabel commandLabel = new JLabel("命令行");
menuLabel.setFont(new Font("Courier",Font.ITALIC,20));
contentLabel.setFont(new Font("Courier",Font.ITALIC,20));
commandLabel.setFont(new Font("Courier",Font.ITALIC,20));
initFileTree(); //初始化文件列表
initButtons();
popMenu();
initPane();
initMenuBar();
JScrollPane jScrollPane = new JScrollPane(fileTree);
initDict();
jScrollPane.setBounds(10,50,400,450);
menuLabel.setBounds(10,10,200,50);
contentLabel.setBounds(560,10,200,50);
commandLabel.setBounds(50,540,200,50);
jscForCommand.setBounds(40,600,900,300);
jscForDisplay.setBounds(560,50,400,450);
fileDisplay.setEditable(false);
commandLine.setBackground(Color.GRAY);
commandLine.setForeground(Color.WHITE);
//命令行滑条不显示
jscForCommand.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.add(jscForDisplay);
this.add(jscForCommand);
this.add(menuLabel);
this.add(jScrollPane);
this.add(contentLabel);
this.add(commandLabel);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
}
});
this.setVisible(true);
}
public void initFileTree(){
String currentPath = "~/";
List<Pair<String, FileTypeEnum>> nodeList = fileSystem.showDirectory(currentPath);
FileNode root = new FileNode("~");
root.setType(0);
for(Pair<String, FileTypeEnum> node : nodeList){
FileNode newNode = new FileNode(node.getKey());
switch (node.getValue()){
case INODE_IS_DIRECTORY: {
newNode.setType(0);
} break;
case INODE_IS_REGULAR_FILE:{
newNode.setType(1);
} break;
}
root.add(newNode);
}
DefaultTreeModel defaultTreeModel = new DefaultTreeModel(root);
fileTree = new JTree(defaultTreeModel);
//tree渲染器
DefaultTreeCellRenderer defaultTreeCellRenderer = new DefaultTreeCellRenderer();
defaultTreeCellRenderer.setBackgroundSelectionColor(Color.GRAY);
fileTree.setCellRenderer(defaultTreeCellRenderer);
fileTree.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
TreePath path = fileTree.getPathForLocation(e.getX(),e.getY());
if(path == null){
return;
}
fileTree.setSelectionPath(path);
if(e.getButton() == 3){ //右键
popupMenu.show(fileTree,e.getX(),e.getY());
}
}
});
fileTree.addTreeSelectionListener(new TreeSelectionListener() {
//选择节点触发
@Override
public void valueChanged(TreeSelectionEvent e) {
openButton.setEnabled(true);
editButton.setVisible(false);
saveButton.setVisible(false);
cancelButton.setVisible(false);
fileDisplay.setText("");
TreePath treePath = fileTree.getSelectionPath();
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
if(!DELETING && (selectedNode != null &&!selectedNode.isLeaf())){
openButton.setEnabled(false);
String currentPath = handlePath(treePath.toString());
List<Pair<String, FileTypeEnum>> nodeList = fileSystem.showDirectory(currentPath);
System.out.println(selectedNode.toString());
selectedNode.removeAllChildren();
System.out.println("能不能");
DefaultTreeModel defaultTreeModel1 = (DefaultTreeModel) fileTree.getModel();
if(nodeList.size() != selectedNode.getChildCount()){
for(Pair<String, FileTypeEnum> node : nodeList){
FileNode newNode = new FileNode(node.getKey());
switch (node.getValue()){
case INODE_IS_DIRECTORY: {
newNode.setType(0);
} break;
case INODE_IS_REGULAR_FILE:{
newNode.setType(1);
} break;
}
defaultTreeModel1.insertNodeInto(newNode,selectedNode,selectedNode.getChildCount());
}
}
}
else {
openButton.setEnabled(true);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fileTree.updateUI();
}
});
}
});
}
public void initMenuBar(){
JMenuBar jMenuBar = new JMenuBar();
JMenu jMenu = new JMenu("系统");
JMenuItem jMenuItem = new JMenuItem("新建用户");
JMenuItem checkUserItem = new JMenuItem("查看用户列表");
JMenuItem checkInternalAndExternal = new JMenuItem("查看磁盘和内存信息");
this.setJMenuBar(jMenuBar);
this.setResizable(false);
jMenu.add(jMenuItem);
jMenu.add(checkUserItem);
jMenu.add(checkInternalAndExternal);
jMenuBar.add(jMenu);
jMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new CreateUserDialog(currentUser,userManagement);
}
});
checkUserItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new UserListDialog(userManagement.getUserList());
}
});
checkInternalAndExternal.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("hear");
int esSize = fileSystem.getStorageInfo('E').getKey();
int esInUse = fileSystem.getStorageInfo('E').getValue();
int isSize = fileSystem.getStorageInfo('I').getKey();
int isInUse = fileSystem.getStorageInfo('I').getValue();
new ExternalAndInternalStorageStatusDialog(esSize, esInUse,isSize,isInUse);
}
});
}
//初始化按钮组
public void initButtons(){
JButton closeButton = new JButton("关闭");
//点击修改触发事件
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
String path = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(path);
if(!FilePrivilege.isOKToDo('w', iNode, currentUser)) {
JOptionPane.showMessageDialog(new JFrame(),"权限不足");
return;
}
fileDisplay.setEditable(true);
saveButton.setVisible(true);
cancelButton.setVisible(true);
editButton.setVisible(false);
}
});
//保存
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
//selectedNode.setFileContent(fileDisplay.getText());
fileDisplay.setEditable(false);
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(true);
System.out.println(selectedNode.toString());
TreePath treePath = fileTree.getSelectionPath();
String currentPath = handleFilepath(treePath);
System.out.println(currentPath);
String path = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(path);
if(FilePrivilege.isOKToDo('w', iNode, currentUser)) {
fileSystem.writeFile(currentPath, selectedNode.toString(), fileDisplay.getText());
fileSystem.saveCurrentFileSystem();
}
else{
JOptionPane.showMessageDialog(new JFrame(),"权限不足");
}
}
});
//取消修改
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileDisplay.setEditable(false);
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(true);
}
});
openButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
FileNode selectedNode = (FileNode) treePath.getLastPathComponent();
INode iNode = fileSystem.getINodeInfo(handlePath(treePath.toString()));
if(!FilePrivilege.isOKToDo('r', iNode, currentUser)) {
JOptionPane.showMessageDialog(null,"权限不足");
return;
}
if(selectedNode != null && selectedNode.isLeaf()) { //删除时触发两次会报错
String currentPath = handleFilepath(treePath);
String content = null;
try {
content = fileSystem.readFile(currentPath,selectedNode.toString());
} catch (InternalStorageOutOfStorageException e1) {
e1.printStackTrace();
}
fileDisplay.setText(content);
}
openButton.setEnabled(false);
editButton.setVisible(true);
}
});
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
editButton.setVisible(false);
openButton.setEnabled(true);
fileDisplay.setText("");
}
});
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(false);
editButton.setBounds(500,520,80,30);
saveButton.setBounds(650,520,80,30);
cancelButton.setBounds(800,520,80,30);
openButton.setBounds(440,200,80,30);
closeButton.setBounds(440,250,80,30);
this.add(editButton);
this.add(saveButton);
this.add(cancelButton);
this.add(openButton);
this.add(closeButton);
}
//右键弹窗
public void popMenu(){
JMenuItem addFile, addDirectory, deleteItem, copyItem, cutItem, pasteItem,checkItem,changePrivilegeItem;
popupMenu = new JPopupMenu();
addFile = new JMenuItem("新建文件");
addDirectory = new JMenuItem("新建文件夹");
deleteItem = new JMenuItem("删除");
copyItem = new JMenuItem("复制");
cutItem = new JMenuItem("剪切");
pasteItem = new JMenuItem("粘贴");
checkItem = new JMenuItem("查看INODE");
changePrivilegeItem = new JMenuItem("更改权限");
//添加新文件
addFile.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String newName = JOptionPane.showInputDialog("输入文件名:");
if(newName == null||newName.equals("")){
return;
}
FileNode newNode = new FileNode(newName);
TreePath treePath = fileTree.getSelectionPath();
newNode.setType(1);
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
String currentPath = handlePath(treePath.toString());
fileSystem.newFile(currentPath,newName);
fileSystem.writeFile(currentPath,newName,"");
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
defaultTreeModel.insertNodeInto(newNode,selectedNode,selectedNode.getChildCount());
fileSystem.saveCurrentFileSystem();
System.out.println("expand"+treePath.toString());
fileTree.expandPath(treePath); //添加文件后扩展开文件夹
}
});
//添加新文件夹
addDirectory.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String newName = JOptionPane.showInputDialog("输入文件夹名:");
if(newName == null || newName.equals("")){
return;
}
FileNode newNode = new FileNode(newName);
TreePath treePath = fileTree.getSelectionPath();
newNode.setType(0);
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
if(selectedNode == null){
selectedNode = (FileNode) ((DefaultTreeModel) fileTree.getModel()).getRoot();
}
//添加新文件夹
fileSystem.newDirectory(handlePath(treePath.toString()),newName);
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
defaultTreeModel.insertNodeInto(newNode,selectedNode,selectedNode.getChildCount());
fileSystem.saveCurrentFileSystem();
fileTree.expandPath(treePath); //添加文件夹后扩展开文件夹
}
});
//删除操作
deleteItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DELETING = true;
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
//文件
TreePath treePath = fileTree.getSelectionPath();
String currentPath = handleFilepath(treePath);
fileSystem.remove(currentPath,selectedNode.toString());
fileSystem.saveCurrentFileSystem();
defaultTreeModel.removeNodeFromParent(selectedNode);
fileDisplay.setText("");
DELETING = false;
}
});
//复制
copyItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mainWindow.this.pastePath = fileTree.getSelectionPath();
pastePrefix = 1;
}
});
//剪切
cutItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mainWindow.this.pastePath = fileTree.getSelectionPath();
pastePrefix = 2;
}
});
//粘贴
pasteItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath startPath = pastePath; //起始地址
TreePath destPath = fileTree.getSelectionPath(); //目的地址
FileNode copyNode,destNode = (FileNode) destPath.getLastPathComponent();
String start,dest;
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
switch (pastePrefix){
case 0:{}break;
case 1:{
start = handleFilepath(startPath);
dest = handlePath(destPath.toString());
copyNode = (FileNode) startPath.getLastPathComponent();
System.out.println("start:"+start+" dest:"+dest);
if(!fileSystem.copy(copyNode.toString(),start,dest)){
JOptionPane.showMessageDialog(new JFrame(),"文件重名,粘贴失败");
return;
}
FileNode newNode = (FileNode) copyNode.clone();
defaultTreeModel.insertNodeInto(newNode,destNode,destNode.getChildCount());
}break;
case 2:{
start = handleFilepath(startPath);
dest = handlePath(destPath.toString());
copyNode = (FileNode) startPath.getLastPathComponent();
System.out.println("start:"+start+" dest:"+dest);
if(!fileSystem.move(copyNode.toString(),start,dest)){
JOptionPane.showMessageDialog(new JFrame(),"文件重名,粘贴失败");
return;
}
defaultTreeModel.insertNodeInto(copyNode,destNode,destNode.getChildCount());
}break;
}
//pastePrefix = 0;
fileSystem.saveCurrentFileSystem();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fileTree.updateUI();
}
});
}
});
//查看INODE
checkItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
String current = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(current);
new InodeInfoDialog(iNode.getFileLength(),iNode.getFileType(),iNode.getiNumber(),iNode.getPrivilege(),iNode.getAtime(),iNode.getMtime(),iNode.getCtime());
}
});
changePrivilegeItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
//FileNode selectedNode = (FileNode) treePath.getLastPathComponent();
String path = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(path);
try {
new ChangePrivilegeDialog(iNode,currentUser,userManagement);
} catch (OSException e1) {
e1.printStackTrace();
}
}
});
popupMenu.add(addFile);
popupMenu.add(addDirectory);
popupMenu.add(deleteItem);
popupMenu.add(copyItem);
popupMenu.add(cutItem);
popupMenu.add(pasteItem);
popupMenu.add(checkItem);
popupMenu.add(changePrivilegeItem);
}
public void initDict(){
keywords = new HashSet<>();
keywords.add("touch");
keywords.add("mkdir");
keywords.add("cat");
keywords.add("write");
keywords.add("cp");
keywords.add("mv");
keywords.add("rm");
keywords.add("rmdir");
keywords.add("ls");
keywords.add("clear");
keywords.add("cd");
}
public void initPane(){
fileDisplay.setFont(new Font("Courier",Font.BOLD,20));
commandLine.setFont(new Font("Courier",Font.BOLD,20));
commandLine.setText(currentUser.getUserName()+" "+commandPath+"\n$ ");
commandLine.getDocument().addDocumentListener(new Highlighter(commandLine));
commandLine.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e){
if(e.getKeyCode() == KeyEvent.VK_ENTER){
String line[] = commandLine.getText().split("\n");
String command = line[line.length - 1];
System.out.println(command);
command = command.substring(2);
String firstWord = "";
for(String str : keywords){
if(command.startsWith(str)){
firstWord = str;
break;
}
}
//System.out.println(firstWord);
switch (firstWord){
case "touch":{
String currentPath = commandPath;
//command = command.replace("touch","");
command = command.substring(firstWord.length());
String newName = command.trim();
fileSystem.newFile(currentPath,newName);
fileSystem.writeFile(currentPath,newName,"");
fileSystem.saveCurrentFileSystem();
fileTree.updateUI();
}break;
case "mkdir":{
command = command.substring(firstWord.length());
//command = command.replace("mkdir","");
String newName = command.trim();
fileSystem.newDirectory(commandPath,newName);
fileSystem.saveCurrentFileSystem();
fileTree.updateUI();
}break;
case "cat":{
}break;
case "write":{
//write实例: write ~/abc/acc -m content
command = command.substring(firstWord.length());
int indexOfM = command.indexOf("-m");
if(indexOfM == -1){
commandLine.replaceSelection("write示例:write path/ -m content\n");
break;
}
String path = command.substring(0,indexOfM);
//获取要写文件的绝对路径
path = path.trim();
if(!fileSystem.checkPath(path)){
commandLine.replaceSelection("\"" + path + "\" 不是一个正确的地址\n");
break;
}
//取得当前路径
String currentPath = path.substring(0,path.lastIndexOf('/'));
String filename = path.substring(path.lastIndexOf('/')+1);
System.out.println("path:"+path+" cur:"+currentPath+" file:"+filename);
String content = command.substring(indexOfM+2);
content = content.trim();
INode iNode = fileSystem.getINodeInfo(path);
if(!FilePrivilege.isOKToDo('w', iNode, currentUser)) {
commandLine.replaceSelection("\"" + command + "\" 权限不足\n");
break;
}
fileSystem.writeFile(currentPath,filename,content);
fileSystem.saveCurrentFileSystem();
}break;
case "cp":{
}break;
case "mv":{
}break;
case "rm":{
}break;
case "rmdir":{
}break;
case "ls":{
//文件夹后面加斜杠
List<Pair<String, FileTypeEnum>> nodelist = fileSystem.showDirectory(commandPath);
for(Pair<String, FileTypeEnum> node : nodelist){
switch (node.getValue()){
case INODE_IS_REGULAR_FILE:{
commandLine.replaceSelection(node.getKey()+"\n");
}break;
case INODE_IS_DIRECTORY:{
commandLine.replaceSelection(node.getKey()+"/\n");
}
}
}
}break;
case "clear":{
commandLine.setText("");
}break;
case "cd":{
command = command.substring(firstWord.length());
command = command.trim();
if(!fileSystem.checkPath(command)){
commandLine.replaceSelection("\"" + command + "\" 不是一个正确的地址\n");
break;
}
commandPath = command;
System.out.println(commandPath);
}break;
default:{
commandLine.replaceSelection("\"" + command + "\" 不是一个正确的命令\n");
}break;
}
//换行添加“$”
commandLine.setCaretPosition(commandLine.getDocument().getLength());
commandLine.replaceSelection(currentUser.getUserName()+" "+commandPath+"\n$ ");
}
}
});
}
//处理路径(转换为底层需要的)
public String handlePath(String path){
String newPath;
path = path.substring(1,path.length()-1);
newPath = path.replaceAll(", ","/");
if(newPath.charAt(newPath.length()-1) == '/'){
newPath = newPath.substring(0,newPath.length()-1);
}
return newPath;
}
//专门处理文件需要的路径
public String handleFilepath(TreePath path){
FileNode selectedNode = (FileNode) path.getLastPathComponent();
String currentPath = handlePath(path.toString());
currentPath = currentPath.substring(0,currentPath.length()-selectedNode.toString().length());
if(currentPath.charAt(currentPath.length()-1) == '/'){
currentPath = currentPath.substring(0,currentPath.length()-1);
}
return currentPath;
}
// public static void main(String[] args) {
// new mainWindow();
// }
}
| UTF-8 | Java | 30,569 | java | mainWindow.java | Java | [] | null | [] | package com.window;
import com.exception.InternalStorageOutOfStorageException;
import com.exception.OSException;
import com.fileSystem.FilePrivilege;
import com.fileSystem.FileSystem;
import com.fileSystem.FileTypeEnum;
import com.fileSystem.INode;
import com.userManagement.User;
import com.userManagement.UserManagement;
import javafx.util.Pair;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Style;
import javax.swing.text.StyledDocument;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
class FileNode extends DefaultMutableTreeNode{
private int type; //文件类型,目录or文件,0为目录,1为文件
@Override
public boolean isLeaf() {
if(type == 1){
return true;
}else{
return false;
}
}
public FileNode(String name){
super(name);
}
public void setType(int i){
type = i;
}
}
public class mainWindow extends JFrame{
private UserManagement userManagement;
private User currentUser;
private JTree fileTree;
private JPopupMenu popupMenu;
private JTextPane fileDisplay, commandLine;
private FileSystem fileSystem;
private static boolean DELETING = false;
private TreePath pastePath; //用于粘贴的地址
private int pastePrefix = 0; //粘贴前缀,无,复制,剪切
private String commandPath = "~";
private Set<String> keywords;
private JButton openButton = new JButton("打开");
private JButton editButton = new JButton("修改");
private JButton saveButton = new JButton("保存");
private JButton cancelButton = new JButton("取消");
public mainWindow(UserManagement userManagement, User currentUser){
this.userManagement = userManagement;
this.currentUser = currentUser;
this.setLayout(null);
this.setSize(1000,1000);
this.setTitle("UNIX FileSystem | username: " + currentUser.getUserName() + " UID: " + currentUser.getUID());
this.setLocationRelativeTo(null);
fileSystem = new FileSystem(userManagement, currentUser);
try {
org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF();
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//SwingUtilities.updateComponentTreeUI(this);
} catch (Exception e) {
e.printStackTrace();
}
fileDisplay = new JTextPane();
commandLine = new JTextPane();
JScrollPane jscForDisplay = new JScrollPane(fileDisplay);
JScrollPane jscForCommand = new JScrollPane(commandLine);
JLabel menuLabel = new JLabel("目录");
JLabel contentLabel = new JLabel("文件内容");
JLabel commandLabel = new JLabel("命令行");
menuLabel.setFont(new Font("Courier",Font.ITALIC,20));
contentLabel.setFont(new Font("Courier",Font.ITALIC,20));
commandLabel.setFont(new Font("Courier",Font.ITALIC,20));
initFileTree(); //初始化文件列表
initButtons();
popMenu();
initPane();
initMenuBar();
JScrollPane jScrollPane = new JScrollPane(fileTree);
initDict();
jScrollPane.setBounds(10,50,400,450);
menuLabel.setBounds(10,10,200,50);
contentLabel.setBounds(560,10,200,50);
commandLabel.setBounds(50,540,200,50);
jscForCommand.setBounds(40,600,900,300);
jscForDisplay.setBounds(560,50,400,450);
fileDisplay.setEditable(false);
commandLine.setBackground(Color.GRAY);
commandLine.setForeground(Color.WHITE);
//命令行滑条不显示
jscForCommand.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.add(jscForDisplay);
this.add(jscForCommand);
this.add(menuLabel);
this.add(jScrollPane);
this.add(contentLabel);
this.add(commandLabel);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
}
});
this.setVisible(true);
}
public void initFileTree(){
String currentPath = "~/";
List<Pair<String, FileTypeEnum>> nodeList = fileSystem.showDirectory(currentPath);
FileNode root = new FileNode("~");
root.setType(0);
for(Pair<String, FileTypeEnum> node : nodeList){
FileNode newNode = new FileNode(node.getKey());
switch (node.getValue()){
case INODE_IS_DIRECTORY: {
newNode.setType(0);
} break;
case INODE_IS_REGULAR_FILE:{
newNode.setType(1);
} break;
}
root.add(newNode);
}
DefaultTreeModel defaultTreeModel = new DefaultTreeModel(root);
fileTree = new JTree(defaultTreeModel);
//tree渲染器
DefaultTreeCellRenderer defaultTreeCellRenderer = new DefaultTreeCellRenderer();
defaultTreeCellRenderer.setBackgroundSelectionColor(Color.GRAY);
fileTree.setCellRenderer(defaultTreeCellRenderer);
fileTree.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
super.mousePressed(e);
TreePath path = fileTree.getPathForLocation(e.getX(),e.getY());
if(path == null){
return;
}
fileTree.setSelectionPath(path);
if(e.getButton() == 3){ //右键
popupMenu.show(fileTree,e.getX(),e.getY());
}
}
});
fileTree.addTreeSelectionListener(new TreeSelectionListener() {
//选择节点触发
@Override
public void valueChanged(TreeSelectionEvent e) {
openButton.setEnabled(true);
editButton.setVisible(false);
saveButton.setVisible(false);
cancelButton.setVisible(false);
fileDisplay.setText("");
TreePath treePath = fileTree.getSelectionPath();
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
if(!DELETING && (selectedNode != null &&!selectedNode.isLeaf())){
openButton.setEnabled(false);
String currentPath = handlePath(treePath.toString());
List<Pair<String, FileTypeEnum>> nodeList = fileSystem.showDirectory(currentPath);
System.out.println(selectedNode.toString());
selectedNode.removeAllChildren();
System.out.println("能不能");
DefaultTreeModel defaultTreeModel1 = (DefaultTreeModel) fileTree.getModel();
if(nodeList.size() != selectedNode.getChildCount()){
for(Pair<String, FileTypeEnum> node : nodeList){
FileNode newNode = new FileNode(node.getKey());
switch (node.getValue()){
case INODE_IS_DIRECTORY: {
newNode.setType(0);
} break;
case INODE_IS_REGULAR_FILE:{
newNode.setType(1);
} break;
}
defaultTreeModel1.insertNodeInto(newNode,selectedNode,selectedNode.getChildCount());
}
}
}
else {
openButton.setEnabled(true);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fileTree.updateUI();
}
});
}
});
}
public void initMenuBar(){
JMenuBar jMenuBar = new JMenuBar();
JMenu jMenu = new JMenu("系统");
JMenuItem jMenuItem = new JMenuItem("新建用户");
JMenuItem checkUserItem = new JMenuItem("查看用户列表");
JMenuItem checkInternalAndExternal = new JMenuItem("查看磁盘和内存信息");
this.setJMenuBar(jMenuBar);
this.setResizable(false);
jMenu.add(jMenuItem);
jMenu.add(checkUserItem);
jMenu.add(checkInternalAndExternal);
jMenuBar.add(jMenu);
jMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new CreateUserDialog(currentUser,userManagement);
}
});
checkUserItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new UserListDialog(userManagement.getUserList());
}
});
checkInternalAndExternal.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("hear");
int esSize = fileSystem.getStorageInfo('E').getKey();
int esInUse = fileSystem.getStorageInfo('E').getValue();
int isSize = fileSystem.getStorageInfo('I').getKey();
int isInUse = fileSystem.getStorageInfo('I').getValue();
new ExternalAndInternalStorageStatusDialog(esSize, esInUse,isSize,isInUse);
}
});
}
//初始化按钮组
public void initButtons(){
JButton closeButton = new JButton("关闭");
//点击修改触发事件
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
String path = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(path);
if(!FilePrivilege.isOKToDo('w', iNode, currentUser)) {
JOptionPane.showMessageDialog(new JFrame(),"权限不足");
return;
}
fileDisplay.setEditable(true);
saveButton.setVisible(true);
cancelButton.setVisible(true);
editButton.setVisible(false);
}
});
//保存
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
//selectedNode.setFileContent(fileDisplay.getText());
fileDisplay.setEditable(false);
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(true);
System.out.println(selectedNode.toString());
TreePath treePath = fileTree.getSelectionPath();
String currentPath = handleFilepath(treePath);
System.out.println(currentPath);
String path = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(path);
if(FilePrivilege.isOKToDo('w', iNode, currentUser)) {
fileSystem.writeFile(currentPath, selectedNode.toString(), fileDisplay.getText());
fileSystem.saveCurrentFileSystem();
}
else{
JOptionPane.showMessageDialog(new JFrame(),"权限不足");
}
}
});
//取消修改
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileDisplay.setEditable(false);
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(true);
}
});
openButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
FileNode selectedNode = (FileNode) treePath.getLastPathComponent();
INode iNode = fileSystem.getINodeInfo(handlePath(treePath.toString()));
if(!FilePrivilege.isOKToDo('r', iNode, currentUser)) {
JOptionPane.showMessageDialog(null,"权限不足");
return;
}
if(selectedNode != null && selectedNode.isLeaf()) { //删除时触发两次会报错
String currentPath = handleFilepath(treePath);
String content = null;
try {
content = fileSystem.readFile(currentPath,selectedNode.toString());
} catch (InternalStorageOutOfStorageException e1) {
e1.printStackTrace();
}
fileDisplay.setText(content);
}
openButton.setEnabled(false);
editButton.setVisible(true);
}
});
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
editButton.setVisible(false);
openButton.setEnabled(true);
fileDisplay.setText("");
}
});
saveButton.setVisible(false);
cancelButton.setVisible(false);
editButton.setVisible(false);
editButton.setBounds(500,520,80,30);
saveButton.setBounds(650,520,80,30);
cancelButton.setBounds(800,520,80,30);
openButton.setBounds(440,200,80,30);
closeButton.setBounds(440,250,80,30);
this.add(editButton);
this.add(saveButton);
this.add(cancelButton);
this.add(openButton);
this.add(closeButton);
}
//右键弹窗
public void popMenu(){
JMenuItem addFile, addDirectory, deleteItem, copyItem, cutItem, pasteItem,checkItem,changePrivilegeItem;
popupMenu = new JPopupMenu();
addFile = new JMenuItem("新建文件");
addDirectory = new JMenuItem("新建文件夹");
deleteItem = new JMenuItem("删除");
copyItem = new JMenuItem("复制");
cutItem = new JMenuItem("剪切");
pasteItem = new JMenuItem("粘贴");
checkItem = new JMenuItem("查看INODE");
changePrivilegeItem = new JMenuItem("更改权限");
//添加新文件
addFile.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String newName = JOptionPane.showInputDialog("输入文件名:");
if(newName == null||newName.equals("")){
return;
}
FileNode newNode = new FileNode(newName);
TreePath treePath = fileTree.getSelectionPath();
newNode.setType(1);
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
String currentPath = handlePath(treePath.toString());
fileSystem.newFile(currentPath,newName);
fileSystem.writeFile(currentPath,newName,"");
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
defaultTreeModel.insertNodeInto(newNode,selectedNode,selectedNode.getChildCount());
fileSystem.saveCurrentFileSystem();
System.out.println("expand"+treePath.toString());
fileTree.expandPath(treePath); //添加文件后扩展开文件夹
}
});
//添加新文件夹
addDirectory.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String newName = JOptionPane.showInputDialog("输入文件夹名:");
if(newName == null || newName.equals("")){
return;
}
FileNode newNode = new FileNode(newName);
TreePath treePath = fileTree.getSelectionPath();
newNode.setType(0);
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
if(selectedNode == null){
selectedNode = (FileNode) ((DefaultTreeModel) fileTree.getModel()).getRoot();
}
//添加新文件夹
fileSystem.newDirectory(handlePath(treePath.toString()),newName);
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
defaultTreeModel.insertNodeInto(newNode,selectedNode,selectedNode.getChildCount());
fileSystem.saveCurrentFileSystem();
fileTree.expandPath(treePath); //添加文件夹后扩展开文件夹
}
});
//删除操作
deleteItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DELETING = true;
FileNode selectedNode = (FileNode) fileTree.getLastSelectedPathComponent();
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
//文件
TreePath treePath = fileTree.getSelectionPath();
String currentPath = handleFilepath(treePath);
fileSystem.remove(currentPath,selectedNode.toString());
fileSystem.saveCurrentFileSystem();
defaultTreeModel.removeNodeFromParent(selectedNode);
fileDisplay.setText("");
DELETING = false;
}
});
//复制
copyItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mainWindow.this.pastePath = fileTree.getSelectionPath();
pastePrefix = 1;
}
});
//剪切
cutItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mainWindow.this.pastePath = fileTree.getSelectionPath();
pastePrefix = 2;
}
});
//粘贴
pasteItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath startPath = pastePath; //起始地址
TreePath destPath = fileTree.getSelectionPath(); //目的地址
FileNode copyNode,destNode = (FileNode) destPath.getLastPathComponent();
String start,dest;
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) fileTree.getModel();
switch (pastePrefix){
case 0:{}break;
case 1:{
start = handleFilepath(startPath);
dest = handlePath(destPath.toString());
copyNode = (FileNode) startPath.getLastPathComponent();
System.out.println("start:"+start+" dest:"+dest);
if(!fileSystem.copy(copyNode.toString(),start,dest)){
JOptionPane.showMessageDialog(new JFrame(),"文件重名,粘贴失败");
return;
}
FileNode newNode = (FileNode) copyNode.clone();
defaultTreeModel.insertNodeInto(newNode,destNode,destNode.getChildCount());
}break;
case 2:{
start = handleFilepath(startPath);
dest = handlePath(destPath.toString());
copyNode = (FileNode) startPath.getLastPathComponent();
System.out.println("start:"+start+" dest:"+dest);
if(!fileSystem.move(copyNode.toString(),start,dest)){
JOptionPane.showMessageDialog(new JFrame(),"文件重名,粘贴失败");
return;
}
defaultTreeModel.insertNodeInto(copyNode,destNode,destNode.getChildCount());
}break;
}
//pastePrefix = 0;
fileSystem.saveCurrentFileSystem();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
fileTree.updateUI();
}
});
}
});
//查看INODE
checkItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
String current = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(current);
new InodeInfoDialog(iNode.getFileLength(),iNode.getFileType(),iNode.getiNumber(),iNode.getPrivilege(),iNode.getAtime(),iNode.getMtime(),iNode.getCtime());
}
});
changePrivilegeItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TreePath treePath = fileTree.getSelectionPath();
//FileNode selectedNode = (FileNode) treePath.getLastPathComponent();
String path = handlePath(treePath.toString());
INode iNode = fileSystem.getINodeInfo(path);
try {
new ChangePrivilegeDialog(iNode,currentUser,userManagement);
} catch (OSException e1) {
e1.printStackTrace();
}
}
});
popupMenu.add(addFile);
popupMenu.add(addDirectory);
popupMenu.add(deleteItem);
popupMenu.add(copyItem);
popupMenu.add(cutItem);
popupMenu.add(pasteItem);
popupMenu.add(checkItem);
popupMenu.add(changePrivilegeItem);
}
public void initDict(){
keywords = new HashSet<>();
keywords.add("touch");
keywords.add("mkdir");
keywords.add("cat");
keywords.add("write");
keywords.add("cp");
keywords.add("mv");
keywords.add("rm");
keywords.add("rmdir");
keywords.add("ls");
keywords.add("clear");
keywords.add("cd");
}
public void initPane(){
fileDisplay.setFont(new Font("Courier",Font.BOLD,20));
commandLine.setFont(new Font("Courier",Font.BOLD,20));
commandLine.setText(currentUser.getUserName()+" "+commandPath+"\n$ ");
commandLine.getDocument().addDocumentListener(new Highlighter(commandLine));
commandLine.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e){
if(e.getKeyCode() == KeyEvent.VK_ENTER){
String line[] = commandLine.getText().split("\n");
String command = line[line.length - 1];
System.out.println(command);
command = command.substring(2);
String firstWord = "";
for(String str : keywords){
if(command.startsWith(str)){
firstWord = str;
break;
}
}
//System.out.println(firstWord);
switch (firstWord){
case "touch":{
String currentPath = commandPath;
//command = command.replace("touch","");
command = command.substring(firstWord.length());
String newName = command.trim();
fileSystem.newFile(currentPath,newName);
fileSystem.writeFile(currentPath,newName,"");
fileSystem.saveCurrentFileSystem();
fileTree.updateUI();
}break;
case "mkdir":{
command = command.substring(firstWord.length());
//command = command.replace("mkdir","");
String newName = command.trim();
fileSystem.newDirectory(commandPath,newName);
fileSystem.saveCurrentFileSystem();
fileTree.updateUI();
}break;
case "cat":{
}break;
case "write":{
//write实例: write ~/abc/acc -m content
command = command.substring(firstWord.length());
int indexOfM = command.indexOf("-m");
if(indexOfM == -1){
commandLine.replaceSelection("write示例:write path/ -m content\n");
break;
}
String path = command.substring(0,indexOfM);
//获取要写文件的绝对路径
path = path.trim();
if(!fileSystem.checkPath(path)){
commandLine.replaceSelection("\"" + path + "\" 不是一个正确的地址\n");
break;
}
//取得当前路径
String currentPath = path.substring(0,path.lastIndexOf('/'));
String filename = path.substring(path.lastIndexOf('/')+1);
System.out.println("path:"+path+" cur:"+currentPath+" file:"+filename);
String content = command.substring(indexOfM+2);
content = content.trim();
INode iNode = fileSystem.getINodeInfo(path);
if(!FilePrivilege.isOKToDo('w', iNode, currentUser)) {
commandLine.replaceSelection("\"" + command + "\" 权限不足\n");
break;
}
fileSystem.writeFile(currentPath,filename,content);
fileSystem.saveCurrentFileSystem();
}break;
case "cp":{
}break;
case "mv":{
}break;
case "rm":{
}break;
case "rmdir":{
}break;
case "ls":{
//文件夹后面加斜杠
List<Pair<String, FileTypeEnum>> nodelist = fileSystem.showDirectory(commandPath);
for(Pair<String, FileTypeEnum> node : nodelist){
switch (node.getValue()){
case INODE_IS_REGULAR_FILE:{
commandLine.replaceSelection(node.getKey()+"\n");
}break;
case INODE_IS_DIRECTORY:{
commandLine.replaceSelection(node.getKey()+"/\n");
}
}
}
}break;
case "clear":{
commandLine.setText("");
}break;
case "cd":{
command = command.substring(firstWord.length());
command = command.trim();
if(!fileSystem.checkPath(command)){
commandLine.replaceSelection("\"" + command + "\" 不是一个正确的地址\n");
break;
}
commandPath = command;
System.out.println(commandPath);
}break;
default:{
commandLine.replaceSelection("\"" + command + "\" 不是一个正确的命令\n");
}break;
}
//换行添加“$”
commandLine.setCaretPosition(commandLine.getDocument().getLength());
commandLine.replaceSelection(currentUser.getUserName()+" "+commandPath+"\n$ ");
}
}
});
}
//处理路径(转换为底层需要的)
public String handlePath(String path){
String newPath;
path = path.substring(1,path.length()-1);
newPath = path.replaceAll(", ","/");
if(newPath.charAt(newPath.length()-1) == '/'){
newPath = newPath.substring(0,newPath.length()-1);
}
return newPath;
}
//专门处理文件需要的路径
public String handleFilepath(TreePath path){
FileNode selectedNode = (FileNode) path.getLastPathComponent();
String currentPath = handlePath(path.toString());
currentPath = currentPath.substring(0,currentPath.length()-selectedNode.toString().length());
if(currentPath.charAt(currentPath.length()-1) == '/'){
currentPath = currentPath.substring(0,currentPath.length()-1);
}
return currentPath;
}
// public static void main(String[] args) {
// new mainWindow();
// }
}
| 30,569 | 0.527957 | 0.522128 | 704 | 41.399147 | 25.629652 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.78267 | false | false | 9 |
89e298c5b208d9f0e54425c61c785b37e4434631 | 2,920,577,776,120 | fb0aef42a0013a5c08ae0374ab23483903d31c84 | /epc-web-facade/src/main/java/com/epc/web/facade/bidding/handle/HandleGuaranteeAmountPay.java | f6e5ae9242e79727c8df45dcba4f547f22552bce | [] | no_license | techqiao/easily-purchase | https://github.com/techqiao/easily-purchase | 7a132ed3ee3e7af96d0ce0cbaac887065eaea2fa | 71259df0f5ae2014c1be6a8823e09d6602c3687a | refs/heads/master | 2021-09-25T02:37:51.584000 | 2018-10-17T07:16:22 | 2018-10-17T07:16:22 | 153,409,297 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.epc.web.facade.bidding.handle;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class HandleGuaranteeAmountPay implements Serializable {
private static final long serialVersionUID = -1144436275203450312L;
private Long procurementProjectId;
private Long bIssueDocumentsId;
private BigDecimal tenderGuaranteeAmount;
private String bidsName;
private String bidsCode;
private Long bidsId;
private String receivables;
private String bankAccount;
private Long operateId;
}
| UTF-8 | Java | 575 | java | HandleGuaranteeAmountPay.java | Java | [] | null | [] | package com.epc.web.facade.bidding.handle;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class HandleGuaranteeAmountPay implements Serializable {
private static final long serialVersionUID = -1144436275203450312L;
private Long procurementProjectId;
private Long bIssueDocumentsId;
private BigDecimal tenderGuaranteeAmount;
private String bidsName;
private String bidsCode;
private Long bidsId;
private String receivables;
private String bankAccount;
private Long operateId;
}
| 575 | 0.768696 | 0.735652 | 31 | 17.548388 | 20.217907 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451613 | false | false | 9 |
10562f1caf7c607bd3cd553155f73115fff6574e | 32,925,219,302,688 | 31c85a4dbfe06e6c2cec8a839ad0dd9d0e54b2fe | /src/main/java/org/tarai/orderbook/message/L2SnapshotMessage.java | 7e941dcd7c3a5d053391e75274ac30ba93595203 | [] | no_license | baracuda25/orderbook | https://github.com/baracuda25/orderbook | 63a7381008256601f8591d47e69ddc26efac08dd | 43ae74acbebadc5ccfded7042ea996374c8f3b78 | refs/heads/master | 2023-07-11T00:32:38.248000 | 2021-08-09T11:49:04 | 2021-08-09T11:49:04 | 394,013,218 | 1 | 0 | null | false | 2021-08-09T07:37:56 | 2021-08-08T16:29:18 | 2021-08-09T07:35:49 | 2021-08-09T07:37:55 | 13 | 0 | 0 | 0 | Java | false | false | package org.tarai.orderbook.message;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@JsonTypeName("snapshot")
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class L2SnapshotMessage extends Message {
@JsonProperty("product_id")
private String productId;
private List<Tick> bids = new ArrayList<>();
private List<Tick> asks = new ArrayList<>();
}
| UTF-8 | Java | 639 | java | L2SnapshotMessage.java | Java | [] | null | [] | package org.tarai.orderbook.message;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@JsonTypeName("snapshot")
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class L2SnapshotMessage extends Message {
@JsonProperty("product_id")
private String productId;
private List<Tick> bids = new ArrayList<>();
private List<Tick> asks = new ArrayList<>();
}
| 639 | 0.793427 | 0.791862 | 23 | 26.782608 | 16.870237 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.521739 | false | false | 9 |
13ab0e51702cc81f9b39b54e79f58b76b2e4f09a | 25,305,947,341,182 | c0731f5742b687c6119bf65270f13a4bf83fa098 | /backend/src/main/java/com/carrito/backend/controller/ProductosController.java | 0482d6891fd6dcd6ab5daf38b8252c47ded24952 | [] | no_license | julbar22/carroCompraBackend | https://github.com/julbar22/carroCompraBackend | 84426768e02e0ef1c0099ae77e60456d1671d572 | da7c1ea32d4d2fa4e4f5d85ad24322acef305c2d | refs/heads/master | 2022-07-14T00:39:49.957000 | 2020-05-11T00:36:30 | 2020-05-11T00:36:30 | 262,701,459 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.carrito.backend.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.carrito.backend.entities.Producto;
import com.carrito.backend.services.ProductosService;
@RestController
@RequestMapping("/carroCompras")
@EnableAutoConfiguration
public class ProductosController {
@Autowired
private ProductosService productoService;
@CrossOrigin
@RequestMapping(value = "/productos", method = RequestMethod.GET)
public List<Producto> crearCarrito() {
return productoService.listaProductos();
}
}
| UTF-8 | Java | 884 | java | ProductosController.java | Java | [] | null | [] | package com.carrito.backend.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.carrito.backend.entities.Producto;
import com.carrito.backend.services.ProductosService;
@RestController
@RequestMapping("/carroCompras")
@EnableAutoConfiguration
public class ProductosController {
@Autowired
private ProductosService productoService;
@CrossOrigin
@RequestMapping(value = "/productos", method = RequestMethod.GET)
public List<Producto> crearCarrito() {
return productoService.listaProductos();
}
}
| 884 | 0.835973 | 0.835973 | 28 | 30.571428 | 24.629292 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
94115b278c5e87371455c7a5e5dca7e0d49c041f | 35,338,990,921,369 | fdc8116ce23536f3c592505d2db2a4e3cd3d1a42 | /service/src/main/java/com/excilys/cdb/service/CompanyService.java | ec96fd6983f19050bdc6f8f4bce35a57f2b10c37 | [] | no_license | bozzo1337/computer-database | https://github.com/bozzo1337/computer-database | 3dbaece70dd20f930c689f0906aabe2cf4c8a9e5 | 74d5271cea4e551487a04618dcb7834e1b0ad9f6 | refs/heads/master | 2022-11-28T03:15:31.640000 | 2020-07-30T16:07:15 | 2020-07-30T16:07:15 | 272,381,959 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.excilys.cdb.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.excilys.cdb.dao.DAOCompany;
import com.excilys.cdb.dao.mapper.CompanyMapper;
import com.excilys.cdb.dto.DTOCompany;
import com.excilys.cdb.exception.mapping.MappingException;
import com.excilys.cdb.model.Company;
import com.excilys.cdb.model.Page;
@Service
public class CompanyService {
private static final Logger LOGGER = LoggerFactory.getLogger(CompanyService.class);
private Page<Company> pageCompany;
private Page<DTOCompany> pageCompanyDTO;
private DAOCompany dao;
private String pageHeader = "ID | Name\n";
@Autowired
public CompanyService(DAOCompany dao) {
this.dao = dao;
pageCompany = new Page<Company>(pageHeader);
pageCompanyDTO = new Page<DTOCompany>(pageHeader);
LOGGER.info("CompanyService instantiated");
}
public void resetPages() {
pageCompany.init(dao.count());
}
public void nextPage() {
pageCompany.nextPage();
}
public void previousPage() {
pageCompany.previousPage();
}
public Page<DTOCompany> selectAll() {
dao.findAll(pageCompany);
pageCompany.getEntities().forEach(company -> pageCompanyDTO.getEntities().add(dao.mapToDTO(company)));
return pageCompanyDTO;
}
public DTOCompany selectById(Long id) {
DTOCompany companyDTO = new DTOCompany("");
companyDTO = dao.mapToDTO(dao.findById(id));
return companyDTO;
}
public Page<DTOCompany> selectPage() {
dao.findBatch(pageCompany);
pageCompany.getEntities().forEach(company -> pageCompanyDTO.getEntities().add(dao.mapToDTO(company)));
return pageCompanyDTO;
}
public void delete(DTOCompany companyDTO) {
try {
dao.delete(CompanyMapper.map(companyDTO));
} catch (MappingException e) {
LOGGER.error("Error during delete company", e);
}
}
}
| UTF-8 | Java | 1,897 | java | CompanyService.java | Java | [] | null | [] | package com.excilys.cdb.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.excilys.cdb.dao.DAOCompany;
import com.excilys.cdb.dao.mapper.CompanyMapper;
import com.excilys.cdb.dto.DTOCompany;
import com.excilys.cdb.exception.mapping.MappingException;
import com.excilys.cdb.model.Company;
import com.excilys.cdb.model.Page;
@Service
public class CompanyService {
private static final Logger LOGGER = LoggerFactory.getLogger(CompanyService.class);
private Page<Company> pageCompany;
private Page<DTOCompany> pageCompanyDTO;
private DAOCompany dao;
private String pageHeader = "ID | Name\n";
@Autowired
public CompanyService(DAOCompany dao) {
this.dao = dao;
pageCompany = new Page<Company>(pageHeader);
pageCompanyDTO = new Page<DTOCompany>(pageHeader);
LOGGER.info("CompanyService instantiated");
}
public void resetPages() {
pageCompany.init(dao.count());
}
public void nextPage() {
pageCompany.nextPage();
}
public void previousPage() {
pageCompany.previousPage();
}
public Page<DTOCompany> selectAll() {
dao.findAll(pageCompany);
pageCompany.getEntities().forEach(company -> pageCompanyDTO.getEntities().add(dao.mapToDTO(company)));
return pageCompanyDTO;
}
public DTOCompany selectById(Long id) {
DTOCompany companyDTO = new DTOCompany("");
companyDTO = dao.mapToDTO(dao.findById(id));
return companyDTO;
}
public Page<DTOCompany> selectPage() {
dao.findBatch(pageCompany);
pageCompany.getEntities().forEach(company -> pageCompanyDTO.getEntities().add(dao.mapToDTO(company)));
return pageCompanyDTO;
}
public void delete(DTOCompany companyDTO) {
try {
dao.delete(CompanyMapper.map(companyDTO));
} catch (MappingException e) {
LOGGER.error("Error during delete company", e);
}
}
}
| 1,897 | 0.761729 | 0.760675 | 69 | 26.492754 | 23.786869 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.478261 | false | false | 9 |
92865159bf14b53420435d3decb5f09fe8bf712d | 18,227,841,261,315 | d9a2debf84864b0b0b840f98a095e9371994bd51 | /SoftwareEngineeringProject/src/edu/ycp/cs320/fokemon_webApp/client/LoginService.java | d9f29209b8f70463934c8a51811c97cc49b2b298 | [] | no_license | cfeltch537/SoftwareEngineeringProject2 | https://github.com/cfeltch537/SoftwareEngineeringProject2 | 2144672e65bcb38746996e47ec51a946d44ba14d | 9dd6258eef8f7289b39992f107060d9b132e136a | refs/heads/master | 2021-01-22T02:07:58.448000 | 2013-05-06T13:29:21 | 2013-05-06T13:29:21 | 9,449,314 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.ycp.cs320.fokemon_webApp.client;
import java.sql.SQLException;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import edu.ycp.cs320.fokemon_webApp.shared.Player.Player;
import edu.ycp.cs320.fokemon_webApp.shared.Login.Login;
@RemoteServiceRelativePath("login")
public interface LoginService extends RemoteService {
/**
*
*
* @param message a message to send to the server.
* @return true if successful, false otherwise
* @throws SQLException
*/
public Login submitLogin(Login login);
public Login checkUsername(Login login);
}
| UTF-8 | Java | 633 | java | LoginService.java | Java | [] | null | [] | package edu.ycp.cs320.fokemon_webApp.client;
import java.sql.SQLException;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import edu.ycp.cs320.fokemon_webApp.shared.Player.Player;
import edu.ycp.cs320.fokemon_webApp.shared.Login.Login;
@RemoteServiceRelativePath("login")
public interface LoginService extends RemoteService {
/**
*
*
* @param message a message to send to the server.
* @return true if successful, false otherwise
* @throws SQLException
*/
public Login submitLogin(Login login);
public Login checkUsername(Login login);
}
| 633 | 0.774092 | 0.759874 | 23 | 26.52174 | 23.228298 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.826087 | false | false | 9 |
083b1e7d4551e0267cf76b27d86b2b910dc1cd06 | 35,150,012,352,621 | 7f58784e6edb808216f5fdf2ddcc1d276e32f131 | /armitage/src/main/java/msf/RpcQueue.java | 391df39d9f3c02358ab94498d37193a2dcf9b964 | [
"LGPL-2.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | hoodsware/armitage | https://github.com/hoodsware/armitage | ead17cab2513ac57c6850f27aba91373abc63ba2 | cf60646134a20a69bd573b71d967ceaccb227470 | refs/heads/master | 2022-02-06T01:04:54.289000 | 2022-01-23T17:40:59 | 2022-01-23T17:40:59 | 454,200,008 | 2 | 0 | BSD-3-Clause | true | 2022-01-31T23:09:21 | 2022-01-31T23:09:20 | 2022-01-31T20:53:57 | 2022-01-23T17:40:59 | 49,696 | 0 | 0 | 0 | null | false | false | package msf;
import console.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import msf.*;
import java.math.*;
import java.security.*;
/* A pretty quick and dirty queue for executing RPC commands in turn and discarding their output. This
has to be 100x better than creating a thread for every async thing I want to have happen via an RPC
call */
public class RpcQueue implements Runnable {
protected RpcConnection connection;
protected LinkedList requests = new LinkedList();
private static class Request {
public String method;
public Object[] args;
public RpcCallback callback = null;
}
public RpcQueue(RpcConnection connection) {
this.connection = connection;
new Thread(this).start();
}
protected void processRequest(Request r) {
try {
Object result = connection.execute(r.method, r.args);
if (r.callback != null) {
r.callback.result(result);
}
}
catch (Exception ex) {
armitage.ArmitageMain.print_error("RpcQueue Method '" + r.method + "' failed: " + ex.getMessage());
for (int x = 0; x < r.args.length; x++) {
System.err.println("\t" + x + ": " + r.args[x]);
}
ex.printStackTrace();
/* let the user know something went wrong */
if (r.callback != null) {
Map result = new HashMap();
result.put("error", ex.getMessage());
r.callback.result((Object)result);
}
}
}
public void execute(String method, Object[] args) {
execute(method, args, null);
}
public void execute(String method, Object[] args, RpcCallback callback) {
synchronized (this) {
Request temp = new Request();
temp.method = method;
if (args == null)
temp.args = new Object[0];
else
temp.args = args;
temp.callback = callback;
requests.add(temp);
}
}
protected Request grabRequest() {
synchronized (this) {
return (Request)requests.pollFirst();
}
}
/* keep grabbing requests */
public void run() {
try {
while (true) {
Request next = grabRequest();
if (next != null) {
processRequest(next);
Thread.yield();
}
else {
Thread.sleep(50);
}
}
}
catch (Exception ex) {
ex.printStackTrace();
return;
}
}
}
| UTF-8 | Java | 2,194 | java | RpcQueue.java | Java | [] | null | [] | package msf;
import console.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import msf.*;
import java.math.*;
import java.security.*;
/* A pretty quick and dirty queue for executing RPC commands in turn and discarding their output. This
has to be 100x better than creating a thread for every async thing I want to have happen via an RPC
call */
public class RpcQueue implements Runnable {
protected RpcConnection connection;
protected LinkedList requests = new LinkedList();
private static class Request {
public String method;
public Object[] args;
public RpcCallback callback = null;
}
public RpcQueue(RpcConnection connection) {
this.connection = connection;
new Thread(this).start();
}
protected void processRequest(Request r) {
try {
Object result = connection.execute(r.method, r.args);
if (r.callback != null) {
r.callback.result(result);
}
}
catch (Exception ex) {
armitage.ArmitageMain.print_error("RpcQueue Method '" + r.method + "' failed: " + ex.getMessage());
for (int x = 0; x < r.args.length; x++) {
System.err.println("\t" + x + ": " + r.args[x]);
}
ex.printStackTrace();
/* let the user know something went wrong */
if (r.callback != null) {
Map result = new HashMap();
result.put("error", ex.getMessage());
r.callback.result((Object)result);
}
}
}
public void execute(String method, Object[] args) {
execute(method, args, null);
}
public void execute(String method, Object[] args, RpcCallback callback) {
synchronized (this) {
Request temp = new Request();
temp.method = method;
if (args == null)
temp.args = new Object[0];
else
temp.args = args;
temp.callback = callback;
requests.add(temp);
}
}
protected Request grabRequest() {
synchronized (this) {
return (Request)requests.pollFirst();
}
}
/* keep grabbing requests */
public void run() {
try {
while (true) {
Request next = grabRequest();
if (next != null) {
processRequest(next);
Thread.yield();
}
else {
Thread.sleep(50);
}
}
}
catch (Exception ex) {
ex.printStackTrace();
return;
}
}
}
| 2,194 | 0.645397 | 0.642206 | 96 | 21.854166 | 21.723633 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.34375 | false | false | 9 |
386dc7df69cbd5987287e549b5984c4190337b17 | 35,150,012,353,536 | fd21a4b5b016ca64083fc037008357fb651423f7 | /apifest-api/src/main/java/com/apifest/api/MappingEndpoint.java | 4440f66ae477cb51ec4412a03bf3a580e71f2a03 | [] | no_license | apifest/apifest | https://github.com/apifest/apifest | fa34326329b4b7020aa76903d6081fbcb6a333be | ac44bfde7f4ca0827357dd8960f0ad28dcb00574 | refs/heads/master | 2022-02-09T14:13:31.555000 | 2022-01-24T07:51:44 | 2022-01-24T07:51:44 | 16,709,732 | 11 | 14 | null | false | 2019-03-13T09:13:54 | 2014-02-10T21:20:27 | 2018-09-23T19:24:43 | 2019-03-13T09:13:53 | 349 | 13 | 15 | 3 | Java | false | null | /*
* Copyright 2013-2014, ApiFest 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.apifest.api;
import java.io.Serializable;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
* Represents a mapping with its external and internal endpoints, HTTP method, actions, filters
* and regular expressions used.
*
* @author Rossitsa Borissova
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "endpoint")
public class MappingEndpoint implements Serializable {
public static final String AUTH_TYPE_USER = "user";
public static final String AUTH_TYPE_CLIENT_APP = "client-app";
private static final long serialVersionUID = -1013670420032412311L;
@XmlAttribute(name = "backendPort", required = false)
private Integer backendPort;
@XmlAttribute(name = "backendHost", required = false)
private String backendHost;
// support for multiple vars?
@XmlAttribute(name = "varExpression")
private String varExpression;
@XmlAttribute(name = "varName")
private String varName;
@XmlAttribute(name = "authType", required = false)
private String authType;
@XmlAttribute(name = "scope", required = false)
private String scope;
@XmlAttribute(name = "method", required = true)
private String method;
@XmlAttribute(name = "internal", required = true)
private String internalEndpoint;
@XmlAttribute(name = "external", required = true)
private String externalEndpoint;
@XmlElement(name = "action", type = MappingAction.class)
private MappingAction action;
@XmlElement(name = "filter", type = ResponseFilter.class)
private ResponseFilter filter;
@XmlElement(name = "customAnnotations")
private Map<String, String> customProperties;
@XmlTransient
private boolean hidden;
public MappingEndpoint() {
}
public MappingEndpoint(String external, String internal, String method, String authRequired, String scope,
MappingAction action, ResponseFilter filter, String varExpr, String varName,
String backendHost, Integer backendPort, Map<String, String> customAnnotations) {
this.externalEndpoint = external;
this.internalEndpoint = internal;
this.method = method;
this.authType = authRequired;
this.scope = scope;
this.action = action;
this.filter = filter;
this.varExpression = varExpr;
this.varName = varName;
this.backendHost = backendHost;
this.backendPort = backendPort;
this.customProperties = customAnnotations;
}
public String getExternalEndpoint() {
return externalEndpoint;
}
public void setExternalEndpoint(String externalEndpoint) {
this.externalEndpoint = externalEndpoint;
}
public String getInternalEndpoint() {
return internalEndpoint;
}
public void setInternalEndpoint(String internalEndpoint) {
this.internalEndpoint = internalEndpoint;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getAuthType() {
return authType;
}
public void setAuthType(String authType) {
this.authType = authType;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public MappingAction getAction() {
return action;
}
public void setAction(MappingAction action) {
this.action = action;
}
public ResponseFilter getFilter() {
return filter;
}
public void setFilters(ResponseFilter filter) {
this.filter = filter;
}
public String getVarExpression() {
return varExpression;
}
public void setVarExpression(String varExpression) {
this.varExpression = varExpression;
}
public String getVarName() {
return varName;
}
public void setVarName(String varName) {
this.varName = varName;
}
public Integer getBackendPort() {
return backendPort;
}
public void setBackendPort(Integer backendPort) {
this.backendPort = backendPort;
}
public String getBackendHost() {
return backendHost;
}
public void setBackendHost(String backendHost) {
this.backendHost = backendHost;
}
public Map<String, String> getCustomProperties() {
return customProperties;
}
public void setCustomProperties(Map<String, String> customProperties) {
this.customProperties = customProperties;
}
public boolean isHidden()
{
return hidden;
}
public void setHidden(boolean hidden)
{
this.hidden = hidden;
}
/**
* Unique mapping endpoint key is constructed from mapping endpoint method and
* mapping endpoint external endpoint.
*
* @return mapping endpoint unique key
*/
public String getUniqueKey() {
return getMethod() + getExternalEndpoint();
}
}
| UTF-8 | Java | 5,851 | java | MappingEndpoint.java | Java | [
{
"context": "ers\n * and regular expressions used.\n *\n * @author Rossitsa Borissova\n *\n */\n@XmlAccessorType(XmlAccessType.FIELD)\n@Xml",
"end": 1125,
"score": 0.999848484992981,
"start": 1107,
"tag": "NAME",
"value": "Rossitsa Borissova"
}
] | null | [] | /*
* Copyright 2013-2014, ApiFest 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.apifest.api;
import java.io.Serializable;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
* Represents a mapping with its external and internal endpoints, HTTP method, actions, filters
* and regular expressions used.
*
* @author <NAME>
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "endpoint")
public class MappingEndpoint implements Serializable {
public static final String AUTH_TYPE_USER = "user";
public static final String AUTH_TYPE_CLIENT_APP = "client-app";
private static final long serialVersionUID = -1013670420032412311L;
@XmlAttribute(name = "backendPort", required = false)
private Integer backendPort;
@XmlAttribute(name = "backendHost", required = false)
private String backendHost;
// support for multiple vars?
@XmlAttribute(name = "varExpression")
private String varExpression;
@XmlAttribute(name = "varName")
private String varName;
@XmlAttribute(name = "authType", required = false)
private String authType;
@XmlAttribute(name = "scope", required = false)
private String scope;
@XmlAttribute(name = "method", required = true)
private String method;
@XmlAttribute(name = "internal", required = true)
private String internalEndpoint;
@XmlAttribute(name = "external", required = true)
private String externalEndpoint;
@XmlElement(name = "action", type = MappingAction.class)
private MappingAction action;
@XmlElement(name = "filter", type = ResponseFilter.class)
private ResponseFilter filter;
@XmlElement(name = "customAnnotations")
private Map<String, String> customProperties;
@XmlTransient
private boolean hidden;
public MappingEndpoint() {
}
public MappingEndpoint(String external, String internal, String method, String authRequired, String scope,
MappingAction action, ResponseFilter filter, String varExpr, String varName,
String backendHost, Integer backendPort, Map<String, String> customAnnotations) {
this.externalEndpoint = external;
this.internalEndpoint = internal;
this.method = method;
this.authType = authRequired;
this.scope = scope;
this.action = action;
this.filter = filter;
this.varExpression = varExpr;
this.varName = varName;
this.backendHost = backendHost;
this.backendPort = backendPort;
this.customProperties = customAnnotations;
}
public String getExternalEndpoint() {
return externalEndpoint;
}
public void setExternalEndpoint(String externalEndpoint) {
this.externalEndpoint = externalEndpoint;
}
public String getInternalEndpoint() {
return internalEndpoint;
}
public void setInternalEndpoint(String internalEndpoint) {
this.internalEndpoint = internalEndpoint;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getAuthType() {
return authType;
}
public void setAuthType(String authType) {
this.authType = authType;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public MappingAction getAction() {
return action;
}
public void setAction(MappingAction action) {
this.action = action;
}
public ResponseFilter getFilter() {
return filter;
}
public void setFilters(ResponseFilter filter) {
this.filter = filter;
}
public String getVarExpression() {
return varExpression;
}
public void setVarExpression(String varExpression) {
this.varExpression = varExpression;
}
public String getVarName() {
return varName;
}
public void setVarName(String varName) {
this.varName = varName;
}
public Integer getBackendPort() {
return backendPort;
}
public void setBackendPort(Integer backendPort) {
this.backendPort = backendPort;
}
public String getBackendHost() {
return backendHost;
}
public void setBackendHost(String backendHost) {
this.backendHost = backendHost;
}
public Map<String, String> getCustomProperties() {
return customProperties;
}
public void setCustomProperties(Map<String, String> customProperties) {
this.customProperties = customProperties;
}
public boolean isHidden()
{
return hidden;
}
public void setHidden(boolean hidden)
{
this.hidden = hidden;
}
/**
* Unique mapping endpoint key is constructed from mapping endpoint method and
* mapping endpoint external endpoint.
*
* @return mapping endpoint unique key
*/
public String getUniqueKey() {
return getMethod() + getExternalEndpoint();
}
}
| 5,839 | 0.680738 | 0.67544 | 220 | 25.595455 | 23.641546 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.440909 | false | false | 9 |
7cf8bf5668e2024e42efc5e648fac1c4f150873a | 1,864,015,866,603 | 81eeed004e62bff9115067797b7995d268f0c87b | /TestTask/src/main/java/com/company/controllers/DataStoringController.java | a78a2cfe78bb3fbe93c11124a8e5738a9341f38b | [] | no_license | myTempUsername123/TestTask | https://github.com/myTempUsername123/TestTask | 54b0ecc7f6faa4b985a995774045a7421d73afae | ce7d67ca8b2786ee8d64b390f36a4b04daaef820 | refs/heads/master | 2020-04-02T04:51:37.009000 | 2018-10-22T08:59:55 | 2018-10-22T08:59:55 | 154,039,455 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.company.controllers;
import com.company.models.UrlDto;
import com.company.repositories.FilesAndUrlsRepository;
import com.company.services.FileService;
import com.company.services.UrlService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@Path("url")
public class DataStoringController {
private FilesAndUrlsRepository repository = new FilesAndUrlsRepository();
private FileService fileService = new FileService(repository);
private UrlService urlService = new UrlService(repository, fileService);
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<UrlDto> listUrls(){
return urlService.getAllUrls();
}
@GET
@Path("/id/{id}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getFileById(@PathParam("id") long id){
return Response.ok(fileService.getFileById(id), MediaType.APPLICATION_OCTET_STREAM)
.build();
}
@POST
@Consumes({MediaType.APPLICATION_JSON})
public Response addUrlToDownload(String url) {
String s = urlService.addUrlAndStartDownloading(url);
return Response.ok(s).build();
}
@POST
@Path("/list")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response addListOfUrlsToDownload(List<String> urls){
return Response.ok(urlService.addListOfUrlsAndStartDownloading(urls)).build();
}
}
| UTF-8 | Java | 1,482 | java | DataStoringController.java | Java | [] | null | [] | package com.company.controllers;
import com.company.models.UrlDto;
import com.company.repositories.FilesAndUrlsRepository;
import com.company.services.FileService;
import com.company.services.UrlService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@Path("url")
public class DataStoringController {
private FilesAndUrlsRepository repository = new FilesAndUrlsRepository();
private FileService fileService = new FileService(repository);
private UrlService urlService = new UrlService(repository, fileService);
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<UrlDto> listUrls(){
return urlService.getAllUrls();
}
@GET
@Path("/id/{id}")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getFileById(@PathParam("id") long id){
return Response.ok(fileService.getFileById(id), MediaType.APPLICATION_OCTET_STREAM)
.build();
}
@POST
@Consumes({MediaType.APPLICATION_JSON})
public Response addUrlToDownload(String url) {
String s = urlService.addUrlAndStartDownloading(url);
return Response.ok(s).build();
}
@POST
@Path("/list")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response addListOfUrlsToDownload(List<String> urls){
return Response.ok(urlService.addListOfUrlsAndStartDownloading(urls)).build();
}
}
| 1,482 | 0.721323 | 0.721323 | 50 | 28.639999 | 25.500401 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.38 | false | false | 9 |
e6910a859b8acf06af139828739aa0a3283a3b33 | 36,481,452,222,825 | f7bc6715dc044e636308009bd27c32eb8085895e | /libraries/mockito/src/main/java/com/frontbackend/libraries/mockito/service/ProcessingService.java | 618428d80e8abb537587887d43705baee9e4e56e | [
"MIT"
] | permissive | martinwojtus/tutorials | https://github.com/martinwojtus/tutorials | 49198772cede622f7ded5856667a646ae420b361 | f44749aa177d7ab1c32b84fd6dc70855fda12fd5 | refs/heads/master | 2023-02-09T16:07:20.893000 | 2022-09-02T20:20:16 | 2022-09-02T20:20:16 | 187,207,196 | 178 | 576 | MIT | false | 2023-02-04T16:22:45 | 2019-05-17T11:47:35 | 2023-02-02T03:08:54 | 2023-02-04T16:22:44 | 7,012 | 153 | 502 | 35 | JavaScript | false | false | package com.frontbackend.libraries.mockito.service;
import java.util.Arrays;
import java.util.List;
public class ProcessingService {
private final ListProcessor listProcessing;
public ProcessingService(ListProcessor listProcessing) {
this.listProcessing = listProcessing;
}
public List<String> processList(String str) {
List<String> list = Arrays.asList(str, str, str);
return this.listProcessing.processList(list);
}
}
| UTF-8 | Java | 469 | java | ProcessingService.java | Java | [] | null | [] | package com.frontbackend.libraries.mockito.service;
import java.util.Arrays;
import java.util.List;
public class ProcessingService {
private final ListProcessor listProcessing;
public ProcessingService(ListProcessor listProcessing) {
this.listProcessing = listProcessing;
}
public List<String> processList(String str) {
List<String> list = Arrays.asList(str, str, str);
return this.listProcessing.processList(list);
}
}
| 469 | 0.729211 | 0.729211 | 18 | 25.055555 | 23.248589 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
4959fa32bed40292338fcf827140443d3a7b6bb7 | 4,063,039,100,784 | a11390434db8fdace48d4b41f03f80931f4d9113 | /project-jee8-webapp/src/main/java/fr/pantheonsorbonne/ufr27/miage/service/ServiceMajDecideur.java | 115ff0bbe7e97b2d4ced4d3feaf1d157a1283c05 | [] | no_license | da-ekchajzer/M1_FRAMEWORK_EJB | https://github.com/da-ekchajzer/M1_FRAMEWORK_EJB | 0e0f677bcc9a4a4d46634c93f64070bb95a1e535 | 3c582318408174f14b5f3991fa53366236af1a43 | refs/heads/jse-train | 2023-02-20T11:05:38.549000 | 2021-01-24T18:56:07 | 2021-01-24T18:56:07 | 310,341,704 | 0 | 6 | null | true | 2021-01-24T18:56:08 | 2020-11-05T15:31:19 | 2021-01-21T16:52:53 | 2021-01-24T18:56:08 | 1,436 | 0 | 3 | 0 | Java | false | false | package fr.pantheonsorbonne.ufr27.miage.service;
import java.util.Collection;
import java.util.Queue;
import fr.pantheonsorbonne.ufr27.miage.jpa.Itineraire;
import fr.pantheonsorbonne.ufr27.miage.service.utils.Retard;
public interface ServiceMajDecideur {
/**
* Retarder/Avancer l'itinéraire associé au retard passé en paramètre puis, en
* cascade, les itinéraires en relation avec cet itinéraire initial
*
* @param retard
* @param isRetard
*/
public void decideRetard(Retard retard, boolean isRetard);
/**
* Récupérer l'ensemble des itinéraires qui sont en relation avec l'itinéraire
* associé au retard passé en paramètre (suffisamment de voyageurs en
* correspondance, départ dans moins de 2h et/ou gare(s) d'arrêt en commun)
*
* @param retard
* @return
*/
public Collection<Retard> getRetardsItineraireEnCorespondance(Retard retard);
/**
* Factorise les différents retards subis par les itinéraires si besoin. Exemple
* : Si un itinéraire est retardé de 15min puis juste après de 10min, on ne va
* pas additionner les 2 retards mais plutôt ne pas prendre en compte le 2ème
* retard pour ne garder que les 15min de retard initiales
*
* @param retards
*/
public void factoriseRetard(Queue<Retard> retards);
/**
* Sélectionne un itinéraire qui passe peut passer sur les mêmes arrêts que ceux
* de l'itinéraire accidenté passé en paramètre
*
* @param itineraire
* @return
*/
public Itineraire selectionnerUnItineraireDeSecours(Itineraire itineraire);
} | UTF-8 | Java | 1,600 | java | ServiceMajDecideur.java | Java | [] | null | [] | package fr.pantheonsorbonne.ufr27.miage.service;
import java.util.Collection;
import java.util.Queue;
import fr.pantheonsorbonne.ufr27.miage.jpa.Itineraire;
import fr.pantheonsorbonne.ufr27.miage.service.utils.Retard;
public interface ServiceMajDecideur {
/**
* Retarder/Avancer l'itinéraire associé au retard passé en paramètre puis, en
* cascade, les itinéraires en relation avec cet itinéraire initial
*
* @param retard
* @param isRetard
*/
public void decideRetard(Retard retard, boolean isRetard);
/**
* Récupérer l'ensemble des itinéraires qui sont en relation avec l'itinéraire
* associé au retard passé en paramètre (suffisamment de voyageurs en
* correspondance, départ dans moins de 2h et/ou gare(s) d'arrêt en commun)
*
* @param retard
* @return
*/
public Collection<Retard> getRetardsItineraireEnCorespondance(Retard retard);
/**
* Factorise les différents retards subis par les itinéraires si besoin. Exemple
* : Si un itinéraire est retardé de 15min puis juste après de 10min, on ne va
* pas additionner les 2 retards mais plutôt ne pas prendre en compte le 2ème
* retard pour ne garder que les 15min de retard initiales
*
* @param retards
*/
public void factoriseRetard(Queue<Retard> retards);
/**
* Sélectionne un itinéraire qui passe peut passer sur les mêmes arrêts que ceux
* de l'itinéraire accidenté passé en paramètre
*
* @param itineraire
* @return
*/
public Itineraire selectionnerUnItineraireDeSecours(Itineraire itineraire);
} | 1,600 | 0.731847 | 0.722293 | 48 | 30.75 | 30.724922 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 9 |
dc5e8ed9a62f6b96665574e74cac713fa42bed9b | 16,295,105,960,828 | 2c70d789aeed6ef643a1a592b812d0321534ed87 | /code/src/org/six11/flatcad/geom/Line.java | b5c703333ba04ac6b98631bd55368234b5220b22 | [
"BSD-3-Clause"
] | permissive | johnsogg/flatcad | https://github.com/johnsogg/flatcad | 9a11fed20dedb756f4d78293dfc53ec64828225c | 268b115236e3e0b4a7977bb5b4ad762cd4d5bb32 | refs/heads/master | 2021-01-23T03:48:06.262000 | 2014-03-05T06:15:28 | 2014-03-05T06:15:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.six11.flatcad.geom;
import org.six11.util.Debug;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
/**
* A line in 3D space. While this is implemented using 'start' and
* 'end' points, this class represents an unbounded line in space that
* runs (abstractly) to +/- infinity. Of course, the finite math the
* computer provides precludes that from being true, but you get the
* point.
**/
public class Line {
/**
* One point on the line.
*/
protected Vertex start;
/**
* Another point on the line (should be different from and
* reasonably far away from 'start' in order to make floating point
* math more solid).
*/
protected Vertex end;
/**
* Make a line with no start/end points. Only here because JUnit
* demands it.
*/
public Line() {
}
/**
* Make a line with the given start and end points.
*/
public Line(Vertex start, Vertex end) {
this.start = start;
this.end = end;
}
/**
* Gets the point that lies some distance along this line measuring
* from the start point, with the distance to the end point being
* 1.0.
*/
public Vertex getParameterizedVertex(double d) {
return getStart().getTranslated(getEnd().getTranslated(getStart().getReverse()).scale(d));
}
/**
* Returns the 'start' point.
*/
public Vertex getStart() {
return start;
}
/**
* Returns the 'end' point.
*/
public Vertex getEnd() {
return end;
}
/**
* Returns the direction of this line, which is a unit vector
* pointing in the direction of start --> end.
*/
public Direction getDirection() {
return new Direction(getEnd().getTranslated(getStart().getReverse()));
}
/**
* Is the indicated point on this line?
*/
public boolean contains(Vertex v) {
Line other;
if (v.isSame(getStart())) {
other = new Line(getParameterizedVertex(0.5), v);
} else {
other = new Line(getStart(), v);
}
double dotProduct = getDirection().dot(other.getDirection());
return Math.abs(1.0 - Math.abs(dotProduct)) < MathUtils.FLOAT_TOLERANCE;
}
/**
* Returns a debugging string in a format similar to <tt>{ {1.0, 2.0,
* 0.5} to { -0.3, 0.0, 0.7 } }</tt>.
*/
public String toString() {
return "{" + start + " to " + end + "}";
}
/**
* Intersects this line with another line, returning a
* <tt>Line.Intersection</tt> object.
*/
public Intersection getIntersection(Line other) {
return new Intersection(this, other);
}
/**
* This class provides information about the results of running an
* intersection calculation between two lines. It tells you if two
* 3D lines intersect at a single point, or if not, what the
* shortest line segment is that can be used to connect the
* two. Results are stored in the public members of an instance.
*/
public static class Intersection {
/**
* The point (if any) along the constructor's lineA argument that
* the intersection or intersecting segment begins.
*/
public Vertex intersectionA;
/**
* The point (if any) along the constructor's lineB argument that
* the intersection or intersecting segment ends.
*/
public Vertex intersectionB;
/**
* The parameter which indicates the location along the
* constructor's lineA argument that the intersection or
* intersecting segment begins. If paramA is between 0..1, it
* means the intersection is between lineA's start/end points.
*/
public double paramA;
/**
* The parameter which indicates the location along the
* constructor's lineB argument that the intersection or
* intersecting segment ends. If paramB is between 0..1, it means
* the intersection is between lineB's start/end points.
*/
public double paramB;
/**
* Returns true if the two lines in 3D space intersect at a single
* point. This is calculated by looking to see if intersectionA
* and intersectionB refer to the same point.
*/
public boolean intersectsAtPoint;
/**
* Attempt to intersect the two given lines. If the two lines are
* coincident or parallel, an IntersectionException is thrown.
*/
public Intersection(Line lineA, Line lineB) throws IntersectionException {
Vertex p13,p43,p21;
// d for denominator, {1,2} as start/end lineA, {3,4} lineB
double d1343, d4321, d1321, d4343, d2121;
double numer, denom;
Vertex p1 = lineA.getStart();
Vertex p2 = lineA.getEnd();
Vertex p3 = lineB.getStart();
Vertex p4 = lineB.getEnd();
p13 = new Vertex(p1.x() - p3.x(), p1.y() - p3.y(), p1.z() - p3.z());
p43 = new Vertex(p4.x() - p3.x(), p4.y() - p3.y(), p4.z() - p3.z());
if (p43.isZero()) {
throw new IntersectionException("Oh no, p43 is zero.");
}
p21 = new Vertex(p2.x() - p1.x(), p2.y() - p1.y(), p2.z() - p1.z());
if (p21.isZero()) {
throw new IntersectionException("Oh no, p21 is zero.");
}
d1343 = p13.x() * p43.x() + p13.y() * p43.y() + p13.z() * p43.z();
d4321 = p43.x() * p21.x() + p43.y() * p21.y() + p43.z() * p21.z();
d1321 = p13.x() * p21.x() + p13.y() * p21.y() + p13.z() * p21.z();
d4343 = p43.x() * p43.x() + p43.y() * p43.y() + p43.z() * p43.z();
d2121 = p21.x() * p21.x() + p21.y() * p21.y() + p21.z() * p21.z();
denom = d2121 * d4343 - d4321 * d4321;
if (Math.abs(denom) < MathUtils.FLOAT_TOLERANCE) {
throw new IntersectionException("Oh no, denom is zero.");
}
numer = d1343 * d4321 - d1321 * d4343;
double ma = numer / denom;
double mb = (d1343 + d4321 * ma) / d4343;
Vertex pa = new Vertex(p1.x() + ma * p21.x(),
p1.y() + ma * p21.y(),
p1.z() + ma * p21.z());
Vertex pb = new Vertex(p3.x() + mb * p43.x(),
p3.y() + mb * p43.y(),
p3.z() + mb * p43.z());
// collect the values into meaningfully named variables
intersectionA = pa;
intersectionB = pb;
paramA = ma;
paramB = mb;
intersectsAtPoint = intersectionA.isSame(intersectionB);
}
/**
* A convenience method for making a line segment from
* intersectionA and intersectionB.
*/
public LineSegment getSegment() {
return new LineSegment(intersectionA, intersectionB);
}
/**
* Returns a nice debugging string.
*/
public String toString() {
return "{Intersection: intersectsAtPoint: " + intersectsAtPoint +
" paramA: " + paramA + " paramB: " + paramB + " intersectionA: " + intersectionA +
" intersectionB: " + intersectionB + "}";
}
}
/* ------------------------------ Test functions. ------- */
@Test public void testParameterizedVertex() {
LineSegment line = new LineSegment(Vertex.ORIGIN, new Vertex(2d, 2d, 2d));
Vertex ones = line.getParameterizedVertex(0.5);
assertEquals(1d, ones.x(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, ones.y(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, ones.z(), MathUtils.FLOAT_TOLERANCE);
Vertex alsoOnes = line.getMidpoint();
assertEquals(1d, alsoOnes.x(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, alsoOnes.y(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, alsoOnes.z(), MathUtils.FLOAT_TOLERANCE);
}
@Test public void testDirection() {
Vertex a = new Vertex(0.0, -0.15, 0.02);
Vertex b = new Vertex(0.0, 0.15, 0.02);
Line line = new Line(a,b);
Direction dir = line.getDirection();
assertEquals(0.0, dir.x(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1.0, dir.y(), MathUtils.FLOAT_TOLERANCE);
assertEquals(0.0, dir.z(), MathUtils.FLOAT_TOLERANCE);
}
@Test public void testContains() {
Vertex a = new Vertex(10d, 0d, 0d);
Vertex b = new Vertex(14d, 3d, 0d);
Vertex c = new Vertex(15d, 0d, 0d);
Vertex d = new Vertex(12d, 1.5, 0d);
Line primary = new Line(a, b);
assertTrue(primary.contains(d));
assertFalse(primary.contains(c));
assertTrue(primary.contains(a));
assertTrue(primary.contains(b));
}
@Test public void testIntersection() {
Line a = new Line(new Vertex(3d, 4d, 4d), new Vertex(5d, 4d, 4d));
Line b = new Line(new Vertex(4d, 4d, 3d), new Vertex(4d, 4d, 5d));
Intersection ix = new Intersection(a, b);
assertNotNull(ix.intersectionA);
assertNotNull(ix.intersectionB);
assertNotNull(ix.getSegment());
assertEquals(0.5, ix.paramA, MathUtils.FLOAT_TOLERANCE);
assertEquals(0.5, ix.paramB, MathUtils.FLOAT_TOLERANCE);
assertTrue(ix.intersectsAtPoint);
}
}
| UTF-8 | Java | 8,798 | java | Line.java | Java | [] | null | [] | package org.six11.flatcad.geom;
import org.six11.util.Debug;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
/**
* A line in 3D space. While this is implemented using 'start' and
* 'end' points, this class represents an unbounded line in space that
* runs (abstractly) to +/- infinity. Of course, the finite math the
* computer provides precludes that from being true, but you get the
* point.
**/
public class Line {
/**
* One point on the line.
*/
protected Vertex start;
/**
* Another point on the line (should be different from and
* reasonably far away from 'start' in order to make floating point
* math more solid).
*/
protected Vertex end;
/**
* Make a line with no start/end points. Only here because JUnit
* demands it.
*/
public Line() {
}
/**
* Make a line with the given start and end points.
*/
public Line(Vertex start, Vertex end) {
this.start = start;
this.end = end;
}
/**
* Gets the point that lies some distance along this line measuring
* from the start point, with the distance to the end point being
* 1.0.
*/
public Vertex getParameterizedVertex(double d) {
return getStart().getTranslated(getEnd().getTranslated(getStart().getReverse()).scale(d));
}
/**
* Returns the 'start' point.
*/
public Vertex getStart() {
return start;
}
/**
* Returns the 'end' point.
*/
public Vertex getEnd() {
return end;
}
/**
* Returns the direction of this line, which is a unit vector
* pointing in the direction of start --> end.
*/
public Direction getDirection() {
return new Direction(getEnd().getTranslated(getStart().getReverse()));
}
/**
* Is the indicated point on this line?
*/
public boolean contains(Vertex v) {
Line other;
if (v.isSame(getStart())) {
other = new Line(getParameterizedVertex(0.5), v);
} else {
other = new Line(getStart(), v);
}
double dotProduct = getDirection().dot(other.getDirection());
return Math.abs(1.0 - Math.abs(dotProduct)) < MathUtils.FLOAT_TOLERANCE;
}
/**
* Returns a debugging string in a format similar to <tt>{ {1.0, 2.0,
* 0.5} to { -0.3, 0.0, 0.7 } }</tt>.
*/
public String toString() {
return "{" + start + " to " + end + "}";
}
/**
* Intersects this line with another line, returning a
* <tt>Line.Intersection</tt> object.
*/
public Intersection getIntersection(Line other) {
return new Intersection(this, other);
}
/**
* This class provides information about the results of running an
* intersection calculation between two lines. It tells you if two
* 3D lines intersect at a single point, or if not, what the
* shortest line segment is that can be used to connect the
* two. Results are stored in the public members of an instance.
*/
public static class Intersection {
/**
* The point (if any) along the constructor's lineA argument that
* the intersection or intersecting segment begins.
*/
public Vertex intersectionA;
/**
* The point (if any) along the constructor's lineB argument that
* the intersection or intersecting segment ends.
*/
public Vertex intersectionB;
/**
* The parameter which indicates the location along the
* constructor's lineA argument that the intersection or
* intersecting segment begins. If paramA is between 0..1, it
* means the intersection is between lineA's start/end points.
*/
public double paramA;
/**
* The parameter which indicates the location along the
* constructor's lineB argument that the intersection or
* intersecting segment ends. If paramB is between 0..1, it means
* the intersection is between lineB's start/end points.
*/
public double paramB;
/**
* Returns true if the two lines in 3D space intersect at a single
* point. This is calculated by looking to see if intersectionA
* and intersectionB refer to the same point.
*/
public boolean intersectsAtPoint;
/**
* Attempt to intersect the two given lines. If the two lines are
* coincident or parallel, an IntersectionException is thrown.
*/
public Intersection(Line lineA, Line lineB) throws IntersectionException {
Vertex p13,p43,p21;
// d for denominator, {1,2} as start/end lineA, {3,4} lineB
double d1343, d4321, d1321, d4343, d2121;
double numer, denom;
Vertex p1 = lineA.getStart();
Vertex p2 = lineA.getEnd();
Vertex p3 = lineB.getStart();
Vertex p4 = lineB.getEnd();
p13 = new Vertex(p1.x() - p3.x(), p1.y() - p3.y(), p1.z() - p3.z());
p43 = new Vertex(p4.x() - p3.x(), p4.y() - p3.y(), p4.z() - p3.z());
if (p43.isZero()) {
throw new IntersectionException("Oh no, p43 is zero.");
}
p21 = new Vertex(p2.x() - p1.x(), p2.y() - p1.y(), p2.z() - p1.z());
if (p21.isZero()) {
throw new IntersectionException("Oh no, p21 is zero.");
}
d1343 = p13.x() * p43.x() + p13.y() * p43.y() + p13.z() * p43.z();
d4321 = p43.x() * p21.x() + p43.y() * p21.y() + p43.z() * p21.z();
d1321 = p13.x() * p21.x() + p13.y() * p21.y() + p13.z() * p21.z();
d4343 = p43.x() * p43.x() + p43.y() * p43.y() + p43.z() * p43.z();
d2121 = p21.x() * p21.x() + p21.y() * p21.y() + p21.z() * p21.z();
denom = d2121 * d4343 - d4321 * d4321;
if (Math.abs(denom) < MathUtils.FLOAT_TOLERANCE) {
throw new IntersectionException("Oh no, denom is zero.");
}
numer = d1343 * d4321 - d1321 * d4343;
double ma = numer / denom;
double mb = (d1343 + d4321 * ma) / d4343;
Vertex pa = new Vertex(p1.x() + ma * p21.x(),
p1.y() + ma * p21.y(),
p1.z() + ma * p21.z());
Vertex pb = new Vertex(p3.x() + mb * p43.x(),
p3.y() + mb * p43.y(),
p3.z() + mb * p43.z());
// collect the values into meaningfully named variables
intersectionA = pa;
intersectionB = pb;
paramA = ma;
paramB = mb;
intersectsAtPoint = intersectionA.isSame(intersectionB);
}
/**
* A convenience method for making a line segment from
* intersectionA and intersectionB.
*/
public LineSegment getSegment() {
return new LineSegment(intersectionA, intersectionB);
}
/**
* Returns a nice debugging string.
*/
public String toString() {
return "{Intersection: intersectsAtPoint: " + intersectsAtPoint +
" paramA: " + paramA + " paramB: " + paramB + " intersectionA: " + intersectionA +
" intersectionB: " + intersectionB + "}";
}
}
/* ------------------------------ Test functions. ------- */
@Test public void testParameterizedVertex() {
LineSegment line = new LineSegment(Vertex.ORIGIN, new Vertex(2d, 2d, 2d));
Vertex ones = line.getParameterizedVertex(0.5);
assertEquals(1d, ones.x(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, ones.y(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, ones.z(), MathUtils.FLOAT_TOLERANCE);
Vertex alsoOnes = line.getMidpoint();
assertEquals(1d, alsoOnes.x(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, alsoOnes.y(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1d, alsoOnes.z(), MathUtils.FLOAT_TOLERANCE);
}
@Test public void testDirection() {
Vertex a = new Vertex(0.0, -0.15, 0.02);
Vertex b = new Vertex(0.0, 0.15, 0.02);
Line line = new Line(a,b);
Direction dir = line.getDirection();
assertEquals(0.0, dir.x(), MathUtils.FLOAT_TOLERANCE);
assertEquals(1.0, dir.y(), MathUtils.FLOAT_TOLERANCE);
assertEquals(0.0, dir.z(), MathUtils.FLOAT_TOLERANCE);
}
@Test public void testContains() {
Vertex a = new Vertex(10d, 0d, 0d);
Vertex b = new Vertex(14d, 3d, 0d);
Vertex c = new Vertex(15d, 0d, 0d);
Vertex d = new Vertex(12d, 1.5, 0d);
Line primary = new Line(a, b);
assertTrue(primary.contains(d));
assertFalse(primary.contains(c));
assertTrue(primary.contains(a));
assertTrue(primary.contains(b));
}
@Test public void testIntersection() {
Line a = new Line(new Vertex(3d, 4d, 4d), new Vertex(5d, 4d, 4d));
Line b = new Line(new Vertex(4d, 4d, 3d), new Vertex(4d, 4d, 5d));
Intersection ix = new Intersection(a, b);
assertNotNull(ix.intersectionA);
assertNotNull(ix.intersectionB);
assertNotNull(ix.getSegment());
assertEquals(0.5, ix.paramA, MathUtils.FLOAT_TOLERANCE);
assertEquals(0.5, ix.paramB, MathUtils.FLOAT_TOLERANCE);
assertTrue(ix.intersectsAtPoint);
}
}
| 8,798 | 0.622983 | 0.588543 | 280 | 30.421429 | 25.742424 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.728571 | false | false | 9 |
38d6f7fd89c19d68adfb1f0f576bfd4e1a547f59 | 24,893,630,456,322 | 8d606be53c760908c884a7b4c4b694529c05079e | /src/main/java/com/es/phoneshop/cart/RecentlyViewedProducts.java | acde9ba5c4db7d0e441c9805ab1ddaa0eecce417 | [] | no_license | DaniilTuruhanov/phoneshop-servlet-api | https://github.com/DaniilTuruhanov/phoneshop-servlet-api | 67fcbea4b49d67b1b3e60f9057c9aa38dd6bf8c7 | fbaebbe0707df5d733f65a3ef7f3c0907d9b5039 | refs/heads/master | 2020-08-26T19:24:58.381000 | 2019-11-29T08:14:33 | 2019-11-29T08:14:33 | 217,119,521 | 0 | 0 | null | true | 2019-12-04T18:18:44 | 2019-10-23T17:51:34 | 2019-11-29T08:14:36 | 2019-12-04T18:15:34 | 110 | 0 | 0 | 3 | Java | false | false | package com.es.phoneshop.cart;
import com.es.phoneshop.model.product.Product;
import java.util.LinkedList;
import java.util.Queue;
public class RecentlyViewedProducts {
private Queue<Product> productQueue;
public RecentlyViewedProducts() {
productQueue = new LinkedList<>();
}
public void addProductInProductQueue(Product product) {
if (productQueue.contains(product)) {
productQueue.remove(product);
productQueue.add(product);
} else {
if (productQueue.size() < 3) {
productQueue.add(product);
} else {
productQueue.poll();
productQueue.add(product);
}
}
}
public Queue<Product> getProductQueue() {
return productQueue;
}
public void setProductQueue(Queue<Product> productQueue) {
this.productQueue = productQueue;
}
}
| UTF-8 | Java | 919 | java | RecentlyViewedProducts.java | Java | [] | null | [] | package com.es.phoneshop.cart;
import com.es.phoneshop.model.product.Product;
import java.util.LinkedList;
import java.util.Queue;
public class RecentlyViewedProducts {
private Queue<Product> productQueue;
public RecentlyViewedProducts() {
productQueue = new LinkedList<>();
}
public void addProductInProductQueue(Product product) {
if (productQueue.contains(product)) {
productQueue.remove(product);
productQueue.add(product);
} else {
if (productQueue.size() < 3) {
productQueue.add(product);
} else {
productQueue.poll();
productQueue.add(product);
}
}
}
public Queue<Product> getProductQueue() {
return productQueue;
}
public void setProductQueue(Queue<Product> productQueue) {
this.productQueue = productQueue;
}
}
| 919 | 0.612622 | 0.611534 | 36 | 24.527779 | 19.244749 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.361111 | false | false | 9 |
230b51d06ad83ceb075e0e7c81f4b8e30b2d415d | 29,351,806,531,680 | b1ac947572661d9930ab544032e8161ef0fb5912 | /src/com/visuc/referentiel/pays/web/actions/EditerPaysAction.java | 96dcf7ed166653b93e4f3708e8244ff5f629b5df | [] | no_license | ndvasava/visucommerce_test | https://github.com/ndvasava/visucommerce_test | 3d9a646819c55008c1915aa61ba4d307c2f45356 | e6d31237a46e952d6208961b9993eab1bdcda856 | refs/heads/master | 2021-01-15T23:50:10.887000 | 2012-02-18T11:12:22 | 2012-02-18T11:12:22 | 2,920,189 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.visuc.referentiel.pays.web.actions;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import javax.transaction.SystemException;
import org.apache.commons.beanutils.BeanUtils;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.framework.Controller;
import org.jboss.seam.framework.EntityNotFoundException;
import org.jboss.seam.international.StatusMessage;
import org.jboss.seam.transaction.Transaction;
import com.visuc.referentiel.devise.entite.Devise;
import com.visuc.referentiel.devise.web.actions.EditerDeviseAction;
import com.visuc.referentiel.langue.entite.Langue;
import com.visuc.referentiel.langue.service.ILangueManager;
import com.visuc.referentiel.pays.entite.Pays;
import com.visuc.referentiel.pays.service.IPaysManager;
import com.visuc.referentiel.ville.entite.Ville;
import com.visuc.referentiel.ville.service.IVilleManager;
@Name("editerPaysAction")
@Scope(ScopeType.CONVERSATION)
@BypassInterceptors
@SuppressWarnings("serial")
public class EditerPaysAction extends Controller {
private Pays instance;
private Object paysId;
private Boolean idDefined;
private ValueExpression newInstance;
private transient boolean dirty;
private transient EntityManager entityManager;
private transient List<Langue> listAvailableLangues;
private transient List<Langue> listSelectedLangues;
private transient List<Ville> listAvailableVilles;
private transient List<Ville> listSelectedVilles;
/******* Declaration des messages specifiques a l'entite pays et ses actions disponibles ***********/
private String deletedMessage = "Suppression effectuée";
private String createdMessage = "Création effectuée";
private String alreadyCreatedMessage = "Création non effectuée : l'enregistrement existe déjà";
private String updatedMessage = "Mise à jour effectuée";
private String unmanagedMessage = "Mise à jour non effectuée : l'enregistrement n'existe pas";
/*********************************************************************************************************************/
/********** Methode en frontal du Backing Bean **********/
public String find() {
// On recherche l'entité associée
initInstance();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"find "+instance.toString());
return "find";
}
public String edit() {
// On recherche l'entité associée
initInstance();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"edit "+instance.toString());
return "edit";
}
// refresh des champs de l'instance de l'action
public void refresh(){
evaluateValueExpression("#{editerPaysAction.instance.nom}");
}
/**
* <p>Cette methode permet gerer les associations et de rafraichir
* l'instance courante une fois que les associations ont ete mises a jour.
* Cette methode <code>wire</code> est declaree dans le fichier devise.page.xml,
* dans la section consacree a la page /views/devise/edit_devise.xhtml
* exemple:
* <pre>
* <page view-id="/views/devise/edit_devise.xhtml">
* <!-- recuperation des donnees en sortie d'une navigation interfonctionnalite. -->
* <action execute="#{editerDeviseAction.wire}"/>
* </pre>
*/
public void wire() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"WIRE");
// gestion lors de la création des saisies existantes avant la selection de l'objet lie, ici saisie du nom
//Events.instance().raiseEvent("event.test");
EditerDeviseAction lEditerDeviseAction = getEditerDeviseAction();
if (lEditerDeviseAction != null) {
Devise lDevise = lEditerDeviseAction.getDefinedInstance();
// Au second appel a selectionner, le pays sera correctement rafraichit
//lEditerPaysAction.clearInstance();
if (lDevise!=null ) {
// tente avant le sePays de le rafraichir pour resoudre le probleme du lien en lazy
//getEntityManager().refresh(lPays);
getInstance().setDevise(lDevise);
System.out.println(" "+getInstance());
}
}
System.out.println(" "+this.instance);
}
public String persist(){
// On sauvegarde l'entité
Pays lEntity = getPaysManager().save(getInstance());
//relie la nouvelle entite du cache JPA a la conversation seam et son bean action
setInstance(lEntity);
//vide le cache de la transaction (l'insert ayant ete joue)
flushIfNecessary();
// stocke le nouvel ID de l'entite depuis le bean action, celui-ci etant vide lors de la demande de creation
assignId(getIdFromObject(lEntity));
// Creation des messages dans le cache Seam, envoi de l'event de refresh de la liste existante dans la recherche
createdMessage();
raiseAfterTransactionSuccessEvent();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"persist");
return "persist";
}
public String update(){
if (getIdFromObject(getInstance()) == null) {
unmanagedMessage();
return null;
}
joinTransaction();
updateListSelected();
Pays lEntity = getPaysManager().update(getInstance());
// Si l'entité retourné est null, c'est qu'il y a eu une erreur.
// on retourne une outcome null (reposition sur la page d'origine)
// la gestion du message d'erreur est à la charge de doUpdate()
if (lEntity == null) {
return null;
}
// Rafraichit la liste des pays devant etre supprimés
lEntity.setSetLangues(new HashSet<Langue>(listSelectedLangues));
lEntity.setListVilles(listSelectedVilles);
// relie l'entite modifiee a partir du cache JPA dans la conversation seam et son bean action
setInstance(lEntity);
// flush de la transaction JPA
flushIfNecessary();
// envoi de l'evt pour declenche le rafraichissement des datas
updatedMessage();
raiseAfterTransactionSuccessEvent();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"update");
return "update";
}
public String remove(){
if (getIdFromObject(getInstance()) == null) {
unmanagedMessage();
return null;
}
getPaysManager().deleteOne(getInstance());
if (getInstance() == null) {
// Retour 'null' de delete = erreur fonctionnelle
return null;
}
flushIfNecessary();
setInstance(null);
// Creation du message resultat de l'action demande et envoi de l'evt pour declenche le rafraichissement des datas
deletedMessage();
raiseAfterTransactionSuccessEvent();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"delete");
return "remove";
}
public String cancel(){
if (getDefinedInstance() == null) {
return "cancel";
}
if (!isManaged()) {
return "cancel";
}
// Doit verifier si l'entite est attaché au cache JPA, il suffit alors de rafraichir l'instance de l'action a partir du cache JPA, sinon il faut jouer le
// initInstance qui lancera un find pour rattacher l'instance de l'action
EntityManager lEntityManager = getEntityManager();
if (lEntityManager != null && lEntityManager.contains(getInstance())) {
// l'entité est attachée
lEntityManager.refresh(getInstance());
} else {
// l'entité est détachée
initInstance();
}
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"cancel");
return "cancel";
}
/********************************************************************************************************************/
/***************** Methodes de requetage ****************/
/*
// Execution de la requete de creation
private Pays querySavePays() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"querySavePays");
return getPaysManager().save(getInstance());
}
// Execution de la requete de de mise a jour
private Pays queryUpdatePays() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"queryUpdatePays");
return getPaysManager().update(getInstance());
}
// Execution de la requete de suppression
private void queryDeletePays() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"queryDeletePays : "+getInstance().getId());
getPaysManager().deleteOne(getInstance());
}
*/
/********************************************************************************************************************/
// Retourne vrai si le pays existe en base de données.
public boolean isManaged() {
return getInstance() != null && isIdDefined();
}
private Object getIdFromObject(Pays aEntity) {
if (aEntity == null) {
NoSuchMethodError lError = new NoSuchMethodError("Méthode getId() inexistante pour l'entité null");
throw lError;
}
return (Object)aEntity.getId();
}
public boolean isIdDefined() {
if (getPaysId() == null) {
return false;
}
if (idDefined == null) {
idDefined = isNotNullKey(getPaysId());
}
return idDefined;
}
// Retourne null si l'action ne gèer actuellement aucune entité (c'est à dire si isIdDefined() return false)
public Pays getDefinedInstance() {
return isIdDefined() ? getInstance() : null;
}
@SuppressWarnings("unchecked")
public static boolean isNotNullKey(Object aKey){
if (aKey == null) {
return false;
}
if (org.springframework.beans.BeanUtils.isSimpleProperty(aKey.getClass())) {
return !"".equals(aKey);
}
Map lMap = null;
try {
lMap = BeanUtils.describe(aKey);
} catch (IllegalAccessException err) {
err.printStackTrace();
} catch (InvocationTargetException err) {
err.printStackTrace();
} catch (NoSuchMethodException err) {
err.printStackTrace();
}
// on itère sur chacune des propriétés
// dès que une non null on renvoie true => mode update
for (Object lEntry : lMap.entrySet()){
Map.Entry lMapEntry = (Map.Entry)lEntry;
String lKey = (String)lMapEntry.getKey();
Object lValue = lMapEntry.getValue();
// la clef class fait partie automatiquement de la Map en plus des attributs
// elle ne nous intéresse pas...
if (!"class".equalsIgnoreCase(lKey) && lValue != null && !"".equals(lValue)) {
return true;
}
}
return false;
}
/********************************************************************************************************************/
/****************** Getter & Setter *********************/
public Long getPaysId() {
return (Long)paysId;
}
public void setPaysId(Long aId) {
if (setDirty(paysId, aId)) {
boolean lIsDebugEnabled = getLog().isDebugEnabled();
if (lIsDebugEnabled) {
getLog().debug("Dirty - setPaysId -> #0, #1", paysId,aId);
}
setInstance(null);
}
paysId = aId;
}
// Cette méthode retourne l'instance managée, méthode appelée dans la page .xhtml sous
// la forme de l'EL : #{entity.instance.attribut} pour accéder au résultat à l'issue d'une recherche
public Pays getInstance() {
joinTransaction();
if (instance == null) {
initInstance();
}
return instance;
}
// Valorise l'instance de l'entité gérée par cette action
// Met à jour setId(Object), en indiquant l'identifiant de l'entité aInstance - l'identifiant étant calculé par la méthode getIdFromObject(Object)
public void setInstance(Pays aInstance) {
setDirty(this.instance, aInstance);
if (aInstance != null) {
assignId(getIdFromObject(aInstance));
}
this.instance = aInstance;
}
public ValueExpression getNewInstance() {
return newInstance;
}
public void setNewInstance(ValueExpression aNewInstance) {
this.newInstance = aNewInstance;
}
/*********************************************************************************************************************/
/**************** Gestion de l'etat instance-entite-Id du bean action de la conversation *****************
/** Met à jour l'identifiant de l'entité gérée par cette action. Mais ne modifie pas l'entite(c'est en fait son instance) de cette action */
void assignId(Object aId) {
setDirty(paysId, aId);
paysId = aId;
idDefined = null;
}
/** Set the dirty flag if the value has changed. Call whenever a subclass attribute is updated */
protected <U> boolean setDirty(U aOldValue, U aNewValue) {
boolean lAttributeDirty = aOldValue != aNewValue && (aOldValue == null || !aOldValue.equals(aNewValue));
dirty = dirty || lAttributeDirty;
return lAttributeDirty;
}
private Pays createInstance() {
if (newInstance != null) {
return (Pays) newInstance.getValue(FacesContext.getCurrentInstance().getELContext());
} else {
try {
return new Pays();
} catch (Exception err) {
throw new RuntimeException(err);
}
}
}
/** Cette méthode doit être appelée pour accéder à un écran vierge. Les actions étant stockées en session,
* le bean managé doit, parfois, être détaché pour permettre un affichage de l'écran vierge. (Ex : un appel
* depuis les menus). */
protected void clearInstance(){
// On détache l'objet de l'action
setInstance(null);
setPaysId(null);
}
protected Pays handleNotFound() throws EntityNotFoundException {
throw new EntityNotFoundException(getPaysId(), this.instance.getClass());
}
/**
* Charge l'instance si l'id est défini, sinon crée une nouvelle instance.
* <br />
* Méthode utilitaire appelée par {@link #getInstance()} pour charger
* l'instance à partir de la base de données (via
* {@link #doFind())si l'id est défini {@link #isIdDefined()} vaut true. Si
* l'id n'est pas défini, une nouvelle instance de l'entité est créé via
* l'appel à {@link #createInstance()}.
*
* @see #doFind()
* @see #createInstance()
*/
protected void initInstance() {
if (isIdDefined()) {
// we cache the instance so that it does not "disappear"
// after remove() is called on the instance
// is this really a Good Idea??
Pays lResult = getPaysManager().findById((Long)getPaysId());
if (lResult == null) {
lResult = handleNotFound();
}
setInstance(lResult);
// met a jour la liste Transient de SelectedItem en mirroir de la liste des pays d'une devise
setListAvailableLangues(getLangueManager().findAllNotlinkedLanguages(getInstance()));
setListSelectedLangues(new ArrayList<Langue>(getInstance().getSetLangues()));
setListAvailableVilles(getVilleManager().findAllNotlinkedVilles(getInstance()));
setListSelectedVilles(getInstance().getListVilles());
} else {
setInstance(createInstance());
}
}
/********************************************************************************************************************/
/* Gestion des listes d'items disponibles et d'items selectionnes pour gérer la collection de langues liés a un pays */
public List<Langue> getListAvailableLangues(){
return listAvailableLangues;
}
public void setListAvailableLangues(List<Langue> aList){
this.listAvailableLangues = aList;
}
public List<Langue> getListSelectedLangues() {
return listSelectedLangues;
}
public void setListSelectedLangues(List<Langue> aListSelectedLangues) {
this.listSelectedLangues = new ArrayList<Langue>();
for(Langue p : aListSelectedLangues){
listSelectedLangues.add(p);
}
}
// remove devise from pays if it is not already existing in instance.getListLangues()
public void updateListSelectedLangues(){
System.out.println(" - - - - - - - - - - - - - - - - - - "+"updateListSelectedLangues");
int i=0;
// Parcours la liste des pays lies a l'instance Devise courante
// -> Si listSelectedLangues ne contient plus un pays de l'instance, on supprime son lien sur la devise.
for(Langue l : this.instance.getSetLangues()){
if(!this.listSelectedLangues.contains(l)){
l.getSetPays().remove(instance);
System.out.println(i+"/ "+l.getNom()+" isRemove");
}
}
i=0;
// Parcours la liste des pays selectionnes, pour ajouter le pays a la liste s'il n'existe pas, et ajouter la langue a la liste de langues liées au pays
// -> Sinon Si le pays n'a pas devise mais existe dans la liste des pays selectionnes a droite, il faut rajouter son lien sur la devise courante
// -> le parcours des instances de la liste et leur modification en direct implique que la liste SelectedLangues est mise à jour en meme temps que instance.getListLangues
for(Langue l : this.listSelectedLangues) {
Set<Pays> s = null;
if(l.getSetPays() == null) {
s = new HashSet<Pays>();
}else{
s = l.getSetPays();
}
s.add(instance);
this.instance.getSetLangues().add(l);
System.out.println(i+"/ "+l.getNom()+" isAdd");
}
}
//-----------------------------------------------------------------------------------------
public List<Ville> getListAvailableVilles(){
return listAvailableVilles;
}
public void setListAvailableVilles(List<Ville> aList){
this.listAvailableVilles = aList;
}
public List<Ville> getListSelectedVilles() {
return listSelectedVilles;
}
public void setListSelectedVilles(List<Ville> aListSelectedVilles) {
this.listSelectedVilles = new ArrayList<Ville>();
for(Ville v : aListSelectedVilles){
listSelectedVilles.add(v);
}
}
public void updateListSelectedVilles(){
System.out.println(" - - - - - - - - - - - - - - - - - - "+"updateListSelectedVilles");
int i=0;
for(Ville v : this.instance.getListVilles()){
if(!this.listSelectedVilles.contains(v)){
v.setPays(null);
System.out.println(i+"/ "+v.getNom()+" isRemove");
}
}
i=0;
for(Ville v : this.listSelectedVilles) {
if(v.getPays() == null) {
v.setPays(instance);
this.instance.getListVilles().add(v);
System.out.println(i+"/ "+v.getNom()+" isAdd");
}
}
}
//-----------------------------------------------------------------------------------------
public void updateListSelected(){
// mise à jour des liens avec les langues
updateListSelectedLangues();
// mise à jour des liens avec les villes
updateListSelectedVilles();
}
/********************************************************************************************************************/
// -------------------------------------------------------------
// Gestionnaire de Services
// -------------------------------------------------------------
/** Acces a l'action Seam editerMatchAction, @return null si l'action Seam n'a pas ete instanciee */
private EditerDeviseAction getEditerDeviseAction() {
return (EditerDeviseAction) Component.getInstance("editerDeviseAction", false);
}
/**
* Service IEquipeManager gere par Spring
* enregistre dans monappli-service.xml
*/
private IPaysManager getPaysManager() {
return super.evaluateValueExpression("#{paysManager}", IPaysManager.class);
}
private ILangueManager getLangueManager() {
return super.evaluateValueExpression("#{langueManager}", ILangueManager.class);
}
private IVilleManager getVilleManager() {
return super.evaluateValueExpression("#{villeManager}", IVilleManager.class);
}
private void joinTransaction() {
EntityManager lEntityManager = getEntityManager();
if (lEntityManager != null && lEntityManager.isOpen()) {
try {
Transaction.instance().enlist(lEntityManager);
} catch (SystemException e) {
throw new RuntimeException("could not join transaction", e);
}
}
}
private EntityManager getEntityManager() {
if (entityManager == null) {
entityManager = (EntityManager) getComponentInstance(getPersistenceContextName());
}
return entityManager;
}
private String getPersistenceContextName() {
return "entityManager";
}
private void flushIfNecessary() {
EntityManager lEntityManager = getEntityManager();
if (lEntityManager != null) {
lEntityManager.flush();
}
}
/********************************************************************************************************************/
/****************** Gestion des evenements declenches par manipulation de l'entite Pays ******/
protected void raiseAfterTransactionSuccessEvent() {
raiseTransactionSuccessEvent("org.jboss.seam.afterTransactionSuccess");
String lSimpleEntityName = getSimpleEntityName();
if (lSimpleEntityName != null) {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"raiseAfterTransactionSuccessEvent : "+"org.jboss.seam.afterTransactionSuccess." + lSimpleEntityName);
raiseTransactionSuccessEvent("org.jboss.seam.afterTransactionSuccess." + lSimpleEntityName);
}
}
// -----------Getter for the entityName
/**Retourne le nom de la classe de l'entité gérée par cette Action sans
* prendre en compte le nom de paquetage (i.e. Employe pour l'entité
* <code>com.natixis.aws.employe.entite.Employe</code>).
*/
protected String getSimpleEntityName() {
String lName = Pays.class.getName();
return lName.lastIndexOf(".") > 0 && lName.lastIndexOf(".") < lName.length() ?
lName.substring(lName.lastIndexOf(".") + 1, lName.length()) : lName;
}
/********************************************************************************************************************/
/****************** Gestion de l'alimentation des messages Seam *********************/
// ----- Prefix a tout message provenant de l'entite Pays
private String getMessageKeyPrefix() {
String lClassName = this.getClass().getName();
return lClassName.substring(lClassName.lastIndexOf('.') + 1) + '_';
}
// ----- Details des cas de messages : create, update, delete
/** Cette méthode permet d'indiquer que l'instance a bien été créée. */
private void createdMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.INFO,
getCreatedMessageKey(), getCreatedMessage());
}
private String getCreatedMessageKey() {
return getMessageKeyPrefix() + "created";
}
/** Cette méthode permet d'indiquer que l'instance a bien été modifiée. */
private void updatedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.INFO,
getUpdatedMessageKey(), getUpdatedMessage());
}
private String getUpdatedMessageKey() {
return getMessageKeyPrefix() + "updated";
}
/** Cette méthode permet d'indiquer que l'instance a bien été supprimée. */
private void deletedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.INFO,
getDeletedMessageKey(), getDeletedMessage());
}
private String getDeletedMessageKey() {
return getMessageKeyPrefix() + "deleted";
}
/** Cette méthode permet d'indiquer que l'instance a déjà été créée */
@SuppressWarnings("unused")
private void alreadyCreatedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.WARN,
getAlreadyCreatedMessageKey(), getAlreadyCreatedMessage());
}
private String getAlreadyCreatedMessageKey() {
return getMessageKeyPrefix() + "alreadyCreated";
}
/** Cette méthode permet d'indiquer que l'instance n'est pas managé en Base de donnée */
protected void unmanagedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.WARN,
getUnmanagedMessageKey(), getUnmanagedMessage());
}
protected String getUnmanagedMessageKey() {
return getMessageKeyPrefix() + "unmanaged";
}
// -----------Getter & Setter des messages de Pays
public String getDeletedMessage() {
return deletedMessage;
}
public void setDeletedMessage(String deletedMessage) {
this.deletedMessage = deletedMessage;
}
public String getCreatedMessage() {
return createdMessage;
}
public void setCreatedMessage(String createdMessage) {
this.createdMessage = createdMessage;
}
public String getAlreadyCreatedMessage() {
return alreadyCreatedMessage;
}
public void setAlreadyCreatedMessage(String alreadyCreatedMessage) {
this.alreadyCreatedMessage = alreadyCreatedMessage;
}
public String getUpdatedMessage() {
return updatedMessage;
}
public void setUpdatedMessage(String updatedMessage) {
this.updatedMessage = updatedMessage;
}
public String getUnmanagedMessage() {
return unmanagedMessage;
}
public void setUnmanagedMessage(String unmanagedMessage) {
this.unmanagedMessage = unmanagedMessage;
}
} | ISO-8859-1 | Java | 24,717 | java | EditerPaysAction.java | Java | [] | null | [] | package com.visuc.referentiel.pays.web.actions;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import javax.transaction.SystemException;
import org.apache.commons.beanutils.BeanUtils;
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.framework.Controller;
import org.jboss.seam.framework.EntityNotFoundException;
import org.jboss.seam.international.StatusMessage;
import org.jboss.seam.transaction.Transaction;
import com.visuc.referentiel.devise.entite.Devise;
import com.visuc.referentiel.devise.web.actions.EditerDeviseAction;
import com.visuc.referentiel.langue.entite.Langue;
import com.visuc.referentiel.langue.service.ILangueManager;
import com.visuc.referentiel.pays.entite.Pays;
import com.visuc.referentiel.pays.service.IPaysManager;
import com.visuc.referentiel.ville.entite.Ville;
import com.visuc.referentiel.ville.service.IVilleManager;
@Name("editerPaysAction")
@Scope(ScopeType.CONVERSATION)
@BypassInterceptors
@SuppressWarnings("serial")
public class EditerPaysAction extends Controller {
private Pays instance;
private Object paysId;
private Boolean idDefined;
private ValueExpression newInstance;
private transient boolean dirty;
private transient EntityManager entityManager;
private transient List<Langue> listAvailableLangues;
private transient List<Langue> listSelectedLangues;
private transient List<Ville> listAvailableVilles;
private transient List<Ville> listSelectedVilles;
/******* Declaration des messages specifiques a l'entite pays et ses actions disponibles ***********/
private String deletedMessage = "Suppression effectuée";
private String createdMessage = "Création effectuée";
private String alreadyCreatedMessage = "Création non effectuée : l'enregistrement existe déjà";
private String updatedMessage = "Mise à jour effectuée";
private String unmanagedMessage = "Mise à jour non effectuée : l'enregistrement n'existe pas";
/*********************************************************************************************************************/
/********** Methode en frontal du Backing Bean **********/
public String find() {
// On recherche l'entité associée
initInstance();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"find "+instance.toString());
return "find";
}
public String edit() {
// On recherche l'entité associée
initInstance();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"edit "+instance.toString());
return "edit";
}
// refresh des champs de l'instance de l'action
public void refresh(){
evaluateValueExpression("#{editerPaysAction.instance.nom}");
}
/**
* <p>Cette methode permet gerer les associations et de rafraichir
* l'instance courante une fois que les associations ont ete mises a jour.
* Cette methode <code>wire</code> est declaree dans le fichier devise.page.xml,
* dans la section consacree a la page /views/devise/edit_devise.xhtml
* exemple:
* <pre>
* <page view-id="/views/devise/edit_devise.xhtml">
* <!-- recuperation des donnees en sortie d'une navigation interfonctionnalite. -->
* <action execute="#{editerDeviseAction.wire}"/>
* </pre>
*/
public void wire() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"WIRE");
// gestion lors de la création des saisies existantes avant la selection de l'objet lie, ici saisie du nom
//Events.instance().raiseEvent("event.test");
EditerDeviseAction lEditerDeviseAction = getEditerDeviseAction();
if (lEditerDeviseAction != null) {
Devise lDevise = lEditerDeviseAction.getDefinedInstance();
// Au second appel a selectionner, le pays sera correctement rafraichit
//lEditerPaysAction.clearInstance();
if (lDevise!=null ) {
// tente avant le sePays de le rafraichir pour resoudre le probleme du lien en lazy
//getEntityManager().refresh(lPays);
getInstance().setDevise(lDevise);
System.out.println(" "+getInstance());
}
}
System.out.println(" "+this.instance);
}
public String persist(){
// On sauvegarde l'entité
Pays lEntity = getPaysManager().save(getInstance());
//relie la nouvelle entite du cache JPA a la conversation seam et son bean action
setInstance(lEntity);
//vide le cache de la transaction (l'insert ayant ete joue)
flushIfNecessary();
// stocke le nouvel ID de l'entite depuis le bean action, celui-ci etant vide lors de la demande de creation
assignId(getIdFromObject(lEntity));
// Creation des messages dans le cache Seam, envoi de l'event de refresh de la liste existante dans la recherche
createdMessage();
raiseAfterTransactionSuccessEvent();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"persist");
return "persist";
}
public String update(){
if (getIdFromObject(getInstance()) == null) {
unmanagedMessage();
return null;
}
joinTransaction();
updateListSelected();
Pays lEntity = getPaysManager().update(getInstance());
// Si l'entité retourné est null, c'est qu'il y a eu une erreur.
// on retourne une outcome null (reposition sur la page d'origine)
// la gestion du message d'erreur est à la charge de doUpdate()
if (lEntity == null) {
return null;
}
// Rafraichit la liste des pays devant etre supprimés
lEntity.setSetLangues(new HashSet<Langue>(listSelectedLangues));
lEntity.setListVilles(listSelectedVilles);
// relie l'entite modifiee a partir du cache JPA dans la conversation seam et son bean action
setInstance(lEntity);
// flush de la transaction JPA
flushIfNecessary();
// envoi de l'evt pour declenche le rafraichissement des datas
updatedMessage();
raiseAfterTransactionSuccessEvent();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"update");
return "update";
}
public String remove(){
if (getIdFromObject(getInstance()) == null) {
unmanagedMessage();
return null;
}
getPaysManager().deleteOne(getInstance());
if (getInstance() == null) {
// Retour 'null' de delete = erreur fonctionnelle
return null;
}
flushIfNecessary();
setInstance(null);
// Creation du message resultat de l'action demande et envoi de l'evt pour declenche le rafraichissement des datas
deletedMessage();
raiseAfterTransactionSuccessEvent();
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"delete");
return "remove";
}
public String cancel(){
if (getDefinedInstance() == null) {
return "cancel";
}
if (!isManaged()) {
return "cancel";
}
// Doit verifier si l'entite est attaché au cache JPA, il suffit alors de rafraichir l'instance de l'action a partir du cache JPA, sinon il faut jouer le
// initInstance qui lancera un find pour rattacher l'instance de l'action
EntityManager lEntityManager = getEntityManager();
if (lEntityManager != null && lEntityManager.contains(getInstance())) {
// l'entité est attachée
lEntityManager.refresh(getInstance());
} else {
// l'entité est détachée
initInstance();
}
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"cancel");
return "cancel";
}
/********************************************************************************************************************/
/***************** Methodes de requetage ****************/
/*
// Execution de la requete de creation
private Pays querySavePays() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"querySavePays");
return getPaysManager().save(getInstance());
}
// Execution de la requete de de mise a jour
private Pays queryUpdatePays() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"queryUpdatePays");
return getPaysManager().update(getInstance());
}
// Execution de la requete de suppression
private void queryDeletePays() {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"queryDeletePays : "+getInstance().getId());
getPaysManager().deleteOne(getInstance());
}
*/
/********************************************************************************************************************/
// Retourne vrai si le pays existe en base de données.
public boolean isManaged() {
return getInstance() != null && isIdDefined();
}
private Object getIdFromObject(Pays aEntity) {
if (aEntity == null) {
NoSuchMethodError lError = new NoSuchMethodError("Méthode getId() inexistante pour l'entité null");
throw lError;
}
return (Object)aEntity.getId();
}
public boolean isIdDefined() {
if (getPaysId() == null) {
return false;
}
if (idDefined == null) {
idDefined = isNotNullKey(getPaysId());
}
return idDefined;
}
// Retourne null si l'action ne gèer actuellement aucune entité (c'est à dire si isIdDefined() return false)
public Pays getDefinedInstance() {
return isIdDefined() ? getInstance() : null;
}
@SuppressWarnings("unchecked")
public static boolean isNotNullKey(Object aKey){
if (aKey == null) {
return false;
}
if (org.springframework.beans.BeanUtils.isSimpleProperty(aKey.getClass())) {
return !"".equals(aKey);
}
Map lMap = null;
try {
lMap = BeanUtils.describe(aKey);
} catch (IllegalAccessException err) {
err.printStackTrace();
} catch (InvocationTargetException err) {
err.printStackTrace();
} catch (NoSuchMethodException err) {
err.printStackTrace();
}
// on itère sur chacune des propriétés
// dès que une non null on renvoie true => mode update
for (Object lEntry : lMap.entrySet()){
Map.Entry lMapEntry = (Map.Entry)lEntry;
String lKey = (String)lMapEntry.getKey();
Object lValue = lMapEntry.getValue();
// la clef class fait partie automatiquement de la Map en plus des attributs
// elle ne nous intéresse pas...
if (!"class".equalsIgnoreCase(lKey) && lValue != null && !"".equals(lValue)) {
return true;
}
}
return false;
}
/********************************************************************************************************************/
/****************** Getter & Setter *********************/
public Long getPaysId() {
return (Long)paysId;
}
public void setPaysId(Long aId) {
if (setDirty(paysId, aId)) {
boolean lIsDebugEnabled = getLog().isDebugEnabled();
if (lIsDebugEnabled) {
getLog().debug("Dirty - setPaysId -> #0, #1", paysId,aId);
}
setInstance(null);
}
paysId = aId;
}
// Cette méthode retourne l'instance managée, méthode appelée dans la page .xhtml sous
// la forme de l'EL : #{entity.instance.attribut} pour accéder au résultat à l'issue d'une recherche
public Pays getInstance() {
joinTransaction();
if (instance == null) {
initInstance();
}
return instance;
}
// Valorise l'instance de l'entité gérée par cette action
// Met à jour setId(Object), en indiquant l'identifiant de l'entité aInstance - l'identifiant étant calculé par la méthode getIdFromObject(Object)
public void setInstance(Pays aInstance) {
setDirty(this.instance, aInstance);
if (aInstance != null) {
assignId(getIdFromObject(aInstance));
}
this.instance = aInstance;
}
public ValueExpression getNewInstance() {
return newInstance;
}
public void setNewInstance(ValueExpression aNewInstance) {
this.newInstance = aNewInstance;
}
/*********************************************************************************************************************/
/**************** Gestion de l'etat instance-entite-Id du bean action de la conversation *****************
/** Met à jour l'identifiant de l'entité gérée par cette action. Mais ne modifie pas l'entite(c'est en fait son instance) de cette action */
void assignId(Object aId) {
setDirty(paysId, aId);
paysId = aId;
idDefined = null;
}
/** Set the dirty flag if the value has changed. Call whenever a subclass attribute is updated */
protected <U> boolean setDirty(U aOldValue, U aNewValue) {
boolean lAttributeDirty = aOldValue != aNewValue && (aOldValue == null || !aOldValue.equals(aNewValue));
dirty = dirty || lAttributeDirty;
return lAttributeDirty;
}
private Pays createInstance() {
if (newInstance != null) {
return (Pays) newInstance.getValue(FacesContext.getCurrentInstance().getELContext());
} else {
try {
return new Pays();
} catch (Exception err) {
throw new RuntimeException(err);
}
}
}
/** Cette méthode doit être appelée pour accéder à un écran vierge. Les actions étant stockées en session,
* le bean managé doit, parfois, être détaché pour permettre un affichage de l'écran vierge. (Ex : un appel
* depuis les menus). */
protected void clearInstance(){
// On détache l'objet de l'action
setInstance(null);
setPaysId(null);
}
protected Pays handleNotFound() throws EntityNotFoundException {
throw new EntityNotFoundException(getPaysId(), this.instance.getClass());
}
/**
* Charge l'instance si l'id est défini, sinon crée une nouvelle instance.
* <br />
* Méthode utilitaire appelée par {@link #getInstance()} pour charger
* l'instance à partir de la base de données (via
* {@link #doFind())si l'id est défini {@link #isIdDefined()} vaut true. Si
* l'id n'est pas défini, une nouvelle instance de l'entité est créé via
* l'appel à {@link #createInstance()}.
*
* @see #doFind()
* @see #createInstance()
*/
protected void initInstance() {
if (isIdDefined()) {
// we cache the instance so that it does not "disappear"
// after remove() is called on the instance
// is this really a Good Idea??
Pays lResult = getPaysManager().findById((Long)getPaysId());
if (lResult == null) {
lResult = handleNotFound();
}
setInstance(lResult);
// met a jour la liste Transient de SelectedItem en mirroir de la liste des pays d'une devise
setListAvailableLangues(getLangueManager().findAllNotlinkedLanguages(getInstance()));
setListSelectedLangues(new ArrayList<Langue>(getInstance().getSetLangues()));
setListAvailableVilles(getVilleManager().findAllNotlinkedVilles(getInstance()));
setListSelectedVilles(getInstance().getListVilles());
} else {
setInstance(createInstance());
}
}
/********************************************************************************************************************/
/* Gestion des listes d'items disponibles et d'items selectionnes pour gérer la collection de langues liés a un pays */
public List<Langue> getListAvailableLangues(){
return listAvailableLangues;
}
public void setListAvailableLangues(List<Langue> aList){
this.listAvailableLangues = aList;
}
public List<Langue> getListSelectedLangues() {
return listSelectedLangues;
}
public void setListSelectedLangues(List<Langue> aListSelectedLangues) {
this.listSelectedLangues = new ArrayList<Langue>();
for(Langue p : aListSelectedLangues){
listSelectedLangues.add(p);
}
}
// remove devise from pays if it is not already existing in instance.getListLangues()
public void updateListSelectedLangues(){
System.out.println(" - - - - - - - - - - - - - - - - - - "+"updateListSelectedLangues");
int i=0;
// Parcours la liste des pays lies a l'instance Devise courante
// -> Si listSelectedLangues ne contient plus un pays de l'instance, on supprime son lien sur la devise.
for(Langue l : this.instance.getSetLangues()){
if(!this.listSelectedLangues.contains(l)){
l.getSetPays().remove(instance);
System.out.println(i+"/ "+l.getNom()+" isRemove");
}
}
i=0;
// Parcours la liste des pays selectionnes, pour ajouter le pays a la liste s'il n'existe pas, et ajouter la langue a la liste de langues liées au pays
// -> Sinon Si le pays n'a pas devise mais existe dans la liste des pays selectionnes a droite, il faut rajouter son lien sur la devise courante
// -> le parcours des instances de la liste et leur modification en direct implique que la liste SelectedLangues est mise à jour en meme temps que instance.getListLangues
for(Langue l : this.listSelectedLangues) {
Set<Pays> s = null;
if(l.getSetPays() == null) {
s = new HashSet<Pays>();
}else{
s = l.getSetPays();
}
s.add(instance);
this.instance.getSetLangues().add(l);
System.out.println(i+"/ "+l.getNom()+" isAdd");
}
}
//-----------------------------------------------------------------------------------------
public List<Ville> getListAvailableVilles(){
return listAvailableVilles;
}
public void setListAvailableVilles(List<Ville> aList){
this.listAvailableVilles = aList;
}
public List<Ville> getListSelectedVilles() {
return listSelectedVilles;
}
public void setListSelectedVilles(List<Ville> aListSelectedVilles) {
this.listSelectedVilles = new ArrayList<Ville>();
for(Ville v : aListSelectedVilles){
listSelectedVilles.add(v);
}
}
public void updateListSelectedVilles(){
System.out.println(" - - - - - - - - - - - - - - - - - - "+"updateListSelectedVilles");
int i=0;
for(Ville v : this.instance.getListVilles()){
if(!this.listSelectedVilles.contains(v)){
v.setPays(null);
System.out.println(i+"/ "+v.getNom()+" isRemove");
}
}
i=0;
for(Ville v : this.listSelectedVilles) {
if(v.getPays() == null) {
v.setPays(instance);
this.instance.getListVilles().add(v);
System.out.println(i+"/ "+v.getNom()+" isAdd");
}
}
}
//-----------------------------------------------------------------------------------------
public void updateListSelected(){
// mise à jour des liens avec les langues
updateListSelectedLangues();
// mise à jour des liens avec les villes
updateListSelectedVilles();
}
/********************************************************************************************************************/
// -------------------------------------------------------------
// Gestionnaire de Services
// -------------------------------------------------------------
/** Acces a l'action Seam editerMatchAction, @return null si l'action Seam n'a pas ete instanciee */
private EditerDeviseAction getEditerDeviseAction() {
return (EditerDeviseAction) Component.getInstance("editerDeviseAction", false);
}
/**
* Service IEquipeManager gere par Spring
* enregistre dans monappli-service.xml
*/
private IPaysManager getPaysManager() {
return super.evaluateValueExpression("#{paysManager}", IPaysManager.class);
}
private ILangueManager getLangueManager() {
return super.evaluateValueExpression("#{langueManager}", ILangueManager.class);
}
private IVilleManager getVilleManager() {
return super.evaluateValueExpression("#{villeManager}", IVilleManager.class);
}
private void joinTransaction() {
EntityManager lEntityManager = getEntityManager();
if (lEntityManager != null && lEntityManager.isOpen()) {
try {
Transaction.instance().enlist(lEntityManager);
} catch (SystemException e) {
throw new RuntimeException("could not join transaction", e);
}
}
}
private EntityManager getEntityManager() {
if (entityManager == null) {
entityManager = (EntityManager) getComponentInstance(getPersistenceContextName());
}
return entityManager;
}
private String getPersistenceContextName() {
return "entityManager";
}
private void flushIfNecessary() {
EntityManager lEntityManager = getEntityManager();
if (lEntityManager != null) {
lEntityManager.flush();
}
}
/********************************************************************************************************************/
/****************** Gestion des evenements declenches par manipulation de l'entite Pays ******/
protected void raiseAfterTransactionSuccessEvent() {
raiseTransactionSuccessEvent("org.jboss.seam.afterTransactionSuccess");
String lSimpleEntityName = getSimpleEntityName();
if (lSimpleEntityName != null) {
System.out.println(" ---------- DEBUG :EditerPaysAction: "+"raiseAfterTransactionSuccessEvent : "+"org.jboss.seam.afterTransactionSuccess." + lSimpleEntityName);
raiseTransactionSuccessEvent("org.jboss.seam.afterTransactionSuccess." + lSimpleEntityName);
}
}
// -----------Getter for the entityName
/**Retourne le nom de la classe de l'entité gérée par cette Action sans
* prendre en compte le nom de paquetage (i.e. Employe pour l'entité
* <code>com.natixis.aws.employe.entite.Employe</code>).
*/
protected String getSimpleEntityName() {
String lName = Pays.class.getName();
return lName.lastIndexOf(".") > 0 && lName.lastIndexOf(".") < lName.length() ?
lName.substring(lName.lastIndexOf(".") + 1, lName.length()) : lName;
}
/********************************************************************************************************************/
/****************** Gestion de l'alimentation des messages Seam *********************/
// ----- Prefix a tout message provenant de l'entite Pays
private String getMessageKeyPrefix() {
String lClassName = this.getClass().getName();
return lClassName.substring(lClassName.lastIndexOf('.') + 1) + '_';
}
// ----- Details des cas de messages : create, update, delete
/** Cette méthode permet d'indiquer que l'instance a bien été créée. */
private void createdMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.INFO,
getCreatedMessageKey(), getCreatedMessage());
}
private String getCreatedMessageKey() {
return getMessageKeyPrefix() + "created";
}
/** Cette méthode permet d'indiquer que l'instance a bien été modifiée. */
private void updatedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.INFO,
getUpdatedMessageKey(), getUpdatedMessage());
}
private String getUpdatedMessageKey() {
return getMessageKeyPrefix() + "updated";
}
/** Cette méthode permet d'indiquer que l'instance a bien été supprimée. */
private void deletedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.INFO,
getDeletedMessageKey(), getDeletedMessage());
}
private String getDeletedMessageKey() {
return getMessageKeyPrefix() + "deleted";
}
/** Cette méthode permet d'indiquer que l'instance a déjà été créée */
@SuppressWarnings("unused")
private void alreadyCreatedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.WARN,
getAlreadyCreatedMessageKey(), getAlreadyCreatedMessage());
}
private String getAlreadyCreatedMessageKey() {
return getMessageKeyPrefix() + "alreadyCreated";
}
/** Cette méthode permet d'indiquer que l'instance n'est pas managé en Base de donnée */
protected void unmanagedMessage() {
getStatusMessages().addFromResourceBundleOrDefault(StatusMessage.Severity.WARN,
getUnmanagedMessageKey(), getUnmanagedMessage());
}
protected String getUnmanagedMessageKey() {
return getMessageKeyPrefix() + "unmanaged";
}
// -----------Getter & Setter des messages de Pays
public String getDeletedMessage() {
return deletedMessage;
}
public void setDeletedMessage(String deletedMessage) {
this.deletedMessage = deletedMessage;
}
public String getCreatedMessage() {
return createdMessage;
}
public void setCreatedMessage(String createdMessage) {
this.createdMessage = createdMessage;
}
public String getAlreadyCreatedMessage() {
return alreadyCreatedMessage;
}
public void setAlreadyCreatedMessage(String alreadyCreatedMessage) {
this.alreadyCreatedMessage = alreadyCreatedMessage;
}
public String getUpdatedMessage() {
return updatedMessage;
}
public void setUpdatedMessage(String updatedMessage) {
this.updatedMessage = updatedMessage;
}
public String getUnmanagedMessage() {
return unmanagedMessage;
}
public void setUnmanagedMessage(String unmanagedMessage) {
this.unmanagedMessage = unmanagedMessage;
}
} | 24,717 | 0.658103 | 0.657737 | 706 | 33.847027 | 32.397003 | 174 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.907932 | false | false | 9 |
a7e77a2c8fc306eac64682218dd4e2a3b41ffa21 | 13,769,665,168,022 | 22ec43e009858328a708813d443a2b0591a2e852 | /zkdemo/src/main/java/com/haska/network/AcceptorCallback.java | 9aea25c6837ced068adf0b2eba9ab48fe55a5149 | [] | no_license | haska1025/zk_study | https://github.com/haska1025/zk_study | 94ed2681af4178fa2e13edb9f62e5b12e9b977bc | ae190ffb27a4dc92a1a301eef7c97c17952cc62f | refs/heads/master | 2020-04-17T16:56:11.547000 | 2018-07-31T07:16:58 | 2018-07-31T07:16:58 | 67,517,966 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.haska.network;
public interface AcceptorCallback {
public SessionCallback onAccept(Session s);
}
| UTF-8 | Java | 119 | java | AcceptorCallback.java | Java | [] | null | [] | package com.haska.network;
public interface AcceptorCallback {
public SessionCallback onAccept(Session s);
}
| 119 | 0.756303 | 0.756303 | 5 | 21.799999 | 18.626862 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 9 |
dcf4f1910113f02e67cc3ca5aa371c6293a82620 | 34,342,558,517,937 | 546942a1a9fb81cd9425c1d57760e443b8e0c402 | /reminder-be/src/main/java/com/hst/reminder/publisher/ui/response/PublisherResponse.java | a56a0d6e329c37ecd2cd88ba59e37de29143187e | [] | no_license | Team-HST/reminder | https://github.com/Team-HST/reminder | ecd6931161ee608b04a6f479799137297b489b1b | a9d0ab5b4add963e1393fe2701aa7a88a5915d42 | refs/heads/develop | 2023-01-13T16:35:25.682000 | 2020-04-10T15:46:40 | 2020-04-10T15:46:40 | 227,402,961 | 0 | 0 | null | false | 2023-01-05T03:36:45 | 2019-12-11T15:50:12 | 2020-05-19T13:26:52 | 2023-01-05T03:36:44 | 2,230 | 0 | 0 | 32 | Java | false | false | package com.hst.reminder.publisher.ui.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Getter;
/**
* @author dlgusrb0808@gmail.com
*/
@Builder
@Getter
public class PublisherResponse {
@ApiModelProperty(position = 1, value = "발행자 ID", example = "2717283")
private Long id;
@ApiModelProperty(position = 1, value = "프로토콜", example = "email")
private String protocol;
@ApiModelProperty(position = 1, value = "대상", example = "gusrb0808@naver.com")
private String target;
@ApiModelProperty(position = 1, value = "파라미터 (프로토콜마다 다른 포맷)")
private String parameters;
@ApiModelProperty(position = 1, value = "발행자의 설명", example = "네이버 이메일 발행자")
private String description;
}
| UTF-8 | Java | 798 | java | PublisherResponse.java | Java | [
{
"context": "bok.Builder;\nimport lombok.Getter;\n\n/**\n * @author dlgusrb0808@gmail.com\n */\n@Builder\n@Getter\npublic class PublisherRespon",
"end": 179,
"score": 0.9999198317527771,
"start": 158,
"tag": "EMAIL",
"value": "dlgusrb0808@gmail.com"
},
{
"context": "elProperty(posit... | null | [] | package com.hst.reminder.publisher.ui.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Getter;
/**
* @author <EMAIL>
*/
@Builder
@Getter
public class PublisherResponse {
@ApiModelProperty(position = 1, value = "발행자 ID", example = "2717283")
private Long id;
@ApiModelProperty(position = 1, value = "프로토콜", example = "email")
private String protocol;
@ApiModelProperty(position = 1, value = "대상", example = "<EMAIL>")
private String target;
@ApiModelProperty(position = 1, value = "파라미터 (프로토콜마다 다른 포맷)")
private String parameters;
@ApiModelProperty(position = 1, value = "발행자의 설명", example = "네이버 이메일 발행자")
private String description;
}
| 772 | 0.736842 | 0.709141 | 23 | 30.391304 | 25.325256 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.217391 | false | false | 9 |
025ef67c629a987b7a9545d3b071a98ca4d85b12 | 7,894,149,935,628 | d085dcbf3f826ede6f87a897ae6067943ab995ae | /src/test/java/musiclibrary/mvc/model/modelswithmorphia/TrackListDBModelTest.java | 28358ea0269578ddc81d534f125005c3874a2b07 | [] | no_license | DmitryKarnaukhov/Music_Library | https://github.com/DmitryKarnaukhov/Music_Library | e13ce79d6195dd5f7ab2f8f1d53321bbcb1fcfd4 | 12ea0ee7d0f60a9fa8515e0397ea4308a1a43bea | refs/heads/master | 2020-04-05T18:09:32.755000 | 2019-03-10T22:34:24 | 2019-03-10T22:34:24 | 157,090,735 | 2 | 2 | null | false | 2019-03-12T11:33:00 | 2018-11-11T15:01:50 | 2019-03-10T22:34:36 | 2019-03-10T22:34:34 | 650 | 2 | 2 | 2 | Java | false | null | package musiclibrary.mvc.model.modelswithmorphia;
import com.google.common.collect.ImmutableList;
import com.mongodb.MongoClient;
import musiclibrary.dbworks.dbconstants.DBconstants;
import musiclibrary.entities.*;
import org.junit.Assert;
import org.junit.Test;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class TrackListDBModelTest {
Morphia morphia;
MongoClient mongoClient;
Datastore datastore;
ArtistDBModel artistModel;
TrackDBModel trackModel;
TrackListDBModel trackListModel;
AlbumDBModel albumModel;
String testArtistNameNo1 = "Elvis Presley";
String testArtistNameNo2 = "John Lennon";
String testArtistNameNo3 = "Eminem";
String testArtistNameNo4 = "Radiohead";
String testAlbumName = "Mixed Tracks";
String testTrackNameNo1 = "Blue Shoes";
String testTrackNameNo2 = "Imagine";
String testTrackNameNo3 = "Stan";
String testTrackNameNo4 = "Lose Yourself";
String testTrackNameNo5 = "Creep";
Track testTrackNo1,
testTrackNo2,
testTrackNo3,
testTrackNo4,
testTrackNo5;
Artist testArtistNo1,
testArtistNo2,
testArtistNo3,
testArtistNo4;
ImmutableList<Track> tracks;
Album testAlbum;
public TrackListDBModelTest() {
morphia = new Morphia();
mongoClient = new MongoClient();
datastore = morphia.createDatastore(mongoClient, DBconstants.DBNAME);
artistModel = new ArtistDBModel();
trackModel = new TrackDBModel();
trackListModel = new TrackListDBModel();
albumModel = new AlbumDBModel();
initArtists();
initTracks();
testAlbum = new Album(albumModel.getNextId(), testAlbumName);
albumModel.put(testAlbum);
}
private void initArtists() {
testArtistNo1 = new Artist(artistModel.getNextId(), testArtistNameNo1);
artistModel.put(testArtistNo1);
testArtistNo2 = new Artist(artistModel.getNextId(), testArtistNameNo2);
artistModel.put(testArtistNo2);
testArtistNo3 = new Artist(artistModel.getNextId(), testArtistNameNo3);
artistModel.put(testArtistNo3);
testArtistNo4 = new Artist(artistModel.getNextId(), testArtistNameNo4);
artistModel.put(testArtistNo4);
}
private void initTracks() {
testTrackNo1 = new Track(trackModel.getNextId(),
testTrackNameNo1, testArtistNo1, 3.45, Genre.Rock);
trackModel.put(testTrackNo1);
testTrackNo2 = new Track(trackModel.getNextId(),
testTrackNameNo2, testArtistNo2, 2.45, Genre.Pop);
trackModel.put(testTrackNo2);
testTrackNo3 = new Track(trackModel.getNextId(),
testTrackNameNo3, testArtistNo3, 5.55, Genre.Electronic);
trackModel.put(testTrackNo3);
testTrackNo4 = new Track(trackModel.getNextId(),
testTrackNameNo4, testArtistNo3, 3.25, Genre.Dance);
trackModel.put(testTrackNo4);
testTrackNo5 = new Track(trackModel.getNextId(),
testTrackNameNo5, testArtistNo4, 1.55, Genre.Rock);
trackModel.put(testTrackNo5);
ArrayList<Track> trList = new ArrayList();
trList.add(testTrackNo1);
trList.add(testTrackNo2);
trList.add(testTrackNo3);
trList.add(testTrackNo4);
trList.add(testTrackNo5);
tracks = ImmutableList.copyOf(trList);
}
@Test
public void put() {
TrackList testTrackList = new TrackList(trackListModel.getNextId(), testAlbum, tracks);
trackListModel.put(testTrackList);
TrackList putTrackListFromDB = trackListModel.getItem(testTrackList.getId());
Assert.assertEquals(testTrackList, putTrackListFromDB);
}
} | UTF-8 | Java | 3,887 | java | TrackListDBModelTest.java | Java | [
{
"context": "odel albumModel;\n\n String testArtistNameNo1 = \"Elvis Presley\";\n String testArtistNameNo2 = \"John Lennon\";\n ",
"end": 709,
"score": 0.9998764991760254,
"start": 696,
"tag": "NAME",
"value": "Elvis Presley"
},
{
"context": " \"Elvis Presley\";\n String te... | null | [] | package musiclibrary.mvc.model.modelswithmorphia;
import com.google.common.collect.ImmutableList;
import com.mongodb.MongoClient;
import musiclibrary.dbworks.dbconstants.DBconstants;
import musiclibrary.entities.*;
import org.junit.Assert;
import org.junit.Test;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class TrackListDBModelTest {
Morphia morphia;
MongoClient mongoClient;
Datastore datastore;
ArtistDBModel artistModel;
TrackDBModel trackModel;
TrackListDBModel trackListModel;
AlbumDBModel albumModel;
String testArtistNameNo1 = "<NAME>";
String testArtistNameNo2 = "<NAME>";
String testArtistNameNo3 = "Eminem";
String testArtistNameNo4 = "Radiohead";
String testAlbumName = "Mixed Tracks";
String testTrackNameNo1 = "Blue Shoes";
String testTrackNameNo2 = "Imagine";
String testTrackNameNo3 = "Stan";
String testTrackNameNo4 = "Lose Yourself";
String testTrackNameNo5 = "Creep";
Track testTrackNo1,
testTrackNo2,
testTrackNo3,
testTrackNo4,
testTrackNo5;
Artist testArtistNo1,
testArtistNo2,
testArtistNo3,
testArtistNo4;
ImmutableList<Track> tracks;
Album testAlbum;
public TrackListDBModelTest() {
morphia = new Morphia();
mongoClient = new MongoClient();
datastore = morphia.createDatastore(mongoClient, DBconstants.DBNAME);
artistModel = new ArtistDBModel();
trackModel = new TrackDBModel();
trackListModel = new TrackListDBModel();
albumModel = new AlbumDBModel();
initArtists();
initTracks();
testAlbum = new Album(albumModel.getNextId(), testAlbumName);
albumModel.put(testAlbum);
}
private void initArtists() {
testArtistNo1 = new Artist(artistModel.getNextId(), testArtistNameNo1);
artistModel.put(testArtistNo1);
testArtistNo2 = new Artist(artistModel.getNextId(), testArtistNameNo2);
artistModel.put(testArtistNo2);
testArtistNo3 = new Artist(artistModel.getNextId(), testArtistNameNo3);
artistModel.put(testArtistNo3);
testArtistNo4 = new Artist(artistModel.getNextId(), testArtistNameNo4);
artistModel.put(testArtistNo4);
}
private void initTracks() {
testTrackNo1 = new Track(trackModel.getNextId(),
testTrackNameNo1, testArtistNo1, 3.45, Genre.Rock);
trackModel.put(testTrackNo1);
testTrackNo2 = new Track(trackModel.getNextId(),
testTrackNameNo2, testArtistNo2, 2.45, Genre.Pop);
trackModel.put(testTrackNo2);
testTrackNo3 = new Track(trackModel.getNextId(),
testTrackNameNo3, testArtistNo3, 5.55, Genre.Electronic);
trackModel.put(testTrackNo3);
testTrackNo4 = new Track(trackModel.getNextId(),
testTrackNameNo4, testArtistNo3, 3.25, Genre.Dance);
trackModel.put(testTrackNo4);
testTrackNo5 = new Track(trackModel.getNextId(),
testTrackNameNo5, testArtistNo4, 1.55, Genre.Rock);
trackModel.put(testTrackNo5);
ArrayList<Track> trList = new ArrayList();
trList.add(testTrackNo1);
trList.add(testTrackNo2);
trList.add(testTrackNo3);
trList.add(testTrackNo4);
trList.add(testTrackNo5);
tracks = ImmutableList.copyOf(trList);
}
@Test
public void put() {
TrackList testTrackList = new TrackList(trackListModel.getNextId(), testAlbum, tracks);
trackListModel.put(testTrackList);
TrackList putTrackListFromDB = trackListModel.getItem(testTrackList.getId());
Assert.assertEquals(testTrackList, putTrackListFromDB);
}
} | 3,875 | 0.682017 | 0.664008 | 110 | 34.345455 | 21.867966 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.990909 | false | false | 9 |
88d1febc4cfbb6ce260268530b880a4fb6afc32f | 1,743,756,786,830 | 7aaeed4fdb986cc63b61247c847cf8b71d7147d3 | /Elections/src/ElectionsMain.java | 58b594fbcddc77f0eacb04e879a5fd8988ff9a53 | [] | no_license | eitanban/Learning_Java | https://github.com/eitanban/Learning_Java | d6b38fda8933df412720c1cfcb0776a931bd4545 | 9808ab382afc48cc33fd63260a9068110bfbf1f8 | refs/heads/master | 2016-11-05T22:53:32.290000 | 2012-03-15T05:28:53 | 2012-03-15T05:28:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //author: Shannon Graham
//date: 9 Feb 2012
//lab: 5 Elections
//works: ready for demo.
public class ElectionsMain {
public static void main(String[] args) {
//create a new riding
Riding oakBay = new Riding("Oak Bay");
//declare some candidates
Candidate chris = new Candidate("Chris", "Rail");
Candidate dani = new Candidate("Danielle", "Sim");
Candidate graham = new Candidate("Graham", "Grayson");
oakBay.addCandidate(chris);
oakBay.addCandidate(dani);
oakBay.addCandidate(graham);
//take the polls
for (int i = 0; i < 200; i++) {
oakBay.voteFor(chris);
}
for (int i = 0; i < 158; i++) {
oakBay.voteFor(dani);
}
for (int i = 0; i < 32; i++) {
oakBay.voteFor(graham);
}
//publish candidate bios
for(CandidateInterface aCandidate : oakBay) {
String firstName = aCandidate.getFirstName();
String lastName = aCandidate.getLastName();
int totalVotes = aCandidate.getVoteCount();
System.out.println("name " + firstName + " " + lastName + " votes " + totalVotes);
}//for
//voting complete. announce the winners.
String winner = oakBay.getWinner().getFirstName() + " " + oakBay.getWinner().getLastName();
System.out.println("The winner is " + winner);
}//main
}//class
| UTF-8 | Java | 1,352 | java | ElectionsMain.java | Java | [
{
"context": "//author:\tShannon Graham\n//date:\t\t9 Feb 2012\n//lab:\t\t5 Elections\n//works: ",
"end": 24,
"score": 0.9998503923416138,
"start": 10,
"tag": "NAME",
"value": "Shannon Graham"
},
{
"context": " Bay\");\n\t\t\n\t\t//declare some candidates\n\t\tCandidate chris = new C... | null | [] | //author: <NAME>
//date: 9 Feb 2012
//lab: 5 Elections
//works: ready for demo.
public class ElectionsMain {
public static void main(String[] args) {
//create a new riding
Riding oakBay = new Riding("Oak Bay");
//declare some candidates
Candidate chris = new Candidate("Chris", "Rail");
Candidate dani = new Candidate("Danielle", "Sim");
Candidate graham = new Candidate("Graham", "Grayson");
oakBay.addCandidate(chris);
oakBay.addCandidate(dani);
oakBay.addCandidate(graham);
//take the polls
for (int i = 0; i < 200; i++) {
oakBay.voteFor(chris);
}
for (int i = 0; i < 158; i++) {
oakBay.voteFor(dani);
}
for (int i = 0; i < 32; i++) {
oakBay.voteFor(graham);
}
//publish candidate bios
for(CandidateInterface aCandidate : oakBay) {
String firstName = aCandidate.getFirstName();
String lastName = aCandidate.getLastName();
int totalVotes = aCandidate.getVoteCount();
System.out.println("name " + firstName + " " + lastName + " votes " + totalVotes);
}//for
//voting complete. announce the winners.
String winner = oakBay.getWinner().getFirstName() + " " + oakBay.getWinner().getLastName();
System.out.println("The winner is " + winner);
}//main
}//class
| 1,344 | 0.607249 | 0.594675 | 59 | 21.881355 | 22.42886 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.016949 | false | false | 9 |
54145569de4db9b471d145d8fa400f2a33e8f9aa | 7,799,660,627,691 | 719a1644cadf7e44e5696063f4b6f5e6c211a086 | /envio_imagem/ClienteImagemUDP.java | 217439647979f6b5fb820be9b2ecf12cd885d61d | [] | no_license | claudiorodolfo/sockets_udp | https://github.com/claudiorodolfo/sockets_udp | 552e180d4d3f4e59a303ece0ff0561754ff17f32 | ebb7d3455e616827d0a7206a5e90678c7b01f6be | refs/heads/main | 2023-09-01T19:08:13.822000 | 2021-10-21T12:33:30 | 2021-10-21T12:33:30 | 388,534,513 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.net.*;
import java.util.*;
import java.io.*;
public class ClienteImagemUDP {
public static void main(String args[]) throws Exception {
DatagramSocket tomada = new DatagramSocket();
InetAddress ip = InetAddress.getByName("127.0.0.1");
int porta = 5000;
/////////CÓDIGO PARA OBTER O NOME DA IMAGEM
/////////VIA TECLADO
System.out.print("Digite uma mensagem:");
Scanner teclado = new Scanner(System.in);
String mensagem = teclado.nextLine();
/////////CÓDIGO PARA ENVIAR UMA MENSAGEM COM O
/////////NOME DA IMAGEM PARA O SERVIDOR
byte[] cartaAEnviar = new byte[64];
cartaAEnviar = mensagem.getBytes();
DatagramPacket envelopeAEnviar
= new DatagramPacket(cartaAEnviar,
cartaAEnviar.length,
ip,
porta);
tomada.send(envelopeAEnviar);
//////////RECEBER O TAMANHO DA IMAGEM DO SERVIDOR
byte[] cartaAReceber = new byte[8];
DatagramPacket envelopeAReceber
= new DatagramPacket(cartaAReceber,
cartaAReceber.length);
tomada.receive(envelopeAReceber);
cartaAReceber = envelopeAReceber.getData();
String msgRecebida = new String(cartaAReceber);
int tamanhoImagem = Integer.parseInt(msgRecebida.trim());
///////////RECEBER IMAGEM DO SERVIDOR E
///////////SALVAR NO COMPUTADOR
byte[] cartaAReceber2 = new byte[tamanhoImagem];
DatagramPacket envelopeAReceber2
= new DatagramPacket(cartaAReceber2,
cartaAReceber2.length);
tomada.receive(envelopeAReceber2);
String caminhoImagem = "C:/Users/asus/Desktop/IMAGEM_RECEBIDA.jpg";
ManipulacaoArquivos m = new ManipulacaoArquivos();
m.deArrayParaImagem(envelopeAReceber2.getData(), caminhoImagem);
//SE NÃO TIVER MAIS NADA PARA FAZER
//finaliza a conexão
tomada.close();
}
}
| UTF-8 | Java | 2,019 | java | ClienteImagemUDP.java | Java | [
{
"context": ";\n InetAddress ip = InetAddress.getByName(\"127.0.0.1\");\n\t\tint porta = 5000;\n \n\t\t/////////CÓDIGO",
"end": 262,
"score": 0.9506753087043762,
"start": 253,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "AReceber2);\n\t\t\n\t\tString cami... | null | [] | import java.net.*;
import java.util.*;
import java.io.*;
public class ClienteImagemUDP {
public static void main(String args[]) throws Exception {
DatagramSocket tomada = new DatagramSocket();
InetAddress ip = InetAddress.getByName("127.0.0.1");
int porta = 5000;
/////////CÓDIGO PARA OBTER O NOME DA IMAGEM
/////////VIA TECLADO
System.out.print("Digite uma mensagem:");
Scanner teclado = new Scanner(System.in);
String mensagem = teclado.nextLine();
/////////CÓDIGO PARA ENVIAR UMA MENSAGEM COM O
/////////NOME DA IMAGEM PARA O SERVIDOR
byte[] cartaAEnviar = new byte[64];
cartaAEnviar = mensagem.getBytes();
DatagramPacket envelopeAEnviar
= new DatagramPacket(cartaAEnviar,
cartaAEnviar.length,
ip,
porta);
tomada.send(envelopeAEnviar);
//////////RECEBER O TAMANHO DA IMAGEM DO SERVIDOR
byte[] cartaAReceber = new byte[8];
DatagramPacket envelopeAReceber
= new DatagramPacket(cartaAReceber,
cartaAReceber.length);
tomada.receive(envelopeAReceber);
cartaAReceber = envelopeAReceber.getData();
String msgRecebida = new String(cartaAReceber);
int tamanhoImagem = Integer.parseInt(msgRecebida.trim());
///////////RECEBER IMAGEM DO SERVIDOR E
///////////SALVAR NO COMPUTADOR
byte[] cartaAReceber2 = new byte[tamanhoImagem];
DatagramPacket envelopeAReceber2
= new DatagramPacket(cartaAReceber2,
cartaAReceber2.length);
tomada.receive(envelopeAReceber2);
String caminhoImagem = "C:/Users/asus/Desktop/IMAGEM_RECEBIDA.jpg";
ManipulacaoArquivos m = new ManipulacaoArquivos();
m.deArrayParaImagem(envelopeAReceber2.getData(), caminhoImagem);
//SE NÃO TIVER MAIS NADA PARA FAZER
//finaliza a conexão
tomada.close();
}
}
| 2,019 | 0.609926 | 0.600496 | 60 | 32.583332 | 20.436317 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 9 |
304faf3139071bc5023b323999a9f12018c677ab | 28,716,151,374,033 | 9a4dd7a8ccebb0467f349cdc59f843a2d920b976 | /building_management/ProjectAndBuildingsTotalPaymentsReport.java | 871df3e83a796a1db9e176b0ee3c415100fc07a4 | [] | no_license | masdar80/buildingProjectManager | https://github.com/masdar80/buildingProjectManager | 202b2e839508c67c44697e507d7ea9f7bfb525db | 48c5c86ae65ef661006fb89433f1363bdad92a58 | refs/heads/master | 2022-02-08T16:08:55.371000 | 2019-07-20T20:15:34 | 2019-07-20T20:15:34 | 197,975,100 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package building_management;
/**
*
* @author masdar
*/
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.math.BigDecimal;
import java.sql.*;
import java.text.DecimalFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ProjectAndBuildingsTotalPaymentsReport extends javax.swing.JFrame {
String quantityPerReferenceQuery = "";
DecimalFormat df;
connect inConn;
Double TOTAL;
private final Image img;
public ProjectAndBuildingsTotalPaymentsReport() throws SQLException {
inConn = new connect();
inConn.newConnection();
df = new DecimalFormat("#.#");
initComponents();
img = Toolkit.getDefaultToolkit().getImage(java.net.URLClassLoader.getSystemResource("icons/1.png"));
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int temp_width = (int) screenSize.getWidth();
int temp_height = (int) screenSize.getHeight();
this.setSize(489, 242);
this.setLocation((temp_width - 489) / 2, (temp_height - 242) / 2);
this.setIconImage(img);
this.setTitle("اجمالي مدفوعات المحاضر مضافا اليها مصاريف المشروع");
/*inputs*/
TOTAL = calcProjectOUtlays() + calcBuidlingsPayments();
totalcosLable.setText(df.format(new BigDecimal(TOTAL)));
// conn.QueryTable(recordsquery, cardRecordsjTable);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
totalcosLable = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
totalcosLable.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N
totalcosLable.setForeground(new java.awt.Color(102, 0, 51));
totalcosLable.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(totalcosLable, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(61, 61, 61)
.addComponent(totalcosLable, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(66, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
}//GEN-LAST:event_formWindowClosed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel totalcosLable;
// End of variables declaration//GEN-END:variables
private Double calcProjectOUtlays() {
Double total1 = 0.0;
inConn.newConnection();
Statement stmt = null;
String total_outlays_recordsQuery = "SELECT sum(amount) as amount FROM total_outlays_records ";
try {
stmt = inConn.conn.createStatement();
ResultSet res = stmt.executeQuery(total_outlays_recordsQuery);
while (res.next()) {
total1 = res.getDouble("amount");
}
} catch (SQLException ex) {
Logger.getLogger(____quantityReport.class.getName()).log(Level.SEVERE, null, ex);
}
return total1;
}
private Double calcBuidlingsPayments() {
Double total1 = 0.0;
inConn.newConnection();
Statement stmt = null;
String chartQuantityPerReferenceQuery = "SELECT amount FROM totalpayments ";
try {
stmt = inConn.conn.createStatement();
ResultSet res = stmt.executeQuery(chartQuantityPerReferenceQuery);
while (res.next()) {
total1 = res.getDouble("amount");
}
} catch (SQLException ex) {
Logger.getLogger(____quantityReport.class.getName()).log(Level.SEVERE, null, ex);
}
return total1;
}
}
| UTF-8 | Java | 5,410 | java | ProjectAndBuildingsTotalPaymentsReport.java | Java | [
{
"context": "package building_management;\n\n/**\n *\n * @author masdar\n */\nimport java.awt.Dimension;\nimport java.awt.Im",
"end": 54,
"score": 0.9807614088058472,
"start": 48,
"tag": "USERNAME",
"value": "masdar"
}
] | null | [] | package building_management;
/**
*
* @author masdar
*/
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.math.BigDecimal;
import java.sql.*;
import java.text.DecimalFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ProjectAndBuildingsTotalPaymentsReport extends javax.swing.JFrame {
String quantityPerReferenceQuery = "";
DecimalFormat df;
connect inConn;
Double TOTAL;
private final Image img;
public ProjectAndBuildingsTotalPaymentsReport() throws SQLException {
inConn = new connect();
inConn.newConnection();
df = new DecimalFormat("#.#");
initComponents();
img = Toolkit.getDefaultToolkit().getImage(java.net.URLClassLoader.getSystemResource("icons/1.png"));
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int temp_width = (int) screenSize.getWidth();
int temp_height = (int) screenSize.getHeight();
this.setSize(489, 242);
this.setLocation((temp_width - 489) / 2, (temp_height - 242) / 2);
this.setIconImage(img);
this.setTitle("اجمالي مدفوعات المحاضر مضافا اليها مصاريف المشروع");
/*inputs*/
TOTAL = calcProjectOUtlays() + calcBuidlingsPayments();
totalcosLable.setText(df.format(new BigDecimal(TOTAL)));
// conn.QueryTable(recordsquery, cardRecordsjTable);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
totalcosLable = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
totalcosLable.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N
totalcosLable.setForeground(new java.awt.Color(102, 0, 51));
totalcosLable.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(totalcosLable, javax.swing.GroupLayout.DEFAULT_SIZE, 489, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(61, 61, 61)
.addComponent(totalcosLable, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(66, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
}//GEN-LAST:event_formWindowClosed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel totalcosLable;
// End of variables declaration//GEN-END:variables
private Double calcProjectOUtlays() {
Double total1 = 0.0;
inConn.newConnection();
Statement stmt = null;
String total_outlays_recordsQuery = "SELECT sum(amount) as amount FROM total_outlays_records ";
try {
stmt = inConn.conn.createStatement();
ResultSet res = stmt.executeQuery(total_outlays_recordsQuery);
while (res.next()) {
total1 = res.getDouble("amount");
}
} catch (SQLException ex) {
Logger.getLogger(____quantityReport.class.getName()).log(Level.SEVERE, null, ex);
}
return total1;
}
private Double calcBuidlingsPayments() {
Double total1 = 0.0;
inConn.newConnection();
Statement stmt = null;
String chartQuantityPerReferenceQuery = "SELECT amount FROM totalpayments ";
try {
stmt = inConn.conn.createStatement();
ResultSet res = stmt.executeQuery(chartQuantityPerReferenceQuery);
while (res.next()) {
total1 = res.getDouble("amount");
}
} catch (SQLException ex) {
Logger.getLogger(____quantityReport.class.getName()).log(Level.SEVERE, null, ex);
}
return total1;
}
}
| 5,410 | 0.661263 | 0.649525 | 146 | 35.760273 | 32.39045 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636986 | false | false | 9 |
7d2183716a739c7831c5f27b34fc4d0674575a0e | 4,114,578,705,206 | 337eaf4af6734b32e1e7df00cb2ef0f173ba4c97 | /src/com/faustas/dbms/scenarios/LogoutScenario.java | ec720fd59a35e2b73b779133288bb4438aaa8101 | [] | no_license | faustuzas/RecipesApp | https://github.com/faustuzas/RecipesApp | 99501dc01cee245ff1a1cdb7589fa71a74d6dcb3 | 650853175c0f473993a6a164fac7e43439fcd880 | refs/heads/master | 2020-05-20T08:15:05.713000 | 2019-05-21T09:33:48 | 2019-05-21T09:33:48 | 185,470,090 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.faustas.dbms.scenarios;
import com.faustas.dbms.framework.annotations.Service;
import com.faustas.dbms.interfaces.SecurityContext;
import com.faustas.dbms.services.ConsoleInteractor;
import com.faustas.dbms.utils.ConsoleColor;
@Service
public class LogoutScenario extends ConsoleScenario {
private SecurityContext securityContext;
public LogoutScenario(ConsoleInteractor interactor, SecurityContext securityContext) {
super(interactor);
this.securityContext = securityContext;
}
@Override
public boolean action() {
securityContext.clear();
interactor.printSuccess("Logout successful");
return true;
}
}
| UTF-8 | Java | 684 | java | LogoutScenario.java | Java | [] | null | [] | package com.faustas.dbms.scenarios;
import com.faustas.dbms.framework.annotations.Service;
import com.faustas.dbms.interfaces.SecurityContext;
import com.faustas.dbms.services.ConsoleInteractor;
import com.faustas.dbms.utils.ConsoleColor;
@Service
public class LogoutScenario extends ConsoleScenario {
private SecurityContext securityContext;
public LogoutScenario(ConsoleInteractor interactor, SecurityContext securityContext) {
super(interactor);
this.securityContext = securityContext;
}
@Override
public boolean action() {
securityContext.clear();
interactor.printSuccess("Logout successful");
return true;
}
}
| 684 | 0.754386 | 0.754386 | 24 | 27.5 | 24.264172 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
605849cde4da98be2bad2bf811360821c442602e | 146,028,937,118 | 16f416c2c9e49218a235bceabd0614edc6a2b304 | /app/src/main/java/com/sky/dining/widget/MyDialog.java | b5ca45b29e22008574a3caea4d73a87c752cb36d | [] | no_license | YngY/dinner | https://github.com/YngY/dinner | ca3a7ac7e7e58d3526cfbb44181416dbf1a8a12b | 30b4625ac9831d561cb665246ffe576379d401f4 | refs/heads/master | 2021-07-17T08:48:27.389000 | 2017-10-24T06:19:56 | 2017-10-24T06:19:56 | 108,082,148 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sky.dining.widget;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import com.sky.dining.R;
/**
* 自定义Dialog
*
* @author Home
*
*/
public class MyDialog extends Dialog implements View.OnClickListener {
private DialogClickListener listener;
Context context;
private TextView tv_restinfo_pop_tel_content;
private TextView dialog_textViewID;
private TextView dialog_textViewID1;
private String leftBtnText;
private String rightBtnText;
private String content;
public MyDialog(Context context) {
super(context);
// TODO Auto-generated constructor stub
this.context = context;
}
/**
*
* @param context
* @param theme
* @param content
* 内容
* @param leftBtnText
* 左
* @param rightBtnText
* 右
* @param listener
* 监听
*/
public MyDialog(Context context, int theme, String content, String leftBtnText, String rightBtnText,
DialogClickListener listener) {
super(context, theme);
this.context = context;
this.content = content;
this.leftBtnText = leftBtnText;
this.rightBtnText = rightBtnText;
this.listener = listener;
}
public void setTextSize(int size) {
dialog_textViewID.setTextSize(size);
dialog_textViewID1.setTextSize(size);
};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.toast_dialog);
tv_restinfo_pop_tel_content = (TextView) findViewById(R.id.tv_restinfo_pop_tel_content);
dialog_textViewID1 = (TextView) findViewById(R.id.dialog_textViewID1);
dialog_textViewID = (TextView) findViewById(R.id.dialog_textViewID);
dialog_textViewID.setOnClickListener(this);
dialog_textViewID1.setOnClickListener(this);
initView();
initDialog(context);
}
/**
* 初始化
*
* @param context
*/
private void initDialog(Context context) {
setCanceledOnTouchOutside(false);
setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
return true;
} else {
return false;
}
}
});
WindowManager windowManager = this.getWindow().getWindowManager();
Display display = windowManager.getDefaultDisplay();
WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.width = (int) (display.getWidth() / 6 * 5); // 属性设置
this.getWindow().setAttributes(lp);
}
private void initView() {
tv_restinfo_pop_tel_content.setText(content);
dialog_textViewID.setText(leftBtnText);
dialog_textViewID1.setText(rightBtnText);
}
public interface DialogClickListener {
void onLeftBtnClick(Dialog dialog);
void onRightBtnClick(Dialog dialog);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_textViewID:
listener.onLeftBtnClick(this);
break;
case R.id.dialog_textViewID1:
listener.onRightBtnClick(this);
break;
default:
break;
}
}
} | UTF-8 | Java | 3,387 | java | MyDialog.java | Java | [
{
"context": "om.sky.dining.R;\n\n\n/**\n * 自定义Dialog\n * \n * @author Home\n *\n */\npublic class MyDialog extends Dialog imple",
"end": 462,
"score": 0.9728615880012512,
"start": 458,
"tag": "USERNAME",
"value": "Home"
}
] | null | [] | package com.sky.dining.widget;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import com.sky.dining.R;
/**
* 自定义Dialog
*
* @author Home
*
*/
public class MyDialog extends Dialog implements View.OnClickListener {
private DialogClickListener listener;
Context context;
private TextView tv_restinfo_pop_tel_content;
private TextView dialog_textViewID;
private TextView dialog_textViewID1;
private String leftBtnText;
private String rightBtnText;
private String content;
public MyDialog(Context context) {
super(context);
// TODO Auto-generated constructor stub
this.context = context;
}
/**
*
* @param context
* @param theme
* @param content
* 内容
* @param leftBtnText
* 左
* @param rightBtnText
* 右
* @param listener
* 监听
*/
public MyDialog(Context context, int theme, String content, String leftBtnText, String rightBtnText,
DialogClickListener listener) {
super(context, theme);
this.context = context;
this.content = content;
this.leftBtnText = leftBtnText;
this.rightBtnText = rightBtnText;
this.listener = listener;
}
public void setTextSize(int size) {
dialog_textViewID.setTextSize(size);
dialog_textViewID1.setTextSize(size);
};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.toast_dialog);
tv_restinfo_pop_tel_content = (TextView) findViewById(R.id.tv_restinfo_pop_tel_content);
dialog_textViewID1 = (TextView) findViewById(R.id.dialog_textViewID1);
dialog_textViewID = (TextView) findViewById(R.id.dialog_textViewID);
dialog_textViewID.setOnClickListener(this);
dialog_textViewID1.setOnClickListener(this);
initView();
initDialog(context);
}
/**
* 初始化
*
* @param context
*/
private void initDialog(Context context) {
setCanceledOnTouchOutside(false);
setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
return true;
} else {
return false;
}
}
});
WindowManager windowManager = this.getWindow().getWindowManager();
Display display = windowManager.getDefaultDisplay();
WindowManager.LayoutParams lp = this.getWindow().getAttributes();
lp.width = (int) (display.getWidth() / 6 * 5); // 属性设置
this.getWindow().setAttributes(lp);
}
private void initView() {
tv_restinfo_pop_tel_content.setText(content);
dialog_textViewID.setText(leftBtnText);
dialog_textViewID1.setText(rightBtnText);
}
public interface DialogClickListener {
void onLeftBtnClick(Dialog dialog);
void onRightBtnClick(Dialog dialog);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_textViewID:
listener.onLeftBtnClick(this);
break;
case R.id.dialog_textViewID1:
listener.onRightBtnClick(this);
break;
default:
break;
}
}
} | 3,387 | 0.724888 | 0.721908 | 138 | 23.31884 | 20.876791 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.73913 | false | false | 9 |
ed4d7a7dcda0b77c851a9dfb0e39c45d6d13c0d4 | 25,056,839,213,726 | 229dff0cda5a05fb4b1b7bfdc1f6b5058ffe32fc | /UI/app/src/main/java/com/tsoiay/ui/PublishDialog.java | 369a099a29789f90fcb161f8cd725cf68ca376ef | [] | no_license | Tsoiay/Android | https://github.com/Tsoiay/Android | 13365ddd122eea8d625a7b660636c04b19e5d5ba | 88fe6f1b4844fbbaeac4fba519d149400545831e | refs/heads/master | 2021-09-15T09:37:54.190000 | 2018-05-30T02:47:45 | 2018-05-30T02:47:45 | 115,402,968 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tsoiay.ui;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.tsoiay.ui.R;
public class PublishDialog extends Dialog {
private RelativeLayout rlMain;
private Context context;
private LinearLayout Btn_new_things, Btn_run_errands, Btn_nearby, llBtnMenu;
private Handler handler;
private ImageView ivMenu;
public PublishDialog(Context context) {
this(context, R.style.main_publishdialog_style);
}
private PublishDialog(Context context, int theme) {
super(context, theme);
this.context = context;
init();
}
/**
* 初始化
*/
private void init() {
handler = new Handler();
//填充视图
setContentView(R.layout.main_dialog_publish);
rlMain = (RelativeLayout) findViewById(R.id.mainPublish_dialog_rlMain);
Btn_new_things = (LinearLayout) findViewById(R.id.new_things);
Btn_run_errands = (LinearLayout) findViewById(R.id.run_errands);
Btn_nearby = (LinearLayout) findViewById(R.id.nearby);
llBtnMenu = (LinearLayout) findViewById(R.id.mainPublish_dialog_llBtnMenu);
ivMenu = (ImageView) findViewById(R.id.mainPublish_dialog_ivMenu);
llBtnMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
outputDialog();
}
});
rlMain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
outputDialog();
}
});
}
/**
* 进入对话框(带动画)
*/
public void inputDialog() {
Btn_new_things.setVisibility(View.INVISIBLE);
Btn_run_errands.setVisibility(View.INVISIBLE);
Btn_nearby.setVisibility(View.INVISIBLE);
//背景动画
rlMain.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_fade_in));
//菜单按钮动画
ivMenu.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_rotate_right));
//选项动画
Btn_new_things.setVisibility(View.VISIBLE);
Btn_new_things.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_in));
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_run_errands.setVisibility(View.VISIBLE);
Btn_run_errands.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_in));
}
}, 100);
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_nearby.setVisibility(View.VISIBLE);
Btn_nearby.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_in));
}
}, 200);
}
/**
* 取消对话框(带动画)
*/
public void outputDialog() {
//退出动画
rlMain.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_fade_out));
ivMenu.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_rotate_left));
handler.postDelayed(new Runnable() {
@Override
public void run() {
dismiss();
}
}, 400);
Btn_new_things.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_out));
Btn_new_things.setVisibility(View.INVISIBLE);
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_run_errands.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_out));
Btn_run_errands.setVisibility(View.INVISIBLE);
}
}, 50);
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_nearby.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_out));
Btn_nearby.setVisibility(View.INVISIBLE);
}
}, 100);
}
@Override
public void show() {
super.show();
inputDialog();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//全屏
WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
}
public PublishDialog setBtn_new_thingsclicklistener(View.OnClickListener clickListener){
Btn_new_things.setOnClickListener(clickListener);
return this;
}
public PublishDialog setBtn_run_errandsclicklistener(View.OnClickListener clickListener){
Btn_run_errands.setOnClickListener(clickListener);
return this;
}
public PublishDialog setBtn_nearbyclicklistener(View.OnClickListener clickListener){
Btn_nearby.setOnClickListener(clickListener);
return this;
}
} | UTF-8 | Java | 5,572 | java | PublishDialog.java | Java | [] | null | [] | package com.tsoiay.ui;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.tsoiay.ui.R;
public class PublishDialog extends Dialog {
private RelativeLayout rlMain;
private Context context;
private LinearLayout Btn_new_things, Btn_run_errands, Btn_nearby, llBtnMenu;
private Handler handler;
private ImageView ivMenu;
public PublishDialog(Context context) {
this(context, R.style.main_publishdialog_style);
}
private PublishDialog(Context context, int theme) {
super(context, theme);
this.context = context;
init();
}
/**
* 初始化
*/
private void init() {
handler = new Handler();
//填充视图
setContentView(R.layout.main_dialog_publish);
rlMain = (RelativeLayout) findViewById(R.id.mainPublish_dialog_rlMain);
Btn_new_things = (LinearLayout) findViewById(R.id.new_things);
Btn_run_errands = (LinearLayout) findViewById(R.id.run_errands);
Btn_nearby = (LinearLayout) findViewById(R.id.nearby);
llBtnMenu = (LinearLayout) findViewById(R.id.mainPublish_dialog_llBtnMenu);
ivMenu = (ImageView) findViewById(R.id.mainPublish_dialog_ivMenu);
llBtnMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
outputDialog();
}
});
rlMain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
outputDialog();
}
});
}
/**
* 进入对话框(带动画)
*/
public void inputDialog() {
Btn_new_things.setVisibility(View.INVISIBLE);
Btn_run_errands.setVisibility(View.INVISIBLE);
Btn_nearby.setVisibility(View.INVISIBLE);
//背景动画
rlMain.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_fade_in));
//菜单按钮动画
ivMenu.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_rotate_right));
//选项动画
Btn_new_things.setVisibility(View.VISIBLE);
Btn_new_things.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_in));
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_run_errands.setVisibility(View.VISIBLE);
Btn_run_errands.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_in));
}
}, 100);
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_nearby.setVisibility(View.VISIBLE);
Btn_nearby.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_in));
}
}, 200);
}
/**
* 取消对话框(带动画)
*/
public void outputDialog() {
//退出动画
rlMain.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_fade_out));
ivMenu.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_rotate_left));
handler.postDelayed(new Runnable() {
@Override
public void run() {
dismiss();
}
}, 400);
Btn_new_things.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_out));
Btn_new_things.setVisibility(View.INVISIBLE);
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_run_errands.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_out));
Btn_run_errands.setVisibility(View.INVISIBLE);
}
}, 50);
handler.postDelayed(new Runnable() {
@Override
public void run() {
Btn_nearby.startAnimation(AnimationUtils.loadAnimation(context, R.anim.mainactivity_push_bottom_out));
Btn_nearby.setVisibility(View.INVISIBLE);
}
}, 100);
}
@Override
public void show() {
super.show();
inputDialog();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//全屏
WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
}
public PublishDialog setBtn_new_thingsclicklistener(View.OnClickListener clickListener){
Btn_new_things.setOnClickListener(clickListener);
return this;
}
public PublishDialog setBtn_run_errandsclicklistener(View.OnClickListener clickListener){
Btn_run_errands.setOnClickListener(clickListener);
return this;
}
public PublishDialog setBtn_nearbyclicklistener(View.OnClickListener clickListener){
Btn_nearby.setOnClickListener(clickListener);
return this;
}
} | 5,572 | 0.643848 | 0.641292 | 167 | 31.808384 | 30.408583 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.562874 | false | false | 9 |
c70281d58245aad6739dcf016d287dcf255b0965 | 23,630,910,066,303 | 55d5a129f2ce06e13d6a88000ba2aa4c0da58bec | /Robocode evolvalasa/Watchmaker-Evolution/src/Programs/ShootingProgram.java | fef200967760225ddcf22b555e0f729ece53fc20 | [] | no_license | PEZO19/Project-Robocode-Evolved-by-Watchmaker-on-git | https://github.com/PEZO19/Project-Robocode-Evolved-by-Watchmaker-on-git | 9e8868cd84de42cf6aec11ee6905b770eaca7fd6 | 448784ed64b43eeefd0ded9437e4ef01edaab753 | refs/heads/master | 2016-09-05T19:20:42.004000 | 2015-02-05T18:45:22 | 2015-02-05T18:45:22 | 18,839,578 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package wmevo.Programs;
import org.uncommons.maths.random.Probability;
import wmevo.Node;
import wmevo.Programs.Factory.AgentProgramFactory;
import wmevo.Programs.Factory.ShootingProgramFactory;
import java.io.Serializable;
import java.util.Random;
/**
* Created by Zoltán on 2014.04.23..
*/
public class ShootingProgram implements Serializable{
public Node tree;
public ShootingProgram(Node tree) {
this.tree = tree;
}
public ShootingProgram(ShootingProgramFactory shootingProgramFactory, Random rng) {
tree = shootingProgramFactory.generateRandomCandidate(rng);
}
public ShootingProgram mutate(Random rng, Probability mutationProbability, AgentProgramFactory agentProgramFactory) {
this.tree = tree.mutate(rng, mutationProbability, agentProgramFactory.shootingProgramFactory);
return this;
}
@Override
public String toString() {
return "\n ShootingProgram: \n" + tree.print(tree.getDepth());
}
} | UTF-8 | Java | 1,026 | java | ShootingProgram.java | Java | [
{
"context": "e;\r\nimport java.util.Random;\r\n\r\n/**\r\n * Created by Zoltán on 2014.04.23..\r\n */\r\npublic class ShootingProgra",
"end": 287,
"score": 0.9996964931488037,
"start": 281,
"tag": "NAME",
"value": "Zoltán"
}
] | null | [] | package wmevo.Programs;
import org.uncommons.maths.random.Probability;
import wmevo.Node;
import wmevo.Programs.Factory.AgentProgramFactory;
import wmevo.Programs.Factory.ShootingProgramFactory;
import java.io.Serializable;
import java.util.Random;
/**
* Created by Zoltán on 2014.04.23..
*/
public class ShootingProgram implements Serializable{
public Node tree;
public ShootingProgram(Node tree) {
this.tree = tree;
}
public ShootingProgram(ShootingProgramFactory shootingProgramFactory, Random rng) {
tree = shootingProgramFactory.generateRandomCandidate(rng);
}
public ShootingProgram mutate(Random rng, Probability mutationProbability, AgentProgramFactory agentProgramFactory) {
this.tree = tree.mutate(rng, mutationProbability, agentProgramFactory.shootingProgramFactory);
return this;
}
@Override
public String toString() {
return "\n ShootingProgram: \n" + tree.print(tree.getDepth());
}
} | 1,026 | 0.715122 | 0.707317 | 37 | 25.756756 | 30.920479 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.486486 | false | false | 9 |
939a45b72626037d7b19f3cfd021e6c084da568a | 24,103,356,465,697 | 9ed69ba364ace33219f84ef4f957f896bc5fbc22 | /src/main/java/com/hoangnt/service/impl/DistrictServiceImpl.java | 60ca8ee44a5ffb152393237fedeaa0ce6193a250 | [] | no_license | hoangnt2-hn/doan | https://github.com/hoangnt2-hn/doan | 3c1b20e26538dac26f542f1cb3ff722f4cad515e | b0c9e8756340c2a68bf7fb103f23408af59bba30 | refs/heads/master | 2022-06-22T15:22:15.848000 | 2019-12-25T22:32:29 | 2019-12-25T22:32:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hoangnt.service.impl;
import java.util.ArrayList;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hoangnt.entity.District;
import com.hoangnt.model.DistrictDTO;
import com.hoangnt.model.TownDTO;
import com.hoangnt.repository.DistrictRepository;
import com.hoangnt.service.DistrictService;
@Transactional
@Service
public class DistrictServiceImpl implements DistrictService {
@Autowired
DistrictRepository districtRepository;
@Override
public DistrictDTO findById(String id) {
DistrictDTO districtDTO = new DistrictDTO();
District district = districtRepository.getOne(id);
districtDTO.setMaqh(district.getMaqh());
districtDTO.setName(district.getName());
districtDTO.setType(district.getType());
List<TownDTO> townDTOs = new ArrayList<>();
district.getTowns().forEach(town -> {
TownDTO townDTO = new TownDTO();
townDTO.setXaid(town.getXaid());
townDTO.setName(town.getName());
townDTO.setType(town.getType());
townDTOs.add(townDTO);
});
districtDTO.setTownDTOs(townDTOs);
return districtDTO;
}
}
| UTF-8 | Java | 1,195 | java | DistrictServiceImpl.java | Java | [] | null | [] | package com.hoangnt.service.impl;
import java.util.ArrayList;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hoangnt.entity.District;
import com.hoangnt.model.DistrictDTO;
import com.hoangnt.model.TownDTO;
import com.hoangnt.repository.DistrictRepository;
import com.hoangnt.service.DistrictService;
@Transactional
@Service
public class DistrictServiceImpl implements DistrictService {
@Autowired
DistrictRepository districtRepository;
@Override
public DistrictDTO findById(String id) {
DistrictDTO districtDTO = new DistrictDTO();
District district = districtRepository.getOne(id);
districtDTO.setMaqh(district.getMaqh());
districtDTO.setName(district.getName());
districtDTO.setType(district.getType());
List<TownDTO> townDTOs = new ArrayList<>();
district.getTowns().forEach(town -> {
TownDTO townDTO = new TownDTO();
townDTO.setXaid(town.getXaid());
townDTO.setName(town.getName());
townDTO.setType(town.getType());
townDTOs.add(townDTO);
});
districtDTO.setTownDTOs(townDTOs);
return districtDTO;
}
}
| 1,195 | 0.779916 | 0.779916 | 47 | 24.425531 | 19.585867 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.404255 | false | false | 9 |
3cca0f807688449dfe82c13111efebf26d677b9d | 18,124,762,037,941 | e11b98a6b7ba5091edcc49cc61652ae12b062753 | /waagreen/src/main/java/waa/green/formatter/DateFormatter.java | 9f42593e82341928e3c6e42ca9a7f65216f1bf83 | [] | no_license | Selinatesfa/waagreen | https://github.com/Selinatesfa/waagreen | dafc7600d26caa7294764c7d001d9a920c8b5952 | f6a7610df165fce0630ff989d17a3f511c775de0 | refs/heads/master | 2020-04-29T04:49:45.422000 | 2019-03-22T20:26:04 | 2019-03-22T20:26:04 | 175,860,206 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package waa.green.formatter;
import org.springframework.format.Formatter;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@Component
public class DateFormatter implements Formatter<Date> {
@Override
public Date parse(String str, Locale locale) {
Date date = null;
try {
date = this.dateFormat(str);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
@Override
public String print(Date date, Locale locale) {
System.out.println("print Working");
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy ");
return dateFormat.format(date);
}
private Date dateFormat(String date) throws ParseException {
SimpleDateFormat formatter;
if (date.contains("/"))
formatter = new SimpleDateFormat("MM/dd/yy");
else if (date.contains("-"))
formatter = new SimpleDateFormat("dd-MM-yyyy");
else
formatter = null;
return formatter.parse(date);
}
}
| UTF-8 | Java | 1,196 | java | DateFormatter.java | Java | [] | null | [] | package waa.green.formatter;
import org.springframework.format.Formatter;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@Component
public class DateFormatter implements Formatter<Date> {
@Override
public Date parse(String str, Locale locale) {
Date date = null;
try {
date = this.dateFormat(str);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
@Override
public String print(Date date, Locale locale) {
System.out.println("print Working");
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy ");
return dateFormat.format(date);
}
private Date dateFormat(String date) throws ParseException {
SimpleDateFormat formatter;
if (date.contains("/"))
formatter = new SimpleDateFormat("MM/dd/yy");
else if (date.contains("-"))
formatter = new SimpleDateFormat("dd-MM-yyyy");
else
formatter = null;
return formatter.parse(date);
}
}
| 1,196 | 0.646321 | 0.646321 | 42 | 27.476191 | 19.468214 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false | 9 |
ed59092bbd19d094e53f474b8975bc6d77e56ec1 | 18,537,078,915,330 | 0d3324aa59fb0374c2f58f1415f4d3b4601499a9 | /app/src/main/java/com/bkromhout/minerva/events/ShowRateMeDialogEvent.java | 8adcb34bfc830c1d25a7a71154b8c5c2c3c8bdd9 | [
"Apache-2.0"
] | permissive | bkromhout/Minerva | https://github.com/bkromhout/Minerva | f574d87cfaf9b798797f7496a817b23ce17d8bac | 49637785d01010424c46ab8cdd84faa6a2e68374 | refs/heads/master | 2020-12-13T09:48:43.621000 | 2016-10-08T01:20:43 | 2016-10-08T01:20:43 | 48,961,876 | 6 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bkromhout.minerva.events;
import android.content.Context;
/**
* Fired by {@link com.bkromhout.minerva.Minerva} if {@link com.bkromhout.minerva.activities.MainActivity} should call
* {@link com.bkromhout.minerva.util.Dialogs#rateMinervaDialog(Context)} when its {@code onResume()} method is called.
*/
public class ShowRateMeDialogEvent {
}
| UTF-8 | Java | 357 | java | ShowRateMeDialogEvent.java | Java | [] | null | [] | package com.bkromhout.minerva.events;
import android.content.Context;
/**
* Fired by {@link com.bkromhout.minerva.Minerva} if {@link com.bkromhout.minerva.activities.MainActivity} should call
* {@link com.bkromhout.minerva.util.Dialogs#rateMinervaDialog(Context)} when its {@code onResume()} method is called.
*/
public class ShowRateMeDialogEvent {
}
| 357 | 0.773109 | 0.773109 | 10 | 34.700001 | 44.104534 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.