blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
d26aba93a06029e8f15bd564812c5e06dad32c8f
fe3e6688cb879db5136b95bdb89d3096f46724c5
/src/Cliente.java
92d208c95a9ff48ca436f906e17b23256c272383
[]
no_license
matheusf98/Java-Orientado_Objeto_Encapsulamento
ff84e540ae6a4c8403b09806db92f83bcc23b9b5
5357f4f5c832947194cfaa826333fb0e5c739402
refs/heads/master
2022-11-13T08:14:32.828346
2020-06-30T18:38:30
2020-06-30T18:38:30
276,180,823
1
0
null
null
null
null
UTF-8
Java
false
false
422
java
public class Cliente { private String Nome; private String Cpf; private String Profissao; public String getNome() { return Nome; } public void setNome(String nome) { Nome = nome; } public String getCpf() { return Cpf; } public void setCpf(String cpf) { Cpf = cpf; } public String getProfissao() { return Profissao; } public void setProfissao(String profissao) { Profissao = profissao; } }
[ "dev@perugluglu" ]
dev@perugluglu
d8b44289381c96a3d20b4d2cbab7a8b0138d1cc3
536239d5000786770fac4311819c360d18779a7e
/src/project/staff/attendance/Get_name.java
a87521d09e582c4b38d77b3672c7afa0f674b125
[]
no_license
rlaalghkwkd2/Project01
081222eda8374303241fb33480f0837ac095bb33
fbda5b57a670057c28379c9af2f6d6289efe004f
refs/heads/main
2023-02-02T02:50:12.010228
2020-12-24T04:11:43
2020-12-24T04:11:43
323,567,015
0
0
null
null
null
null
UTF-8
Java
false
false
1,214
java
package project.staff.attendance; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Properties; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import project.Payment.team.Hikariconfig; public class Get_name { public String name = null; HikariDataSource ds = null; public Get_name(int emp_id) { ds = new Hikariconfig().config(); try { Connection conn = ds.getConnection(); PreparedStatement pstmt = conn.prepareStatement("SELECT emp_name FROM employees3 WHERE emp_id = ?"); pstmt.setInt(1, emp_id); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { name = rs.getString("emp_name"); } rs.close(); pstmt.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } public String name() { return name; } public static void main(String[] args) { System.out.println(new Get_name(2).name()); } }
[ "seunghwan@Park" ]
seunghwan@Park
1d7fa4a5bd97f698e9ec26b1234a55879a5a7218
aa189fa4cac412b639cbc4b10f0c8d0db38adc19
/src/interaction/mappers/MentionUsersMapper.java
26730a4eea25b71674ac2e80d9495e5b3bb610fd
[]
no_license
wild-fire/interaction-graph-filter
231a45e9ad9901e8e88c42f72862bc55c3205216
9f4285f4d60e9f5fc8cdb7d420aad55456664879
refs/heads/master
2021-01-22T09:09:11.268326
2015-05-23T19:21:37
2015-05-23T19:21:37
32,278,773
2
0
null
null
null
null
UTF-8
Java
false
false
1,046
java
package interaction.mappers; import interaction.vos.Interaction; import java.io.IOException; import org.apache.hadoop.io.Text; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public class MentionUsersMapper extends InteractionDateGroupedMapper { @Override protected void mapTweet(Object key, Text value, Context context) throws IOException, InterruptedException { JsonObject entities = this.tweet.get("entities").getAsJsonObject(); if(entities.get("user_mentions").getAsJsonArray().size() > 0) { String userId = this.tweet.get("user").getAsJsonObject().get("id_str") .getAsString(); for (JsonElement mentionedUser : entities.get("user_mentions") .getAsJsonArray()) { JsonObject mentionedUserObj = mentionedUser.getAsJsonObject(); if(!this.tweet.isRetweeting(mentionedUserObj.get("screen_name").getAsString())) { Interaction mention = new Interaction(userId, mentionedUserObj.get("id").toString()); this.contextWriteToGroups(context, mention); } } } } }
[ "davidjbrenes@gmail.com" ]
davidjbrenes@gmail.com
627d5db55117408d2c5b400530dbf72ca31b97e1
ef275d147ddd32fdf137f2e57e7d09f04826754f
/h2code/src/main/org/h2/fulltext/FullTextLucene.java
4ea3a56756a75cf0010428360fbd0b3a8df343df
[]
no_license
ketki512/H2_database_extensions
61e26202422bd5ea86b684d171d5b97a74c19fd6
dcd56b74a5314013cbeafa2c4ef9ecb67a7f078d
refs/heads/master
2021-01-10T08:21:46.576757
2016-03-30T16:13:38
2016-03-30T16:13:38
55,077,685
0
0
null
null
null
null
UTF-8
Java
false
false
28,342
java
/* * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (http://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.fulltext; import java.io.IOException; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.DateTools; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.Searcher; import org.h2.api.Trigger; import org.h2.command.Parser; import org.h2.engine.Session; import org.h2.expression.ExpressionColumn; import org.h2.jdbc.JdbcConnection; import org.h2.store.fs.FileUtils; import org.h2.tools.SimpleResultSet; import org.h2.util.New; import org.h2.util.StatementBuilder; import org.h2.util.StringUtils; import org.h2.util.Utils; import java.io.File; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.util.Version; import org.apache.lucene.index.IndexWriter; /** * This class implements the full text search based on Apache Lucene. * Most methods can be called using SQL statements as well. */ public class FullTextLucene extends FullText { /** * Whether the text content should be stored in the Lucene index. */ protected static final boolean STORE_DOCUMENT_TEXT_IN_INDEX = Utils.getProperty("h2.storeDocumentTextInIndex", false); private static final HashMap<String, IndexAccess> INDEX_ACCESS = New.hashMap(); private static final String TRIGGER_PREFIX = "FTL_"; private static final String SCHEMA = "FTL"; private static final String LUCENE_FIELD_DATA = "_DATA"; private static final String LUCENE_FIELD_QUERY = "_QUERY"; private static final String LUCENE_FIELD_MODIFIED = "_modified"; private static final String LUCENE_FIELD_COLUMN_PREFIX = "_"; /** * The prefix for a in-memory path. This prefix is only used internally * within this class and not related to the database URL. */ private static final String IN_MEMORY_PREFIX = "mem:"; /** * Initializes full text search functionality for this database. This adds * the following Java functions to the database: * <ul> * <li>FTL_CREATE_INDEX(schemaNameString, tableNameString, * columnListString)</li> * <li>FTL_SEARCH(queryString, limitInt, offsetInt): result set</li> * <li>FTL_REINDEX()</li> * <li>FTL_DROP_ALL()</li> * </ul> * It also adds a schema FTL to the database where bookkeeping information * is stored. This function may be called from a Java application, or by * using the SQL statements: * * <pre> * CREATE ALIAS IF NOT EXISTS FTL_INIT FOR * &quot;org.h2.fulltext.FullTextLucene.init&quot;; * CALL FTL_INIT(); * </pre> * * @param conn the connection */ public static void init(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".INDEXES(SCHEMA VARCHAR, TABLE VARCHAR, " + "COLUMNS VARCHAR, PRIMARY KEY(SCHEMA, TABLE))"); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_CREATE_INDEX FOR \"" + FullTextLucene.class.getName() + ".createIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_DROP_INDEX FOR \"" + FullTextLucene.class.getName() + ".dropIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH FOR \"" + FullTextLucene.class.getName() + ".search\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH_DATA FOR \"" + FullTextLucene.class.getName() + ".searchData\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_REINDEX FOR \"" + FullTextLucene.class.getName() + ".reindex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_DROP_ALL FOR \"" + FullTextLucene.class.getName() + ".dropAll\""); try { getIndexAccess(conn); } catch (SQLException e) { throw convertException(e); } } /** * Create a new full text index for a table and column list. Each table may * only have one index at any time. * * @param conn the connection * @param schema the schema name of the table (case sensitive) * @param table the table name (case sensitive) * @param columnList the column list (null for all columns) */ public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".INDEXES(SCHEMA, TABLE, COLUMNS) VALUES(?, ?, ?)"); prep.setString(1, schema); prep.setString(2, table); prep.setString(3, columnList); prep.execute(); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); } /** * Drop an existing full text index for a table. This method returns * silently if no index for this table exists. * * @param conn the connection * @param schema the schema name of the table (case sensitive) * @param table the table name (case sensitive) */ public static void dropIndex(Connection conn, String schema, String table) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("DELETE FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schema); prep.setString(2, table); int rowCount = prep.executeUpdate(); if (rowCount == 0) { return; } reindex(conn); } /** * Re-creates the full text index for this database. Calling this method is * usually not needed, as the index is kept up-to-date automatically. * * @param conn the connection */ public static void reindex(Connection conn) throws SQLException { init(conn); removeAllTriggers(conn, TRIGGER_PREFIX); removeIndexFiles(conn); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".INDEXES"); while (rs.next()) { String schema = rs.getString("SCHEMA"); String table = rs.getString("TABLE"); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); } } /** * Drops all full text indexes from the database. * * @param conn the connection */ public static void dropAll(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA); removeAllTriggers(conn, TRIGGER_PREFIX); removeIndexFiles(conn); } /** * Searches from the full text index for this database. * The returned result set has the following column: * <ul><li>QUERY (varchar): the query to use to get the data. * The query does not include 'SELECT * FROM '. Example: * PUBLIC.TEST WHERE ID = 1 * </li><li>SCORE (float) the relevance score as returned by Lucene. * </li></ul> * * @param conn the connection * @param text the search query * @param limit the maximum number of rows or 0 for no limit * @param offset the offset or 0 for no offset * @return the result set */ public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException { return search(conn, text, limit, offset, false); } /** * Searches from the full text index for this database. The result contains * the primary key data as an array. The returned result set has the * following columns: * <ul> * <li>SCHEMA (varchar): the schema name. Example: PUBLIC</li> * <li>TABLE (varchar): the table name. Example: TEST</li> * <li>COLUMNS (array of varchar): comma separated list of quoted column * names. The column names are quoted if necessary. Example: (ID)</li> * <li>KEYS (array of values): comma separated list of values. * Example: (1)</li> * <li>SCORE (float) the relevance score as returned by Lucene.</li> * </ul> * * @param conn the connection * @param text the search query * @param limit the maximum number of rows or 0 for no limit * @param offset the offset or 0 for no offset * @return the result set */ public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException { return search(conn, text, limit, offset, true); } /** * Convert an exception to a fulltext exception. * * @param e the original exception * @return the converted SQL exception */ protected static SQLException convertException(Exception e) { SQLException e2 = new SQLException( "Error while indexing document", "FULLTEXT"); e2.initCause(e); return e2; } /** * Create the trigger. * * @param conn the database connection * @param schema the schema name * @param table the table name */ protected static void createTrigger(Connection conn, String schema, String table) throws SQLException { createOrDropTrigger(conn, schema, table, true); } private static void createOrDropTrigger(Connection conn, String schema, String table, boolean create) throws SQLException { Statement stat = conn.createStatement(); String trigger = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(TRIGGER_PREFIX + table); stat.execute("DROP TRIGGER IF EXISTS " + trigger); if (create) { StringBuilder buff = new StringBuilder( "CREATE TRIGGER IF NOT EXISTS "); // the trigger is also called on rollback because transaction // rollback will not undo the changes in the Lucene index buff.append(trigger). append(" AFTER INSERT, UPDATE, DELETE, ROLLBACK ON "). append(StringUtils.quoteIdentifier(schema)). append('.'). append(StringUtils.quoteIdentifier(table)). append(" FOR EACH ROW CALL \""). append(FullTextLucene.FullTextTrigger.class.getName()). append('\"'); stat.execute(buff.toString()); } } /** * Get the index writer/searcher wrapper for the given connection. * * @param conn the connection * @return the index access wrapper */ protected static IndexAccess getIndexAccess(Connection conn) throws SQLException { String path = getIndexPath(conn); synchronized (INDEX_ACCESS) { IndexAccess access = INDEX_ACCESS.get(path); if (access == null) { try { Directory indexDir = path.startsWith(IN_MEMORY_PREFIX) ? new RAMDirectory() : FSDirectory.open(new File(path)); boolean recreate = !IndexReader.indexExists(indexDir); Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30); IndexWriter writer = new IndexWriter(indexDir, analyzer, recreate, IndexWriter.MaxFieldLength.UNLIMITED); //see http://wiki.apache.org/lucene-java/NearRealtimeSearch IndexReader reader = writer.getReader(); access = new IndexAccess(); access.writer = writer; access.reader = reader; access.searcher = new IndexSearcher(reader); } catch (IOException e) { throw convertException(e); } INDEX_ACCESS.put(path, access); } return access; } } /** * Get the path of the Lucene index for this database. * * @param conn the database connection * @return the path */ protected static String getIndexPath(Connection conn) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("CALL DATABASE_PATH()"); rs.next(); String path = rs.getString(1); if (path == null) { return IN_MEMORY_PREFIX + conn.getCatalog(); } int index = path.lastIndexOf(':'); // position 1 means a windows drive letter is used, ignore that if (index > 1) { path = path.substring(index + 1); } rs.close(); return path; } /** * Add the existing data to the index. * * @param conn the database connection * @param schema the schema name * @param table the table name */ protected static void indexExistingRows(Connection conn, String schema, String table) throws SQLException { FullTextLucene.FullTextTrigger existing = new FullTextLucene.FullTextTrigger(); existing.init(conn, schema, null, table, false, Trigger.INSERT); String sql = "SELECT * FROM " + StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(table); ResultSet rs = conn.createStatement().executeQuery(sql); int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] row = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { row[i] = rs.getObject(i + 1); } existing.insert(row, false); } existing.commitIndex(); } private static void removeIndexFiles(Connection conn) throws SQLException { String path = getIndexPath(conn); IndexAccess access = INDEX_ACCESS.get(path); if (access != null) { removeIndexAccess(access, path); } if (!path.startsWith(IN_MEMORY_PREFIX)) { FileUtils.deleteRecursive(path, false); } } /** * Close the index writer and searcher and remove them from the index access * set. * * @param access the index writer/searcher wrapper * @param indexPath the index path */ protected static void removeIndexAccess(IndexAccess access, String indexPath) throws SQLException { synchronized (INDEX_ACCESS) { try { INDEX_ACCESS.remove(indexPath); access.searcher.close(); access.reader.close(); access.writer.close(); } catch (Exception e) { throw convertException(e); } } } /** * Do the search. * * @param conn the database connection * @param text the query * @param limit the limit * @param offset the offset * @param data whether the raw data should be returned * @return the result set */ protected static ResultSet search(Connection conn, String text, int limit, int offset, boolean data) throws SQLException { SimpleResultSet result = createResultSet(data); if (conn.getMetaData().getURL().startsWith("jdbc:columnlist:")) { // this is just to query the result set columns return result; } if (text == null || text.trim().length() == 0) { return result; } try { IndexAccess access = getIndexAccess(conn); // take a reference as the searcher may change Searcher searcher = access.searcher; // reuse the same analyzer; it's thread-safe; // also allows subclasses to control the analyzer used. Analyzer analyzer = access.writer.getAnalyzer(); QueryParser parser = new QueryParser(Version.LUCENE_30, LUCENE_FIELD_DATA, analyzer); Query query = parser.parse(text); // Lucene 3 insists on a hard limit and will not provide // a total hits value. Take at least 100 which is // an optimal limit for Lucene as any more // will trigger writing results to disk. int maxResults = (limit == 0 ? 100 : limit) + offset; TopDocs docs = searcher.search(query, maxResults); if (limit == 0) { limit = docs.totalHits; } for (int i = 0, len = docs.scoreDocs.length; i < limit && i + offset < docs.totalHits && i + offset < len; i++) { ScoreDoc sd = docs.scoreDocs[i + offset]; Document doc = searcher.doc(sd.doc); float score = sd.score; String q = doc.get(LUCENE_FIELD_QUERY); if (data) { int idx = q.indexOf(" WHERE "); JdbcConnection c = (JdbcConnection) conn; Session session = (Session) c.getSession(); Parser p = new Parser(session); String tab = q.substring(0, idx); ExpressionColumn expr = (ExpressionColumn) p.parseExpression(tab); String schemaName = expr.getOriginalTableAliasName(); String tableName = expr.getColumnName(); q = q.substring(idx + " WHERE ".length()); Object[][] columnData = parseKey(conn, q); result.addRow( schemaName, tableName, columnData[0], columnData[1], score); } else { result.addRow(q, score); } } } catch (Exception e) { throw convertException(e); } return result; } /** * Trigger updates the index when a inserting, updating, or deleting a row. */ public static class FullTextTrigger implements Trigger { protected String schema; protected String table; protected int[] keys; protected int[] indexColumns; protected String[] columns; protected int[] columnTypes; protected String indexPath; protected IndexAccess indexAccess; /** * INTERNAL */ @Override public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException { this.schema = schemaName; this.table = tableName; this.indexPath = getIndexPath(conn); this.indexAccess = getIndexAccess(conn); ArrayList<String> keyList = New.arrayList(); DatabaseMetaData meta = conn.getMetaData(); ResultSet rs = meta.getColumns(null, StringUtils.escapeMetaDataPattern(schemaName), StringUtils.escapeMetaDataPattern(tableName), null); ArrayList<String> columnList = New.arrayList(); while (rs.next()) { columnList.add(rs.getString("COLUMN_NAME")); } columnTypes = new int[columnList.size()]; columns = new String[columnList.size()]; columnList.toArray(columns); rs = meta.getColumns(null, StringUtils.escapeMetaDataPattern(schemaName), StringUtils.escapeMetaDataPattern(tableName), null); for (int i = 0; rs.next(); i++) { columnTypes[i] = rs.getInt("DATA_TYPE"); } if (keyList.size() == 0) { rs = meta.getPrimaryKeys(null, StringUtils.escapeMetaDataPattern(schemaName), tableName); while (rs.next()) { keyList.add(rs.getString("COLUMN_NAME")); } } if (keyList.size() == 0) { throw throwException("No primary key for table " + tableName); } ArrayList<String> indexList = New.arrayList(); PreparedStatement prep = conn.prepareStatement( "SELECT COLUMNS FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schemaName); prep.setString(2, tableName); rs = prep.executeQuery(); if (rs.next()) { String cols = rs.getString(1); if (cols != null) { for (String s : StringUtils.arraySplit(cols, ',', true)) { indexList.add(s); } } } if (indexList.size() == 0) { indexList.addAll(columnList); } keys = new int[keyList.size()]; setColumns(keys, keyList, columnList); indexColumns = new int[indexList.size()]; setColumns(indexColumns, indexList, columnList); } /** * INTERNAL */ @Override public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException { if (oldRow != null) { if (newRow != null) { // update if (hasChanged(oldRow, newRow, indexColumns)) { delete(oldRow, false); insert(newRow, true); } } else { // delete delete(oldRow, true); } } else if (newRow != null) { // insert insert(newRow, true); } } /** * INTERNAL */ @Override public void close() throws SQLException { if (indexAccess != null) { removeIndexAccess(indexAccess, indexPath); indexAccess = null; } } /** * INTERNAL */ @Override public void remove() { // ignore } /** * Commit all changes to the Lucene index. */ void commitIndex() throws SQLException { try { indexAccess.writer.commit(); // recreate Searcher with the IndexWriter's reader. indexAccess.searcher.close(); indexAccess.reader.close(); IndexReader reader = indexAccess.writer.getReader(); indexAccess.reader = reader; indexAccess.searcher = new IndexSearcher(reader); } catch (IOException e) { throw convertException(e); } } /** * Add a row to the index. * * @param row the row * @param commitIndex whether to commit the changes to the Lucene index */ protected void insert(Object[] row, boolean commitIndex) throws SQLException { String query = getQuery(row); Document doc = new Document(); doc.add(new Field(LUCENE_FIELD_QUERY, query, Field.Store.YES, Field.Index.NOT_ANALYZED)); long time = System.currentTimeMillis(); doc.add(new Field(LUCENE_FIELD_MODIFIED, DateTools.timeToString(time, DateTools.Resolution.SECOND), Field.Store.YES, Field.Index.NOT_ANALYZED)); StatementBuilder buff = new StatementBuilder(); for (int index : indexColumns) { String columnName = columns[index]; String data = asString(row[index], columnTypes[index]); // column names that start with _ // must be escaped to avoid conflicts // with internal field names (_DATA, _QUERY, _modified) if (columnName.startsWith(LUCENE_FIELD_COLUMN_PREFIX)) { columnName = LUCENE_FIELD_COLUMN_PREFIX + columnName; } doc.add(new Field(columnName, data, Field.Store.NO, Field.Index.ANALYZED)); buff.appendExceptFirst(" "); buff.append(data); } Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ? Field.Store.YES : Field.Store.NO; doc.add(new Field(LUCENE_FIELD_DATA, buff.toString(), storeText, Field.Index.ANALYZED)); try { indexAccess.writer.addDocument(doc); if (commitIndex) { commitIndex(); } } catch (IOException e) { throw convertException(e); } } /** * Delete a row from the index. * * @param row the row * @param commitIndex whether to commit the changes to the Lucene index */ protected void delete(Object[] row, boolean commitIndex) throws SQLException { String query = getQuery(row); try { Term term = new Term(LUCENE_FIELD_QUERY, query); indexAccess.writer.deleteDocuments(term); if (commitIndex) { commitIndex(); } } catch (IOException e) { throw convertException(e); } } private String getQuery(Object[] row) throws SQLException { StatementBuilder buff = new StatementBuilder(); if (schema != null) { buff.append(StringUtils.quoteIdentifier(schema)).append('.'); } buff.append(StringUtils.quoteIdentifier(table)).append(" WHERE "); for (int columnIndex : keys) { buff.appendExceptFirst(" AND "); buff.append(StringUtils.quoteIdentifier(columns[columnIndex])); Object o = row[columnIndex]; if (o == null) { buff.append(" IS NULL"); } else { buff.append('=').append(FullText.quoteSQL(o, columnTypes[columnIndex])); } } return buff.toString(); } } /** * A wrapper for the Lucene writer and searcher. */ static class IndexAccess { /** * The index writer. */ IndexWriter writer; /** * The index reader. */ IndexReader reader; /** * The index searcher. */ Searcher searcher; } }
[ "ketki512@gmail.com" ]
ketki512@gmail.com
dca197a6cca1b23029cc5454578b65b811bd598a
96f8d42c474f8dd42ecc6811b6e555363f168d3e
/baike/sources/android/support/v4/content/WakefulBroadcastReceiver.java
ae92ccb12b9fd1a9693f314852fe720cf2829282
[]
no_license
aheadlcx/analyzeApk
050b261595cecc85790558a02d79739a789ae3a3
25cecc394dde4ed7d4971baf0e9504dcb7fabaca
refs/heads/master
2020-03-10T10:24:49.773318
2018-04-13T09:44:45
2018-04-13T09:44:45
129,332,351
6
2
null
null
null
null
UTF-8
Java
false
false
1,846
java
package android.support.v4.content; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.util.Log; import android.util.SparseArray; @Deprecated public abstract class WakefulBroadcastReceiver extends BroadcastReceiver { private static final SparseArray<WakeLock> a = new SparseArray(); private static int b = 1; public static ComponentName startWakefulService(Context context, Intent intent) { synchronized (a) { int i = b; b++; if (b <= 0) { b = 1; } intent.putExtra("android.support.content.wakelockid", i); ComponentName startService = context.startService(intent); if (startService == null) { return null; } WakeLock newWakeLock = ((PowerManager) context.getSystemService("power")).newWakeLock(1, "wake:" + startService.flattenToShortString()); newWakeLock.setReferenceCounted(false); newWakeLock.acquire(60000); a.put(i, newWakeLock); return startService; } } public static boolean completeWakefulIntent(Intent intent) { int intExtra = intent.getIntExtra("android.support.content.wakelockid", 0); if (intExtra == 0) { return false; } synchronized (a) { WakeLock wakeLock = (WakeLock) a.get(intExtra); if (wakeLock != null) { wakeLock.release(); a.remove(intExtra); return true; } Log.w("WakefulBroadcastReceiv.", "No active wake lock id #" + intExtra); return true; } } }
[ "aheadlcxzhang@gmail.com" ]
aheadlcxzhang@gmail.com
153bf45c830ff4b5a1fb2df6bdf5751266ebf0f9
7a37f671593075168849e5936fbcaef6c9aa8cc2
/contributions/jxpath/src/main/java/org/softlang/company/features/Cut.java
c12ad7fc980107f8e98dc74a2e50981fd8b49038
[]
no_license
DerDackel/101simplejava
59afce318775f14cd576384f573b47fa90a896c1
0b99227b09fcf9a7c95ee6f0b20b42bbd3935cc4
refs/heads/master
2021-01-18T18:22:32.313684
2014-05-20T13:54:36
2014-05-20T13:54:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
812
java
package org.softlang.company.features; import java.util.LinkedList; import org.apache.commons.jxpath.JXPathContext; import org.softlang.company.model.Company; import org.softlang.company.model.Employee; /** * * @author Matthias Paul * */ public class Cut { /** * Cut using JXPath to modify salaries. Method demonstrate JXPath ability to * alter values. * * @param c * Company to cut salaries */ public static void cut(Company c) { JXPathContext con = JXPathContext.newContext(c); LinkedList<Employee> es = new LinkedList<Employee>(); es.addAll(con.selectNodes("//employees | //manager")); con = JXPathContext.newContext(es); for (int i = 1; i <= es.size(); i++) { con.setValue("@salary[" + i + "]", (Double) con.getValue("@salary[" + i + "]") / 2); } } }
[ "mpaul@uni-koblenz.de" ]
mpaul@uni-koblenz.de
a42b4c15d6a76b77e49627258f119bf6bca0c55a
4723eb5cb5ddc0b9d5a12a9ae050a23b832e4a43
/app/src/main/java/com/nearman/focusin/TodoDatabaseAccessProvider.java
543d1e42baa2c962d28bcd418a122eeed5b34acb
[]
no_license
cnearman/focus-in
2fa3a2e1046a2343fea61500c6e559331a2ec214
b8e12c424f0fbe2e0d94624446df95cd8b87c2f3
refs/heads/master
2021-01-20T00:51:57.115882
2017-04-24T06:23:19
2017-04-24T06:23:19
89,204,721
0
0
null
null
null
null
UTF-8
Java
false
false
2,958
java
package com.nearman.focusin; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; /** * Created by Chris on 4/9/2017. */ public class TodoDatabaseAccessProvider implements TodoAccessHandler { DatabaseAccessInitializer mDbHelper; public TodoDatabaseAccessProvider(Context context) { mDbHelper= new DatabaseAccessInitializer(context); } public long createTodo(TodoModel todo){ SQLiteDatabase db = mDbHelper.getWritableDatabase(); ContentValues inputModel = mapTodoToDatabaseValues(todo); long result = db.insert(DatabaseContract.Todo.TABLE_NAME, null, inputModel); return result; } public void updateTodo(TodoModel todo) { SQLiteDatabase db = mDbHelper.getReadableDatabase(); ContentValues values = mapTodoToDatabaseValues(todo); String selection = DatabaseContract.Todo._ID + "= ?"; String idString = Integer.toString(todo.getId()); String[] selectionArgs = {idString}; db.update(DatabaseContract.Todo.TABLE_NAME, values, selection, selectionArgs); } public void deleteTodo(TodoModel todo) { SQLiteDatabase db = mDbHelper.getWritableDatabase(); String selection = DatabaseContract.Todo._ID + "= ?"; String idString = Integer.toString(todo.getId()); String[] selectionArgs = {idString}; db.delete(DatabaseContract.Todo.TABLE_NAME, selection, selectionArgs); } public TodoModel retrieveTodo(int todoId) throws Exception{ SQLiteDatabase db = mDbHelper.getWritableDatabase(); String[] columns = { DatabaseContract.Todo._ID, DatabaseContract.Todo.COLUMN_NAME_DESCRIPTION }; String selection = DatabaseContract.Todo._ID + "= ?"; String idString = Integer.toString(todoId); String[] selectionArgs = {idString}; Cursor cursor = db.query ( DatabaseContract.Todo.TABLE_NAME, columns, selection, selectionArgs, null, null, null ); if(cursor.getCount() > 1){ throw new Exception(); } cursor.moveToFirst(); TodoModel result = mapTodoFromCursor(cursor); return result; } private ContentValues mapTodoToDatabaseValues(TodoModel todo){ ContentValues values = new ContentValues(); values.put(DatabaseContract.Todo.COLUMN_NAME_DESCRIPTION, todo.getDescription()); return values; } private TodoModel mapTodoFromCursor(Cursor c){ TodoModel result = new TodoModel(); result.setId(c.getColumnIndexOrThrow(DatabaseContract.Todo._ID)); result.setDescription(c.getString(c.getColumnIndexOrThrow(DatabaseContract.Todo.COLUMN_NAME_DESCRIPTION))); return result; } }
[ "nearman.cj@gmail.com" ]
nearman.cj@gmail.com
5ee0b614f5b8b8a2c0eeaa0f50aa1d1018d5847e
b77bf23ba60db5794445b8204317ed8b7388a2fd
/gg/sulfur/client/impl/utils/networking/PacketSleepThread.java
fbc5844a9c28763899bd0e44ffdc13c791848c5e
[]
no_license
SulfurClient/Sulfur
f41abb5335ae9617a629ced0cde4703ef7cc5f2c
e54efe14bb52d09752f9a38d7282f0d1cd81e469
refs/heads/main
2022-07-29T03:18:53.078298
2022-02-02T15:09:34
2022-02-02T15:09:34
426,418,356
2
0
null
null
null
null
UTF-8
Java
false
false
716
java
package gg.sulfur.client.impl.utils.networking; import net.minecraft.client.Minecraft; import net.minecraft.network.Packet; public class PacketSleepThread extends Thread { public PacketSleepThread(Packet packet, long delay) { super(() -> { sleep_ms(delay); if (Minecraft.getMinecraft().thePlayer != null) PacketUtil.sendPacketNoEvent(packet); }); } static void sleep_ms(long delay) { try { sleep(delay); } catch (InterruptedException e) { e.printStackTrace(); } } public static void delayPacket(Packet packet, long delay) { new PacketSleepThread(packet, delay).start(); } }
[ "45654930+Kansioo@users.noreply.github.com" ]
45654930+Kansioo@users.noreply.github.com
72581ad38ff150654528c3d82cd333d1f5f1cd95
e5c11eaa5b9842ac42ba25829d56dcb5635e017c
/src/com/code/pattern/chain/Director.java
31ca67a816f282a4d9c9f57d6aacc1b44bcb507c
[]
no_license
zhulongxi2015/PatternDesign
8147d567bf01b42fc7ce2a17a3a3d5f9a87ca793
14e2aa38932b70690d50ee5ce5ceb8c8eba449c6
refs/heads/master
2020-04-27T00:03:23.600533
2019-03-12T02:59:04
2019-03-12T02:59:04
173,922,599
0
0
null
null
null
null
UTF-8
Java
false
false
600
java
package com.code.pattern.chain; /** * 主任 */ public class Director extends Leader { public Director(String name){ super(name); } @Override public void handlerRequest(LeaveRequest leaveRequest) { if(leaveRequest.getLeaveDays()<3){ System.out.println("员工 "+leaveRequest.getEmpName()+" 请假 "+leaveRequest.getLeaveDays()+" 天"); System.out.println("主任 "+this.name+" 审批通过"); }else{ if(this.nextLeader!=null){ this.nextLeader.handlerRequest(leaveRequest); } } } }
[ "zhulongxi@autohome.com.cn" ]
zhulongxi@autohome.com.cn
6d09a58539de70faf5f7311787c13b0e7964cc3d
dde804bed2655d40ce4cf4fb65701e652415b7d1
/ebaysdkcore/src/main/java/com/ebay/soap/eBLBaseComponents/CategoryFeatureType.java
b39bab6c752babe917c0a73c578796e7d71ebb30
[]
no_license
mamthal/getItemJava
ceccf4a8bab67bab5e9e8a37d60af095f847de44
d7a1bcc8c7a1f72728973c799973e86c435a6047
refs/heads/master
2016-09-05T23:39:46.495096
2014-04-21T18:19:21
2014-04-21T18:19:21
19,001,704
0
1
null
null
null
null
UTF-8
Java
false
false
111,265
java
package com.ebay.soap.eBLBaseComponents; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import org.w3c.dom.Element; /** * * Type defining the <b>Category</b> container that is returned in the <b>GetCategoryFeatures</b> response. A <b>Category</b> node is returned for each category that is relevant/applicable to the input criteria in the <b>GetCategoryFeatures</b> request. The <b>CategoryID</b> value identifies the eBay category. The rest of the <b>CategoryFeatureType</b> fields that are returned will be dependent on which <b>FeatureID</b> value(s) are specified in the <b>GetCategoryFeatures</b> request. * * * <p>Java class for CategoryFeatureType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="CategoryFeatureType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="CategoryID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="ListingDuration" type="{urn:ebay:apis:eBLBaseComponents}ListingDurationReferenceType" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="ShippingTermsRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="BestOfferEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="DutchBINEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="UserConsentRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="HomePageFeaturedEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ProPackEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="BasicUpgradePackEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ValuePackEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ProPackPlusEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="AdFormatEnabled" type="{urn:ebay:apis:eBLBaseComponents}AdFormatEnabledCodeType" minOccurs="0"/> * &lt;element name="BestOfferCounterEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="BestOfferAutoDeclineEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketSpecialitySubscription" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketRegularSubscription" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketPremiumSubscription" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketNonSubscription" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ExpressEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ExpressPicturesRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ExpressConditionRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="MinimumReservePrice" type="{http://www.w3.org/2001/XMLSchema}double" minOccurs="0"/> * &lt;element name="SellerContactDetailsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="TransactionConfirmationRequestEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="StoreInventoryEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="SkypeMeTransactionalEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="SkypeMeNonTransactionalEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdPaymentMethodEnabled" type="{urn:ebay:apis:eBLBaseComponents}ClassifiedAdPaymentMethodEnabledCodeType" minOccurs="0"/> * &lt;element name="ClassifiedAdShippingMethodEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdBestOfferEnabled" type="{urn:ebay:apis:eBLBaseComponents}ClassifiedAdBestOfferEnabledCodeType" minOccurs="0"/> * &lt;element name="ClassifiedAdCounterOfferEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdAutoDeclineEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdContactByPhoneEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdContactByEmailEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="SafePaymentRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdPayPerLeadEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ItemSpecificsEnabled" type="{urn:ebay:apis:eBLBaseComponents}ItemSpecificsEnabledCodeType" minOccurs="0"/> * &lt;element name="PaisaPayFullEscrowEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="UPCIdentifierEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="EANIdentifierEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ISBNIdentifierEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="BrandMPNIdentifierEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdAutoAcceptEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="BestOfferAutoAcceptEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="CrossBorderTradeNorthAmericaEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="CrossBorderTradeGBEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="CrossBorderTradeAustraliaEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="PayPalBuyerProtectionEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="BuyerGuaranteeEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="CombinedFixedPriceTreatmentEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="GalleryFeaturedDurations" type="{urn:ebay:apis:eBLBaseComponents}ListingEnhancementDurationReferenceType" minOccurs="0"/> * &lt;element name="PayPalRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProAdFormatEnabled" type="{urn:ebay:apis:eBLBaseComponents}AdFormatEnabledCodeType" minOccurs="0"/> * &lt;element name="eBayMotorsProContactByPhoneEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProPhoneCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="eBayMotorsProContactByAddressEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProStreetCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="eBayMotorsProCompanyNameEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProContactByEmailEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProBestOfferEnabled" type="{urn:ebay:apis:eBLBaseComponents}ClassifiedAdBestOfferEnabledCodeType" minOccurs="0"/> * &lt;element name="eBayMotorsProAutoAcceptEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProAutoDeclineEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProPaymentMethodCheckOutEnabled" type="{urn:ebay:apis:eBLBaseComponents}ClassifiedAdPaymentMethodEnabledCodeType" minOccurs="0"/> * &lt;element name="eBayMotorsProShippingMethodEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProCounterOfferEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="eBayMotorsProSellerContactDetailsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketAdFormatEnabled" type="{urn:ebay:apis:eBLBaseComponents}AdFormatEnabledCodeType" minOccurs="0"/> * &lt;element name="LocalMarketContactByPhoneEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketPhoneCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="LocalMarketContactByAddressEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketStreetCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="LocalMarketCompanyNameEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketContactByEmailEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketBestOfferEnabled" type="{urn:ebay:apis:eBLBaseComponents}ClassifiedAdBestOfferEnabledCodeType" minOccurs="0"/> * &lt;element name="LocalMarketAutoAcceptEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketAutoDeclineEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketPaymentMethodCheckOutEnabled" type="{urn:ebay:apis:eBLBaseComponents}ClassifiedAdPaymentMethodEnabledCodeType" minOccurs="0"/> * &lt;element name="LocalMarketShippingMethodEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketCounterOfferEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="LocalMarketSellerContactDetailsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdPhoneCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="ClassifiedAdContactByAddressEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ClassifiedAdStreetCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="ClassifiedAdCompanyNameEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="SpecialitySubscription" type="{urn:ebay:apis:eBLBaseComponents}GeographicExposureCodeType" minOccurs="0"/> * &lt;element name="RegularSubscription" type="{urn:ebay:apis:eBLBaseComponents}GeographicExposureCodeType" minOccurs="0"/> * &lt;element name="PremiumSubscription" type="{urn:ebay:apis:eBLBaseComponents}GeographicExposureCodeType" minOccurs="0"/> * &lt;element name="NonSubscription" type="{urn:ebay:apis:eBLBaseComponents}GeographicExposureCodeType" minOccurs="0"/> * &lt;element name="INEscrowWorkflowTimeline" type="{urn:ebay:apis:eBLBaseComponents}INEscrowWorkflowTimelineCodeType" minOccurs="0"/> * &lt;element name="PayPalRequiredForStoreOwner" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ReviseQuantityAllowed" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="RevisePriceAllowed" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="StoreOwnerExtendedListingDurationsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="StoreOwnerExtendedListingDurations" type="{urn:ebay:apis:eBLBaseComponents}StoreOwnerExtendedListingDurationsType" minOccurs="0"/> * &lt;element name="ReturnPolicyEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="HandlingTimeEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="MaxFlatShippingCost" type="{urn:ebay:apis:eBLBaseComponents}AmountType" minOccurs="0"/> * &lt;element name="Group1MaxFlatShippingCost" type="{urn:ebay:apis:eBLBaseComponents}AmountType" minOccurs="0"/> * &lt;element name="Group2MaxFlatShippingCost" type="{urn:ebay:apis:eBLBaseComponents}AmountType" minOccurs="0"/> * &lt;element name="Group3MaxFlatShippingCost" type="{urn:ebay:apis:eBLBaseComponents}AmountType" minOccurs="0"/> * &lt;element name="PaymentMethod" type="{urn:ebay:apis:eBLBaseComponents}BuyerPaymentMethodCodeType" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="VariationsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="AttributeConversionEnabled" type="{urn:ebay:apis:eBLBaseComponents}AttributeConversionEnabledCodeType" minOccurs="0"/> * &lt;element name="FreeGalleryPlusEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="FreePicturePackEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ItemCompatibilityEnabled" type="{urn:ebay:apis:eBLBaseComponents}ItemCompatibilityEnabledCodeType" minOccurs="0"/> * &lt;element name="MinItemCompatibility" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="MaxItemCompatibility" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="ConditionEnabled" type="{urn:ebay:apis:eBLBaseComponents}ConditionEnabledCodeType" minOccurs="0"/> * &lt;element name="ConditionValues" type="{urn:ebay:apis:eBLBaseComponents}ConditionValuesType" minOccurs="0"/> * &lt;element name="ValueCategory" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="ProductCreationEnabled" type="{urn:ebay:apis:eBLBaseComponents}ProductCreationEnabledCodeType" minOccurs="0"/> * &lt;element name="MaxGranularFitmentCount" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="CompatibleVehicleType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="PaymentOptionsGroup" type="{urn:ebay:apis:eBLBaseComponents}PaymentOptionsGroupEnabledCodeType" minOccurs="0"/> * &lt;element name="ShippingProfileCategoryGroup" type="{urn:ebay:apis:eBLBaseComponents}ProfileCategoryGroupCodeType" minOccurs="0"/> * &lt;element name="PaymentProfileCategoryGroup" type="{urn:ebay:apis:eBLBaseComponents}ProfileCategoryGroupCodeType" minOccurs="0"/> * &lt;element name="ReturnPolicyProfileCategoryGroup" type="{urn:ebay:apis:eBLBaseComponents}ProfileCategoryGroupCodeType" minOccurs="0"/> * &lt;element name="VINSupported" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="VRMSupported" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="SellerProvidedTitleSupported" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="DepositSupported" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="GlobalShippingEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;element name="AdditionalCompatibilityEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * &lt;any/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CategoryFeatureType", propOrder = { "categoryID", "listingDuration", "shippingTermsRequired", "bestOfferEnabled", "dutchBINEnabled", "userConsentRequired", "homePageFeaturedEnabled", "proPackEnabled", "basicUpgradePackEnabled", "valuePackEnabled", "proPackPlusEnabled", "adFormatEnabled", "bestOfferCounterEnabled", "bestOfferAutoDeclineEnabled", "localMarketSpecialitySubscription", "localMarketRegularSubscription", "localMarketPremiumSubscription", "localMarketNonSubscription", "expressEnabled", "expressPicturesRequired", "expressConditionRequired", "minimumReservePrice", "sellerContactDetailsEnabled", "transactionConfirmationRequestEnabled", "storeInventoryEnabled", "skypeMeTransactionalEnabled", "skypeMeNonTransactionalEnabled", "classifiedAdPaymentMethodEnabled", "classifiedAdShippingMethodEnabled", "classifiedAdBestOfferEnabled", "classifiedAdCounterOfferEnabled", "classifiedAdAutoDeclineEnabled", "classifiedAdContactByPhoneEnabled", "classifiedAdContactByEmailEnabled", "safePaymentRequired", "classifiedAdPayPerLeadEnabled", "itemSpecificsEnabled", "paisaPayFullEscrowEnabled", "upcIdentifierEnabled", "eanIdentifierEnabled", "isbnIdentifierEnabled", "brandMPNIdentifierEnabled", "classifiedAdAutoAcceptEnabled", "bestOfferAutoAcceptEnabled", "crossBorderTradeNorthAmericaEnabled", "crossBorderTradeGBEnabled", "crossBorderTradeAustraliaEnabled", "payPalBuyerProtectionEnabled", "buyerGuaranteeEnabled", "combinedFixedPriceTreatmentEnabled", "galleryFeaturedDurations", "payPalRequired", "eBayMotorsProAdFormatEnabled", "eBayMotorsProContactByPhoneEnabled", "eBayMotorsProPhoneCount", "eBayMotorsProContactByAddressEnabled", "eBayMotorsProStreetCount", "eBayMotorsProCompanyNameEnabled", "eBayMotorsProContactByEmailEnabled", "eBayMotorsProBestOfferEnabled", "eBayMotorsProAutoAcceptEnabled", "eBayMotorsProAutoDeclineEnabled", "eBayMotorsProPaymentMethodCheckOutEnabled", "eBayMotorsProShippingMethodEnabled", "eBayMotorsProCounterOfferEnabled", "eBayMotorsProSellerContactDetailsEnabled", "localMarketAdFormatEnabled", "localMarketContactByPhoneEnabled", "localMarketPhoneCount", "localMarketContactByAddressEnabled", "localMarketStreetCount", "localMarketCompanyNameEnabled", "localMarketContactByEmailEnabled", "localMarketBestOfferEnabled", "localMarketAutoAcceptEnabled", "localMarketAutoDeclineEnabled", "localMarketPaymentMethodCheckOutEnabled", "localMarketShippingMethodEnabled", "localMarketCounterOfferEnabled", "localMarketSellerContactDetailsEnabled", "classifiedAdPhoneCount", "classifiedAdContactByAddressEnabled", "classifiedAdStreetCount", "classifiedAdCompanyNameEnabled", "specialitySubscription", "regularSubscription", "premiumSubscription", "nonSubscription", "inEscrowWorkflowTimeline", "payPalRequiredForStoreOwner", "reviseQuantityAllowed", "revisePriceAllowed", "storeOwnerExtendedListingDurationsEnabled", "storeOwnerExtendedListingDurations", "returnPolicyEnabled", "handlingTimeEnabled", "maxFlatShippingCost", "group1MaxFlatShippingCost", "group2MaxFlatShippingCost", "group3MaxFlatShippingCost", "paymentMethod", "variationsEnabled", "attributeConversionEnabled", "freeGalleryPlusEnabled", "freePicturePackEnabled", "itemCompatibilityEnabled", "minItemCompatibility", "maxItemCompatibility", "conditionEnabled", "conditionValues", "valueCategory", "productCreationEnabled", "maxGranularFitmentCount", "compatibleVehicleType", "paymentOptionsGroup", "shippingProfileCategoryGroup", "paymentProfileCategoryGroup", "returnPolicyProfileCategoryGroup", "vinSupported", "vrmSupported", "sellerProvidedTitleSupported", "depositSupported", "globalShippingEnabled", "additionalCompatibilityEnabled", "any" }) public class CategoryFeatureType implements Serializable { private final static long serialVersionUID = 12343L; @XmlElement(name = "CategoryID") protected String categoryID; @XmlElement(name = "ListingDuration") protected List<ListingDurationReferenceType> listingDuration; @XmlElement(name = "ShippingTermsRequired") protected Boolean shippingTermsRequired; @XmlElement(name = "BestOfferEnabled") protected Boolean bestOfferEnabled; @XmlElement(name = "DutchBINEnabled") protected Boolean dutchBINEnabled; @XmlElement(name = "UserConsentRequired") protected Boolean userConsentRequired; @XmlElement(name = "HomePageFeaturedEnabled") protected Boolean homePageFeaturedEnabled; @XmlElement(name = "ProPackEnabled") protected Boolean proPackEnabled; @XmlElement(name = "BasicUpgradePackEnabled") protected Boolean basicUpgradePackEnabled; @XmlElement(name = "ValuePackEnabled") protected Boolean valuePackEnabled; @XmlElement(name = "ProPackPlusEnabled") protected Boolean proPackPlusEnabled; @XmlElement(name = "AdFormatEnabled") protected AdFormatEnabledCodeType adFormatEnabled; @XmlElement(name = "BestOfferCounterEnabled") protected Boolean bestOfferCounterEnabled; @XmlElement(name = "BestOfferAutoDeclineEnabled") protected Boolean bestOfferAutoDeclineEnabled; @XmlElement(name = "LocalMarketSpecialitySubscription") protected Boolean localMarketSpecialitySubscription; @XmlElement(name = "LocalMarketRegularSubscription") protected Boolean localMarketRegularSubscription; @XmlElement(name = "LocalMarketPremiumSubscription") protected Boolean localMarketPremiumSubscription; @XmlElement(name = "LocalMarketNonSubscription") protected Boolean localMarketNonSubscription; @XmlElement(name = "ExpressEnabled") protected Boolean expressEnabled; @XmlElement(name = "ExpressPicturesRequired") protected Boolean expressPicturesRequired; @XmlElement(name = "ExpressConditionRequired") protected Boolean expressConditionRequired; @XmlElement(name = "MinimumReservePrice") protected Double minimumReservePrice; @XmlElement(name = "SellerContactDetailsEnabled") protected Boolean sellerContactDetailsEnabled; @XmlElement(name = "TransactionConfirmationRequestEnabled") protected Boolean transactionConfirmationRequestEnabled; @XmlElement(name = "StoreInventoryEnabled") protected Boolean storeInventoryEnabled; @XmlElement(name = "SkypeMeTransactionalEnabled") protected Boolean skypeMeTransactionalEnabled; @XmlElement(name = "SkypeMeNonTransactionalEnabled") protected Boolean skypeMeNonTransactionalEnabled; @XmlElement(name = "ClassifiedAdPaymentMethodEnabled") protected ClassifiedAdPaymentMethodEnabledCodeType classifiedAdPaymentMethodEnabled; @XmlElement(name = "ClassifiedAdShippingMethodEnabled") protected Boolean classifiedAdShippingMethodEnabled; @XmlElement(name = "ClassifiedAdBestOfferEnabled") protected ClassifiedAdBestOfferEnabledCodeType classifiedAdBestOfferEnabled; @XmlElement(name = "ClassifiedAdCounterOfferEnabled") protected Boolean classifiedAdCounterOfferEnabled; @XmlElement(name = "ClassifiedAdAutoDeclineEnabled") protected Boolean classifiedAdAutoDeclineEnabled; @XmlElement(name = "ClassifiedAdContactByPhoneEnabled") protected Boolean classifiedAdContactByPhoneEnabled; @XmlElement(name = "ClassifiedAdContactByEmailEnabled") protected Boolean classifiedAdContactByEmailEnabled; @XmlElement(name = "SafePaymentRequired") protected Boolean safePaymentRequired; @XmlElement(name = "ClassifiedAdPayPerLeadEnabled") protected Boolean classifiedAdPayPerLeadEnabled; @XmlElement(name = "ItemSpecificsEnabled") protected ItemSpecificsEnabledCodeType itemSpecificsEnabled; @XmlElement(name = "PaisaPayFullEscrowEnabled") protected Boolean paisaPayFullEscrowEnabled; @XmlElement(name = "UPCIdentifierEnabled") protected Boolean upcIdentifierEnabled; @XmlElement(name = "EANIdentifierEnabled") protected Boolean eanIdentifierEnabled; @XmlElement(name = "ISBNIdentifierEnabled") protected Boolean isbnIdentifierEnabled; @XmlElement(name = "BrandMPNIdentifierEnabled") protected Boolean brandMPNIdentifierEnabled; @XmlElement(name = "ClassifiedAdAutoAcceptEnabled") protected Boolean classifiedAdAutoAcceptEnabled; @XmlElement(name = "BestOfferAutoAcceptEnabled") protected Boolean bestOfferAutoAcceptEnabled; @XmlElement(name = "CrossBorderTradeNorthAmericaEnabled") protected Boolean crossBorderTradeNorthAmericaEnabled; @XmlElement(name = "CrossBorderTradeGBEnabled") protected Boolean crossBorderTradeGBEnabled; @XmlElement(name = "CrossBorderTradeAustraliaEnabled") protected Boolean crossBorderTradeAustraliaEnabled; @XmlElement(name = "PayPalBuyerProtectionEnabled") protected Boolean payPalBuyerProtectionEnabled; @XmlElement(name = "BuyerGuaranteeEnabled") protected Boolean buyerGuaranteeEnabled; @XmlElement(name = "CombinedFixedPriceTreatmentEnabled") protected Boolean combinedFixedPriceTreatmentEnabled; @XmlElement(name = "GalleryFeaturedDurations") protected ListingEnhancementDurationReferenceType galleryFeaturedDurations; @XmlElement(name = "PayPalRequired") protected Boolean payPalRequired; protected AdFormatEnabledCodeType eBayMotorsProAdFormatEnabled; protected Boolean eBayMotorsProContactByPhoneEnabled; protected Integer eBayMotorsProPhoneCount; protected Boolean eBayMotorsProContactByAddressEnabled; protected Integer eBayMotorsProStreetCount; protected Boolean eBayMotorsProCompanyNameEnabled; protected Boolean eBayMotorsProContactByEmailEnabled; protected ClassifiedAdBestOfferEnabledCodeType eBayMotorsProBestOfferEnabled; protected Boolean eBayMotorsProAutoAcceptEnabled; protected Boolean eBayMotorsProAutoDeclineEnabled; protected ClassifiedAdPaymentMethodEnabledCodeType eBayMotorsProPaymentMethodCheckOutEnabled; protected Boolean eBayMotorsProShippingMethodEnabled; protected Boolean eBayMotorsProCounterOfferEnabled; protected Boolean eBayMotorsProSellerContactDetailsEnabled; @XmlElement(name = "LocalMarketAdFormatEnabled") protected AdFormatEnabledCodeType localMarketAdFormatEnabled; @XmlElement(name = "LocalMarketContactByPhoneEnabled") protected Boolean localMarketContactByPhoneEnabled; @XmlElement(name = "LocalMarketPhoneCount") protected Integer localMarketPhoneCount; @XmlElement(name = "LocalMarketContactByAddressEnabled") protected Boolean localMarketContactByAddressEnabled; @XmlElement(name = "LocalMarketStreetCount") protected Integer localMarketStreetCount; @XmlElement(name = "LocalMarketCompanyNameEnabled") protected Boolean localMarketCompanyNameEnabled; @XmlElement(name = "LocalMarketContactByEmailEnabled") protected Boolean localMarketContactByEmailEnabled; @XmlElement(name = "LocalMarketBestOfferEnabled") protected ClassifiedAdBestOfferEnabledCodeType localMarketBestOfferEnabled; @XmlElement(name = "LocalMarketAutoAcceptEnabled") protected Boolean localMarketAutoAcceptEnabled; @XmlElement(name = "LocalMarketAutoDeclineEnabled") protected Boolean localMarketAutoDeclineEnabled; @XmlElement(name = "LocalMarketPaymentMethodCheckOutEnabled") protected ClassifiedAdPaymentMethodEnabledCodeType localMarketPaymentMethodCheckOutEnabled; @XmlElement(name = "LocalMarketShippingMethodEnabled") protected Boolean localMarketShippingMethodEnabled; @XmlElement(name = "LocalMarketCounterOfferEnabled") protected Boolean localMarketCounterOfferEnabled; @XmlElement(name = "LocalMarketSellerContactDetailsEnabled") protected Boolean localMarketSellerContactDetailsEnabled; @XmlElement(name = "ClassifiedAdPhoneCount") protected Integer classifiedAdPhoneCount; @XmlElement(name = "ClassifiedAdContactByAddressEnabled") protected Boolean classifiedAdContactByAddressEnabled; @XmlElement(name = "ClassifiedAdStreetCount") protected Integer classifiedAdStreetCount; @XmlElement(name = "ClassifiedAdCompanyNameEnabled") protected Boolean classifiedAdCompanyNameEnabled; @XmlElement(name = "SpecialitySubscription") protected GeographicExposureCodeType specialitySubscription; @XmlElement(name = "RegularSubscription") protected GeographicExposureCodeType regularSubscription; @XmlElement(name = "PremiumSubscription") protected GeographicExposureCodeType premiumSubscription; @XmlElement(name = "NonSubscription") protected GeographicExposureCodeType nonSubscription; @XmlElement(name = "INEscrowWorkflowTimeline") protected INEscrowWorkflowTimelineCodeType inEscrowWorkflowTimeline; @XmlElement(name = "PayPalRequiredForStoreOwner") protected Boolean payPalRequiredForStoreOwner; @XmlElement(name = "ReviseQuantityAllowed") protected Boolean reviseQuantityAllowed; @XmlElement(name = "RevisePriceAllowed") protected Boolean revisePriceAllowed; @XmlElement(name = "StoreOwnerExtendedListingDurationsEnabled") protected Boolean storeOwnerExtendedListingDurationsEnabled; @XmlElement(name = "StoreOwnerExtendedListingDurations") protected StoreOwnerExtendedListingDurationsType storeOwnerExtendedListingDurations; @XmlElement(name = "ReturnPolicyEnabled") protected Boolean returnPolicyEnabled; @XmlElement(name = "HandlingTimeEnabled") protected Boolean handlingTimeEnabled; @XmlElement(name = "MaxFlatShippingCost") protected AmountType maxFlatShippingCost; @XmlElement(name = "Group1MaxFlatShippingCost") protected AmountType group1MaxFlatShippingCost; @XmlElement(name = "Group2MaxFlatShippingCost") protected AmountType group2MaxFlatShippingCost; @XmlElement(name = "Group3MaxFlatShippingCost") protected AmountType group3MaxFlatShippingCost; @XmlElement(name = "PaymentMethod") protected List<BuyerPaymentMethodCodeType> paymentMethod; @XmlElement(name = "VariationsEnabled") protected Boolean variationsEnabled; @XmlElement(name = "AttributeConversionEnabled") protected AttributeConversionEnabledCodeType attributeConversionEnabled; @XmlElement(name = "FreeGalleryPlusEnabled") protected Boolean freeGalleryPlusEnabled; @XmlElement(name = "FreePicturePackEnabled") protected Boolean freePicturePackEnabled; @XmlElement(name = "ItemCompatibilityEnabled") protected ItemCompatibilityEnabledCodeType itemCompatibilityEnabled; @XmlElement(name = "MinItemCompatibility") protected Integer minItemCompatibility; @XmlElement(name = "MaxItemCompatibility") protected Integer maxItemCompatibility; @XmlElement(name = "ConditionEnabled") protected ConditionEnabledCodeType conditionEnabled; @XmlElement(name = "ConditionValues") protected ConditionValuesType conditionValues; @XmlElement(name = "ValueCategory") protected Boolean valueCategory; @XmlElement(name = "ProductCreationEnabled") protected ProductCreationEnabledCodeType productCreationEnabled; @XmlElement(name = "MaxGranularFitmentCount") protected Integer maxGranularFitmentCount; @XmlElement(name = "CompatibleVehicleType") protected String compatibleVehicleType; @XmlElement(name = "PaymentOptionsGroup") protected PaymentOptionsGroupEnabledCodeType paymentOptionsGroup; @XmlElement(name = "ShippingProfileCategoryGroup") protected ProfileCategoryGroupCodeType shippingProfileCategoryGroup; @XmlElement(name = "PaymentProfileCategoryGroup") protected ProfileCategoryGroupCodeType paymentProfileCategoryGroup; @XmlElement(name = "ReturnPolicyProfileCategoryGroup") protected ProfileCategoryGroupCodeType returnPolicyProfileCategoryGroup; @XmlElement(name = "VINSupported") protected Boolean vinSupported; @XmlElement(name = "VRMSupported") protected Boolean vrmSupported; @XmlElement(name = "SellerProvidedTitleSupported") protected Boolean sellerProvidedTitleSupported; @XmlElement(name = "DepositSupported") protected Boolean depositSupported; @XmlElement(name = "GlobalShippingEnabled") protected Boolean globalShippingEnabled; @XmlElement(name = "AdditionalCompatibilityEnabled") protected Boolean additionalCompatibilityEnabled; @XmlAnyElement(lax = true) protected List<Object> any; /** * Gets the value of the categoryID property. * * @return * possible object is * {@link String } * */ public String getCategoryID() { return categoryID; } /** * Sets the value of the categoryID property. * * @param value * allowed object is * {@link String } * */ public void setCategoryID(String value) { this.categoryID = value; } /** * * * @return * array of * {@link ListingDurationReferenceType } * */ public ListingDurationReferenceType[] getListingDuration() { if (this.listingDuration == null) { return new ListingDurationReferenceType[ 0 ] ; } return ((ListingDurationReferenceType[]) this.listingDuration.toArray(new ListingDurationReferenceType[this.listingDuration.size()] )); } /** * * * @return * one of * {@link ListingDurationReferenceType } * */ public ListingDurationReferenceType getListingDuration(int idx) { if (this.listingDuration == null) { throw new IndexOutOfBoundsException(); } return this.listingDuration.get(idx); } public int getListingDurationLength() { if (this.listingDuration == null) { return 0; } return this.listingDuration.size(); } /** * * * @param values * allowed objects are * {@link ListingDurationReferenceType } * */ public void setListingDuration(ListingDurationReferenceType[] values) { this._getListingDuration().clear(); int len = values.length; for (int i = 0; (i<len); i ++) { this.listingDuration.add(values[i]); } } protected List<ListingDurationReferenceType> _getListingDuration() { if (listingDuration == null) { listingDuration = new ArrayList<ListingDurationReferenceType>(); } return listingDuration; } /** * * * @param value * allowed object is * {@link ListingDurationReferenceType } * */ public ListingDurationReferenceType setListingDuration(int idx, ListingDurationReferenceType value) { return this.listingDuration.set(idx, value); } /** * Gets the value of the shippingTermsRequired property. * * @return * possible object is * {@link Boolean } * */ public Boolean isShippingTermsRequired() { return shippingTermsRequired; } /** * Sets the value of the shippingTermsRequired property. * * @param value * allowed object is * {@link Boolean } * */ public void setShippingTermsRequired(Boolean value) { this.shippingTermsRequired = value; } /** * Gets the value of the bestOfferEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isBestOfferEnabled() { return bestOfferEnabled; } /** * Sets the value of the bestOfferEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setBestOfferEnabled(Boolean value) { this.bestOfferEnabled = value; } /** * Gets the value of the dutchBINEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isDutchBINEnabled() { return dutchBINEnabled; } /** * Sets the value of the dutchBINEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setDutchBINEnabled(Boolean value) { this.dutchBINEnabled = value; } /** * Gets the value of the userConsentRequired property. * * @return * possible object is * {@link Boolean } * */ public Boolean isUserConsentRequired() { return userConsentRequired; } /** * Sets the value of the userConsentRequired property. * * @param value * allowed object is * {@link Boolean } * */ public void setUserConsentRequired(Boolean value) { this.userConsentRequired = value; } /** * Gets the value of the homePageFeaturedEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isHomePageFeaturedEnabled() { return homePageFeaturedEnabled; } /** * Sets the value of the homePageFeaturedEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setHomePageFeaturedEnabled(Boolean value) { this.homePageFeaturedEnabled = value; } /** * Gets the value of the proPackEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isProPackEnabled() { return proPackEnabled; } /** * Sets the value of the proPackEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setProPackEnabled(Boolean value) { this.proPackEnabled = value; } /** * Gets the value of the basicUpgradePackEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isBasicUpgradePackEnabled() { return basicUpgradePackEnabled; } /** * Sets the value of the basicUpgradePackEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setBasicUpgradePackEnabled(Boolean value) { this.basicUpgradePackEnabled = value; } /** * Gets the value of the valuePackEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isValuePackEnabled() { return valuePackEnabled; } /** * Sets the value of the valuePackEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setValuePackEnabled(Boolean value) { this.valuePackEnabled = value; } /** * Gets the value of the proPackPlusEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isProPackPlusEnabled() { return proPackPlusEnabled; } /** * Sets the value of the proPackPlusEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setProPackPlusEnabled(Boolean value) { this.proPackPlusEnabled = value; } /** * Gets the value of the adFormatEnabled property. * * @return * possible object is * {@link AdFormatEnabledCodeType } * */ public AdFormatEnabledCodeType getAdFormatEnabled() { return adFormatEnabled; } /** * Sets the value of the adFormatEnabled property. * * @param value * allowed object is * {@link AdFormatEnabledCodeType } * */ public void setAdFormatEnabled(AdFormatEnabledCodeType value) { this.adFormatEnabled = value; } /** * Gets the value of the bestOfferCounterEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isBestOfferCounterEnabled() { return bestOfferCounterEnabled; } /** * Sets the value of the bestOfferCounterEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setBestOfferCounterEnabled(Boolean value) { this.bestOfferCounterEnabled = value; } /** * Gets the value of the bestOfferAutoDeclineEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isBestOfferAutoDeclineEnabled() { return bestOfferAutoDeclineEnabled; } /** * Sets the value of the bestOfferAutoDeclineEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setBestOfferAutoDeclineEnabled(Boolean value) { this.bestOfferAutoDeclineEnabled = value; } /** * Gets the value of the localMarketSpecialitySubscription property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketSpecialitySubscription() { return localMarketSpecialitySubscription; } /** * Sets the value of the localMarketSpecialitySubscription property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketSpecialitySubscription(Boolean value) { this.localMarketSpecialitySubscription = value; } /** * Gets the value of the localMarketRegularSubscription property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketRegularSubscription() { return localMarketRegularSubscription; } /** * Sets the value of the localMarketRegularSubscription property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketRegularSubscription(Boolean value) { this.localMarketRegularSubscription = value; } /** * Gets the value of the localMarketPremiumSubscription property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketPremiumSubscription() { return localMarketPremiumSubscription; } /** * Sets the value of the localMarketPremiumSubscription property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketPremiumSubscription(Boolean value) { this.localMarketPremiumSubscription = value; } /** * Gets the value of the localMarketNonSubscription property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketNonSubscription() { return localMarketNonSubscription; } /** * Sets the value of the localMarketNonSubscription property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketNonSubscription(Boolean value) { this.localMarketNonSubscription = value; } /** * Gets the value of the expressEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isExpressEnabled() { return expressEnabled; } /** * Sets the value of the expressEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setExpressEnabled(Boolean value) { this.expressEnabled = value; } /** * Gets the value of the expressPicturesRequired property. * * @return * possible object is * {@link Boolean } * */ public Boolean isExpressPicturesRequired() { return expressPicturesRequired; } /** * Sets the value of the expressPicturesRequired property. * * @param value * allowed object is * {@link Boolean } * */ public void setExpressPicturesRequired(Boolean value) { this.expressPicturesRequired = value; } /** * Gets the value of the expressConditionRequired property. * * @return * possible object is * {@link Boolean } * */ public Boolean isExpressConditionRequired() { return expressConditionRequired; } /** * Sets the value of the expressConditionRequired property. * * @param value * allowed object is * {@link Boolean } * */ public void setExpressConditionRequired(Boolean value) { this.expressConditionRequired = value; } /** * Gets the value of the minimumReservePrice property. * * @return * possible object is * {@link Double } * */ public Double getMinimumReservePrice() { return minimumReservePrice; } /** * Sets the value of the minimumReservePrice property. * * @param value * allowed object is * {@link Double } * */ public void setMinimumReservePrice(Double value) { this.minimumReservePrice = value; } /** * Gets the value of the sellerContactDetailsEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isSellerContactDetailsEnabled() { return sellerContactDetailsEnabled; } /** * Sets the value of the sellerContactDetailsEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setSellerContactDetailsEnabled(Boolean value) { this.sellerContactDetailsEnabled = value; } /** * Gets the value of the transactionConfirmationRequestEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isTransactionConfirmationRequestEnabled() { return transactionConfirmationRequestEnabled; } /** * Sets the value of the transactionConfirmationRequestEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setTransactionConfirmationRequestEnabled(Boolean value) { this.transactionConfirmationRequestEnabled = value; } /** * Gets the value of the storeInventoryEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isStoreInventoryEnabled() { return storeInventoryEnabled; } /** * Sets the value of the storeInventoryEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setStoreInventoryEnabled(Boolean value) { this.storeInventoryEnabled = value; } /** * Gets the value of the skypeMeTransactionalEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isSkypeMeTransactionalEnabled() { return skypeMeTransactionalEnabled; } /** * Sets the value of the skypeMeTransactionalEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setSkypeMeTransactionalEnabled(Boolean value) { this.skypeMeTransactionalEnabled = value; } /** * Gets the value of the skypeMeNonTransactionalEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isSkypeMeNonTransactionalEnabled() { return skypeMeNonTransactionalEnabled; } /** * Sets the value of the skypeMeNonTransactionalEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setSkypeMeNonTransactionalEnabled(Boolean value) { this.skypeMeNonTransactionalEnabled = value; } /** * Gets the value of the classifiedAdPaymentMethodEnabled property. * * @return * possible object is * {@link ClassifiedAdPaymentMethodEnabledCodeType } * */ public ClassifiedAdPaymentMethodEnabledCodeType getClassifiedAdPaymentMethodEnabled() { return classifiedAdPaymentMethodEnabled; } /** * Sets the value of the classifiedAdPaymentMethodEnabled property. * * @param value * allowed object is * {@link ClassifiedAdPaymentMethodEnabledCodeType } * */ public void setClassifiedAdPaymentMethodEnabled(ClassifiedAdPaymentMethodEnabledCodeType value) { this.classifiedAdPaymentMethodEnabled = value; } /** * Gets the value of the classifiedAdShippingMethodEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdShippingMethodEnabled() { return classifiedAdShippingMethodEnabled; } /** * Sets the value of the classifiedAdShippingMethodEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdShippingMethodEnabled(Boolean value) { this.classifiedAdShippingMethodEnabled = value; } /** * Gets the value of the classifiedAdBestOfferEnabled property. * * @return * possible object is * {@link ClassifiedAdBestOfferEnabledCodeType } * */ public ClassifiedAdBestOfferEnabledCodeType getClassifiedAdBestOfferEnabled() { return classifiedAdBestOfferEnabled; } /** * Sets the value of the classifiedAdBestOfferEnabled property. * * @param value * allowed object is * {@link ClassifiedAdBestOfferEnabledCodeType } * */ public void setClassifiedAdBestOfferEnabled(ClassifiedAdBestOfferEnabledCodeType value) { this.classifiedAdBestOfferEnabled = value; } /** * Gets the value of the classifiedAdCounterOfferEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdCounterOfferEnabled() { return classifiedAdCounterOfferEnabled; } /** * Sets the value of the classifiedAdCounterOfferEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdCounterOfferEnabled(Boolean value) { this.classifiedAdCounterOfferEnabled = value; } /** * Gets the value of the classifiedAdAutoDeclineEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdAutoDeclineEnabled() { return classifiedAdAutoDeclineEnabled; } /** * Sets the value of the classifiedAdAutoDeclineEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdAutoDeclineEnabled(Boolean value) { this.classifiedAdAutoDeclineEnabled = value; } /** * Gets the value of the classifiedAdContactByPhoneEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdContactByPhoneEnabled() { return classifiedAdContactByPhoneEnabled; } /** * Sets the value of the classifiedAdContactByPhoneEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdContactByPhoneEnabled(Boolean value) { this.classifiedAdContactByPhoneEnabled = value; } /** * Gets the value of the classifiedAdContactByEmailEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdContactByEmailEnabled() { return classifiedAdContactByEmailEnabled; } /** * Sets the value of the classifiedAdContactByEmailEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdContactByEmailEnabled(Boolean value) { this.classifiedAdContactByEmailEnabled = value; } /** * Gets the value of the safePaymentRequired property. * * @return * possible object is * {@link Boolean } * */ public Boolean isSafePaymentRequired() { return safePaymentRequired; } /** * Sets the value of the safePaymentRequired property. * * @param value * allowed object is * {@link Boolean } * */ public void setSafePaymentRequired(Boolean value) { this.safePaymentRequired = value; } /** * Gets the value of the classifiedAdPayPerLeadEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdPayPerLeadEnabled() { return classifiedAdPayPerLeadEnabled; } /** * Sets the value of the classifiedAdPayPerLeadEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdPayPerLeadEnabled(Boolean value) { this.classifiedAdPayPerLeadEnabled = value; } /** * Gets the value of the itemSpecificsEnabled property. * * @return * possible object is * {@link ItemSpecificsEnabledCodeType } * */ public ItemSpecificsEnabledCodeType getItemSpecificsEnabled() { return itemSpecificsEnabled; } /** * Sets the value of the itemSpecificsEnabled property. * * @param value * allowed object is * {@link ItemSpecificsEnabledCodeType } * */ public void setItemSpecificsEnabled(ItemSpecificsEnabledCodeType value) { this.itemSpecificsEnabled = value; } /** * Gets the value of the paisaPayFullEscrowEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isPaisaPayFullEscrowEnabled() { return paisaPayFullEscrowEnabled; } /** * Sets the value of the paisaPayFullEscrowEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setPaisaPayFullEscrowEnabled(Boolean value) { this.paisaPayFullEscrowEnabled = value; } /** * Gets the value of the upcIdentifierEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isUPCIdentifierEnabled() { return upcIdentifierEnabled; } /** * Sets the value of the upcIdentifierEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setUPCIdentifierEnabled(Boolean value) { this.upcIdentifierEnabled = value; } /** * Gets the value of the eanIdentifierEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEANIdentifierEnabled() { return eanIdentifierEnabled; } /** * Sets the value of the eanIdentifierEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEANIdentifierEnabled(Boolean value) { this.eanIdentifierEnabled = value; } /** * Gets the value of the isbnIdentifierEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isISBNIdentifierEnabled() { return isbnIdentifierEnabled; } /** * Sets the value of the isbnIdentifierEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setISBNIdentifierEnabled(Boolean value) { this.isbnIdentifierEnabled = value; } /** * Gets the value of the brandMPNIdentifierEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isBrandMPNIdentifierEnabled() { return brandMPNIdentifierEnabled; } /** * Sets the value of the brandMPNIdentifierEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setBrandMPNIdentifierEnabled(Boolean value) { this.brandMPNIdentifierEnabled = value; } /** * Gets the value of the classifiedAdAutoAcceptEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdAutoAcceptEnabled() { return classifiedAdAutoAcceptEnabled; } /** * Sets the value of the classifiedAdAutoAcceptEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdAutoAcceptEnabled(Boolean value) { this.classifiedAdAutoAcceptEnabled = value; } /** * Gets the value of the bestOfferAutoAcceptEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isBestOfferAutoAcceptEnabled() { return bestOfferAutoAcceptEnabled; } /** * Sets the value of the bestOfferAutoAcceptEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setBestOfferAutoAcceptEnabled(Boolean value) { this.bestOfferAutoAcceptEnabled = value; } /** * Gets the value of the crossBorderTradeNorthAmericaEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isCrossBorderTradeNorthAmericaEnabled() { return crossBorderTradeNorthAmericaEnabled; } /** * Sets the value of the crossBorderTradeNorthAmericaEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setCrossBorderTradeNorthAmericaEnabled(Boolean value) { this.crossBorderTradeNorthAmericaEnabled = value; } /** * Gets the value of the crossBorderTradeGBEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isCrossBorderTradeGBEnabled() { return crossBorderTradeGBEnabled; } /** * Sets the value of the crossBorderTradeGBEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setCrossBorderTradeGBEnabled(Boolean value) { this.crossBorderTradeGBEnabled = value; } /** * Gets the value of the crossBorderTradeAustraliaEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isCrossBorderTradeAustraliaEnabled() { return crossBorderTradeAustraliaEnabled; } /** * Sets the value of the crossBorderTradeAustraliaEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setCrossBorderTradeAustraliaEnabled(Boolean value) { this.crossBorderTradeAustraliaEnabled = value; } /** * Gets the value of the payPalBuyerProtectionEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isPayPalBuyerProtectionEnabled() { return payPalBuyerProtectionEnabled; } /** * Sets the value of the payPalBuyerProtectionEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setPayPalBuyerProtectionEnabled(Boolean value) { this.payPalBuyerProtectionEnabled = value; } /** * Gets the value of the buyerGuaranteeEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isBuyerGuaranteeEnabled() { return buyerGuaranteeEnabled; } /** * Sets the value of the buyerGuaranteeEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setBuyerGuaranteeEnabled(Boolean value) { this.buyerGuaranteeEnabled = value; } /** * Gets the value of the combinedFixedPriceTreatmentEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isCombinedFixedPriceTreatmentEnabled() { return combinedFixedPriceTreatmentEnabled; } /** * Sets the value of the combinedFixedPriceTreatmentEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setCombinedFixedPriceTreatmentEnabled(Boolean value) { this.combinedFixedPriceTreatmentEnabled = value; } /** * Gets the value of the galleryFeaturedDurations property. * * @return * possible object is * {@link ListingEnhancementDurationReferenceType } * */ public ListingEnhancementDurationReferenceType getGalleryFeaturedDurations() { return galleryFeaturedDurations; } /** * Sets the value of the galleryFeaturedDurations property. * * @param value * allowed object is * {@link ListingEnhancementDurationReferenceType } * */ public void setGalleryFeaturedDurations(ListingEnhancementDurationReferenceType value) { this.galleryFeaturedDurations = value; } /** * Gets the value of the payPalRequired property. * * @return * possible object is * {@link Boolean } * */ public Boolean isPayPalRequired() { return payPalRequired; } /** * Sets the value of the payPalRequired property. * * @param value * allowed object is * {@link Boolean } * */ public void setPayPalRequired(Boolean value) { this.payPalRequired = value; } /** * Gets the value of the eBayMotorsProAdFormatEnabled property. * * @return * possible object is * {@link AdFormatEnabledCodeType } * */ public AdFormatEnabledCodeType getEBayMotorsProAdFormatEnabled() { return eBayMotorsProAdFormatEnabled; } /** * Sets the value of the eBayMotorsProAdFormatEnabled property. * * @param value * allowed object is * {@link AdFormatEnabledCodeType } * */ public void setEBayMotorsProAdFormatEnabled(AdFormatEnabledCodeType value) { this.eBayMotorsProAdFormatEnabled = value; } /** * Gets the value of the eBayMotorsProContactByPhoneEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProContactByPhoneEnabled() { return eBayMotorsProContactByPhoneEnabled; } /** * Sets the value of the eBayMotorsProContactByPhoneEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProContactByPhoneEnabled(Boolean value) { this.eBayMotorsProContactByPhoneEnabled = value; } /** * Gets the value of the eBayMotorsProPhoneCount property. * * @return * possible object is * {@link Integer } * */ public Integer getEBayMotorsProPhoneCount() { return eBayMotorsProPhoneCount; } /** * Sets the value of the eBayMotorsProPhoneCount property. * * @param value * allowed object is * {@link Integer } * */ public void setEBayMotorsProPhoneCount(Integer value) { this.eBayMotorsProPhoneCount = value; } /** * Gets the value of the eBayMotorsProContactByAddressEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProContactByAddressEnabled() { return eBayMotorsProContactByAddressEnabled; } /** * Sets the value of the eBayMotorsProContactByAddressEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProContactByAddressEnabled(Boolean value) { this.eBayMotorsProContactByAddressEnabled = value; } /** * Gets the value of the eBayMotorsProStreetCount property. * * @return * possible object is * {@link Integer } * */ public Integer getEBayMotorsProStreetCount() { return eBayMotorsProStreetCount; } /** * Sets the value of the eBayMotorsProStreetCount property. * * @param value * allowed object is * {@link Integer } * */ public void setEBayMotorsProStreetCount(Integer value) { this.eBayMotorsProStreetCount = value; } /** * Gets the value of the eBayMotorsProCompanyNameEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProCompanyNameEnabled() { return eBayMotorsProCompanyNameEnabled; } /** * Sets the value of the eBayMotorsProCompanyNameEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProCompanyNameEnabled(Boolean value) { this.eBayMotorsProCompanyNameEnabled = value; } /** * Gets the value of the eBayMotorsProContactByEmailEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProContactByEmailEnabled() { return eBayMotorsProContactByEmailEnabled; } /** * Sets the value of the eBayMotorsProContactByEmailEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProContactByEmailEnabled(Boolean value) { this.eBayMotorsProContactByEmailEnabled = value; } /** * Gets the value of the eBayMotorsProBestOfferEnabled property. * * @return * possible object is * {@link ClassifiedAdBestOfferEnabledCodeType } * */ public ClassifiedAdBestOfferEnabledCodeType getEBayMotorsProBestOfferEnabled() { return eBayMotorsProBestOfferEnabled; } /** * Sets the value of the eBayMotorsProBestOfferEnabled property. * * @param value * allowed object is * {@link ClassifiedAdBestOfferEnabledCodeType } * */ public void setEBayMotorsProBestOfferEnabled(ClassifiedAdBestOfferEnabledCodeType value) { this.eBayMotorsProBestOfferEnabled = value; } /** * Gets the value of the eBayMotorsProAutoAcceptEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProAutoAcceptEnabled() { return eBayMotorsProAutoAcceptEnabled; } /** * Sets the value of the eBayMotorsProAutoAcceptEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProAutoAcceptEnabled(Boolean value) { this.eBayMotorsProAutoAcceptEnabled = value; } /** * Gets the value of the eBayMotorsProAutoDeclineEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProAutoDeclineEnabled() { return eBayMotorsProAutoDeclineEnabled; } /** * Sets the value of the eBayMotorsProAutoDeclineEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProAutoDeclineEnabled(Boolean value) { this.eBayMotorsProAutoDeclineEnabled = value; } /** * Gets the value of the eBayMotorsProPaymentMethodCheckOutEnabled property. * * @return * possible object is * {@link ClassifiedAdPaymentMethodEnabledCodeType } * */ public ClassifiedAdPaymentMethodEnabledCodeType getEBayMotorsProPaymentMethodCheckOutEnabled() { return eBayMotorsProPaymentMethodCheckOutEnabled; } /** * Sets the value of the eBayMotorsProPaymentMethodCheckOutEnabled property. * * @param value * allowed object is * {@link ClassifiedAdPaymentMethodEnabledCodeType } * */ public void setEBayMotorsProPaymentMethodCheckOutEnabled(ClassifiedAdPaymentMethodEnabledCodeType value) { this.eBayMotorsProPaymentMethodCheckOutEnabled = value; } /** * Gets the value of the eBayMotorsProShippingMethodEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProShippingMethodEnabled() { return eBayMotorsProShippingMethodEnabled; } /** * Sets the value of the eBayMotorsProShippingMethodEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProShippingMethodEnabled(Boolean value) { this.eBayMotorsProShippingMethodEnabled = value; } /** * Gets the value of the eBayMotorsProCounterOfferEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProCounterOfferEnabled() { return eBayMotorsProCounterOfferEnabled; } /** * Sets the value of the eBayMotorsProCounterOfferEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProCounterOfferEnabled(Boolean value) { this.eBayMotorsProCounterOfferEnabled = value; } /** * Gets the value of the eBayMotorsProSellerContactDetailsEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isEBayMotorsProSellerContactDetailsEnabled() { return eBayMotorsProSellerContactDetailsEnabled; } /** * Sets the value of the eBayMotorsProSellerContactDetailsEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setEBayMotorsProSellerContactDetailsEnabled(Boolean value) { this.eBayMotorsProSellerContactDetailsEnabled = value; } /** * Gets the value of the localMarketAdFormatEnabled property. * * @return * possible object is * {@link AdFormatEnabledCodeType } * */ public AdFormatEnabledCodeType getLocalMarketAdFormatEnabled() { return localMarketAdFormatEnabled; } /** * Sets the value of the localMarketAdFormatEnabled property. * * @param value * allowed object is * {@link AdFormatEnabledCodeType } * */ public void setLocalMarketAdFormatEnabled(AdFormatEnabledCodeType value) { this.localMarketAdFormatEnabled = value; } /** * Gets the value of the localMarketContactByPhoneEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketContactByPhoneEnabled() { return localMarketContactByPhoneEnabled; } /** * Sets the value of the localMarketContactByPhoneEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketContactByPhoneEnabled(Boolean value) { this.localMarketContactByPhoneEnabled = value; } /** * Gets the value of the localMarketPhoneCount property. * * @return * possible object is * {@link Integer } * */ public Integer getLocalMarketPhoneCount() { return localMarketPhoneCount; } /** * Sets the value of the localMarketPhoneCount property. * * @param value * allowed object is * {@link Integer } * */ public void setLocalMarketPhoneCount(Integer value) { this.localMarketPhoneCount = value; } /** * Gets the value of the localMarketContactByAddressEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketContactByAddressEnabled() { return localMarketContactByAddressEnabled; } /** * Sets the value of the localMarketContactByAddressEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketContactByAddressEnabled(Boolean value) { this.localMarketContactByAddressEnabled = value; } /** * Gets the value of the localMarketStreetCount property. * * @return * possible object is * {@link Integer } * */ public Integer getLocalMarketStreetCount() { return localMarketStreetCount; } /** * Sets the value of the localMarketStreetCount property. * * @param value * allowed object is * {@link Integer } * */ public void setLocalMarketStreetCount(Integer value) { this.localMarketStreetCount = value; } /** * Gets the value of the localMarketCompanyNameEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketCompanyNameEnabled() { return localMarketCompanyNameEnabled; } /** * Sets the value of the localMarketCompanyNameEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketCompanyNameEnabled(Boolean value) { this.localMarketCompanyNameEnabled = value; } /** * Gets the value of the localMarketContactByEmailEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketContactByEmailEnabled() { return localMarketContactByEmailEnabled; } /** * Sets the value of the localMarketContactByEmailEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketContactByEmailEnabled(Boolean value) { this.localMarketContactByEmailEnabled = value; } /** * Gets the value of the localMarketBestOfferEnabled property. * * @return * possible object is * {@link ClassifiedAdBestOfferEnabledCodeType } * */ public ClassifiedAdBestOfferEnabledCodeType getLocalMarketBestOfferEnabled() { return localMarketBestOfferEnabled; } /** * Sets the value of the localMarketBestOfferEnabled property. * * @param value * allowed object is * {@link ClassifiedAdBestOfferEnabledCodeType } * */ public void setLocalMarketBestOfferEnabled(ClassifiedAdBestOfferEnabledCodeType value) { this.localMarketBestOfferEnabled = value; } /** * Gets the value of the localMarketAutoAcceptEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketAutoAcceptEnabled() { return localMarketAutoAcceptEnabled; } /** * Sets the value of the localMarketAutoAcceptEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketAutoAcceptEnabled(Boolean value) { this.localMarketAutoAcceptEnabled = value; } /** * Gets the value of the localMarketAutoDeclineEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketAutoDeclineEnabled() { return localMarketAutoDeclineEnabled; } /** * Sets the value of the localMarketAutoDeclineEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketAutoDeclineEnabled(Boolean value) { this.localMarketAutoDeclineEnabled = value; } /** * Gets the value of the localMarketPaymentMethodCheckOutEnabled property. * * @return * possible object is * {@link ClassifiedAdPaymentMethodEnabledCodeType } * */ public ClassifiedAdPaymentMethodEnabledCodeType getLocalMarketPaymentMethodCheckOutEnabled() { return localMarketPaymentMethodCheckOutEnabled; } /** * Sets the value of the localMarketPaymentMethodCheckOutEnabled property. * * @param value * allowed object is * {@link ClassifiedAdPaymentMethodEnabledCodeType } * */ public void setLocalMarketPaymentMethodCheckOutEnabled(ClassifiedAdPaymentMethodEnabledCodeType value) { this.localMarketPaymentMethodCheckOutEnabled = value; } /** * Gets the value of the localMarketShippingMethodEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketShippingMethodEnabled() { return localMarketShippingMethodEnabled; } /** * Sets the value of the localMarketShippingMethodEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketShippingMethodEnabled(Boolean value) { this.localMarketShippingMethodEnabled = value; } /** * Gets the value of the localMarketCounterOfferEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketCounterOfferEnabled() { return localMarketCounterOfferEnabled; } /** * Sets the value of the localMarketCounterOfferEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketCounterOfferEnabled(Boolean value) { this.localMarketCounterOfferEnabled = value; } /** * Gets the value of the localMarketSellerContactDetailsEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isLocalMarketSellerContactDetailsEnabled() { return localMarketSellerContactDetailsEnabled; } /** * Sets the value of the localMarketSellerContactDetailsEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setLocalMarketSellerContactDetailsEnabled(Boolean value) { this.localMarketSellerContactDetailsEnabled = value; } /** * Gets the value of the classifiedAdPhoneCount property. * * @return * possible object is * {@link Integer } * */ public Integer getClassifiedAdPhoneCount() { return classifiedAdPhoneCount; } /** * Sets the value of the classifiedAdPhoneCount property. * * @param value * allowed object is * {@link Integer } * */ public void setClassifiedAdPhoneCount(Integer value) { this.classifiedAdPhoneCount = value; } /** * Gets the value of the classifiedAdContactByAddressEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdContactByAddressEnabled() { return classifiedAdContactByAddressEnabled; } /** * Sets the value of the classifiedAdContactByAddressEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdContactByAddressEnabled(Boolean value) { this.classifiedAdContactByAddressEnabled = value; } /** * Gets the value of the classifiedAdStreetCount property. * * @return * possible object is * {@link Integer } * */ public Integer getClassifiedAdStreetCount() { return classifiedAdStreetCount; } /** * Sets the value of the classifiedAdStreetCount property. * * @param value * allowed object is * {@link Integer } * */ public void setClassifiedAdStreetCount(Integer value) { this.classifiedAdStreetCount = value; } /** * Gets the value of the classifiedAdCompanyNameEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isClassifiedAdCompanyNameEnabled() { return classifiedAdCompanyNameEnabled; } /** * Sets the value of the classifiedAdCompanyNameEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setClassifiedAdCompanyNameEnabled(Boolean value) { this.classifiedAdCompanyNameEnabled = value; } /** * Gets the value of the specialitySubscription property. * * @return * possible object is * {@link GeographicExposureCodeType } * */ public GeographicExposureCodeType getSpecialitySubscription() { return specialitySubscription; } /** * Sets the value of the specialitySubscription property. * * @param value * allowed object is * {@link GeographicExposureCodeType } * */ public void setSpecialitySubscription(GeographicExposureCodeType value) { this.specialitySubscription = value; } /** * Gets the value of the regularSubscription property. * * @return * possible object is * {@link GeographicExposureCodeType } * */ public GeographicExposureCodeType getRegularSubscription() { return regularSubscription; } /** * Sets the value of the regularSubscription property. * * @param value * allowed object is * {@link GeographicExposureCodeType } * */ public void setRegularSubscription(GeographicExposureCodeType value) { this.regularSubscription = value; } /** * Gets the value of the premiumSubscription property. * * @return * possible object is * {@link GeographicExposureCodeType } * */ public GeographicExposureCodeType getPremiumSubscription() { return premiumSubscription; } /** * Sets the value of the premiumSubscription property. * * @param value * allowed object is * {@link GeographicExposureCodeType } * */ public void setPremiumSubscription(GeographicExposureCodeType value) { this.premiumSubscription = value; } /** * Gets the value of the nonSubscription property. * * @return * possible object is * {@link GeographicExposureCodeType } * */ public GeographicExposureCodeType getNonSubscription() { return nonSubscription; } /** * Sets the value of the nonSubscription property. * * @param value * allowed object is * {@link GeographicExposureCodeType } * */ public void setNonSubscription(GeographicExposureCodeType value) { this.nonSubscription = value; } /** * Gets the value of the inEscrowWorkflowTimeline property. * * @return * possible object is * {@link INEscrowWorkflowTimelineCodeType } * */ public INEscrowWorkflowTimelineCodeType getINEscrowWorkflowTimeline() { return inEscrowWorkflowTimeline; } /** * Sets the value of the inEscrowWorkflowTimeline property. * * @param value * allowed object is * {@link INEscrowWorkflowTimelineCodeType } * */ public void setINEscrowWorkflowTimeline(INEscrowWorkflowTimelineCodeType value) { this.inEscrowWorkflowTimeline = value; } /** * Gets the value of the payPalRequiredForStoreOwner property. * * @return * possible object is * {@link Boolean } * */ public Boolean isPayPalRequiredForStoreOwner() { return payPalRequiredForStoreOwner; } /** * Sets the value of the payPalRequiredForStoreOwner property. * * @param value * allowed object is * {@link Boolean } * */ public void setPayPalRequiredForStoreOwner(Boolean value) { this.payPalRequiredForStoreOwner = value; } /** * Gets the value of the reviseQuantityAllowed property. * * @return * possible object is * {@link Boolean } * */ public Boolean isReviseQuantityAllowed() { return reviseQuantityAllowed; } /** * Sets the value of the reviseQuantityAllowed property. * * @param value * allowed object is * {@link Boolean } * */ public void setReviseQuantityAllowed(Boolean value) { this.reviseQuantityAllowed = value; } /** * Gets the value of the revisePriceAllowed property. * * @return * possible object is * {@link Boolean } * */ public Boolean isRevisePriceAllowed() { return revisePriceAllowed; } /** * Sets the value of the revisePriceAllowed property. * * @param value * allowed object is * {@link Boolean } * */ public void setRevisePriceAllowed(Boolean value) { this.revisePriceAllowed = value; } /** * Gets the value of the storeOwnerExtendedListingDurationsEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isStoreOwnerExtendedListingDurationsEnabled() { return storeOwnerExtendedListingDurationsEnabled; } /** * Sets the value of the storeOwnerExtendedListingDurationsEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setStoreOwnerExtendedListingDurationsEnabled(Boolean value) { this.storeOwnerExtendedListingDurationsEnabled = value; } /** * Gets the value of the storeOwnerExtendedListingDurations property. * * @return * possible object is * {@link StoreOwnerExtendedListingDurationsType } * */ public StoreOwnerExtendedListingDurationsType getStoreOwnerExtendedListingDurations() { return storeOwnerExtendedListingDurations; } /** * Sets the value of the storeOwnerExtendedListingDurations property. * * @param value * allowed object is * {@link StoreOwnerExtendedListingDurationsType } * */ public void setStoreOwnerExtendedListingDurations(StoreOwnerExtendedListingDurationsType value) { this.storeOwnerExtendedListingDurations = value; } /** * Gets the value of the returnPolicyEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isReturnPolicyEnabled() { return returnPolicyEnabled; } /** * Sets the value of the returnPolicyEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setReturnPolicyEnabled(Boolean value) { this.returnPolicyEnabled = value; } /** * Gets the value of the handlingTimeEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isHandlingTimeEnabled() { return handlingTimeEnabled; } /** * Sets the value of the handlingTimeEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setHandlingTimeEnabled(Boolean value) { this.handlingTimeEnabled = value; } /** * Gets the value of the maxFlatShippingCost property. * * @return * possible object is * {@link AmountType } * */ public AmountType getMaxFlatShippingCost() { return maxFlatShippingCost; } /** * Sets the value of the maxFlatShippingCost property. * * @param value * allowed object is * {@link AmountType } * */ public void setMaxFlatShippingCost(AmountType value) { this.maxFlatShippingCost = value; } /** * Gets the value of the group1MaxFlatShippingCost property. * * @return * possible object is * {@link AmountType } * */ public AmountType getGroup1MaxFlatShippingCost() { return group1MaxFlatShippingCost; } /** * Sets the value of the group1MaxFlatShippingCost property. * * @param value * allowed object is * {@link AmountType } * */ public void setGroup1MaxFlatShippingCost(AmountType value) { this.group1MaxFlatShippingCost = value; } /** * Gets the value of the group2MaxFlatShippingCost property. * * @return * possible object is * {@link AmountType } * */ public AmountType getGroup2MaxFlatShippingCost() { return group2MaxFlatShippingCost; } /** * Sets the value of the group2MaxFlatShippingCost property. * * @param value * allowed object is * {@link AmountType } * */ public void setGroup2MaxFlatShippingCost(AmountType value) { this.group2MaxFlatShippingCost = value; } /** * Gets the value of the group3MaxFlatShippingCost property. * * @return * possible object is * {@link AmountType } * */ public AmountType getGroup3MaxFlatShippingCost() { return group3MaxFlatShippingCost; } /** * Sets the value of the group3MaxFlatShippingCost property. * * @param value * allowed object is * {@link AmountType } * */ public void setGroup3MaxFlatShippingCost(AmountType value) { this.group3MaxFlatShippingCost = value; } /** * * * @return * array of * {@link BuyerPaymentMethodCodeType } * */ public BuyerPaymentMethodCodeType[] getPaymentMethod() { if (this.paymentMethod == null) { return new BuyerPaymentMethodCodeType[ 0 ] ; } return ((BuyerPaymentMethodCodeType[]) this.paymentMethod.toArray(new BuyerPaymentMethodCodeType[this.paymentMethod.size()] )); } /** * * * @return * one of * {@link BuyerPaymentMethodCodeType } * */ public BuyerPaymentMethodCodeType getPaymentMethod(int idx) { if (this.paymentMethod == null) { throw new IndexOutOfBoundsException(); } return this.paymentMethod.get(idx); } public int getPaymentMethodLength() { if (this.paymentMethod == null) { return 0; } return this.paymentMethod.size(); } /** * * * @param values * allowed objects are * {@link BuyerPaymentMethodCodeType } * */ public void setPaymentMethod(BuyerPaymentMethodCodeType[] values) { this._getPaymentMethod().clear(); int len = values.length; for (int i = 0; (i<len); i ++) { this.paymentMethod.add(values[i]); } } protected List<BuyerPaymentMethodCodeType> _getPaymentMethod() { if (paymentMethod == null) { paymentMethod = new ArrayList<BuyerPaymentMethodCodeType>(); } return paymentMethod; } /** * * * @param value * allowed object is * {@link BuyerPaymentMethodCodeType } * */ public BuyerPaymentMethodCodeType setPaymentMethod(int idx, BuyerPaymentMethodCodeType value) { return this.paymentMethod.set(idx, value); } /** * Gets the value of the variationsEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isVariationsEnabled() { return variationsEnabled; } /** * Sets the value of the variationsEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setVariationsEnabled(Boolean value) { this.variationsEnabled = value; } /** * Gets the value of the attributeConversionEnabled property. * * @return * possible object is * {@link AttributeConversionEnabledCodeType } * */ public AttributeConversionEnabledCodeType getAttributeConversionEnabled() { return attributeConversionEnabled; } /** * Sets the value of the attributeConversionEnabled property. * * @param value * allowed object is * {@link AttributeConversionEnabledCodeType } * */ public void setAttributeConversionEnabled(AttributeConversionEnabledCodeType value) { this.attributeConversionEnabled = value; } /** * Gets the value of the freeGalleryPlusEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isFreeGalleryPlusEnabled() { return freeGalleryPlusEnabled; } /** * Sets the value of the freeGalleryPlusEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setFreeGalleryPlusEnabled(Boolean value) { this.freeGalleryPlusEnabled = value; } /** * Gets the value of the freePicturePackEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isFreePicturePackEnabled() { return freePicturePackEnabled; } /** * Sets the value of the freePicturePackEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setFreePicturePackEnabled(Boolean value) { this.freePicturePackEnabled = value; } /** * Gets the value of the itemCompatibilityEnabled property. * * @return * possible object is * {@link ItemCompatibilityEnabledCodeType } * */ public ItemCompatibilityEnabledCodeType getItemCompatibilityEnabled() { return itemCompatibilityEnabled; } /** * Sets the value of the itemCompatibilityEnabled property. * * @param value * allowed object is * {@link ItemCompatibilityEnabledCodeType } * */ public void setItemCompatibilityEnabled(ItemCompatibilityEnabledCodeType value) { this.itemCompatibilityEnabled = value; } /** * Gets the value of the minItemCompatibility property. * * @return * possible object is * {@link Integer } * */ public Integer getMinItemCompatibility() { return minItemCompatibility; } /** * Sets the value of the minItemCompatibility property. * * @param value * allowed object is * {@link Integer } * */ public void setMinItemCompatibility(Integer value) { this.minItemCompatibility = value; } /** * Gets the value of the maxItemCompatibility property. * * @return * possible object is * {@link Integer } * */ public Integer getMaxItemCompatibility() { return maxItemCompatibility; } /** * Sets the value of the maxItemCompatibility property. * * @param value * allowed object is * {@link Integer } * */ public void setMaxItemCompatibility(Integer value) { this.maxItemCompatibility = value; } /** * Gets the value of the conditionEnabled property. * * @return * possible object is * {@link ConditionEnabledCodeType } * */ public ConditionEnabledCodeType getConditionEnabled() { return conditionEnabled; } /** * Sets the value of the conditionEnabled property. * * @param value * allowed object is * {@link ConditionEnabledCodeType } * */ public void setConditionEnabled(ConditionEnabledCodeType value) { this.conditionEnabled = value; } /** * Gets the value of the conditionValues property. * * @return * possible object is * {@link ConditionValuesType } * */ public ConditionValuesType getConditionValues() { return conditionValues; } /** * Sets the value of the conditionValues property. * * @param value * allowed object is * {@link ConditionValuesType } * */ public void setConditionValues(ConditionValuesType value) { this.conditionValues = value; } /** * Gets the value of the valueCategory property. * * @return * possible object is * {@link Boolean } * */ public Boolean isValueCategory() { return valueCategory; } /** * Sets the value of the valueCategory property. * * @param value * allowed object is * {@link Boolean } * */ public void setValueCategory(Boolean value) { this.valueCategory = value; } /** * Gets the value of the productCreationEnabled property. * * @return * possible object is * {@link ProductCreationEnabledCodeType } * */ public ProductCreationEnabledCodeType getProductCreationEnabled() { return productCreationEnabled; } /** * Sets the value of the productCreationEnabled property. * * @param value * allowed object is * {@link ProductCreationEnabledCodeType } * */ public void setProductCreationEnabled(ProductCreationEnabledCodeType value) { this.productCreationEnabled = value; } /** * Gets the value of the maxGranularFitmentCount property. * * @return * possible object is * {@link Integer } * */ public Integer getMaxGranularFitmentCount() { return maxGranularFitmentCount; } /** * Sets the value of the maxGranularFitmentCount property. * * @param value * allowed object is * {@link Integer } * */ public void setMaxGranularFitmentCount(Integer value) { this.maxGranularFitmentCount = value; } /** * Gets the value of the compatibleVehicleType property. * * @return * possible object is * {@link String } * */ public String getCompatibleVehicleType() { return compatibleVehicleType; } /** * Sets the value of the compatibleVehicleType property. * * @param value * allowed object is * {@link String } * */ public void setCompatibleVehicleType(String value) { this.compatibleVehicleType = value; } /** * Gets the value of the paymentOptionsGroup property. * * @return * possible object is * {@link PaymentOptionsGroupEnabledCodeType } * */ public PaymentOptionsGroupEnabledCodeType getPaymentOptionsGroup() { return paymentOptionsGroup; } /** * Sets the value of the paymentOptionsGroup property. * * @param value * allowed object is * {@link PaymentOptionsGroupEnabledCodeType } * */ public void setPaymentOptionsGroup(PaymentOptionsGroupEnabledCodeType value) { this.paymentOptionsGroup = value; } /** * Gets the value of the shippingProfileCategoryGroup property. * * @return * possible object is * {@link ProfileCategoryGroupCodeType } * */ public ProfileCategoryGroupCodeType getShippingProfileCategoryGroup() { return shippingProfileCategoryGroup; } /** * Sets the value of the shippingProfileCategoryGroup property. * * @param value * allowed object is * {@link ProfileCategoryGroupCodeType } * */ public void setShippingProfileCategoryGroup(ProfileCategoryGroupCodeType value) { this.shippingProfileCategoryGroup = value; } /** * Gets the value of the paymentProfileCategoryGroup property. * * @return * possible object is * {@link ProfileCategoryGroupCodeType } * */ public ProfileCategoryGroupCodeType getPaymentProfileCategoryGroup() { return paymentProfileCategoryGroup; } /** * Sets the value of the paymentProfileCategoryGroup property. * * @param value * allowed object is * {@link ProfileCategoryGroupCodeType } * */ public void setPaymentProfileCategoryGroup(ProfileCategoryGroupCodeType value) { this.paymentProfileCategoryGroup = value; } /** * Gets the value of the returnPolicyProfileCategoryGroup property. * * @return * possible object is * {@link ProfileCategoryGroupCodeType } * */ public ProfileCategoryGroupCodeType getReturnPolicyProfileCategoryGroup() { return returnPolicyProfileCategoryGroup; } /** * Sets the value of the returnPolicyProfileCategoryGroup property. * * @param value * allowed object is * {@link ProfileCategoryGroupCodeType } * */ public void setReturnPolicyProfileCategoryGroup(ProfileCategoryGroupCodeType value) { this.returnPolicyProfileCategoryGroup = value; } /** * Gets the value of the vinSupported property. * * @return * possible object is * {@link Boolean } * */ public Boolean isVINSupported() { return vinSupported; } /** * Sets the value of the vinSupported property. * * @param value * allowed object is * {@link Boolean } * */ public void setVINSupported(Boolean value) { this.vinSupported = value; } /** * Gets the value of the vrmSupported property. * * @return * possible object is * {@link Boolean } * */ public Boolean isVRMSupported() { return vrmSupported; } /** * Sets the value of the vrmSupported property. * * @param value * allowed object is * {@link Boolean } * */ public void setVRMSupported(Boolean value) { this.vrmSupported = value; } /** * Gets the value of the sellerProvidedTitleSupported property. * * @return * possible object is * {@link Boolean } * */ public Boolean isSellerProvidedTitleSupported() { return sellerProvidedTitleSupported; } /** * Sets the value of the sellerProvidedTitleSupported property. * * @param value * allowed object is * {@link Boolean } * */ public void setSellerProvidedTitleSupported(Boolean value) { this.sellerProvidedTitleSupported = value; } /** * Gets the value of the depositSupported property. * * @return * possible object is * {@link Boolean } * */ public Boolean isDepositSupported() { return depositSupported; } /** * Sets the value of the depositSupported property. * * @param value * allowed object is * {@link Boolean } * */ public void setDepositSupported(Boolean value) { this.depositSupported = value; } /** * Gets the value of the globalShippingEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isGlobalShippingEnabled() { return globalShippingEnabled; } /** * Sets the value of the globalShippingEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setGlobalShippingEnabled(Boolean value) { this.globalShippingEnabled = value; } /** * Gets the value of the additionalCompatibilityEnabled property. * * @return * possible object is * {@link Boolean } * */ public Boolean isAdditionalCompatibilityEnabled() { return additionalCompatibilityEnabled; } /** * Sets the value of the additionalCompatibilityEnabled property. * * @param value * allowed object is * {@link Boolean } * */ public void setAdditionalCompatibilityEnabled(Boolean value) { this.additionalCompatibilityEnabled = value; } /** * * * @return * array of * {@link Element } * {@link Object } * */ public Object[] getAny() { if (this.any == null) { return new Object[ 0 ] ; } return ((Object[]) this.any.toArray(new Object[this.any.size()] )); } /** * * * @return * one of * {@link Element } * {@link Object } * */ public Object getAny(int idx) { if (this.any == null) { throw new IndexOutOfBoundsException(); } return this.any.get(idx); } public int getAnyLength() { if (this.any == null) { return 0; } return this.any.size(); } /** * * * @param values * allowed objects are * {@link Element } * {@link Object } * */ public void setAny(Object[] values) { this._getAny().clear(); int len = values.length; for (int i = 0; (i<len); i ++) { this.any.add(values[i]); } } protected List<Object> _getAny() { if (any == null) { any = new ArrayList<Object>(); } return any; } /** * * * @param value * allowed object is * {@link Element } * {@link Object } * */ public Object setAny(int idx, Object value) { return this.any.set(idx, value); } }
[ "mamtha@mamtha-Dell.(none)" ]
mamtha@mamtha-Dell.(none)
dbeeb524f77290cefb857f52dcbde3425295a514
cb47150733851506ab7987cabf4bb57d839dd724
/app/src/main/java/com/example/geeksproject/Notification/Client.java
bb3d57734a5737f96c4e63554388a9ae984a781a
[]
no_license
Saumil4122000/WhatsAppClone
f00a29f96905355f904d60908769bd11a8bc9421
cffcd3c54b990fd43144d7b9e8ced36066b8c109
refs/heads/master
2023-08-02T12:47:10.275083
2021-09-23T16:42:43
2021-09-23T16:42:43
343,429,809
2
0
null
null
null
null
UTF-8
Java
false
false
453
java
package com.example.geeksproject.Notification; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class Client { private static Retrofit retrofit=null; public static Retrofit getClient(String url){ if (retrofit==null){ retrofit=new Retrofit.Builder() .baseUrl(url).addConverterFactory(GsonConverterFactory.create()).build(); } return retrofit; } }
[ "saumil1220@gmail.com" ]
saumil1220@gmail.com
43edeea10c404661e63f5dd736499634f9ade454
eef5f6729e3a7514d60da547378cc5ca93b994d1
/space_android/app/src/main/java/com/tenth/space/imservice/manager/IMContactManager.java
6cb42f2bdd091b6db7452dcf5c2954659d51c10f
[]
no_license
robot0x/10thspace
effab5646d36705eec9342b9589bfee19e4c65e9
8b4066bacf402382e7d423723f57eb409a7af0d6
refs/heads/master
2021-01-12T08:47:58.854002
2016-12-16T05:38:59
2016-12-16T05:38:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
16,176
java
package com.tenth.space.imservice.manager; import com.tenth.space.DB.DBInterface; import com.tenth.space.DB.entity.DepartmentEntity; import com.tenth.space.DB.entity.UserEntity; import com.tenth.space.imservice.event.UserInfoEvent; import com.tenth.space.protobuf.IMBaseDefine; import com.tenth.space.protobuf.IMBuddy; import com.tenth.space.protobuf.helper.ProtoBuf2JavaBean; import com.tenth.space.utils.IMUIHelper; import com.tenth.space.utils.Logger; import com.tenth.space.utils.pinyin.PinYin; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import de.greenrobot.event.EventBus; import static com.tenth.space.imservice.event.UserInfoEvent.Event.USER_INFO_OK; /** * 负责用户信息的请求 * 为回话页面以及联系人页面提供服务 * * 联系人信息管理 * 普通用户的version 有总版本 * 群组没有总version的概念, 每个群有version * 具体请参见 服务端具体的pd协议 */ public class IMContactManager extends IMManager { private Logger logger = Logger.getLogger(IMContactManager.class); // 单例 private static IMContactManager inst = new IMContactManager(); public static IMContactManager instance() { return inst; } private IMSocketManager imSocketManager = IMSocketManager.instance(); private DBInterface dbInterface = DBInterface.instance(); // 自身状态字段 private boolean userDataReady = false; private Map<Integer,UserEntity> userMap = new ConcurrentHashMap<>(); private Map<Integer,DepartmentEntity> departmentMap = new ConcurrentHashMap<>(); @Override public void doOnStart() { } /** * 登陆成功触发 * auto自动登陆 * */ public void onNormalLoginOk(){ onLocalLoginOk(); onLocalNetOk(); } /** * 加载本地DB的状态 * 不管是离线还是在线登陆,loadFromDb 要运行的 */ public void onLocalLoginOk(){ logger.i("contact#loadAllUserInfo"); List<DepartmentEntity> deptlist = dbInterface.loadAllDept(); logger.i("contact#loadAllDept dbsuccess"); List<UserEntity> userlist = dbInterface.loadAllUsers(); logger.i("contact#loadAllUserInfo dbsuccess"); for(UserEntity userInfo:userlist){ // todo DB的状态不包含拼音的,这个样每次都要加载啊 PinYin.getPinYin(userInfo.getMainName(), userInfo.getPinyinElement()); userMap.put(userInfo.getPeerId(),userInfo); } for(DepartmentEntity deptInfo:deptlist){ PinYin.getPinYin(deptInfo.getDepartName(), deptInfo.getPinyinElement()); departmentMap.put(deptInfo.getDepartId(),deptInfo); } triggerEvent(USER_INFO_OK); } /** * 网络链接成功,登陆之后请求 */ public void onLocalNetOk(){ // 部门信息 int deptUpdateTime = dbInterface.getDeptLastTime(); reqGetDepartment(deptUpdateTime); // 用户信息 int updateTime = dbInterface.getUserInfoLastTime(); logger.i("contact#loadAllUserInfo req-updateTime:%d",updateTime); reqGetAllUsers(updateTime); } @Override public void reset() { userDataReady = false; userMap.clear(); } /** * @param event */ public void triggerEvent(UserInfoEvent.Event event) { //先更新自身的状态 switch (event){ case USER_INFO_OK: userDataReady = true; break; } EventBus.getDefault().postSticky(event); } /**-----------------------事件驱动---end---------*/ private void reqGetAllUsers(int lastUpdateTime) { logger.i("contact#reqGetAllUsers"); int userId = IMLoginManager.instance().getLoginId(); IMBuddy.IMAllUserReq imAllUserReq = IMBuddy.IMAllUserReq.newBuilder() .setUserId(userId) .setLatestUpdateTime(0).build(); int sid = IMBaseDefine.ServiceID.SID_BUDDY_LIST_VALUE; int cid = IMBaseDefine.BuddyListCmdID.CID_BUDDY_LIST_ALL_USER_REQUEST_VALUE; imSocketManager.sendRequest(imAllUserReq,sid,cid); } /** * yingmu change id from string to int * @param imAllUserRsp * * 1.请求所有用户的信息,总的版本号version * 2.匹配总的版本号,返回可能存在变更的 * 3.选取存在变更的,请求用户详细信息 * 4.更新DB,保存globalVersion 以及用户的信息 */ public void onRepAllUsers(IMBuddy.IMAllUserRsp imAllUserRsp) { logger.i("contact#onRepAllUsers"); int userId = imAllUserRsp.getUserId(); int lastTime = imAllUserRsp.getLatestUpdateTime(); // lastTime 需要保存嘛? 不保存了 int count = imAllUserRsp.getUserListCount(); logger.i("contact#user cnt:%d", count); if(count <=0){ return; } int loginId = IMLoginManager.instance().getLoginId(); if(userId != loginId){ logger.e("[fatal error] userId not equels loginId ,cause by onRepAllUsers"); return ; } List<IMBaseDefine.UserInfo> changeList = imAllUserRsp.getUserListList(); ArrayList<UserEntity> needDb = new ArrayList<>(); for(IMBaseDefine.UserInfo userInfo:changeList){ UserEntity entity = ProtoBuf2JavaBean.getUserEntity(userInfo); userMap.put(entity.getPeerId(),entity); needDb.add(entity); } dbInterface.batchInsertOrUpdateUser(needDb); triggerEvent(UserInfoEvent.Event.USER_INFO_UPDATE); } public UserEntity findContact(int buddyId){ if(buddyId > 0 && userMap.containsKey(buddyId)){ return userMap.get(buddyId); }else // else if (buddyId==0){ // SessionEntity sessionEntity=new SessionEntity(); // sessionEntity.setPeerId(15); // sessionEntity.setPeerType(DBConstant.SESSION_TYPE_SINGLE); // sessionEntity.setSessionKey( sessionEntity.buildSessionKey()); // dbInterface.insertOrUpdateSession(sessionEntity); // long requstCode = DBInterface.instance().insertOrUpdateSession(new SessionEntity()); // if(requstCode !=-1){ // // } // } return null; } /** * 请求用户详细信息 * @param userIds */ public void reqGetDetaillUsers(ArrayList<Integer> userIds){ logger.i("contact#contact#reqGetDetaillUsers"); if(null == userIds || userIds.size() <=0){ logger.i("contact#contact#reqGetDetaillUsers return,cause by null or empty"); return; } int loginId = IMLoginManager.instance().getLoginId(); IMBuddy.IMUsersInfoReq imUsersInfoReq = IMBuddy.IMUsersInfoReq.newBuilder() .setUserId(loginId) .addAllUserIdList(userIds) .build(); int sid = IMBaseDefine.ServiceID.SID_BUDDY_LIST_VALUE; int cid = IMBaseDefine.BuddyListCmdID.CID_BUDDY_LIST_USER_INFO_REQUEST_VALUE; imSocketManager.sendRequest(imUsersInfoReq,sid,cid); } /** * 获取用户详细的信息 * @param imUsersInfoRsp */ public void onRepDetailUsers(IMBuddy.IMUsersInfoRsp imUsersInfoRsp){ int loginId = imUsersInfoRsp.getUserId(); boolean needEvent = false; List<IMBaseDefine.UserInfo> userInfoList = imUsersInfoRsp.getUserInfoListList(); ArrayList<UserEntity> dbNeed = new ArrayList<>(); for(IMBaseDefine.UserInfo userInfo:userInfoList) { UserEntity userEntity = ProtoBuf2JavaBean.getUserEntity(userInfo); int userId = userEntity.getPeerId(); if (userMap.containsKey(userId) && userMap.get(userId).equals(userEntity)) { //没有必要通知更新 } else { needEvent = true; userMap.put(userEntity.getPeerId(), userEntity); dbNeed.add(userEntity); if (userInfo.getUserId() == loginId) { IMLoginManager.instance().setLoginInfo(userEntity); } } } // 负责userMap dbInterface.batchInsertOrUpdateUser(dbNeed); // 判断有没有必要进行推送 if(needEvent){ triggerEvent(UserInfoEvent.Event.USER_INFO_UPDATE); } } public DepartmentEntity findDepartment(int deptId){ DepartmentEntity entity = departmentMap.get(deptId); return entity; } public List<DepartmentEntity> getDepartmentSortedList(){ // todo eric efficiency List<DepartmentEntity> departmentList = new ArrayList<>(departmentMap.values()); Collections.sort(departmentList, new Comparator<DepartmentEntity>(){ @Override public int compare(DepartmentEntity entity1, DepartmentEntity entity2) { if(entity1.getPinyinElement().pinyin==null) { PinYin.getPinYin(entity1.getDepartName(),entity1.getPinyinElement()); } if(entity2.getPinyinElement().pinyin==null) { PinYin.getPinYin(entity2.getDepartName(),entity2.getPinyinElement()); } return entity1.getPinyinElement().pinyin.compareToIgnoreCase(entity2.getPinyinElement().pinyin); } }); return departmentList; } public void addFriend(UserEntity userEntity){ userMap.put(userEntity.getPeerId(),userEntity); } public List<UserEntity> getContactSortedList() { // todo eric efficiency List<UserEntity> contactList = new ArrayList<>(userMap.values()); Collections.sort(contactList, new Comparator<UserEntity>(){ @Override public int compare(UserEntity entity1, UserEntity entity2) { PinYin.PinYinElement pinyinElement = entity2.getPinyinElement(); if (entity2.getPinyinElement().pinyin.startsWith("#")) { return -1; } else if (entity1.getPinyinElement().pinyin.startsWith("#")) { // todo eric guess: latter is > 0 return 1; } else { if(entity1.getPinyinElement().pinyin==null) { PinYin.getPinYin(entity1.getMainName(),entity1.getPinyinElement()); } if(entity2.getPinyinElement().pinyin==null) { PinYin.getPinYin(entity2.getMainName(),entity2.getPinyinElement()); } return entity1.getPinyinElement().pinyin.compareToIgnoreCase(entity2.getPinyinElement().pinyin); } } }); return contactList; } public List<UserEntity> queryAllUser(){ return new ArrayList<>(userMap.values()); } // 通讯录中的部门显示 需要根据优先级 public List<UserEntity> getDepartmentTabSortedList() { // todo eric efficiency List<UserEntity> contactList = new ArrayList<>(userMap.values()); Collections.sort(contactList, new Comparator<UserEntity>() { @Override public int compare(UserEntity entity1, UserEntity entity2) { DepartmentEntity dept1 = departmentMap.get(entity1.getDepartmentId()); DepartmentEntity dept2 = departmentMap.get(entity2.getDepartmentId()); if (entity1.getDepartmentId() == entity2.getDepartmentId()) { // start compare if (entity2.getPinyinElement().pinyin.startsWith("#")) { return -1; } else if (entity1.getPinyinElement().pinyin.startsWith("#")) { // todo eric guess: latter is > 0 return 1; } else { if(entity1.getPinyinElement().pinyin==null) { PinYin.getPinYin(entity1.getMainName(), entity1.getPinyinElement()); } if(entity2.getPinyinElement().pinyin==null) { PinYin.getPinYin(entity2.getMainName(),entity2.getPinyinElement()); } return entity1.getPinyinElement().pinyin.compareToIgnoreCase(entity2.getPinyinElement().pinyin); } // end compare } else { return dept1.getDepartName().compareToIgnoreCase(dept2.getDepartName()); } } }); return contactList; } // 确实要将对比的抽离出来 Collections public List<UserEntity> getSearchContactList(String key){ List<UserEntity> searchList = new ArrayList<>(); for(Map.Entry<Integer,UserEntity> entry:userMap.entrySet()){ UserEntity user = entry.getValue(); if (IMUIHelper.handleContactSearch(key, user)) { searchList.add(user); } } return searchList; } public List<DepartmentEntity> getSearchDepartList(String key) { List<DepartmentEntity> searchList = new ArrayList<>(); for(Map.Entry<Integer,DepartmentEntity> entry:departmentMap.entrySet()){ DepartmentEntity dept = entry.getValue(); if (IMUIHelper.handleDepartmentSearch(key, dept)) { searchList.add(dept); } } return searchList; } /**------------------------部门相关的协议 start------------------------------*/ // 更新的方式与userInfo一直,根据时间点 public void reqGetDepartment(int lastUpdateTime){ logger.i("contact#reqGetDepartment"); int userId = IMLoginManager.instance().getLoginId(); IMBuddy.IMDepartmentReq imDepartmentReq = IMBuddy.IMDepartmentReq.newBuilder() .setUserId(userId) .setLatestUpdateTime(lastUpdateTime).build(); int sid = IMBaseDefine.ServiceID.SID_BUDDY_LIST_VALUE; int cid = IMBaseDefine.BuddyListCmdID.CID_BUDDY_LIST_DEPARTMENT_REQUEST_VALUE; imSocketManager.sendRequest(imDepartmentReq,sid,cid); } public void onRepDepartment(IMBuddy.IMDepartmentRsp imDepartmentRsp){ logger.i("contact#onRepDepartment"); int userId = imDepartmentRsp.getUserId(); int lastTime = imDepartmentRsp.getLatestUpdateTime(); int count = imDepartmentRsp.getDeptListCount(); logger.i("contact#department cnt:%d", count); // 如果用户找不到depart 那么部门显示未知 if(count <=0){ return; } int loginId = IMLoginManager.instance().getLoginId(); if(userId != loginId){ logger.e("[fatal error] userId not equels loginId ,cause by onRepDepartment"); return ; } List<IMBaseDefine.DepartInfo> changeList = imDepartmentRsp.getDeptListList(); ArrayList<DepartmentEntity> needDb = new ArrayList<>(); for(IMBaseDefine.DepartInfo departInfo:changeList){ DepartmentEntity entity = ProtoBuf2JavaBean.getDepartEntity(departInfo); departmentMap.put(entity.getDepartId(),entity); needDb.add(entity); } // 部门信息更新 dbInterface.batchInsertOrUpdateDepart(needDb); triggerEvent(UserInfoEvent.Event.USER_INFO_UPDATE); } /**------------------------部门相关的协议 end------------------------------*/ /**-----------------------实体 get set 定义-----------------------------------*/ public Map<Integer, UserEntity> getUserMap() { return userMap; } public Map<Integer, DepartmentEntity> getDepartmentMap() { return departmentMap; } public boolean isUserDataReady() { return userDataReady; } }
[ "3515676386@qq.com" ]
3515676386@qq.com
9422bed3112d4d9b37279b8ce7b41d0a1357958a
af03e8577c3d3dd8915aae19e0805317ffeb4d22
/quakoo-chat/src/main/java/com/quakoo/framework/ext/chat/service/nio/NioConnectService.java
9f126264008a36593c5330f3288ed3bc1653bcc2
[]
no_license
quakoo/quakoo-framework
299d07a175af95093c0f6ed89f67c323e07bd5c0
45a9ecb72022f95ca11512f62589ed6b9b6500ef
refs/heads/master
2023-01-07T06:36:23.729603
2021-06-19T10:50:34
2021-06-19T10:50:34
163,071,702
1
1
null
2022-12-29T01:50:15
2018-12-25T10:13:22
Java
UTF-8
Java
false
false
469
java
package com.quakoo.framework.ext.chat.service.nio; import com.quakoo.framework.ext.chat.model.param.nio.SessionRequest; import io.netty.channel.ChannelHandlerContext; public interface NioConnectService { public void handle(ChannelHandlerContext ctx, SessionRequest sessionRequest); // public void connect(ChannelHandlerContext ctx, ConnectRequest connectRequest); // public void sessionRequest(ChannelHandlerContext ctx, SessionRequest sessionRequest); }
[ "haolibj7741@sohu-inc.com" ]
haolibj7741@sohu-inc.com
bdb069bb9cfe510020d0f7b82968b8c900dc0c3a
89bfa64c1c728fa0b5ce77319d415ea52249026b
/chapter04/src/main/java/chapter04/StringTest03.java
df7a075f29835b51cc20766ed0452b8ffcaf28e5
[]
no_license
tnalfm12353/javastudy
1bcc358a76562aaa09d7aadb9692935d9beb61cf
cb15e1a0e5cc6ebc9c9b7d7cbf39c51a9aec1ace
refs/heads/master
2023-04-19T23:48:43.652861
2021-05-13T08:17:59
2021-05-13T08:17:59
361,947,031
0
0
null
null
null
null
UTF-8
Java
false
false
2,103
java
package chapter04; public class StringTest03 { public static void main(String[] args) { String s = "aBcABCabcAbc"; System.out.println(s.length()); System.out.println(s.charAt(2)); System.out.println(s.indexOf("abc")); System.out.println(s.indexOf("abc", 3)); System.out.println(s.indexOf("abc", 7)); // -1 System.out.println(s.substring(3)); System.out.println(s.substring(3,5)); String s2 = " ab cd "; String s3 = "efg,hijk,lmn,opqr,stu"; String s4 = s2.concat(s3); System.out.println(s4); System.out.println("----" + s2.trim() + "----"); System.out.println("====" + s2.replaceAll(" ", "") + "===="); // 정규표현식 regular expression String p = "1000"; if(p.matches("\\d+")) { // \d 숫자 int price = Integer.parseInt(p); System.out.println(price); }else { System.out.println("유효한 금액이 아닙니다."); } String tokens [] = s3.split(","); for(String token : tokens) { System.out.println(token); } System.out.println("==================================================="); String tokens2 [] = s3.split("#"); for(String token : tokens2) { System.out.println(token); } StringBuffer sb = new StringBuffer(""); sb.append("Hello "); sb.append("World "); sb.append("Java "); sb.append(1.8); String s5= sb.toString(); System.out.println(s5); //String s6 = "Hello " + "World " + "Java " + 1.8; String s6 = new StringBuffer("Hello ").append("World ").append("Java ").append(1.8).toString(); System.out.println(s6); // 주의 : 문자열 + 연산을 하지 말아야 할 때 --> String s6 = "Hello " + "World " + "Java " + 1.8; String warning =""; for(int i = 0 ; i < 100000 ; i++) { //warning = s7 + i; //warning = new StringBuffer(s7).append(i).toString(); } StringBuffer useThis = new StringBuffer(""); for(int i = 0 ; i < 100000 ; i++) { useThis.append(i); } String s7 = useThis.toString(); System.out.println(s7.length()); } }
[ "BIT@DESKTOP-0H6HNMT" ]
BIT@DESKTOP-0H6HNMT
026d4328bf33a9f24a91ecded71f4996906f00c4
fdb99db45d13b5078f03f814700f72e3a2fc9aa0
/app/src/main/java/com/teach/news10/adapter/TestAdapter.java
a782acfc7446c81128da9c24ed377f0107ec9efd
[]
no_license
andongn1-byte/kuangjia
fd5944018855c51622b27568d5afc0acc651b499
d82cc7c0e0d07d9d4c2de604a754e63c41c7d5d9
refs/heads/master
2022-12-08T13:39:12.182966
2020-08-31T07:24:03
2020-08-31T07:24:03
291,638,797
0
0
null
null
null
null
UTF-8
Java
false
false
2,189
java
package com.teach.news10.adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.teach.news10.R; import com.teach.news10.bean.LevelAndRoundInfo; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; public class TestAdapter extends RecyclerView.Adapter<TestAdapter.ViewHolder> { List<LevelAndRoundInfo.ContentBeanX.RoundsBean.ContentBean.DataBean> mList; Context mContext; public TestAdapter(List<LevelAndRoundInfo.ContentBeanX.RoundsBean.ContentBean.DataBean> pList, Context pContext) { mList = pList; mContext = pContext; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.test_adapter_layout, parent, false)); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { if (mList == null) return; LevelAndRoundInfo.ContentBeanX.RoundsBean.ContentBean.DataBean dataBean = mList.get(position); Glide.with(mContext).load(dataBean.getTeam_A_logo()).into(holder.leftImage); Glide.with(mContext).load(dataBean.getTeam_B_logo()).into(holder.rightImage); holder.leftText.setText(dataBean.getTeam_A_name()); holder.rightText.setText(dataBean.getTeam_B_name()); } @Override public int getItemCount() { return mList != null ? mList.size() : 0; } public class ViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.left_image) ImageView leftImage; @BindView(R.id.left_text) TextView leftText; @BindView(R.id.right_image) ImageView rightImage; @BindView(R.id.right_text) TextView rightText; public ViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } } }
[ "andongn1@163.com" ]
andongn1@163.com
cb739334b3aea49d6d3240980574d20c38a1449f
a7e301415e5c4f775a597cbb2043427ede49a965
/src/main/java/students/viktors_cesnokovs/lesson_9/level_5/task_22/FraudRule2.java
b4492bdf9cf0ecf329ca6443b5aba1b4da2e1179
[]
no_license
topchilina/jg-java-1-online-autumn-november-monday-2020
bf1ed1d6e8fd1afc35fe3af341eba6b4cfe27dd3
f130707b07a95e0a130433686d27af66c5ab1505
refs/heads/master
2023-03-04T23:38:29.814830
2021-02-22T16:50:30
2021-02-22T16:50:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package students.viktors_cesnokovs.lesson_9.level_5.task_22; class FraudRule2 extends FraudRule { public FraudRule2(String ruleName) { super(ruleName); } public boolean isFraud(Transaction t) { return t.getTrader().getCity().equalsIgnoreCase("Sidney"); } }
[ "doc18@inbox.lv" ]
doc18@inbox.lv
01237b73fb82120001aa4b1ecf7553e9512f4bac
ac6eb25990d5e101ac7a6a20390a2372728807fa
/src/com/cm55/kanhira/OkuriganaTable.java
cb6a89c699c816fe65e97b8b980f668a2b9740de
[]
no_license
FlySkyBear/kanhira
b8b3509f06729229b8db47d3a2d87efdc41580b6
0bb8899cecb3d8b4a2056c3eced5d6eeec5af673
refs/heads/master
2020-05-03T01:55:54.947044
2019-03-29T07:39:43
2019-03-29T07:39:43
178,353,381
0
0
null
null
null
null
UTF-8
Java
false
false
2,519
java
package com.cm55.kanhira; import java.util.*; /** * あるひらがな文字が漢字の送り仮名として適当かどうかをチェックするためのテーブル。 * 例えば、「悪く」の「く」という送り仮名が適当かどうかは、「悪」という熟語の送り仮名イニシャルとして「k」が * あるかないかで決まる。 * @author admin */ public class OkuriganaTable { /** * チェック対象の文字が送り仮名として適当であるかを調べる。 * @param okurigana 送り仮名マーク * @param target チェック対称の文字 * @return true:適当、false:不適当 */ public static boolean check(char okurigana, char target) { // 送り仮名マークの対象とするひらがなリストを取得する。 char[]targetChars = map.get(okurigana); if (targetChars == null) return false; // チェック、対象ひらがなは昇順なのでバイナリサーチ return Arrays.binarySearch(targetChars, target) >= 0; } /** 送り仮名イニシャルと、それに対してゆるされるひらがな */ static final Object[] TABLE = { 'a', "ぁあぃいぅうぇえぉおっ", 'b', "っばびぶべぼ", 'c', "ちっ", 'd', "だぢっづでど", 'e', "ぁあぃいぅうぇえぉおっゎわゐゑ", 'f', "っふ", 'g', "がぎぐげごっ", 'h', "っはひふへほ", 'i', "ぁあぃいぅうぇえぉおっゎわゐゑ", 'j', "ざじずぜぞっ", 'k', "かきくけこっヵヶ", 'l', "らりるれろ", 'm', "まみむめも", 'n', "なにぬねのん", 'o', "ぁあぃいぅうぇえぉおっゎわゐゑ", 'p', "っぱぴぷぺぽ", 'r', "らりるれろ", 's', "さしすせそっ", 't', "たちっつてと", 'u', "ぁあぃいぅうぇえぉおっゎわゐゑ", 'w', "ぁあぃいぅうぇえぉおっゎわゐゑを", 'y', "ゃやゅゆょよ", 'z', "ざじずぜぞっ", }; /** 送り仮名イニシャル・許可ひらがなマップ。ひらがな配列は昇順に並ぶ */ private static final Map<Character, char[]> map = new HashMap<>(); static { for (int i = 0; i < TABLE.length; i += 2) { char initial = (Character)TABLE[i + 0]; String targets = (String)TABLE[i + 1]; char[]targetChars = targets.toCharArray(); Arrays.sort(targetChars); map.put(initial, targetChars); } } }
[ "true.hardroad@gmail.com" ]
true.hardroad@gmail.com
c720eb87cf3eb49063ef38db27a45f6adcb21032
23574e36203a1ad85029c59079ec0f24666d41d7
/src/main/java/br/com/felippeneves/abstract_factory/car_service/services/CarEJBService.java
99860b713e5c35b6d1fecf81a111153a4bf74912
[]
no_license
felippeneves/creational-patterns
9a7246a7d85e27d132122f08641c44ef25185aa8
2e9c13f0ff1cfc21d74e105220e1a8f16206f6d1
refs/heads/master
2023-08-14T12:41:53.664128
2021-10-17T17:13:51
2021-10-17T17:13:51
417,646,544
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package br.com.felippeneves.abstract_factory.car_service.services; public class CarEJBService implements CarService { @Override public void save(String model) { System.out.println("Saving " + model + " car through EJB's interface"); } @Override public void update(String newModel) { System.out.println("Updating " + newModel + " car through EJB's interface"); } }
[ "felippenevesmonteiro@gmail.com" ]
felippenevesmonteiro@gmail.com
f5c95a3ac1f5bf23e8d22017bb3d51f7dc4077bb
43871858d9f0a605d56aedc255f4e114bcbb14e2
/src/main/java/com/razrabotkin/systematics/DataModels/Formulas/Cosine.java
0e7065a53ce6d1d301f687ed17f8f8df5952af82
[]
no_license
volodya-stepanov/ProjectS
afb1b837fe699d192774bf6f2c7da646bdd11f22
cd37be046e06e8a1cf3fb7edcf19d8d9df1b76ed
refs/heads/master
2020-04-19T04:49:19.914929
2019-04-09T21:07:49
2019-04-09T21:07:49
167,954,498
0
0
null
null
null
null
UTF-8
Java
false
false
2,037
java
package com.razrabotkin.systematics.DataModels.Formulas; import sun.reflect.generics.reflectiveObjects.NotImplementedException; import javax.xml.bind.JAXBElement; import java.util.ArrayList; /** * Косинус */ public class Cosine extends ExpressionModel{ /** Аргумент */ private SignedAtomModel Argument; public Cosine(FormulaModel parent) { super(parent); } @Override public String toString() { return "cos(" + Argument.toString() + ")"; } @Override public ArrayList<JAXBElement> toOpenXML() { throw new NotImplementedException(); } @Override public boolean isNumber() { return false; } @Override public boolean isVariable() { return false; } @Override public boolean isResult() { // Если аргумет дальше вычислить уже нельзя, но при этом он является числом, значит, // значение функции ещё можно вычислить. // Во всех остальных случаях значение вычислить уже нельзя, значит, это результат. if (Argument.isResult()){ if (Argument.isNumber()){ return false; } else { return true; } } else { return false; } } @Override public FormulaModel copy(FormulaModel parent) { Cosine cosine = new Cosine(parent); cosine.setArgument((SignedAtomModel) Argument.copy(cosine)); return cosine; } @Override public boolean canSolve() { return Argument.isNumber(); } @Override public void solve() { throw new NotImplementedException(); } // Методы-мутаторы public SignedAtomModel getArgument() { return Argument; } public void setArgument(SignedAtomModel argument) { Argument = argument; } }
[ "volodya.stepanov.edu@yandex.ru" ]
volodya.stepanov.edu@yandex.ru
4ab71893c98fbb6993ff83a8175e1430466011f1
0e6d099cc6f4750c396619c5196c8ba5d7fdd062
/app/src/main/java/mx/edu/ittepic/tpdm_u3_practica1/ProductoAdapter.java
fe544207ea5ee7d340912ed12d24563fae09a3fa
[]
no_license
jorgearellano19/Empresa
d6c2315427ad4026415550457c8274d1d8b87fba
bb0e0e76d073becbab95235597f0d2b74f155e1a
refs/heads/master
2021-01-18T18:05:51.881112
2017-03-31T22:35:28
2017-03-31T22:35:28
86,843,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,421
java
package mx.edu.ittepic.tpdm_u3_practica1; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.List; /** * Created by jorgearellano on 29/03/17. */ public class ProductoAdapter extends ArrayAdapter { private Context context; private List datos; public ProductoAdapter( Context context, List objects) { super(context,R.layout.listview_producto ,objects); this.context = context; this.datos = objects; } public View getView(int position, View convertView, ViewGroup parent){ LayoutInflater inflater = LayoutInflater.from(context); View item = inflater.inflate(R.layout.listview_producto,null); //Sacar todos los datos TextView tv1 = (TextView)item.findViewById(R.id.listview_item_producto_nombre); tv1.setText("Nombre del producto: "+((Producto)datos.get(position)).nombre); TextView tv2 = (TextView)item.findViewById(R.id.listview_item_producto_cantidad); tv2.setText("Cantidad en stock: "+((Producto)datos.get(position)).stack+""); TextView tv3 = (TextView)item.findViewById(R.id.listview_item_producto_precio); tv3.setText("Precio unitario del producto: $"+((Producto)datos.get(position)).precio+""); return item; } }
[ "jorch1910@gmail.com" ]
jorch1910@gmail.com
5b97eeb901b11c66cc6bef389829417fc8c96ccd
20eff352e4a7996746027123a0d9180ec405ce24
/SSM001/src/main/java/com/crx/quanxian/service/serviceImpl/UserServiceImpl.java
8df5ed33ebed1e3d8c05e02bf38af0bc2f6e0bb3
[]
no_license
1984867875/ZhangweiHello
641a100c7009a542f563ad333605bc911a3dca11
340435bb52d52213a3a65809a41d559ce782c248
refs/heads/master
2023-02-07T12:16:22.501973
2021-01-04T08:30:59
2021-01-04T08:30:59
326,613,940
0
0
null
null
null
null
UTF-8
Java
false
false
1,309
java
package com.crx.quanxian.service.serviceImpl; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpRequest; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.SessionAttributes; import com.crx.quanxian.dao.UserMapper; import com.crx.quanxian.model.Message; import com.crx.quanxian.model.User; import com.crx.quanxian.service.UserService; @Service public class UserServiceImpl implements UserService { @Autowired private UserMapper mapper; @Override public Message login(HttpServletRequest request, User user) { HttpSession session = request.getSession(); User u = mapper.selectByUser(user); Message message = new Message(); if(u!=null) { message.setMess("success"); session.setAttribute("user", u); }else { message.setMess("fail"); } return message; } /** * 用户列表 查找所有 */ @Override public List<User> queryUserList() { // TODO Auto-generated method stub return mapper.queryUserList(); } /** * 更改用户信息 (删除) */ @Override public void updateUser(User user) { mapper.deleteByPrimaryKey(user.getUid()); } }
[ "1984867875@qq.com" ]
1984867875@qq.com
53541d2a95c1e510b9be4ed017fc36efe6146490
1fedcc071a503d91f571daf5ff99c4e270b350a4
/app/src/main/java/com/fangsf/gankio/di/component/VideoComponent.java
c5b81c6b0a780b40ddaabfe695e61b3103345e91
[ "Apache-2.0" ]
permissive
midFang/Gank.io
0c3252ae4e0528b86d28c2bb86ff4ef44896f115
82a788b05a4a8fd54033c5e91a75e44583cb7894
refs/heads/master
2022-02-27T20:38:42.749995
2019-10-20T09:55:43
2019-10-20T09:55:43
111,272,804
4
0
null
null
null
null
UTF-8
Java
false
false
512
java
package com.fangsf.gankio.di.component; import com.fangsf.gankio.di.FragmentScope; import com.fangsf.gankio.di.module.HttpModule; import com.fangsf.gankio.di.module.VideoModule; import com.fangsf.gankio.ui.fragment.hometab.VideoFragment; import dagger.Component; import dagger.Module; /** * Created by fangsf on 2018/3/11. * Useful: */ @FragmentScope @Component(modules = VideoModule.class, dependencies = AppComponent.class) public interface VideoComponent { void inject(VideoFragment fragment); }
[ "highestfeng@gmail.com" ]
highestfeng@gmail.com
d2cc567d507cfb317f73c28630b7859b3bbd7b0e
77d863a334936f38f0934dbadc843d7acd587cc1
/RO17/src/main/java/adt/bst/BSTImpl.java
b6e4fb0c7eb674dc7576768f02a640df3e6f8d37
[]
no_license
ja1felipe/LEDA
7d454e9cfa540648c2d0279e8bacdf2c0e18265f
f2d4859c9371c7cc3b38a132fcd32975b81a6271
refs/heads/master
2020-05-03T04:11:45.287088
2019-06-11T22:51:41
2019-06-11T22:51:41
178,415,032
0
0
null
null
null
null
UTF-8
Java
false
false
6,766
java
package adt.bst; import java.util.ArrayList; import adt.bt.BTNode; public class BSTImpl<T extends Comparable<T>> implements BST<T> { protected BSTNode<T> root; public BSTImpl() { root = new BSTNode<>(); } public BSTNode<T> getRoot() { return this.root; } @Override public boolean isEmpty() { return this.root.isEmpty(); } @Override public int height() { return height(this.root); } protected int height(BSTNode<T> node) { int height = -1; if (!node.isEmpty()) { int heightLeft = height((BSTNode<T>) node.getLeft()); int heightRight = height((BSTNode<T>) node.getRight()); height = 1 + Math.max(heightLeft, heightRight); } return height; } @Override public BSTNode<T> search(T element) { return search(root, element); } protected BSTNode<T> search(BTNode<T> node, T element) { if (node.isEmpty()) { return (BSTNode<T>) node; } else if (node.getData().equals(element)) { return (BSTNode<T>) node; } else { if (element.compareTo(node.getData()) <= 0) { return search(node.getLeft(), element); } else { return search(node.getRight(), element); } } } @Override public void insert(T element) { insert(element,root); } protected void insert(T element, BTNode<T> node) { if (node.isEmpty()) { node.setData(element); node.setLeft(new BSTNode<T>()); node.setRight(new BSTNode<T>()); node.getLeft().setParent((BTNode<T>) node); node.getRight().setParent((BTNode<T>) node); } else { if (element.compareTo(node.getData()) < 0) { insert(element,node.getLeft()); } else { insert(element, node.getRight()); } } } @Override public BSTNode<T> maximum() { return maximum(root); } private BSTNode<T> maximum(BTNode<T> node) { if (node.isEmpty()) { return null; } else if (node.getRight().isEmpty()) { return (BSTNode<T>) node; } else { return maximum(node.getRight()); } } @Override public BSTNode<T> minimum() { return minimum(root); } private BSTNode<T> minimum(BTNode<T> node) { if (node.isEmpty()) { return null; } else if (node.getLeft().isEmpty()) { return (BSTNode<T>) node; } else { return minimum(node.getLeft()); } } @Override public BSTNode<T> sucessor(T element) { return (BSTNode<T>) sucessor(root, element); } private BTNode<T> sucessor(BTNode<T> no, T element) { BTNode<T> result = null; BTNode<T> auxNode = search(element); if (auxNode.isEmpty()) { return null; } if (!auxNode.getRight().isEmpty()) { result = minimum(auxNode.getRight()); } else { result = auxNode.getParent(); while (result != null && auxNode.equals(result.getRight())) { auxNode = result; result = result.getParent(); } } return result; } @Override public BSTNode<T> predecessor(T element) { return (BSTNode<T>) predecessor(root, element); } private BTNode<T> predecessor(BTNode<T> no, T element) { BTNode<T> result = null; BTNode<T> auxNode = search(element); if (auxNode.isEmpty()) { return null; } if (!auxNode.getLeft().isEmpty()) { result = maximum(auxNode.getLeft()); } else { result = auxNode.getParent(); while (result != null && auxNode.equals(result.getLeft())) { auxNode = result; result = result.getParent(); } } return result; } @Override public void remove(T element) { BSTNode<T> no = search(element); if(!no.isEmpty()) remove(no); } private void remove(BSTNode<T> node) { if (node.getRight().isEmpty() && node.getLeft().isEmpty()) { node.setData(null); } else if (node.getRight().isEmpty() || node.getLeft().isEmpty()) { if (node.equals(root)) { if (!node.getRight().isEmpty()) { root = (BSTNode<T>) node.getRight(); } else { root = (BSTNode<T>) node.getLeft(); } root.setParent(new BSTNode<T>()); } else { if (node.equals(node.getParent().getLeft())) { if (!node.getRight().isEmpty()) { node.getParent().setLeft(node.getRight()); node.getRight().setParent(node.getParent()); } else { node.getParent().setLeft(node.getLeft()); node.getLeft().setParent(node.getParent()); } } else { if (!node.getRight().isEmpty()) { node.getParent().setRight(node.getRight()); node.getRight().setParent(node.getParent()); } else { node.getParent().setRight(node.getLeft()); node.getLeft().setParent(node.getParent()); } } } }else{ BSTNode<T>sucessor = sucessor(node.getData()); T elementoSucessor = sucessor.getData(); remove(sucessor); node.setData(elementoSucessor); } } @Override public T[] preOrder() { ArrayList<T> list = new ArrayList<T>(); preOrder(this.root, list); T[] array = (T[]) new Comparable[size()]; return list.toArray(array); } public void preOrder(BSTNode<T> no, ArrayList<T> array) { if (!no.isEmpty()) { array.add(no.getData()); preOrder((BSTNode<T>) no.getLeft(), array); preOrder((BSTNode<T>) no.getRight(), array); } } @Override public T[] order() { ArrayList<T> list = new ArrayList<T>(); order(this.root, list); T[] array = (T[]) new Comparable[size()]; return list.toArray(array); } private void order(BSTNode<T> no, ArrayList<T> array) { if (!no.isEmpty()) { order((BSTNode<T>) no.getLeft(), array); array.add(no.getData()); order((BSTNode<T>) no.getRight(), array); } } @Override public T[] postOrder() { ArrayList<T> list = new ArrayList<T>(); postOrder(this.root, list); T[] array = (T[]) new Comparable[size()]; return list.toArray(array); } private void postOrder(BSTNode<T> no, ArrayList<T> array) { if (!no.isEmpty()) { postOrder((BSTNode<T>) no.getLeft(), array); postOrder((BSTNode<T>) no.getRight(), array); array.add(no.getData()); } } /** * This method is already implemented using recursion. You must understand how it work and * use similar idea with the other methods. */ @Override public int size() { return size(root); } private int size(BSTNode<T> node){ int result = 0; //base case means doing nothing (return 0) if(!node.isEmpty()){ //indusctive case result = 1 + size((BSTNode<T>)node.getLeft()) + size((BSTNode<T>)node.getRight()); } return result; } public boolean isLeftChild(BSTNode<T> node) { return node.getParent() != null && !node.getParent().isEmpty() && !node.getParent().getLeft().isEmpty() && node.getParent().getLeft().getData().equals(node.getData()); } public boolean isBiggerThan(BSTNode<T> node, T element) { return !node.isEmpty() && element != null && node.getData().compareTo(element) > 0; } public boolean isSmallerThan(BSTNode<T> node, T element) { return !node.isEmpty() && element != null && node.getData().compareTo(element) < 0; } }
[ "39709263+ja1felipe@users.noreply.github.com" ]
39709263+ja1felipe@users.noreply.github.com
57f2aee72195b164e004e663194ec03c609c0c56
9e35f63e0e24796726ac9ad6404f81597c06bcc4
/src/main/java/br/com/sigi/controller/PlanoFinanceiroManagedBean.java
d8f63bffffd1d843c303d75f37b5d0e69ff424ad
[]
no_license
ramon-diego/sigi
efebcf0046cf9aa8e8c9e5d2f31a0df9d6870a9c
b59b0e75a07681603c8bda7ba43ce41ecec1aa3d
refs/heads/master
2021-01-21T04:50:47.293101
2016-07-11T03:56:36
2016-07-11T03:56:36
51,704,159
0
0
null
null
null
null
UTF-8
Java
false
false
2,078
java
package br.com.sigi.controller; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; import br.com.sigi.model.PlanoFinanceiro; import br.com.sigi.services.PlanoFinanceiroService; @RequestScoped @ManagedBean(name = "planoFinanceiroBean") public class PlanoFinanceiroManagedBean implements Serializable { private static final long serialVersionUID = -7244080784034046663L; private PlanoFinanceiro planoFinanceiro; private List<PlanoFinanceiro> planosReceita; private List<PlanoFinanceiro> planosDespesa; @ManagedProperty("#{planoFinanceiroService}") PlanoFinanceiroService planoFinanceiroService; @PostConstruct public void init() { planoFinanceiro = new PlanoFinanceiro(); planosDespesa = new ArrayList<>(); planosDespesa = new ArrayList<>(); carregarPlanos(); } public void setPlanoFinanceiroService(PlanoFinanceiroService planoFinanceiroService) { this.planoFinanceiroService = planoFinanceiroService; } public void setPlanoFinanceiro(PlanoFinanceiro planoFinanceiro) { this.planoFinanceiro = planoFinanceiro; } public PlanoFinanceiro getPlanoFinanceiro() { return planoFinanceiro; } public void setPlanosReceita(List<PlanoFinanceiro> planosReceita) { this.planosReceita = planosReceita; } public List<PlanoFinanceiro> getPlanosReceita() { return planosReceita; } public void setPlanosDespesa(List<PlanoFinanceiro> planosDespesa) { this.planosDespesa = planosDespesa; } public List<PlanoFinanceiro> getPlanosDespesa() { return planosDespesa; } public void salvar() { planoFinanceiroService.save(planoFinanceiro); carregarPlanos(); } public void delete(PlanoFinanceiro planoFinanceiro) { planoFinanceiroService.delete(planoFinanceiro); carregarPlanos(); } public void carregarPlanos() { planosDespesa = planoFinanceiroService.buscarPlanoDespesa(); planosReceita = planoFinanceiroService.buscarPlanoReceita(); } }
[ "ramon-diego@hotmail.com" ]
ramon-diego@hotmail.com
924de3b9a479d8cd86fcb8bbf842761338c8e59f
cf93912c617c5de392ac6b0583e47f4f23496a65
/app/src/main/java/mx/edu/ittepic/a46animacionframeanimations/MainActivity.java
fa62297bf8e4ddc63027051a9bc63901a361c83d
[]
no_license
SoftZenith/46AnimacionFrameAnimations
bba1de57012515a6e140aa33e12be4eb47f97d32
b19d0b6cbf3994520bc520349e356676fa656162
refs/heads/master
2020-03-17T04:37:43.211275
2018-05-13T23:36:36
2018-05-13T23:36:36
133,282,725
0
0
null
null
null
null
UTF-8
Java
false
false
1,197
java
package mx.edu.ittepic.a46animacionframeanimations; import android.graphics.drawable.AnimationDrawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { private ImageView imageView; private AnimationDrawable horseAnimation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.animation); if (imageView == null) throw new AssertionError(); imageView.setVisibility(View.INVISIBLE); imageView.setBackgroundResource(R.drawable.horseanimation); horseAnimation = (AnimationDrawable) imageView.getBackground(); horseAnimation.setOneShot(true); } public void onStartBtnClick(View v) { imageView.setVisibility(View.VISIBLE); if (horseAnimation.isRunning()) { horseAnimation.stop(); } horseAnimation.start(); } public void onStopBtnClick(View v) { horseAnimation.stop(); } }
[ "bryan@MBP-de-Bryan.lan" ]
bryan@MBP-de-Bryan.lan
ecb677d7703ca171e25250d02542b71216654312
1a9108b7b9cb2a83452788b9f0a4483700f8689b
/src/com/github/battleships/Area.java
794ac70d8f0592411622af7a488e494b1aff8068
[]
no_license
4KevR/Battleships
be0a5de6e56b9867b3f243dc3b30948f51684fd5
8a6bd67d5a2b4e62deb88308ab77c402b34156be
refs/heads/master
2022-11-19T20:41:15.766295
2020-07-18T12:36:46
2020-07-18T12:36:46
241,362,615
1
0
null
null
null
null
UTF-8
Java
false
false
2,644
java
package com.github.battleships; import java.util.Random; public class Area { private final char[][] area = new char[10][10]; public Area () { this.initArea(); } public void initArea () { for (int i = 0; i < this.area.length; i++) { for (int j = 0; j < this.area.length; j++) { this.area[i][j] = '~'; } } } public void placeShip (int [] coordinates){ this.area[coordinates[1]][coordinates[0]] = '#'; } public char giveField (int [] coordinates){ return this.area[coordinates[1]][coordinates[0]]; } public void setField (int [] coordinates, char character){ this.area[coordinates[1]][coordinates[0]] = character; } public int [] getFieldWithChar (char character) { int set = 0; int [] field = new int[2]; while (set == 0) { field[0] = new Random().nextInt(10); field[1] = new Random().nextInt(10); if (this.giveField(field) == character) { set = 1; } } return field; } public int nearbyFieldsContainCharacter (int [] coordinates, String characters) { int [][] fields = {{coordinates[0]+1, coordinates[1]}, {coordinates[0]-1, coordinates[1]}, {coordinates[0], coordinates[1]+1}, {coordinates[0], coordinates[1]-1}}; for (int counter = 0; counter < 4; counter++) { if (fields[counter][0] >= 0 && fields[counter][0] <= 9 && fields[counter][1] >= 0 && fields[counter][1] <= 9) { if (characters.indexOf(this.giveField(fields[counter])) != -1) { return counter+1; } } } return 0; } public void applyNumberPos (int [] coordinates, int number) { if (number == 1) { coordinates[0] = coordinates[0]+1; } else if (number == 2) { coordinates[0] = coordinates[0]-1; } else if (number == 3) { coordinates[1] = coordinates[1]+1; } else { coordinates[1] = coordinates[1]-1; } } public void showArea () { System.out.println(" 1 2 3 4 5 6 7 8 9 10"); for (int i=0;i<this.area.length;i++) { int asciiNumber = 65+i; char asciiChar = (char)asciiNumber; System.out.print(asciiChar); System.out.print(" "); for (int j=0;j<this.area.length;j++) { System.out.print(this.area[i][j]); System.out.print(" "); } System.out.println(); } } }
[ "k.wiesner@keviani.de" ]
k.wiesner@keviani.de
e7c392e4e78aebfa1e6fe94c256b19760604ecca
e1529b1835f6135e76fd7ff4bc4045e9b2ef1460
/src/TestScript1.java
e73e852455fa33de9d7df62c3093387c3aa55ab1
[]
no_license
SmijaNair/to-be-loaded_git
5b412ec5b75bb07b4e0d4c109f76bbc78ee0348f
1817163f4a9b6b972f13f81c52f50455149a0bd6
refs/heads/master
2020-07-23T09:42:06.736454
2019-09-10T10:02:09
2019-09-10T10:02:09
207,516,840
0
0
null
null
null
null
UTF-8
Java
false
false
238
java
public class TestScript1 { public static void main(String[] args) { System.out.println("Test 1"); System.out.println("now added one more line"); System.out.println("third line"); System.out.println("from project architecture"); } }
[ "smijanair@outlook.com" ]
smijanair@outlook.com
65e24f3eaa36233b4a1b909a1cf0ac8221d14f6c
5d860ba1d0ddad29b06ac4244a269a73394c8cb3
/src/main/java/com/khlin/leetcode/ProductOfArrayExceptSelf.java
01fe82b5fdd7d81a97e609bb00193dee0a307ce6
[]
no_license
kikilink/MyLeetCodePractice
547729c75f0e65cd2296bccca0e1081e5d353ee1
dd5e5817045892aff829a341fbb493ece30eb441
refs/heads/master
2020-04-01T06:07:51.448471
2018-11-25T07:38:35
2018-11-25T07:38:35
152,934,463
0
0
null
null
null
null
UTF-8
Java
false
false
1,589
java
package com.khlin.leetcode; import java.util.Arrays; /** * 给定长度为 n 的整数数组 nums,其中 n > 1,返回输出数组 output ,其中 output[i] 等于 nums 中除 nums[i] * 之外其余各元素的乘积。 * * 示例: * * 输入: [1,2,3,4] 输出: [24,12,8,6] 说明: 请不要使用除法,且在 O(n) 时间复杂度内完成此题。 * * 进阶: 你可以在常数空间复杂度内完成这个题目吗?( 出于对空间复杂度分析的目的,输出数组不被视为额外空间。) */ public class ProductOfArrayExceptSelf { public static class Solution { public int[] productExceptSelf(int[] nums) { if (nums.length == 0) { return new int[0]; } int[] result = new int[nums.length]; int lastCursor = 1; // 先从左往右遍历,构造一个数组,每个索引位置i的值,是从0到(i-1)位置的乘积 // 例如[1, 2, 3, 4],则构造出[1, 1, 2, 6] result[0] = 1; for (int i = 1; i <= nums.length - 1; i++) { result[i] = nums[i - 1] * lastCursor; lastCursor = result[i]; } // 从右往左遍历,每个索引的值等于当前位置的值(即所有左边的乘积)乘以右边所有位置的值 int right = 1; for (int i = nums.length - 2; i >= 0; i--) { result[i] = result[i] * (right * nums[i + 1]); right = right * nums[i + 1]; } return result; } } public static void main(String[] args) { System.out.println(Arrays.toString( new Solution().productExceptSelf(new int[] { 2, 3, 4, 5, 6 }))); } }
[ "546324943@qq.com" ]
546324943@qq.com
a5a537ec7d431e7419be56f3498121502230a61f
6970cd9e1c123276f8f297caaac3374ef779a72e
/pocchroma/pocchromastorefront/web/addonsrc/notificationaddon/de/hybris/platform/notificationaddon/controllers/pages/NotificationPreferencePageController.java
e3f68aadbdc7ddb0bf2e2c78e757c53fee67f003
[]
no_license
Prashanth-techouts/tatacroma-poc
22badc975ebb84ebd270e88932eafdbb4ffe14ec
21992e275ba96f65b129b4485e76a7e4baa2e727
refs/heads/master
2023-06-19T13:32:32.848697
2021-07-21T08:28:09
2021-07-21T08:28:09
388,042,775
0
0
null
null
null
null
UTF-8
Java
false
false
4,747
java
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.notificationaddon.controllers.pages; import de.hybris.platform.acceleratorstorefrontcommons.annotations.RequireHardLogIn; import de.hybris.platform.acceleratorstorefrontcommons.breadcrumb.ResourceBreadcrumbBuilder; import de.hybris.platform.acceleratorstorefrontcommons.controllers.ThirdPartyConstants; import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController; import de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages; import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException; import de.hybris.platform.notificationaddon.forms.NotificationChannelForm; import de.hybris.platform.notificationfacades.data.NotificationPreferenceData; import de.hybris.platform.notificationfacades.facades.NotificationPreferenceFacade; import java.util.List; import java.util.stream.Collectors; import javax.annotation.Resource; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** * Controller for displaying and updating notification preference */ @Controller @Scope("tenant") @RequestMapping("/my-account/notification-preference") public class NotificationPreferencePageController extends AbstractPageController { private static final String REDIRECT_TO_GET_PREFERENCE_PAGE = REDIRECT_PREFIX + "/my-account/notification-preference"; private static final String NOTIFICATION_PREFERENCE_CMS_PAGE = "notification-preference"; private static final String BREADCRUMBS_ATTR = "breadcrumbs"; private static final String NOTIFICATION_PREFERENCE_FORM = "notificationPreferenceForm"; @Resource(name = "accountBreadcrumbBuilder") private ResourceBreadcrumbBuilder accountBreadcrumbBuilder; @Resource(name = "notificationPreferenceFacade") private NotificationPreferenceFacade notificationPreferenceFacade; final String[] DISALLOWED_FIELDS = new String[]{}; @InitBinder public void initBinder(final WebDataBinder binder) { binder.setDisallowedFields(DISALLOWED_FIELDS); } @RequestMapping(method = RequestMethod.GET) @RequireHardLogIn public String getNotificationPreferences(final Model model) throws CMSItemNotFoundException { final List<NotificationPreferenceData> notificationPreferenceList = notificationPreferenceFacade .getValidNotificationPreferences(); final NotificationChannelForm form = new NotificationChannelForm(); form.setChannels(notificationPreferenceList.stream() .sorted((a, b) -> a.getChannel().getCode().compareTo(b.getChannel().getCode())).collect(Collectors.toList())); model.addAttribute(NOTIFICATION_PREFERENCE_FORM, form); storeCmsPageInModel(model, getContentPageForLabelOrId(NOTIFICATION_PREFERENCE_CMS_PAGE)); setUpMetaDataForContentPage(model, getContentPageForLabelOrId(NOTIFICATION_PREFERENCE_CMS_PAGE)); model.addAttribute(BREADCRUMBS_ATTR, accountBreadcrumbBuilder.getBreadcrumbs("text.account.profile.notificationPreferenceSetting")); model.addAttribute(ThirdPartyConstants.SeoRobots.META_ROBOTS, ThirdPartyConstants.SeoRobots.NOINDEX_NOFOLLOW); return getViewForPage(model); } @RequestMapping(method = RequestMethod.POST) @RequireHardLogIn public String updateNotificationPreference(final NotificationChannelForm notificationPreferenceForm, final BindingResult bindingResult, final Model model, final RedirectAttributes redirectModel) throws CMSItemNotFoundException { notificationPreferenceFacade.updateNotificationPreference(notificationPreferenceForm.getChannels()); model.addAttribute(BREADCRUMBS_ATTR, accountBreadcrumbBuilder.getBreadcrumbs("text.account.profile.notificationPreferenceSetting")); model.addAttribute(ThirdPartyConstants.SeoRobots.META_ROBOTS, ThirdPartyConstants.SeoRobots.NOINDEX_NOFOLLOW); GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.CONF_MESSAGES_HOLDER, "notification.preference.confirmation.message.title"); return REDIRECT_TO_GET_PREFERENCE_PAGE; } }
[ "prashanth.g@techouts.com" ]
prashanth.g@techouts.com
0e611b645e1a979d5cf1979eb1f0839195269d62
b3d3b41f2023f1c969bc01dea85ef99bba0b8cdd
/src/main/java/com/amazonaws/services/cloudfront/AmazonCloudFrontClient.java
730d1867af227af354a3654585b8baf17d367be9
[ "JSON", "Apache-2.0" ]
permissive
carljparker/aws-sdk-for-java
67fe76c0fa8ff347dd3252cdca10b26be497c1f6
902235186eefaf131fadd18c47d85d9167cbe963
refs/heads/master
2021-01-15T21:02:29.480581
2011-10-21T00:18:29
2011-10-21T18:45:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
43,412
java
/* * Copyright 2010-2011 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.cloudfront; import org.w3c.dom.Node; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map.Entry; import com.amazonaws.*; import com.amazonaws.auth.*; import com.amazonaws.handlers.HandlerChainFactory; import com.amazonaws.handlers.RequestHandler; import com.amazonaws.http.StaxResponseHandler; import com.amazonaws.http.DefaultErrorResponseHandler; import com.amazonaws.http.ExecutionContext; import com.amazonaws.internal.StaticCredentialsProvider; import com.amazonaws.transform.Unmarshaller; import com.amazonaws.transform.StaxUnmarshallerContext; import com.amazonaws.transform.StandardErrorUnmarshaller; import com.amazonaws.services.cloudfront.model.*; import com.amazonaws.services.cloudfront.model.transform.*; /** * Client for accessing AmazonCloudFront. All service calls made * using this client are blocking, and will not return until the service call * completes. * <p> * */ public class AmazonCloudFrontClient extends AmazonWebServiceClient implements AmazonCloudFront { /** Provider for AWS credentials. */ private AWSCredentialsProvider awsCredentialsProvider; /** * List of exception unmarshallers for all AmazonCloudFront exceptions. */ protected final List<Unmarshaller<AmazonServiceException, Node>> exceptionUnmarshallers = new ArrayList<Unmarshaller<AmazonServiceException, Node>>(); /** AWS signer for authenticating requests. */ private CloudFrontSigner signer; /** * Constructs a new client to invoke service methods on * AmazonCloudFront using the specified AWS account credentials. * * <p> * All service calls made using this new client object are blocking, and will not * return until the service call completes. * * @param awsCredentials The AWS credentials (access key ID and secret key) to use * when authenticating with AWS services. */ public AmazonCloudFrontClient(AWSCredentials awsCredentials) { this(awsCredentials, new ClientConfiguration()); } /** * Constructs a new client to invoke service methods on * AmazonCloudFront using the specified AWS account credentials * and client configuration options. * * <p> * All service calls made using this new client object are blocking, and will not * return until the service call completes. * * @param awsCredentials The AWS credentials (access key ID and secret key) to use * when authenticating with AWS services. * @param clientConfiguration The client configuration options controlling how this * client connects to AmazonCloudFront * (ex: proxy settings, retry counts, etc.). */ public AmazonCloudFrontClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) { super(clientConfiguration); this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials); init(); } /** * Constructs a new client to invoke service methods on * AmazonCloudFront using the specified AWS account credentials provider. * * <p> * All service calls made using this new client object are blocking, and will not * return until the service call completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials * to authenticate requests with AWS services. */ public AmazonCloudFrontClient(AWSCredentialsProvider awsCredentialsProvider) { this(awsCredentialsProvider, new ClientConfiguration()); } /** * Constructs a new client to invoke service methods on * AmazonCloudFront using the specified AWS account credentials * provider and client configuration options. * * <p> * All service calls made using this new client object are blocking, and will not * return until the service call completes. * * @param awsCredentialsProvider * The AWS credentials provider which will provide credentials * to authenticate requests with AWS services. * @param clientConfiguration The client configuration options controlling how this * client connects to AmazonCloudFront * (ex: proxy settings, retry counts, etc.). */ public AmazonCloudFrontClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) { super(clientConfiguration); this.awsCredentialsProvider = awsCredentialsProvider; init(); } private void init() { exceptionUnmarshallers.add(new TooManyDistributionsExceptionUnmarshaller()); exceptionUnmarshallers.add(new PreconditionFailedExceptionUnmarshaller()); exceptionUnmarshallers.add(new CNAMEAlreadyExistsExceptionUnmarshaller()); exceptionUnmarshallers.add(new CloudFrontOriginAccessIdentityInUseExceptionUnmarshaller()); exceptionUnmarshallers.add(new TrustedSignerDoesNotExistExceptionUnmarshaller()); exceptionUnmarshallers.add(new DistributionNotDisabledExceptionUnmarshaller()); exceptionUnmarshallers.add(new BatchTooLargeExceptionUnmarshaller()); exceptionUnmarshallers.add(new StreamingDistributionNotDisabledExceptionUnmarshaller()); exceptionUnmarshallers.add(new InvalidArgumentExceptionUnmarshaller()); exceptionUnmarshallers.add(new TooManyStreamingDistributionsExceptionUnmarshaller()); exceptionUnmarshallers.add(new TooManyTrustedSignersExceptionUnmarshaller()); exceptionUnmarshallers.add(new InvalidRequiredProtocolExceptionUnmarshaller()); exceptionUnmarshallers.add(new IllegalUpdateExceptionUnmarshaller()); exceptionUnmarshallers.add(new TooManyCloudFrontOriginAccessIdentitiesExceptionUnmarshaller()); exceptionUnmarshallers.add(new NoSuchDistributionExceptionUnmarshaller()); exceptionUnmarshallers.add(new DistributionAlreadyExistsExceptionUnmarshaller()); exceptionUnmarshallers.add(new CloudFrontOriginAccessIdentityAlreadyExistsExceptionUnmarshaller()); exceptionUnmarshallers.add(new TooManyInvalidationsInProgressExceptionUnmarshaller()); exceptionUnmarshallers.add(new InvalidDefaultRootObjectExceptionUnmarshaller()); exceptionUnmarshallers.add(new InvalidIfMatchVersionExceptionUnmarshaller()); exceptionUnmarshallers.add(new InvalidOriginExceptionUnmarshaller()); exceptionUnmarshallers.add(new NoSuchInvalidationExceptionUnmarshaller()); exceptionUnmarshallers.add(new StreamingDistributionAlreadyExistsExceptionUnmarshaller()); exceptionUnmarshallers.add(new AccessDeniedExceptionUnmarshaller()); exceptionUnmarshallers.add(new MissingBodyExceptionUnmarshaller()); exceptionUnmarshallers.add(new TooManyDistributionCNAMEsExceptionUnmarshaller()); exceptionUnmarshallers.add(new NoSuchCloudFrontOriginAccessIdentityExceptionUnmarshaller()); exceptionUnmarshallers.add(new InvalidOriginAccessIdentityExceptionUnmarshaller()); exceptionUnmarshallers.add(new NoSuchStreamingDistributionExceptionUnmarshaller()); exceptionUnmarshallers.add(new TooManyStreamingDistributionCNAMEsExceptionUnmarshaller()); exceptionUnmarshallers.add(new StandardErrorUnmarshaller()); setEndpoint("cloudfront.amazonaws.com/"); signer = new CloudFrontSigner(); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandlers.addAll(chainFactory.newRequestHandlerChain( "/com/amazonaws/services/cloudfront/request.handlers")); } /** * <p> * Get the information about a streaming distribution. * </p> * * @param getStreamingDistributionRequest Container for the necessary * parameters to execute the GetStreamingDistribution service method on * AmazonCloudFront. * * @return The response from the GetStreamingDistribution service method, * as returned by AmazonCloudFront. * * @throws NoSuchStreamingDistributionException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public GetStreamingDistributionResult getStreamingDistribution(GetStreamingDistributionRequest getStreamingDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<GetStreamingDistributionRequest> request = new GetStreamingDistributionRequestMarshaller().marshall(getStreamingDistributionRequest); return invoke(request, new GetStreamingDistributionResultStaxUnmarshaller()); } /** * <p> * List origin access identities. * </p> * * @param listCloudFrontOriginAccessIdentitiesRequest Container for the * necessary parameters to execute the * ListCloudFrontOriginAccessIdentities service method on * AmazonCloudFront. * * @return The response from the ListCloudFrontOriginAccessIdentities * service method, as returned by AmazonCloudFront. * * @throws InvalidArgumentException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public ListCloudFrontOriginAccessIdentitiesResult listCloudFrontOriginAccessIdentities(ListCloudFrontOriginAccessIdentitiesRequest listCloudFrontOriginAccessIdentitiesRequest) throws AmazonServiceException, AmazonClientException { Request<ListCloudFrontOriginAccessIdentitiesRequest> request = new ListCloudFrontOriginAccessIdentitiesRequestMarshaller().marshall(listCloudFrontOriginAccessIdentitiesRequest); return invoke(request, new ListCloudFrontOriginAccessIdentitiesResultStaxUnmarshaller()); } /** * <p> * Create a new distribution. * </p> * * @param createDistributionRequest Container for the necessary * parameters to execute the CreateDistribution service method on * AmazonCloudFront. * * @return The response from the CreateDistribution service method, as * returned by AmazonCloudFront. * * @throws InvalidDefaultRootObjectException * @throws MissingBodyException * @throws TooManyDistributionCNAMEsException * @throws TooManyDistributionsException * @throws CNAMEAlreadyExistsException * @throws InvalidArgumentException * @throws InvalidOriginAccessIdentityException * @throws TrustedSignerDoesNotExistException * @throws InvalidOriginException * @throws TooManyTrustedSignersException * @throws AccessDeniedException * @throws DistributionAlreadyExistsException * @throws InvalidRequiredProtocolException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public CreateDistributionResult createDistribution(CreateDistributionRequest createDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<CreateDistributionRequest> request = new CreateDistributionRequestMarshaller().marshall(createDistributionRequest); return invoke(request, new CreateDistributionResultStaxUnmarshaller()); } /** * <p> * Create a new origin access identity. * </p> * * @param createCloudFrontOriginAccessIdentityRequest Container for the * necessary parameters to execute the * CreateCloudFrontOriginAccessIdentity service method on * AmazonCloudFront. * * @return The response from the CreateCloudFrontOriginAccessIdentity * service method, as returned by AmazonCloudFront. * * @throws TooManyCloudFrontOriginAccessIdentitiesException * @throws MissingBodyException * @throws InvalidArgumentException * @throws CloudFrontOriginAccessIdentityAlreadyExistsException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public CreateCloudFrontOriginAccessIdentityResult createCloudFrontOriginAccessIdentity(CreateCloudFrontOriginAccessIdentityRequest createCloudFrontOriginAccessIdentityRequest) throws AmazonServiceException, AmazonClientException { Request<CreateCloudFrontOriginAccessIdentityRequest> request = new CreateCloudFrontOriginAccessIdentityRequestMarshaller().marshall(createCloudFrontOriginAccessIdentityRequest); return invoke(request, new CreateCloudFrontOriginAccessIdentityResultStaxUnmarshaller()); } /** * <p> * List invalidation batches. * </p> * * @param listInvalidationsRequest Container for the necessary parameters * to execute the ListInvalidations service method on AmazonCloudFront. * * @return The response from the ListInvalidations service method, as * returned by AmazonCloudFront. * * @throws NoSuchDistributionException * @throws InvalidArgumentException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public ListInvalidationsResult listInvalidations(ListInvalidationsRequest listInvalidationsRequest) throws AmazonServiceException, AmazonClientException { Request<ListInvalidationsRequest> request = new ListInvalidationsRequestMarshaller().marshall(listInvalidationsRequest); return invoke(request, new ListInvalidationsResultStaxUnmarshaller()); } /** * <p> * Get the information about a distribution. * </p> * * @param getDistributionRequest Container for the necessary parameters * to execute the GetDistribution service method on AmazonCloudFront. * * @return The response from the GetDistribution service method, as * returned by AmazonCloudFront. * * @throws NoSuchDistributionException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public GetDistributionResult getDistribution(GetDistributionRequest getDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<GetDistributionRequest> request = new GetDistributionRequestMarshaller().marshall(getDistributionRequest); return invoke(request, new GetDistributionResultStaxUnmarshaller()); } /** * <p> * List distributions. * </p> * * @param listDistributionsRequest Container for the necessary parameters * to execute the ListDistributions service method on AmazonCloudFront. * * @return The response from the ListDistributions service method, as * returned by AmazonCloudFront. * * @throws InvalidArgumentException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public ListDistributionsResult listDistributions(ListDistributionsRequest listDistributionsRequest) throws AmazonServiceException, AmazonClientException { Request<ListDistributionsRequest> request = new ListDistributionsRequestMarshaller().marshall(listDistributionsRequest); return invoke(request, new ListDistributionsResultStaxUnmarshaller()); } /** * <p> * Create a new streaming distribution. * </p> * * @param createStreamingDistributionRequest Container for the necessary * parameters to execute the CreateStreamingDistribution service method * on AmazonCloudFront. * * @return The response from the CreateStreamingDistribution service * method, as returned by AmazonCloudFront. * * @throws TooManyTrustedSignersException * @throws MissingBodyException * @throws TooManyStreamingDistributionCNAMEsException * @throws StreamingDistributionAlreadyExistsException * @throws CNAMEAlreadyExistsException * @throws AccessDeniedException * @throws TooManyStreamingDistributionsException * @throws InvalidArgumentException * @throws InvalidOriginAccessIdentityException * @throws TrustedSignerDoesNotExistException * @throws InvalidOriginException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public CreateStreamingDistributionResult createStreamingDistribution(CreateStreamingDistributionRequest createStreamingDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<CreateStreamingDistributionRequest> request = new CreateStreamingDistributionRequestMarshaller().marshall(createStreamingDistributionRequest); return invoke(request, new CreateStreamingDistributionResultStaxUnmarshaller()); } /** * <p> * Delete a streaming distribution. * </p> * * @param deleteStreamingDistributionRequest Container for the necessary * parameters to execute the DeleteStreamingDistribution service method * on AmazonCloudFront. * * @throws InvalidIfMatchVersionException * @throws NoSuchStreamingDistributionException * @throws StreamingDistributionNotDisabledException * @throws PreconditionFailedException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public void deleteStreamingDistribution(DeleteStreamingDistributionRequest deleteStreamingDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<DeleteStreamingDistributionRequest> request = new DeleteStreamingDistributionRequestMarshaller().marshall(deleteStreamingDistributionRequest); invoke(request, null); } /** * <p> * Delete an origin access identity. * </p> * * @param deleteCloudFrontOriginAccessIdentityRequest Container for the * necessary parameters to execute the * DeleteCloudFrontOriginAccessIdentity service method on * AmazonCloudFront. * * @throws InvalidIfMatchVersionException * @throws CloudFrontOriginAccessIdentityInUseException * @throws NoSuchCloudFrontOriginAccessIdentityException * @throws PreconditionFailedException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public void deleteCloudFrontOriginAccessIdentity(DeleteCloudFrontOriginAccessIdentityRequest deleteCloudFrontOriginAccessIdentityRequest) throws AmazonServiceException, AmazonClientException { Request<DeleteCloudFrontOriginAccessIdentityRequest> request = new DeleteCloudFrontOriginAccessIdentityRequestMarshaller().marshall(deleteCloudFrontOriginAccessIdentityRequest); invoke(request, null); } /** * <p> * Get the information about an invalidation. * </p> * * @param getInvalidationRequest Container for the necessary parameters * to execute the GetInvalidation service method on AmazonCloudFront. * * @return The response from the GetInvalidation service method, as * returned by AmazonCloudFront. * * @throws NoSuchInvalidationException * @throws NoSuchDistributionException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public GetInvalidationResult getInvalidation(GetInvalidationRequest getInvalidationRequest) throws AmazonServiceException, AmazonClientException { Request<GetInvalidationRequest> request = new GetInvalidationRequestMarshaller().marshall(getInvalidationRequest); return invoke(request, new GetInvalidationResultStaxUnmarshaller()); } /** * <p> * Delete a distribution. * </p> * * @param deleteDistributionRequest Container for the necessary * parameters to execute the DeleteDistribution service method on * AmazonCloudFront. * * @throws InvalidIfMatchVersionException * @throws NoSuchDistributionException * @throws DistributionNotDisabledException * @throws PreconditionFailedException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public void deleteDistribution(DeleteDistributionRequest deleteDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<DeleteDistributionRequest> request = new DeleteDistributionRequestMarshaller().marshall(deleteDistributionRequest); invoke(request, null); } /** * <p> * Update a distribution. * </p> * * @param updateDistributionRequest Container for the necessary * parameters to execute the UpdateDistribution service method on * AmazonCloudFront. * * @return The response from the UpdateDistribution service method, as * returned by AmazonCloudFront. * * @throws InvalidDefaultRootObjectException * @throws InvalidIfMatchVersionException * @throws IllegalUpdateException * @throws MissingBodyException * @throws TooManyDistributionCNAMEsException * @throws PreconditionFailedException * @throws CNAMEAlreadyExistsException * @throws InvalidArgumentException * @throws InvalidOriginAccessIdentityException * @throws TrustedSignerDoesNotExistException * @throws TooManyTrustedSignersException * @throws NoSuchDistributionException * @throws AccessDeniedException * @throws InvalidRequiredProtocolException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public UpdateDistributionResult updateDistribution(UpdateDistributionRequest updateDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<UpdateDistributionRequest> request = new UpdateDistributionRequestMarshaller().marshall(updateDistributionRequest); return invoke(request, new UpdateDistributionResultStaxUnmarshaller()); } /** * <p> * Get the configuration information about a distribution. * </p> * * @param getDistributionConfigRequest Container for the necessary * parameters to execute the GetDistributionConfig service method on * AmazonCloudFront. * * @return The response from the GetDistributionConfig service method, as * returned by AmazonCloudFront. * * @throws NoSuchDistributionException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public GetDistributionConfigResult getDistributionConfig(GetDistributionConfigRequest getDistributionConfigRequest) throws AmazonServiceException, AmazonClientException { Request<GetDistributionConfigRequest> request = new GetDistributionConfigRequestMarshaller().marshall(getDistributionConfigRequest); return invoke(request, new GetDistributionConfigResultStaxUnmarshaller()); } /** * <p> * Update an origin access identity. * </p> * * @param updateCloudFrontOriginAccessIdentityRequest Container for the * necessary parameters to execute the * UpdateCloudFrontOriginAccessIdentity service method on * AmazonCloudFront. * * @return The response from the UpdateCloudFrontOriginAccessIdentity * service method, as returned by AmazonCloudFront. * * @throws InvalidIfMatchVersionException * @throws IllegalUpdateException * @throws MissingBodyException * @throws NoSuchCloudFrontOriginAccessIdentityException * @throws PreconditionFailedException * @throws AccessDeniedException * @throws InvalidArgumentException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public UpdateCloudFrontOriginAccessIdentityResult updateCloudFrontOriginAccessIdentity(UpdateCloudFrontOriginAccessIdentityRequest updateCloudFrontOriginAccessIdentityRequest) throws AmazonServiceException, AmazonClientException { Request<UpdateCloudFrontOriginAccessIdentityRequest> request = new UpdateCloudFrontOriginAccessIdentityRequestMarshaller().marshall(updateCloudFrontOriginAccessIdentityRequest); return invoke(request, new UpdateCloudFrontOriginAccessIdentityResultStaxUnmarshaller()); } /** * <p> * Get the information about an origin access identity. * </p> * * @param getCloudFrontOriginAccessIdentityRequest Container for the * necessary parameters to execute the GetCloudFrontOriginAccessIdentity * service method on AmazonCloudFront. * * @return The response from the GetCloudFrontOriginAccessIdentity * service method, as returned by AmazonCloudFront. * * @throws NoSuchCloudFrontOriginAccessIdentityException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public GetCloudFrontOriginAccessIdentityResult getCloudFrontOriginAccessIdentity(GetCloudFrontOriginAccessIdentityRequest getCloudFrontOriginAccessIdentityRequest) throws AmazonServiceException, AmazonClientException { Request<GetCloudFrontOriginAccessIdentityRequest> request = new GetCloudFrontOriginAccessIdentityRequestMarshaller().marshall(getCloudFrontOriginAccessIdentityRequest); return invoke(request, new GetCloudFrontOriginAccessIdentityResultStaxUnmarshaller()); } /** * <p> * Create a new invalidation. * </p> * * @param createInvalidationRequest Container for the necessary * parameters to execute the CreateInvalidation service method on * AmazonCloudFront. * * @return The response from the CreateInvalidation service method, as * returned by AmazonCloudFront. * * @throws TooManyInvalidationsInProgressException * @throws MissingBodyException * @throws NoSuchDistributionException * @throws BatchTooLargeException * @throws AccessDeniedException * @throws InvalidArgumentException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public CreateInvalidationResult createInvalidation(CreateInvalidationRequest createInvalidationRequest) throws AmazonServiceException, AmazonClientException { Request<CreateInvalidationRequest> request = new CreateInvalidationRequestMarshaller().marshall(createInvalidationRequest); return invoke(request, new CreateInvalidationResultStaxUnmarshaller()); } /** * <p> * Get the configuration information about a streaming distribution. * </p> * * @param getStreamingDistributionConfigRequest Container for the * necessary parameters to execute the GetStreamingDistributionConfig * service method on AmazonCloudFront. * * @return The response from the GetStreamingDistributionConfig service * method, as returned by AmazonCloudFront. * * @throws NoSuchStreamingDistributionException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public GetStreamingDistributionConfigResult getStreamingDistributionConfig(GetStreamingDistributionConfigRequest getStreamingDistributionConfigRequest) throws AmazonServiceException, AmazonClientException { Request<GetStreamingDistributionConfigRequest> request = new GetStreamingDistributionConfigRequestMarshaller().marshall(getStreamingDistributionConfigRequest); return invoke(request, new GetStreamingDistributionConfigResultStaxUnmarshaller()); } /** * <p> * Update a streaming distribution. * </p> * * @param updateStreamingDistributionRequest Container for the necessary * parameters to execute the UpdateStreamingDistribution service method * on AmazonCloudFront. * * @return The response from the UpdateStreamingDistribution service * method, as returned by AmazonCloudFront. * * @throws TooManyTrustedSignersException * @throws InvalidIfMatchVersionException * @throws IllegalUpdateException * @throws MissingBodyException * @throws NoSuchStreamingDistributionException * @throws TooManyStreamingDistributionCNAMEsException * @throws PreconditionFailedException * @throws AccessDeniedException * @throws CNAMEAlreadyExistsException * @throws InvalidArgumentException * @throws InvalidOriginAccessIdentityException * @throws TrustedSignerDoesNotExistException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public UpdateStreamingDistributionResult updateStreamingDistribution(UpdateStreamingDistributionRequest updateStreamingDistributionRequest) throws AmazonServiceException, AmazonClientException { Request<UpdateStreamingDistributionRequest> request = new UpdateStreamingDistributionRequestMarshaller().marshall(updateStreamingDistributionRequest); return invoke(request, new UpdateStreamingDistributionResultStaxUnmarshaller()); } /** * <p> * List streaming distributions. * </p> * * @param listStreamingDistributionsRequest Container for the necessary * parameters to execute the ListStreamingDistributions service method on * AmazonCloudFront. * * @return The response from the ListStreamingDistributions service * method, as returned by AmazonCloudFront. * * @throws InvalidArgumentException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public ListStreamingDistributionsResult listStreamingDistributions(ListStreamingDistributionsRequest listStreamingDistributionsRequest) throws AmazonServiceException, AmazonClientException { Request<ListStreamingDistributionsRequest> request = new ListStreamingDistributionsRequestMarshaller().marshall(listStreamingDistributionsRequest); return invoke(request, new ListStreamingDistributionsResultStaxUnmarshaller()); } /** * <p> * Get the configuration information about an origin access identity. * </p> * * @param getCloudFrontOriginAccessIdentityConfigRequest Container for * the necessary parameters to execute the * GetCloudFrontOriginAccessIdentityConfig service method on * AmazonCloudFront. * * @return The response from the GetCloudFrontOriginAccessIdentityConfig * service method, as returned by AmazonCloudFront. * * @throws NoSuchCloudFrontOriginAccessIdentityException * @throws AccessDeniedException * * @throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response. For example * if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonCloudFront indicating * either a problem with the data in the request, or a server side issue. */ public GetCloudFrontOriginAccessIdentityConfigResult getCloudFrontOriginAccessIdentityConfig(GetCloudFrontOriginAccessIdentityConfigRequest getCloudFrontOriginAccessIdentityConfigRequest) throws AmazonServiceException, AmazonClientException { Request<GetCloudFrontOriginAccessIdentityConfigRequest> request = new GetCloudFrontOriginAccessIdentityConfigRequestMarshaller().marshall(getCloudFrontOriginAccessIdentityConfigRequest); return invoke(request, new GetCloudFrontOriginAccessIdentityConfigResultStaxUnmarshaller()); } /** * Returns additional metadata for a previously executed successful, request, typically used for * debugging issues where a service isn't acting as expected. This data isn't considered part * of the result data returned by an operation, so it's available through this separate, * diagnostic interface. * <p> * Response metadata is only cached for a limited period of time, so if you need to access * this extra diagnostic information for an executed request, you should use this method * to retrieve it as soon as possible after executing the request. * * @param request * The originally executed request * * @return The response metadata for the specified request, or null if none * is available. */ public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) { return client.getResponseMetadataForRequest(request); } private <X, Y extends AmazonWebServiceRequest> X invoke(Request<Y> request, Unmarshaller<X, StaxUnmarshallerContext> unmarshaller) { request.setEndpoint(endpoint); for (Entry<String, String> entry : request.getOriginalRequest().copyPrivateRequestParameters().entrySet()) { request.addParameter(entry.getKey(), entry.getValue()); } AWSCredentials credentials = awsCredentialsProvider.getCredentials(); AmazonWebServiceRequest originalRequest = request.getOriginalRequest(); if (originalRequest != null && originalRequest.getRequestCredentials() != null) { credentials = originalRequest.getRequestCredentials(); } ExecutionContext executionContext = createExecutionContext(); executionContext.setSigner(signer); executionContext.setCredentials(credentials); StaxResponseHandler<X> responseHandler = new StaxResponseHandler<X>(unmarshaller); DefaultErrorResponseHandler errorResponseHandler = new DefaultErrorResponseHandler(exceptionUnmarshallers); return (X)client.execute(request, responseHandler, errorResponseHandler, executionContext); } }
[ "aws-dr-tools@amazon.com" ]
aws-dr-tools@amazon.com
4cf0cde64defb1a088450f5d09dc90e132a7ddb4
529a045dce4d15abc0a559f5256b91704eb5abdc
/workspace/src/lotto/LottoPro.java
7241e67898d86488bc9704da1a1bbe5ca4bf4dfc
[]
no_license
commin0813/platform
5b21bf17bc542278247d5a36b08d790768665163
4227b15ead3f3ee43b2142ff7f493bf6b7ecab31
refs/heads/master
2020-05-21T08:41:53.393376
2017-05-30T01:33:25
2017-05-30T01:33:25
64,712,190
0
0
null
null
null
null
UTF-8
Java
false
false
2,254
java
package lotto; public class LottoPro { // developed by commin// // Lotto Program // // ver 1.0.0 // // 2016.11.21 // // 전역 변수 private boolean duplicate = false; private boolean can_bonus; private int[] numbers; public LottoPro() { System.out.println("(System)보너스추첨은 불가합니다."); can_bonus = false; } public LottoPro(boolean can_bonus) { System.out.println("(System)보너스추첨도 가능합니다."); this.can_bonus = can_bonus; } public void printNumber(){ if(numbers==null||numbers[0]==0){ System.out.println("(System)Empty Value"); return; } for(int i=0;i<numbers.length;i++){ if(i==6){ System.out.println("(BONUS)>>>"+numbers[i]); }else{ System.out.println(">>>"+numbers[i]); } } } public int[] start_recommandation() { if (can_bonus) { numbers = new int[7]; } else { numbers = new int[6]; } int [] imsi=getNormalNumber(); for (int i = 0; i < numbers.length; i++) { if (i == 6) { numbers[i] =getBounusNumber(numbers); } else { numbers[i] = imsi[i]; } } return numbers; } private int getBounusNumber(int[] normal_number) { int bonus = 0; int imsi = 0; while (true) { imsi = (int) (Math.random() * 45 + 1); for (int j = 0; j < normal_number.length; j++) { if (normal_number[j] == imsi) { duplicate = true; } } if (duplicate) { duplicate = false; continue; } else { break; } } bonus = imsi; System.out.println("(System)Success Create Bonus Number"); return bonus; } private int[] getNormalNumber() { int[] normal_number = new int[6]; int imsi = 0; for (int i = 0; i < normal_number.length; i++) { imsi = (int) (Math.random() * 45 + 1);// random 함수는 0.0~ 0.999...까지 랜덤으로 난수를 생성하는 함수입니다. for (int j = 0; j < i; j++) { if (normal_number[j] == imsi) { duplicate = true; } } if (!duplicate) { normal_number[i] = imsi; } else { duplicate = false; i--; } } System.out.println("(System)Success Create Normal Number"); return normal_number; } }
[ "commin0813@gmail.com" ]
commin0813@gmail.com
7a3fd1234fe749c792e6db8cec85e1576e40f03e
fc2daa3b96a8987aa46d328f518bfa329be8a6c0
/xqls/src/main/java/com/xqls/dal/service/RolePermissionDetailMapper.java
26494220643ff6188804a100ba4a9307c23eb995
[]
no_license
ufoet0715/Skeye
d8a35eedd8ebb12525cb72d876b24165f31935bf
58069bf871bdb4f37b2c47755f55058fba338241
refs/heads/master
2021-01-21T11:01:06.831483
2017-03-04T09:56:40
2017-03-04T09:56:40
83,518,007
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package com.xqls.dal.service; import java.util.List; import java.util.Map; import com.xqls.dal.model.RolePermissionDetail; public interface RolePermissionDetailMapper { List<RolePermissionDetail> getListByMap(Map<String,Object> map); }
[ "ufoet0715@163.com" ]
ufoet0715@163.com
a8bde6b3e5dbbb8b4ee2464b43f3470b3d7a5951
b4f26885e77e581d406f63cee1d04fb7feedc6b1
/EmpSSM/src/main/java/nsu/edu/cn/zsq/test/MBGTest.java
f9d8e570620782009ed62edae337bd05d91824f0
[]
no_license
0Zarathustra0/EmpSSM
bcdb70dc0deb5f1c04574abb8dd2fa462af554aa
291f3c4462c5a780a4105104249e54a9c249d2e6
refs/heads/master
2020-03-12T05:00:46.958710
2018-11-05T08:25:02
2018-11-05T08:25:02
130,442,606
0
0
null
null
null
null
UTF-8
Java
false
false
994
java
package nsu.edu.cn.zsq.test; import java.io.File; import java.util.ArrayList; import java.util.List; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.internal.DefaultShellCallback; /** * @author zhangshuqiang <br> * @version 2018年4月21日 下午3:52:59 <br> * 生成mybatis映射文件 */ public class MBGTest { public static void main(String[] args) throws Exception { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File("mbg.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } }
[ "1915744914@qq.com" ]
1915744914@qq.com
4a7a911f148a95e2978f4b8b9a16727092751b73
0249151b2a494938a008f6cd1e842bca6799139b
/app/src/androidTest/java/com/example/instagram_clone/ExampleInstrumentedTest.java
44bb66634b5722df93a853d01624e0d21673bf04
[ "Apache-2.0" ]
permissive
mtkhawaja/Instagram_Clone
50e5b146274e98301d8421780eee7a96ec8adc1e
0ea2064157d155806a442a01cfe9601185c50f12
refs/heads/master
2021-06-25T09:57:12.346326
2021-01-20T03:51:29
2021-01-20T03:51:29
177,512,137
0
0
null
2021-01-20T03:51:30
2019-03-25T04:06:53
Java
UTF-8
Java
false
false
738
java
package com.example.instagram_clone; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.instagram_clone", appContext.getPackageName()); } }
[ "36654508+mtkhawaja@users.noreply.github.com" ]
36654508+mtkhawaja@users.noreply.github.com
feaba2012a7ed234a6ce5d23359a6930361084db
d5fe47a125fe59dea63aef684d3b66a69e32d065
/ly-order/ly-order-interface/src/main/java/com/leyou/order/pojo/OrderStatus.java
8aecba6cbc1fb98a76250c3dc1f6b11043a4f85f
[]
no_license
delicatebaby99/leyou
62e79aaf1061ea2c573dcca061549148236b4a4a
d0670f6ef4be767c2a0fc9ee14a3f72033f8d519
refs/heads/master
2023-01-18T17:19:08.542078
2020-11-23T08:16:04
2020-11-23T08:16:04
314,478,208
1
0
null
null
null
null
UTF-8
Java
false
false
1,176
java
package com.leyou.order.pojo; import lombok.Data; import javax.persistence.Id; import javax.persistence.Table; import java.util.Date; /** * date:2020-10-22 * author:zhangxiaoshuai */ @Data @Table(name = "tb_order_status") public class OrderStatus { /** * 初始阶段:1、未付款、未发货;初始化所有数据 * 付款阶段:2、已付款、未发货;更改付款时间 * 发货阶段:3、已发货,未确认;更改发货时间、物流名称、物流单号 * 成功阶段:4、已确认,未评价;更改交易结束时间 * 关闭阶段:5、关闭; 更改更新时间,交易关闭时间。 * 评价阶段:6、已评价 */ @Id private Long orderId; private Integer status; /** * 创建时间 */ private Date createTime; /** * 付款时间 */ private Date paymentTime; /** * 发货时间 */ private Date consignTime; /** * 交易结束时间 */ private Date endTime; /** * 交易关闭时间 */ private Date closeTime; /** * 评价时间 */ private Date commentTime; }
[ "2097230692@qq.com" ]
2097230692@qq.com
7a3ab3b2582357fdb151a9edae4254536c065263
bb31abd2a7f8b0f58a117d68bb9595f18d0ab620
/MyJavaWorkShop10/src/com/test2/Sample02.java
0353515470d68da7ce2422fa3382e3ca04b87339
[]
no_license
doyongsung/Java
d17fda36e9c3b45d25cdfd43ac13db2d9be3f418
22efff99b4d40d056767662c7d47eed158a02248
refs/heads/master
2023-05-07T15:05:57.230557
2021-05-21T10:47:58
2021-05-21T10:47:58
366,378,987
0
0
null
null
null
null
UHC
Java
false
false
600
java
package com.test2; import java.io.IOException; public class Sample02 { void method1() throws IOException{//throws Exception{ //throw(s) Exception ex)에러를 다음으로 넘김 오류가연속으로 나올때 // try { // int a = 10/0; throw new IOException(); //throw // }catch(Exception ex) { // } // } // void method2() throws IOException { // method1(); // } // void method3() { // method2(); // } // // public static void main(String[] args) { // Sample02 obj = new Sample02(); // try { // obj.method3(); // }catch(Exception ex) { // System.out.println("Exit"); // } } }
[ "ppelpp@naver.com" ]
ppelpp@naver.com
60a000a7e9b75b8fb2421dcadf9957959099d748
a7ea1958846646794d1c2b8f124a775f8bff3382
/BACK END/src/main/java/com/ecommerce/shoes/entity/User.java
53df9a74ea28dd88fca4ac444053e02ba4b59cd8
[]
no_license
devphan/E-Commerce-Shoes
554fcf5b9e4a6a6e31bf01abb8ad3aadb27d1c4a
9ee265ab0f6f4b599fc7f30a71e1dbd1be24e27e
refs/heads/main
2023-04-05T21:22:18.412869
2021-04-28T08:17:36
2021-04-28T08:17:36
359,373,345
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
package com.ecommerce.shoes.entity; import com.sun.istack.NotNull; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; @NoArgsConstructor @AllArgsConstructor @Getter @Setter @Entity @Table(name = "User") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @NotNull @Column(unique = true) private String email; @Column(name = "full_name") private String name; @Column(length = 10) private String phone; @Column private String password; @Column(name = "role", nullable = false, columnDefinition = "varchar(255) default 'USER'") private String role; }
[ "longphan12062001@gmail.com" ]
longphan12062001@gmail.com
95c81b5b2b9f2902281d4a89e9e3eff81032fc2f
f890f96b050919c100176dbe5354488139f39446
/Architect_Day05/butterknife/src/test/java/com/butterknife/ExampleUnitTest.java
3e57c7fe331849f2e4ab6d27787138d9c14eca34
[]
no_license
zmMyp/myButterKnife
40c32bf3cdbce12d49f2ee1af2b23555a98f557c
58ffa5623489ac16cfbb5e79d644cf9595d1207e
refs/heads/master
2020-05-16T01:20:53.089087
2019-04-22T01:16:23
2019-04-22T01:16:23
182,600,553
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package com.butterknife; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "969308461@qq.com" ]
969308461@qq.com
a3a4cceb5979db46529633cd2b45575e47042d6d
9042e1627059aadac870f9d142e89e18031eb61c
/fettuccine/graphics/RenderData.java
5b9cec2b0705d9fcf5bdc7438314c14e3d363436
[ "Apache-2.0" ]
permissive
TheMonsterFromTheDeep/Fellowship
0d5870065dd9d8860fd702afb59593df169d2e3d
377f5af59d0bae262254140d444b75e4f7956dfa
refs/heads/master
2016-08-12T11:29:28.438918
2016-04-18T22:42:04
2016-04-18T22:42:04
47,946,963
0
0
null
null
null
null
UTF-8
Java
false
false
1,545
java
package fettuccine.graphics; /** * Stores data about a screen being rendered. A RenderData class holds methods * to recalculate offsets and other values used for rendering a scaled canvas of * a fixed ratio inside a larger screen.<br /><br /> * * A RenderData can be passed directly to a Renderer when rendering. * @author TheMonsterFromTheDeep */ public class RenderData { public int canvasWidth, canvasHeight; public int renderWidth, renderHeight; public int renderX, renderY; public double scaleX, scaleY; public RenderData(int dw, int dh) { renderWidth = canvasWidth = dw; renderHeight = canvasHeight = dh; renderX = 0; renderY = 0; scaleX = scaleY = 1; } public void recalculate(int windowWidth, int windowHeight) { double YXRatio = (double)canvasHeight / canvasWidth; double XYRatio = (double)canvasWidth / canvasHeight; if(windowWidth < (windowHeight * XYRatio)) { renderWidth = windowWidth; renderHeight = (int)(windowWidth * YXRatio); renderX = 0; renderY = (int)Math.floor((windowHeight - renderHeight) / 2); } else { renderWidth = (int)(windowHeight * XYRatio); renderHeight = windowHeight; renderX = (int)Math.floor((windowWidth - renderWidth) / 2); renderY = 0; } scaleX = (double)renderWidth / canvasWidth; scaleY = (double)renderHeight / canvasHeight; } }
[ "themonsterfromthedeep@gmail.com" ]
themonsterfromthedeep@gmail.com
c72aeaab7ac107272094d5e60fe4bb7571345aa0
4aa3d51c7c6d6c6d8707f90d7e3138177a2708fe
/ViewShed/src/java/database/DatabaseErrorLogManager.java
34d01d51d80bffa2fd1ca09fac3ebef81c1d96a6
[]
no_license
Neocyte/Viewshed-Viewer
eff2c838d26ca52281b3aacdb2fcaae21353e2bb
c098606ec9fa361029670e24d64a7da1c0a69b31
refs/heads/master
2023-05-30T20:49:31.152318
2021-06-09T17:16:41
2021-06-09T17:16:41
375,404,811
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
package database; import common.ErrorLog; import java.util.Collection; /** * * @author Curt Jones */ public interface DatabaseErrorLogManager { public Collection<ErrorLog> getAllErrorLogs(); public String getAllErrorLogsAsHTMLTable(); public void addErrorLog(ErrorLog errorLog); public ErrorLog getErrorLogByID(int id); public void deleteErrorLog(int id); public void deleteAllErrorLogs(); }
[ "masonwu8462@yahoo.com" ]
masonwu8462@yahoo.com
04ee22136d60052880b88f3ed54c9dd9b18d7868
b5e0efc45d5502177268483397a031475b672bd5
/s4e-backend/src/test/java/pl/cyfronet/s4e/controller/AuthControllerTest.java
2f7a459684df92ad9ab97732be1690fcd62785a6
[ "Apache-2.0" ]
permissive
cyfronet-fid/sat4envi
8f9a08a924362e751c2cf5f5a06f97ffd8988620
02908e9d457a4f1f4f6356760268142e178b4554
refs/heads/master
2022-08-21T11:25:50.424798
2022-07-06T12:48:02
2022-07-08T08:41:59
149,281,301
2
2
Apache-2.0
2022-07-08T08:42:00
2018-09-18T12:01:10
Java
UTF-8
Java
false
false
11,737
java
/* * Copyright 2020 ACC Cyfronet AGH * * 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 * * https://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 pl.cyfronet.s4e.controller; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.val; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.http.MediaType; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.test.context.TestPropertySource; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultMatcher; import pl.cyfronet.s4e.BasicTest; import pl.cyfronet.s4e.TestDbHelper; import pl.cyfronet.s4e.bean.AppUser; import pl.cyfronet.s4e.controller.request.LoginRequest; import pl.cyfronet.s4e.data.repository.AppUserRepository; import pl.cyfronet.s4e.security.SecurityConstants; import static org.hamcrest.Matchers.*; import static org.springframework.test.web.servlet.ResultMatcher.matchAll; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import static pl.cyfronet.s4e.Constants.API_PREFIX_V1; @AutoConfigureMockMvc @BasicTest class AuthControllerTest { /// Constant in all our tokens. private static final String JWT_ALG_PREFIX = "eyJhbGciOiJSUzI1NiJ9"; private static final String TOKEN_COOKIE = SecurityConstants.COOKIE_NAME; private static final String TEST_HOST = "test-host:1234"; private static final String TEST_HOST_DOMAIN = "test-host"; @Autowired private AppUserRepository appUserRepository; @Autowired private PasswordEncoder passwordEncoder; @Autowired private ObjectMapper objectMapper; @Autowired private TestDbHelper testDbHelper; @Autowired private MockMvc mockMvc; @BeforeEach public void beforeEach() { testDbHelper.clean(); } @Test public void tokenShouldReturnJWS() throws Exception { val appUser = appUserRepository.save(appUser(true)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/token") .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isOk()) .andExpect(jsonPath("email", is(equalTo("some@email.com")))) .andExpect(jsonPath("token", startsWith(JWT_ALG_PREFIX))); } @Test public void tokenShouldReturn403ForDisabledAccount() throws Exception { val appUser = appUserRepository.save(appUser(false)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/token") .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isForbidden()); } @Test public void tokenShouldReturn401ForIncorrectCredentials() throws Exception { val appUser = appUserRepository.save(appUser(true)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("incorrectPassword") .build(); mockMvc.perform(post(API_PREFIX_V1+"/token") .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isUnauthorized()); } @Test public void tokenShouldReturn401ForNonexistentAccount() throws Exception { val loginRequest = LoginRequest.builder() .email("does@not.exist") .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/token") .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isUnauthorized()); } @Test public void loginShouldSetCookie() throws Exception { val appUser = appUserRepository.save(appUser(true)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/login") .header("Host", TEST_HOST) .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isOk()) .andExpect(content().string(is(emptyOrNullString()))) .andExpect(setsCookie(TEST_HOST_DOMAIN)); } @Test public void loginShouldSetCookieWithXForwardedHost() throws Exception { val appUser = appUserRepository.save(appUser(true)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/login") .header("Host", TEST_HOST) .header("X-Forwarded-Host", "original-host") .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isOk()) .andExpect(content().string(is(emptyOrNullString()))) .andExpect(setsCookie("original-host")); } @Test public void loginShouldReturn403ForDisabledAccount() throws Exception { val appUser = appUserRepository.save(appUser(false)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/login") .header("Host", TEST_HOST) .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isForbidden()); } @Test public void loginShouldReturn401ForIncorrectCredentials() throws Exception { val appUser = appUserRepository.save(appUser(true)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("incorrectPassword") .build(); mockMvc.perform(post(API_PREFIX_V1+"/login") .header("Host", TEST_HOST) .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isUnauthorized()); } @Test public void loginShouldReturn401ForNonexistentAccount() throws Exception { val loginRequest = LoginRequest.builder() .email("does@not.exist") .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/login") .header("Host", TEST_HOST) .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isUnauthorized()); } @Test public void logoutShouldResetCookie() throws Exception { mockMvc.perform(post(API_PREFIX_V1+"/logout") .header("Host", TEST_HOST) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string(is(emptyOrNullString()))) .andExpect(unsetsCookie(TEST_HOST_DOMAIN)); } @Test public void logoutShouldResetCookieWithXForwardedHost() throws Exception { mockMvc.perform(post(API_PREFIX_V1+"/logout") .header("Host", TEST_HOST) .header("X-Forwarded-Host", "original-host") .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string(is(emptyOrNullString()))) .andExpect(unsetsCookie("original-host")); } @Nested @TestPropertySource(properties = { "jwt.cookie.domain=other-domain" }) class WithCookieDomainProperty { // For some reason, the set property isn't propagated to the mockMvc from an enclosing class, // but works when it's moved here. @Autowired private MockMvc mockMvc; @Test public void loginShouldSetCookie() throws Exception { val appUser = appUserRepository.save(appUser(true)); val loginRequest = LoginRequest.builder() .email(appUser.getEmail()) .password("password") .build(); mockMvc.perform(post(API_PREFIX_V1+"/login") .header("Host", TEST_HOST) .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsBytes(loginRequest))) .andExpect(status().isOk()) .andExpect(content().string(is(emptyOrNullString()))) .andExpect(setsCookie("other-domain")); } @Test public void logoutShouldResetCookie() throws Exception { mockMvc.perform(post(API_PREFIX_V1+"/logout") .header("Host", TEST_HOST) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string(is(emptyOrNullString()))) .andExpect(unsetsCookie("other-domain")); } } private ResultMatcher setsCookie(String expectedDomain) { return matchAll( cookie().value(TOKEN_COOKIE, startsWith(JWT_ALG_PREFIX)), cookie().httpOnly(TOKEN_COOKIE, true), cookie().path(TOKEN_COOKIE, "/"), cookie().secure(TOKEN_COOKIE, true), cookie().maxAge(TOKEN_COOKIE, greaterThan(0)), cookie().domain(TOKEN_COOKIE, expectedDomain) ); } private ResultMatcher unsetsCookie(String expectedDomain) { return matchAll( cookie().value(TOKEN_COOKIE, is(emptyOrNullString())), cookie().httpOnly(TOKEN_COOKIE, true), cookie().path(TOKEN_COOKIE, "/"), cookie().secure(TOKEN_COOKIE, true), cookie().maxAge(TOKEN_COOKIE, 0), // resets cookie cookie().domain(TOKEN_COOKIE, expectedDomain) ); } private AppUser appUser(boolean enabled) { return AppUser.builder() .email("some@email.com") .name("Name") .surname("Surname") .password(passwordEncoder.encode("password")) .enabled(enabled) .build(); } }
[ "jswk@users.noreply.github.com" ]
jswk@users.noreply.github.com
dbfd0ac18fd6e4f8aa256dfe2854a1a3d8221a31
210500e6df8862f9b4531e84d25f925a3bf0fd58
/ll-javaUtils/src/main/java/gov/va/med/lom/javaUtils/xml/HashMapNamedNodeMap.java
2dc7669108882e94fdf752da8af446061d6b269e
[ "Apache-2.0" ]
permissive
merwinn/AVS
e1db56e48dc9432e1f73f5043e96749b4799f6fd
51f3316586059210d3d8a0a9d1761fed4b9b1826
refs/heads/master
2020-05-21T09:14:58.372161
2014-08-18T18:57:06
2014-08-18T18:57:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package gov.va.med.lom.javaUtils.xml; import java.util.ArrayList; import java.util.HashMap; import org.w3c.dom.Node; /* * A class representing a node in a meta-data tree, which implements * the org.w3c.dom.NamedNodeMap */ class HashMapNamedNodeMap extends NamedNodeMapImpl { /* * HashMap of Node items. */ HashMap hNodes; /* * Constructs a HashMapNamedNodeMap from the given HashMap. */ public HashMapNamedNodeMap(HashMap nodes) { super(new ArrayList(nodes.values())); this.hNodes = nodes; } /* * Returns the items count. */ public int getLength() { return hNodes.size(); } /* * Returns the Node item with the given name. */ public Node getNamedItem(String name) { return (Node) hNodes.get(name); } }
[ "william.collins@va.gov" ]
william.collins@va.gov
fac68fd87a321b3e495a118141e30d7c5fe51a0b
8a6453cd49949798c11f57462d3f64a1fa2fc441
/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/UpdateServiceActionResult.java
dc0c47192edfa986da8d37ef279ea01509f2f517
[ "Apache-2.0" ]
permissive
tedyu/aws-sdk-java
138837a2be45ecb73c14c0d1b5b021e7470520e1
c97c472fd66d7fc8982cb4cf3c4ae78de590cfe8
refs/heads/master
2020-04-14T14:17:28.985045
2019-01-02T21:46:53
2019-01-02T21:46:53
163,892,339
0
0
Apache-2.0
2019-01-02T21:38:39
2019-01-02T21:38:39
null
UTF-8
Java
false
false
4,172
java
/* * Copyright 2013-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.servicecatalog.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdateServiceAction" target="_top">AWS * API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class UpdateServiceActionResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * Detailed information about the self-service action. * </p> */ private ServiceActionDetail serviceActionDetail; /** * <p> * Detailed information about the self-service action. * </p> * * @param serviceActionDetail * Detailed information about the self-service action. */ public void setServiceActionDetail(ServiceActionDetail serviceActionDetail) { this.serviceActionDetail = serviceActionDetail; } /** * <p> * Detailed information about the self-service action. * </p> * * @return Detailed information about the self-service action. */ public ServiceActionDetail getServiceActionDetail() { return this.serviceActionDetail; } /** * <p> * Detailed information about the self-service action. * </p> * * @param serviceActionDetail * Detailed information about the self-service action. * @return Returns a reference to this object so that method calls can be chained together. */ public UpdateServiceActionResult withServiceActionDetail(ServiceActionDetail serviceActionDetail) { setServiceActionDetail(serviceActionDetail); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getServiceActionDetail() != null) sb.append("ServiceActionDetail: ").append(getServiceActionDetail()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof UpdateServiceActionResult == false) return false; UpdateServiceActionResult other = (UpdateServiceActionResult) obj; if (other.getServiceActionDetail() == null ^ this.getServiceActionDetail() == null) return false; if (other.getServiceActionDetail() != null && other.getServiceActionDetail().equals(this.getServiceActionDetail()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getServiceActionDetail() == null) ? 0 : getServiceActionDetail().hashCode()); return hashCode; } @Override public UpdateServiceActionResult clone() { try { return (UpdateServiceActionResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
4b6c6f5ddbd848b07826b461f9b6af8c12e81c9e
a8dedf48a44006b0dfe44725ce56545759a23c99
/src/main/java/com/bambini/ProductStoreApp.java
20413443e9aacb5e1a68d0ec684abb6466f8bc35
[]
no_license
pepo42/products-store
b03edf414c1ad811e42cf1bedc78bd59e64ade06
e947f65d89cee80108e1ba7806d416116c342a4b
refs/heads/master
2020-03-28T13:48:19.461959
2018-09-16T17:40:51
2018-09-16T17:40:51
148,430,416
0
0
null
null
null
null
UTF-8
Java
false
false
402
java
package com.bambini; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProductStoreApp { // Creates everything for free (servlets, containers...) // Standalone application public static void main(String[] args) { SpringApplication.run(ProductStoreApp.class, args); } }
[ "elponja_tandil@hotmail.com" ]
elponja_tandil@hotmail.com
e31593f03a385898764fda0f1c0b5e0655159053
15ae8d4bd9e1085e0ba7a54beae2f0c126a2dce4
/src/codingInterviewGuide/part3tree/TraverseTree.java
9b4bc28b2b5a18f0a0ff83569377022ba5743eae
[]
no_license
qdh0520/Algorithm
aae9cc61cc020ba371afe4e638bdb5bff11150cf
40f626d95eb877005149631d4ffc228b2829cc89
refs/heads/master
2020-07-06T12:23:23.300710
2019-09-19T14:50:29
2019-09-19T14:50:29
203,016,025
1
0
null
2019-08-18T14:32:46
2019-08-18T14:32:45
null
UTF-8
Java
false
false
1,875
java
package codingInterviewGuide.part3tree; import java.util.Stack; /** * 非递归实现遍历二叉树 * Created by Dell on 2017-09-03. */ public class TraverseTree { public void preOrder(TreeNode root){ Stack<TreeNode> stack=new Stack<TreeNode>(); TreeNode cur=null; stack.add(root); while(!stack.isEmpty()){ cur=stack.pop(); System.out.print(cur.val+" "); if(cur.right!=null){stack.add(cur.right);} if(cur.left!=null){stack.add(cur.left);} } } public void in(TreeNode root){ if(root==null){ return; } in(root.left); System.out.println(root.val+" "); in(root.right); } public void inOrder(TreeNode root){ if(root==null){ return; } Stack<TreeNode> stack=new Stack<TreeNode>(); stack.add(root); TreeNode cur=root.left;//cur指向栈顶的左孩子 while(cur!=null||!stack.isEmpty()){//压栈的顺序是左,右,根, if(cur==null){ cur=stack.pop(); System.out.print(cur.val+" "); cur=cur.right; }else{ stack.add(cur); cur=cur.left; } } } public void postOrder(TreeNode root){ if(root==null){ return; } Stack<TreeNode> stack=new Stack<TreeNode>(); stack.add(root); TreeNode cur=root.left;//cur指向栈顶的左孩子 while(cur!=null||!stack.isEmpty()){//压栈的顺序是左,右,根, if(cur==null){ cur=stack.pop(); System.out.print(cur.val+" "); cur=cur.right; }else{ stack.add(cur); } } } }
[ "18103412880@163.com" ]
18103412880@163.com
fd10121fd99da5a9b4ead7ad5726c840fba92db7
8ec9e03f427cf06b186e1f9e724762539f8a9156
/LemmeTravel/app/src/main/java/com/lemmetravel/seniorproject/fragments/myArticleFragment.java
80c6dad53a42511ed90aefaf143c5d8f424c847f
[]
no_license
thanapa049/Lemme-Travel
2c3e363b7d39ab95d89e2f7eec4551dc13e61182
fe687fcc83ea08b4439ee5af7503a0adb4230fcf
refs/heads/master
2021-01-18T07:48:39.274070
2017-10-19T14:22:29
2017-10-19T14:22:29
100,352,757
0
1
null
null
null
null
UTF-8
Java
false
false
783
java
package com.lemmetravel.seniorproject.fragments; import android.content.Context; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.lemmetravel.seniorproject.R; public class myArticleFragment extends Fragment { public myArticleFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootview = inflater.inflate(R.layout.fragment_my_article, container, false); return rootview; } }
[ "nui_pk48@hotmail.com" ]
nui_pk48@hotmail.com
5ea11ae37008230f7f3eed7e123f255fd25e82fb
1e147f7417a43d08defd98eb8820db3c263dc337
/src/com/lewa/player/MediaPlaybackActivity.java
e57defa2c4e173245cf2ff9af9041c68765a24a0
[]
no_license
chongbo2013/My-MusicPlayer
bd512b15ef2f0a60eb0645352cc1885b4596f97a
3ba0356418c3d27da5f0e80e3853593c8e4ad6fe
refs/heads/master
2021-05-29T20:23:49.054045
2015-08-25T06:14:23
2015-08-25T06:14:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
51,589
java
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.lewa.player; import android.app.Activity; import android.app.AlertDialog; import android.app.KeyguardManager; import android.app.SearchManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentUris; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.res.Configuration; import android.database.Cursor; import android.graphics.Bitmap; import android.media.AudioManager; import android.media.audiofx.AudioEffect; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.os.SystemClock; import android.provider.MediaStore; import android.text.Layout; import android.text.TextUtils.TruncateAt; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.SubMenu; import android.view.View; import android.view.ViewConfiguration; import android.view.Window; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; import android.widget.Toast; import com.lewa.player.MusicUtils.ServiceToken; public class MediaPlaybackActivity extends Activity implements MusicUtils.Defs, View.OnTouchListener, View.OnLongClickListener { private static final int USE_AS_RINGTONE = CHILD_MENU_BASE; private boolean mSeeking = false; private boolean mDeviceHasDpad; private long mStartSeekPos = 0; private long mLastSeekEventTime; private IMediaPlaybackService mService = null; private RepeatingImageButton mPrevButton; private ImageButton mPauseButton; private RepeatingImageButton mNextButton; private ImageButton mRepeatButton; private ImageButton mShuffleButton; private ImageButton mQueueButton; private Worker mAlbumArtWorker; private AlbumArtHandler mAlbumArtHandler; private Toast mToast; private int mTouchSlop; private ServiceToken mToken; public MediaPlaybackActivity() { } /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setVolumeControlStream(AudioManager.STREAM_MUSIC); mAlbumArtWorker = new Worker("album art worker"); mAlbumArtHandler = new AlbumArtHandler(mAlbumArtWorker.getLooper()); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.audio_player); mCurrentTime = (TextView) findViewById(R.id.currenttime); mTotalTime = (TextView) findViewById(R.id.totaltime); mProgress = (ProgressBar) findViewById(android.R.id.progress); mAlbum = (ImageView) findViewById(R.id.album); mArtistName = (TextView) findViewById(R.id.artistname); mAlbumName = (TextView) findViewById(R.id.albumname); mTrackName = (TextView) findViewById(R.id.trackname); View v = (View)mArtistName.getParent(); v.setOnTouchListener(this); v.setOnLongClickListener(this); v = (View)mAlbumName.getParent(); v.setOnTouchListener(this); v.setOnLongClickListener(this); v = (View)mTrackName.getParent(); v.setOnTouchListener(this); v.setOnLongClickListener(this); mPrevButton = (RepeatingImageButton) findViewById(R.id.prev); mPrevButton.setOnClickListener(mPrevListener); mPrevButton.setRepeatListener(mRewListener, 260); mPauseButton = (ImageButton) findViewById(R.id.pause); mPauseButton.requestFocus(); mPauseButton.setOnClickListener(mPauseListener); mNextButton = (RepeatingImageButton) findViewById(R.id.next); mNextButton.setOnClickListener(mNextListener); mNextButton.setRepeatListener(mFfwdListener, 260); seekmethod = 1; mDeviceHasDpad = (getResources().getConfiguration().navigation == Configuration.NAVIGATION_DPAD); mQueueButton = (ImageButton) findViewById(R.id.curplaylist); mQueueButton.setOnClickListener(mQueueListener); mShuffleButton = ((ImageButton) findViewById(R.id.shuffle)); mShuffleButton.setOnClickListener(mShuffleListener); mRepeatButton = ((ImageButton) findViewById(R.id.repeat)); mRepeatButton.setOnClickListener(mRepeatListener); if (mProgress instanceof SeekBar) { SeekBar seeker = (SeekBar) mProgress; seeker.setOnSeekBarChangeListener(mSeekListener); } mProgress.setMax(1000); mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop(); } int mInitialX = -1; int mLastX = -1; int mTextWidth = 0; int mViewWidth = 0; boolean mDraggingLabel = false; TextView textViewForContainer(View v) { View vv = v.findViewById(R.id.artistname); if (vv != null) return (TextView) vv; vv = v.findViewById(R.id.albumname); if (vv != null) return (TextView) vv; vv = v.findViewById(R.id.trackname); if (vv != null) return (TextView) vv; return null; } public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); TextView tv = textViewForContainer(v); if (tv == null) { return false; } if (action == MotionEvent.ACTION_DOWN) { v.setBackgroundColor(0xff606060); mInitialX = mLastX = (int) event.getX(); mDraggingLabel = false; } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { v.setBackgroundColor(0); if (mDraggingLabel) { Message msg = mLabelScroller.obtainMessage(0, tv); mLabelScroller.sendMessageDelayed(msg, 1000); } } else if (action == MotionEvent.ACTION_MOVE) { if (mDraggingLabel) { int scrollx = tv.getScrollX(); int x = (int) event.getX(); int delta = mLastX - x; if (delta != 0) { mLastX = x; scrollx += delta; if (scrollx > mTextWidth) { // scrolled the text completely off the view to the left scrollx -= mTextWidth; scrollx -= mViewWidth; } if (scrollx < -mViewWidth) { // scrolled the text completely off the view to the right scrollx += mViewWidth; scrollx += mTextWidth; } tv.scrollTo(scrollx, 0); } return true; } int delta = mInitialX - (int) event.getX(); if (Math.abs(delta) > mTouchSlop) { // start moving mLabelScroller.removeMessages(0, tv); // Only turn ellipsizing off when it's not already off, because it // causes the scroll position to be reset to 0. if (tv.getEllipsize() != null) { tv.setEllipsize(null); } Layout ll = tv.getLayout(); // layout might be null if the text just changed, or ellipsizing // was just turned off if (ll == null) { return false; } // get the non-ellipsized line width, to determine whether scrolling // should even be allowed mTextWidth = (int) tv.getLayout().getLineWidth(0); mViewWidth = tv.getWidth(); if (mViewWidth > mTextWidth) { tv.setEllipsize(TruncateAt.END); v.cancelLongPress(); return false; } mDraggingLabel = true; tv.setHorizontalFadingEdgeEnabled(true); v.cancelLongPress(); return true; } } return false; } Handler mLabelScroller = new Handler() { @Override public void handleMessage(Message msg) { TextView tv = (TextView) msg.obj; int x = tv.getScrollX(); x = x * 3 / 4; tv.scrollTo(x, 0); if (x == 0) { tv.setEllipsize(TruncateAt.END); } else { Message newmsg = obtainMessage(0, tv); mLabelScroller.sendMessageDelayed(newmsg, 15); } } }; public boolean onLongClick(View view) { CharSequence title = null; String mime = null; String query = null; String artist; String album; String song; long audioid; try { artist = mService.getArtistName(); album = mService.getAlbumName(); song = mService.getTrackName(); audioid = mService.getAudioId(); } catch (RemoteException ex) { return true; } catch (NullPointerException ex) { // we might not actually have the service yet return true; } if (MediaStore.UNKNOWN_STRING.equals(album) && MediaStore.UNKNOWN_STRING.equals(artist) && song != null && song.startsWith("recording")) { // not music return false; } if (audioid < 0) { return false; } Cursor c = MusicUtils.query(this, ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, audioid), new String[] {MediaStore.Audio.Media.IS_MUSIC}, null, null, null); boolean ismusic = true; if (c != null) { if (c.moveToFirst()) { ismusic = c.getInt(0) != 0; } c.close(); } if (!ismusic) { return false; } boolean knownartist = (artist != null) && !MediaStore.UNKNOWN_STRING.equals(artist); boolean knownalbum = (album != null) && !MediaStore.UNKNOWN_STRING.equals(album); if (knownartist && view.equals(mArtistName.getParent())) { title = artist; query = artist; mime = MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE; } else if (knownalbum && view.equals(mAlbumName.getParent())) { title = album; if (knownartist) { query = artist + " " + album; } else { query = album; } mime = MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE; } else if (view.equals(mTrackName.getParent()) || !knownartist || !knownalbum) { if ((song == null) || MediaStore.UNKNOWN_STRING.equals(song)) { // A popup of the form "Search for null/'' using ..." is pretty // unhelpful, plus, we won't find any way to buy it anyway. return true; } title = song; if (knownartist) { query = artist + " " + song; } else { query = song; } mime = "audio/*"; // the specific type doesn't matter, so don't bother retrieving it } else { throw new RuntimeException("shouldn't be here"); } title = getString(R.string.mediasearch, title); Intent i = new Intent(); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH); i.putExtra(SearchManager.QUERY, query); if(knownartist) { i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artist); } if(knownalbum) { i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, album); } i.putExtra(MediaStore.EXTRA_MEDIA_TITLE, song); i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, mime); startActivity(Intent.createChooser(i, title)); return true; } private OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() { public void onStartTrackingTouch(SeekBar bar) { mLastSeekEventTime = 0; mFromTouch = true; } public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) { if (!fromuser || (mService == null)) return; long now = SystemClock.elapsedRealtime(); if ((now - mLastSeekEventTime) > 250) { mLastSeekEventTime = now; mPosOverride = mDuration * progress / 1000; try { mService.seek(mPosOverride); } catch (RemoteException ex) { } // trackball event, allow progress updates if (!mFromTouch) { refreshNow(); mPosOverride = -1; } } } public void onStopTrackingTouch(SeekBar bar) { mPosOverride = -1; mFromTouch = false; } }; private View.OnClickListener mQueueListener = new View.OnClickListener() { public void onClick(View v) { startActivity( new Intent(Intent.ACTION_EDIT) .setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track") .putExtra("playlist", "nowplaying") ); } }; private View.OnClickListener mShuffleListener = new View.OnClickListener() { public void onClick(View v) { toggleShuffle(); } }; private View.OnClickListener mRepeatListener = new View.OnClickListener() { public void onClick(View v) { cycleRepeat(); } }; private View.OnClickListener mPauseListener = new View.OnClickListener() { public void onClick(View v) { doPauseResume(); } }; private View.OnClickListener mPrevListener = new View.OnClickListener() { public void onClick(View v) { if (mService == null) return; try { if (mService.position() < 2000) { mService.prev(); } else { mService.seek(0); mService.play(); } } catch (RemoteException ex) { } } }; private View.OnClickListener mNextListener = new View.OnClickListener() { public void onClick(View v) { if (mService == null) return; try { mService.next(); } catch (RemoteException ex) { } } }; private RepeatingImageButton.RepeatListener mRewListener = new RepeatingImageButton.RepeatListener() { public void onRepeat(View v, long howlong, int repcnt) { scanBackward(repcnt, howlong); } }; private RepeatingImageButton.RepeatListener mFfwdListener = new RepeatingImageButton.RepeatListener() { public void onRepeat(View v, long howlong, int repcnt) { scanForward(repcnt, howlong); } }; @Override public void onStop() { paused = true; mHandler.removeMessages(REFRESH); unregisterReceiver(mStatusListener); MusicUtils.unbindFromService(mToken); mService = null; super.onStop(); } @Override public void onStart() { super.onStart(); paused = false; mToken = MusicUtils.bindToService(this, osc); if (mToken == null) { // something went wrong mHandler.sendEmptyMessage(QUIT); } IntentFilter f = new IntentFilter(); f.addAction(MediaPlaybackService.PLAYSTATE_CHANGED); f.addAction(MediaPlaybackService.META_CHANGED); registerReceiver(mStatusListener, new IntentFilter(f)); updateTrackInfo(); long next = refreshNow(); queueNextRefresh(next); } @Override public void onNewIntent(Intent intent) { setIntent(intent); } @Override public void onResume() { super.onResume(); updateTrackInfo(); setPauseButtonImage(); } @Override public void onDestroy() { mAlbumArtWorker.quit(); super.onDestroy(); //System.out.println("***************** playback activity onDestroy\n"); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Don't show the menu items if we got launched by path/filedescriptor, or // if we're in one shot mode. In most cases, these menu items are not // useful in those modes, so for consistency we never show them in these // modes, instead of tailoring them to the specific file being played. if (MusicUtils.getCurrentAudioId() >= 0) { menu.add(0, GOTO_START, 0, R.string.goto_start).setIcon(R.drawable.ic_menu_music_library); menu.add(0, PARTY_SHUFFLE, 0, R.string.party_shuffle); // icon will be set in onPrepareOptionsMenu() SubMenu sub = menu.addSubMenu(0, ADD_TO_PLAYLIST, 0, R.string.add_to_playlist).setIcon(android.R.drawable.ic_menu_add); // these next two are in a separate group, so they can be shown/hidden as needed // based on the keyguard state menu.add(1, USE_AS_RINGTONE, 0, R.string.ringtone_menu_short) .setIcon(R.drawable.ic_menu_set_as_ringtone); menu.add(1, DELETE_ITEM, 0, R.string.delete_item) .setIcon(R.drawable.ic_menu_delete); Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL); if (getPackageManager().resolveActivity(i, 0) != null) { menu.add(0, EFFECTS_PANEL, 0, R.string.effectspanel).setIcon(R.drawable.ic_menu_eq); } return true; } return false; } @Override public boolean onPrepareOptionsMenu(Menu menu) { if (mService == null) return false; MenuItem item = menu.findItem(PARTY_SHUFFLE); if (item != null) { int shuffle = MusicUtils.getCurrentShuffleMode(); if (shuffle == MediaPlaybackService.SHUFFLE_AUTO) { item.setIcon(R.drawable.ic_menu_party_shuffle); item.setTitle(R.string.party_shuffle_off); } else { item.setIcon(R.drawable.ic_menu_party_shuffle); item.setTitle(R.string.party_shuffle); } } item = menu.findItem(ADD_TO_PLAYLIST); if (item != null) { SubMenu sub = item.getSubMenu(); // MusicUtils.makePlaylistMenu(this, sub); } KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); menu.setGroupVisible(1, !km.inKeyguardRestrictedInputMode()); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent; try { switch (item.getItemId()) { case GOTO_START: // intent = new Intent(); // intent.setClass(this, MusicBrowserActivity.class); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); // startActivity(intent); // finish(); break; case USE_AS_RINGTONE: { // Set the system setting to make this the current ringtone if (mService != null) { MusicUtils.setRingtone(this, mService.getAudioId()); } return true; } case PARTY_SHUFFLE: MusicUtils.togglePartyShuffle(); setShuffleButtonImage(); break; case NEW_PLAYLIST: { intent = new Intent(); intent.setClass(this, CreatePlaylist.class); startActivityForResult(intent, NEW_PLAYLIST); return true; } case PLAYLIST_SELECTED: { long [] list = new long[1]; list[0] = MusicUtils.getCurrentAudioId(); long playlist = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(this, list, playlist); return true; } case DELETE_ITEM: { if (mService != null) { long [] list = new long[1]; list[0] = MusicUtils.getCurrentAudioId(); Bundle b = new Bundle(); String f; if (android.os.Environment.isExternalStorageRemovable()) { f = getString(R.string.delete_song_desc, mService.getTrackName()); } else { f = getString(R.string.delete_song_desc_nosdcard, mService.getTrackName()); } b.putString("description", f); b.putLongArray("items", list); intent = new Intent(); intent.setClass(this, DeleteItems.class); intent.putExtras(b); startActivityForResult(intent, -1); } return true; } case EFFECTS_PANEL: { Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL); i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mService.getAudioSessionId()); startActivityForResult(i, EFFECTS_PANEL); return true; } } } catch (RemoteException ex) { } return super.onOptionsItemSelected(item); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (resultCode != RESULT_OK) { return; } switch (requestCode) { case NEW_PLAYLIST: Uri uri = intent.getData(); if (uri != null) { long [] list = new long[1]; list[0] = MusicUtils.getCurrentAudioId(); int playlist = Integer.parseInt(uri.getLastPathSegment()); MusicUtils.addToPlaylist(this, list, playlist); } break; } } private final int keyboard[][] = { { KeyEvent.KEYCODE_Q, KeyEvent.KEYCODE_W, KeyEvent.KEYCODE_E, KeyEvent.KEYCODE_R, KeyEvent.KEYCODE_T, KeyEvent.KEYCODE_Y, KeyEvent.KEYCODE_U, KeyEvent.KEYCODE_I, KeyEvent.KEYCODE_O, KeyEvent.KEYCODE_P, }, { KeyEvent.KEYCODE_A, KeyEvent.KEYCODE_S, KeyEvent.KEYCODE_D, KeyEvent.KEYCODE_F, KeyEvent.KEYCODE_G, KeyEvent.KEYCODE_H, KeyEvent.KEYCODE_J, KeyEvent.KEYCODE_K, KeyEvent.KEYCODE_L, KeyEvent.KEYCODE_DEL, }, { KeyEvent.KEYCODE_Z, KeyEvent.KEYCODE_X, KeyEvent.KEYCODE_C, KeyEvent.KEYCODE_V, KeyEvent.KEYCODE_B, KeyEvent.KEYCODE_N, KeyEvent.KEYCODE_M, KeyEvent.KEYCODE_COMMA, KeyEvent.KEYCODE_PERIOD, KeyEvent.KEYCODE_ENTER } }; private int lastX; private int lastY; private boolean seekMethod1(int keyCode) { if (mService == null) return false; for(int x=0;x<10;x++) { for(int y=0;y<3;y++) { if(keyboard[y][x] == keyCode) { int dir = 0; // top row if(x == lastX && y == lastY) dir = 0; else if (y == 0 && lastY == 0 && x > lastX) dir = 1; else if (y == 0 && lastY == 0 && x < lastX) dir = -1; // bottom row else if (y == 2 && lastY == 2 && x > lastX) dir = -1; else if (y == 2 && lastY == 2 && x < lastX) dir = 1; // moving up else if (y < lastY && x <= 4) dir = 1; else if (y < lastY && x >= 5) dir = -1; // moving down else if (y > lastY && x <= 4) dir = -1; else if (y > lastY && x >= 5) dir = 1; lastX = x; lastY = y; try { mService.seek(mService.position() + dir * 5); } catch (RemoteException ex) { } refreshNow(); return true; } } } lastX = -1; lastY = -1; return false; } private boolean seekMethod2(int keyCode) { if (mService == null) return false; for(int i=0;i<10;i++) { if(keyboard[0][i] == keyCode) { int seekpercentage = 100*i/10; try { mService.seek(mService.duration() * seekpercentage / 100); } catch (RemoteException ex) { } refreshNow(); return true; } } return false; } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { try { switch(keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: if (!useDpadMusicControl()) { break; } if (mService != null) { if (!mSeeking && mStartSeekPos >= 0) { mPauseButton.requestFocus(); if (mStartSeekPos < 1000) { mService.prev(); } else { mService.seek(0); } } else { scanBackward(-1, event.getEventTime() - event.getDownTime()); mPauseButton.requestFocus(); mStartSeekPos = -1; } } mSeeking = false; mPosOverride = -1; return true; case KeyEvent.KEYCODE_DPAD_RIGHT: if (!useDpadMusicControl()) { break; } if (mService != null) { if (!mSeeking && mStartSeekPos >= 0) { mPauseButton.requestFocus(); mService.next(); } else { scanForward(-1, event.getEventTime() - event.getDownTime()); mPauseButton.requestFocus(); mStartSeekPos = -1; } } mSeeking = false; mPosOverride = -1; return true; } } catch (RemoteException ex) { } return super.onKeyUp(keyCode, event); } private boolean useDpadMusicControl() { if (mDeviceHasDpad && (mPrevButton.isFocused() || mNextButton.isFocused() || mPauseButton.isFocused())) { return true; } return false; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { int direction = -1; int repcnt = event.getRepeatCount(); if((seekmethod==0)?seekMethod1(keyCode):seekMethod2(keyCode)) return true; switch(keyCode) { /* // image scale case KeyEvent.KEYCODE_Q: av.adjustParams(-0.05, 0.0, 0.0, 0.0, 0.0,-1.0); break; case KeyEvent.KEYCODE_E: av.adjustParams( 0.05, 0.0, 0.0, 0.0, 0.0, 1.0); break; // image translate case KeyEvent.KEYCODE_W: av.adjustParams( 0.0, 0.0,-1.0, 0.0, 0.0, 0.0); break; case KeyEvent.KEYCODE_X: av.adjustParams( 0.0, 0.0, 1.0, 0.0, 0.0, 0.0); break; case KeyEvent.KEYCODE_A: av.adjustParams( 0.0,-1.0, 0.0, 0.0, 0.0, 0.0); break; case KeyEvent.KEYCODE_D: av.adjustParams( 0.0, 1.0, 0.0, 0.0, 0.0, 0.0); break; // camera rotation case KeyEvent.KEYCODE_R: av.adjustParams( 0.0, 0.0, 0.0, 0.0, 0.0,-1.0); break; case KeyEvent.KEYCODE_U: av.adjustParams( 0.0, 0.0, 0.0, 0.0, 0.0, 1.0); break; // camera translate case KeyEvent.KEYCODE_Y: av.adjustParams( 0.0, 0.0, 0.0, 0.0,-1.0, 0.0); break; case KeyEvent.KEYCODE_N: av.adjustParams( 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); break; case KeyEvent.KEYCODE_G: av.adjustParams( 0.0, 0.0, 0.0,-1.0, 0.0, 0.0); break; case KeyEvent.KEYCODE_J: av.adjustParams( 0.0, 0.0, 0.0, 1.0, 0.0, 0.0); break; */ case KeyEvent.KEYCODE_SLASH: seekmethod = 1 - seekmethod; return true; case KeyEvent.KEYCODE_DPAD_LEFT: if (!useDpadMusicControl()) { break; } if (!mPrevButton.hasFocus()) { mPrevButton.requestFocus(); } scanBackward(repcnt, event.getEventTime() - event.getDownTime()); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: if (!useDpadMusicControl()) { break; } if (!mNextButton.hasFocus()) { mNextButton.requestFocus(); } scanForward(repcnt, event.getEventTime() - event.getDownTime()); return true; case KeyEvent.KEYCODE_S: toggleShuffle(); return true; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_SPACE: doPauseResume(); return true; } return super.onKeyDown(keyCode, event); } private void scanBackward(int repcnt, long delta) { if(mService == null) return; try { if(repcnt == 0) { mStartSeekPos = mService.position(); mLastSeekEventTime = 0; mSeeking = false; } else { mSeeking = true; if (delta < 5000) { // seek at 10x speed for the first 5 seconds delta = delta * 10; } else { // seek at 40x after that delta = 50000 + (delta - 5000) * 40; } long newpos = mStartSeekPos - delta; if (newpos < 0) { // move to previous track mService.prev(); long duration = mService.duration(); mStartSeekPos += duration; newpos += duration; } if (((delta - mLastSeekEventTime) > 250) || repcnt < 0){ mService.seek(newpos); mLastSeekEventTime = delta; } if (repcnt >= 0) { mPosOverride = newpos; } else { mPosOverride = -1; } refreshNow(); } } catch (RemoteException ex) { } } private void scanForward(int repcnt, long delta) { if(mService == null) return; try { if(repcnt == 0) { mStartSeekPos = mService.position(); mLastSeekEventTime = 0; mSeeking = false; } else { mSeeking = true; if (delta < 5000) { // seek at 10x speed for the first 5 seconds delta = delta * 10; } else { // seek at 40x after that delta = 50000 + (delta - 5000) * 40; } long newpos = mStartSeekPos + delta; long duration = mService.duration(); if (newpos >= duration) { // move to next track mService.next(); mStartSeekPos -= duration; // is OK to go negative newpos -= duration; } if (((delta - mLastSeekEventTime) > 250) || repcnt < 0){ mService.seek(newpos); mLastSeekEventTime = delta; } if (repcnt >= 0) { mPosOverride = newpos; } else { mPosOverride = -1; } refreshNow(); } } catch (RemoteException ex) { } } private void doPauseResume() { try { if(mService != null) { if (mService.isPlaying()) { mService.pause(); } else { mService.play(); } refreshNow(); setPauseButtonImage(); } } catch (RemoteException ex) { } } private void toggleShuffle() { if (mService == null) { return; } try { int shuffle = mService.getShuffleMode(); if (shuffle == MediaPlaybackService.SHUFFLE_NONE) { mService.setShuffleMode(MediaPlaybackService.SHUFFLE_NORMAL); if (mService.getRepeatMode() == MediaPlaybackService.REPEAT_CURRENT) { mService.setRepeatMode(MediaPlaybackService.REPEAT_ALL); setRepeatButtonImage(); } showToast(R.string.shuffle_on_notif); } else if (shuffle == MediaPlaybackService.SHUFFLE_NORMAL || shuffle == MediaPlaybackService.SHUFFLE_AUTO) { mService.setShuffleMode(MediaPlaybackService.SHUFFLE_NONE); showToast(R.string.shuffle_off_notif); } else { Log.e("MediaPlaybackActivity", "Invalid shuffle mode: " + shuffle); } setShuffleButtonImage(); } catch (RemoteException ex) { } } private void cycleRepeat() { if (mService == null) { return; } try { int mode = mService.getRepeatMode(); if (mode == MediaPlaybackService.REPEAT_NONE) { mService.setRepeatMode(MediaPlaybackService.REPEAT_ALL); showToast(R.string.repeat_all_notif); } else if (mode == MediaPlaybackService.REPEAT_ALL) { mService.setRepeatMode(MediaPlaybackService.REPEAT_CURRENT); if (mService.getShuffleMode() != MediaPlaybackService.SHUFFLE_NONE) { mService.setShuffleMode(MediaPlaybackService.SHUFFLE_NONE); setShuffleButtonImage(); } showToast(R.string.repeat_current_notif); } else { mService.setRepeatMode(MediaPlaybackService.REPEAT_NONE); showToast(R.string.repeat_off_notif); } setRepeatButtonImage(); } catch (RemoteException ex) { } } private void showToast(int resid) { if (mToast == null) { mToast = Toast.makeText(this, "", Toast.LENGTH_SHORT); } mToast.setText(resid); mToast.show(); } private void startPlayback() { if(mService == null) return; Intent intent = getIntent(); String filename = ""; Uri uri = intent.getData(); if (uri != null && uri.toString().length() > 0) { // If this is a file:// URI, just use the path directly instead // of going through the open-from-filedescriptor codepath. String scheme = uri.getScheme(); if ("file".equals(scheme)) { filename = uri.getPath(); } else { filename = uri.toString(); } try { mService.stop(); mService.openFile(filename); mService.play(); setIntent(new Intent()); } catch (Exception ex) { Log.d("MediaPlaybackActivity", "couldn't start playback: " + ex); } } updateTrackInfo(); long next = refreshNow(); queueNextRefresh(next); } private ServiceConnection osc = new ServiceConnection() { public void onServiceConnected(ComponentName classname, IBinder obj) { mService = IMediaPlaybackService.Stub.asInterface(obj); startPlayback(); try { // Assume something is playing when the service says it is, // but also if the audio ID is valid but the service is paused. if (mService.getAudioId() >= 0 || mService.isPlaying() || mService.getPath() != null) { // something is playing now, we're done mRepeatButton.setVisibility(View.VISIBLE); mShuffleButton.setVisibility(View.VISIBLE); mQueueButton.setVisibility(View.VISIBLE); setRepeatButtonImage(); setShuffleButtonImage(); setPauseButtonImage(); return; } } catch (RemoteException ex) { } // Service is dead or not playing anything. If we got here as part // of a "play this file" Intent, exit. Otherwise go to the Music // app start screen. if (getIntent().getData() == null) { // Intent intent = new Intent(Intent.ACTION_MAIN); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setClass(MediaPlaybackActivity.this, MusicBrowserActivity.class); // startActivity(intent); } finish(); } public void onServiceDisconnected(ComponentName classname) { mService = null; } }; private void setRepeatButtonImage() { if (mService == null) return; try { switch (mService.getRepeatMode()) { case MediaPlaybackService.REPEAT_ALL: mRepeatButton.setImageResource(R.drawable.ic_mp_repeat_all_btn); break; case MediaPlaybackService.REPEAT_CURRENT: mRepeatButton.setImageResource(R.drawable.ic_mp_repeat_once_btn); break; default: mRepeatButton.setImageResource(R.drawable.ic_mp_repeat_off_btn); break; } } catch (RemoteException ex) { } } private void setShuffleButtonImage() { if (mService == null) return; try { switch (mService.getShuffleMode()) { case MediaPlaybackService.SHUFFLE_NONE: mShuffleButton.setImageResource(R.drawable.ic_mp_shuffle_off_btn); break; case MediaPlaybackService.SHUFFLE_AUTO: mShuffleButton.setImageResource(R.drawable.ic_mp_partyshuffle_on_btn); break; default: mShuffleButton.setImageResource(R.drawable.ic_mp_shuffle_on_btn); break; } } catch (RemoteException ex) { } } private void setPauseButtonImage() { try { if (mService != null && mService.isPlaying()) { mPauseButton.setImageResource(android.R.drawable.ic_media_pause); } else { mPauseButton.setImageResource(android.R.drawable.ic_media_play); } } catch (RemoteException ex) { } } private ImageView mAlbum; private TextView mCurrentTime; private TextView mTotalTime; private TextView mArtistName; private TextView mAlbumName; private TextView mTrackName; private ProgressBar mProgress; private long mPosOverride = -1; private boolean mFromTouch = false; private long mDuration; private int seekmethod; private boolean paused; private static final int REFRESH = 1; private static final int QUIT = 2; private static final int GET_ALBUM_ART = 3; private static final int ALBUM_ART_DECODED = 4; private void queueNextRefresh(long delay) { if (!paused) { Message msg = mHandler.obtainMessage(REFRESH); mHandler.removeMessages(REFRESH); mHandler.sendMessageDelayed(msg, delay); } } private long refreshNow() { if(mService == null) return 500; try { long pos = mPosOverride < 0 ? mService.position() : mPosOverride; if ((pos >= 0) && (mDuration > 0)) { mCurrentTime.setText(MusicUtils.makeTimeString(this, pos / 1000)); int progress = (int) (1000 * pos / mDuration); mProgress.setProgress(progress); if (mService.isPlaying()) { mCurrentTime.setVisibility(View.VISIBLE); } else { // blink the counter int vis = mCurrentTime.getVisibility(); mCurrentTime.setVisibility(vis == View.INVISIBLE ? View.VISIBLE : View.INVISIBLE); return 500; } } else { mCurrentTime.setText("--:--"); mProgress.setProgress(1000); } // calculate the number of milliseconds until the next full second, so // the counter can be updated at just the right time long remaining = 1000 - (pos % 1000); // approximate how often we would need to refresh the slider to // move it smoothly int width = mProgress.getWidth(); if (width == 0) width = 320; long smoothrefreshtime = mDuration / width; if (smoothrefreshtime > remaining) return remaining; if (smoothrefreshtime < 20) return 20; return smoothrefreshtime; } catch (RemoteException ex) { } return 500; } private final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case ALBUM_ART_DECODED: mAlbum.setImageBitmap((Bitmap)msg.obj); mAlbum.getDrawable().setDither(true); break; case REFRESH: long next = refreshNow(); queueNextRefresh(next); break; case QUIT: // This can be moved back to onCreate once the bug that prevents // Dialogs from being started from onCreate/onResume is fixed. new AlertDialog.Builder(MediaPlaybackActivity.this) .setTitle(R.string.service_start_error_title) .setMessage(R.string.service_start_error_msg) .setPositiveButton(R.string.service_start_error_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { finish(); } }) .setCancelable(false) .show(); break; default: break; } } }; private BroadcastReceiver mStatusListener = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(MediaPlaybackService.META_CHANGED)) { // redraw the artist/title info and // set new max for progress bar updateTrackInfo(); setPauseButtonImage(); queueNextRefresh(1); } else if (action.equals(MediaPlaybackService.PLAYSTATE_CHANGED)) { setPauseButtonImage(); } } }; private static class AlbumSongIdWrapper { public long albumid; public long songid; AlbumSongIdWrapper(long aid, long sid) { albumid = aid; songid = sid; } } private void updateTrackInfo() { if (mService == null) { return; } try { String path = mService.getPath(); if (path == null) { finish(); return; } long songid = mService.getAudioId(); if (songid < 0 && path.toLowerCase().startsWith("http://")) { // Once we can get album art and meta data from MediaPlayer, we // can show that info again when streaming. ((View) mArtistName.getParent()).setVisibility(View.INVISIBLE); ((View) mAlbumName.getParent()).setVisibility(View.INVISIBLE); mAlbum.setVisibility(View.GONE); mTrackName.setText(path); mAlbumArtHandler.removeMessages(GET_ALBUM_ART); mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, new AlbumSongIdWrapper(-1, -1)).sendToTarget(); } else { ((View) mArtistName.getParent()).setVisibility(View.VISIBLE); ((View) mAlbumName.getParent()).setVisibility(View.VISIBLE); String artistName = mService.getArtistName(); if (MediaStore.UNKNOWN_STRING.equals(artistName)) { artistName = getString(R.string.unknown_artist_name); } mArtistName.setText(artistName); String albumName = mService.getAlbumName(); long albumid = mService.getAlbumId(); if (MediaStore.UNKNOWN_STRING.equals(albumName)) { albumName = getString(R.string.unknown_album_name); albumid = -1; } mAlbumName.setText(albumName); mTrackName.setText(mService.getTrackName()); mAlbumArtHandler.removeMessages(GET_ALBUM_ART); mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, new AlbumSongIdWrapper(albumid, songid)).sendToTarget(); mAlbum.setVisibility(View.VISIBLE); } mDuration = mService.duration(); mTotalTime.setText(MusicUtils.makeTimeString(this, mDuration / 1000)); } catch (RemoteException ex) { finish(); } } public class AlbumArtHandler extends Handler { private long mAlbumId = -1; public AlbumArtHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { long albumid = ((AlbumSongIdWrapper) msg.obj).albumid; long songid = ((AlbumSongIdWrapper) msg.obj).songid; if (msg.what == GET_ALBUM_ART && (mAlbumId != albumid || albumid < 0)) { // while decoding the new image, show the default album art Message numsg = mHandler.obtainMessage(ALBUM_ART_DECODED, null); mHandler.removeMessages(ALBUM_ART_DECODED); mHandler.sendMessageDelayed(numsg, 300); // Don't allow default artwork here, because we want to fall back to song-specific // album art if we can't find anything for the album. Bitmap bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, albumid, false); if (bm == null) { bm = MusicUtils.getArtwork(MediaPlaybackActivity.this, songid, -1); albumid = -1; } if (bm != null) { numsg = mHandler.obtainMessage(ALBUM_ART_DECODED, bm); mHandler.removeMessages(ALBUM_ART_DECODED); mHandler.sendMessage(numsg); } mAlbumId = albumid; } } } private static class Worker implements Runnable { private final Object mLock = new Object(); private Looper mLooper; /** * Creates a worker thread with the given name. The thread * then runs a {@link android.os.Looper}. * @param name A name for the new thread */ Worker(String name) { Thread t = new Thread(null, this, name); t.setPriority(Thread.MIN_PRIORITY); t.start(); synchronized (mLock) { while (mLooper == null) { try { mLock.wait(); } catch (InterruptedException ex) { } } } } public Looper getLooper() { return mLooper; } public void run() { synchronized (mLock) { Looper.prepare(); mLooper = Looper.myLooper(); mLock.notifyAll(); } Looper.loop(); } public void quit() { mLooper.quit(); } } }
[ "mzoneseven@foxmail.com" ]
mzoneseven@foxmail.com
72f5938d5c87e9281cf42c61a69ae29af34111d4
904aad25a260a3668960c040c330e96f2e0087c7
/API-Gateway/src/main/java/com/org/apigateway/ApiGatewayApplication.java
b745670b8340f1fcfd246465e629f6cf96e5c0b4
[]
no_license
Mundiaem/Spring-Microservices
74cd7f475414d0d3fb232307c73595185e1f3d83
c5199081b95f5eb9cd83cc3dc493a514320aecfd
refs/heads/main
2023-07-03T13:19:56.762762
2021-08-03T13:55:31
2021-08-03T13:55:31
392,334,041
0
0
null
null
null
null
UTF-8
Java
false
false
1,382
java
package com.org.apigateway; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.circuitbreaker.Customizer; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @EnableEurekaClient @EnableHystrix @ComponentScan(basePackages = {"com.org.apigateway.*"}) @EnableCircuitBreaker public class ApiGatewayApplication { public static void main(String[] args) { SpringApplication.run(ApiGatewayApplication.class, args); } // @Bean // public Customizer<HystrixCircuitBreakerFactory> defaultConfig() { // return factory -> factory.configureDefault(id -> HystrixCommand.Setter // .withGroupKey(HystrixCommandGroupKey.Factory.asKey(id)) // .andCommandPropertiesDefaults(HystrixCommandProperties.Setter() // .withExecutionTimeoutInMilliseconds(4000))); // } }
[ "machariamundia@gmail.com" ]
machariamundia@gmail.com
0217ee1e7d22675e54fb2e22d544985e3ec9c3d3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_21f859e222cf78ca8485e0f479bffd38d85838a2/QueryMapper/2_21f859e222cf78ca8485e0f479bffd38d85838a2_QueryMapper_s.java
e0ed6b0fb3671c3fe7b84d400d4f6681cc5d5bd7
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,132
java
/* * Copyright (c) 2011 by the original author(s). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.data.document.mongodb.query; import java.util.ArrayList; import java.util.List; import com.mongodb.BasicDBObject; import com.mongodb.DBObject; import org.bson.types.ObjectId; import org.springframework.core.convert.ConversionFailedException; import org.springframework.data.document.mongodb.MongoReader; import org.springframework.data.document.mongodb.convert.MongoConverter; import org.springframework.data.mapping.model.PersistentEntity; /** * A helper class to encapsulate any modifications of a Query object before it gets submitted to the database. * * @author Jon Brisbin <jbrisbin@vmware.com> */ public class QueryMapper<T> { final private DBObject query; final private PersistentEntity<T> entity; final private MongoReader<Object> reader; public QueryMapper(DBObject query, PersistentEntity<T> entity, MongoReader<?> reader) { this.query = query; this.entity = entity; this.reader = (MongoReader<Object>) reader; } public DBObject getMappedObject() { String idKey = null; if (null != entity) { idKey = entity.getIdProperty().getName(); } else if (query.containsField("id")) { idKey = "id"; } else if (query.containsField("_id")) { idKey = "_id"; } DBObject newDbo = new BasicDBObject(); for (String key : query.keySet()) { String newKey = key; Object value = query.get(key); if (key.equals(idKey)) { if (value instanceof DBObject) { DBObject valueDbObj = (DBObject) value; if ("$in".equals(key)) { List<Object> ids = new ArrayList<Object>(); for (Object id : (Object[]) ((DBObject) value).get("$in")) { if (null != reader && !(id instanceof ObjectId)) { ObjectId oid = ((MongoConverter) reader).convertObjectId(id); ids.add(oid); } else { ids.add(id); } } newDbo.put("$in", ids.toArray(new ObjectId[ids.size()])); } if (null != reader) { try { value = reader.read(entity.getIdProperty().getType(), valueDbObj); } catch (ConversionFailedException ignored) { } } } else if (null != reader) { try { value = ((MongoConverter) reader).convertObjectId(value); } catch (ConversionFailedException ignored) { } } newKey = "_id"; } else { // TODO: Implement other forms of key conversion (like @Alias and whatnot) } newDbo.put(newKey, value); } return newDbo; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
c455054b1624f4ee1cadd1c45386170378bb41fb
139960e2d7d55e71c15e6a63acb6609e142a2ace
/mobile_app1/leafModuleMin/src/main/java/leafModuleMinpackageJava0/Foo0.java
9f5c58380b7a88a217aebf23d2a0c775d2b3e54f
[ "Apache-2.0" ]
permissive
uber-common/android-build-eval
448bfe141b6911ad8a99268378c75217d431766f
7723bfd0b9b1056892cef1fef02314b435b086f2
refs/heads/master
2023-02-18T22:25:15.121902
2023-02-06T19:35:34
2023-02-06T19:35:34
294,831,672
83
7
Apache-2.0
2021-09-24T08:55:30
2020-09-11T23:27:37
Java
UTF-8
Java
false
false
779
java
package leafModuleMinpackageJava0; import java.lang.Integer; public class Foo0 { Integer int0; public void foo0() { new module1055packageKt0.Foo0().foo4(); new module304packageKt0.Foo0().foo5(); new module1002packageJava0.Foo0().foo3(); new module491packageJava0.Foo0().foo5(); new module438packageKt0.Foo0().foo2(); new module1246packageJava0.Foo0().foo3(); new module288packageJava0.Foo0().foo0(); new module252packageJava0.Foo0().foo5(); new module410packageJava0.Foo0().foo1(); new module785packageJava0.Foo0().foo2(); new module648packageKt0.Foo0().foo8(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } }
[ "oliviern@uber.com" ]
oliviern@uber.com
8b0b81d8ce1030530a9e93af54a0a8a73caded5c
152e7337c93e371678af214f91e08e0d7685e2e9
/Backend/src/main/java/com/example/Holidaymaker/repositories/ReviewRepo.java
086592a47eeb8cdafa5ca181dfbc480a4390f336
[]
no_license
xerox134/Holiday-maker
5df87ec15b09bae03b9d05f3dae6bbb97110fe77
befac749098415e1cc14a3215f4beaca923bad38
refs/heads/main
2023-05-31T02:50:10.721075
2021-06-14T09:34:40
2021-06-14T09:34:40
363,855,287
2
2
null
2021-06-04T14:24:16
2021-05-03T07:50:15
JavaScript
UTF-8
Java
false
false
459
java
package com.example.Holidaymaker.repositories; import com.example.Holidaymaker.entities.Review; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface ReviewRepo extends JpaRepository<Review, Long> { List<Review> findByUserId(long userId); List<Review> findByHotelId(long hotelId); }
[ "anton.baric99@gmail.com" ]
anton.baric99@gmail.com
d1bf7840cb651d1fb0745100e6e8f41a0ce9e6cb
539ba246d56f0e624104b0b8a6691808bffd552c
/pac4/client/src/main/java/ss3/gui/StockPiezas.java
29014cca3fa845929e29466d3c778e08feec3f8e
[]
no_license
esaugm/TDP_Grup6
a09026cb2490b6b3724ef3a62984770aa9af2d58
5e09035a3f93b43f0b8288d9eef4f26bdf9988b3
refs/heads/master
2020-07-24T19:35:07.581920
2013-05-26T21:35:45
2013-05-26T21:35:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,400
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ss3.gui; import common.rmi.Client; import java.rmi.RemoteException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; import ss1.dao.exception.ExceptionErrorDataBase; import ss1.entity.Taller; import ss1.entity.Usuari; import ss1.entity.UsuariConectat; import ss1.entity.exception.ExceptionNoReparacionesAsignadas; import ss1.gui.LoginDialog; import ss2.entity.Solicitud; import ss2.entity.StockPeca; import ss2.exception.AppException; import ss3.beans.Pedido; import ss3.beans.Pieza; import ss3.beans.Reparacion; import ss3.beans.Vehiculo; /** * * @author Fernando */ public class StockPiezas extends javax.swing.JPanel { LoginDialog loginDialog; public Client cliente; JTable jTable1; JScrollPane scrollPane; JTable jTable2; JScrollPane scrollPane2; JFrame topFrame; UsuariConectat uC; /** * Creates new form StockPiezas */ public StockPiezas(Client cli, UsuariConectat uC) throws ExceptionErrorDataBase, RemoteException { cliente = cli; initComponents(); jTable1 = crearTabla(); scrollPane = new JScrollPane(); scrollPane.setBounds(20, 130, 725, 100); add(scrollPane); scrollPane.setViewportView(jTable1); jTable2 = crearTabla2(); scrollPane2 = new JScrollPane(); scrollPane2.setBounds(20, 320, 665, 90); add(scrollPane2); scrollPane2.setViewportView(jTable2); topFrame = (JFrame) SwingUtilities.getWindowAncestor(this); rellenaTabla(cliente.consultaStockPiezas(uC.getTaller())); } public void rellenaTabla(ArrayList<StockPeca> stoPeca) throws ExceptionErrorDataBase { jButton3.setEnabled(false); try { DefaultTableModel tableModel = (DefaultTableModel) jTable1.getModel(); int rowCount = tableModel.getRowCount(); Iterator itRep = stoPeca.iterator(); int i=0; Pieza p1; StockPeca sp1; while (itRep.hasNext()){ sp1 = (StockPeca) itRep.next(); p1 = cliente.ConsultaCodigo(sp1.getCodipeca()); if(i==rowCount-1) tableModel.addRow(new Object[]{}); tableModel.setValueAt(p1.getCodiPieza(),i, 0); tableModel.setValueAt(p1.getMarca(),i,1); tableModel.setValueAt(p1.getModelo(),i,2); tableModel.setValueAt(sp1.getStockminim(),i,3); tableModel.setValueAt(sp1.getStock(),i,4); tableModel.setValueAt(p1.getPvd(),i,5); tableModel.setValueAt(p1.getDescripcion(),i,6); i++; } for (int rowIdx=i;rowIdx<rowCount ;rowIdx++){ tableModel.setValueAt("",rowIdx,0); tableModel.setValueAt("",rowIdx,1); tableModel.setValueAt("",rowIdx,2); tableModel.setValueAt("",rowIdx,3); tableModel.setValueAt("",rowIdx,4); tableModel.setValueAt("",rowIdx,5); tableModel.setValueAt("",rowIdx,6); } jTable1 = createTabla(tableModel); scrollPane.setViewportView(jTable1); DefaultTableModel tableModel2 = (DefaultTableModel) jTable2.getModel(); int rowCount2 = tableModel2.getRowCount(); int j=0; for (int rowIdy=j;rowIdy<rowCount2 ;rowIdy++){ tableModel2.setValueAt("",rowIdy,0); tableModel2.setValueAt("",rowIdy,1); tableModel2.setValueAt("",rowIdy,2); tableModel2.setValueAt("",rowIdy,3); tableModel2.setValueAt("",rowIdy,4); tableModel2.setValueAt("",rowIdy,5); tableModel2.setValueAt("",rowIdy,6); } jTable2 = createTabla2(tableModel2); scrollPane2.setViewportView(jTable2); } catch (RemoteException e1) { e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } private JTable crearTabla() { DefaultTableModel tableModel = (new DefaultTableModel( new Object[][] { {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, }, new String[] {"Codigo","Marca","Modelo", "Stock Min.","Stock","Precio","Descripción"} ){ Class[] columnTypes = new Class[] { Integer.class, String.class, String.class, Integer.class, Integer.class, Integer.class, String.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); return createTabla(tableModel); } private JTable createTabla(DefaultTableModel tableModel) { JTable table = new JTable(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setCellSelectionEnabled(false); table.setColumnSelectionAllowed(false); table.setModel(tableModel); table.setRowSelectionAllowed(true); table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(0).setPreferredWidth(75); table.getColumnModel().getColumn(0).setMinWidth(75); table.getColumnModel().getColumn(0).setMaxWidth(75); table.getColumnModel().getColumn(1).setResizable(false); table.getColumnModel().getColumn(1).setPreferredWidth(100); table.getColumnModel().getColumn(1).setMinWidth(100); table.getColumnModel().getColumn(1).setMaxWidth(100); table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setMinWidth(80); table.getColumnModel().getColumn(2).setMaxWidth(80); table.getColumnModel().getColumn(3).setPreferredWidth(80); table.getColumnModel().getColumn(3).setMinWidth(80); table.getColumnModel().getColumn(3).setMaxWidth(80); table.getColumnModel().getColumn(4).setPreferredWidth(80); table.getColumnModel().getColumn(4).setMinWidth(80); table.getColumnModel().getColumn(4).setMaxWidth(80); table.getColumnModel().getColumn(5).setPreferredWidth(80); table.getColumnModel().getColumn(5).setMinWidth(80); table.getColumnModel().getColumn(5).setMaxWidth(80); table.getColumnModel().getColumn(6).setPreferredWidth(230); table.getColumnModel().getColumn(6).setMinWidth(230); table.getColumnModel().getColumn(6).setMaxWidth(230); table.setBounds(20, 130, 725, 100); return table; } private JTable crearTabla2() { DefaultTableModel tableModel = (new DefaultTableModel( new Object[][] { {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, }, new String[] {"Codigo","Marca","Modelo", "Unidades","Precio","PRecio Total","Descripción"} ){ Class[] columnTypes = new Class[] { Integer.class, String.class, String.class, Integer.class, Integer.class, Integer.class, String.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); return createTabla(tableModel); } private JTable createTabla2(DefaultTableModel tableModel) { JTable table = new JTable(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setCellSelectionEnabled(false); table.setColumnSelectionAllowed(false); table.setModel(tableModel); table.setRowSelectionAllowed(true); table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(0).setPreferredWidth(75); table.getColumnModel().getColumn(0).setMinWidth(75); table.getColumnModel().getColumn(0).setMaxWidth(75); table.getColumnModel().getColumn(1).setResizable(false); table.getColumnModel().getColumn(1).setPreferredWidth(100); table.getColumnModel().getColumn(1).setMinWidth(100); table.getColumnModel().getColumn(1).setMaxWidth(100); table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setMinWidth(80); table.getColumnModel().getColumn(2).setMaxWidth(80); table.getColumnModel().getColumn(3).setPreferredWidth(80); table.getColumnModel().getColumn(3).setMinWidth(80); table.getColumnModel().getColumn(3).setMaxWidth(80); table.getColumnModel().getColumn(4).setPreferredWidth(80); table.getColumnModel().getColumn(4).setMinWidth(80); table.getColumnModel().getColumn(4).setMaxWidth(80); table.getColumnModel().getColumn(5).setPreferredWidth(80); table.getColumnModel().getColumn(5).setMinWidth(80); table.getColumnModel().getColumn(5).setMaxWidth(80); table.getColumnModel().getColumn(6).setPreferredWidth(155); table.getColumnModel().getColumn(6).setMinWidth(155); table.getColumnModel().getColumn(6).setMaxWidth(155); table.setBounds(20, 320, 665, 90); return table; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jLabel11 = new javax.swing.JLabel(); setLayout(null); jLabel1.setFont(new java.awt.Font("Lucida Grande", 1, 36)); // NOI18N jLabel1.setText("Stock Piezas"); add(jLabel1); jLabel1.setBounds(273, 11, 219, 51); jButton2.setText("Realizar Pedido"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); add(jButton2); jButton2.setBounds(10, 460, 150, 23); jButton3.setText("Eliminar"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); add(jButton3); jButton3.setBounds(180, 460, 80, 23); jButton6.setText("Salir"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); add(jButton6); jButton6.setBounds(687, 458, 60, 23); jButton5.setText("Añadir"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); add(jButton5); jButton5.setBounds(660, 240, 83, 23); jLabel11.setFont(new java.awt.Font("Lucida Grande", 1, 24)); // NOI18N jLabel11.setText("Piezas añadidas para realizar el pedido"); add(jLabel11); jLabel11.setBounds(170, 280, 446, 32); }// </editor-fold>//GEN-END:initComponents private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: DefaultTableModel modelo = (DefaultTableModel) jTable2.getModel(); Object[] datos = {(Integer)jTable1.getValueAt(jTable1.getSelectedRow(), 0),jTable1.getValueAt(jTable1.getSelectedRow(), 1).toString(),jTable1.getValueAt(jTable1.getSelectedRow(), 2).toString(),1,(Float)jTable1.getValueAt(jTable1.getSelectedRow(), 5),(Float)jTable1.getValueAt(jTable1.getSelectedRow(), 5),jTable1.getValueAt(jTable1.getSelectedRow(), 6)}; // Cantidad de columnas de la tabla modelo.addRow(datos); modelo.moveRow(jTable2.getRowCount()-1, jTable2.getRowCount()-1, 0); jButton3.setEnabled(true); }//GEN-LAST:event_jButton5ActionPerformed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed // TODO add your handling code here: setVisible(false); }//GEN-LAST:event_jButton6ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: // TODO add your handling code here: if(!jTable2.getValueAt(jTable2.getSelectedRow(), 0).toString().isEmpty()){ DefaultTableModel model = (DefaultTableModel)jTable2.getModel(); model.removeRow(jTable2.getSelectedRow()); jTable2.getSelectionModel().setSelectionInterval(0,0); }else{ Avisos av = new Avisos("Esta fila está vacía. No hay nada que eliminar."); av.setVisible(true); av.setModal(true); } }//GEN-LAST:event_jButton3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: /*jTable2.getSelectionModel().setSelectionInterval(0, 0); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); try { Taller tall = cliente.findTallerById(uC.getTaller()); Pieza p2 = cliente.ConsultaCodigo(Integer.parseInt(jTable2.getValueAt(0, 0).toString())); StockPeca sp2 = cliente.consultaStockPiezabyCodigoPieza(Integer.parseInt(p2.getCodiPieza().toString()), uC.getTaller()); //Pedido ped = new Pedido(true,dateFormat.format(date),p2.getCodiPieza(),tall.getCapTaller(),p2.getIdProveedor(),); } catch (ExceptionErrorDataBase ex) { ex.printStackTrace(); } catch (RemoteException ex) { ex.printStackTrace(); }*/ Avisos av = new Avisos("Función no implementada. Disculpe las molestias."); av.setVisible(true); av.setModal(true); }//GEN-LAST:event_jButton2ActionPerformed private void jTable2ActionPerformed(java.awt.event.ActionEvent evt){ } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel11; // End of variables declaration//GEN-END:variables }
[ "fernandeuz@gmail.com" ]
fernandeuz@gmail.com
ce29df9a185e1beae2cb2b4571524559287e0b2f
49e3e158eeffc61fcc522588831c25fd5aadba7b
/app/src/androidTest/java/com/muzi/numberview/ExampleInstrumentedTest.java
730444fa1bafb7ecccdce69be84ce1a866dd2eb5
[ "Apache-2.0" ]
permissive
xiangyutian/NumberView
f29c583ffea91c7e9e36f48d9f29127dcc69a4c3
1ef79b6ebcf9b59532ecf9d51d783b00c076213b
refs/heads/master
2020-04-23T19:07:13.248914
2018-04-16T01:47:34
2018-04-16T01:47:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package com.muzi.numberview; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.muzi.numberview", appContext.getPackageName()); } }
[ "727784430@qq.com" ]
727784430@qq.com
baa98136023fb127bfee0f3b18342eadf9979f45
ae70e6caef18ce046d58f79984002c95d789f996
/app/src/main/java/com/qjf/sample/presenter/MainPresenter.java
de398dc4aba52a3feeb862cc8ab43fb64d8e1d28
[]
no_license
Tobi1025/MvvpFrame
f5c92de74afe363c9fbba12db130b6b12e093e5b
e3f3f6d5301a664ea25b52c7a1588c9508577940
refs/heads/master
2021-08-28T13:33:44.122277
2017-12-12T09:55:50
2017-12-12T09:55:50
113,964,287
1
0
null
null
null
null
UTF-8
Java
false
false
1,708
java
package com.qjf.sample.presenter; import com.qjf.sample.base.RxPresenter; import com.qjf.sample.model.http.HttpManager; import com.qjf.sample.model.http.request.NewsRequestCenter; import com.qjf.sample.model.http.response.NewsHttpResponse; import com.qjf.sample.presenter.contract.MainContract; import com.qjf.sample.utils.RxUtil; import java.util.List; import java.util.Map; import rx.Subscription; import rx.functions.Action0; import rx.functions.Action1; /** * Created by qiaojingfei on 2017/12/1. */ public class MainPresenter extends RxPresenter<MainContract.IMainView> implements MainContract.IMainPresenter { @Override public void getDataList() { Subscription newsSubscription = HttpManager.getNewsRequestCenter().newsList("shehui", NewsRequestCenter.APPKEY) .compose(RxUtil.<NewsHttpResponse>rxNewsSchedulerHelper()) .compose(RxUtil.<Map<String, Object>>handleNewsResult()) .subscribe(new Action1<Map<String, Object>>() { @Override public void call(final Map<String, Object> res) { if (res != null) { List<Map<String, String>> data = (List<Map<String, String>>) res.get("data"); mView.showContent(data); } } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { } }, new Action0() { @Override public void call() { } }); addSubscribe(newsSubscription); } }
[ "1104575208@qq.com" ]
1104575208@qq.com
faa6fea66a302e79d31e51d0fc0377da7254fb07
2f05bf264bd87f533803906811ffc89685688dba
/Java_020_wordQuiz/src/com/callor/word/domain/WordVO.java
6381586826b387f48efe67241f5816ec8f055030
[]
no_license
dkdud8140/Biz_403_2021_03_Java
3d6a9cf8cd692b78047606665fd888a8ca6ed80f
a24f241a8d12e13c9d6a8a6be78a6b66e5856c31
refs/heads/master
2023-06-23T03:51:46.025661
2021-07-26T08:35:43
2021-07-26T08:35:43
348,207,335
0
0
null
null
null
null
UTF-8
Java
false
false
722
java
package com.callor.word.domain; import lombok.Getter; import lombok.Setter; import lombok.ToString; /* * model package * MVC(Model View Controller) 패턴의 프로젝트에서는 * VO 클래스가 저장되는 package 를 보통 model로 작성을 한다 * * domain package * DBMS와 연동되는 프로젝트에서 사용하기도 하는 이름 * * command package * */ // Annotation // @Override 처럼 // annotation으로 키워드를 지정하므로써 단순히 반복 작성해야하는 // 코드를 자동으로 만들어주는 효과를 낸다 @Getter @Setter @ToString public class WordVO { //정보의 은닉 private String english ; private String korea ; private Integer count ; }
[ "cho.ay4@gmail.com" ]
cho.ay4@gmail.com
634ef746e58af02aa4404f51895fc4afcd2bbd9e
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdas/applicationModule/src/main/java/applicationModulepackageJava8/Foo148.java
54ff0e32059e7092f5a91036352d719058468296
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package applicationModulepackageJava8; public class Foo148 { public void foo0() { new applicationModulepackageJava8.Foo147().foo5(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
65ab237452d3305be775d2c09f88a4c8a7d2da50
0d5cbabdb8b7257d075c4470f90847e9493f80b8
/app/src/main/java/com/jiubang/commerce/database/table/PkgRecordTable.java
375bd08d2f9f6e80cf7170b28302944b1458b4f0
[]
no_license
hgy413/filemanager
d214c692b862fdb6e76388f8454492335c5aadc9
b445c4b46bcce08fb889875e342cf6a08e747d00
refs/heads/master
2022-07-06T20:51:46.342792
2020-05-19T12:55:11
2020-05-19T12:55:11
264,810,162
0
0
null
2020-05-18T02:58:47
2020-05-18T02:58:46
null
UTF-8
Java
false
false
6,669
java
package com.jiubang.commerce.database.table; import android.content.ContentValues; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; import com.jb.ga0.commerce.util.LogUtils; import com.jiubang.commerce.database.DataBaseHelper; public class PkgRecordTable { public static final String CREATE_TABLE_SQL = "CREATE TABLE IF NOT EXISTS PkgRecordTable (packageName TEXT NOT NULL UNIQUE DEFAULT(-1), hash INTEGER, updateTime NUMERIC)"; public static final String HASH = "hash"; private static final int MAX_ROWS = 500; public static final String PACKAGE_NAME = "packageName"; public static final String TABLE_NAME = "PkgRecordTable"; public static final String UPDATE_TIME = "updateTime"; private static PkgRecordTable sInstance; private DataBaseHelper mDatabaseHelper; private PkgRecordTable(Context context) { this.mDatabaseHelper = DataBaseHelper.getInstance(context); } public static synchronized PkgRecordTable getInstance(Context context) { PkgRecordTable pkgRecordTable; synchronized (PkgRecordTable.class) { if (sInstance == null) { sInstance = new PkgRecordTable(context); } pkgRecordTable = sInstance; } return pkgRecordTable; } public boolean insertData(String packageName) { boolean z = false; if (!TextUtils.isEmpty(packageName)) { SQLiteDatabase sqlDatabase = null; try { sqlDatabase = this.mDatabaseHelper.getWritableDatabase(); sqlDatabase.beginTransaction(); ContentValues values = new ContentValues(); values.put("packageName", packageName); values.put(HASH, Integer.valueOf(packageName.hashCode())); values.put("updateTime", Long.valueOf(System.currentTimeMillis())); sqlDatabase.replace(TABLE_NAME, (String) null, values); sqlDatabase.setTransactionSuccessful(); z = true; if (sqlDatabase != null && sqlDatabase.inTransaction()) { sqlDatabase.endTransaction(); } } catch (Exception e) { LogUtils.e("Ad_SDK", "PkgRecordTable--insertData Exception!", e); if (sqlDatabase != null && sqlDatabase.inTransaction()) { sqlDatabase.endTransaction(); } } catch (Throwable th) { if (sqlDatabase != null && sqlDatabase.inTransaction()) { sqlDatabase.endTransaction(); } throw th; } } return z; } public boolean deleteDataBefore(long timePoint) { boolean z = true; if (timePoint <= 0) { return false; } if (this.mDatabaseHelper.delete(TABLE_NAME, " updateTime < ? ", new String[]{String.valueOf(timePoint)}) <= 0) { z = false; } return z; } /* JADX WARNING: Removed duplicated region for block: B:10:0x0060 */ /* JADX WARNING: Removed duplicated region for block: B:13:0x006b */ /* Code decompiled incorrectly, please refer to instructions dump. */ public android.util.SparseArray<com.jiubang.commerce.database.model.InstalledPkgBean> getAllData() { /* r20 = this; android.util.SparseArray r16 = new android.util.SparseArray r16.<init>() java.util.ArrayList r14 = new java.util.ArrayList r14.<init>() r11 = 0 java.lang.String r9 = "updateTime DESC" r0 = r20 com.jiubang.commerce.database.DataBaseHelper r2 = r0.mDatabaseHelper // Catch:{ Exception -> 0x007d } java.lang.String r3 = "PkgRecordTable" r4 = 0 r5 = 0 r6 = 0 r7 = 0 r8 = 0 android.database.Cursor r11 = r2.query(r3, r4, r5, r6, r7, r8, r9) // Catch:{ Exception -> 0x007d } if (r11 == 0) goto L_0x005e boolean r2 = r11.moveToFirst() // Catch:{ Exception -> 0x007d } if (r2 == 0) goto L_0x005e r10 = 0 L_0x0025: com.jiubang.commerce.database.model.InstalledPkgBean r10 = new com.jiubang.commerce.database.model.InstalledPkgBean // Catch:{ Exception -> 0x007d } r10.<init>() // Catch:{ Exception -> 0x007d } java.lang.String r2 = "packageName" int r2 = r11.getColumnIndex(r2) // Catch:{ Exception -> 0x007d } java.lang.String r15 = r11.getString(r2) // Catch:{ Exception -> 0x007d } java.lang.String r2 = "hash" int r2 = r11.getColumnIndex(r2) // Catch:{ Exception -> 0x007d } int r13 = r11.getInt(r2) // Catch:{ Exception -> 0x007d } java.lang.String r2 = "updateTime" int r2 = r11.getColumnIndex(r2) // Catch:{ Exception -> 0x007d } long r18 = r11.getLong(r2) // Catch:{ Exception -> 0x007d } r10.setPackageName(r15) // Catch:{ Exception -> 0x007d } r0 = r18 r10.setUpdateTime(r0) // Catch:{ Exception -> 0x007d } r14.add(r10) // Catch:{ Exception -> 0x007d } r0 = r16 r0.put(r13, r10) // Catch:{ Exception -> 0x007d } boolean r2 = r11.moveToNext() // Catch:{ Exception -> 0x007d } if (r2 != 0) goto L_0x0025 L_0x005e: if (r11 == 0) goto L_0x0063 r11.close() L_0x0063: int r2 = r14.size() r3 = 500(0x1f4, float:7.0E-43) if (r2 <= r3) goto L_0x007c r2 = 499(0x1f3, float:6.99E-43) java.lang.Object r2 = r14.get(r2) com.jiubang.commerce.database.model.InstalledPkgBean r2 = (com.jiubang.commerce.database.model.InstalledPkgBean) r2 long r2 = r2.getUpdateTime() r0 = r20 r0.deleteDataBefore(r2) L_0x007c: return r16 L_0x007d: r12 = move-exception r12.printStackTrace() // Catch:{ all -> 0x0087 } if (r11 == 0) goto L_0x0063 r11.close() goto L_0x0063 L_0x0087: r2 = move-exception if (r11 == 0) goto L_0x008d r11.close() L_0x008d: throw r2 */ throw new UnsupportedOperationException("Method not decompiled: com.jiubang.commerce.database.table.PkgRecordTable.getAllData():android.util.SparseArray"); } }
[ "80718901@qq.com" ]
80718901@qq.com
6a15eec3e2f703cb63c389c7b91709cef2eed2a4
83df42e12908068e246e5b87facc034bab39fb9f
/src/main/java/org/smart4j/framework/helper/ConfigHelper.java
43b66af870e706ae67fa408fb708420643133def
[]
no_license
RayZhangSB/smart_framework
c18e82c1ecfd993e887d4fd7914544e4551dfefe
d98d998d372afb707d7aaf16a3f5a957dce8cfd3
refs/heads/master
2020-03-15T23:52:07.191145
2018-05-24T08:05:01
2018-05-24T08:05:01
132,402,400
0
0
null
null
null
null
UTF-8
Java
false
false
1,494
java
package org.smart4j.framework.helper; import org.smart4j.framework.ConfigConstant; import org.smart4j.framework.util.PropsUtil; import java.util.Properties; import static org.smart4j.framework.ConfigConstant.CONFIG_FILE; /** * @ClassName ConfigHelper * @Description:属性文件助手 * @Author Raymond Zhang * @Date 2018/5/6 17:59 * @Version 1.0 **/ public final class ConfigHelper { private static final Properties CONFIG_PROPS = PropsUtil.loadProps(CONFIG_FILE); public static String getJdbcDriver() { return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_DRIVER); } public static String getJdbcUrl() { return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_URL); } public static String getJdbcUserName() { return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_USERNAME); } public static String getJdbcPassword() { return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_PASSWORD); } public static String getAppBasePackage() { return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_BASE_PACKAGE); } public static String getAppJspPath() { return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_JSP_PATH, "/WEB-INF/view/"); } public static String getAppAssetPath() { return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_ASSET_PATH, "/asset/"); } public static int getAppUploadLimit() { return 50; } }
[ "995858246@qq.com" ]
995858246@qq.com
0c5b32a8045deccb23640e9e0af9d382bba724d8
0be92950649594e8109ceacfeb6f08061974587c
/mybatis-mate/src/main/java/cn/newphy/druid/sql/visitor/functions/Trim.java
ba97cf607812d752e0877e4a226c8aa21b719624
[]
no_license
Newphy/orm-mate
73f4a02a9ee0438ee09a4c449777f71fb5ada8d7
e74e0176a59f5b2956ea51db26a73a8a645a02a1
refs/heads/master
2020-03-27T17:10:17.436937
2018-08-31T06:30:25
2018-08-31T06:30:25
146,832,634
0
0
null
null
null
null
UTF-8
Java
false
false
1,518
java
/* * Copyright 1999-2018 Alibaba Group Holding Ltd. * * 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 cn.newphy.druid.sql.visitor.functions; import static cn.newphy.druid.sql.visitor.SQLEvalVisitor.EVAL_VALUE; import cn.newphy.druid.sql.ast.SQLExpr; import cn.newphy.druid.sql.ast.expr.SQLMethodInvokeExpr; import cn.newphy.druid.sql.visitor.SQLEvalVisitor; public class Trim implements Function { public final static Trim instance = new Trim(); public Object eval(SQLEvalVisitor visitor, SQLMethodInvokeExpr x) { if (x.getParameters().size() != 1) { return SQLEvalVisitor.EVAL_ERROR; } SQLExpr param0 = x.getParameters().get(0); param0.accept(visitor); Object param0Value = param0.getAttributes().get(EVAL_VALUE); if (param0Value == null) { return SQLEvalVisitor.EVAL_ERROR; } String strValue = param0Value.toString(); String result = strValue.trim(); return result; } }
[ "liuhui18@xiaoniu66.com" ]
liuhui18@xiaoniu66.com
e88a6c684d59b8296aa87b4afe35c089da170481
85c3aadf4c8f3fbd8ad5a3f4c7437aea22291fb5
/spring-introduction/src/main/java/com/example/ch02_factory/servlet/DemoServlet.java
264b845ee2e627201d6bdbf81053605c46cb5811
[ "Apache-2.0" ]
permissive
lijing0221/spring-framework-projects
a088ac5fb13a8f5b17f921b700af186baf06028e
eb07addffd7428d3483a40c4a55167ee444b1962
refs/heads/master
2023-01-14T16:10:48.434354
2020-11-20T11:34:03
2020-11-20T11:34:03
313,318,851
0
0
null
null
null
null
UTF-8
Java
false
false
831
java
package com.example.ch02_factory.servlet; import com.example.ch02_factory.factory.BeanFactory; import com.example.ch02_factory.service.DemoService; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; /** * Servlet 测试示例 * * @author lijing * @date 2020/11/19 21:01 **/ @WebServlet(urlPatterns = "/factory") public class DemoServlet extends HttpServlet { public static final DemoService demoService = BeanFactory.getDemoService(); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { List<String> all = demoService.findAll(); resp.getWriter().println(all); } }
[ "lijing@didachuxing.com" ]
lijing@didachuxing.com
77ee2d77adfdf43b2af32b3cd8c66ea7c54ea1d4
af02ef11699eeda493977488913d166710dac23d
/src/com/resmanager/client/view/PullableScrollView.java
125780fb079764d4abebad303e3c5207104106d6
[]
no_license
Rachel-hsw/ResManagerClient
3ac212ab91f5fe06893de445d3591170aadfee18
f4b1f6958b0b3949e9e6e575877cf62a67e147e9
refs/heads/master
2021-06-29T18:47:45.628225
2017-09-13T10:16:36
2017-09-13T10:16:36
103,385,544
0
1
null
null
null
null
UTF-8
Java
false
false
814
java
package com.resmanager.client.view; import android.content.Context; import android.util.AttributeSet; import android.widget.ScrollView; public class PullableScrollView extends ScrollView implements Pullable { public PullableScrollView(Context context) { super(context); } public PullableScrollView(Context context, AttributeSet attrs) { super(context, attrs); } public PullableScrollView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public boolean canPullDown() { if (getScrollY() == 0) return true; else return false; } @Override public boolean canPullUp() { if (getScrollY() >= (getChildAt(0).getHeight() - getMeasuredHeight())) return true; else return false; } }
[ "1623404291@qq.com" ]
1623404291@qq.com
52579574f4ff12f7efc9a7b50400071068e9a4c6
36c7d9828c5158370144b61eeb7f56ac8ed50162
/src/main/java/org/opensha/sra/gui/BCR_Application.java
8d338b622f9a2f4799073444ab3adcc91eac4385
[ "Apache-2.0" ]
permissive
Aditya-Zutshi/opensha
92f1a5112c855fec37afea27150b4588fd14d077
d0e862a62bb3cdd262c4f33742b3a071da6b21b7
refs/heads/master
2023-08-28T05:00:38.792472
2021-10-26T08:13:18
2021-10-26T08:13:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
37,885
java
/******************************************************************************* * Copyright 2009 OpenSHA.org in partnership with * the Southern California Earthquake Center (SCEC, http://www.scec.org) * at the University of Southern California and the UnitedStates Geological * Survey (USGS; http://www.usgs.gov) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package org.opensha.sra.gui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.SystemColor; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.text.DecimalFormat; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.border.BevelBorder; import javax.swing.border.Border; import org.apache.commons.lang3.SystemUtils; import org.opensha.commons.data.Site; import org.opensha.commons.data.function.ArbitrarilyDiscretizedFunc; import org.opensha.commons.data.function.DiscretizedFunc; import org.opensha.commons.geo.Location; import org.opensha.commons.geo.LocationList; import org.opensha.commons.gui.DisclaimerDialog; import org.opensha.commons.param.event.ParameterChangeEvent; import org.opensha.commons.param.event.ParameterChangeListener; import org.opensha.commons.util.ApplicationVersion; import org.opensha.commons.util.ExceptionUtils; import org.opensha.commons.util.FileUtils; import org.opensha.commons.util.ServerPrefUtils; import org.opensha.commons.util.bugReports.BugReport; import org.opensha.commons.util.bugReports.BugReportDialog; import org.opensha.commons.util.bugReports.DefaultExceptoinHandler; import org.opensha.sha.calc.HazardCurveCalculator; import org.opensha.sha.calc.HazardCurveCalculatorAPI; import org.opensha.sha.calc.params.MaxDistanceParam; import org.opensha.sha.earthquake.BaseERF; import org.opensha.sha.earthquake.ERF; import org.opensha.sha.earthquake.ERF_Ref; import org.opensha.sha.gui.beans.ERF_GuiBean; import org.opensha.sha.gui.beans.IMR_GuiBean; import org.opensha.sha.gui.beans.IMR_GuiBeanAPI; import org.opensha.sha.gui.beans.Site_GuiBean; import org.opensha.sha.gui.controls.SetMinSourceSiteDistanceControlPanel; import org.opensha.sha.gui.controls.SetSiteParamsFromWebServicesControlPanel; import org.opensha.sha.gui.controls.SitesOfInterestControlPanel; import org.opensha.sha.gui.infoTools.CalcProgressBar; import org.opensha.sha.gui.infoTools.IMT_Info; import org.opensha.sha.imr.ScalarIMR; import org.opensha.sha.imr.param.IntensityMeasureParams.PeriodParam; import org.opensha.sha.imr.param.IntensityMeasureParams.SA_Param; import org.opensha.sra.calc.BenefitCostCalculator; import org.opensha.sra.calc.EALCalculator; import org.opensha.sra.gui.components.BenefitCostBean; import org.opensha.sra.gui.components.GuiBeanAPI; import org.opensha.sra.vulnerability.AbstractVulnerability; /** * <p>Title: BCR_Application</p> * <p>Description: </p> * @author Nitin Gupta and Vipin Gupta * Date : Feb , 2006 * @version 1.0 */ public class BCR_Application extends JFrame implements Runnable, ParameterChangeListener, IMR_GuiBeanAPI{ protected static final String APP_NAME = "Benefit Cost Ratio Application"; protected static final String APP_SHORT_NAME = "BCR_Application"; private static final long serialVersionUID = 0x1B8589F; /** * Name of the class */ private final static String C = "BCR_Application"; // for debug purpose protected final static boolean D = false; // instances of the GUI Beans which will be shown in this applet protected ERF_GuiBean erfGuiBean; protected IMR_GuiBean imrGuiBean; protected Site_GuiBean siteGuiBean; private JLabel openshaImgLabel = new JLabel(new ImageIcon(FileUtils.loadImage("logos/PoweredByOpenSHA_Agua.jpg"))); private JLabel usgsImgLabel = new JLabel(new ImageIcon(FileUtils.loadImage("logos/usgs_resrisk.gif"))); private JLabel riskAgoraImgLabel = new JLabel(new ImageIcon(FileUtils.loadImage("logos/AgoraOpenRisk.jpg"))); // Strings for control pick list protected final static String CONTROL_PANELS = "Control Panels"; protected final static String DISTANCE_CONTROL = "Max Source-Site Distance"; protected final static String SITES_OF_INTEREST_CONTROL = "Sites of Interest"; protected final static String CVM_CONTROL = "Set Site Params from Web Services"; // objects for control panels protected SetMinSourceSiteDistanceControlPanel distanceControlPanel; protected SitesOfInterestControlPanel sitesOfInterest; protected SetSiteParamsFromWebServicesControlPanel cvmControlPanel; private Insets plotInsets = new Insets( 4, 10, 4, 4 ); private Border border1; // default insets protected Insets defaultInsets = new Insets( 4, 4, 4, 4 ); // height and width of the applet protected final static int W = 1100; protected final static int H = 770; //holds the ArbitrarilyDiscretizedFunc protected ArbitrarilyDiscretizedFunc function; protected String TITLE = new String("BCR Calculator"); private JPanel jPanel1 = new JPanel(); private Border border2; private final static Dimension COMBO_DIM = new Dimension( 180, 30 ); private final static Dimension BUTTON_DIM = new Dimension( 80, 20 ); private Border border3; private Border border4; private Border border5; private Border border6; private Border border7; private Border border8; JSplitPane topSplitPane = new JSplitPane(); JButton clearButton = new JButton(); JPanel buttonPanel = new JPanel(); JCheckBox progressCheckBox = new JCheckBox(); JButton addButton = new JButton(); JComboBox controlComboBox = new JComboBox(); JSplitPane chartSplit = new JSplitPane(); JPanel panel = new JPanel(); /** * adding scroll pane for showing data */ private JScrollPane dataScrollPane = new JScrollPane(); // text area to show the data values private JTextArea pointsTextArea = new JTextArea(); GridBagLayout gridBagLayout9 = new GridBagLayout(); GridBagLayout gridBagLayout8 = new GridBagLayout(); JSplitPane imrSplitPane = new JSplitPane(); GridBagLayout gridBagLayout5 = new GridBagLayout(); JPanel erfTimespanPanel = new JPanel(); JPanel siteLocPanel = new JPanel(); JSplitPane controlsSplit = new JSplitPane(); JTabbedPane paramsTabbedPane = new JTabbedPane(); JPanel structuralPanel = new JPanel(); private BenefitCostBean bcbean ; private JPanel bcPanel; GridBagLayout gridBagLayout15 = new GridBagLayout(); GridBagLayout gridBagLayout13 = new GridBagLayout(); GridBagLayout gridBagLayout12 = new GridBagLayout(); JPanel imrPanel = new JPanel(); GridBagLayout gridBagLayout10 = new GridBagLayout(); BorderLayout borderLayout1 = new BorderLayout(); //instances of various calculators HazardCurveCalculatorAPI calc; CalcProgressBar progressClass; protected CalcProgressBar startAppProgressClass; //timer threads to show the progress of calculations Timer timer; //calculation thead Thread calcThread; //checks to see if HazardCurveCalculations are done boolean isHazardCalcDone= false; //counts the number of computation done till now private int computationDisplayCount =0; private DecimalFormat bcrFormat = new DecimalFormat("0.00"); /**this boolean keeps track when to plot the new data on top of other and when to *add to the existing data. * If it is true then add new data on top of existing data, but if it is false * then add new data to the existing data(this option only works if it is ERF_List). * */ boolean addData= true; protected JButton cancelCalcButton = new JButton(); private FlowLayout flowLayout1 = new FlowLayout(); //Construct the applet public BCR_Application() { } //Initialize the applet public void init() { try { // initialize the control pick list initControlList(); // initialize the GUI components startAppProgressClass = new CalcProgressBar("Starting Application", "Initializing Application .. Please Wait"); jbInit(); // initialize the various GUI beans initBenefitCostBean(); initIMR_GuiBean(); initSiteGuiBean(); try{ initERF_GuiBean(); }catch(RuntimeException e){ JOptionPane.showMessageDialog(this,"Connection to ERF's failed","Internet Connection Problem", JOptionPane.OK_OPTION); e.printStackTrace(); startAppProgressClass.dispose(); System.exit(0); } } catch(Exception e) { ExceptionUtils.throwAsRuntimeException(e); } startAppProgressClass.dispose(); ((JPanel)getContentPane()).updateUI(); } private static ApplicationVersion version; /** * Returns the Application version * @return ApplicationVersion */ public static ApplicationVersion getAppVersion(){ if (version == null) { try { version = ApplicationVersion.loadBuildVersion(); } catch (IOException e) { e.printStackTrace(); } } return version; } //Component initialization protected void jbInit() throws Exception { border1 = BorderFactory.createLineBorder(SystemColor.controlText,1); border2 = BorderFactory.createLineBorder(SystemColor.controlText,1); border3 = BorderFactory.createEmptyBorder(); border4 = BorderFactory.createLineBorder(SystemColor.controlText,1); border5 = BorderFactory.createLineBorder(SystemColor.controlText,1); border6 = BorderFactory.createBevelBorder(BevelBorder.RAISED,Color.white,Color.white,new Color(98, 98, 112),new Color(140, 140, 161)); border7 = BorderFactory.createBevelBorder(BevelBorder.RAISED,Color.white,Color.white,new Color(98, 98, 112),new Color(140, 140, 161)); border8 = BorderFactory.createBevelBorder(BevelBorder.RAISED,Color.white,Color.white,new Color(98, 98, 112),new Color(140, 140, 161)); this.getContentPane().setLayout(borderLayout1); jPanel1.setLayout(gridBagLayout10); jPanel1.setBackground(Color.white); jPanel1.setBorder(border4); jPanel1.setMinimumSize(new Dimension(959, 600)); jPanel1.setPreferredSize(new Dimension(959, 600)); //loading the OpenSHA Logo topSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); clearButton.setText("Clear Results"); clearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { clearButton_actionPerformed(e); } }); buttonPanel.setMinimumSize(new Dimension(568, 20)); buttonPanel.setLayout(flowLayout1); progressCheckBox.setFont(new java.awt.Font("Dialog", 1, 12)); progressCheckBox.setSelected(true); progressCheckBox.setText("Show Progress Bar"); addButton.setText("Compute"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { addButton_actionPerformed(e); } }); controlComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { controlComboBox_actionPerformed(e); } }); panel.setLayout(gridBagLayout9); panel.setBackground(Color.white); panel.setBorder(border5); panel.setMinimumSize(new Dimension(0, 0)); imrSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); dataScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setBorder( BorderFactory.createEtchedBorder() ); dataScrollPane.getViewport().add( pointsTextArea, null ); pointsTextArea.setEditable(false); pointsTextArea.setLineWrap(true); panel.add(dataScrollPane,new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, plotInsets, 0, 0 ) ); erfTimespanPanel.setLayout(gridBagLayout13); erfTimespanPanel.setBackground(Color.white); siteLocPanel.setLayout(gridBagLayout8); siteLocPanel.setBackground(Color.white); controlsSplit.setDividerSize(5); structuralPanel.setLayout(gridBagLayout5); structuralPanel.setBackground(Color.white); structuralPanel.setBorder(border2); structuralPanel.setMaximumSize(new Dimension(2147483647, 10000)); structuralPanel.setMinimumSize(new Dimension(2, 300)); structuralPanel.setPreferredSize(new Dimension(2, 300)); imrPanel.setLayout(gridBagLayout15); imrPanel.setBackground(Color.white); chartSplit.setLeftComponent(panel); chartSplit.setRightComponent(paramsTabbedPane); cancelCalcButton.setText("Cancel"); cancelCalcButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { cancelCalcButton_actionPerformed(e); } }); this.getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.add(topSplitPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 4, 5, 6), 243, 231)); buttonPanel.add(controlComboBox, 0); buttonPanel.add(addButton, 1); buttonPanel.add(cancelCalcButton, 2); buttonPanel.add(clearButton, 3); buttonPanel.add(progressCheckBox, 4); buttonPanel.add(usgsImgLabel, 5); buttonPanel.add(openshaImgLabel, 6); buttonPanel.add(riskAgoraImgLabel,7); //making the cancel button not visible until user has started to do the calculation cancelCalcButton.setVisible(false); topSplitPane.add(chartSplit, JSplitPane.TOP); chartSplit.add(panel, JSplitPane.LEFT); chartSplit.add(paramsTabbedPane, JSplitPane.RIGHT); imrSplitPane.add(imrPanel, JSplitPane.TOP); imrSplitPane.add(siteLocPanel, JSplitPane.BOTTOM); controlsSplit.add(imrSplitPane, JSplitPane.LEFT); controlsSplit.add(erfTimespanPanel, JSplitPane.RIGHT); paramsTabbedPane.add(structuralPanel, "Set Structural Type"); paramsTabbedPane.add(controlsSplit, "Set Hazard Curve"); topSplitPane.add(buttonPanel, JSplitPane.BOTTOM); topSplitPane.setDividerLocation(590); imrSplitPane.setDividerLocation(300); controlsSplit.setDividerLocation(230); structuralPanel.setLayout(gridBagLayout5); chartSplit.setDividerLocation(590); this.setSize(W,H); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation((dim.width - this.getSize().width) / 2, 0); //EXIT_ON_CLOSE == 3 this.setDefaultCloseOperation(3); this.setTitle("BCR Application "); } //Main method public static void main(String[] args) { new DisclaimerDialog(APP_NAME, APP_SHORT_NAME, getAppVersion()); DefaultExceptoinHandler exp = new DefaultExceptoinHandler( APP_SHORT_NAME, getAppVersion(), null, null); Thread.setDefaultUncaughtExceptionHandler(exp); BCR_Application applet = new BCR_Application(); exp.setApp(applet); exp.setParent(applet); applet.init(); applet.setVisible(true); } //static initializer for setting look & feel static { String osName = System.getProperty("os.name"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { } } /** * this function is called when Add Graph button is clicked * @param e */ void addButton_actionPerformed(ActionEvent e) { cancelCalcButton.setVisible(true); addButton(); } /** * Implementing the run method in the Runnable interface that creates a new thread * to do Hazard Curve Calculation, this thread created is seperate from the * timer thread, so that progress bar updation does not conflicts with Calculations. */ public void run() { try{ computeHazardCurve(); cancelCalcButton.setVisible(false); //disaggCalc = null; calcThread = null; }catch(Exception e){ setButtonsEnable(true); e.printStackTrace(); BugReport bug = new BugReport(e, getParametersInfoAsString(), APP_SHORT_NAME, getAppVersion(), this); BugReportDialog bugDialog = new BugReportDialog(this, bug, false); bugDialog.setVisible(true); } } /** * This method creates the HazardCurveCalc and Disaggregation Calc(if selected) instances. * If the internet connection is available then it creates a remote instances of * the calculators on server where the calculations take place, else * calculations are performed on the user's own machine. */ protected void createCalcInstance(){ try{ calc = new HazardCurveCalculator(); } catch (Exception ex) { ex.printStackTrace(); } } /** * this function is called to draw the graph */ protected void addButton() { setButtonsEnable(false); // do not show warning messages in IMR gui bean. this is needed // so that warning messages for site parameters are not shown when Add graph is clicked imrGuiBean.showWarningMessages(false); try{ createCalcInstance(); }catch(Exception e){ setButtonsEnable(true); e.printStackTrace(); BugReport bug = new BugReport(e, getParametersInfoAsString(), APP_SHORT_NAME, getAppVersion(), this); BugReportDialog bugDialog = new BugReportDialog(this, bug, true); bugDialog.setVisible(true); } // check if progress bar is desired and set it up if so if(this.progressCheckBox.isSelected()) { calcThread = new Thread(this); calcThread.start(); timer = new Timer(200, new ActionListener() { public void actionPerformed(ActionEvent evt) { try{ int totRupture = calc.getTotRuptures(); int currRupture = calc.getCurrRuptures(); boolean totCurCalculated = true; if(currRupture ==-1){ progressClass.setProgressMessage("Please wait, calculating total rutures ...."); totCurCalculated = false; } if(!isHazardCalcDone && totCurCalculated) progressClass.updateProgress(currRupture, totRupture); if (isHazardCalcDone) { timer.stop(); progressClass.dispose(); } }catch(Exception e){ e.printStackTrace(); } } }); } else { this.computeHazardCurve(); } } /** * * @return the application component */ protected Component getApplicationComponent(){ return this; } /** * this function is called when "clear plot" is selected * * @param e */ void clearButton_actionPerformed(ActionEvent e) { this.pointsTextArea.setText(""); computationDisplayCount = 0; } /** * Any time a control paramater or independent paramater is changed * by the user in a GUI this function is called, and a paramater change * event is passed in. This function then determines what to do with the * information ie. show some paramaters, set some as invisible, * basically control the paramater lists. * * @param event */ public void parameterChange( ParameterChangeEvent event ) { String S = C + ": parameterChange(): "; if ( D ) System.out.println( "\n" + S + "starting: " ); String name1 = event.getParameterName(); // if IMR selection changed, update the site parameter list and supported IMT if ( name1.equalsIgnoreCase(imrGuiBean.IMR_PARAM_NAME)) { ScalarIMR imr = imrGuiBean.getSelectedIMR_Instance(); siteGuiBean.replaceSiteParams(imr.getSiteParamsIterator()); siteGuiBean.validate(); siteGuiBean.repaint(); } if(name1.equalsIgnoreCase(bcbean.getCurrentVulnParam().getName())){ AbstractVulnerability currentModel = bcbean.getVulnModel(bcbean.CURRENT); String currentIMT = currentModel.getIMT(); double currentPeriod = 0; if(currentIMT.equals(SA_Param.NAME)) currentPeriod = currentModel.getPeriod(); AbstractVulnerability newModel = bcbean.getVulnModel(bcbean.RETRO); String newIMT = newModel.getIMT(); double newPeriod = 0; if(newIMT.equals(SA_Param.NAME)) newPeriod = newModel.getPeriod(); imrGuiBean.setIMRParamListAndEditor(currentIMT, newIMT, currentPeriod, newPeriod); ScalarIMR imr = imrGuiBean.getSelectedIMR_Instance(); siteGuiBean.replaceSiteParams(imr.getSiteParamsIterator()); siteGuiBean.validate(); siteGuiBean.repaint(); } } /** * Function to make the buttons enable or disable in the application. * It is used in application to disable the button in the buttons panel * if some computation is already going on. * @param b */ protected void setButtonsEnable(boolean b){ addButton.setEnabled(b); clearButton.setEnabled(b); progressCheckBox.setEnabled(b); } /** * Gets the probabilities functiion based on selected parameters * this function is called when add Graph is clicked */ protected void computeHazardCurve() { //starting the calculation isHazardCalcDone = false; BaseERF forecast = null; // get the selected forecast model try { // whether to show progress bar in case of update forecast erfGuiBean.showProgressBar(this.progressCheckBox.isSelected()); //get the selected ERF instance forecast = erfGuiBean.getSelectedERF(); } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(this, e.getMessage(), "Incorrect Values", JOptionPane.ERROR_MESSAGE); setButtonsEnable(true); return; } if (this.progressCheckBox.isSelected()) { progressClass = new CalcProgressBar("Hazard-Curve Calc Status", "Beginning Calculation "); progressClass.displayProgressBar(); timer.start(); } AbstractVulnerability currentModel = bcbean.getVulnModel(bcbean.CURRENT); String currentIMT = currentModel.getIMT(); double currentPeriod = 0; if(currentIMT.equals(SA_Param.NAME)) currentPeriod = currentModel.getPeriod(); // ArrayList<Double> currentIMLs = currentModel.getIMLVals(); double[] currentIMLs = currentModel.getIMLValues(); AbstractVulnerability newModel = bcbean.getVulnModel(bcbean.RETRO); String newIMT = newModel.getIMT(); double newPeriod = 0; if(newIMT.equals(SA_Param.NAME)) newPeriod = newModel.getPeriod(); // ArrayList<Double> newIMLs = newModel.getIMLVals(); double[] newIMLs = newModel.getIMLValues(); // get the selected IMR ScalarIMR imr = imrGuiBean.getSelectedIMR_Instance(); // make a site object to pass to IMR Site site = siteGuiBean.getSite(); LocationList locs = new LocationList(); Location loc = site.getLocation(); locs.add(loc); // getting the wills site class values from servlet // String siteClass=""; // try { // ArrayList willsSiteClassList = ConnectToCVM.getWillsSiteTypeFromCVM(locs); // siteClass = (String)willsSiteClassList.get(0); // } catch (Exception e1) { // e1.printStackTrace(); // } // calculate the hazard curve try { if (distanceControlPanel != null) calc.setMaxSourceDistance( distanceControlPanel.getDistance()); } catch (Exception e) { setButtonsEnable(true); e.printStackTrace(); BugReport bug = new BugReport(e, getParametersInfoAsString(), APP_SHORT_NAME, getAppVersion(), this); BugReportDialog bugDialog = new BugReportDialog(this, bug, false); bugDialog.setVisible(true); } ArbitrarilyDiscretizedFunc currentHazardCurve = calcHazardCurve(currentIMT,currentPeriod,currentIMLs,site,forecast,imr); ArbitrarilyDiscretizedFunc currentAnnualizedRates= null; currentAnnualizedRates = (ArbitrarilyDiscretizedFunc)calc.getAnnualizedRates(currentHazardCurve, forecast.getTimeSpan().getDuration()); ArbitrarilyDiscretizedFunc retroHazardCurve = calcHazardCurve(newIMT,newPeriod,newIMLs,site,forecast,imr); ArbitrarilyDiscretizedFunc retroAnnualizedRates = null; retroAnnualizedRates = (ArbitrarilyDiscretizedFunc)calc.getAnnualizedRates(retroHazardCurve, forecast.getTimeSpan().getDuration()); EALCalculator currentCalc = new EALCalculator(currentAnnualizedRates,currentModel.getVulnerabilityFunc(), bcbean.getCurrentReplaceCost()); double currentEALVal = currentCalc.computeEAL(); EALCalculator retroCalc = new EALCalculator(retroAnnualizedRates,newModel.getVulnerabilityFunc(),bcbean.getRetroReplaceCost()); double newEALVal = retroCalc.computeEAL(); BenefitCostCalculator bcCalc = new BenefitCostCalculator(currentEALVal,newEALVal,bcbean.getDiscountRate(), bcbean.getDesignLife(),bcbean.getRetroCost()); double bcr = bcCalc.computeBCR(); double benefit = bcCalc.computeBenefit(); double cost = bcCalc.computeCost(); isHazardCalcDone = true; displayData(currentHazardCurve,retroHazardCurve,currentEALVal,newEALVal,bcr,benefit,cost); setButtonsEnable(true); } private void displayData(ArbitrarilyDiscretizedFunc currentHazardCurve,ArbitrarilyDiscretizedFunc retroHazardCurve, double currentEALVal,double newEALVal,double bcr,double benefit,double cost){ ++computationDisplayCount; String data = pointsTextArea.getText(); if(computationDisplayCount !=1) data +="\n\n"; data +="Benefit Cost Ratio Calculation # "+computationDisplayCount+"\n"; data +="BCR Desc. = "+bcbean.getDescription()+"\n"; // data +="Site Class = "+siteClass+"\n"; data +="Current EAL Val = "+currentEALVal+"\nRetrofitted EAL Val = "+newEALVal+"\n"; data +="Benefit = $"+bcrFormat.format(benefit)+"\nBenefit Cost Ratio = "+bcr+"\n"; data +="Curent Hazard Curve"+"\n"+currentHazardCurve.toString(); data +="Retrofitted Hazard Curve"+"\n"+retroHazardCurve.toString()+"\n\n"; pointsTextArea.setText(data); } // private ArbitrarilyDiscretizedFunc calcHazardCurve(String imt, double period, ArrayList<Double> imls, // Site site,EqkRupForecastBaseAPI forecast,ScalarIntensityMeasureRelationshipAPI imr){ private ArbitrarilyDiscretizedFunc calcHazardCurve(String imt, double period, double[] imls, Site site,BaseERF forecast,ScalarIMR imr){ // initialize the values in condProbfunc with log values as passed in hazFunction // intialize the hazard function ArbitrarilyDiscretizedFunc hazFunction = new ArbitrarilyDiscretizedFunc(); initX_Values(hazFunction,imls,imt); imr.setIntensityMeasure(imt); imr.getParameter(PeriodParam.NAME).setValue(period); // ((AttenuationRelationship)imr).setIntensityMeasure(imt,period); //System.out.println("22222222HazFunction: "+hazFunction.toString()); try { // calculate the hazard curve //eqkRupForecast = (EqkRupForecastAPI)FileUtils.loadObject("erf.obj"); try { hazFunction = (ArbitrarilyDiscretizedFunc) calc.getHazardCurve( hazFunction, site,imr, (ERF) forecast); } catch (Exception e) { e.printStackTrace(); setButtonsEnable(true); } hazFunction = toggleHazFuncLogValues(hazFunction,imls); hazFunction.setInfo(getParametersInfoAsString()); } catch (RuntimeException e) { JOptionPane.showMessageDialog(this, e.getMessage(), "Parameters Invalid", JOptionPane.INFORMATION_MESSAGE); e.printStackTrace(); setButtonsEnable(true); return null; } return hazFunction; } /** * set x values in log space for Hazard Function to be passed to IMR * if the selected IMT are SA , PGA , PGV or FaultDispl * It accepts 1 parameters * * @param originalFunc : this is the function with X values set */ // private void initX_Values(DiscretizedFuncAPI arb,ArrayList<Double> imls, String imt){ private void initX_Values(DiscretizedFunc arb, double[] imls, String imt){ IMT_Info imtInfo = new IMT_Info(); if (imtInfo.isIMT_LogNormalDist(imt)) { for(int i=0;i<imls.length;++i) arb.set(Math.log(imls[i]),1); //System.out.println("11111111111HazFunction: "+arb.toString()); } else throw new RuntimeException("Unsupported IMT"); } /** * Initialize the IMR Gui Bean */ protected void initIMR_GuiBean() { AbstractVulnerability currentModel = bcbean.getVulnModel(bcbean.CURRENT); String currentIMT = currentModel.getIMT(); double currentPeriod = 0; if(currentIMT.equals(SA_Param.NAME)) currentPeriod = currentModel.getPeriod(); AbstractVulnerability newModel = bcbean.getVulnModel(bcbean.RETRO); String newIMT = newModel.getIMT(); double newPeriod = 0; if(newIMT.equals(SA_Param.NAME)) newPeriod = newModel.getPeriod(); imrPanel.removeAll(); imrGuiBean = new IMR_GuiBean(this,currentIMT,newIMT,currentPeriod,newPeriod); imrGuiBean.getParameterEditor(imrGuiBean.IMR_PARAM_NAME).getParameter().addParameterChangeListener(this); // show this gui bean the JPanel imrPanel.add(this.imrGuiBean,new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, defaultInsets, 0, 0 )); imrPanel.updateUI(); } /** * Initialize the site gui bean */ private void initSiteGuiBean() { // get the selected IMR ScalarIMR imr = imrGuiBean.getSelectedIMR_Instance(); // create the IMT Gui Bean object siteGuiBean = new Site_GuiBean(); siteGuiBean.addSiteParams(imr.getSiteParamsIterator()); siteLocPanel.setLayout(gridBagLayout8); siteLocPanel.add(siteGuiBean, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, defaultInsets, 0, 0)); siteLocPanel.updateUI(); } /** * Initialize the ERF Gui Bean */ protected void initERF_GuiBean() { if (erfGuiBean == null) { try { erfGuiBean = new ERF_GuiBean(ERF_Ref.get(false, ServerPrefUtils.SERVER_PREFS)); erfGuiBean.getParameter(erfGuiBean.ERF_PARAM_NAME). addParameterChangeListener(this); } catch (InvocationTargetException e) { e.printStackTrace(); //throw new RuntimeException("Connection to ERF's failed"); } } erfTimespanPanel.add(this.erfGuiBean, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, defaultInsets, 0, 0)); erfTimespanPanel.updateUI(); } /** * Initialize the Benefit cost GUI bean * */ protected void initBenefitCostBean(){ // creates the instance of the BenefitCost bean try { bcbean = new BenefitCostBean(); } catch (IOException e) { ExceptionUtils.throwAsRuntimeException(e); } bcPanel = (JPanel) bcbean.getVisualization(GuiBeanAPI.APPLICATION); bcbean.getRetroVulnParam().addParameterChangeListener(this); bcbean.getCurrentVulnParam().addParameterChangeListener(this); structuralPanel.add(bcPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); structuralPanel.validate(); structuralPanel.repaint(); } /** * Initialize the items to be added to the control list */ protected void initControlList() { controlComboBox.addItem(CONTROL_PANELS); controlComboBox.addItem(DISTANCE_CONTROL); controlComboBox.addItem(SITES_OF_INTEREST_CONTROL); controlComboBox.addItem(CVM_CONTROL); } /** * This function is called when controls pick list is chosen * @param e */ void controlComboBox_actionPerformed(ActionEvent e) { if(controlComboBox.getItemCount()<=0) return; String selectedControl = controlComboBox.getSelectedItem().toString(); if(selectedControl.equalsIgnoreCase(this.DISTANCE_CONTROL)) initDistanceControl(); else if(selectedControl.equalsIgnoreCase(this.SITES_OF_INTEREST_CONTROL)) initSitesOfInterestControl(); else if(selectedControl.equalsIgnoreCase(this.CVM_CONTROL)) initCVMControl(); controlComboBox.setSelectedItem(this.CONTROL_PANELS); } /** * Initialize the Min Source and site distance control. * This function is called when user selects "Source Site Distance Control" * from controls pick list */ private void initDistanceControl() { if(this.distanceControlPanel==null) distanceControlPanel = new SetMinSourceSiteDistanceControlPanel(this); distanceControlPanel.pack(); distanceControlPanel.setVisible(true); } /** * Initialize the Interesting sites control panel * It will provide a pick list of interesting sites */ private void initSitesOfInterestControl() { if(this.sitesOfInterest==null) sitesOfInterest = new SitesOfInterestControlPanel(this, this.siteGuiBean); sitesOfInterest.getComponent().pack(); sitesOfInterest.getComponent().setVisible(true); } /** * Initialize the Interesting sites control panel * It will provide a pick list of interesting sites */ private void initCVMControl() { if(this.cvmControlPanel==null) cvmControlPanel = new SetSiteParamsFromWebServicesControlPanel(this, this.imrGuiBean, this.siteGuiBean); cvmControlPanel.pack(); cvmControlPanel.setVisible(true); } /** * set x values back from the log space to the original linear values * for Hazard Function after completion of the Hazard Calculations * if the selected IMT are SA , PGA or PGV * It accepts 1 parameters * * @param hazFunction : this is the function with X values set */ // private ArbitrarilyDiscretizedFunc toggleHazFuncLogValues(ArbitrarilyDiscretizedFunc hazFunc,ArrayList<Double> imls){ private ArbitrarilyDiscretizedFunc toggleHazFuncLogValues(ArbitrarilyDiscretizedFunc hazFunc,double[] imls){ int numPoints = hazFunc.size(); DiscretizedFunc tempFunc = hazFunc.deepClone(); hazFunc = new ArbitrarilyDiscretizedFunc(); // take log only if it is PGA, PGV ,SA or FaultDispl for(int i=0;i<tempFunc.size();++i) hazFunc.set(imls[i],tempFunc.getY(i)); return hazFunc; } /** * * @return the String containing the values selected for different parameters */ public String getParametersInfoAsString(){ return getMapParametersInfoAsHTML().replaceAll("<br>",SystemUtils.LINE_SEPARATOR); } /** * * @return the String containing the values selected for different parameters */ public String getMapParametersInfoAsHTML(){ String imrMetadata; //if Probabilistic calculation then only add the metadata //for visible parameters imrMetadata = imrGuiBean.getVisibleParametersCloned().getParameterListMetadataString(); double maxSourceSiteDistance; if (distanceControlPanel != null) maxSourceSiteDistance = distanceControlPanel.getDistance(); else maxSourceSiteDistance = MaxDistanceParam.DEFAULT; return "<br>"+ "IMR Param List:" +"<br>"+ "---------------"+"<br>"+ imrMetadata+"<br><br>"+ "Site Param List: "+"<br>"+ "----------------"+"<br>"+ siteGuiBean.getParameterListEditor().getVisibleParametersCloned().getParameterListMetadataString()+"<br><br>"+ "Forecast Param List: "+"<br>"+ "--------------------"+"<br>"+ erfGuiBean.getERFParameterList().getParameterListMetadataString()+"<br><br>"+ "TimeSpan Param List: "+"<br>"+ "--------------------"+"<br>"+ erfGuiBean.getSelectedERFTimespanGuiBean().getParameterListMetadataString()+"<br><br>"+ "Max. Source-Site Distance = "+maxSourceSiteDistance; } /** * This function stops the hazard curve calculation if started, so that user does not * have to wait for the calculation to finish. * Note: This function has one advantage , it starts over the calculation again, but * if user has not changed any other parameter for the forecast, that won't * be updated, so saves time and memory for not updating the forecast everytime, * cancel is pressed. * @param e */ void cancelCalcButton_actionPerformed(ActionEvent e) { //stopping the Hazard Curve calculation thread calcThread.stop(); calcThread = null; //close the progress bar for the ERF GuiBean that displays "Updating Forecast". erfGuiBean.closeProgressBar(); //stoping the timer thread that updates the progress bar if(timer !=null && progressClass !=null){ timer.stop(); timer = null; progressClass.dispose(); } //stopping the Hazard Curve calculations on server if(calc !=null){ try{ calc.stopCalc(); calc = null; }catch(RuntimeException ee){ ee.printStackTrace(); setButtonsEnable(true); BugReport bug = new BugReport(ee, getParametersInfoAsString(), APP_SHORT_NAME, getAppVersion(), this); BugReportDialog bugDialog = new BugReportDialog(this, bug, false); bugDialog.setVisible(true); } } this.isHazardCalcDone = false; //making the buttons to be visible setButtonsEnable(true); cancelCalcButton.setVisible(false); } /** * This returns the Earthquake Forecast GuiBean which allows the the cybershake * control panel to set the forecast parameters from cybershake control panel, * similar to what they are set when calculating cybershaks curves. */ public ERF_GuiBean getEqkRupForecastGuiBeanInstance(){ return erfGuiBean; } /** * This returns the Site Guibean using which allows to set the site locations * in the OpenSHA application from cybershake control panel. */ public Site_GuiBean getSiteGuiBeanInstance() { return siteGuiBean; } /** * Updates the IMT_GuiBean to reflect the chnaged IM for the selected AttenuationRelationship. * This method is called from the IMR_GuiBean to update the application with the Attenuation's * supported IMs. * */ public void updateIM() { } /** * Updates the Site_GuiBean to reflect the chnaged SiteParams for the selected AttenuationRelationship. * This method is called from the IMR_GuiBean to update the application with the Attenuation's * Site Params. * */ public void updateSiteParams() { //get the selected IMR ScalarIMR imr = imrGuiBean.getSelectedIMR_Instance(); siteGuiBean.replaceSiteParams(imr.getSiteParamsIterator()); siteGuiBean.validate(); siteGuiBean.repaint(); } }
[ "kmilner@usc.edu" ]
kmilner@usc.edu
5d42566261e11f93d3f94bdbbfd926cf1a740c7e
bd5081e8f7d3d028f0c04ee6c0210b77b61532c6
/src/test/java/AOPTest.java
85dc045f03def5101854a4203a6b22f30c3ce382
[]
no_license
LOLtoulan/spring_annoaop
ffa5fa7f10d05c1e064ade9d0add9835c1d44257
364be275c59cc01b7d15070dfebc137971569f29
refs/heads/master
2021-01-03T17:41:05.811872
2020-02-13T04:07:56
2020-02-13T04:07:56
240,173,737
0
0
null
null
null
null
UTF-8
Java
false
false
697
java
import com.toulan.service.AccountService; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * @Author LOL_toulan * @Time 2020/2/12 19:29 * @Message */ public class AOPTest { public static void main(String[] args) { //获取容器 ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml"); //获取容器中对象 AccountService as = (AccountService) ac.getBean("accountService"); //执行方法 as.saveAccount(); System.out.println(); // as.updateAccount(5); System.out.println(); // as.deleteAccount(); } }
[ "1987108233@qq.com" ]
1987108233@qq.com
539b388a4b5b7963d83c093e60077d39414aa693
04208c15419cfbad47b8053e9f44101e5d9975d6
/Multithreading/Thread-Pools/Application.java
c2a7422e9c2cb2a5fe63c1fc902d7f1392f5c1bd
[]
no_license
gauthamhs/Java
7e88ce981ace631673102c93d038f65707535bc9
838e7fe71afb97175659e414d5c0b59f29682c2f
refs/heads/master
2020-12-24T06:16:31.962654
2016-11-06T01:36:52
2016-11-06T01:36:52
30,766,102
0
1
null
2015-02-17T18:57:47
2015-02-13T16:58:09
Java
UTF-8
Java
false
false
2,255
java
//Thread Pool is a way of managing different threads at the same time so that the program can work efficiently. //Its analogous to workers in a factory. There are say 5 tasks and each worker is given a specific task. //In this method. when one worker is done with a task or say that a task is completed, the idle worker is //assigned a new task. //The first three output statements run at the same time.When a thread has completed a task, the same thread //is assigned another task. //Executor provides methods to manage termination and methods to keep tracking progress of one //or more asynchronous tasks. import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; class Worker implements Runnable{ private int id; public Worker(int id) { this.id = id; } public void run() { System.out.println("Task Running: " + id); try { Thread.sleep(5000); } catch (InterruptedException e) { // Once the task is running, it has to wait 5 seconds to display // The task completed. e.printStackTrace(); } System.out.println("Task completed: " + id) ; } } public class Application { public static void main(String[] args) { // Worker worker = new Worker(); /*worker.run(); Thread t1 = new Thread(worker); t1.start();*/ ExecutorService executor = Executors.newFixedThreadPool(3); // Setting up the no. of threads assigned // for a task using the executor service. In this code, three threads from the thread pool are assigned for(int i=0;i<10;i++){ // i pertains to the no. of tasks the thread has to perform executor.submit(new Worker(i)); // All the tasks has been submitted. } executor.shutdown(); //The shutdown() method will allow previously submitted tasks to execute before terminating System.out.println("All tasks submitted"); try { executor.awaitTermination(1, TimeUnit.DAYS); //Tells the executor how much time it should wait // until all tasks have completed execution. } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("All Tasks Completed"); // Says when a task is completed. } }
[ "gauthamhs@gmail.com" ]
gauthamhs@gmail.com
8408800c83263b82bfbe0a5e3fed4a30f75a961b
68edc10c26c008b348419f0997b768e8dd014827
/module_2/src/bai1_introduction_to_java/thuc_hanh/KhaiBaoVaSuDungBien.java
f273fe2f4654658bd6b36cc2dbebfdba49cdf3f4
[]
no_license
thanhhau052/C0221G1-DuongThanhHau
4332a3f8db425dc56db96c74ed98afe9ce6de6d6
94379b8e44d757c2db5b79b30759a9db26e4fbcb
refs/heads/main
2023-06-26T18:21:49.711919
2021-07-31T16:51:04
2021-07-31T16:51:04
342,121,420
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package bai1_introduction_to_java.thuc_hanh; public class KhaiBaoVaSuDungBien { public static void main(String[] args) { int i = 10; float f = 20.5f; double d = 20.5; boolean b = true; char c = 'a'; String s = "Hà Nội"; System.out.println("i = " + i); System.out.println("f = " + f); System.out.println("d = " + d); System.out.println("b = " + b); System.out.println("c = " + c); System.out.println("s = " + s); } }
[ "you@example.com" ]
you@example.com
fd64e40ded68834aa9f9689b63f6c5312d39d206
e823bebfaf4d1ff71c674b7349258e4b43b9be5a
/BeTraffic/src/com/profete162/WebcamWallonnes/adapter/ImageMapReceivedCallback.java
d93c260b94714f9c90163a5d77aab384c7da726d
[]
no_license
KhalidElSayed/BeTraffic-Android-Client
f55599e846ef36fe454d1a1c4d92505b2122ac02
ac3ba347bacca2a582a2919043a165fb759f1a5e
refs/heads/master
2021-01-18T10:22:00.837445
2012-03-02T09:22:33
2012-03-02T09:22:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.profete162.WebcamWallonnes.adapter; import com.profete162.WebcamWallonnes.CamerasActivity; public interface ImageMapReceivedCallback { // Called when an image is rendered public void onImageReceived(CamerasActivity.ImageDisplayer displayer); }
[ "christophe.versieux@gmail.com" ]
christophe.versieux@gmail.com
231d5b789b590a10152d94ccd7a13c538411c232
5e8eec6ed490c0c1d4711ce6a9158aec4d4719ee
/shopping/src/com/company/shopping/action/TestAction.java
3123a6dca5d0d4c9695deabdf0de62a702685e6f
[]
no_license
PengLi1990/eclipse_backup
11466fecd9c2af576354199736faeffc6915e056
dab0f53d11a8296115190098245cddd384564384
refs/heads/master
2021-01-17T19:23:33.800457
2016-06-22T13:13:20
2016-06-22T13:13:20
57,083,724
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.company.shopping.action; import java.io.PrintWriter; import org.apache.struts2.ServletActionContext; public class TestAction { private String username; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String execute() throws Exception{ PrintWriter out = ServletActionContext.getResponse().getWriter(); out.println("Hello,World"); return null; } }
[ "peng_li_pre@qq.com" ]
peng_li_pre@qq.com
6ccf60888ef24fc9e80b7a77484dd4fb583558c6
b34d08d309984ddd1b7a0fba4c92f40d3d8f51fd
/src/sample/Controller/RequestFormController.java
f882b44adedec6347a1c1e04266a9b84ffa3d790
[]
no_license
Lojini/JavaFX-Public-Transport-Ticketing-System
75a43af897ce037147bd517853d3bb5d19811571
ecf518092eb5452ad7a5e600fdff2c356d49f2b5
refs/heads/master
2022-11-13T01:34:01.883840
2020-07-01T06:12:49
2020-07-01T06:12:49
276,057,862
0
0
null
null
null
null
UTF-8
Java
false
false
67
java
package sample.Controller; public class RequestFormController { }
[ "pavilojini29@gmail.com" ]
pavilojini29@gmail.com
0ba0606c9fd1fb63fc2e6053773a27572614a8cd
d7c5121237c705b5847e374974b39f47fae13e10
/airspan.netspan/src/main/java/Netspan/NBI_14_50/API/Statistics/LinkAdaptationRawGet.java
0dd7b80045060f62728573fb9ff14dcfafe4e692
[]
no_license
AirspanNetworks/SWITModules
8ae768e0b864fa57dcb17168d015f6585d4455aa
7089a4b6456621a3abd601cc4592d4b52a948b57
refs/heads/master
2022-11-24T11:20:29.041478
2020-08-09T07:20:03
2020-08-09T07:20:03
184,545,627
1
0
null
2022-11-16T12:35:12
2019-05-02T08:21:55
Java
UTF-8
Java
false
false
4,529
java
package Netspan.NBI_14_50.API.Statistics; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="NodeName" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="NodeId" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="DateStart" type="{http://www.w3.org/2001/XMLSchema}dateTime"/> * &lt;element name="DateEnd" type="{http://www.w3.org/2001/XMLSchema}dateTime"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "nodeName", "nodeId", "dateStart", "dateEnd" }) @XmlRootElement(name = "LinkAdaptationRawGet") public class LinkAdaptationRawGet { @XmlElement(name = "NodeName") protected List<String> nodeName; @XmlElement(name = "NodeId") protected List<String> nodeId; @XmlElement(name = "DateStart", required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar dateStart; @XmlElement(name = "DateEnd", required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar dateEnd; /** * Gets the value of the nodeName property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the nodeName property. * * <p> * For example, to add a new item, do as follows: * <pre> * getNodeName().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getNodeName() { if (nodeName == null) { nodeName = new ArrayList<String>(); } return this.nodeName; } /** * Gets the value of the nodeId property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the nodeId property. * * <p> * For example, to add a new item, do as follows: * <pre> * getNodeId().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getNodeId() { if (nodeId == null) { nodeId = new ArrayList<String>(); } return this.nodeId; } /** * Gets the value of the dateStart property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDateStart() { return dateStart; } /** * Sets the value of the dateStart property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDateStart(XMLGregorianCalendar value) { this.dateStart = value; } /** * Gets the value of the dateEnd property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDateEnd() { return dateEnd; } /** * Sets the value of the dateEnd property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDateEnd(XMLGregorianCalendar value) { this.dateEnd = value; } }
[ "build.Airspan.com" ]
build.Airspan.com
35cc6ad1cf93c366c087ecfa3b21af7ff9ca2abe
7c5ed6c01618d0ec5cea08692fb2384da90fb387
/src/main/java/com/qy/sp/fee/modules/piplecode/bwhite/BWhiteService.java
0bb8ab60fd1278ac6c83b2ae2aad3ac65f898146
[]
no_license
xtgodlike/SPFee
f5dac9de5b2e6fb0ae46d1d2ce215270ce318ea2
045bb2aca00afcd36b014813ade5daa723f0304f
refs/heads/master
2021-01-22T04:01:27.468202
2018-01-03T02:58:16
2018-01-03T02:58:16
92,421,411
0
1
null
null
null
null
UTF-8
Java
false
false
8,251
java
package com.qy.sp.fee.modules.piplecode.bwhite; import java.math.BigDecimal; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import com.qy.sp.fee.common.utils.DateTimeUtils; import com.qy.sp.fee.common.utils.GlobalConst; import com.qy.sp.fee.common.utils.KeyHelper; import com.qy.sp.fee.common.utils.NumberUtil; import com.qy.sp.fee.common.utils.StringUtil; import com.qy.sp.fee.dao.TSdkConfigDao; import com.qy.sp.fee.dao.TSdkconfigMobileBaseDao; import com.qy.sp.fee.dto.TChannel; import com.qy.sp.fee.dto.TOrder; import com.qy.sp.fee.dto.TProduct; import com.qy.sp.fee.dto.TSdkConfig; import com.qy.sp.fee.dto.TSdkConfigQueryKey; import com.qy.sp.fee.dto.TSdkconfigMobileBase; import com.qy.sp.fee.entity.BaseChannelRequest; import com.qy.sp.fee.entity.BaseResult; import com.qy.sp.fee.modules.piplecode.base.ChannelService; import net.sf.json.JSONObject; @Service public class BWhiteService extends ChannelService { private Logger logger = LoggerFactory.getLogger(BWhiteService.class); public static final String CONFIG_CODE_START_TIME ="codeStartTime"; @Resource private TSdkConfigDao tSdkConfigDao; @Resource private TSdkconfigMobileBaseDao tSdkconfigMobileBaseDao; @Override public String getPipleId() { return "14714136609207184697301"; } @Override public JSONObject processGetSMS(JSONObject requestBody) throws Exception { String productCode = requestBody.optString("productCode"); String apiKey = requestBody.optString("apiKey"); String mobile = requestBody.optString("mobile"); String pipleId = requestBody.optString("pipleId"); String appId = requestBody.optString("appId"); String extData = requestBody.optString("extData"); String pipleOrderId = requestBody.optString("pipleOrderId"); String contentId = requestBody.optString("contentId"); String releaseChannelId = requestBody.optString("releaseChannelId"); String cpId = requestBody.optString("cpId"); String cId = requestBody.optString("cid"); String appVersion = requestBody.optString("appVersion"); logger.info("BWRequest:"+requestBody.toString()); JSONObject result = new JSONObject(); if(StringUtil.isEmptyString(productCode) || StringUtil.isEmptyString(apiKey) || StringUtil.isEmptyString(mobile)|| StringUtil.isEmptyString(appId) ){ result.put("resultCode",GlobalConst.CheckResult.MUST_PARAM_ISNULL+""); result.put("resultMsg",GlobalConst.CheckResultDesc.message.get(GlobalConst.CheckResult.MUST_PARAM_ISNULL)); } else { BaseChannelRequest req = new BaseChannelRequest(); req.setApiKey(apiKey); req.setProductCode(productCode); req.setPipleId(pipleId); req.setMobile(mobile); BaseResult bResult = this.accessVerify(req); if (bResult != null) {// 返回不为空则校验不通过 result.put("resultCode",bResult.getResultCode()); result.put("resultMsg",bResult.getResultMsg()); logger.info("BWResoonse:"+result.toString()); return result; } else { TChannel tChannel = this.tChannelDao.selectByApiKey(apiKey); TSdkConfigQueryKey key = new TSdkConfigQueryKey(); key.setAppId(appId); key.setChannelId(tChannel.getChannelId()); key.setPipleId(getPipleId()); key.setProvinceId(req.getProvinceId()+""); key.setConfigId(CONFIG_CODE_START_TIME); TSdkConfig config = null; List<TSdkConfig> configs = tSdkConfigDao.selectConfigurationsByConfigQueryKey(key); if(configs.size() >0){ config = configs.get(0); } if(config != null){ try{ String codeStartTime = config.getConfigValue(); Date currentDate = DateTimeUtils.getCurrentTime(); currentDate.setYear(70); currentDate.setMonth(0); currentDate.setDate(1); String times[] = codeStartTime.split(","); boolean isTimeOk = false; for(String time: times){ time = time.substring(1,time.length()-1); String start = time.split("-")[0]; Date startDate = DateTimeUtils.toTime(start,"HH:mm:ss"); String end = time.split("-")[1]; Date endDate =DateTimeUtils.toTime(end,"HH:mm:ss"); if(currentDate.getTime() > startDate.getTime() && currentDate.getTime() < endDate.getTime()){ isTimeOk = true; } } if(!isTimeOk){ result.put("resultCode","-1"); result.put("resultMsg","不在时间段内"); logger.info("BWResoonse:"+result.toString()); return result; } }catch(Exception e){ e.printStackTrace(); } } TSdkconfigMobileBase tSdkconfigMobileBase = new TSdkconfigMobileBase(); tSdkconfigMobileBase.setAppId(appId); tSdkconfigMobileBase.setContentId(contentId); tSdkconfigMobileBase.setCpId(cpId); tSdkconfigMobileBase.setReleaseChannelId(releaseChannelId); TSdkconfigMobileBase sdkconfigMobileConfig = tSdkconfigMobileBaseDao.selectByPrimaryKey(tSdkconfigMobileBase); if(sdkconfigMobileConfig != null){ boolean isOPen = NumberUtil.getBoolean(sdkconfigMobileConfig.getIsOpen()); if(!isOPen){ result.put("resultCode","-1"); result.put("resultMsg","基地该渠道未打开,联系管理员"); logger.info("BWResoonse:"+result.toString()); return result; } boolean isBWhite = NumberUtil.getBoolean(sdkconfigMobileConfig.getIsUseBWhite()); if(!isBWhite){ result.put("resultCode","-1"); result.put("resultMsg","基地该渠道黑白包未开启"); logger.info("BWResoonse:"+result.toString()); return result; } String startCodeTime = sdkconfigMobileConfig.getStartCodeTime(); if(StringUtil.isNotEmptyString(startCodeTime)){ Date currentDate = DateTimeUtils.getCurrentTime(); currentDate.setYear(70); currentDate.setMonth(0); currentDate.setDate(1); String times[] = startCodeTime.split(","); boolean isTimeOk = false; for(String time: times){ time = time.substring(1,time.length()-1); String start = time.split("-")[0]; Date startDate = DateTimeUtils.toTime(start,"HH:mm:ss"); String end = time.split("-")[1]; Date endDate =DateTimeUtils.toTime(end,"HH:mm:ss"); if(currentDate.getTime() > startDate.getTime() && currentDate.getTime() < endDate.getTime()){ isTimeOk = true; } } if(!isTimeOk){ result.put("resultCode","-1"); result.put("resultMsg","该基地渠道开放,不在时间段内"); logger.info("BWResoonse:"+result.toString()); return result; } }else{ result.put("resultCode","-1"); result.put("resultMsg","该省份时间段未开通。请开通"); logger.info("BWResoonse:"+result.toString()); return result; } }else{ result.put("resultCode","-1"); result.put("resultMsg","该版本没有配置策略。"); logger.info("BWResoonse:"+result.toString()); return result; } String groupId = KeyHelper.createKey(); TProduct tProduct = this.tProductDao.selectByCode(productCode); statistics( STEP_GET_SMS_CHANNEL_TO_PLATFORM, groupId, requestBody.toString()); TOrder order = new TOrder(); order.setAmount(new BigDecimal(tProduct.getPrice()/100.0)); order.setChannelId(tChannel.getChannelId()); order.setCreateTime(DateTimeUtils.getCurrentTime()); order.setMobile(mobile); order.setOrderId(KeyHelper.createKey()); order.setOrderStatus(GlobalConst.OrderStatus.INIT); order.setPipleId(getPipleId()); order.setPipleOrderId(pipleOrderId); order.setProductId(tProduct.getProductId()); order.setProvinceId(req.getProvinceId()); order.setSubStatus(GlobalConst.SubStatus.PAY_INIT); order.setGroupId(groupId); order.setExtData(extData); order.setAppId(appId); this.SaveOrderInsert(order); result.put("resultCode",GlobalConst.Result.SUCCESS); result.put("orderId",order.getOrderId()); result.put("resultMsg","获取成功"); statistics(STEP_BACK_SMS_PLATFORM_TO_CHANNEL, groupId, JSONObject.fromObject(result).toString()); } } logger.info("BWResoonse:"+result.toString()); return result; } @Override protected boolean isUseableTradeDayAndMonth() { return true; } }
[ "xietianalt@126.com" ]
xietianalt@126.com
bb86d2e4a712fc7af4ffb5705b66e641273a5f13
c7df5077b4966513e8280dbb6f00fabc730e9529
/src/main/java/com/yin/pattern/prototype/v2/Test.java
fc1c623540d8ce79aba00eb256437a94de4f8041
[]
no_license
guanqunyin/DesignPattern
c95726d5bf1ecad29761287cac1ee35ccaea4a88
bde9b46b3d2ab1d9afac73ba8346e851fec2c6c9
refs/heads/master
2020-08-03T16:01:10.298983
2019-11-13T09:41:28
2019-11-13T09:41:28
211,808,025
0
0
null
null
null
null
UTF-8
Java
false
false
1,439
java
package com.yin.pattern.prototype.v2; public class Test { public static void main(String[] args) throws CloneNotSupportedException { Person person = new Person(); Person clone = (Person)person.clone(); System.out.println("age:" + clone.age +" score:"+ clone.score); System.out.println(clone.location); System.out.println(person.location==clone.location); clone.location.roomStreet="test"; System.out.println(person.location); } } class Person implements Cloneable { int age = 8; int score = 100; Location location = new Location("bj", 22); @Override public Object clone() throws CloneNotSupportedException { Person personClone = (Person)super.clone(); Location locClone = (Location)personClone.location.clone(); personClone.location = locClone; return personClone; } } class Location implements Cloneable{ String roomStreet; int number; public Location(String roomStreet, int number) { this.roomStreet = roomStreet; this.number = number; } @Override public String toString() { return "Location{" + "roomStreet='" + roomStreet + '\'' + ", number=" + number + '}'; } //重写clone方法 @Override protected Object clone() throws CloneNotSupportedException { return super.clone(); } }
[ "1151900425@qq.com" ]
1151900425@qq.com
9bc0a5f7f7dfd41488e9106039bf41ba0303e3fd
dafcdd6347a1be928df01b5a5bf47527f38d029f
/Sample4GoogleGCM/src/com/example/sample4googlegcm/GcmIntentService.java
9079cd8035d02c398642f6209fc304fc2b010744
[]
no_license
sunleesi/android-education-project
b62e63076619cb927490fe1585c6a7a0169c79a5
31c1e520275ba0445b3288e0626fe5717193bd7b
refs/heads/master
2021-01-10T03:06:12.607555
2015-06-01T06:38:54
2015-06-01T06:38:54
36,643,841
0
1
null
null
null
null
UTF-8
Java
false
false
3,204
java
package com.example.sample4googlegcm; import com.google.android.gms.gcm.GoogleCloudMessaging; import android.app.IntentService; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.NotificationCompat; public class GcmIntentService extends IntentService { private static final String TAG="GcmIntengService"; public static final int NOTIFICATION_ID = 1; private NotificationManager mNotificationManager; NotificationCompat.Builder builder; public GcmIntentService() { super("GcmIntentService"); } @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { // has effect of unparcelling Bundle /* * Filter messages based on message type. Since it is likely that GCM * will be extended in the future with new message types, just ignore * any message types you're not interested in, or that you don't * recognize. */ if (GoogleCloudMessaging. MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { sendNotification("Send error: " + extras.toString()); } else if (GoogleCloudMessaging. MESSAGE_TYPE_DELETED.equals(messageType)) { sendNotification("Deleted messages on server: " + extras.toString()); // If it's a regular GCM message, do some work. } else if (GoogleCloudMessaging. MESSAGE_TYPE_MESSAGE.equals(messageType)) { // This loop represents the service doing some work. String time = intent.getStringExtra("time"); sendNotification("Received: " + extras.toString()); } } // Release the wake lock provided by the WakefulBroadcastReceiver. GcmBroadcastReceiver.completeWakefulIntent(intent); } // Put the message into a notification and post it. // This is just one simple example of what you might choose to do with // a GCM message. private void sendNotification(String msg) { mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("GCM Notification") .setStyle(new NotificationCompat.BigTextStyle() .bigText(msg)) .setContentText(msg); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } }
[ "dongja94@gmail.com" ]
dongja94@gmail.com
039a105b7ca1ad0ef06e5ba7c0967502e40c21da
f8358e34a8151d377f7ad476d50bb9c840fd7afd
/ImageHoster/src/main/java/ImageHoster/controller/ImageController.java
957a441e4c80f5ef5abc5340c17d6b03868331fd
[]
no_license
deepanshu-g/imagehosterproject
23a6cf8003cd86de277be868b2dc671e3bc3d9c5
998dc3fcc794793bfdceaeba7198127ca1a1f159
refs/heads/master
2020-04-13T01:36:38.152773
2018-12-23T17:49:47
2018-12-23T17:49:47
162,878,937
2
0
null
null
null
null
UTF-8
Java
false
false
11,380
java
package ImageHoster.controller; import ImageHoster.model.Comment; import ImageHoster.model.Image; import ImageHoster.model.Tag; import ImageHoster.model.User; import ImageHoster.service.CommentService; import ImageHoster.service.ImageService; import ImageHoster.service.TagService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.*; @Controller public class ImageController { @Autowired private ImageService imageService; @Autowired private TagService tagService; @Autowired private CommentService commentService; //This method displays all the images in the user home page after successful login @RequestMapping("images") public String getUserImages(Model model) { List<Image> images = imageService.getAllImages(); model.addAttribute("images", images); return "images"; } //This method is called when the details of the specific image with corresponding title are to be displayed //The logic is to get the image from the databse with corresponding title. After getting the image from the database the details are shown //First receive the dynamic parameter in the incoming request URL in a string variable 'title' and also the Model type object //Call the getImageByTitle() method in the business logic to fetch all the details of that image //Add the image in the Model type object with 'image' as the key //Return 'images/image.html' file //Also now you need to add the tags of an image in the Model type object //Here a list of tags is added in the Model type object //this list is then sent to 'images/image.html' file and the tags are displayed @RequestMapping("/images/{id}/{title}") public String showImage(@PathVariable("title") String title, @PathVariable("id") Integer id, Model model) { Image image = imageService.getImageByTitle(title ,id); model.addAttribute("comments",image.getComment()); model.addAttribute("image", image); model.addAttribute("tags", image.getTags()); return "images/image"; } //This controller method is called when the request pattern is of type 'images/upload' //The method returns 'images/upload.html' file @RequestMapping("/images/upload") public String newImage() { return "images/upload"; } //This controller method is called when the request pattern is of type 'images/upload' and also the incoming request is of POST type //The method receives all the details of the image to be stored in the database, and now the image will be sent to the business logic to be persisted in the database //After you get the imageFile, set the user of the image by getting the logged in user from the Http Session //Convert the image to Base64 format and store it as a string in the 'imageFile' attribute //Set the date on which the image is posted //After storing the image, this method directs to the logged in user homepage displaying all the images //Get the 'tags' request parameter using @RequestParam annotation which is just a string of all the tags //Store all the tags in the database and make a list of all the tags using the findOrCreateTags() method //set the tags attribute of the image as a list of all the tags returned by the findOrCreateTags() method @RequestMapping(value = "/images/upload", method = RequestMethod.POST) public String createImage(@RequestParam("file") MultipartFile file, @RequestParam("tags") String tags, Image newImage, HttpSession session) throws IOException { User user = (User) session.getAttribute("loggeduser"); newImage.setUser(user); String uploadedImageData = convertUploadedFileToBase64(file); newImage.setImageFile(uploadedImageData); List<Tag> imageTags = findOrCreateTags(tags); newImage.setTags(imageTags); newImage.setDate(new Date()); imageService.uploadImage(newImage); return "redirect:/images"; } //This controller method is called when the request pattern is of type 'editImage' //This method fetches the image with the corresponding id from the database and adds it to the model with the key as 'image' //The method then returns 'images/edit.html' file wherein you fill all the updated details of the image //The method first needs to convert the list of all the tags to a string containing all the tags separated by a comma and then add this string in a Model type object //This string is then displayed by 'edit.html' file as previous tags of an image @RequestMapping(value = "/editImage") public String editImage(@RequestParam("imageId") Integer imageId,@RequestParam("title") String title,@RequestParam("userId") Integer userId ,HttpSession session ,Model model) { //title and userid is fetched with the help of requestparameter //here we are creating the logged in user object with the help of session //finally the view is returned on the basis of logged in user and image owner(userId) User loggeduser = (User) session.getAttribute("loggeduser"); if(userId != loggeduser.getId()){ Image image = imageService.getImageByTitle(title ,imageId); model.addAttribute("editError", true); model.addAttribute("image", image); model.addAttribute("tags", image.getTags()); return "images/image"; } else { Image image = imageService.getImage(imageId); String tags = convertTagsToString(image.getTags()); model.addAttribute("image", image); model.addAttribute("tags", tags); return "images/edit"; } } //This controller method is called when the request pattern is of type 'images/edit' and also the incoming request is of PUT type //The method receives the imageFile, imageId, updated image, along with the Http Session //The method adds the new imageFile to the updated image if user updates the imageFile and adds the previous imageFile to the new updated image if user does not choose to update the imageFile //Set an id of the new updated image //Set the user using Http Session //Set the date on which the image is posted //Call the updateImage() method in the business logic to update the image //Direct to the same page showing the details of that particular updated image //The method also receives tags parameter which is a string of all the tags separated by a comma using the annotation @RequestParam //The method converts the string to a list of all the tags using findOrCreateTags() method and sets the tags attribute of an image as a list of all the tags @RequestMapping(value = "/editImage", method = RequestMethod.PUT) public String editImageSubmit(@RequestParam("file") MultipartFile file, @RequestParam("imageId") Integer imageId, @RequestParam("tags") String tags, Image updatedImage, HttpSession session) throws IOException { Image image = imageService.getImage(imageId); String updatedImageData = convertUploadedFileToBase64(file); List<Tag> imageTags = findOrCreateTags(tags); if (updatedImageData.isEmpty()) updatedImage.setImageFile(image.getImageFile()); else { updatedImage.setImageFile(updatedImageData); } updatedImage.setId(imageId); User user = (User) session.getAttribute("loggeduser"); updatedImage.setUser(user); updatedImage.setTags(imageTags); updatedImage.setDate(new Date()); imageService.updateImage(updatedImage); return "redirect:/images/" + imageId + "/"+ updatedImage.getTitle(); } //This controller method is called when the request pattern is of type 'deleteImage' and also the incoming request is of DELETE type //The method calls the deleteImage() method in the business logic passing the id of the image to be deleted //Looks for a controller method with request mapping of type '/images' @RequestMapping(value = "/deleteImage", method = RequestMethod.DELETE) public String deleteImageSubmit(@RequestParam(name = "imageId") Integer imageId,@RequestParam("title") String title,@RequestParam("userId") Integer userId ,HttpSession session ,Model model) { //getting the logged user with the help of session User loggeduser = (User) session.getAttribute("loggeduser"); //deleting the post if the user belongs to the owner of the image if(userId != loggeduser.getId()){ Image image = imageService.getImageByTitle(title ,imageId); model.addAttribute("deleteError", true); model.addAttribute("image", image); model.addAttribute("tags", image.getTags()); return "images/image"; } else { imageService.deleteImage(imageId); return "redirect:/images"; } } //This method converts the image to Base64 format private String convertUploadedFileToBase64(MultipartFile file) throws IOException { return Base64.getEncoder().encodeToString(file.getBytes()); } //findOrCreateTags() method has been implemented, which returns the list of tags after converting the ‘tags’ string to a list of all the tags and also stores the tags in the database if they do not exist in the database. Observe the method and complete the code where required for this method. //Try to get the tag from the database using getTagByName() method. If tag is returned, you need not to store that tag in the database, and if null is returned, you need to first store that tag in the database and then the tag is added to a list //After adding all tags to a list, the list is returned private List<Tag> findOrCreateTags(String tagNames) { StringTokenizer st = new StringTokenizer(tagNames, ","); List<Tag> tags = new ArrayList<Tag>(); while (st.hasMoreTokens()) { String tagName = st.nextToken().trim(); Tag tag = tagService.getTagByName(tagName); if (tag == null) { Tag newTag = new Tag(tagName); tag = tagService.createTag(newTag); } tags.add(tag); } return tags; } //The method receives the list of all tags //Converts the list of all tags to a single string containing all the tags separated by a comma //Returns the string private String convertTagsToString(List<Tag> tags) { StringBuilder tagString = new StringBuilder(); for (int i = 0; i <= tags.size() - 2; i++) { tagString.append(tags.get(i).getName()).append(","); } Tag lastTag = tags.get(tags.size() - 1); tagString.append(lastTag.getName()); return tagString.toString(); } }
[ "deepanshu.ghai51@gmail.com" ]
deepanshu.ghai51@gmail.com
693e59de0f4ac7cc9decdccc9131309b251246d2
31922011f3f1b6a043b8c423bce097d93f05711c
/src/hao/test/fbapidemo/FacebookUtility.java
9ed3954871257188a78560bb3750bb66e0c1a2ec
[]
no_license
sfavors3/FacebookAPIDemo
5e601fb3580bf0ac268ae2554139d4c7a4075acd
29a42fcfe168173500e6420d26597c0553b8dd22
refs/heads/master
2021-01-17T10:24:10.626973
2014-01-15T03:22:04
2014-01-15T03:22:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
317
java
package hao.test.fbapidemo; import android.content.SharedPreferences; import com.facebook.android.AsyncFacebookRunner; import com.facebook.android.Facebook; public class FacebookUtility { public static Facebook fb = null; public static AsyncFacebookRunner runner = null; public static SharedPreferences prefs; }
[ "fuhaoee@gmail.com" ]
fuhaoee@gmail.com
5aec546b13cbcf2b56d8c71d810a316c8c4f67b0
0e06e096a9f95ab094b8078ea2cd310759af008b
/sources/com/vungle/warren/network/APKDirectDownloader.java
a2de418d9e24bcb54c7f3923d09fd55e4e4b66cb
[]
no_license
Manifold0/adcom_decompile
4bc2907a057c73703cf141dc0749ed4c014ebe55
fce3d59b59480abe91f90ba05b0df4eaadd849f7
refs/heads/master
2020-05-21T02:01:59.787840
2019-05-10T00:36:27
2019-05-10T00:36:27
185,856,424
1
2
null
2019-05-10T00:36:28
2019-05-09T19:04:28
Java
UTF-8
Java
false
false
966
java
package com.vungle.warren.network; import android.content.Context; import com.tonyodev.fetch.Fetch.Settings; import java.util.Map.Entry; public class APKDirectDownloader extends FetchDownloader { public APKDirectDownloader(Context context) { super(context); new Settings(context).setConcurrentDownloadsLimit(5).enableLogging(true).apply(); } public void pause() { if (this.operations != null) { for (Entry entry : this.operations.entrySet()) { this.fetch.pause(((Long) entry.getKey()).longValue()); } } } public void resume() { if (this.operations != null) { for (Entry entry : this.operations.entrySet()) { this.fetch.resume(((Long) entry.getKey()).longValue()); } } } public boolean isDownloadTaskRunning() { return (this.operations == null || this.operations.isEmpty()) ? false : true; } }
[ "querky1231@gmail.com" ]
querky1231@gmail.com
0b055367cb11e8b5b7cc9af774ebea0dea72d5e3
743540992a26e435939620c6d8ea9260a52fd9e2
/university-dal/src/main/java/com/pavel/university/entity/ObjectProfessor.java
d1b71f8ff749b7730de3badb0a906a6dec1bb2ae
[]
no_license
birladeanuPavel/University
e1886171b31f52f38262c6df46525a7713c8551a
dfadb43fdc7b217ec0ebb2b24a10b54612b4dcdc
refs/heads/master
2016-09-06T21:28:08.250041
2014-05-04T14:51:37
2014-05-04T14:51:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,019
java
package com.pavel.university.entity; import javax.persistence.*; import java.io.Serializable; /** * Created by Pavel on 28.04.2014. */ @Entity @Table(name = "object_professor") public class ObjectProfessor implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", unique = true, nullable = false) private Integer id; @ManyToOne @JoinColumn(name = "id_object") private Object object; @ManyToOne @JoinColumn(name = "id_professor") private Professor professor; public ObjectProfessor() { } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Object getObject() { return object; } public void setObject(Object object) { this.object = object; } public Professor getProfessor() { return professor; } public void setProfessor(Professor professor) { this.professor = professor; } }
[ "birladeanupavel@gmail.com" ]
birladeanupavel@gmail.com
066244c1b75c9eaa25de6e41812cbf5b99870916
814ccf2b4b70136e995648aaae9593ed163f6fa6
/OllysEnhancedList/src/main/java/com/polydelic/oliverdixon/ollysenhancedlist/src/ListModels/ListItemPaginationSpinner.java
873d2f630ed137ea9e8c3956af74b1450bd314a6
[]
no_license
ollyde/enhanced-recycle-list-android
315df7a5e316b92bbfefbe5e961e16caab573b28
171d47e39417441c768824f1c93c157cde02d72d
refs/heads/master
2023-02-20T03:38:27.426287
2017-09-25T12:37:55
2017-09-25T12:37:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.polydelic.oliverdixon.ollysenhancedlist.src.ListModels; import com.polydelic.oliverdixon.ollysenhancedlist.R; import com.polydelic.oliverdixon.ollysenhancedlist.src.IListModel; import com.polydelic.oliverdixon.ollysenhancedlist.src.BaseViewHolder; public class ListItemPaginationSpinner extends ListModelTemporary implements IListModel { @Override public int getViewLayoutId() { if (getCustomLayout() != null) { return getCustomLayout(); } return R.layout.list_item_pagination; } @Override public Class getViewClass() { return BaseView.class; } /** * BaseView for this list item. */ public static class BaseView extends BaseViewHolder { public BaseView(android.view.View createdView) { super(createdView); } } }
[ "olly257@gmail.com" ]
olly257@gmail.com
9c7e0e1828c97eb800b31db753c1368bc8f10980
8de7d24a3b26954b46fabfd6190452da37e6fe5a
/src/main/java/com/hrtx/global/EgtPage.java
be72b9100d95c53077a8b98f5e9d0e8700a5f08f
[]
no_license
funtalkTelecom/saleBUBackend
7ed31d8cf2849f4ffc382b334dbf0de48d1f0ee3
d2b53e7a9888226928a276b7a68a9ce85a590ea0
refs/heads/master
2022-05-22T18:27:26.046073
2019-06-24T10:06:14
2019-06-24T10:06:14
192,842,892
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package com.hrtx.global; public class EgtPage extends com.github.pagehelper.Page { private long total; public EgtPage(int pageNum, int pageSzie, long totalHits) { super(pageNum, pageSzie); this.total = totalHits; } @Override public long getTotal() { return total; } @Override public void setTotal(long total) { this.total = total; } }
[ "zhouyq@egt365.com" ]
zhouyq@egt365.com
621a94254b9dae1293a9d03b4f1a5e61212a38c3
3bcaebf7d69eaab5e4086568440b2ca56219b50d
/src/main/java/com/tinyolo/cxml/parsing/demo/jaxb/cxml/RequiredMaximumQuantity.java
c6583d21312b479e569982db941a4a8d4108b1fc
[]
no_license
augustine-d-nguyen/cxml-parsing-demo
2a419263b091b32e70fa84312b55d8217e691ac6
3cc169ee0392d88bbf0e03f0791a15287a8eba97
refs/heads/master
2023-01-18T19:07:27.094598
2020-11-20T14:52:52
2020-11-20T14:52:52
314,490,660
0
0
null
null
null
null
UTF-8
Java
false
false
2,164
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.2 // See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.11.20 at 08:07:34 PM ICT // package com.tinyolo.cxml.parsing.demo.jaxb.cxml; 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.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.NormalizedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "unitOfMeasure" }) @XmlRootElement(name = "RequiredMaximumQuantity") public class RequiredMaximumQuantity { @XmlAttribute(name = "quantity") @XmlJavaTypeAdapter(NormalizedStringAdapter.class) protected String quantity; @XmlElement(name = "UnitOfMeasure") protected String unitOfMeasure; /** * Gets the value of the quantity property. * * @return * possible object is * {@link String } * */ public String getQuantity() { return quantity; } /** * Sets the value of the quantity property. * * @param value * allowed object is * {@link String } * */ public void setQuantity(String value) { this.quantity = value; } /** * Gets the value of the unitOfMeasure property. * * @return * possible object is * {@link String } * */ public String getUnitOfMeasure() { return unitOfMeasure; } /** * Sets the value of the unitOfMeasure property. * * @param value * allowed object is * {@link String } * */ public void setUnitOfMeasure(String value) { this.unitOfMeasure = value; } }
[ "augustine.d.nguyen@outlook.com" ]
augustine.d.nguyen@outlook.com
6590548770e6895cf1037e1e61c5ede23de604da
682929767740301d4ab3e020a5996f2e43ef8f56
/MessageQueue/src/assignment/Responder.java
a564b93675931ed396c0468a27114a548dd450c1
[]
no_license
JosephMalandruccolo/CSPP51050-HW2
44c71c65adcafc82eaead22140a35d239d3a6cbd
56e0f2ed9775b1ee6faba218f4d00ab867967dfa
refs/heads/master
2021-01-10T19:05:46.002684
2013-05-06T00:37:32
2013-05-06T00:37:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,217
java
package assignment; import java.util.HashMap; /** * Responds to Query Messages * @author Joseph Malandruccolo * */ public class Responder { //===================================================================== // => CLASS //===================================================================== public static int nextId = 1; private static HashMap<Integer, String> presidentialData; static { presidentialData = new HashMap<Integer, String>(); presidentialData.put(1, "George Washington"); presidentialData.put(2, "John Adams"); presidentialData.put(3, "Thomas Jefferson"); presidentialData.put(4, "James Madison"); presidentialData.put(5, "James Monroe"); presidentialData.put(6, "John Qunicy Adams"); presidentialData.put(7, "Andrew Jackson"); presidentialData.put(8, "Martin Van Buren"); presidentialData.put(9, "William Henry Harrison"); presidentialData.put(10, "John Tyler"); } //===================================================================== // => PROPERTIES //===================================================================== private int id; //===================================================================== // => CONSTRUCTOR //===================================================================== public Responder() { this.id = Responder.nextId++; } //===================================================================== // => PUBLIC API //===================================================================== public int getId() { return this.id; } //===================================================================== // => QUEUE INTERACTION //===================================================================== public void readQueue(MessageQueue q) { Message msg = q.popMessageIfForRecipient(this.id); if (msg != null) { if (msg instanceof QueryMsg) { int request = (Integer) msg.getContents(); ReplyMsg reply = new ReplyMsg(this.id, msg.getSenderId(), Responder.presidentialData.get(request), ((QueryMsg) msg).getQueryId()); q.pushMessage(reply); } else { q.pushMessage(new ReplyMsg(this.id, msg.getSenderId(), new String("Invalid message type"), -1)); } } } }
[ "jdmalandruccolo@gmail.com" ]
jdmalandruccolo@gmail.com
2341c86015e168ff3ec2de38e81513a7c0b4c3a0
6252c165657baa6aa605337ebc38dd44b3f694e2
/org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-1000-Files/boiler-To-Generate-1000-Files/syncregions-1000Files/BoilerActuator4284.java
a2ef21b51a9f676e085f5ff4506c5e9ab7054a5c
[]
no_license
soha500/EglSync
00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638
55101bc781349bb14fefc178bf3486e2b778aed6
refs/heads/master
2021-06-23T02:55:13.464889
2020-12-11T19:10:01
2020-12-11T19:10:01
139,832,721
0
1
null
2019-05-31T11:34:02
2018-07-05T10:20:00
Java
UTF-8
Java
false
false
267
java
package syncregions; public class BoilerActuator4284 { public int execute(int temperatureDifference4284, boolean boilerStatus4284) { //sync _bfpnGUbFEeqXnfGWlV4284, behaviour Half Change - return temperature - targetTemperature; //endSync } }
[ "sultanalmutairi@172.20.10.2" ]
sultanalmutairi@172.20.10.2
4f423d892dfdd916c0114a222acb727e1a598da1
911d71da9155b022631a071c631ce1b2cb14b92c
/basic-arch-ruoyivue/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
c69f24bfb1a60c91ad7c49e70d39ca64a48ac118
[ "MIT" ]
permissive
devsong/basic_arch
09cc86f0f2b7a1b836195316426c2a72b78271dd
7e48c3e52878939f6b191741d338e24fc7eea90e
refs/heads/master
2023-03-08T09:34:24.906231
2021-05-20T07:18:28
2021-05-20T07:18:28
203,941,641
0
1
null
2023-02-22T07:51:07
2019-08-23T06:53:47
Java
UTF-8
Java
false
false
2,478
java
package com.ruoyi.system.service; import java.util.List; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; /** * 部门管理 服务层 * * @author guanzhisong */ public interface ISysDeptService { /** * 查询部门管理数据 * * @param dept 部门信息 * @return 部门信息集合 */ public List<SysDept> selectDeptList(SysDept dept); /** * 构建前端所需要树结构 * * @param depts 部门列表 * @return 树结构列表 */ public List<SysDept> buildDeptTree(List<SysDept> depts); /** * 构建前端所需要下拉树结构 * * @param depts 部门列表 * @return 下拉树结构列表 */ public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts); /** * 根据角色ID查询部门树信息 * * @param roleId 角色ID * @return 选中部门列表 */ public List<Integer> selectDeptListByRoleId(Long roleId); /** * 根据部门ID查询信息 * * @param deptId 部门ID * @return 部门信息 */ public SysDept selectDeptById(Long deptId); /** * 根据ID查询所有子部门(正常状态) * * @param deptId 部门ID * @return 子部门数 */ public int selectNormalChildrenDeptById(Long deptId); /** * 是否存在部门子节点 * * @param deptId 部门ID * @return 结果 */ public boolean hasChildByDeptId(Long deptId); /** * 查询部门是否存在用户 * * @param deptId 部门ID * @return 结果 true 存在 false 不存在 */ public boolean checkDeptExistUser(Long deptId); /** * 校验部门名称是否唯一 * * @param dept 部门信息 * @return 结果 */ public String checkDeptNameUnique(SysDept dept); /** * 新增保存部门信息 * * @param dept 部门信息 * @return 结果 */ public int insertDept(SysDept dept); /** * 修改保存部门信息 * * @param dept 部门信息 * @return 结果 */ public int updateDept(SysDept dept); /** * 删除部门管理信息 * * @param deptId 部门ID * @return 结果 */ public int deleteDeptById(Long deptId); }
[ "guanzhisong@gmail.com" ]
guanzhisong@gmail.com
774406206caa47107860142cebc07fcc44d2ebad
b160bd1d344d3d9af67f7d9e7b7e9f48d3c6db8c
/src/cn/book/ui/UserFrame.java
68e42ee4af791b2c0249f1e860f54da3699d5e6f
[]
no_license
clooney0/bookmanagement
4a3632633a30baee981d53a7b17ca28c6d4eb596
bbeed21ec77676e8aa65beaeb14944e4cd500da9
refs/heads/master
2022-02-19T07:44:01.426856
2017-11-20T11:24:02
2017-11-20T11:24:02
111,398,383
6
1
null
null
null
null
UTF-8
Java
false
false
16,864
java
package cn.book.ui; import java.awt.Component; import java.awt.EventQueue; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.List; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; import javax.swing.table.DefaultTableModel; import org.jvnet.substance.SubstanceLookAndFeel; import org.jvnet.substance.button.StandardButtonShaper; import org.jvnet.substance.skin.CremeSkin; import org.jvnet.substance.theme.SubstanceCremeTheme; import org.jvnet.substance.watermark.SubstanceBinaryWatermark; import cn.book.dao.UserDao; import cn.book.entity.User; import cn.book.util.StringUtil; import javax.swing.SwingConstants; import java.awt.Font; import java.awt.Color; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; public class UserFrame { public JFrame frame; private JTable table; private JTextField nameField; private JButton btnQueryname; private JLabel nameLabel; private JLabel phoneLabel; private JTextField phoneField; private JButton btnQueryphone; private JPopupMenu popupMenu; private JMenuItem reflushItem; private JMenuItem getvalueItem; private JLabel genderLabel; private final ButtonGroup buttonGroup = new ButtonGroup(); private JTextField idField; /** * Launch the application. */ public static void main(String[] args) { try { UIManager.setLookAndFeel(new SubstanceLookAndFeel()); JFrame.setDefaultLookAndFeelDecorated(true); // frame JDialog.setDefaultLookAndFeelDecorated(true); // dialog SubstanceLookAndFeel.setCurrentTheme(new SubstanceCremeTheme()); // theme SubstanceLookAndFeel.setSkin(new CremeSkin()); // skin SubstanceLookAndFeel .setCurrentWatermark(new SubstanceBinaryWatermark()); // watermark SubstanceLookAndFeel .setCurrentButtonShaper(new StandardButtonShaper()); // button // SubstanceLookAndFeel.setCurrentBorderPainter(new // StandardBorderPainter()); // SubstanceLookAndFeel.setCurrentGradientPainter(new // StandardGradientPainter()); // SubstanceLookAndFeel.setCurrentTitlePainter(new // FlatTitePainter()); } catch (Exception e) { System.err.println("Something went wrong!"); } EventQueue.invokeLater(new Runnable() { public void run() { try { UserFrame window = new UserFrame(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. * * @throws Exception */ public UserFrame() throws Exception { initialize(); } /** * Initialize the contents of the frame. * * @throws Exception */ private void initialize() throws Exception { frame = new JFrame(); frame.setTitle("书籍管理系统"); frame.setResizable(false); frame.setBounds(100, 100, 850, 600); // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = toolkit.getImage("img/sys.png"); frame.setIconImage(image); frame.setLocationRelativeTo(null); JLabel userLabel = new JLabel("读者信息管理"); userLabel.setForeground(Color.RED); userLabel.setFont(new Font("SimSun", Font.PLAIN, 25)); userLabel.setHorizontalAlignment(SwingConstants.CENTER); userLabel.setBounds(310, 27, 190, 30); frame.getContentPane().add(userLabel); // table table = new JTable(); UserDao dao = new UserDao(); Object[][] data = null; // 声明date List<User> user = dao.queryUser(); data = new Object[user.size()][4]; for (int i = 0; i < user.size(); i++) { User u = user.get(i); data[i][0] = u.getUser_id(); data[i][1] = u.getUser_name(); data[i][2] = u.getUser_gender(); data[i][3] = u.getUser_phone(); } table.setModel(new DefaultTableModel(data, new String[] { "编号", "名字", "性别", "手机号" })); // scorll final JScrollPane scroll = new JScrollPane(table); scroll.setBounds(72, 74, 695, 210); frame.getContentPane().add(scroll); nameLabel = new JLabel("读者姓名"); nameLabel.setFont(new Font("SimSun", Font.PLAIN, 18)); nameLabel.setBounds(139, 315, 95, 25); frame.getContentPane().add(nameLabel); nameField = new JTextField(); nameField.setFont(new Font("SimSun", Font.PLAIN, 18)); nameField.setBounds(282, 313, 190, 30); frame.getContentPane().add(nameField); nameField.setColumns(10); // button queryByname 姓名查询按钮 btnQueryname = new JButton("姓名查询"); btnQueryname.setFont(new Font("SimSun", Font.PLAIN, 18)); btnQueryname.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String text = nameField.getText(); // 创建 Dao UserDao dao = new UserDao(); String name = "%" + text + "%"; Object[][] data = null; // 声明date List<User> user = dao.queryUserByname(name); data = new Object[user.size()][4]; for (int i = 0; i < user.size(); i++) { User u = user.get(i); data[i][0] = u.getUser_id(); data[i][1] = u.getUser_name(); data[i][2] = u.getUser_gender(); data[i][3] = u.getUser_phone(); } table.setModel(new DefaultTableModel(data, new String[] { "编号", "名字", "性别", "手机号" })); scroll.setViewportView(table); } }); btnQueryname.setBounds(529, 312, 122, 30); frame.getContentPane().add(btnQueryname); phoneLabel = new JLabel("手机号"); phoneLabel.setFont(new Font("SimSun", Font.PLAIN, 18)); phoneLabel.setBounds(139, 368, 95, 25); frame.getContentPane().add(phoneLabel); phoneField = new JTextField(); phoneField.setFont(new Font("SimSun", Font.PLAIN, 18)); phoneField.setBounds(282, 366, 190, 30); frame.getContentPane().add(phoneField); phoneField.setColumns(10); // button queryByphone 手机查询 按钮 btnQueryphone = new JButton("手机查询"); btnQueryphone.setFont(new Font("SimSun", Font.PLAIN, 18)); btnQueryphone.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String text = phoneField.getText(); // 创建 Dao UserDao dao = new UserDao(); String phone = "%" + text + "%"; Object[][] data = null; // 声明date List<User> user = dao.queryUserByphone(phone); data = new Object[user.size()][4]; for (int i = 0; i < user.size(); i++) { User u = user.get(i); data[i][0] = u.getUser_id(); data[i][1] = u.getUser_name(); data[i][2] = u.getUser_gender(); data[i][3] = u.getUser_phone(); } table.setModel(new DefaultTableModel(data, new String[] { "编号", "名字", "性别", "手机号" })); scroll.setViewportView(table); } }); btnQueryphone.setBounds(529, 365, 122, 30); frame.getContentPane().add(btnQueryphone); genderLabel = new JLabel("性别"); genderLabel.setFont(new Font("SimSun", Font.PLAIN, 18)); genderLabel.setBounds(139, 421, 95, 25); frame.getContentPane().add(genderLabel); final JRadioButton maleRadio = new JRadioButton("男"); maleRadio.setSelected(true); buttonGroup.add(maleRadio); maleRadio.setFont(new Font("SimSun", Font.PLAIN, 18)); maleRadio.setBounds(282, 421, 56, 25); frame.getContentPane().add(maleRadio); final JRadioButton femaleRadio = new JRadioButton("女"); femaleRadio.setFont(new Font("SimSun", Font.PLAIN, 18)); buttonGroup.add(femaleRadio); femaleRadio.setBounds(344, 421, 56, 25); frame.getContentPane().add(femaleRadio); JLabel idLabel = new JLabel("读者编号"); idLabel.setFont(new Font("SimSun", Font.PLAIN, 18)); idLabel.setBounds(139, 473, 95, 25); frame.getContentPane().add(idLabel); idField = new JTextField(); idField.setEnabled(false); idField.setFont(new Font("SimSun", Font.PLAIN, 18)); idField.setColumns(10); idField.setBounds(282, 471, 190, 30); frame.getContentPane().add(idField); // button modifyUser 修改按钮 JButton btnUsermodify = new JButton("修改"); btnUsermodify.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { // 取值 String strid = idField.getText(); long id = Long.valueOf(strid); // String-->id String name = nameField.getText(); String phone = phoneField.getText(); String regex = "^1[3|4|5|7|8]\\d{9}$"; boolean isNum = phone.matches(regex); if (isNum == false) { JOptionPane.showMessageDialog(null, "手机格式不正确!"); } else { // 获取男女信息 String gender = "男"; if (femaleRadio.isSelected()) { gender = "女"; } UserDao dao = new UserDao(); User obj = new User(id, name, gender, phone); boolean isupdate = dao.updateUser(obj); if (isupdate) { // 判断是否为空 if (StringUtil.hasLength(name) && StringUtil.hasLength(phone) && StringUtil.hasLength(gender)) { JOptionPane.showMessageDialog(null, "修改成功"); // 刷新table Object[][] data = null; dao = new UserDao(); List<User> user = dao.queryUser(); data = new Object[user.size()][4]; for (int i = 0; i < user.size(); i++) { User u = user.get(i); data[i][0] = u.getUser_id(); data[i][1] = u.getUser_name(); data[i][2] = u.getUser_gender(); data[i][3] = u.getUser_phone(); } table.setModel(new DefaultTableModel( data, new String[] { "编号", "名字", "性别", "手机号" })); scroll.setViewportView(table); } else { JOptionPane.showMessageDialog(null, "输入不能为空"); } } /* * else { // 异常在UserDao处理 * JOptionPane.showMessageDialog(null, "修改失败!"); * //手机号已存在 * * } */ } } catch (Exception ex) { JOptionPane.showMessageDialog(null, "数据不能为空!"); } } }); btnUsermodify.setFont(new Font("SimSun", Font.PLAIN, 18)); btnUsermodify.setBounds(539, 416, 105, 30); frame.getContentPane().add(btnUsermodify); // button addUser 添加按钮 JButton btnUseradd = new JButton("添加"); btnUseradd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // 取值 String name = nameField.getText(); String phone = phoneField.getText(); String regex = "^1[3|4|5|7|8]\\d{9}$"; boolean isNum = phone.matches(regex); if (isNum == false) { JOptionPane.showMessageDialog(null, "手机格式不正确!"); } else { // 获取男女信息 String gender = "男"; if (femaleRadio.isSelected()) { gender = "女"; } UserDao dao = new UserDao(); User obj = new User(0, name, gender, phone); boolean isadd = dao.addUser(obj); if (isadd) { // 判断是否为空 if (StringUtil.hasLength(name) && StringUtil.hasLength(phone) && StringUtil.hasLength(gender)) { JOptionPane.showMessageDialog(null, "添加成功"); // 刷新table Object[][] data = null; dao = new UserDao(); List<User> user = dao.queryUser(); data = new Object[user.size()][4]; for (int i = 0; i < user.size(); i++) { User u = user.get(i); data[i][0] = u.getUser_id(); data[i][1] = u.getUser_name(); data[i][2] = u.getUser_gender(); data[i][3] = u.getUser_phone(); } table.setModel(new DefaultTableModel(data, new String[] { "编号", "名字", "性别", "手机号" })); scroll.setViewportView(table); } else { JOptionPane.showMessageDialog(null, "输入不能为空"); } } /* * else { //UserDao处理异常 JOptionPane.showMessageDialog(null, * "添加失败"); } */ } } }); btnUseradd.setFont(new Font("SimSun", Font.PLAIN, 18)); btnUseradd.setBounds(539, 470, 105, 30); frame.getContentPane().add(btnUseradd); // 右键菜单 popupMenu = new JPopupMenu(); popupMenu.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { } public void ancestorMoved(AncestorEvent event) { } public void ancestorRemoved(AncestorEvent event) { } }); addPopup(table, popupMenu); // 右键删除 JMenuItem deleteItem = new JMenuItem("删除"); deleteItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("删除"); int isdel = JOptionPane.showConfirmDialog(null, "是否删除", "提示", JOptionPane.YES_NO_OPTION); System.out.println("isdel==" + isdel); if (isdel == 0) { try { // 确认删除 Object object = table.getValueAt( table.getSelectedRow(), 0); UserDao dao = new UserDao(); boolean b = dao.deleteUser((Long) object); // UserDao // 处理异常 if (b) { JOptionPane.showMessageDialog(null, "删除成功"); Object[][] data = null; // 声明date List<User> user = dao.queryUser(); data = new Object[user.size()][4]; for (int i = 0; i < user.size(); i++) { User u = user.get(i); data[i][0] = u.getUser_id(); data[i][1] = u.getUser_name(); data[i][2] = u.getUser_gender(); data[i][3] = u.getUser_phone(); } table.setModel(new DefaultTableModel(data, new String[] { "编号", "名字", "性别", "手机号" })); scroll.setViewportView(table); } } catch (Exception ex) { JOptionPane.showMessageDialog(null, "请在表格中选中一行,右键删除!"); } } } }); // 右键获取数值 getvalueItem = new JMenuItem("获取该行数据"); getvalueItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { long id = (Long) table.getValueAt(table.getSelectedRow(), 0);// get // id idField.setText(String.valueOf(id));// set id long--->String String name = (String) table.getValueAt( table.getSelectedRow(), 1); nameField.setText(name); // name赋值到文本框 String gender = (String) table.getValueAt( table.getSelectedRow(), 2); if (gender.equals("男")) { // gender 设置被选中 maleRadio.setSelected(true); } else { femaleRadio.setSelected(true); } String phone = (String) table.getValueAt( table.getSelectedRow(), 3); phoneField.setText(phone); // phone } catch (Exception ex) { JOptionPane.showMessageDialog(null, "请在表格中选中一行,右键取值!"); } } }); popupMenu.add(getvalueItem); // 右键刷新 reflushItem = new JMenuItem("刷新"); reflushItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object[][] data = null; UserDao dao = new UserDao(); List<User> user = dao.queryUser(); data = new Object[user.size()][4]; for (int i = 0; i < user.size(); i++) { User u = user.get(i); data[i][0] = u.getUser_id(); data[i][1] = u.getUser_name(); data[i][2] = u.getUser_gender(); data[i][3] = u.getUser_phone(); } table.setModel(new DefaultTableModel(data, new String[] { "编号", "名字", "性别", "手机号" })); scroll.setViewportView(table); } }); popupMenu.add(reflushItem); popupMenu.add(deleteItem); } // addPopup private static void addPopup(Component component, final JPopupMenu popup) { component.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showMenu(e); } } public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { showMenu(e); } } private void showMenu(MouseEvent e) { popup.show(e.getComponent(), e.getX(), e.getY()); } }); } }
[ "garfunke1@outlook.com" ]
garfunke1@outlook.com
f06fafa3abe4d238ce38d317bf95e325a6f35f9c
c71831709c5c56f99d32b4c5369b3bc51d415d55
/app/src/main/java/com/hasan/mathsukrevision/AqaJun18Paper3.java
01fd5db5d93ee3664f0148d28603db4c3c23f6a2
[]
no_license
hasanalfaruk/unifinalproject
869c2a9e8e289fa23b37ec4bd70b325e2e95163c
bec65418ebe92eb17d176e655c8b243468592751
refs/heads/main
2023-06-28T22:18:27.972472
2021-08-02T11:32:07
2021-08-02T11:32:07
386,979,054
1
0
null
null
null
null
UTF-8
Java
false
false
553
java
package com.hasan.mathsukrevision; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import com.github.barteksc.pdfviewer.PDFView; public class AqaJun18Paper3 extends AppCompatActivity { private PDFView paper3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_aqa_jun18_paper3); paper3 = (PDFView) findViewById(R.id.pdfAqa_Jun18_3); paper3.fromAsset("AQA-83003H-QPMS-jun18.pdf").load(); } }
[ "hasan-al-faruk@hotmail.co.uk" ]
hasan-al-faruk@hotmail.co.uk
9efd2d467de140d1a85282c04a42c327948c7b11
eb5f5353f49ee558e497e5caded1f60f32f536b5
/javax/management/NotificationEmitter.java
6764d4e25ec436944797df7b806242ac3d27178e
[]
no_license
mohitrajvardhan17/java1.8.0_151
6fc53e15354d88b53bd248c260c954807d612118
6eeab0c0fd20be34db653f4778f8828068c50c92
refs/heads/master
2020-03-18T09:44:14.769133
2018-05-23T14:28:24
2018-05-23T14:28:24
134,578,186
0
2
null
null
null
null
UTF-8
Java
false
false
505
java
package javax.management; public abstract interface NotificationEmitter extends NotificationBroadcaster { public abstract void removeNotificationListener(NotificationListener paramNotificationListener, NotificationFilter paramNotificationFilter, Object paramObject) throws ListenerNotFoundException; } /* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\javax\management\NotificationEmitter.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
[ "mohit.rajvardhan@ericsson.com" ]
mohit.rajvardhan@ericsson.com
2f456f12af6af30be9bf26cd3d77c7521aa216c8
7ddcb906c12f9b522326da141ca74bfb584ae423
/src/main/java/com/smart/smartcontactmanager/com/smart/smartcontactmanager/config/CustomUserDetails.java
35558e0855a52d97f9e0b5f9fb734aa0aa036c5f
[]
no_license
abhinav-repository-007/ContactManager
e5b7ddf510340df849b14732da4118c80190583e
ea6c7b7a1c23086db831db3038a33f42a9eac3f1
refs/heads/master
2023-03-31T07:20:51.340106
2021-04-09T04:37:44
2021-04-09T04:37:44
347,838,252
0
0
null
null
null
null
UTF-8
Java
false
false
1,345
java
package com.smart.smartcontactmanager.com.smart.smartcontactmanager.config; import com.smart.smartcontactmanager.com.smart.smartcontactmanager.entities.User; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class CustomUserDetails implements UserDetails { private User user; public CustomUserDetails(User user) { this.user = user; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { SimpleGrantedAuthority simpleGrantedAuthority= new SimpleGrantedAuthority(user.getRole()); return List.of(simpleGrantedAuthority); } @Override public String getPassword() { return user.getPassword(); } @Override public String getUsername() { return user.getEmail(); } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } }
[ "66670675+u23490@users.noreply.github.com" ]
66670675+u23490@users.noreply.github.com
6c0d068baa47d7b92ed9d9b1d89121831e967517
74c2241ffd858933efd645b25618b608c2e1b6b0
/Comicser/app/src/main/java/com/sedsoftware/comicser/features/widget/ComicWidgetService.java
9b1c2aeb0a4877898c2d6b2c3727f45e4921c2d1
[]
no_license
cpt-r3tr0/Android
3559b9ea039e87f1222e42cb69ec4a8566db2885
47b987bfeabe4f9dd0b1683b5aa7d0655b9d8b4e
refs/heads/master
2020-04-06T10:26:49.751079
2018-11-13T15:09:33
2018-11-13T15:09:33
157,380,576
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package com.sedsoftware.comicser.features.widget; import android.content.Intent; import android.widget.RemoteViewsService; public class ComicWidgetService extends RemoteViewsService { @Override public RemoteViewsFactory onGetViewFactory(Intent intent) { return new ComicWidgetFactory(getApplicationContext()); } }
[ "rbordiya22@hotmail.com" ]
rbordiya22@hotmail.com
a9765991dfa7c50fe0cecfff5aa402df7051abe6
98190029d1de72d493e6a730ff4607a50a858946
/src/main/java/l2d/game/network/L2GamePacketHandler.java
9290053f3cb0a00eb22268064d6b7c1a6cf41b73
[]
no_license
iBezneR/interlude
e9777e24330b0342c2657eee8ada7914cfd6d1d0
764c889874034cf04d8e7b67792d705bee4ef719
refs/heads/master
2023-03-02T13:48:24.884131
2018-08-29T09:37:41
2018-08-29T09:37:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,485
java
package l2d.game.network; import static l2d.game.network.L2GameClient.GameClientState.IN_GAME; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.util.concurrent.RejectedExecutionException; import java.util.logging.Logger; import l2d.Config; import l2d.ext.network.HeaderInfo; import l2d.ext.network.IClientFactory; import l2d.ext.network.IMMOExecutor; import l2d.ext.network.IPacketHandler; import l2d.ext.network.MMOConnection; import l2d.ext.network.ReceivablePacket; import l2d.ext.network.TCPHeaderHandler; import l2d.game.ThreadPoolManager; import l2d.game.clientpackets.*; import l2d.game.model.L2Player; import l2d.game.network.L2GameClient.GameClientState; /** * Stateful Packet Handler<BR> * The Stateful approach prevents the server from handling inconsistent packets, examples:<BR> * <li>Clients sends a MoveToLocation packet without having a character attached. (Potential errors handling the packet).</li> * <li>Clients sends a RequestAuthLogin being already authed. (Potential exploit).</li> * <BR><BR> * Note: If for a given exception a packet needs to be handled on more then one state, then it should be added to all these states. */ public final class L2GamePacketHandler extends TCPHeaderHandler<L2GameClient> implements IPacketHandler<L2GameClient>, IClientFactory<L2GameClient>, IMMOExecutor<L2GameClient> { private static final Logger _log = Logger.getLogger(L2GamePacketHandler.class.getName()); /** * @param subHeaderHandler */ public L2GamePacketHandler() { super(null); } // implementation @Override public ReceivablePacket<L2GameClient> handlePacket(ByteBuffer buf, L2GameClient client) { int opcode = buf.get() & 0xFF; ReceivablePacket<L2GameClient> msg = null; GameClientState state = client.getState(); switch(state) { case CONNECTED: if(opcode == 0x00) msg = new ProtocolVersion(); else if(opcode == 0x08) msg = new AuthLogin(); else { //printDebug(opcode, buf, state, client); } break; case AUTHED: switch(opcode) { case 0x09: msg = new Logout(); break; case 0x0b: msg = new CharacterCreate(); break; case 0x0c: msg = new CharacterDelete(); break; case 0x0d: msg = new CharacterSelected(); break; case 0x0e: msg = new NewCharacter(); break; case 0x62: msg = new CharacterRestore(); break; case 0x68: msg = new RequestPledgeCrest(); break; default: //printDebug(opcode, buf, state, client); break; } break; case IN_GAME: switch(opcode) { case 0x01: msg = new MoveBackwardToLocation(); break; // case 0x02: // // Say ... not used any more ?? // break; case 0x03: msg = new EnterWorld(); break; case 0x04: msg = new Action(); break; case 0x09: msg = new Logout(); break; case 0x0a: msg = new AttackRequest(); break; case 0x0f: msg = new RequestItemList(); break; // case 0x10: // // RequestEquipItem ... not used any more, instead "useItem" // break; case 0x11: msg = new RequestUnEquipItem(); break; case 0x12: msg = new RequestDropItem(); break; case 0x14: msg = new UseItem(); break; case 0x15: msg = new TradeRequest(); break; case 0x16: msg = new AddTradeItem(); break; case 0x17: msg = new TradeDone(); break; case 0x1a: msg = new DummyPacket(); break; case 0x1b: msg = new RequestSocialAction(); break; case 0x1c: msg = new ChangeMoveType2(); break; case 0x1d: msg = new ChangeWaitType2(); break; case 0x1e: msg = new RequestSellItem(); break; case 0x1f: msg = new RequestBuyItem(); break; case 0x20: msg = new RequestLinkHtml(); break; case 0x21: msg = new RequestBypassToServer(); break; case 0x22: msg = new RequestBBSwrite(); break; case 0x23: msg = new DummyPacket(); break; case 0x24: msg = new RequestJoinPledge(); break; case 0x25: msg = new RequestAnswerJoinPledge(); break; case 0x26: msg = new RequestWithdrawalPledge(); break; case 0x27: msg = new RequestOustPledgeMember(); break; // case 0x28: // // RequestDismissPledge // break; case 0x29: msg = new RequestJoinParty(); break; case 0x2a: msg = new RequestAnswerJoinParty(); break; case 0x2b: msg = new RequestWithDrawalParty(); break; case 0x2c: msg = new RequestOustPartyMember(); break; case 0x2d: // RequestDismissParty break; case 0x2e: msg = new DummyPacket(); break; case 0x2f: msg = new RequestMagicSkillUse(); break; case 0x30: msg = new Appearing(); // (after death) break; case 0x31: if(Config.ALLOW_WAREHOUSE) msg = new SendWareHouseDepositList(); break; case 0x32: msg = new SendWareHouseWithDrawList(); break; case 0x33: msg = new RequestShortCutReg(); break; case 0x34: msg = new DummyPacket(); break; case 0x35: msg = new RequestShortCutDel(); break; case 0x36: msg = new CannotMoveAnymore(); break; case 0x37: msg = new RequestTargetCanceld(); break; case 0x38: msg = new Say2C(); break; case 0x3c: msg = new RequestPledgeMemberList(); break; case 0x3e: msg = new DummyPacket(); break; case 0x3f: msg = new RequestMagicSkillList(); break; // case 0x41: // // MoveWithDelta ... unused ?? or only on ship ?? // break; case 0x42: msg = new RequestGetOnVehicle(); break; case 0x43: msg = new RequestGetOffVehicle(); break; case 0x44: msg = new AnswerTradeRequest(); break; case 0x45: msg = new RequestActionUse(); break; case 0x46: msg = new RequestRestart(); break; // case 0x47: // // RequestSiegeInfo // break; case 0x48: msg = new ValidatePosition(); break; // case 0x49: // // RequestSEKCustom // break; // THESE ARE NOW TEMPORARY DISABLED case 0x4a: new StartRotating(); break; case 0x4b: new FinishRotating(); break; case 0x4d: msg = new RequestStartPledgeWar(); break; case 0x4e: //msg = new RequestReplyStartPledgeWar(); break; case 0x4f: msg = new RequestStopPledgeWar(); break; case 0x50: //msg = new RequestReplyStopPledgeWar(); break; case 0x51: // msg = new RequestSurrenderPledgeWar(); break; case 0x52: /// msg = new RequestReplySurrenderPledgeWar(); break; case 0x53: msg = new RequestSetPledgeCrest(); break; case 0x55: msg = new RequestGiveNickName(); break; case 0x57: msg = new RequestShowBoard(); break; case 0x58: msg = new RequestEnchantItem(); break; case 0x59: msg = new RequestDestroyItem(); break; case 0x5b: msg = new SendBypassBuildCmd(); break; case 0x5c: msg = new RequestMoveToLocationInVehicle(); break; case 0x5d: msg = new CannotMoveAnymoreInVehicle(); break; case 0x5e: msg = new RequestFriendInvite(); break; case 0x5f: msg = new RequestFriendAddReply(); break; case 0x60: msg = new RequestFriendList(); break; case 0x61: msg = new RequestFriendDel(); break; case 0x63: msg = new RequestQuestList(); break; case 0x64: msg = new RequestQuestAbort(); break; case 0x66: msg = new RequestPledgeInfo(); break; // case 0x67: // // RequestPledgeExtendedInfo // break; case 0x68: msg = new RequestPledgeCrest(); break; case 0x69: // msg = new RequestSurrenderPersonally(); break; // case 0x6a: // // Ride // break; case 0x6b: // send when talking to trainer npc, to show list of available skills msg = new RequestAquireSkillInfo();// --> [s] 0xa4; break; case 0x6c: // send when a skill to be learned is selected msg = new RequestAquireSkill(); break; case 0x6d: msg = new RequestRestartPoint(); break; case 0x6e: msg = new RequestGMCommand(); break; case 0x6f: msg = new RequestPartyMatchConfig(); break; case 0x70: msg = new RequestPartyMatchList(); break; case 0x71: msg = new RequestPartyMatchDetail(); break; case 0x72: msg = new RequestCrystallizeItem(); break; case 0x73: msg = new RequestPrivateStoreManageSell(); break; case 0x74: msg = new SetPrivateStoreList(); break; // case 0x75: // msg = new RequestPrivateStoreManageCancel(data, _client); // break; case 0x76: msg = new RequestPrivateStoreQuitSell(); break; case 0x77: msg = new SetPrivateStoreMsgSell(); break; // case 0x78: // // RequestPrivateStoreList // break; case 0x79: msg = new RequestPrivateStoreBuy(); break; case 0x7a: //ReviveReply break; case 0x7b: msg = new RequestTutorialLinkHtml(); break; case 0x7c: msg = new RequestTutorialPassCmdToServer(); break; case 0x7d: msg = new RequestTutorialQuestionMark(); break; case 0x7e: msg = new RequestTutorialClientEvent(); break; case 0x7f: msg = new RequestPetition(); break; case 0x80: msg = new RequestPetitionCancel(); break; case 0x81: msg = new RequestGmList(); break; case 0x82: msg = new RequestJoinAlly(); break; case 0x83: msg = new RequestAnswerJoinAlly(); break; case 0x84: msg = new RequestWithdrawAlly(); break; case 0x85: msg = new RequestOustAlly(); break; case 0x86: msg = new RequestDismissAlly(); break; case 0x87: msg = new RequestSetAllyCrest(); break; case 0x88: msg = new RequestAllyCrest(); break; case 0x89: msg = new RequestChangePetName(); break; case 0x8a: msg = new RequestPetUseItem(); break; case 0x8b: msg = new RequestGiveItemToPet(); break; case 0x8c: msg = new RequestGetItemFromPet(); break; case 0x8e: msg = new RequestAllyInfo(); break; case 0x8f: msg = new RequestPetGetItem(); break; case 0x90: msg = new RequestPrivateStoreManageBuy(); break; case 0x91: msg = new SetPrivateStoreBuyList(); break; // case 0x92: // // RequestPrivateStoreBuyManageCancel // break; case 0x93: msg = new RequestPrivateStoreQuitBuy(); break; case 0x94: msg = new SetPrivateStoreMsgBuy(); break; // case 0x95: // RequestPrivateStoreBuyList // break; case 0x96: msg = new SendPrivateStoreBuyBuyList(); // ? break; // case 0x97: // SendTimeCheckPacket // break; // case 0x98: // // RequestStartAllianceWar // break; // case 0x99: // // ReplyStartAllianceWar // break; // case 0x9a: // // RequestStopAllianceWar // break; // case 0x9b: // // ReplyStopAllianceWar // break; // case 0x9c: // // RequestSurrenderAllianceWar // break; case 0x9d: // RequestSkillCoolTime /*if (Config.DEBUG) _log.info("Request Skill Cool Time .. ignored"); msg = null;*/ break; case 0x9e: msg = new RequestPackageSendableItemList(); break; case 0x9f: msg = new RequestPackageSend(); break; case 0xa0: msg = new RequestBlock(); break; // case 0xa1: // // RequestCastleSiegeInfo // break; case 0xa2: msg = new RequestSiegeAttackerList(); break; case 0xa3: msg = new RequestSiegeDefenderList(); break; case 0xa4: msg = new RequestJoinSiege(); break; case 0xa5: msg = new RequestConfirmSiegeWaitingList(); break; // case 0xa6: // // RequestSetCastleSiegeTime // break; case 0xa7: msg = new RequestMultiSellChoose(); break; // case 0xa8: // // NetPing // break; case 0xaa: msg = new BypassUserCmd(); break; case 0xab: msg = new SnoopQuit(); break; case 0xac: // we still need this packet to handle BACK button of craft dialog msg = new RequestRecipeBookOpen(); break; case 0xad: msg = new RequestRecipeItemDelete(); break; case 0xae: msg = new RequestRecipeItemMakeInfo(); break; case 0xaf: msg = new RequestRecipeItemMakeSelf(); break; //case 0xb0: // msg = new RequestRecipeShopManageList(data, client); // break; case 0xb1: msg = new RequestRecipeShopMessageSet(); break; case 0xb2: msg = new RequestRecipeShopListSet(); break; case 0xb3: msg = new RequestRecipeShopManageQuit(); break; case 0xb5: msg = new RequestRecipeShopMakeInfo(); break; case 0xb6: msg = new RequestRecipeShopMakeDo(); break; case 0xb7: msg = new RequestRecipeShopMakeInfo(); break; case 0xb8: msg = new RequestObserverEnd(); break; case 0xb9: msg = new RequestEvaluate(); break; case 0xba: msg = new RequestHennaList(); break; case 0xbb: msg = new RequestHennaItemInfo(); break; case 0xbc: msg = new RequestHennaEquip(); break; case 0xc0: // Clan Privileges msg = new RequestPledgePower(); break; case 0xc1: msg = new RequestMakeMacro(); break; case 0xc2: msg = new RequestDeleteMacro(); break; // Manor case 0xc3: msg = new RequestProcureCropList(); break; case 0xc4: msg = new RequestBuySeed(); break; case 0xc5: msg = new ConfirmDlg(); break; case 0xc6: msg = new RequestPreviewItem(); break; case 0xc7: msg = new RequestSSQStatus(); break; case 0xCA: //msg = new GameGuardReply(); break; case 0xcc: msg = new RequestSendL2FriendSay(); break; case 0xcd: msg = new RequestShowMiniMap(); break; case 0xce: // MSN dialogs so that you dont see them in the console. break; case 0xcf: msg = new RequestReload(); // record video break; case 0xd0: int id2 = -1; if(buf.remaining() >= 2) id2 = buf.getShort() & 0xffff; else { _log.warning("Client: " + client.toString() + " sent a 0xd0 without the second opcode."); break; } switch(id2) { case 1: msg = new RequestOustFromPartyRoom(); break; case 2: msg = new RequestDismissPartyRoom(); break; case 3: msg = new RequestWithdrawPartyRoom(); break; case 4: msg = new RequestHandOverPartyMaster(); break; case 5: msg = new RequestAutoSoulShot(); break; case 6: msg = new RequestExEnchantSkillInfo(); break; case 7: msg = new RequestExEnchantSkill(); break; case 8: msg = new RequestManorList(); break; case 9: msg = new RequestProcureCropList(); break; case 0x0a: msg = new RequestSetSeed(); break; case 0x0b: msg = new RequestSetCrop(); break; case 0x0c: msg = new RequestWriteHeroWords(); break; case 0x0d: msg = new RequestExMPCCAskJoin(); break; case 0x0e: msg = new RequestExMPCCAcceptJoin(); break; case 0x0f: msg = new RequestExOustFromMPCC(); break; case 0x10: msg = new RequestPledgeCrestLarge(); break; case 0x11: msg = new RequestSetPledgeCrestLarge(); break; case 0x12: msg = new RequestOlympiadObserverEnd(); break; case 0x13: //msg = new RequestOlympiadMatchList(); break; case 0x14: msg = new RequestAskJoinPartyRoom(); break; case 0x15: msg = new AnswerJoinPartyRoom(); break; case 0x16: msg = new RequestListPartyMatchingWaitingRoom(); break; case 0x17: msg = new RequestExitPartyMatchingWaitingRoom(); break; case 0x18: msg = new RequestGetBossRecord(); break; case 0x19: msg = new RequestPledgeSetAcademyMaster(); break; case 0x1a: msg = new RequestPledgePowerGradeList(); break; case 0x1b: msg = new RequestPledgeMemberPowerInfo(); break; case 0x1c: msg = new RequestPledgeSetMemberPowerGrade(); break; case 0x1d: msg = new RequestPledgeMemberInfo(); break; case 0x1e: msg = new RequestPledgeWarList(); break; case 0x1f: msg = new RequestExFishRanking(); break; case 0x20: msg = new RequestPCCafeCouponUse(); break; // couldnt find it 0x21 :S case 0x22: msg = new RequestCursedWeaponList(); break; case 0x23: msg = new RequestCursedWeaponLocation(); break; case 0x24: msg = new RequestPledgeReorganizeMember(); break; // couldnt find it 0x25 :S case 0x26: msg = new RequestExMPCCShowPartyMembersInfo(); break; case 0x27: msg = new RequestDuelStart(); break; case 0x28: msg = new RequestDuelAnswerStart(); break; case 0x29: msg = new RequestConfirmTargetItem(); break; case 0x2a: msg = new RequestConfirmRefinerItem(); break; case 0x2b: msg = new RequestConfirmGemStone(); break; case 0x2c: msg = new RequestRefine(); break; case 0x2d: msg = new RequestConfirmCancelItem(); break; case 0x2e: msg = new RequestRefineCancel(); break; case 0x2f: msg = new RequestExMagicSkillUseGround(); break; case 0x30: msg = new RequestDuelSurrender(buf, client); break; default: //printDebugDoubleOpcode(opcode, id2, buf, state, client); break; } break; /*case 0xee: msg = new RequestChangePartyLeader(data, _client); break;*/ default: //printDebug(opcode, buf, state, client); break; } break; } return msg; } // impl @Override public L2GameClient create(MMOConnection<L2GameClient> con) { return new L2GameClient(con); } @Override public void execute(ReceivablePacket<L2GameClient> rp) { try { if(rp.getClient().getState() == IN_GAME) ThreadPoolManager.getInstance().executePacket(rp); else ThreadPoolManager.getInstance().executeIOPacket(rp); } catch(RejectedExecutionException e) { // if the server is shutdown we ignore if(!ThreadPoolManager.getInstance().isShutdown()) _log.severe("Failed executing: " + rp.getClass().getSimpleName() + " for Client: " + rp.getClient().toString()); } } public static String printData(byte[] data, int len) { StringBuffer result = new StringBuffer(); int counter = 0; for(int i = 0; i < len; i++) { if(counter % 16 == 0) result.append(fillHex(i, 4) + ": "); result.append(fillHex(data[i] & 0xff, 2) + " "); counter++; if(counter == 16) { result.append(" "); int charpoint = i - 15; for(int a = 0; a < 16; a++) { int t1 = data[charpoint++]; if(t1 > 0x1f && t1 < 0x80) result.append((char) t1); else result.append('.'); } result.append("\n"); counter = 0; } } int rest = data.length % 16; if(rest > 0) { for(int i = 0; i < 17 - rest; i++) result.append(" "); int charpoint = data.length - rest; for(int a = 0; a < rest; a++) { int t1 = data[charpoint++]; if(t1 > 0x1f && t1 < 0x80) result.append((char) t1); else result.append('.'); } result.append("\n"); } return result.toString(); } private static String fillHex(int data, int digits) { String number = Integer.toHexString(data); for(int i = number.length(); i < digits; i++) number = "0" + number; return number; } public void handleIncompletePacket(L2GameClient client) { L2Player activeChar = client.getActiveChar(); if(activeChar == null) _log.warning("Packet not completed. Maybe cheater. IP:" + client.getIpAddr() + ", account:" + client.getLoginName()); else _log.warning("Packet not completed. Maybe cheater. IP:" + client.getIpAddr() + ", account:" + client.getLoginName() + ", character:" + activeChar.getName()); client.onClientPacketFail(); } @SuppressWarnings("unchecked") @Override public HeaderInfo<L2GameClient> handleHeader(SelectionKey key, ByteBuffer buf) { if(buf.remaining() >= 2) { int dataPending = (buf.getShort() & 0xffff) - 2; L2GameClient client = ((MMOConnection<L2GameClient>) key.attachment()).getClient(); return getHeaderInfoReturn().set(0, dataPending, false, client); } L2GameClient client = ((MMOConnection<L2GameClient>) key.attachment()).getClient(); return getHeaderInfoReturn().set(2 - buf.remaining(), 0, false, client); } }
[ "vadim.didenko84@gmail.com" ]
vadim.didenko84@gmail.com
bdcaa2d5b666a1a49a4ce2fb310c6fdd8aaddafa
5a124224b497605306b4efdb3be2da013461ea22
/Case1.java
c8b60033343440a67d5cfa2b4f275dbf7e1ec4e2
[]
no_license
rdwornik/ecote-project
f5f6f93e6a4a81278ec3621290ac3583fbfd6b30
b407728bae3eeb78abd3e76a1c2ccb9cda38d6a8
refs/heads/master
2022-01-18T18:05:46.425617
2019-05-22T10:19:24
2019-05-22T10:19:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,314
java
/* Successful case: We test 5 cases; -Already declared "Runnable" interface in library with no arguemnts -Decalred Interface with 3 paramaters and using this parametrs in lambda body -Interface with one parameter not used in lambda body -Interface with six parameters used in lambda body -Interface with one parameter used in lambda body */ interface Interface{ public void foo(Object n, Object l, Object p); } interface Interface2{ public void foo2(Object n); } interface Interface3{ public void foo3(Object x, Object y, Object z,Object a, Object b, Object c); } interface Interface4{ public void foo4(Object n); } public class Case1 { public static void main(String[] args) { Runnable run = () -> { System.out.println("Hello"); }; Interface foo = (x,y,z) -> { System.out.println(x); Integer v = (Integer) x; v++; }; Interface2 foo2 = (x) -> { System.out.println("hello"); }; Interface3 foo3 = (x,y,z,a,b,c) -> { System.out.println("hello"); Integer v = (Integer) a; v++; Integer o = (Integer) b; o++; }; Interface4 foo4 = (x) -> { System.out.println(x); }; } }
[ "robert.dwornik@outlook.com" ]
robert.dwornik@outlook.com
1bd1bb3493dc542bc2b6be6bde1e9ed5308c3fc0
3ee6d6a1ca3f19b56eab7936a1e2839fc4b29e78
/jungsuk/src/ch12/ThreadEx2.java
efb264aaa9d7b16c5a6f70838889137b2e6689db
[]
no_license
daegi/study-dg
2764592b0f0914ec64b0a418a0417a1d6091651f
ad9862ecb60aca7265481daf7735d9dfd826e5f6
refs/heads/master
2021-01-19T13:52:59.044839
2014-07-25T03:27:26
2014-07-25T03:27:26
32,976,520
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package ch12; public class ThreadEx2 { public static void main(String[] args) { MyThreadEx2_1 t1 = new MyThreadEx2_1(); t1.start(); } } class MyThreadEx2_1 extends Thread{ public void run(){ throwException(); } public void throwException(){ try{ throw new Exception(); }catch(Exception e){ e.printStackTrace(); } } }
[ "choyc82@cf0b24a7-709c-1eb7-a6c0-50069b54bc80" ]
choyc82@cf0b24a7-709c-1eb7-a6c0-50069b54bc80
66437172f4238b86a30e70f731d3ff5368c59112
82487900d0d4e9a0a2d9f24e605c64db3585a40f
/app/src/main/java/com/example/corstan__cc__managment/Model/Day.java
e911f28b7a44eb7651a3dd92aaaa378699e0dd1d
[]
no_license
ryangd/Corstan--CC--Managment
2a18cc3e9c4f7b35740e7503ac45de15f0a6c657
224e508bb48d77925e19d3af011c5053f7a18007
refs/heads/master
2022-12-04T02:23:36.851940
2020-08-22T03:15:07
2020-08-22T03:15:07
288,278,259
0
0
null
null
null
null
UTF-8
Java
false
false
865
java
/* * Property of: GreenDot Management Systems Inc. * A Division Of * Corstan Systems Inc. * * Written By: Ryan Stander * ryanstander@gmail.com * June 17, 2020 * * Copyright (c) TradeMark Reserved (tm) * */ package com.example.corstan__cc__managment.Model; public class Day { private String dayDate, dayDay; public Day (){ } public Day(String dayDate, String dayDay) { this.dayDate = dayDate; this.dayDay = dayDay; } public String getDayDay() { return dayDay; } public void setDayDay(String dayDay) { this.dayDay = dayDay; } public String getDayDate() { return dayDate; } public void setDayDate(String dayDate) { this.dayDate = dayDate; } }
[ "ryan@gd.systems" ]
ryan@gd.systems
4fc5cf2a1f44846186a819aa1cceb1e9439e2bfc
1d35f3630148deb0e22ccedb15980ba004023549
/qrcode/src/main/java/com/aisino/qrcode/activity/CaptureActivity.java
c9ee8de9e24f98a956d837827466b743bd327eca
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
wwan12/SimpleExample_v1
95aa6f912911754d3edc19d8ac1a613e982a0fad
8b6675c8ab9d251086429a038d100a8c9d9098b2
refs/heads/master
2023-08-13T22:17:36.922406
2023-06-25T09:14:57
2023-06-25T09:14:57
174,499,736
0
0
null
null
null
null
UTF-8
Java
false
false
9,916
java
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aisino.qrcode.activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.Window; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.ImageView; import android.widget.RelativeLayout; import androidx.appcompat.app.AppCompatActivity; import com.aisino.qrcode.R; import com.aisino.qrcode.camera.CameraManager; import com.aisino.qrcode.decode.DecodeThread; import com.aisino.qrcode.utils.BeepManager; import com.aisino.qrcode.utils.CaptureActivityHandler; import com.aisino.qrcode.utils.InactivityTimer; import com.google.zxing.Result; import java.io.IOException; import java.lang.reflect.Field; /** * This activity opens the camera and does the actual scanning on a background * thread. It draws a viewfinder to help the user place the barcode correctly, * shows feedback as the image processing is happening, and then overlays the * results when a scan is successful. * * @author dswitkin@google.com (Daniel Switkin) * @author Sean Owen */ public final class CaptureActivity extends AppCompatActivity implements SurfaceHolder.Callback { private static final String TAG = CaptureActivity.class.getSimpleName(); private CameraManager cameraManager; private CaptureActivityHandler handler; private InactivityTimer inactivityTimer; private BeepManager beepManager; private SurfaceView scanPreview = null; private RelativeLayout scanContainer; private RelativeLayout scanCropView; private ImageView scanLine; private Rect mCropRect = null; private boolean isHasSurface = false; public Handler getHandler() { return handler; } public CameraManager getCameraManager() { return cameraManager; } @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_capture); scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation .RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f); animation.setDuration(4500); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); } @Override protected void onResume() { super.onResume(); cameraManager = new CameraManager(getApplication()); handler = null; if (isHasSurface) { // The activity was paused but not stopped, so the surface still // exists. Therefore // surfaceCreated() won't be called, so init the camera here. initCamera(scanPreview.getHolder()); } else { // Install the callback and wait for surfaceCreated() to init the // camera. scanPreview.getHolder().addCallback(this); } inactivityTimer.onResume(); } @Override protected void onPause() { if (handler != null) { handler.quitSynchronously(); handler = null; } inactivityTimer.onPause(); beepManager.close(); cameraManager.closeDriver(); if (!isHasSurface) { scanPreview.getHolder().removeCallback(this); } super.onPause(); } @Override protected void onDestroy() { inactivityTimer.shutdown(); super.onDestroy(); } @Override public void surfaceCreated(SurfaceHolder holder) { if (holder == null) { Log.e(TAG, "*** WARNING *** surfaceCreated() gave us a null surface!"); } if (!isHasSurface) { isHasSurface = true; initCamera(holder); } } @Override public void surfaceDestroyed(SurfaceHolder holder) { isHasSurface = false; } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } /** * A valid barcode has been found, so give an indication of success and show * the results. * * @param rawResult The contents of the barcode. * @param bundle The extras */ public void handleDecode(Result rawResult, Bundle bundle) { inactivityTimer.onActivity(); beepManager.playBeepSoundAndVibrate(); Intent resultIntent = new Intent(); bundle.putInt("width", mCropRect.width()); bundle.putInt("height", mCropRect.height()); bundle.putString("result", rawResult.getText()); resultIntent.putExtras(bundle); this.setResult(RESULT_OK, resultIntent); CaptureActivity.this.finish(); } private void initCamera(SurfaceHolder surfaceHolder) { if (surfaceHolder == null) { throw new IllegalStateException("No SurfaceHolder provided"); } if (cameraManager.isOpen()) { Log.w(TAG, "initCamera() while already open -- late SurfaceView callback?"); return; } try { cameraManager.openDriver(surfaceHolder); // Creating the handler starts the preview, which can also throw a // RuntimeException. if (handler == null) { handler = new CaptureActivityHandler(this, cameraManager, DecodeThread.ALL_MODE); } initCrop(); } catch (IOException ioe) { Log.w(TAG, ioe); displayFrameworkBugMessageAndExit(); } catch (RuntimeException e) { // Barcode Scanner has seen crashes in the wild of this variety: // java.?lang.?RuntimeException: Fail to connect to camera service Log.w(TAG, "Unexpected error initializing camera", e); displayFrameworkBugMessageAndExit(); } } private void displayFrameworkBugMessageAndExit() { // camera error AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(""); builder.setMessage("相机发生错误"); builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }); builder.show(); } public void restartPreviewAfterDelay(long delayMS) { if (handler != null) { handler.sendEmptyMessageDelayed(R.id.restart_preview, delayMS); } } public Rect getCropRect() { return mCropRect; } /** * 初始化截取的矩形区域 */ private void initCrop() { int cameraWidth = cameraManager.getCameraResolution().y; int cameraHeight = cameraManager.getCameraResolution().x; /** 获取布局中扫描框的位置信息 */ int[] location = new int[2]; scanCropView.getLocationInWindow(location); int cropLeft = location[0]; int cropTop = location[1] - getStatusBarHeight(); int cropWidth = scanCropView.getWidth(); int cropHeight = scanCropView.getHeight(); /** 获取布局容器的宽高 */ int containerWidth = scanContainer.getWidth(); int containerHeight = scanContainer.getHeight(); /** 计算最终截取的矩形的左上角顶点x坐标 */ int x = cropLeft * cameraWidth / containerWidth; /** 计算最终截取的矩形的左上角顶点y坐标 */ int y = cropTop * cameraHeight / containerHeight; /** 计算最终截取的矩形的宽度 */ int width = cropWidth * cameraWidth / containerWidth; /** 计算最终截取的矩形的高度 */ int height = cropHeight * cameraHeight / containerHeight; /** 生成最终的截取的矩形 */ mCropRect = new Rect(x, y, width + x, height + y); } private int getStatusBarHeight() { try { Class<?> c = Class.forName("com.android.internal.R$dimen"); Object obj = c.newInstance(); Field field = c.getField("status_bar_height"); int x = Integer.parseInt(field.get(obj).toString()); return getResources().getDimensionPixelSize(x); } catch (Exception e) { e.printStackTrace(); } return 0; } }
[ "376954839@qq.com" ]
376954839@qq.com
2536464853bde66fd5221698d94e400437b2e97b
7639cb47863dc8ee41a420f4e838d61e9857bbf4
/NTurk_BACKEND_1/src/main/java/foursomeSE/entity/statistics/UserDistribution.java
f61a5e77793263ddbc9338e0fc4cc5195bc3b03d
[]
no_license
PatrickLai7528/NTurk_Phase_III
3e0288a337ca562662d41ed8477b0df3f2ca42ed
4a23be2ac0d6ec79a69c9564d9bb883efc14e3c8
refs/heads/master
2020-04-26T17:42:17.704743
2018-09-05T01:13:58
2018-09-05T01:13:58
173,721,636
0
0
null
2020-04-12T03:51:17
2019-03-04T10:14:09
Java
UTF-8
Java
false
false
1,240
java
package foursomeSE.entity.statistics; public class UserDistribution { private String name; // 就是province private int value; public UserDistribution() { } public UserDistribution(String name, int value) { this.name = name; this.value = value; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } @Override public String toString() { return "UserDistribution{" + "name='" + name + '\'' + ", value=" + value + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof UserDistribution)) return false; UserDistribution that = (UserDistribution) o; if (value != that.value) return false; return name != null ? name.equals(that.name) : that.name == null; } @Override public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + value; return result; } }
[ "LiianwYuuX@outlook.com" ]
LiianwYuuX@outlook.com
9a335ccc6a938e8cc64382cb0ba04e6741f14966
e79a12f7d2538dce830d8abc858d49c247f14248
/src/main/java/com/firstjhipster/sample/security/jwt/TokenProvider.java
f62ec50192fab66521974ad56cc88f9a155d6fb5
[]
no_license
shindedeepali1994/Sample
17f778dfd66f3213ecf7b42efe2ab0d212ebfeb0
345b501547f2fefa7eb9c98b808b62d93f036704
refs/heads/master
2021-06-23T20:22:06.407545
2019-11-15T06:03:11
2019-11-15T06:03:11
221,855,121
0
0
null
2021-04-29T21:53:11
2019-11-15T06:03:03
Java
UTF-8
Java
false
false
4,256
java
package com.firstjhipster.sample.security.jwt; import java.nio.charset.StandardCharsets; import java.security.Key; import java.util.*; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import io.github.jhipster.config.JHipsterProperties; import io.jsonwebtoken.*; import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; @Component public class TokenProvider implements InitializingBean { private final Logger log = LoggerFactory.getLogger(TokenProvider.class); private static final String AUTHORITIES_KEY = "auth"; private Key key; private long tokenValidityInMilliseconds; private long tokenValidityInMillisecondsForRememberMe; private final JHipsterProperties jHipsterProperties; public TokenProvider(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; } @Override public void afterPropertiesSet() throws Exception { byte[] keyBytes; String secret = jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret(); if (!StringUtils.isEmpty(secret)) { log.warn("Warning: the JWT key used is not Base64-encoded. " + "We recommend using the `jhipster.security.authentication.jwt.base64-secret` key for optimum security."); keyBytes = secret.getBytes(StandardCharsets.UTF_8); } else { log.debug("Using a Base64-encoded JWT secret key"); keyBytes = Decoders.BASE64.decode(jHipsterProperties.getSecurity().getAuthentication().getJwt().getBase64Secret()); } this.key = Keys.hmacShaKeyFor(keyBytes); this.tokenValidityInMilliseconds = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds(); this.tokenValidityInMillisecondsForRememberMe = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt() .getTokenValidityInSecondsForRememberMe(); } public String createToken(Authentication authentication, boolean rememberMe) { String authorities = authentication.getAuthorities().stream() .map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); long now = (new Date()).getTime(); Date validity; if (rememberMe) { validity = new Date(now + this.tokenValidityInMillisecondsForRememberMe); } else { validity = new Date(now + this.tokenValidityInMilliseconds); } return Jwts.builder() .setSubject(authentication.getName()) .claim(AUTHORITIES_KEY, authorities) .signWith(key, SignatureAlgorithm.HS512) .setExpiration(validity) .compact(); } public Authentication getAuthentication(String token) { Claims claims = Jwts.parser() .setSigningKey(key) .parseClaimsJws(token) .getBody(); Collection<? extends GrantedAuthority> authorities = Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(",")) .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); User principal = new User(claims.getSubject(), "", authorities); return new UsernamePasswordAuthenticationToken(principal, token, authorities); } public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(key).parseClaimsJws(authToken); return true; } catch (JwtException | IllegalArgumentException e) { log.info("Invalid JWT token."); log.trace("Invalid JWT token trace.", e); } return false; } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
e7f3660db75a98f7ccaa9e9b4712415ddc2b29d3
e62c3b93b38d2d7781d38ba1cdbabfea2c1cf7af
/BocBankMobile/src/main/java/com/boc/bocsoft/mobile/bocmobile/buss/wealthmanagement/mypositions/financialposition/ui/FinancialTypeProgressQueryFragment.java
1c3e650e4cf18cc44bde9d84b4e452732650ad0a
[]
no_license
soghao/zgyh
df34779708a8d6088b869d0efc6fe1c84e53b7b1
09994dda29f44b6c1f7f5c7c0b12f956fc9a42c1
refs/heads/master
2021-06-19T07:36:53.910760
2017-06-23T14:23:10
2017-06-23T14:23:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,243
java
package com.boc.bocsoft.mobile.bocmobile.buss.wealthmanagement.mypositions.financialposition.ui; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; import com.boc.bocsoft.mobile.bii.bus.wealthmanagement.model.PsnXpadProgressQuery.PsnXpadProgressQueryParams; import com.boc.bocsoft.mobile.bii.bus.wealthmanagement.model.PsnXpadProgressQueryOutlay.PsnXpadProgressQueryOutlayParams; import com.boc.bocsoft.mobile.bocmobile.R; import com.boc.bocsoft.mobile.bocmobile.base.activity.MvpBussFragment; import com.boc.bocsoft.mobile.bocmobile.base.utils.LogUtils; import com.boc.bocsoft.mobile.bocmobile.base.widget.SpringPressageView.SpringRateDetailContent; import com.boc.bocsoft.mobile.bocmobile.base.widget.emptyview.CommonEmptyView; import com.boc.bocsoft.mobile.bocmobile.buss.wealthmanagement.mypositions.financialposition.model.PsnXpadProgressQueryOutlay.PsnXpadProgressQueryOutlayResModel; import com.boc.bocsoft.mobile.bocmobile.buss.wealthmanagement.mypositions.financialposition.model.psnxpadprogressquery.PsnXpadProgressQueryResModel; import com.boc.bocsoft.mobile.bocmobile.buss.wealthmanagement.mypositions.financialposition.presenter.FinancialPositionContract; import com.boc.bocsoft.mobile.bocmobile.buss.wealthmanagement.mypositions.financialposition.presenter.FinancialTypeProgressQueryPresenter; import com.boc.bocsoft.mobile.common.utils.PublicUtils; import com.boc.bocsoft.mobile.common.utils.StringUtils; import com.boc.bocsoft.mobile.framework.ui.BasePresenter; import com.boc.bocsoft.mobile.framework.widget.TitleBarView; import java.util.ArrayList; import java.util.List; /** * 收益累进产品 -- 累计产品收益查询 - 预计年化收益率 * Created by cff on 2016/10/19. */ public class FinancialTypeProgressQueryFragment extends MvpBussFragment<FinancialTypeProgressQueryPresenter> implements FinancialPositionContract.FinancialTypeProgressQueryView { private static final String TAG = "FinancialTypeProgressQueryFragment"; private View rootView; //产品头部介绍 private TextView progress_product; //=============================变量====================================== //回话ID // private String mConversationID; //接收传送数据 // private PsnXpadProductBalanceQueryResModel banlanceDeta; //当前请求页数 private int page = 0; //数据总共条目数 private int queryNum_total; //展示数据 private List<PsnXpadProgressQueryResModel.ListBean> progressList = new ArrayList<PsnXpadProgressQueryResModel.ListBean>(); //展示数据 private List<PsnXpadProgressQueryOutlayResModel.ListBean> progressOutlayList = new ArrayList<PsnXpadProgressQueryOutlayResModel.ListBean>(); //请求参数 private PsnXpadProgressQueryParams mParams = new PsnXpadProgressQueryParams(); //请求参数 private PsnXpadProgressQueryOutlayParams mParamsOutlay = new PsnXpadProgressQueryOutlayParams(); private SpringRateDetailContent spring_date; private ScrollView scroll_no_emptyview; /** * 产品名称和code---默认为隐藏 */ private LinearLayout title_product_name; //空数据页面 private RelativeLayout rl_content_view_nodata; //空数据页面 private CommonEmptyView view_no_data; /** * 产品名称 */ private String ProdName; /** * 产品代码 */ private String ProdCod; /** * 资金账号缓存标识 */ private String BancAccountKey; //是否登录 默认为未登录 private boolean isLogin = false; float max; @Override protected View onCreateView(LayoutInflater mInflater) { rootView = mInflater.inflate(R.layout.view_financialtype_progress_view, null); return rootView; } @Override protected String getTitleValue() { return getString(R.string.boc_position_expected_annual_return_rate); } @Override protected boolean getTitleBarRed() { return false; } @Override protected View getTitleBarView() { TitleBarView titleBarView = (TitleBarView) super.getTitleBarView(); titleBarView.setRightButton(null, null); return titleBarView; } @Override public void initView() { progress_product = (TextView) rootView.findViewById(R.id.progress_product); scroll_no_emptyview = (ScrollView) rootView.findViewById(R.id.scroll_no_emptyview); spring_date = (SpringRateDetailContent) rootView.findViewById(R.id.spring_date); title_product_name = (LinearLayout) rootView.findViewById(R.id.title_productnameandcode); rl_content_view_nodata = (RelativeLayout) rootView.findViewById(R.id.rl_content_view_nodata); view_no_data = (CommonEmptyView) rootView.findViewById(R.id.view_no_data); scroll_no_emptyview.setVisibility(View.GONE); } @Override public void initData() { progress_product.setText(ProdName + " (" + ProdCod + ")"); // for(int i = 1;i<=10;i++){ // spring_date.addTextContent("100",i*10+"",i+"-"+i*10+"天"); // } // if (isLogin) { //已登录 获取年华收益率详情 showLoadingDialog(); getPresenter().getPSNCreatConversation(); } else { //未登录 获取年华收益率详情 getPsnXpadProgressQueryOutlay(page); // getPresenter().getPsnXpadProgressQueryOutlay(); } } @Override public void setListener() { } /** * 为预计年化收益率设置数据 * * @param ProdName * @param ProdCod * @param BancAccountKey * @param isLogin */ public void setReferDetail(String ProdName, String ProdCod, String BancAccountKey, boolean isLogin) { this.ProdName = ProdName; this.ProdCod = ProdCod; this.BancAccountKey = BancAccountKey; this.isLogin = isLogin; } /** * 获取会话ID--成功 * * @param conversationId */ @Override public void obtainConversationSuccess(String conversationId) { LogUtils.i(TAG, "-------->获取会话ID--成功!"); getPsnXpadProgressQuery(page, conversationId); } /** * 获取会话ID--失败 */ @Override public void obtainConversationFail() { LogUtils.i(TAG, "-------->获取会话ID--失败!"); closeProgressDialog(); } /** * 请求收益率查询成功 * * @param resModel */ @Override public void obtainPsnXpadProgressQuerySuccess(PsnXpadProgressQueryResModel resModel) { LogUtils.i(TAG, "----------请求收益率查询成功----------"); closeProgressDialog(); handlerPsnXpadProgressQuerySuccess(resModel); } /** * 请求收益率查询失败 */ @Override public void obtainPsnXpadProgressQueryFault() { LogUtils.i(TAG, "----------请求收益率查询失败----------"); closeProgressDialog(); rl_content_view_nodata.setVisibility(View.VISIBLE); view_no_data.setEmptyTips("暂无预期年化收益率", R.drawable.no_result); scroll_no_emptyview.setVisibility(View.GONE); } /** * 4.53 053 PsnXpadProgressQueryOutlay 登录前累进产品收益率查询 * 成功 * * @param resModel */ @Override public void obtainPsnXpadProgressQueryOutlaySuccess(PsnXpadProgressQueryOutlayResModel resModel) { LogUtils.i(TAG, "----------登录前累进产品收益率查询成功----------"); closeProgressDialog(); handlerPsnXpadProgressQueryOutlaySuccess(resModel); } /** * 4.53 053 PsnXpadProgressQueryOutlay 登录前累进产品收益率查询 * 失败 */ @Override public void obtainPsnXpadProgressQueryOutlayFault() { LogUtils.i(TAG, "----------登录前累进产品收益率查询失败----------"); closeProgressDialog(); rl_content_view_nodata.setVisibility(View.VISIBLE); view_no_data.setEmptyTips("暂无预期年化收益率", R.drawable.no_result); scroll_no_emptyview.setVisibility(View.GONE); } @Override public void setPresenter(BasePresenter presenter) { } @Override protected FinancialTypeProgressQueryPresenter initPresenter() { return new FinancialTypeProgressQueryPresenter(this); } //===========================自定义方法=========================== /** * 网络数据回调处理 * * @param resModel */ private void handlerPsnXpadProgressQuerySuccess(PsnXpadProgressQueryResModel resModel) { queryNum_total = Integer.parseInt(resModel.getRecordNumber()); if (0 == page) { progressList = resModel.getList(); } else { progressList.addAll(resModel.getList()); } if (PublicUtils.isEmpty(progressList)) { rl_content_view_nodata.setVisibility(View.VISIBLE); view_no_data.setEmptyTips("暂无预期年化收益率", R.drawable.no_result); scroll_no_emptyview.setVisibility(View.GONE); } else { scroll_no_emptyview.setVisibility(View.VISIBLE); rl_content_view_nodata.setVisibility(View.GONE); for (int i = 0; i < progressList.size(); i++) { max = Float.valueOf(progressList.get(0).getYearlyRR()); if (max <= Float.valueOf(progressList.get(i).getYearlyRR())) { max = Float.valueOf(progressList.get(i).getYearlyRR()); } } for (int i = 0; i < progressList.size(); i++) { PsnXpadProgressQueryResModel.ListBean model = progressList.get(i); if (!StringUtils.isEmptyOrNull(model.getMaxDays())&&!"-1".equalsIgnoreCase(model.getMaxDays())) { spring_date.addTextContent(String.valueOf(max), model.getYearlyRR(), model.getMinDays() + "-" + model.getMaxDays() + "天"); } else { spring_date.addTextContent(String.valueOf(max), model.getYearlyRR(), model.getMinDays() + "天及以上"); } } // for(int i = 0; i < 5; i++){ // spring_date.addTextContent( "15.0" ,String.valueOf(i+6.0),"1-7tian"); // // } } } /** * 4.53 053 PsnXpadProgressQueryOutlay 登录前累进产品收益率查询 * * @param resModel */ private void handlerPsnXpadProgressQueryOutlaySuccess(PsnXpadProgressQueryOutlayResModel resModel) { queryNum_total = Integer.parseInt(resModel.getRecordNumber()); if (0 == page) { progressOutlayList = resModel.getList(); } else { progressOutlayList.addAll(resModel.getList()); } if (PublicUtils.isEmpty(progressOutlayList)) { rl_content_view_nodata.setVisibility(View.VISIBLE); view_no_data.setEmptyTips("暂无预期年化收益率", R.drawable.no_result); scroll_no_emptyview.setVisibility(View.GONE); } else { scroll_no_emptyview.setVisibility(View.VISIBLE); rl_content_view_nodata.setVisibility(View.GONE); for (int i = 0; i < progressOutlayList.size(); i++) { max = Float.valueOf(progressOutlayList.get(0).getYearlyRR()); if (max <= Float.valueOf(progressOutlayList.get(i).getYearlyRR())) { max = Float.valueOf(progressOutlayList.get(i).getYearlyRR()); } } for (int i = 0; i < progressOutlayList.size(); i++) { PsnXpadProgressQueryOutlayResModel.ListBean model = progressOutlayList.get(i); // if (null != model.getMinDays()) { // spring_date.addTextContent(progressOutlayList.get(progressOutlayList.size() - 1).getYearlyRR(), // model.getYearlyRR(), model.getMinDays() + "-" + model.getMaxDays() + "天"); // } else { // spring_date.addTextContent(progressOutlayList.get(progressOutlayList.size() - 1).getYearlyRR(), // model.getYearlyRR(), model.getMaxDays() + "天及以上"); // } if (!StringUtils.isEmptyOrNull(model.getMaxDays())&&!"-1".equalsIgnoreCase(model.getMaxDays())) { spring_date.addTextContent(String.valueOf(max), model.getYearlyRR(), model.getMinDays() + "-" + model.getMaxDays() + "天"); } else { spring_date.addTextContent(String.valueOf(max), model.getYearlyRR(), model.getMinDays() + "天及以上"); } } } } /** * 登陆后 * * @param page * @param conversationId */ private void getPsnXpadProgressQuery(int page, String conversationId) { mParams.setConversationId(conversationId); mParams.setAccountKey(BancAccountKey); mParams.setPageSize("50"); mParams.set_refresh("true"); mParams.setCurrentIndex(page * 50 + ""); mParams.setProductCode(ProdCod); getPresenter().getPsnXpadProgressQuery(mParams); } /** * 登陆前 */ private void getPsnXpadProgressQueryOutlay(int page) { mParamsOutlay.setProductCode(ProdCod); mParamsOutlay.setPageSize("50"); mParamsOutlay.set_refresh("true"); mParamsOutlay.setCurrentIndex(page * 50 + ""); getPresenter().getPsnXpadProgressQueryOutlay(mParamsOutlay); } /** * 判断是否已加载所有数据 * * @return true 已经全部加载;false 没有全部加载 */ private boolean isLoadAllRecord() { int loadnum = progressList == null ? 0 : progressList.size(); int totalnum = queryNum_total; if (loadnum >= totalnum) { return true; } else { return false; } } }
[ "15609143618@163.com" ]
15609143618@163.com
3c225d8ab71086e71ec4c958d99ab32a6bf7cb64
5f4bfcdf9c1b8f3d7ac31785201edb59a7e35273
/src/com/javarush/test/level13/lesson02/task07/Solution.java
14769082afab417f97d9d1acda6e3aaf3a207255
[]
no_license
sergAleshchenko/JavaRushHomeWork
f6c9d23e881245c80d42f72cf06a5d860191b0a4
ff67c727cbe9f27468d83d625594b3f682a58320
refs/heads/master
2021-01-18T11:50:31.130020
2016-01-13T03:52:50
2016-01-13T03:52:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package com.javarush.test.level13.lesson02.task07; /* Параметризованый интерфейс В классе StringObject реализуй интерфейс SimpleObject с параметром типа String. */ public class Solution { public static void main(String[] args) throws Exception { } interface SimpleObject<T> { SimpleObject<T> getInstance(); } class StringObject implements SimpleObject<String> //допишите здесь ваш код { public SimpleObject<String> getInstance() { return new StringObject(); } } }
[ "serg.aleshchenko@gmail.com" ]
serg.aleshchenko@gmail.com
38727fe6187be6a40c70cf00cf2148d4e065d1cf
d69ab48c3a3e2f2ebce488c0627c536c81421685
/MovingCard.java
0d8d90931a7398797019aba927042eaa17fef9c0
[]
no_license
sdr04055/maplestone
63490d1d262faa221451003117b310b6d6e882d7
4face29c416cea92c20c07112a75ecc5079b2d0d
refs/heads/master
2016-09-06T05:56:41.585999
2015-05-12T11:59:42
2015-05-12T11:59:42
35,484,627
1
2
null
null
null
null
UTF-8
Java
false
false
1,021
java
public class MovingCard { static Card data, goal; static Champion goalChamp; static int goalx, goaly; static int movingTime = 1500; static double speedx, speedy; static double nowx, nowy; static int retx, rety; static boolean isMoving; static void update(){ nowx += speedx; nowy += speedy; if(goalx == retx && goaly == rety){ //returning if(Math.abs(nowx-goalx)<=Math.abs(speedx) || Math.abs(nowy-goaly)<=Math.abs(speedy)){ isMoving = false; nowx = retx; nowy = rety; } } else if(Math.abs(goalx-nowx)<60 && Math.abs(goaly-nowy)<90){ //isMoving = false;isMoving = true; if(goal.name!=""){ data.hp -= goal.atk; goal.hp -= data.atk; if(data.hpmax<data.hp)data.hp = data.hpmax; if(goal.hpmax<goal.hp)goal.hp = goal.hpmax; } else{ goalChamp.hp -= data.atk; if(goalChamp.hpmax<goalChamp.hp)goalChamp.hp = goalChamp.hpmax; } goalx = retx; goaly = rety; speedx *= -1; speedy *= -1; } data.x = (int)nowx; data.y = (int)nowy; } }
[ "sdr04055@gmail.com" ]
sdr04055@gmail.com
79757c4c1351732e8a7625b148ec790794885abe
7af846ccf54082cd1832c282ccd3c98eae7ad69a
/ftmap/src/main/java/taxi/nicecode/com/ftmap/generated/package_31/Foo10.java
756fd22f9e78dd447135edbd38ec058e168cd1b4
[]
no_license
Kadanza/TestModules
821f216be53897d7255b8997b426b359ef53971f
342b7b8930e9491251de972e45b16f85dcf91bd4
refs/heads/master
2020-03-25T08:13:09.316581
2018-08-08T10:47:25
2018-08-08T10:47:25
143,602,647
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package taxi.nicecode.com.ftmap.generated.package_31; public class Foo10 { public void foo0(){ new Foo9().foo5(); } public void foo1(){ foo0(); } public void foo2(){ foo1(); } public void foo3(){ foo2(); } public void foo4(){ foo3(); } public void foo5(){ foo4(); } }
[ "1" ]
1
080b1ad6b12e10d8c1daf12d6672240948b11f50
7744e94b372687a1467df23acc7e498db6c7d4cd
/src/main/java/com/linwu/yuanqi/threadtest/TheradTest.java
abf7543453d0dc673cd202549d55d6e647a7dbe1
[]
no_license
Mrwuyi00/yuanqi
e42f99eb9a6ed4169d0acc5f04b693500356a3dc
23c2df72899e3f9b8c48e17bd89e0d35ce90c634
refs/heads/master
2021-01-02T08:48:55.425277
2017-12-29T09:32:19
2017-12-29T09:32:19
99,068,988
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package com.linwu.yuanqi.threadtest; /** * Created by linwu on 11/8/2017. */ public abstract class TheradTest extends Thread{ }
[ "linwu@hengtiansoft.com" ]
linwu@hengtiansoft.com
635092a6e40079bfd7bb4e55d77af55a900dbf74
6324ba3857e09e1ff891dc547f05bb7c9ed6f449
/apps/maintenance/web/src/main/java/net/aicoder/maintenance/business/product/product/package-info.java
eb9f5cdd9a811cac3ada9a125a619067f0d75f2a
[]
no_license
ai-coders/devp
68a0431007ebd5796dbf48a321ee08ff2dd87708
9dfe34374048cea2e613fa01fd9f584c5090361d
refs/heads/master
2023-01-09T12:16:06.197363
2018-11-24T09:16:25
2018-11-24T09:16:25
134,250,514
0
2
null
2022-12-26T05:54:12
2018-05-21T09:53:00
Java
UTF-8
Java
false
false
57
java
package net.aicoder.maintenance.business.product.product;
[ "13962217@qq.com" ]
13962217@qq.com