conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
list.add(YKMH.getDefaultSource());
=======
list.add(DmzjFix.getDefaultSource());
>>>>>>>
list.add(YKMH.getDefaultSource());
list.add(DmzjFix.getDefaultSource()); |
<<<<<<<
import com.hiroshi.cimoc.source.Cartoonmad;
import com.hiroshi.cimoc.source.ChuiXue;
=======
import com.hiroshi.cimoc.source.ChuiXue;
import com.hiroshi.cimoc.source.Chuiyao;
>>>>>>>
import com.hiroshi.cimoc.source.Cartoonmad;
import com.hiroshi.cimoc.source.ChuiXue;
<<<<<<<
import com.hiroshi.cimoc.source.MiGu;
import com.hiroshi.cimoc.source.NetEase;
=======
import com.hiroshi.cimoc.source.Manhuatai;
>>>>>>>
import com.hiroshi.cimoc.source.Manhuatai;
import com.hiroshi.cimoc.source.MiGu;
import com.hiroshi.cimoc.source.NetEase;
<<<<<<<
import com.hiroshi.cimoc.source.Tencent;
import com.hiroshi.cimoc.source.TuHao;
=======
import com.hiroshi.cimoc.source.Tencent;
>>>>>>>
import com.hiroshi.cimoc.source.Tencent;
import com.hiroshi.cimoc.source.TuHao;
<<<<<<<
//feilong
=======
>>>>>>>
//feilong
<<<<<<<
case Tencent.TYPE:
parser = new Tencent(source);
break;
case BuKa.TYPE:
parser = new BuKa(source);
break;
case EHentai.TYPE:
parser = new EHentai(source);
break;
case NetEase.TYPE:
parser = new NetEase(source);
break;
case Hhxxee.TYPE:
parser = new Hhxxee(source);
break;
case Cartoonmad.TYPE:
parser = new Cartoonmad(source);
break;
case Animx2.TYPE:
parser = new Animx2(source);
break;
case MH517.TYPE:
parser = new MH517(source);
break;
case MiGu.TYPE:
parser = new MiGu(source);
break;
case BaiNian.TYPE:
parser = new BaiNian(source);
break;
case ChuiXue.TYPE:
parser = new ChuiXue(source);
break;
case TuHao.TYPE:
parser = new TuHao(source);
break;
case ManHuaDB.TYPE:
parser = new ManHuaDB(source);
break;
=======
case ChuiXue.TYPE:
parser = new ChuiXue(source);
break;
case Manhuatai.TYPE:
parser = new Manhuatai(source);
break;
// case Tencent.TYPE:
// parser = new Tencent(source);
// break;
>>>>>>>
case Tencent.TYPE:
parser = new Tencent(source);
break;
case BuKa.TYPE:
parser = new BuKa(source);
break;
case EHentai.TYPE:
parser = new EHentai(source);
break;
case NetEase.TYPE:
parser = new NetEase(source);
break;
case Hhxxee.TYPE:
parser = new Hhxxee(source);
break;
case Cartoonmad.TYPE:
parser = new Cartoonmad(source);
break;
case Animx2.TYPE:
parser = new Animx2(source);
break;
case MH517.TYPE:
parser = new MH517(source);
break;
case MiGu.TYPE:
parser = new MiGu(source);
break;
case BaiNian.TYPE:
parser = new BaiNian(source);
break;
case ChuiXue.TYPE:
parser = new ChuiXue(source);
break;
case TuHao.TYPE:
parser = new TuHao(source);
break;
case ManHuaDB.TYPE:
parser = new ManHuaDB(source);
break;
case Manhuatai.TYPE:
parser = new Manhuatai(source);
break; |
<<<<<<<
import org.springframework.boot.test.system.OutputCaptureRule;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
=======
import static org.assertj.core.api.Assertions.assertThat;
>>>>>>>
import org.springframework.boot.test.system.OutputCaptureRule;
import static org.assertj.core.api.Assertions.assertThat; |
<<<<<<<
import java.util.List;
=======
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
>>>>>>>
import java.util.List;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
<<<<<<<
// push just the tags listed in the pom rather than all images using imageName
public static void pushImageTag(DockerClient docker, String imageName,
List<String> imageTags, Log log)
throws MojoExecutionException, DockerException, IOException, InterruptedException {
// tags should not be empty if you have specified the option to push tags
if (imageTags.isEmpty()) {
throw new MojoExecutionException("You have used option \"pushImageTag\" but have"
+ " not specified an \"imageTag\" in your"
+ " docker-maven-client's plugin configuration");
}
for (final String imageTag : imageTags) {
final String imageNameWithTag = imageName + ":" + imageTag;
log.info("Pushing " + imageName + ":" + imageTag);
docker.push(imageNameWithTag, new AnsiProgressHandler());
}
}
=======
public static void writeImageInfoFile(final DockerBuildInformation buildInfo,
final String tagInfoFile) throws IOException {
final Path imageInfoPath = Paths.get(tagInfoFile);
if (imageInfoPath.getParent() != null) {
Files.createDirectories(imageInfoPath.getParent());
}
Files.write(imageInfoPath, buildInfo.toJsonBytes());
}
private static class DigestExtractingProgressHandler implements ProgressHandler {
private final ProgressHandler delegate;
private String digest;
DigestExtractingProgressHandler(final ProgressHandler delegate) {
this.delegate = delegate;
}
@Override
public void progress(final ProgressMessage message) throws DockerException {
if (message.digest() != null) {
digest = message.digest();
}
delegate.progress(message);
}
public String digest() {
return digest;
}
}
>>>>>>>
// push just the tags listed in the pom rather than all images using imageName
public static void pushImageTag(DockerClient docker, String imageName,
List<String> imageTags, Log log)
throws MojoExecutionException, DockerException, IOException, InterruptedException {
// tags should not be empty if you have specified the option to push tags
if (imageTags.isEmpty()) {
throw new MojoExecutionException("You have used option \"pushImageTag\" but have"
+ " not specified an \"imageTag\" in your"
+ " docker-maven-client's plugin configuration");
}
for (final String imageTag : imageTags) {
final String imageNameWithTag = imageName + ":" + imageTag;
log.info("Pushing " + imageName + ":" + imageTag);
docker.push(imageNameWithTag, new AnsiProgressHandler());
}
}
public static void writeImageInfoFile(final DockerBuildInformation buildInfo,
final String tagInfoFile) throws IOException {
final Path imageInfoPath = Paths.get(tagInfoFile);
if (imageInfoPath.getParent() != null) {
Files.createDirectories(imageInfoPath.getParent());
}
Files.write(imageInfoPath, buildInfo.toJsonBytes());
}
private static class DigestExtractingProgressHandler implements ProgressHandler {
private final ProgressHandler delegate;
private String digest;
DigestExtractingProgressHandler(final ProgressHandler delegate) {
this.delegate = delegate;
}
@Override
public void progress(final ProgressMessage message) throws DockerException {
if (message.digest() != null) {
digest = message.digest();
}
delegate.progress(message);
}
public String digest() {
return digest;
}
} |
<<<<<<<
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
=======
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
>>>>>>>
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
<<<<<<<
HiveDbUtil.ConnectionInfo connectionInfo = new HiveDbUtil.ConnectionInfo();
=======
if (null != formatState && null != formatState.getState()) {
HiveFormatState hiveFormatState = (HiveFormatState)formatState.getState();
formatStateMap.putAll(hiveFormatState.getFormatStateMap());
}
DBUtil.ConnectionInfo connectionInfo = new DBUtil.ConnectionInfo();
>>>>>>>
if (null != formatState && null != formatState.getState()) {
HiveFormatState hiveFormatState = (HiveFormatState)formatState.getState();
formatStateMap.putAll(hiveFormatState.getFormatStateMap());
}
HiveDbUtil.ConnectionInfo connectionInfo = new HiveDbUtil.ConnectionInfo();
<<<<<<<
private BaseHdfsOutputFormat createHdfsOutputFormat(TableInfo tableInfo, String path) {
=======
private HdfsOutputFormat createHdfsOutputFormat(TableInfo tableInfo, String path, String hiveTablePath) {
>>>>>>>
private BaseHdfsOutputFormat createHdfsOutputFormat(TableInfo tableInfo, String path, String hiveTablePath) {
<<<<<<<
BaseHdfsOutputFormat outputFormat = (BaseHdfsOutputFormat) hdfsOutputFormatBuilder.finish();
=======
HdfsOutputFormat outputFormat = (HdfsOutputFormat) hdfsOutputFormatBuilder.finish();
outputFormat.setFormatId(hiveTablePath);
>>>>>>>
HdfsOutputFormat outputFormat = (HdfsOutputFormat) hdfsOutputFormatBuilder.finish();
outputFormat.setFormatId(hiveTablePath); |
<<<<<<<
public List<Route> getWhere() {
return where;
}
=======
public List<String> getWhere() { return where; }
/**
* Filters given messages based on filters defined in
* this object.
* @param message the message to be filtered.
* @return true if there is no filter found or if the filter returns true when applied to the message.
* @throws Exception thrown if filtering ran into an unexpected failure
*/
>>>>>>>
public List<Route> getWhere() {
return where;
}
/**
* Filters given messages based on filters defined in
* this object.
* @param message the message to be filtered.
* @return true if there is no filter found or if the filter returns true when applied to the message.
* @throws Exception thrown if filtering ran into an unexpected failure
*/ |
<<<<<<<
if(inputMetric != null){
inputMetric.waitForMetricReport();
}
=======
>>>>>>>
<<<<<<<
isClosed.set(true);
=======
if(inputMetric != null){
inputMetric.waitForReportMetrics();
}
>>>>>>>
if(inputMetric != null){
inputMetric.waitForMetricReport();
}
isClosed.set(true); |
<<<<<<<
=======
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.security.PrivilegedAction;
import java.util.Map;
>>>>>>>
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.security.PrivilegedAction;
import java.util.Map;
<<<<<<<
try {
FileSystemUtil.getFileSystem(hadoopConfig, defaultFs);
} catch (Exception e) {
throw new IOException(e);
=======
if (FileSystemUtil.isOpenKerberos(hadoopConfig)) {
UserGroupInformation ugi = FileSystemUtil.getUGI(hadoopConfig, defaultFS);
LOG.info("user:{}, ", ugi.getShortUserName());
return ugi.doAs(new PrivilegedAction<InputSplit[]>() {
@Override
public InputSplit[] run() {
try {
return createTextSplit(minNumSplits);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
} else {
return createTextSplit(minNumSplits);
>>>>>>>
if (FileSystemUtil.isOpenKerberos(hadoopConfig)) {
UserGroupInformation ugi = FileSystemUtil.getUGI(hadoopConfig, defaultFs);
LOG.info("user:{}, ", ugi.getShortUserName());
return ugi.doAs(new PrivilegedAction<InputSplit[]>() {
@Override
public InputSplit[] run() {
try {
return createTextSplit(minNumSplits);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
} else {
return createTextSplit(minNumSplits);
<<<<<<<
JobConf jobConf = FileSystemUtil.getJobConf(hadoopConfig, defaultFs);
org.apache.hadoop.mapred.FileInputFormat.setInputPathFilter(buildConfig(), HdfsPathFilter.class);
=======
private InputSplit[] createTextSplit(int minNumSplits) throws IOException{
JobConf jobConf = buildConfig();
org.apache.hadoop.mapred.FileInputFormat.setInputPathFilter(jobConf, HdfsPathFilter.class);
>>>>>>>
private InputSplit[] createTextSplit(int minNumSplits) throws IOException{
JobConf jobConf = buildConfig();
org.apache.hadoop.mapred.FileInputFormat.setInputPathFilter(jobConf, HdfsPathFilter.class);
<<<<<<<
HdfsTextInputSplit hdfsTextInputSplit = (HdfsTextInputSplit) inputSplit;
org.apache.hadoop.mapred.InputSplit fileSplit = hdfsTextInputSplit.getTextSplit();
findCurrentPartition(((FileSplit) fileSplit).getPath());
recordReader = inputFormat.getRecordReader(fileSplit, conf, Reporter.NULL);
key = new LongWritable();
value = new Text();
=======
ugi.doAs(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
HdfsTextInputSplit hdfsTextInputSplit = (HdfsTextInputSplit) inputSplit;
org.apache.hadoop.mapred.InputSplit fileSplit = hdfsTextInputSplit.getTextSplit();
recordReader = inputFormat.getRecordReader(fileSplit, conf, Reporter.NULL);
key = new LongWritable();
value = new Text();
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
});
>>>>>>>
ugi.doAs(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
HdfsTextInputSplit hdfsTextInputSplit = (HdfsTextInputSplit) inputSplit;
org.apache.hadoop.mapred.InputSplit fileSplit = hdfsTextInputSplit.getTextSplit();
findCurrentPartition(((FileSplit) fileSplit).getPath());
recordReader = inputFormat.getRecordReader(fileSplit, conf, Reporter.NULL);
key = new LongWritable();
value = new Text();
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
}); |
<<<<<<<
String jobPath = "/Users/tudou/Library/Preferences/IntelliJIdea2019.3/scratches/json/emqx/emqx_stream.json";
=======
String jobPath = "D:\\project\\dt-center-flinkx\\flinkx-test\\src\\main\\resources\\dev_test_job\\stream_template.json";
>>>>>>>
String jobPath = "D:\\project\\dt-center-flinkx\\flinkx-test\\src\\main\\resources\\dev_test_job\\stream_template.json";
<<<<<<<
case PluginNameConstrant.EMQX_READER : reader = new EmqxReader(config, env); break;
=======
case PluginNameConstrant.PHOENIX_READER : reader = new PhoenixReader(config, env); break;
case PluginNameConstrant.SQLSERVER_CDC_READER : reader = new SqlservercdcReader(config, env); break;
>>>>>>>
case PluginNameConstrant.PHOENIX_READER : reader = new PhoenixReader(config, env); break;
case PluginNameConstrant.SQLSERVER_CDC_READER : reader = new SqlservercdcReader(config, env); break;
case PluginNameConstrant.EMQX_READER : reader = new EmqxReader(config, env); break;
<<<<<<<
case PluginNameConstrant.EMQX_WRITER : writer = new EmqxWriter(config); break;
=======
case PluginNameConstrant.PHOENIX_WRITER : writer = new PhoenixWriter(config); break;
>>>>>>>
case PluginNameConstrant.PHOENIX_WRITER : writer = new PhoenixWriter(config); break;
case PluginNameConstrant.EMQX_WRITER : writer = new EmqxWriter(config); break; |
<<<<<<<
case PluginNameConstrant.PHOENIX_READER : reader = new PhoenixReader(config, env); break;
=======
case PluginNameConstrant.SQLSERVER_CDC_READER : reader = new SqlservercdcReader(config, env); break;
>>>>>>>
case PluginNameConstrant.PHOENIX_READER : reader = new PhoenixReader(config, env); break;
case PluginNameConstrant.SQLSERVER_CDC_READER : reader = new SqlservercdcReader(config, env); break; |
<<<<<<<
import com.dtstack.flinkx.config.*;
import com.dtstack.flinkx.constants.ConfigConstant;
=======
import com.dtstack.flinkx.config.ContentConfig;
import com.dtstack.flinkx.config.DataTransferConfig;
import com.dtstack.flinkx.config.RestartConfig;
import com.dtstack.flinkx.config.TestConfig;
import com.dtstack.flinkx.constants.ConfigConstant;
>>>>>>>
import com.dtstack.flinkx.config.*;
import com.dtstack.flinkx.constants.ConfigConstant;
<<<<<<<
=======
import org.apache.flink.streaming.api.transformations.PartitionTransformation;
import com.dtstack.flinkx.streaming.runtime.partitioner.CustomPartitioner;
>>>>>>>
import org.apache.flink.streaming.api.transformations.PartitionTransformation;
<<<<<<<
Configuration flinkConf = new Configuration();
if (StringUtils.isNotEmpty(options.getFlinkconf())) {
flinkConf = GlobalConfiguration.loadConfiguration(options.getFlinkconf());
}
=======
if (StringUtils.isNotEmpty(remotePluginPath)) {
config.setRemotePluginPath(remotePluginPath);
}
>>>>>>>
Configuration flinkConf = new Configuration();
if (StringUtils.isNotEmpty(options.getFlinkconf())) {
flinkConf = GlobalConfiguration.loadConfiguration(options.getFlinkconf());
}
if (StringUtils.isNotEmpty(remotePluginPath)) {
config.setRemotePluginPath(remotePluginPath);
}
<<<<<<<
SpeedConfig speedConfig = config.getJob().getSetting().getSpeed();
env.setParallelism(speedConfig.getChannel());
env.setRestartStrategy(RestartStrategies.noRestart());
BaseDataReader dataReader = DataReaderFactory.getDataReader(config, env);
=======
env.setParallelism(config.getJob().getSetting().getSpeed().getChannel());
BaseDataReader dataReader = DataReaderFactory.getDataReader(config, env);
>>>>>>>
SpeedConfig speedConfig = config.getJob().getSetting().getSpeed();
env.setParallelism(speedConfig.getChannel());
env.setRestartStrategy(RestartStrategies.noRestart());
BaseDataReader dataReader = DataReaderFactory.getDataReader(config, env); |
<<<<<<<
import com.dtstack.flinkx.enums.ClusterMode;
import com.dtstack.flinkx.launcher.perJob.PerJobSubmitter;
import com.dtstack.flinkx.options.OptionParser;
import com.dtstack.flinkx.options.Options;
=======
import com.dtstack.flinkx.launcher.perJob.PerJobSubmitter;
>>>>>>>
import com.dtstack.flinkx.util.StringUtil;
<<<<<<<
import org.apache.flink.client.program.PackagedProgramUtils;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.GlobalConfiguration;
import org.apache.flink.core.fs.Path;
import org.apache.flink.runtime.jobgraph.JobGraph;
=======
import org.apache.flink.client.program.PackagedProgramUtils;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.GlobalConfiguration;
import org.apache.flink.runtime.jobgraph.JobGraph;
>>>>>>>
<<<<<<<
import java.io.FilenameFilter;
=======
>>>>>>>
import java.io.FileFilter;
import java.io.FilenameFilter;
<<<<<<<
String pluginRoot = launcherOptions.getPluginRoot();
=======
String pluginRoot = launcherOptions.getPlugin();
>>>>>>>
ClusterClient clusterClient = ClusterClientFactory.createClusterClient(launcherOptions);
String monitor = clusterClient.getWebInterfaceURL();
argList.add("-monitor");
argList.add(monitor);
String pluginRoot = launcherOptions.getPlugin(); |
<<<<<<<
=======
@Override
public void configure(Configuration parameters) {
LOG.info("binlog configure...");
if (StringUtils.isNotEmpty(binlogConfig.getCat())) {
LOG.info("{}", categories);
categories = Arrays.asList(binlogConfig.getCat().toUpperCase().split(","));
}
/**
* mysql 数据解析关注的表,Perl正则表达式.
多个正则之间以逗号(,)分隔,转义符需要双斜杠(\\)
常见例子:
1. 所有表:.* or .*\\..*
2. canal schema下所有表: canal\\..*
3. canal下的以canal打头的表:canal\\.canal.*
4. canal schema下的一张表:canal\\.test1
5. 多个规则组合使用:canal\\..*,mysql.test1,mysql.test2 (逗号分隔)
*/
List<String> table = binlogConfig.getTable();
String jdbcUrl = binlogConfig.getJdbcUrl();
if (table != null && table.size() != 0 && jdbcUrl != null) {
int idx = jdbcUrl.lastIndexOf('?');
String database = null;
if (idx != -1) {
database = StringUtils.substring(jdbcUrl, jdbcUrl.lastIndexOf('/') + 1, idx);
} else {
database = StringUtils.substring(jdbcUrl, jdbcUrl.lastIndexOf('/') + 1);
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < table.size(); i++) {
sb.append(database).append(".").append(table.get(i));
if (i != table.size() - 1) {
sb.append(",");
}
}
binlogConfig.setFilter(sb.toString());
}
}
>>>>>>> |
<<<<<<<
import org.apache.commons.lang.StringUtils;
import com.dtstack.flinkx.util.ExceptionUtil;
=======
import com.dtstack.flinkx.util.ExceptionUtil;
>>>>>>>
import org.apache.commons.lang.StringUtils;
import com.dtstack.flinkx.util.ExceptionUtil;
<<<<<<<
DtLogger.config(logConfig, jobId);
=======
DtLogger.config(logConfig, jobId);
}
@Override
public final InputSplit[] createInputSplits(int i) throws IOException {
try {
return createInputSplitsInternal(i);
} catch (Exception e){
LOG.warn(ExceptionUtil.getErrorMessage(e));
return createErrorInputSplit(e);
}
}
private ErrorInputSplit[] createErrorInputSplit(Exception e){
ErrorInputSplit[] inputSplits = new ErrorInputSplit[1];
ErrorInputSplit errorInputSplit = new ErrorInputSplit(ExceptionUtil.getErrorMessage(e));
inputSplits[0] = errorInputSplit;
return inputSplits;
>>>>>>>
DtLogger.config(logConfig, jobId);
}
@Override
public final InputSplit[] createInputSplits(int i) throws IOException {
try {
return createInputSplitsInternal(i);
} catch (Exception e){
LOG.warn(ExceptionUtil.getErrorMessage(e));
return createErrorInputSplit(e);
}
}
private ErrorInputSplit[] createErrorInputSplit(Exception e){
ErrorInputSplit[] inputSplits = new ErrorInputSplit[1];
ErrorInputSplit errorInputSplit = new ErrorInputSplit(ExceptionUtil.getErrorMessage(e));
inputSplits[0] = errorInputSplit;
return inputSplits;
<<<<<<<
if (inputMetric != null) {
inputMetric.waitForMetricReport();
}
=======
>>>>>>>
<<<<<<<
public void setRestoreConfig(RestoreConfig restoreConfig) {
this.restoreConfig = restoreConfig;
}
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
}
=======
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
}
public void setRestoreConfig(RestoreConfig restoreConfig) {
this.restoreConfig = restoreConfig;
}
>>>>>>>
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
} |
<<<<<<<
builder.setLogConfig(logConfig);
=======
builder.setTestConfig(testConfig);
>>>>>>>
builder.setTestConfig(testConfig);
builder.setLogConfig(logConfig); |
<<<<<<<
import com.dtstack.flinkx.util.*;
=======
import com.dtstack.flinkx.util.ClassUtil;
import com.dtstack.flinkx.util.ExceptionUtil;
import com.dtstack.flinkx.util.FileSystemUtil;
import com.dtstack.flinkx.util.StringUtil;
import com.dtstack.flinkx.util.UrlUtil;
>>>>>>>
import com.dtstack.flinkx.util.ClassUtil;
import com.dtstack.flinkx.util.ExceptionUtil;
import com.dtstack.flinkx.util.FileSystemUtil;
import com.dtstack.flinkx.util.StringUtil;
import com.dtstack.flinkx.util.UrlUtil;
<<<<<<<
import org.apache.flink.api.common.accumulators.LongMaximum;
=======
>>>>>>>
<<<<<<<
import java.sql.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
=======
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
>>>>>>>
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
<<<<<<<
/**
* 轮询增量标识字段类型,目前只有timestamp类型和数值类型
*/
protected boolean isTimestamp = false;
=======
/**
* 轮询增量标识字段类型
*/
protected ColumnType type;
>>>>>>>
/**
* 轮询增量标识字段类型
*/
protected ColumnType type;
<<<<<<<
LOG.info("inputSplit = {}", inputSplit);
ClassUtil.forName(driverName, getClass().getClassLoader());
initMetric(inputSplit);
String startLocation = incrementConfig.getStartLocation();
if (incrementConfig.isPolling()) {
if (StringUtils.isNotEmpty(startLocation)) {
endLocationAccumulator.add(Long.parseLong(startLocation));
}
isTimestamp = "timestamp".equalsIgnoreCase(incrementConfig.getColumnType());
} else if ((incrementConfig.isIncrement() && incrementConfig.isUseMaxFunc())) {
getMaxValue(inputSplit);
}
if (!canReadData(inputSplit)) {
LOG.warn("Not read data when the start location are equal to end location");
hasNext = false;
return;
}
querySql = buildQuerySql(inputSplit);
JdbcInputSplit jdbcInputSplit = (JdbcInputSplit) inputSplit;
if (null != jdbcInputSplit.getStartLocation()) {
startLocation = jdbcInputSplit.getStartLocation();
}
executeQuery(startLocation);
=======
executeQuery(((JdbcInputSplit) inputSplit).getStartLocation());
>>>>>>>
executeQuery(((JdbcInputSplit) inputSplit).getStartLocation());
<<<<<<<
boolean splitWithRowCol = numPartitions > 1 && StringUtils.isNotEmpty(splitKey) && splitKey.contains("(");
if (splitWithRowCol) {
columnCount = columnCount - 1;
}
checkSize(columnCount, metaColumns);
descColumnTypeList = DbUtil.analyzeColumnType(resultSet);
} catch (SQLException se) {
throw new IllegalArgumentException("open() failed." + se.getMessage(), se);
=======
boolean splitWithRowCol = numPartitions > 1 && StringUtils.isNotEmpty(splitKey) && splitKey.contains("(");
if (splitWithRowCol) {
columnCount = columnCount - 1;
}
if (StringUtils.isEmpty(customSql)) {
//获取表对应的所有字段类型抽取一个方法,而不是直接调用DbUtil#analyzeTable 以便子类更好扩展
descColumnTypeList = analyzeTable(dbUrl, username, password, databaseInterface, table, metaColumns);
} else {
descColumnTypeList = new ArrayList<>();
for (MetaColumn metaColumn : metaColumns) {
descColumnTypeList.add(metaColumn.getName());
}
>>>>>>>
boolean splitWithRowCol = numPartitions > 1 && StringUtils.isNotEmpty(splitKey) && splitKey.contains("(");
if (splitWithRowCol) {
columnCount = columnCount - 1;
}
checkSize(columnCount, metaColumns);
if (StringUtils.isEmpty(customSql)) {
//获取表对应的所有字段类型抽取一个方法,而不是直接调用DbUtil#analyzeTable 以便子类更好扩展
descColumnTypeList = analyzeTable(dbUrl, username, password, databaseInterface, table, metaColumns);
} else {
descColumnTypeList = new ArrayList<>();
for (MetaColumn metaColumn : metaColumns) {
descColumnTypeList.add(metaColumn.getName());
}
<<<<<<<
DbUtil.closeDbResources(resultSet, null, null, false);
=======
DbUtil.closeDbResources(resultSet, null, null, false);
//此处endLocation理应不会为空
>>>>>>>
DbUtil.closeDbResources(resultSet, null, null, false);
//此处endLocation理应不会为空
<<<<<<<
LOG.error("error to execute sql = {}, startLocation = {}, e = {}", querySql, endLocationAccumulator.getLocalValue(), ExceptionUtil.getErrorMessage(e));
DbUtil.closeDbResources(resultSet, ps, null, false);
throw new RuntimeException(e);
=======
DbUtil.closeDbResources(resultSet, ps, null, false);
String message = String.format("error to execute sql = %s, startLocation = %s, e = %s", querySql, endLocationAccumulator.getLocalValue(), ExceptionUtil.getErrorMessage(e));
LOG.error(message);
throw new RuntimeException(message, e);
>>>>>>>
DbUtil.closeDbResources(resultSet, ps, null, false);
String message = String.format("error to execute sql = %s, startLocation = %s, e = %s", querySql, endLocationAccumulator.getLocalValue(), ExceptionUtil.getErrorMessage(e));
LOG.error(message);
throw new RuntimeException(message, e);
<<<<<<<
boolean isUpdateLocation = incrementConfig.isPolling() || (incrementConfig.isIncrement() && !incrementConfig.isUseMaxFunc());
if (isUpdateLocation) {
Object incrementVal = resultSet.getObject(incrementConfig.getColumnName());
if(incrementVal != null) {
if((incrementVal instanceof java.util.Date
|| incrementVal.getClass().getSimpleName().toUpperCase().contains("TIMESTAMP")) ) {
incrementVal = resultSet.getTimestamp(incrementConfig.getColumnName());
}
}
String location;
if(incrementConfig.isPolling()){
location = String.valueOf(incrementVal);
}else{
location = getLocation(incrementConfig.getColumnType(), incrementVal);
}
if(StringUtils.isNotEmpty(location)) {
endLocationAccumulator.add(Long.parseLong(location));
=======
boolean isUpdateLocation = incrementConfig.isPolling() || (incrementConfig.isIncrement() && !incrementConfig.isUseMaxFunc());
if (isUpdateLocation) {
String location = null;
Object obj = resultSet.getObject(incrementConfig.getColumnName());
if(obj != null) {
if((obj instanceof java.util.Date
|| obj.getClass().getSimpleName().toUpperCase().contains(ColumnType.TIMESTAMP.name())) ) {
obj = resultSet.getTimestamp(incrementConfig.getColumnName()).getTime();
}
location = String.valueOf(obj);
endLocationAccumulator.add(new BigInteger(location));
>>>>>>>
boolean isUpdateLocation = incrementConfig.isPolling() || (incrementConfig.isIncrement() && !incrementConfig.isUseMaxFunc());
if (isUpdateLocation) {
String location = null;
Object obj = resultSet.getObject(incrementConfig.getColumnName());
if(obj != null) {
if((obj instanceof java.util.Date
|| obj.getClass().getSimpleName().toUpperCase().contains(ColumnType.TIMESTAMP.name())) ) {
obj = resultSet.getTimestamp(incrementConfig.getColumnName()).getTime();
}
location = String.valueOf(obj);
endLocationAccumulator.add(new BigInteger(location));
<<<<<<<
* 从数据库中查询增量字段的最大值
*
* @return
*/
private String getMaxValueFromDb() {
String maxValue = null;
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
long startTime = System.currentTimeMillis();
String queryMaxValueSql;
if (StringUtils.isNotEmpty(customSql)) {
queryMaxValueSql = String.format("select max(%s.%s) as max_value from ( %s ) %s", DbUtil.TEMPORARY_TABLE_NAME,
databaseInterface.quoteColumn(incrementConfig.getColumnName()), customSql, DbUtil.TEMPORARY_TABLE_NAME);
} else {
queryMaxValueSql = String.format("select max(%s) as max_value from %s",
databaseInterface.quoteColumn(incrementConfig.getColumnName()), databaseInterface.quoteTable(table));
}
String startSql = buildStartLocationSql(incrementConfig.getColumnType(),
databaseInterface.quoteColumn(incrementConfig.getColumnName()),
incrementConfig.getStartLocation(),
incrementConfig.isUseMaxFunc());
if (StringUtils.isNotEmpty(startSql)) {
queryMaxValueSql += " where " + startSql;
}
LOG.info(String.format("Query max value sql is '%s'", queryMaxValueSql));
conn = DbUtil.getConnection(dbUrl, username, password);
st = conn.createStatement();
rs = st.executeQuery(queryMaxValueSql);
if (rs.next()) {
maxValue = getLocation(incrementConfig.getColumnType(), rs.getObject("max_value"));
}
LOG.info(String.format("Takes [%s] milliseconds to get the maximum value [%s]", System.currentTimeMillis() - startTime, maxValue));
return maxValue;
} catch (Throwable e) {
throw new RuntimeException("Get max value from " + table + " error", e);
} finally {
DbUtil.closeDbResources(rs, st, conn, false);
}
}
/**
=======
>>>>>>>
<<<<<<<
if (ColumnType.isTimeType(columnType)) {
if (columnVal instanceof Long) {
location = columnVal.toString();
} else if (columnVal instanceof Timestamp) {
long time = ((Timestamp) columnVal).getTime() / 1000;
String nanosStr = String.valueOf(((Timestamp) columnVal).getNanos());
if (nanosStr.length() == DbUtil.NANOS_PART_LENGTH) {
location = time + nanosStr;
} else {
String fillZeroStr = StringUtils.repeat("0", DbUtil.NANOS_PART_LENGTH - nanosStr.length());
location = time + fillZeroStr + nanosStr;
}
} else {
Date date = DateUtil.stringToDate(columnVal.toString(), null);
String fillZeroStr = StringUtils.repeat("0", 6);
long time = date.getTime();
location = time + fillZeroStr;
}
} else if (ColumnType.isNumberType(columnType)) {
location = String.valueOf(columnVal);
} else {
location = String.valueOf(columnVal);
}
return location;
=======
return columnVal.toString();
>>>>>>>
return columnVal.toString();
<<<<<<<
if(dbConn==null){
dbConn = DbUtil.getConnection(dbUrl, username, password);
}
=======
dbConn = DbUtil.getConnection(dbUrl, username, password);
>>>>>>>
dbConn = DbUtil.getConnection(dbUrl, username, password);
<<<<<<<
/**
* 校验columnCount和metaColumns的长度是否相等
* @param columnCount
* @param metaColumns
*/
protected void checkSize(int columnCount, List<MetaColumn> metaColumns) {
if (!ConstantValue.STAR_SYMBOL.equals(metaColumns.get(0).getName()) && columnCount != metaColumns.size()) {
LOG.error("error config: column size for reader is {},but columns size for query result is {}." +
" And the query sql is '{}'.",
metaColumns.size(), columnCount, querySql);
throw new RuntimeException("");
}
}
=======
/**
* 使用自定义的指标输出器把增量指标打到普罗米修斯
*/
@Override
protected boolean useCustomPrometheusReporter() {
return incrementConfig.isIncrement();
}
/**
* 为了保证增量数据的准确性,指标输出失败时使任务失败
*/
@Override
protected boolean makeTaskFailedWhenReportFailed() {
return true;
}
protected List<String> analyzeTable(String dbUrl, String username, String password, DatabaseInterface databaseInterface,
String table, List<MetaColumn> metaColumns) {
return DbUtil.analyzeTable(dbUrl, username, password, databaseInterface, table, metaColumns);
}
>>>>>>>
/**
* 使用自定义的指标输出器把增量指标打到普罗米修斯
*/
@Override
protected boolean useCustomPrometheusReporter() {
return incrementConfig.isIncrement();
}
/**
* 校验columnCount和metaColumns的长度是否相等
* @param columnCount
* @param metaColumns
*/
protected void checkSize(int columnCount, List<MetaColumn> metaColumns) {
if (!ConstantValue.STAR_SYMBOL.equals(metaColumns.get(0).getName()) && columnCount != metaColumns.size()) {
LOG.error("error config: column size for reader is {},but columns size for query result is {}." +
" And the query sql is '{}'.",
metaColumns.size(), columnCount, querySql);
throw new RuntimeException("");
}
}
protected List<String> analyzeTable(String dbUrl, String username, String password, DatabaseInterface databaseInterface,
String table, List<MetaColumn> metaColumns) {
return DbUtil.analyzeTable(dbUrl, username, password, databaseInterface, table, metaColumns);
} |
<<<<<<<
@OptionRequired(description = "applicationId on yarn cluster")
private String appId;
@OptionRequired(description = "Sync remote plugin root path")
private String remotePluginPath;
private Configuration flinkConfiguration = null;
public Configuration loadFlinkConfiguration() {
if(flinkConfiguration == null){
flinkConfiguration = StringUtils.isEmpty(flinkconf) ? new Configuration() : GlobalConfiguration.loadConfiguration(flinkconf);
if (StringUtils.isNotBlank(queue)) {
flinkConfiguration.setString(YarnConfigOptions.APPLICATION_QUEUE, queue);
}
if (StringUtils.isNotBlank(jobid)) {
flinkConfiguration.setString(YarnConfigOptions.APPLICATION_NAME, jobid);
}
if(StringUtils.isNotBlank(yarnconf)){
flinkConfiguration.setString(ConfigConstants.PATH_HADOOP_CONFIG, yarnconf);
}
if(CLASS_PATH_PLUGIN_LOAD_MODE.equalsIgnoreCase(pluginLoadMode)){
flinkConfiguration.setString(CoreOptions.CLASSLOADER_RESOLVE_ORDER, "child-first");
}else{
flinkConfiguration.setString(CoreOptions.CLASSLOADER_RESOLVE_ORDER, "parent-first");
}
flinkConfiguration.setString(ConfigConstant.FLINK_PLUGIN_LOAD_MODE_KEY, pluginLoadMode);
}
return flinkConfiguration;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
=======
@OptionRequired(description = "kerberos krb5conf")
private String krb5conf ;
@OptionRequired(description = "kerberos keytabPath")
private String keytab ;
@OptionRequired(description = "kerberos principal")
private String principal ;
>>>>>>>
@OptionRequired(description = "kerberos krb5conf")
private String krb5conf ;
@OptionRequired(description = "kerberos keytabPath")
private String keytab ;
@OptionRequired(description = "kerberos principal")
private String principal ;
@OptionRequired(description = "applicationId on yarn cluster")
private String appId;
@OptionRequired(description = "Sync remote plugin root path")
private String remotePluginPath;
private Configuration flinkConfiguration = null;
public Configuration loadFlinkConfiguration() {
if(flinkConfiguration == null){
flinkConfiguration = StringUtils.isEmpty(flinkconf) ? new Configuration() : GlobalConfiguration.loadConfiguration(flinkconf);
if (StringUtils.isNotBlank(queue)) {
flinkConfiguration.setString(YarnConfigOptions.APPLICATION_QUEUE, queue);
}
if (StringUtils.isNotBlank(jobid)) {
flinkConfiguration.setString(YarnConfigOptions.APPLICATION_NAME, jobid);
}
if(StringUtils.isNotBlank(yarnconf)){
flinkConfiguration.setString(ConfigConstants.PATH_HADOOP_CONFIG, yarnconf);
}
if(CLASS_PATH_PLUGIN_LOAD_MODE.equalsIgnoreCase(pluginLoadMode)){
flinkConfiguration.setString(CoreOptions.CLASSLOADER_RESOLVE_ORDER, "child-first");
}else{
flinkConfiguration.setString(CoreOptions.CLASSLOADER_RESOLVE_ORDER, "parent-first");
}
flinkConfiguration.setString(ConfigConstant.FLINK_PLUGIN_LOAD_MODE_KEY, pluginLoadMode);
}
return flinkConfiguration;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
<<<<<<<
public String getRemotePluginPath() {
return remotePluginPath;
}
public void setRemotePluginPath(String remotePluginPath) {
this.remotePluginPath = remotePluginPath;
}
@Override
public String toString() {
return "Options{" +
"mode='" + mode + '\'' +
", job='" + job + '\'' +
", monitor='" + monitor + '\'' +
", jobid='" + jobid + '\'' +
", flinkconf='" + flinkconf + '\'' +
", pluginRoot='" + pluginRoot + '\'' +
", yarnconf='" + yarnconf + '\'' +
", parallelism='" + parallelism + '\'' +
", priority='" + priority + '\'' +
", queue='" + queue + '\'' +
", flinkLibJar='" + flinkLibJar + '\'' +
", confProp='" + confProp + '\'' +
", s='" + s + '\'' +
", pluginLoadMode='" + pluginLoadMode + '\'' +
", appId='" + appId + '\'' +
", remotePluginPath='" + remotePluginPath + '\'' +
", flinkConfiguration=" + flinkConfiguration +
'}';
}
=======
public String getKrb5conf() {
return krb5conf;
}
public void setKrb5conf(String krb5conf) {
this.krb5conf = krb5conf;
}
public String getKeytab() {
return keytab;
}
public void setKeytab(String keytab) {
this.keytab = keytab;
}
public String getPrincipal() {
return principal;
}
public void setPrincipal(String principal) {
this.principal = principal;
}
@Override
public String toString() {
return "Options{" +
"mode='" + mode + '\'' +
", job='" + job + '\'' +
", monitor='" + monitor + '\'' +
", jobid='" + jobid + '\'' +
", flinkconf='" + flinkconf + '\'' +
", pluginRoot='" + pluginRoot + '\'' +
", yarnconf='" + yarnconf + '\'' +
", parallelism='" + parallelism + '\'' +
", priority='" + priority + '\'' +
", queue='" + queue + '\'' +
", flinkLibJar='" + flinkLibJar + '\'' +
", confProp='" + confProp + '\'' +
", s='" + s + '\'' +
", pluginLoadMode='" + pluginLoadMode + '\'' +
", krb5conf='" + krb5conf + '\'' +
", keytab='" + keytab + '\'' +
", principal='" + principal + '\'' +
'}';
}
>>>>>>>
public String getRemotePluginPath() {
return remotePluginPath;
}
public void setRemotePluginPath(String remotePluginPath) {
this.remotePluginPath = remotePluginPath;
}
public String getKrb5conf() {
return krb5conf;
}
public void setKrb5conf(String krb5conf) {
this.krb5conf = krb5conf;
}
public String getKeytab() {
return keytab;
}
public void setKeytab(String keytab) {
this.keytab = keytab;
}
public String getPrincipal() {
return principal;
}
public void setPrincipal(String principal) {
this.principal = principal;
}
@Override
public String toString() {
return "Options{" +
"mode='" + mode + '\'' +
", job='" + job + '\'' +
", monitor='" + monitor + '\'' +
", jobid='" + jobid + '\'' +
", flinkconf='" + flinkconf + '\'' +
", pluginRoot='" + pluginRoot + '\'' +
", yarnconf='" + yarnconf + '\'' +
", parallelism='" + parallelism + '\'' +
", priority='" + priority + '\'' +
", queue='" + queue + '\'' +
", flinkLibJar='" + flinkLibJar + '\'' +
", confProp='" + confProp + '\'' +
", s='" + s + '\'' +
", pluginLoadMode='" + pluginLoadMode + '\'' +
", appId='" + appId + '\'' +
", remotePluginPath='" + remotePluginPath + '\'' +
", krb5conf='" + krb5conf + '\'' +
", keytab='" + keytab + '\'' +
", principal='" + principal + '\'' +
'}';
} |
<<<<<<<
=======
@Override
public void openInternal(InputSplit inputSplit) throws IOException {
if(isFileEmpty){
return;
}
if (openKerberos) {
ugi.doAs(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
openOrcReader(inputSplit);
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
});
} else {
openOrcReader(inputSplit);
}
}
private void openOrcReader(InputSplit inputSplit) throws IOException{
numReadCounter = getRuntimeContext().getLongCounter("numRead");
HdfsOrcInputSplit hdfsOrcInputSplit = (HdfsOrcInputSplit) inputSplit;
OrcSplit orcSplit = hdfsOrcInputSplit.getOrcSplit();
recordReader = inputFormat.getRecordReader(orcSplit, conf, Reporter.NULL);
key = recordReader.createKey();
value = recordReader.createValue();
fields = inspector.getAllStructFieldRefs();
}
>>>>>>> |
<<<<<<<
format.setLogConfig(logConfig);
=======
format.setTestConfig(testConfig);
>>>>>>>
format.setLogConfig(logConfig);
format.setTestConfig(testConfig); |
<<<<<<<
import com.dtstack.flinkx.oraclelogminer.reader.OraclelogminerReader;
=======
import com.dtstack.flinkx.phoenix.reader.PhoenixReader;
import com.dtstack.flinkx.phoenix.writer.PhoenixWriter;
>>>>>>>
import com.dtstack.flinkx.oraclelogminer.reader.OraclelogminerReader;
import com.dtstack.flinkx.phoenix.reader.PhoenixReader;
import com.dtstack.flinkx.phoenix.writer.PhoenixWriter;
<<<<<<<
case PluginNameConstrant.ORACLE_LOG_MINER_READER : reader = new OraclelogminerReader(config, env); break;
=======
case PluginNameConstrant.CASSANDRA_READER : reader = new CassandraReader(config, env); break;
case PluginNameConstrant.PHOENIX_READER : reader = new PhoenixReader(config, env); break;
>>>>>>>
case PluginNameConstrant.ORACLE_LOG_MINER_READER : reader = new OraclelogminerReader(config, env); break;
case PluginNameConstrant.CASSANDRA_READER : reader = new CassandraReader(config, env); break;
case PluginNameConstrant.PHOENIX_READER : reader = new PhoenixReader(config, env); break;
<<<<<<<
=======
case PluginNameConstrant.CASSANDRA_WRITER : writer = new CassandraWriter(config); break;
case PluginNameConstrant.PHOENIX_WRITER : writer = new PhoenixWriter(config); break;
>>>>>>>
case PluginNameConstrant.CASSANDRA_WRITER : writer = new CassandraWriter(config); break;
case PluginNameConstrant.PHOENIX_WRITER : writer = new PhoenixWriter(config); break; |
<<<<<<<
LOG.info("subTaskIndex[{}]:{}", taskNumber, row);
}
if (restoreConfig.isRestore()) {
formatState.setState(row.getField(restoreConfig.getRestoreColumnIndex()));
=======
LOG.info("print data subTaskIndex[{}]:{}", taskNumber, row);
>>>>>>>
LOG.info("subTaskIndex[{}]:{}", taskNumber, row);
}
if (restoreConfig.isRestore()) {
formatState.setState(row.getField(restoreConfig.getRestoreColumnIndex()));
LOG.info("print data subTaskIndex[{}]:{}", taskNumber, row);
<<<<<<<
}
public String rowToStringWithDelimiter(Row row, String writeDelimiter) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < row.getArity(); i++) {
if (i > 0) {
sb.append(writeDelimiter);
}
sb.append(StringUtils.arrayAwareToString(row.getField(i)));
}
return sb.toString();
=======
>>>>>>> |
<<<<<<<
=======
LOG.error("error to analyzeSchema, resultSet = {}, e = {}", resultSet, ExceptionUtil.getErrorMessage(e));
>>>>>>>
LOG.error("error to analyzeSchema, resultSet = {}, e = {}", resultSet, ExceptionUtil.getErrorMessage(e));
<<<<<<<
return ret;
=======
return columnTypeList;
}
/**
* 占位符设值
*
* @param param 参数
* @param statement PreparedStatement
* @param i 占位符位置
* @throws SQLException
*/
public static void setParameterValue(Object param, PreparedStatement statement, int i) throws SQLException {
if (param instanceof String) {
statement.setString(i + 1, (String) param);
} else if (param instanceof Long) {
statement.setLong(i + 1, (Long) param);
} else if (param instanceof Integer) {
statement.setInt(i + 1, (Integer) param);
} else if (param instanceof Double) {
statement.setDouble(i + 1, (Double) param);
} else if (param instanceof Boolean) {
statement.setBoolean(i + 1, (Boolean) param);
} else if (param instanceof Float) {
statement.setFloat(i + 1, (Float) param);
} else if (param instanceof BigDecimal) {
statement.setBigDecimal(i + 1, (BigDecimal) param);
} else if (param instanceof Byte) {
statement.setByte(i + 1, (Byte) param);
} else if (param instanceof Short) {
statement.setShort(i + 1, (Short) param);
} else if (param instanceof Date) {
statement.setDate(i + 1, (Date) param);
} else if (param instanceof Time) {
statement.setTime(i + 1, (Time) param);
} else if (param instanceof Timestamp) {
statement.setTimestamp(i + 1, (Timestamp) param);
} else if (param instanceof Array) {
statement.setArray(i + 1, (Array) param);
} else {
//extends with other types if needed
throw new IllegalArgumentException("open() failed. Parameter " + i + " of type " + param.getClass() + " is not handled (yet).");
}
>>>>>>>
return columnTypeList; |
<<<<<<<
=======
@OptionRequired(description = "json modify")
private String p = "";
>>>>>>>
@OptionRequired(description = "json modify")
private String p = "";
<<<<<<<
@Override
public String toString() {
return "Options{" +
"mode='" + mode + '\'' +
", job='" + job + '\'' +
", monitor='" + monitor + '\'' +
", jobid='" + jobid + '\'' +
", flinkconf='" + flinkconf + '\'' +
", pluginRoot='" + pluginRoot + '\'' +
", yarnconf='" + yarnconf + '\'' +
", parallelism='" + parallelism + '\'' +
", priority='" + priority + '\'' +
", queue='" + queue + '\'' +
", flinkLibJar='" + flinkLibJar + '\'' +
", confProp='" + confProp + '\'' +
", s='" + s + '\'' +
", pluginLoadMode='" + pluginLoadMode + '\'' +
", appId='" + appId + '\'' +
'}';
}
=======
public String getP() {
return p;
}
public void setP(String p) {
this.p = p;
}
>>>>>>>
public String getP() {
return p;
}
public void setP(String p) {
this.p = p;
}
@Override
public String toString() {
return "Options{" +
"mode='" + mode + '\'' +
", job='" + job + '\'' +
", monitor='" + monitor + '\'' +
", jobid='" + jobid + '\'' +
", flinkconf='" + flinkconf + '\'' +
", pluginRoot='" + pluginRoot + '\'' +
", yarnconf='" + yarnconf + '\'' +
", parallelism='" + parallelism + '\'' +
", priority='" + priority + '\'' +
", queue='" + queue + '\'' +
", flinkLibJar='" + flinkLibJar + '\'' +
", confProp='" + confProp + '\'' +
", p='" + p + '\'' +
", s='" + s + '\'' +
", pluginLoadMode='" + pluginLoadMode + '\'' +
", appId='" + appId + '\'' +
", flinkConfiguration=" + flinkConfiguration +
'}';
} |
<<<<<<<
DbUtil.closeDbResources(resultSet, null, null, false);
queryForPolling(endLocationAccumulator.getLocalValue());
=======
DBUtil.closeDBResources(resultSet, null, null, false);
queryForPolling(endLocationAccumulator.getLocalValue().toString());
>>>>>>>
DbUtil.closeDbResources(resultSet, null, null, false);
queryForPolling(endLocationAccumulator.getLocalValue().toString()); |
<<<<<<<
=======
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
>>>>>>>
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
<<<<<<<
private Map<String, Object> config;
private BufferedWriter bw;
=======
private Configuration config;
>>>>>>>
private Map<String, Object> config;
<<<<<<<
private String jobId;
private long lastFlushTime;
private long flushInterval = 60000;
=======
private FSDataOutputStream stream;
private EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags = EnumSet.of(HdfsDataOutputStream.SyncFlag.UPDATE_LENGTH);
>>>>>>>
private String jobId;
private FSDataOutputStream stream;
private EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags = EnumSet.of(HdfsDataOutputStream.SyncFlag.UPDATE_LENGTH);
<<<<<<<
bw = new BufferedWriter(new OutputStreamWriter(fs.create(path, true)));
} catch (Exception e) {
throw new RuntimeException("Open dirty manager error", e);
=======
stream = fs.create(path, true);
} catch (Exception e) {
throw new RuntimeException("Open dirty manager error", e);
>>>>>>>
stream = fs.create(path, true);
} catch (Exception e) {
throw new RuntimeException("Open dirty manager error", e); |
<<<<<<<
String jobPath = "D:\\dtstack\\flinkx-all\\flinkx-test\\src\\main\\resources\\dev_test_job\\metadatamysql_restapi.json";
=======
String jobPath = "D:\\dtstack\\flinkx-all\\flinkx-test\\src\\main\\resources\\dev_test_job\\hive2metareader.json";
>>>>>>>
String jobPath = "D:\\dtstack\\flinkx-all\\flinkx-test\\src\\main\\resources\\dev_test_job\\hive2metareader.json";
<<<<<<<
case PluginNameConstrant.METADATATIDB_READER : reader = new MetadataTidbReader(config, env); break;
case PluginNameConstrant.METADATAMYSQL_READER : reader = new MetadataMysqlReader(config, env); break;
=======
case PluginNameConstrant.METADATATIDB_READER : reader = new MetadatatidbReader(config, env); break;
case PluginNameConstrant.GREENPLUM_READER : reader = new GreenplumReader(config, env); break;
>>>>>>>
case PluginNameConstrant.METADATAMYSQL_READER : reader = new MetadataMysqlReader(config, env); break;
case PluginNameConstrant.METADATATIDB_READER : reader = new MetadatatidbReader(config, env); break;
case PluginNameConstrant.GREENPLUM_READER : reader = new GreenplumReader(config, env); break; |
<<<<<<<
import com.google.common.collect.Maps;
import org.apache.hadoop.security.UserGroupInformation;
=======
>>>>>>>
import com.google.common.collect.Maps;
import org.apache.hadoop.security.UserGroupInformation; |
<<<<<<<
import hu.akarnokd.rxjava.interop.RxJavaInterop;
import io.reactivex.Observable;
=======
import retrofit2.Retrofit;
>>>>>>>
import retrofit2.Retrofit;
import hu.akarnokd.rxjava.interop.RxJavaInterop;
import io.reactivex.Observable;
<<<<<<<
public Observable<SponsorsResult> getSponsors(int type) {
=======
@Override
protected void run(Context context) throws Throwable
{
Retrofit restAdapter = DataHelper.makeRetrofit2Client(URL_AMAZON_S3);
>>>>>>>
public Observable<SponsorsResult> getSponsors(int type) {
<<<<<<<
return RxJavaInterop.toV2Observable(request.getSponsors(fileName));
=======
response = restAdapter.create(SponsorsRequest.class).getSponsors(fileName).execute().body();
>>>>>>>
return RxJavaInterop.toV2Observable(request.getSponsors(fileName)); |
<<<<<<<
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.hive.ql.io.orc.OrcFile;
import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
import org.apache.hadoop.hive.ql.io.orc.OrcSplit;
=======
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.ql.io.orc.OrcFile;
import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
import org.apache.hadoop.hive.ql.io.orc.OrcSplit;
>>>>>>>
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.ql.io.orc.OrcFile;
import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
import org.apache.hadoop.hive.ql.io.orc.OrcSplit;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.hive.ql.io.orc.OrcFile;
import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat;
import org.apache.hadoop.hive.ql.io.orc.OrcSerde;
import org.apache.hadoop.hive.ql.io.orc.OrcSplit;
<<<<<<<
import java.io.*;
import java.util.*;
=======
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
>>>>>>>
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean;
import java.io.*;
import java.util.*;
<<<<<<<
@Override
public void openInternal(InputSplit inputSplit) throws IOException {
if(isFileEmpty){
return;
}
numReadCounter = getRuntimeContext().getLongCounter("numRead");
HdfsOrcInputSplit hdfsOrcInputSplit = (HdfsOrcInputSplit) inputSplit;
OrcSplit orcSplit = hdfsOrcInputSplit.getOrcSplit();
findCurrentPartition(orcSplit.getPath());
recordReader = inputFormat.getRecordReader(orcSplit, conf, Reporter.NULL);
key = recordReader.createKey();
value = recordReader.createValue();
fields = inspector.getAllStructFieldRefs();
}
=======
>>>>>>> |
<<<<<<<
=======
public static void main(String[] args) throws Exception {
setLogLevel(Level.INFO.toString());
OptionParser optionParser = new OptionParser(args);
Options launcherOptions = optionParser.getOptions();
findDefaultConfigDir(launcherOptions);
String mode = launcherOptions.getMode();
List<String> argList = optionParser.getProgramExeArgList();
// 将argList转化为HashMap,方便通过参数名称来获取参数值
HashMap<String, String> temp = new HashMap<>(16);
for (int i = 0; i < argList.size(); i += 2) {
temp.put(argList.get(i), argList.get(i + 1));
}
// 对json中的值进行修改
HashMap<String, String> parameter = JsonModifyUtil.CommandTransform(temp.get("-p"));
temp.put("-job", JsonModifyUtil.JsonValueReplace(temp.get("-job"), parameter));
// 清空list,填充修改后的参数值
argList.clear();
for (int i = 0; i < temp.size(); i++) {
argList.add(temp.keySet().toArray()[i].toString());
argList.add(temp.values().toArray()[i].toString());
}
if(mode.equals(ClusterMode.local.name())) {
String[] localArgs = argList.toArray(new String[0]);
com.dtstack.flinkx.Main.main(localArgs);
} else {
String pluginRoot = launcherOptions.getPluginRoot();
String content = launcherOptions.getJob();
String coreJarName = getCoreJarFileName(pluginRoot);
File jarFile = new File(pluginRoot + File.separator + coreJarName);
List<URL> urlList = analyzeUserClasspath(content, pluginRoot);
if(!ClusterMode.yarnPer.name().equals(mode)){
ClusterClient clusterClient = ClusterClientFactory.createClusterClient(launcherOptions);
String monitor = clusterClient.getWebInterfaceURL();
argList.add("-monitor");
argList.add(monitor);
String[] remoteArgs = argList.toArray(new String[0]);
ClassLoaderType classLoaderType = ClassLoaderType.getByClassMode(launcherOptions.getPluginLoadMode());
PackagedProgram program = new PackagedProgram(jarFile, urlList, classLoaderType, "com.dtstack.flinkx.Main", remoteArgs);
if (StringUtils.isNotEmpty(launcherOptions.getS())){
program.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(launcherOptions.getS()));
}
clusterClient.run(program, Integer.parseInt(launcherOptions.getParallelism()));
clusterClient.shutdown();
}else{
String confProp = launcherOptions.getConfProp();
if (StringUtils.isBlank(confProp)){
throw new IllegalArgumentException("per-job mode must have confProp!");
}
String libJar = launcherOptions.getFlinkLibJar();
if (StringUtils.isBlank(libJar)){
throw new IllegalArgumentException("per-job mode must have flink lib path!");
}
argList.add("-monitor");
argList.add("");
//jdk内在优化,使用空数组效率更高
String[] remoteArgs = argList.toArray(new String[0]);
PerJobSubmitter.submit(launcherOptions, jarFile, remoteArgs);
}
}
}
>>>>>>> |
<<<<<<<
builder.setLogConfig(logConfig);
=======
builder.setTestConfig(testConfig);
>>>>>>>
builder.setTestConfig(testConfig);
builder.setLogConfig(logConfig); |
<<<<<<<
@Singleton
public class UpdateAlertsInteractor
{
private final DatabaseHelper helper;
private final AppPrefs prefs;
public Event event;
=======
public class UpdateAlertsInteractor {
private final AppPrefs prefs;
private final RefreshScheduleInteractor refreshInteractor;
public Event event;
>>>>>>>
@Singleton
public class UpdateAlertsInteractor
{
private final RefreshScheduleInteractor refreshInteractor;
private final AppPrefs prefs;
public Event event;
<<<<<<<
@Inject
public UpdateAlertsInteractor(DatabaseHelper helper, AppPrefs prefs)
{
this.helper = helper;
=======
public UpdateAlertsInteractor(AppPrefs prefs, RefreshScheduleInteractor refreshInteractor) {
>>>>>>>
@Inject
public UpdateAlertsInteractor(AppPrefs prefs, RefreshScheduleInteractor refreshInteractor)
{
<<<<<<<
public void alert()
{
if(prefs.getAllowNotifications())
{
ConferenceDataHelper.getDays(helper, false)
=======
public void alert() {
if (prefs.getAllowNotifications()) {
refreshInteractor.refreshFromDatabase();
refreshInteractor.getFullConferenceData(false)
>>>>>>>
public void alert() {
if (prefs.getAllowNotifications()) {
refreshInteractor.refreshFromDatabase();
refreshInteractor.getFullConferenceData(false)
<<<<<<<
Event event = (Event) hour.timeBlock;
if(event.getStartLong() - ALERT_BUFFER > System.currentTimeMillis())
{
=======
Event event = (Event) hour.getTimeBlock();
if (event.getStartLong() - ALERT_BUFFER > System.currentTimeMillis()) {
>>>>>>>
Event event = (Event) hour.getTimeBlock();
if (event.getStartLong() - ALERT_BUFFER > System.currentTimeMillis()) { |
<<<<<<<
=======
import org.apache.hadoop.conf.Configuration;
>>>>>>>
import org.apache.hadoop.conf.Configuration; |
<<<<<<<
import com.dtstack.flinkx.util.*;
=======
import com.dtstack.flinkx.restore.FormatState;
import com.dtstack.flinkx.util.ClassUtil;
import com.dtstack.flinkx.util.DateUtil;
import com.dtstack.flinkx.util.StringUtil;
import com.dtstack.flinkx.util.URLUtil;
>>>>>>>
import com.dtstack.flinkx.util.*;
import com.dtstack.flinkx.restore.FormatState;
import com.dtstack.flinkx.util.ClassUtil;
import com.dtstack.flinkx.util.DateUtil;
import com.dtstack.flinkx.util.StringUtil;
import com.dtstack.flinkx.util.URLUtil; |
<<<<<<<
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
}
public void setRestoreConfig(RestoreConfig restoreConfig) {
this.restoreConfig = restoreConfig;
}
=======
public void setTestConfig(TestConfig testConfig) {
this.testConfig = testConfig;
}
>>>>>>>
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
}
public void setRestoreConfig(RestoreConfig restoreConfig) {
this.restoreConfig = restoreConfig;
}
public void setTestConfig(TestConfig testConfig) {
this.testConfig = testConfig;
} |
<<<<<<<
List column = config.getJob().getContent().get(0).getWriter().getParameter().getColumn();
metaColumns = MetaColumn.getMetaColumns(column);
=======
writeDelimiter = config.getJob().getContent().get(0).getWriter().getParameter().getStringVal("writeDelimiter", "|");
batchInterval = config.getJob().getContent().get(0).getWriter().getParameter().getIntVal("batchInterval", 20);
>>>>>>>
writeDelimiter = config.getJob().getContent().get(0).getWriter().getParameter().getStringVal("writeDelimiter", "|");
batchInterval = config.getJob().getContent().get(0).getWriter().getParameter().getIntVal("batchInterval", 20);
List column = config.getJob().getContent().get(0).getWriter().getParameter().getColumn();
metaColumns = MetaColumn.getMetaColumns(column);
<<<<<<<
builder.setMetaColumn(metaColumns);
builder.setDirtyPath(dirtyPath);
builder.setDirtyHadoopConfig(dirtyHadoopConfig);
builder.setSrcCols(srcCols);
=======
builder.setBatchInterval(batchInterval);
>>>>>>>
builder.setMetaColumn(metaColumns);
builder.setDirtyPath(dirtyPath);
builder.setDirtyHadoopConfig(dirtyHadoopConfig);
builder.setSrcCols(srcCols);
builder.setBatchInterval(batchInterval); |
<<<<<<<
public static final String METADATAORACLE_READER = "metadataoraclereader";
=======
public static final String METADATAMYSQL_READER = "metadatamysqlreader";
public static final String GREENPLUM_READER = "greenplumreader";
>>>>>>>
public static final String METADATAORACLE_READER = "metadataoraclereader";
public static final String METADATAMYSQL_READER = "metadatamysqlreader";
public static final String GREENPLUM_READER = "greenplumreader"; |
<<<<<<<
public static final String KUDU_READER = "kudureader";
=======
public static final String BINLOG_READER = "binlogreader";
public static final String KAFKA09_READER = "kafka09reader";
public static final String KAFKA10_READER = "kafka10reader";
public static final String KAFKA11_READER = "kafka11reader";
>>>>>>>
public static final String KUDU_READER = "kudureader";
public static final String BINLOG_READER = "binlogreader";
public static final String KAFKA09_READER = "kafka09reader";
public static final String KAFKA10_READER = "kafka10reader";
public static final String KAFKA11_READER = "kafka11reader";
<<<<<<<
public static final String KUDU_WRITER = "kuduwriter";
=======
public static final String HIVE_WRITER = "hivewriter";
public static final String KAFKA09_WRITER = "kafka09writer";
public static final String KAFKA10_WRITER = "kafka10writer";
public static final String KAFKA11_WRITER = "kafka11writer";
>>>>>>>
public static final String KUDU_WRITER = "kuduwriter";
public static final String HIVE_WRITER = "hivewriter";
public static final String KAFKA09_WRITER = "kafka09writer";
public static final String KAFKA10_WRITER = "kafka10writer";
public static final String KAFKA11_WRITER = "kafka11writer"; |
<<<<<<<
=======
@Override
public void configure(Configuration parameters) {
Properties props = geneConsumerProp();
consumerConnector = kafka.consumer.Consumer.createJavaConsumerConnector(new ConsumerConfig(props));
executor = Executors.newFixedThreadPool(1);
queue = new SynchronousQueue<Row>(false);
}
private Properties geneConsumerProp() {
Properties props = new Properties();
Iterator<Map.Entry<String, String>> consumerSetting = consumerSettings.entrySet().iterator();
while (consumerSetting.hasNext()) {
Map.Entry<String, String> entry = consumerSetting.next();
String k = entry.getKey();
String v = entry.getValue();
props.put(k, v);
}
return props;
}
@Override
public InputSplit[] createInputSplits(int minNumSplits) throws IOException {
InputSplit[] splits = new InputSplit[minNumSplits];
for (int i = 0; i < minNumSplits; i++) {
splits[i] = new GenericInputSplit(i, minNumSplits);
}
return splits;
}
@Override
public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) {
return new DefaultInputSplitAssigner(inputSplits);
}
@Override
public boolean reachedEnd() throws IOException {
return false;
}
public void processEvent(Map<String, Object> event) {
try {
queue.put(Row.of(event));
} catch (InterruptedException e) {
LOG.error("takeEvent interrupted event:{} error:{}", event, e);
}
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public String getEncoding() {
return encoding;
}
public String getCodec() {
return codec;
}
public void setCodec(String codec) {
this.codec = codec;
}
public void setTopic(String topic) {
this.topic = topic;
}
public void setConsumerSettings(Map<String, String> consumerSettings) {
this.consumerSettings = consumerSettings;
}
>>>>>>> |
<<<<<<<
import co.touchlab.droidconandroid.shared.network.RefreshScheduleDataRequest;
import co.touchlab.droidconandroid.shared.presenter.AppManager;
=======
import co.touchlab.droidconandroid.shared.data.Event;
import co.touchlab.droidconandroid.shared.data.TimeBlock;
>>>>>>>
import co.touchlab.droidconandroid.shared.network.RefreshScheduleDataRequest;
import co.touchlab.droidconandroid.shared.presenter.AppManager;
import co.touchlab.droidconandroid.shared.data.Event;
import co.touchlab.droidconandroid.shared.data.TimeBlock;
<<<<<<<
private final DatabaseHelper databaseHelper;
private final AppPrefs appPrefs;
private final RefreshScheduleDataRequest request;
private BehaviorSubject<DaySchedule[]> conferenceDataSubject = BehaviorSubject.create();
=======
private final JobManager jobManager;
private final DatabaseHelper databaseHelper;
private BehaviorSubject<List<TimeBlock>> conferenceDataSubject = BehaviorSubject.create();
>>>>>>>
private final DatabaseHelper databaseHelper;
private final AppPrefs appPrefs;
private final RefreshScheduleDataRequest request;
private BehaviorSubject<List<TimeBlock>> conferenceDataSubject = BehaviorSubject.create();
<<<<<<<
return conferenceDataSubject;
=======
return conferenceDataSubject
.flatMap(list -> filterAndSortBlocks(list, allEvents))
.map(ConferenceDataHelper:: formatHourBlocks)
.map(ConferenceDataHelper:: convertMapToDaySchedule)
.map(dayScheduleList -> dayScheduleList.toArray(new DaySchedule[dayScheduleList.size()]));
>>>>>>>
return conferenceDataSubject
.flatMap(list -> filterAndSortBlocks(list, allEvents))
.map(ConferenceDataHelper:: formatHourBlocks)
.map(ConferenceDataHelper:: convertMapToDaySchedule)
.map(dayScheduleList -> dayScheduleList.toArray(new DaySchedule[dayScheduleList.size()])); |
<<<<<<<
public static final String KEY_LOG = "log";
=======
public static final String KEY_TEST = "test";
public static final String KEY_RESTART = "restart";
>>>>>>>
public static final String KEY_TEST = "test";
public static final String KEY_RESTART = "restart";
public static final String KEY_LOG = "log";
<<<<<<<
private LogConfig logConfig = LogConfig.defaultConfig();
=======
private TestConfig testConfig = TestConfig.defaultConfig();
private RestartConfig restartConfig = RestartConfig.defaultConfig();
>>>>>>>
private TestConfig testConfig = TestConfig.defaultConfig();
private RestartConfig restartConfig = RestartConfig.defaultConfig();
private LogConfig logConfig = LogConfig.defaultConfig();
<<<<<<<
if (map.containsKey(KEY_LOG)){
logConfig = new LogConfig((Map<String, Object>) map.get(KEY_LOG));
}
=======
if (map.containsKey(KEY_TEST)) {
testConfig = new TestConfig((Map<String, Object>) map.get(KEY_TEST));
}
if (map.containsKey(KEY_RESTART)) {
restartConfig = new RestartConfig((Map<String, Object>) map.get(KEY_RESTART));
}
>>>>>>>
if (map.containsKey(KEY_LOG)){
logConfig = new LogConfig((Map<String, Object>) map.get(KEY_LOG));
}
if (map.containsKey(KEY_TEST)) {
testConfig = new TestConfig((Map<String, Object>) map.get(KEY_TEST));
}
if (map.containsKey(KEY_RESTART)) {
restartConfig = new RestartConfig((Map<String, Object>) map.get(KEY_RESTART));
}
<<<<<<<
public LogConfig getLogConfig() {
return logConfig;
}
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
}
public DirtyConfig getDirty() {
return dirty;
}
public void setDirty(DirtyConfig dirty) {
this.dirty = dirty;
}
=======
public TestConfig getTestConfig() {
return testConfig;
}
public void setTestConfig(TestConfig testConfig) {
this.testConfig = testConfig;
}
public RestartConfig getRestartConfig() {
return restartConfig;
}
public void setRestartConfig(RestartConfig restartConfig) {
this.restartConfig = restartConfig;
}
>>>>>>>
public LogConfig getLogConfig() {
return logConfig;
}
public void setLogConfig(LogConfig logConfig) {
this.logConfig = logConfig;
}
public DirtyConfig getDirty() {
return dirty;
}
public void setDirty(DirtyConfig dirty) {
this.dirty = dirty;
}
public TestConfig getTestConfig() {
return testConfig;
}
public void setTestConfig(TestConfig testConfig) {
this.testConfig = testConfig;
}
public RestartConfig getRestartConfig() {
return restartConfig;
}
public void setRestartConfig(RestartConfig restartConfig) {
this.restartConfig = restartConfig;
} |
<<<<<<<
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
=======
import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
>>>>>>>
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
<<<<<<<
protected FormatState formatState;
=======
private long startTime;
public DirtyDataManager getDirtyDataManager() {
return dirtyDataManager;
}
>>>>>>>
protected FormatState formatState;
<<<<<<<
writeBytesCounter = context.getLongCounter(Metrics.BYTES_WRITES);
=======
bytesWriteCounter = context.getLongCounter(Metrics.WRITE_BYTES);
durationCounter = context.getLongCounter(Metrics.WRITE_DURATION);
>>>>>>>
bytesWriteCounter = context.getLongCounter(Metrics.WRITE_BYTES);
durationCounter = context.getLongCounter(Metrics.WRITE_DURATION);
<<<<<<<
outputMetric.addMetric(Metrics.BYTES_WRITES, writeBytesCounter);
}
=======
outputMetric.addMetric(Metrics.WRITE_BYTES, bytesWriteCounter);
outputMetric.addMetric(Metrics.WRITE_DURATION, durationCounter);
startTime = System.currentTimeMillis();
>>>>>>>
outputMetric.addMetric(Metrics.WRITE_BYTES, bytesWriteCounter);
outputMetric.addMetric(Metrics.WRITE_DURATION, durationCounter);
}
<<<<<<<
=======
if(needWaitBeforeOpenInternal()) {
Latch latch = newLatch("#1");
beforeOpenInternal();
latch.addOne();
latch.waitUntil(numTasks);
}
openInternal(taskNumber, numTasks);
// Do something before starting writing records
if(needWaitBeforeWriteRecords()) {
Latch latch = newLatch("#2");
beforeWriteRecords();
latch.addOne();
latch.waitUntil(numTasks);
}
>>>>>>>
<<<<<<<
writeBytesCounter.add(ObjectSizeCalculator.getObjectSize(row));
}
private Row setChannelInfo(Row row){
Row internalRow = new Row(row.getArity() - 1);
for (int i = 0; i < internalRow.getArity(); i++) {
internalRow.setField(i, row.getField(i));
}
return internalRow;
}
private boolean readyWrite(Row row){
if(restoreConfig.isRestore() && !readyWrite && initState != null){
Object currentState = row.getField(restoreConfig.getRestoreColumnIndex());
if(currentState != null){
readyWrite = currentState.toString().compareTo(initState.toString()) > 0;
}
return readyWrite;
}
return true;
=======
updateDuration();
bytesWriteCounter.add(ObjectSizeCalculator.getObjectSize(row));
>>>>>>>
updateDuration();
writeBytesCounter.add(ObjectSizeCalculator.getObjectSize(row));
}
private Row setChannelInfo(Row row){
Row internalRow = new Row(row.getArity() - 1);
for (int i = 0; i < internalRow.getArity(); i++) {
internalRow.setField(i, row.getField(i));
}
return internalRow;
}
private boolean readyWrite(Row row){
if(restoreConfig.isRestore() && !readyWrite && initState != null){
Object currentState = row.getField(restoreConfig.getRestoreColumnIndex());
if(currentState != null){
readyWrite = currentState.toString().compareTo(initState.toString()) > 0;
}
return readyWrite;
}
return true; |
<<<<<<<
} else if (MapUtils.isNotEmpty(binlogConfig.getStart())) {
=======
checkBinlogFile(startPosition.getJournalName());
} else if (start != null && start.size() != 0) {
>>>>>>>
checkBinlogFile(startPosition.getJournalName());
} else if (MapUtils.isNotEmpty(binlogConfig.getStart())) {
<<<<<<<
String journalName = (String) binlogConfig.getStart().get("journalName");
=======
String journalName = (String) start.get("journalName");
checkBinlogFile(journalName);
>>>>>>>
String journalName = (String) binlogConfig.getStart().get("journalName");
checkBinlogFile(journalName);
<<<<<<<
if (new BinlogJournalValidator(binlogConfig.getHost(), binlogConfig.getPort(), binlogConfig.getUsername(), binlogConfig.getPassword()).check(journalName)) {
startPosition.setJournalName(journalName);
} else {
throw new IllegalArgumentException("Can't find journalName: " + journalName);
}
=======
startPosition.setJournalName(journalName);
>>>>>>>
startPosition.setJournalName(journalName); |
<<<<<<<
import com.dtstack.flinkx.rdb.inputformat.JdbcInputSplit;
import com.dtstack.flinkx.rdb.util.DbUtil;
import com.dtstack.flinkx.util.ClassUtil;
=======
>>>>>>>
import com.dtstack.flinkx.rdb.inputformat.JdbcInputSplit;
import com.dtstack.flinkx.rdb.util.DbUtil;
import com.dtstack.flinkx.util.ClassUtil;
<<<<<<<
try {
LOG.info("inputSplit = {}", inputSplit);
ClassUtil.forName(driverName, getClass().getClassLoader());
initMetric(inputSplit);
String startLocation = incrementConfig.getStartLocation();
if (incrementConfig.isPolling()) {
if (StringUtils.isNotEmpty(startLocation)) {
endLocationAccumulator.add(Long.parseLong(startLocation));
}
isTimestamp = "timestamp".equalsIgnoreCase(incrementConfig.getColumnType());
} else if ((incrementConfig.isIncrement() && incrementConfig.isUseMaxFunc())) {
getMaxValue(inputSplit);
}
if(!canReadData(inputSplit)){
LOG.warn("Not read data when the start location are equal to end location");
hasNext = false;
return;
}
querySql = buildQuerySql(inputSplit);
JdbcInputSplit jdbcInputSplit = (JdbcInputSplit) inputSplit;
if (null != jdbcInputSplit.getStartLocation()) {
startLocation = jdbcInputSplit.getStartLocation();
}
executeQuery(startLocation);
columnCount = resultSet.getMetaData().getColumnCount();
boolean splitWithRowCol = numPartitions > 1 && StringUtils.isNotEmpty(splitKey) && splitKey.contains("(");
if(splitWithRowCol){
columnCount = columnCount-1;
}
checkSize(columnCount, metaColumns);
descColumnTypeList = DbUtil.analyzeColumnType(resultSet);
} catch (SQLException se) {
throw new IllegalArgumentException("open() failed. " + se.getMessage(), se);
=======
// 避免result.next阻塞
if(incrementConfig.isPolling() && StringUtils.isEmpty(incrementConfig.getStartLocation()) && fetchSize==databaseInterface.getFetchSize()){
fetchSize = 1000;
>>>>>>>
// 避免result.next阻塞
if(incrementConfig.isPolling() && StringUtils.isEmpty(incrementConfig.getStartLocation()) && fetchSize==databaseInterface.getFetchSize()){
fetchSize = 1000; |
<<<<<<<
=======
protected int requestAccumulatorInterval;
protected boolean useMaxFunc;
>>>>>>>
<<<<<<<
if (incrementConfig.isIncrement() && !incrementConfig.isColumnUnique()){
=======
if (useMaxFunc){
>>>>>>>
if (incrementConfig.isIncrement() && !incrementConfig.isUseMaxFunc()){
<<<<<<<
if(incrementConfig.isIncrement() && !incrementConfig.isColumnUnique()){
Object incrementVal = resultSet.getObject(incrementConfig.getColumnIndex() + 1);
endLocationAccumulator.add(getLocation(incrementConfig.getColumnType(), incrementVal));
=======
if(increCol != null && !useMaxFunc){
if (ColumnType.isTimeType(increColType)){
Timestamp increVal = resultSet.getTimestamp(increColIndex + 1);
if(increVal != null){
endLocationAccumulator.add(String.valueOf(getLocation(increVal)));
}
} else if(ColumnType.isNumberType(increColType)){
endLocationAccumulator.add(String.valueOf(resultSet.getLong(increColIndex + 1)));
} else {
String increVal = resultSet.getString(increColIndex + 1);
if(increVal != null){
endLocationAccumulator.add(increVal);
}
}
>>>>>>>
if(incrementConfig.isIncrement() && !incrementConfig.isUseMaxFunc()){
Object incrementVal = resultSet.getObject(incrementConfig.getColumnIndex() + 1);
endLocationAccumulator.add(getLocation(incrementConfig.getColumnType(), incrementVal));
<<<<<<<
if (!incrementConfig.isIncrement()){
=======
if (StringUtils.isEmpty(increCol)){
return true;
}
if (!useMaxFunc){
>>>>>>>
if (!incrementConfig.isIncrement()){
<<<<<<<
if (restoreConfig.isRestore()){
if(formatState == null){
querySql = querySql.replace(DBUtil.RESTORE_FILTER_PLACEHOLDER, "");
} else {
String startLocation = getLocation(restoreColumn.getType(), formatState.getState());
String restoreFilter = DBUtil.buildIncrementFilter(databaseInterface, restoreColumn.getType(),
restoreColumn.getName(), startLocation, jdbcInputSplit.getEndLocation(), customSql);
if(StringUtils.isNotEmpty(restoreFilter)){
restoreFilter = " and " + restoreFilter;
}
querySql = querySql.replace(DBUtil.RESTORE_FILTER_PLACEHOLDER, restoreFilter);
}
} else if (incrementConfig.isIncrement()){
String incrementFilter = DBUtil.buildIncrementFilter(databaseInterface, incrementConfig.getColumnType(),
incrementConfig.getColumnName(), jdbcInputSplit.getStartLocation(), jdbcInputSplit.getEndLocation(), customSql);
=======
if (StringUtils.isNotEmpty(increCol)){
String incrementFilter = DBUtil.buildIncrementFilter(databaseInterface, increColType, increCol,
jdbcInputSplit.getStartLocation(), jdbcInputSplit.getEndLocation(), customSql, useMaxFunc);
>>>>>>>
if (restoreConfig.isRestore()){
if(formatState == null){
querySql = querySql.replace(DBUtil.RESTORE_FILTER_PLACEHOLDER, "");
} else {
String startLocation = getLocation(restoreColumn.getType(), formatState.getState());
String restoreFilter = DBUtil.buildIncrementFilter(databaseInterface, restoreColumn.getType(),
restoreColumn.getName(), startLocation, jdbcInputSplit.getEndLocation(), customSql, incrementConfig.isUseMaxFunc());
if(StringUtils.isNotEmpty(restoreFilter)){
restoreFilter = " and " + restoreFilter;
}
querySql = querySql.replace(DBUtil.RESTORE_FILTER_PLACEHOLDER, restoreFilter);
}
} else if (incrementConfig.isIncrement()){
String incrementFilter = DBUtil.buildIncrementFilter(databaseInterface, incrementConfig.getColumnType(),
incrementConfig.getColumnName(), jdbcInputSplit.getStartLocation(),
jdbcInputSplit.getEndLocation(), customSql, incrementConfig.isUseMaxFunc());
<<<<<<<
String startSql = DBUtil.buildStartLocationSql(databaseInterface, incrementConfig.getColumnType(),
databaseInterface.quoteColumn(incrementConfig.getColumnName()), incrementConfig.getStartLocation());
=======
String startSql = DBUtil.buildStartLocationSql(databaseInterface, increColType,
databaseInterface.quoteColumn(increCol), startLocation, useMaxFunc);
>>>>>>>
String startSql = DBUtil.buildStartLocationSql(databaseInterface, incrementConfig.getColumnType(),
databaseInterface.quoteColumn(incrementConfig.getColumnName()), incrementConfig.getStartLocation(), incrementConfig.isUseMaxFunc()); |
<<<<<<<
case PluginNameConstrant.KUDU_READER : reader = new KuduReader(config, env); break;
case PluginNameConstrant.CLICKHOUSE_READER : reader = new ClickhouseReader(config, env); break;
case PluginNameConstrant.POLARDB_READER : reader = new PolardbReader(config, env); break;
=======
case PluginNameConstrant.KAFKA_READER : reader = new KafkaReader(config, env); break;
>>>>>>>
case PluginNameConstrant.KAFKA_READER : reader = new KafkaReader(config, env); break;
case PluginNameConstrant.KUDU_READER : reader = new KuduReader(config, env); break;
case PluginNameConstrant.CLICKHOUSE_READER : reader = new ClickhouseReader(config, env); break;
case PluginNameConstrant.POLARDB_READER : reader = new PolardbReader(config, env); break;
<<<<<<<
case PluginNameConstrant.KUDU_WRITER : writer = new KuduWriter(config); break;
case PluginNameConstrant.CLICKHOUSE_WRITER : writer = new ClickhouseWriter(config); break;
case PluginNameConstrant.POLARDB_WRITER : writer = new PolardbWriter(config); break;
=======
case PluginNameConstrant.KAFKA_WRITER : writer = new KafkaWriter(config); break;
>>>>>>>
case PluginNameConstrant.KUDU_WRITER : writer = new KuduWriter(config); break;
case PluginNameConstrant.CLICKHOUSE_WRITER : writer = new ClickhouseWriter(config); break;
case PluginNameConstrant.POLARDB_WRITER : writer = new PolardbWriter(config); break;
case PluginNameConstrant.KAFKA_WRITER : writer = new KafkaWriter(config); break; |
<<<<<<<
=======
builder.setBatchInterval(batchSize);
>>>>>>>
builder.setBatchInterval(batchSize); |
<<<<<<<
if ("true".equalsIgnoreCase(System.getProperty("org.pepsoft.worldpainter.westerosCraftMode"))) {
// Leave checkbox and label visible
} else if ("true".equalsIgnoreCase(System.getProperty("org.pepsoft.worldpainter.smoothGroundCover"))) {
labelWesterosCraftFeature.setVisible(false);
} else {
=======
this.platform = platform;
mixedMaterialSelector1.setPlatform(platform);
if (! "true".equalsIgnoreCase(System.getProperty("org.pepsoft.worldpainter.westerosCraftMode"))) {
>>>>>>>
this.platform = platform;
mixedMaterialSelector1.setPlatform(platform);
if ("true".equalsIgnoreCase(System.getProperty("org.pepsoft.worldpainter.westerosCraftMode"))) {
// Leave checkbox and label visible
} else if ("true".equalsIgnoreCase(System.getProperty("org.pepsoft.worldpainter.smoothGroundCover"))) {
labelWesterosCraftFeature.setVisible(false);
} else { |
<<<<<<<
boolean isConstant();
float getConstantValue();
=======
Icon getIcon();
>>>>>>>
boolean isConstant();
float getConstantValue();
Icon getIcon(); |
<<<<<<<
private Boolean mBound = false;
private Messenger mService;
private String mShouldBoundUrl = "", mPackageName = "pct.droid";
private static OkHttpClient sHttpClient;
private static Picasso sPicasso;
private static String sDefSystemLanguage;
private static PopcornApplication sInstance;
public PopcornApplication() {
sInstance = this;
}
public static PopcornApplication getInstance() {
return sInstance;
}
@Override
public void onCreate() {
super.onCreate();
sDefSystemLanguage = LocaleUtils.getCurrent();
Bugsnag.register(this, Constants.BUGSNAG_KEY);
PopcornUpdater.getInstance(this).checkUpdates(false);
Constants.DEBUG_ENABLED = false;
int versionCode = 0;
try {
mPackageName = getPackageName();
PackageInfo packageInfo = getPackageManager().getPackageInfo(mPackageName, 0);
int flags = packageInfo.applicationInfo.flags;
versionCode = packageInfo.versionCode;
Constants.DEBUG_ENABLED = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
=======
private static OkHttpClient sHttpClient;
private static Picasso sPicasso;
private static String sDefSystemLanguage;
@Override
public void onCreate() {
super.onCreate();
sDefSystemLanguage = LocaleUtils.getCurrent();
Constants.DEBUG_ENABLED = false;
int versionCode = 0;
try {
String packageName = getPackageName();
PackageInfo packageInfo = getPackageManager().getPackageInfo(packageName, 0);
int flags = packageInfo.applicationInfo.flags;
versionCode = packageInfo.versionCode;
Constants.DEBUG_ENABLED = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
>>>>>>>
private static OkHttpClient sHttpClient;
private static Picasso sPicasso;
private static String sDefSystemLanguage;
private static PopcornApplication sInstance;
public PopcornApplication() {
sInstance = this;
}
public static PopcornApplication getInstance() {
return sInstance;
}
@Override
public void onCreate() {
super.onCreate();
sDefSystemLanguage = LocaleUtils.getCurrent();
Constants.DEBUG_ENABLED = false;
int versionCode = 0;
try {
String packageName = getPackageName();
PackageInfo packageInfo = getPackageManager().getPackageInfo(packageName, 0);
int flags = packageInfo.applicationInfo.flags;
versionCode = packageInfo.versionCode;
Constants.DEBUG_ENABLED = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
<<<<<<<
Intent nodeServiceIntent = new Intent(this, StreamerService.class);
bindService(nodeServiceIntent, mConnection, Context.BIND_AUTO_CREATE);
File path = new File(PrefUtils.get(this, Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(this).toString()));
File directory = new File(path, "/torrents/");
if (PrefUtils.get(this, Prefs.REMOVE_CACHE, true)) {
FileUtils.recursiveDelete(directory);
FileUtils.recursiveDelete(new File(path + "/subs"));
} else {
File statusFile = new File(directory, "status.json");
File streamerFile = new File(directory, "streamer.json");
statusFile.delete();
streamerFile.delete();
}
LogUtils.d("StorageLocations: " + StorageUtils.getAllStorageLocations());
LogUtils.i("Chosen cache location: " + directory);
if (PrefUtils.get(this, Prefs.INSTALLED_VERSION, 0) < versionCode) {
PrefUtils.save(this, Prefs.INSTALLED_VERSION, versionCode);
FileUtils.recursiveDelete(new File(StorageUtils.getIdealCacheDirectory(this) + "/backend"));
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
sDefSystemLanguage = LocaleUtils.getCurrent();
}
public static String getSystemLanguage() {
return sDefSystemLanguage;
}
public static OkHttpClient getHttpClient() {
if (sHttpClient == null) {
sHttpClient = new OkHttpClient();
int cacheSize = 10 * 1024 * 1024;
try {
File cacheLocation = new File(PrefUtils.get(PopcornApplication.getAppContext(), Prefs.STORAGE_LOCATION,
StorageUtils.getIdealCacheDirectory(PopcornApplication.getAppContext()).toString()));
cacheLocation.mkdirs();
com.squareup.okhttp.Cache cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize);
sHttpClient.setCache(cache);
} catch (IOException e) {
e.printStackTrace();
}
}
return sHttpClient;
}
public static Picasso getPicasso() {
if (sPicasso == null) {
Picasso.Builder builder = new Picasso.Builder(getAppContext());
OkHttpDownloader downloader = new OkHttpDownloader(getHttpClient());
builder.downloader(downloader);
sPicasso = builder.build();
}
return sPicasso;
}
public Boolean isServiceBound() {
return mBound;
}
public static String getStreamDir() {
File path = new File(
PrefUtils.get(getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(getAppContext()).toString()));
File directory = new File(path, "/torrents/");
return directory.toString();
}
public void startStreamer(String streamUrl) {
File torrentPath = new File(getStreamDir());
torrentPath.mkdirs();
if (!mBound) {
LogUtils.d("Service not started yet");
mShouldBoundUrl = streamUrl;
startService();
return;
}
LogUtils.i("Start streamer: " + streamUrl);
Message msg = Message.obtain(null, StreamerService.MSG_RUN_SCRIPT, 0, 0);
Bundle args = new Bundle();
args.putString("directory", getStreamDir());
args.putString("stream_url", streamUrl);
msg.setData(args);
try {
mService.send(msg);
} catch (RemoteException e) {
e.printStackTrace();
}
}
public void stopStreamer() {
if (!mBound) return;
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = am.getRunningAppProcesses();
for (int i = 0; i < runningAppProcesses.size(); i++) {
ActivityManager.RunningAppProcessInfo info = runningAppProcesses.get(i);
if (info.processName.equalsIgnoreCase(mPackageName + ":node")) {
android.os.Process.killProcess(info.pid);
}
}
File torrentPath = new File(getStreamDir());
if (PrefUtils.get(this, Prefs.REMOVE_CACHE, true)) {
FileUtils.recursiveDelete(torrentPath);
} else {
File statusFile = new File(torrentPath, "status.json");
File streamerFile = new File(torrentPath, "streamer.json");
statusFile.delete();
streamerFile.delete();
}
startService();
}
public void startService() {
if (mBound) return;
Intent nodeServiceIntent = new Intent(this, StreamerService.class);
bindService(nodeServiceIntent, mConnection, Context.BIND_AUTO_CREATE);
}
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
mService = new Messenger(service);
mBound = true;
if (mShouldBoundUrl != null && !mShouldBoundUrl.isEmpty()) {
startStreamer(mShouldBoundUrl);
mShouldBoundUrl = "";
}
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
mService = null;
mBound = false;
}
};
=======
TorrentService.start(this);
File path = new File(PrefUtils.get(this, Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(this).toString()));
File directory = new File(path, "/torrents/");
if (PrefUtils.get(this, Prefs.REMOVE_CACHE, true)) {
FileUtils.recursiveDelete(directory);
FileUtils.recursiveDelete(new File(path + "/subs"));
} else {
File statusFile = new File(directory, "status.json");
statusFile.delete();
}
LogUtils.d("StorageLocations: " + StorageUtils.getAllStorageLocations());
LogUtils.i("Chosen cache location: " + directory);
if (PrefUtils.get(this, Prefs.INSTALLED_VERSION, 0) < versionCode) {
PrefUtils.save(this, Prefs.INSTALLED_VERSION, versionCode);
FileUtils.recursiveDelete(new File(StorageUtils.getIdealCacheDirectory(this) + "/backend"));
}
PopcornUpdater.getInstance(this).checkUpdates(false);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
sDefSystemLanguage = LocaleUtils.getCurrent();
}
public static String getSystemLanguage() {
return sDefSystemLanguage;
}
public static OkHttpClient getHttpClient() {
if (sHttpClient == null) {
sHttpClient = new OkHttpClient();
int cacheSize = 10 * 1024 * 1024;
try {
File cacheLocation = new File(PrefUtils.get(PopcornApplication.getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(PopcornApplication.getAppContext()).toString()));
cacheLocation.mkdirs();
com.squareup.okhttp.Cache cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize);
sHttpClient.setCache(cache);
} catch (IOException e) {
e.printStackTrace();
}
}
return sHttpClient;
}
public static Picasso getPicasso() {
if (sPicasso == null) {
Picasso.Builder builder = new Picasso.Builder(getAppContext());
OkHttpDownloader downloader = new OkHttpDownloader(getHttpClient());
builder.downloader(downloader);
sPicasso = builder.build();
}
return sPicasso;
}
public static String getStreamDir() {
File path = new File(PrefUtils.get(getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(getAppContext()).toString()));
File directory = new File(path, "/torrents/");
return directory.toString();
}
>>>>>>>
TorrentService.start(this);
File path = new File(PrefUtils.get(this, Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(this).toString()));
File directory = new File(path, "/torrents/");
if (PrefUtils.get(this, Prefs.REMOVE_CACHE, true)) {
FileUtils.recursiveDelete(directory);
FileUtils.recursiveDelete(new File(path + "/subs"));
} else {
File statusFile = new File(directory, "status.json");
statusFile.delete();
}
LogUtils.d("StorageLocations: " + StorageUtils.getAllStorageLocations());
LogUtils.i("Chosen cache location: " + directory);
if (PrefUtils.get(this, Prefs.INSTALLED_VERSION, 0) < versionCode) {
PrefUtils.save(this, Prefs.INSTALLED_VERSION, versionCode);
FileUtils.recursiveDelete(new File(StorageUtils.getIdealCacheDirectory(this) + "/backend"));
}
PopcornUpdater.getInstance(this).checkUpdates(false);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
sDefSystemLanguage = LocaleUtils.getCurrent();
}
public static String getSystemLanguage() {
return sDefSystemLanguage;
}
public static OkHttpClient getHttpClient() {
if (sHttpClient == null) {
sHttpClient = new OkHttpClient();
int cacheSize = 10 * 1024 * 1024;
try {
File cacheLocation = new File(PrefUtils.get(PopcornApplication.getAppContext(), Prefs.STORAGE_LOCATION,
StorageUtils.getIdealCacheDirectory(PopcornApplication.getAppContext()).toString()));
cacheLocation.mkdirs();
com.squareup.okhttp.Cache cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize);
sHttpClient.setCache(cache);
} catch (IOException e) {
e.printStackTrace();
}
}
return sHttpClient;
}
public static Picasso getPicasso() {
if (sPicasso == null) {
Picasso.Builder builder = new Picasso.Builder(getAppContext());
OkHttpDownloader downloader = new OkHttpDownloader(getHttpClient());
builder.downloader(downloader);
sPicasso = builder.build();
}
return sPicasso;
}
public static String getStreamDir() {
File path = new File(
PrefUtils.get(getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(getAppContext()).toString()));
File directory = new File(path, "/torrents/");
return directory.toString();
} |
<<<<<<<
protected int mTotalPixelCount;
protected int mCropBoundWidthXLeft;
protected int mCropBoundWidthXRight = 0;
protected int mCropBoundHeightYTop;
protected int mCropBoundHeightYBottom = 0;
protected int mIntermediateCropBoundWidthXLeft;
protected int mIntermediateCropBoundWidthXRight;
protected int mIntermediateCropBoundHeightYTop;
protected int mIntermediateCropBoundHeightYBottom;
protected final int mLineStrokeWidth = 5;
protected int mCropExtraLinesLength = mLineStrokeWidth * 5;
protected boolean mCropRunFinished = false;
private static FindCroppingCoordinatesAsyncTask mFindCroppingCoordinates = null;
=======
>>>>>>>
<<<<<<<
private int mBitmapWidth = 0;
private int mbitmapHeight = 0;
=======
private static final int DEFAULT_BOX_RESIZE_MARGIN = 20;
private DrawingSurface mDrawingSurface;
private float mCropBoundWidthXLeft;
private float mCropBoundWidthXRight = 0;
private float mCropBoundHeightYTop;
private float mCropBoundHeightYBottom = 0;
private int mIntermediateCropBoundWidthXLeft;
private int mIntermediateCropBoundWidthXRight;
private int mIntermediateCropBoundHeightYTop;
private int mIntermediateCropBoundHeightYBottom;
private Paint mLinePaint;
private final int mLineStrokeWidth = 5;
private int mCropExtraLinesLength = mLineStrokeWidth * 5;
private boolean mCropRunFinished = false;
private static FindCroppingCoordinatesAsyncTask mFindCroppingCoordinates = null;
private float mBoxResizeMargin;
private ResizeAction mResizeAction;
private FloatingBoxAction mCurrentAction;
private enum ResizeAction {
NONE, TOP, RIGHT, BOTTOM, LEFT, TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT;
}
private enum FloatingBoxAction {
NONE, MOVE, RESIZE;
}
>>>>>>>
private static final int DEFAULT_BOX_RESIZE_MARGIN = 20;
private float mCropBoundWidthXLeft;
private float mCropBoundWidthXRight = 0;
private float mCropBoundHeightYTop;
private float mCropBoundHeightYBottom = 0;
private int mIntermediateCropBoundWidthXLeft;
private int mIntermediateCropBoundWidthXRight;
private int mIntermediateCropBoundHeightYTop;
private int mIntermediateCropBoundHeightYBottom;
private Paint mLinePaint;
private final int mLineStrokeWidth = 5;
private int mCropExtraLinesLength = mLineStrokeWidth * 5;
private boolean mCropRunFinished = false;
private static FindCroppingCoordinatesAsyncTask mFindCroppingCoordinates = null;
private float mBoxResizeMargin;
private ResizeAction mResizeAction;
private FloatingBoxAction mCurrentAction;
private enum ResizeAction {
NONE, TOP, RIGHT, BOTTOM, LEFT, TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT;
}
private enum FloatingBoxAction {
NONE, MOVE, RESIZE;
}
<<<<<<<
=======
mResizeAction = ResizeAction.NONE;
mBoxResizeMargin = getInverselyProportionalSizeForZoom(DEFAULT_BOX_RESIZE_MARGIN);
>>>>>>>
mResizeAction = ResizeAction.NONE;
mBoxResizeMargin = getInverselyProportionalSizeForZoom(DEFAULT_BOX_RESIZE_MARGIN);
<<<<<<<
mBitmapWidth = PaintroidApplication.DRAWING_SURFACE.getBitmapWidth();
mbitmapHeight = PaintroidApplication.DRAWING_SURFACE.getBitmapHeight();
mTotalPixelCount = mBitmapWidth * mbitmapHeight;
=======
>>>>>>>
<<<<<<<
PaintroidApplication.COMMAND_MANAGER.commitCommand(new BitmapCommand(
PaintroidApplication.DRAWING_SURFACE.getBitmap()));
=======
mCropRunFinished = false;
>>>>>>>
mCropRunFinished = false;
PaintroidApplication.COMMAND_MANAGER.commitCommand(new BitmapCommand(
PaintroidApplication.DRAWING_SURFACE.getBitmap())); |
<<<<<<<
public void testFinishInitializeThenSetUndoRedoButtons() {
when(toolReference.get()).thenReturn(tool);
when(tool.getDrawPaint()).thenReturn(mock(Paint.class));
=======
public void testOnCreateToolCallsToolController() {
presenter.onCreateTool();
verify(toolController).createTool();
verifyNoMoreInteractions(toolController);
}
>>>>>>>
public void testOnCreateToolCallsToolController() {
presenter.onCreateTool();
verify(toolController).createTool();
verifyNoMoreInteractions(toolController);
}
<<<<<<<
public void testFinishInitializeWhenUndoAvailableThenSetUndoRedoButtons() {
when(toolReference.get()).thenReturn(tool);
when(tool.getDrawPaint()).thenReturn(mock(Paint.class));
=======
public void testFinishInitializeWhenUndoAvailableThenSetUndoRedoButtons() {
>>>>>>>
public void testFinishInitializeWhenUndoAvailableThenSetUndoRedoButtons() {
<<<<<<<
public void testFinishInitializeWhenRedoAvailableThenSetUndoRedoButtons() {
when(toolReference.get()).thenReturn(tool);
when(tool.getDrawPaint()).thenReturn(mock(Paint.class));
=======
public void testFinishInitializeWhenRedoAvailableThensetUndoRedoButtons() {
>>>>>>>
public void testFinishInitializeWhenRedoAvailableThenSetUndoRedoButtons() {
<<<<<<<
public void testFinishInitializeWhenCommandManagerBusyRestoreProgressDialog() {
when(toolReference.get()).thenReturn(tool);
when(tool.getDrawPaint()).thenReturn(mock(Paint.class));
when(commandManager.isBusy()).thenReturn(true);
presenter.finishInitialize();
verify(navigator).showIndeterminateProgressDialog();
}
@Test
public void testFinishInitializeWhenCommandManagerIdleThenDoNothing() {
when(toolReference.get()).thenReturn(tool);
when(tool.getDrawPaint()).thenReturn(mock(Paint.class));
presenter.finishInitialize();
verify(navigator, never()).showIndeterminateProgressDialog();
}
@Test
public void testToolClickedThenCancelAnimation() {
when(toolReference.get()).thenReturn(tool);
when(tool.getToolType()).thenReturn(ToolType.BRUSH);
presenter.toolClicked(ToolType.BRUSH);
verify(bottomBarViewHolder).cancelAnimation();
}
@Test
=======
>>>>>>>
public void testFinishInitializeWhenCommandManagerBusyRestoreProgressDialog() {
when(commandManager.isBusy()).thenReturn(true);
presenter.finishInitialize();
verify(navigator).showIndeterminateProgressDialog();
}
@Test
public void testFinishInitializeWhenCommandManagerIdleThenDoNothing() {
presenter.finishInitialize();
verify(navigator, never()).showIndeterminateProgressDialog();
}
@Test |
<<<<<<<
case ROTATE:
return R.drawable.icon_menu_rotate;
=======
case LINE:
return R.drawable.icon_menu_straight_line;
>>>>>>>
case ROTATE:
return R.drawable.icon_menu_rotate;
case LINE:
return R.drawable.icon_menu_straight_line; |
<<<<<<<
// The toolbar buttons
protected Toolbar toolbar;
protected boolean showMenu = true;
//request codes
public static final int TOOL_MENU = 0;
public static final int REQ_IMPORTPNG = 1;
=======
private boolean openedWithCatroid;
public enum ToolbarItem {
HAND, ZOOM, BRUSH, EYEDROPPER, MAGICWAND, UNDO, REDO, NONE, RESET
}
>>>>>>>
// The toolbar buttons
protected Toolbar toolbar;
protected boolean showMenu = true;
private boolean openedWithCatroid;
//request codes
public static final int TOOL_MENU = 0;
public static final int REQ_IMPORTPNG = 1;
<<<<<<<
=======
updateStrokeButtonBackground();
final ToolbarButton brushToolButton = (ToolbarButton) this.findViewById(R.id.ibtn_brushTool);
brushToolButton.activate();
drawingSurface.setActionType(ToolbarItem.BRUSH);
openedWithCatroid = false;
//check if awesome catroid app opened it:
Bundle bundle = this.getIntent().getExtras();
if (bundle == null) {
return;
}
String pathToImage = bundle.getString(this.getString(R.string.extra_picture_path_catroid));
if (pathToImage != null) {
openedWithCatroid = true;
}
if (pathToImage != "") {
loadNewImage(pathToImage);
}
>>>>>>>
openedWithCatroid = false;
//check if awesome catroid app opened it:
Bundle bundle = this.getIntent().getExtras();
if (bundle == null) {
return;
}
String pathToImage = bundle.getString(this.getString(R.string.extra_picture_path_catroid));
if (pathToImage != null) {
openedWithCatroid = true;
}
if (pathToImage != "") {
loadNewImage(pathToImage);
}
<<<<<<<
case R.id.item_Quit: // Exit the application
showSecurityQuestionBeforeExit();
=======
case R.id.item_Quit: // Exit the application
showSecurityQuestionBeforeExit();
return true;
case R.id.item_Clear:
drawingSurface.clearBitmap();
>>>>>>>
case R.id.item_Quit: // Exit the application
showSecurityQuestionBeforeExit();
<<<<<<<
if (ReturnValue.contentEquals("LOAD") && uriString != null) {
=======
if (ReturnValue.contentEquals("LOAD") && uriString != null) {
Log.d("PAINTROID", "Main: Uri " + uriString);
drawingSurface.clearUndoRedo();
loadNewImage(uriString);
}
>>>>>>>
if (ReturnValue.contentEquals("LOAD") && uriString != null) {
Log.d("PAINTROID", "Main: Uri " + uriString);
drawingSurface.clearUndoRedo();
loadNewImage(uriString);
}
<<<<<<<
protected void showSecurityQuestionBeforeExit() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.closing_security_question).setCancelable(false)
.setPositiveButton(R.string.closing_security_question_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
MainActivity.this.finish();
}
}).setNegativeButton(R.string.closing_security_question_not, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
return;
=======
public String getSavedFileUriString() {
return savedFileUri.toString().replace("file://", "");
>>>>>>>
public String getSavedFileUriString() {
return savedFileUri.toString().replace("file://", ""); |
<<<<<<<
// if (Utils.isScreenLocked(mSolo.getCurrentActivity())) {
// mScreenLocked = true;
// tearDown();
// assertFalse("Screen is locked!", mScreenLocked);
// return;
// }
Log.d("Paintroid test", "setup" + setup++);
=======
>>>>>>> |
<<<<<<<
int bitmapHeight = PaintroidApplication.DRAWING_SURFACE
.getBitmapHeight();
int bitmapWidth = PaintroidApplication.DRAWING_SURFACE.getBitmapWidth();
if ((coordinate.x > bitmapWidth) || (coordinate.y > bitmapHeight)) {
return false;
}
if (mBitmapPaint.getColor() == PaintroidApplication.DRAWING_SURFACE
.getBitmapColor(coordinate)) {
return false;
}
=======
int bitmapHeight = PaintroidApplication.DRAWING_SURFACE
.getBitmapHeight();
int bitmapWidth = PaintroidApplication.DRAWING_SURFACE.getBitmapWidth();
if ((coordinate.x > bitmapWidth) || (coordinate.y > bitmapHeight)) {
return false;
}
if (mBitmapPaint.getColor() == PaintroidApplication.DRAWING_SURFACE
.getBitmapColor(coordinate)) {
return false;
}
>>>>>>>
int bitmapHeight = PaintroidApplication.DRAWING_SURFACE
.getBitmapHeight();
int bitmapWidth = PaintroidApplication.DRAWING_SURFACE.getBitmapWidth();
if ((coordinate.x > bitmapWidth) || (coordinate.y > bitmapHeight)) {
return false;
}
if (mBitmapPaint.getColor() == PaintroidApplication.DRAWING_SURFACE
.getBitmapColor(coordinate)) {
return false;
}
<<<<<<<
=======
case BUTTON_ID_PARAMETER_TOP:
return getStrokeColorResource();
>>>>>>> e0cdb6d819dfba38d0ac5720ed691b0513e22109
case BUTTON_ID_PARAMETER_BOTTOM_2:
return R.drawable.icon_menu_color_palette;
default:
return super.getAttributeButtonResource(buttonNumber);
}
<<<<<<< HEAD
=======
>>>>>>> e0cdb6d819dfba38d0ac5720ed691b0513e22109
}
@Override
public void attributeButtonClick(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
case BUTTON_ID_PARAMETER_BOTTOM_2:
showColorPicker();
break;
default:
<<<<<<< /mnt/batch/tasks/workitems/adfv2-General_1/job-1/9fefa57c-cd3b-4af6-b859-0ece70c9daed/wd/.temp/athenacommon/2cb5eb6d-7364-4685-8700-e7d3f1a91ba8.java
<<<<<<< HEAD
super.attributeButtonClick(buttonNumber);
=======
break;
>>>>>>> e0cdb6d819dfba38d0ac5720ed691b0513e22109
=======
super.attributeButtonClick(buttonNumber);
>>>>>>>
case BUTTON_ID_PARAMETER_TOP:
return getStrokeColorResource();
case BUTTON_ID_PARAMETER_BOTTOM_2:
return R.drawable.icon_menu_color_palette;
default:
return super.getAttributeButtonResource(buttonNumber);
}
}
@Override
public void attributeButtonClick(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
case BUTTON_ID_PARAMETER_BOTTOM_2:
showColorPicker();
break;
default:
super.attributeButtonClick(buttonNumber);
break; |
<<<<<<<
private DrawingSurfaceThread mDrawingThread;
private Bitmap mWorkingBitmap;
private final Rect mWorkingBitmapRect;
private final Canvas mWorkingBitmapCanvas;
private final Paint mFramePaint;
private final Paint mClearPaint;
protected Perspective mSurfacePerspective;
protected boolean mSurfaceCanBeUsed;
=======
private DrawingSurfaceThread drawingThread;
private Bitmap workingBitmap;
private final Rect workingBitmapRect;
private final Canvas workingBitmapCanvas;
private final Paint framePaint;
private final Paint clearPaint;
protected boolean surfaceCanBeUsed;
>>>>>>>
private DrawingSurfaceThread mDrawingThread;
private Bitmap mWorkingBitmap;
private final Rect mWorkingBitmapRect;
private final Canvas mWorkingBitmapCanvas;
private final Paint mFramePaint;
private final Paint mClearPaint;
protected boolean mSurfaceCanBeUsed;
<<<<<<<
mSurfacePerspective.applyToCanvas(surfaceViewCanvas);
=======
PaintroidApplication.CURRENT_PERSPECTIVE.applyToCanvas(surfaceViewCanvas);
>>>>>>>
PaintroidApplication.CURRENT_PERSPECTIVE.applyToCanvas(surfaceViewCanvas);
<<<<<<<
bundle.putSerializable(BUNDLE_PERSPECTIVE, mSurfacePerspective);
=======
bundle.putSerializable(BUNDLE_PERSPECTIVE, PaintroidApplication.CURRENT_PERSPECTIVE);
>>>>>>>
bundle.putSerializable(BUNDLE_PERSPECTIVE, PaintroidApplication.CURRENT_PERSPECTIVE);
<<<<<<<
mSurfacePerspective = (Perspective) bundle.getSerializable(BUNDLE_PERSPECTIVE);
=======
PaintroidApplication.CURRENT_PERSPECTIVE = (Perspective) bundle.getSerializable(BUNDLE_PERSPECTIVE);
>>>>>>>
PaintroidApplication.CURRENT_PERSPECTIVE = (Perspective) bundle.getSerializable(BUNDLE_PERSPECTIVE);
<<<<<<<
mSurfacePerspective.resetScaleAndTranslation();
=======
PaintroidApplication.CURRENT_PERSPECTIVE.resetScaleAndTranslation();
>>>>>>>
PaintroidApplication.CURRENT_PERSPECTIVE.resetScaleAndTranslation();
<<<<<<<
public void setPerspective(Perspective perspective) {
mSurfacePerspective = perspective;
}
@Override
=======
>>>>>>>
<<<<<<<
mSurfacePerspective.setSurfaceHolder(holder);
=======
PaintroidApplication.CURRENT_PERSPECTIVE.setSurfaceHolder(holder);
>>>>>>>
PaintroidApplication.CURRENT_PERSPECTIVE.setSurfaceHolder(holder); |
<<<<<<<
public static void startActivity(Context context, Media media) {
Intent intent = new Intent(PopcornApplication.getAppContext(), MediaDetailActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sMedia = media;
PopcornApplication.getAppContext().startActivity(intent);
=======
public static void startActivity(Context context, Media media, int paletteColor) {
Intent intent = new Intent(context, MediaDetailActivity.class);
if (paletteColor != -1) intent.putExtra(COLOR, paletteColor);
if(media != null)
sMedia = media;
context.startActivity(intent);
>>>>>>>
public static void startActivity(Context context, Media media) {
Intent intent = new Intent(context, MediaDetailActivity.class);
if(media != null)
sMedia = media;
context.startActivity(intent); |
<<<<<<<
import at.tugraz.ist.paintroid.MainActivity.ToolType;
=======
import at.tugraz.ist.paintroid.MainActivity.ToolbarItem;
import at.tugraz.ist.paintroid.R;
>>>>>>>
import at.tugraz.ist.paintroid.MainActivity.ToolType;
import at.tugraz.ist.paintroid.R;
<<<<<<<
import at.tugraz.ist.paintroid.helper.Toolbar;
import at.tugraz.ist.zoomscroll.ZoomStatus;
/**
* This Class is the main drawing surface and handles all drawing elements
*
* Status: refactored 20.02.2011
* @author PaintroidTeam
* @version 0.6.4b
*/
public class DrawingSurface extends SurfaceView implements Observer, SurfaceHolder.Callback {
/**
* Thread used for drawing the path
*
*/
class PathDrawingThread extends Thread {
private Path path;
private Paint paint;
// Canvas thats bound to the bitmap
private Canvas draw_canvas;
// if true thread work, else thread finishes
private boolean work = false;
private SurfaceView surface_view;
/**
* Constructor
*
* @param path path to draw
* @param paint paint used to draw the path
* @param canvas canvas to draw path on
* @param surfaceView surface view
*/
public PathDrawingThread(Path path, Paint paint, Canvas canvas, SurfaceView surfaceView)
{
this.path = path;
this.draw_canvas = canvas;
this.paint = paint;
this.surface_view = surfaceView;
}
@Override
public void run() {
while(this.work)
{
try {
synchronized (this) {
// Wait for work
this.wait();
// Do actual path drawing
doDraw();
// Force view to redraw
this.surface_view.postInvalidate();
}
} catch (InterruptedException e) {
}
}
}
/**
* Draws the path on the canvas
*/
private void doDraw()
{
if(this.draw_canvas != null)
{
this.draw_canvas.drawPath(this.path, this.paint);
}
}
/**
* Sets the paint
*
* @param paint to set
*/
public synchronized void setPaint(Paint paint)
{
this.paint = paint;
}
/**
* Sets the canvas
*
* @param canvas to set
*/
public synchronized void setCanvas(Canvas canvas)
{
this.draw_canvas = canvas;
}
/**
* Sets the running state
*
* @param state to set
*/
public synchronized void setRunning(boolean state)
{
this.work = state;
}
}
// The bitmap which will be edited
private volatile Bitmap bitmap;
=======
>>>>>>>
import at.tugraz.ist.paintroid.helper.Toolbar;
<<<<<<<
// Paint for drawing the bitmap
private Paint bitmap_paint;
// Current selected action
ToolType action = ToolType.BRUSH;
=======
public static class Perspective {
public static float zoom = 1f;
public static PointF scroll = new PointF(0f, 0f);
}
// translate coordinates onto the bitmap
public Point translate2Image(float x, float y) {
Point point = new Point();
point.x = Math.round((x / Perspective.zoom) - rectImage.left);
point.y = Math.round((y / Perspective.zoom) - rectImage.top);
return point;
}
>>>>>>>
public static class Perspective {
public static float zoom = 1f;
public static PointF scroll = new PointF(0f, 0f);
}
// translate coordinates onto the bitmap
public Point translate2Image(float x, float y) {
Point point = new Point();
point.x = Math.round((x / Perspective.zoom) - rectImage.left);
point.y = Math.round((y / Perspective.zoom) - rectImage.top);
return point;
}
<<<<<<<
private PathDrawingThread path_drawing_thread;
Toolbar toolbar = null;
=======
>>>>>>>
<<<<<<<
=======
setActionType(ToolbarItem.NONE);
>>>>>>>
<<<<<<<
if(tool.getState() == ToolState.INACTIVE && action != ToolType.BRUSH)
{
=======
if (activeTool.getState() == ToolState.INACTIVE && activeAction != ToolbarItem.BRUSH) {
>>>>>>>
if (activeTool.getState() == ToolState.INACTIVE && action != ToolType.BRUSH) {
<<<<<<<
/**
* sets the surface listener in order of state when double tap event occurred
*
* @param x the x-coordinate of the tap
* @param y the y-coordinate of the tap
* @return true if the event is consumed, else false
*/
public boolean doubleTapEvent(float x, float y)
{
boolean eventUsed = tool.doubleTapEvent((int)x, (int)y, getZoomX(), getZoomY());
if(eventUsed)
{
switch(tool.getState())
{
case INACTIVE:
action = ToolType.BRUSH;
drawingSurfaceListener = new DrawingSurfaceListener(this.getContext());
break;
case ACTIVE:
action = ToolType.CURSOR;
drawingSurfaceListener = new ToolDrawingSurfaceListener(this.getContext(), tool);
=======
public boolean doubleTapEvent(float x, float y) {
boolean eventUsed = activeTool.doubleTapEvent((int) x, (int) y);
if (eventUsed) {
switch (activeTool.getState()) {
case INACTIVE:
activeMode = Mode.DRAW;
drawingSurfaceListener = new DrawingSurfaceListener(this.getContext());
break;
case ACTIVE:
activeMode = Mode.CURSOR;
drawingSurfaceListener = new ToolDrawingSurfaceListener(this.getContext(), activeTool);
>>>>>>>
public boolean doubleTapEvent(float x, float y) {
boolean eventUsed = activeTool.doubleTapEvent((int) x, (int) y);
if (eventUsed) {
switch (activeTool.getState()) {
case INACTIVE:
action = ToolType.BRUSH;
drawingSurfaceListener = new DrawingSurfaceListener(this.getContext());
break;
case ACTIVE:
action = ToolType.CURSOR;
drawingSurfaceListener = new ToolDrawingSurfaceListener(this.getContext(), activeTool);
<<<<<<<
public void activateCursor()
{
if(action != ToolType.BRUSH)
{
tool.deactivate();
tool = new Cursor(tool);
}
action = ToolType.CURSOR;
drawingSurfaceListener = new ToolDrawingSurfaceListener(this.getContext(), tool);
((Cursor)tool).activate(getZoomX(), getZoomY());
drawingSurfaceListener.setSurface(this);
drawingSurfaceListener.setZoomStatus(zoomStatus);
drawingSurfaceListener.setControlType(action);
setOnTouchListener(drawingSurfaceListener);
invalidate();
}
/**
* called of the paint gets changed
*
* used to draw a point on the actual position of the cursor
* if activated
*
*/
public void paintChanged()
{
if(tool.getState() == ToolState.DRAW)
{
Point cursorPosition = tool.getPosition();
drawPaintOnSurface(cursorPosition.x, cursorPosition.y);
}
}
/**
* gets the actual surface listener
*
* @return the listener to the surface
*/
public BaseSurfaceListener getDrawingSurfaceListener()
{
=======
public void paintChanged() {
DrawFunctions.setPaint(pathPaint, activeBrush.cap, activeBrush.stroke, activeColor, useAntiAliasing, null);
if (activeTool.getState() == ToolState.DRAW) {
Point cursorPosition = activeTool.getPosition();
drawPointOnSurface(cursorPosition.x, cursorPosition.y);
}
}
public BaseSurfaceListener getDrawingSurfaceListener() {
>>>>>>>
public void activateCursor() {
if (action != ToolType.BRUSH) {
activeTool.deactivate();
activeTool = new Cursor(activeTool);
}
action = ToolType.CURSOR;
drawingSurfaceListener = new ToolDrawingSurfaceListener(this.getContext(), activeTool);
((Cursor) activeTool).activate();
drawingSurfaceListener.setSurface(this);
drawingSurfaceListener.setControlType(action);
setOnTouchListener(drawingSurfaceListener);
invalidate();
}
public void paintChanged() {
if (activeTool.getState() == ToolState.DRAW) {
Point cursorPosition = activeTool.getPosition();
drawPointOnSurface(cursorPosition.x, cursorPosition.y);
}
}
public BaseSurfaceListener getDrawingSurfaceListener() {
<<<<<<<
if(action != ToolType.FLOATINGBOX)
{
activateFloatingBox();
}
FloatingBox floatingBox = (FloatingBox) tool;
floatingBox.reset();
floatingBox.addBitmap(newPng);
toolbar.activateFloatingBoxButtons();
//called by robotium too
postInvalidate();
}
/**
* Rotate floating box
*
* @param degree
* @return true if it worked, else false
*/
public boolean rotateFloatingBox(int degree)
{
if(action != ToolType.FLOATINGBOX)
{
return false;
}
FloatingBox floatingBox = (FloatingBox) tool;
boolean worked = floatingBox.rotate(degree);
postInvalidate();
return worked;
}
/**
* Calculates the coordinates on the bitmap from the screen coordinates
*
* @param x screen coordinate
* @param y screen coordinate
* @return bitmap coordinates
*/
public Point getPixelCoordinates(float x, float y)
{
bitmap_coordinates = DrawFunctions.RealCoordinateValue(x, y, rectImage, rectCanvas);
int imageX = bitmap_coordinates.elementAt(0).intValue();
int imageY = bitmap_coordinates.elementAt(1).intValue();
=======
if (activeMode != Mode.FLOATINGBOX) {
toggleFloatingBoxMode();
}
FloatingBox floatingBox = (FloatingBox) activeTool;
floatingBox.reset();
floatingBox.addBitmap(newPng);
postInvalidate(); //called by robotium too
}
public void addPng(String uri) {
Bitmap newPng = DrawFunctions.createBitmapFromUri(uri);
if (newPng == null) {
return;
}
}
public Point getPixelCoordinates(float x, float y) {
Point coords = translate2Image(x, y);
int imageX = coords.x;
int imageY = coords.y;
>>>>>>>
if (action != ToolType.FLOATINGBOX) {
activateFloatingBox();
}
FloatingBox floatingBox = (FloatingBox) activeTool;
floatingBox.reset();
floatingBox.addBitmap(newPng);
toolbar.activateFloatingBoxButtons();
//called by robotium too
postInvalidate();
}
public boolean rotateFloatingBox(int degree) {
if (action != ToolType.FLOATINGBOX) {
return false;
}
FloatingBox floatingBox = (FloatingBox) activeTool;
boolean worked = floatingBox.rotate(degree);
postInvalidate();
return worked;
}
public Point getPixelCoordinates(float x, float y) {
Point coords = translate2Image(x, y);
int imageX = coords.x;
int imageY = coords.y;
<<<<<<<
public ToolState getToolState()
{
return tool.getState();
=======
public Mode getMode() {
return activeMode;
}
public ToolState getToolState() {
return activeTool.getState();
}
public Point getFloatingBoxCoordinates() {
return activeTool.getPosition();
>>>>>>>
public ToolState getToolState() {
return activeTool.getState();
}
public Point getFloatingBoxCoordinates() {
return activeTool.getPosition();
<<<<<<<
public Point getFloatingBoxSize()
{
if(action == ToolType.FLOATINGBOX && tool instanceof FloatingBox)
{
FloatingBox floatingBox = (FloatingBox) tool;
int width = floatingBox.getWidth();
int height = floatingBox.getHeight();
return new Point(width, height);
}
return null;
}
public float getFloatingBoxRotation()
{
if(action == ToolType.FLOATINGBOX && tool instanceof FloatingBox)
{
FloatingBox floatingBox = (FloatingBox) tool;
return floatingBox.getRotation();
}
return 0;
=======
public float getFloatingBoxRotation() {
if (activeMode == Mode.FLOATINGBOX && activeTool instanceof FloatingBox) {
FloatingBox floatingBox = (FloatingBox) activeTool;
return floatingBox.getRotation();
}
return 0;
>>>>>>>
public float getFloatingBoxRotation() {
if (action == ToolType.FLOATINGBOX && activeTool instanceof FloatingBox) {
FloatingBox floatingBox = (FloatingBox) activeTool;
return floatingBox.getRotation();
}
return 0; |
<<<<<<<
package org.catrobat.paintroid.tools.implementation;
import org.catrobat.paintroid.PaintroidApplication;
import org.catrobat.paintroid.R;
import org.catrobat.paintroid.command.Command;
import org.catrobat.paintroid.command.implementation.StampCommand;
import org.catrobat.paintroid.dialog.colorpicker.ColorPickerDialog.OnColorPickedListener;
import org.catrobat.paintroid.tools.ToolType;
import org.catrobat.paintroid.ui.DrawingSurface;
import org.catrobat.paintroid.ui.Statusbar.ToolButtonIDs;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Point;
import android.graphics.RectF;
public class RectangleFillTool extends BaseToolWithRectangleShape {
private static final boolean ROTATION_ENABLED = true;
private static final boolean RESPECT_IMAGE_BOUNDS = false;
private static final float SHAPE_OFFSET = 10f;
private BaseShape mBaseShape;
private ShapeDrawType mShapeDrawType;
public static enum ShapeDrawType {
OUTLINE, FILL
};
public static enum BaseShape {
RECTANGLE, OVAL
};
public RectangleFillTool(Context context, ToolType toolType) {
super(context, toolType);
setRotationEnabled(ROTATION_ENABLED);
setRespectImageBounds(RESPECT_IMAGE_BOUNDS);
mBaseShape = BaseShape.RECTANGLE;
mShapeDrawType = ShapeDrawType.FILL;
mColor = new OnColorPickedListener() {
@Override
public void colorChanged(int color) {
changePaintColor(color);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
};
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
@Override
public void setDrawPaint(Paint paint) {
// necessary because of timing in MainActivity and Eraser
super.setDrawPaint(paint);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
@Override
public void changePaintColor(int color) {
super.changePaintColor(color);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
protected void createAndSetBitmap(DrawingSurface drawingSurface) {
Bitmap bitmap = Bitmap.createBitmap((int) mBoxWidth, (int) mBoxHeight,
Bitmap.Config.ARGB_8888);
Canvas drawCanvas = new Canvas(bitmap);
RectF shapeRect = new RectF(SHAPE_OFFSET, SHAPE_OFFSET, mBoxWidth
- SHAPE_OFFSET, mBoxHeight - SHAPE_OFFSET);
Paint drawPaint = new Paint();
drawPaint.setColor(mCanvasPaint.getColor());
drawPaint.setAntiAlias(DEFAULT_ANTIALISING_ON);
switch (mShapeDrawType) {
case FILL:
drawPaint.setStyle(Style.FILL);
break;
case OUTLINE:
drawPaint.setStyle(Style.STROKE);
float strokeWidth = mBitmapPaint.getStrokeWidth();
shapeRect = new RectF(SHAPE_OFFSET + (strokeWidth / 2),
SHAPE_OFFSET + (strokeWidth / 2), mBoxWidth - SHAPE_OFFSET
- (strokeWidth / 2), mBoxHeight - SHAPE_OFFSET
- (strokeWidth / 2));
drawPaint.setStrokeWidth(strokeWidth);
drawPaint.setStrokeCap(Paint.Cap.BUTT);
break;
default:
break;
}
switch (mBaseShape) {
case RECTANGLE:
drawCanvas.drawRect(shapeRect, drawPaint);
break;
case OVAL:
drawCanvas.drawOval(shapeRect, drawPaint);
break;
default:
break;
}
mDrawingBitmap = bitmap;
}
@Override
protected void onClickInBox() {
Point intPosition = new Point((int) mToolPosition.x,
(int) mToolPosition.y);
Command command = new StampCommand(mDrawingBitmap, intPosition,
mBoxWidth, mBoxHeight, mBoxRotation);
((StampCommand) command).addObserver(this);
mProgressDialog.show();
PaintroidApplication.commandManager.commitCommand(command);
}
@Override
public void attributeButtonClick(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
case BUTTON_ID_PARAMETER_BOTTOM_2:
showColorPicker();
break;
default:
break;
}
}
@Override
public int getAttributeButtonResource(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
return getStrokeColorResource();
case BUTTON_ID_PARAMETER_BOTTOM_2:
return R.drawable.icon_menu_color_palette;
default:
return super.getAttributeButtonResource(buttonNumber);
}
}
@Override
protected void drawToolSpecifics(Canvas canvas) {
// TODO Auto-generated method stub
}
@Override
public void resetInternalState() {
// TODO Auto-generated method stub
}
}
=======
/**
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2012 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* An additional term exception under section 7 of the GNU Affero
* General Public License, version 3, is available at
* http://www.catroid.org/catroid/licenseadditionalterm
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.catrobat.paintroid.tools.implementation;
import org.catrobat.paintroid.PaintroidApplication;
import org.catrobat.paintroid.R;
import org.catrobat.paintroid.command.Command;
import org.catrobat.paintroid.command.implementation.StampCommand;
import org.catrobat.paintroid.dialog.colorpicker.ColorPickerDialog.OnColorPickedListener;
import org.catrobat.paintroid.tools.ToolType;
import org.catrobat.paintroid.ui.DrawingSurface;
import org.catrobat.paintroid.ui.Statusbar.ToolButtonIDs;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Point;
import android.graphics.RectF;
public class RectangleFillTool extends BaseToolWithRectangleShape {
private static final boolean ROTATION_ENABLED = true;
private static final boolean RESPECT_IMAGE_BOUNDS = false;
private static final float SHAPE_OFFSET = 10f;
private BaseShape mBaseShape;
private ShapeDrawType mShapeDrawType;
public static enum ShapeDrawType {
OUTLINE, FILL
};
public static enum BaseShape {
RECTANGLE, OVAL
};
public RectangleFillTool(Context context, ToolType toolType) {
super(context, toolType);
setRotationEnabled(ROTATION_ENABLED);
setRespectImageBounds(RESPECT_IMAGE_BOUNDS);
mBaseShape = BaseShape.RECTANGLE;
mShapeDrawType = ShapeDrawType.FILL;
mColor = new OnColorPickedListener() {
@Override
public void colorChanged(int color) {
changePaintColor(color);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
};
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
@Override
public void setDrawPaint(Paint paint) {
// necessary because of timing in MainActivity and Eraser
super.setDrawPaint(paint);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
protected void createAndSetBitmap(DrawingSurface drawingSurface) {
Bitmap bitmap = Bitmap.createBitmap((int) mBoxWidth, (int) mBoxHeight,
Bitmap.Config.ARGB_8888);
Canvas drawCanvas = new Canvas(bitmap);
RectF shapeRect = new RectF(SHAPE_OFFSET, SHAPE_OFFSET, mBoxWidth
- SHAPE_OFFSET, mBoxHeight - SHAPE_OFFSET);
Paint drawPaint = new Paint();
drawPaint.setColor(mCanvasPaint.getColor());
drawPaint.setAntiAlias(DEFAULT_ANTIALISING_ON);
switch (mShapeDrawType) {
case FILL:
drawPaint.setStyle(Style.FILL);
break;
case OUTLINE:
drawPaint.setStyle(Style.STROKE);
float strokeWidth = mBitmapPaint.getStrokeWidth();
shapeRect = new RectF(SHAPE_OFFSET + (strokeWidth / 2),
SHAPE_OFFSET + (strokeWidth / 2), mBoxWidth - SHAPE_OFFSET
- (strokeWidth / 2), mBoxHeight - SHAPE_OFFSET
- (strokeWidth / 2));
drawPaint.setStrokeWidth(strokeWidth);
drawPaint.setStrokeCap(Paint.Cap.BUTT);
break;
default:
break;
}
switch (mBaseShape) {
case RECTANGLE:
drawCanvas.drawRect(shapeRect, drawPaint);
break;
case OVAL:
drawCanvas.drawOval(shapeRect, drawPaint);
break;
default:
break;
}
mDrawingBitmap = bitmap;
}
@Override
protected void onClickInBox() {
Point intPosition = new Point((int) mToolPosition.x,
(int) mToolPosition.y);
Command command = new StampCommand(mDrawingBitmap, intPosition,
mBoxWidth, mBoxHeight, mBoxRotation);
((StampCommand) command).addObserver(this);
mProgressDialog.show();
PaintroidApplication.commandManager.commitCommand(command);
}
@Override
public void attributeButtonClick(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
case BUTTON_ID_PARAMETER_BOTTOM_2:
showColorPicker();
break;
default:
break;
}
}
@Override
public int getAttributeButtonResource(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
return getStrokeColorResource();
case BUTTON_ID_PARAMETER_BOTTOM_2:
return R.drawable.icon_menu_color_palette;
default:
return super.getAttributeButtonResource(buttonNumber);
}
}
@Override
protected void drawToolSpecifics(Canvas canvas) {
// TODO Auto-generated method stub
}
@Override
public void resetInternalState() {
// TODO Auto-generated method stub
}
}
>>>>>>>
/**
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2012 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* An additional term exception under section 7 of the GNU Affero
* General Public License, version 3, is available at
* http://www.catroid.org/catroid/licenseadditionalterm
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.catrobat.paintroid.tools.implementation;
import org.catrobat.paintroid.PaintroidApplication;
import org.catrobat.paintroid.R;
import org.catrobat.paintroid.command.Command;
import org.catrobat.paintroid.command.implementation.StampCommand;
import org.catrobat.paintroid.dialog.colorpicker.ColorPickerDialog.OnColorPickedListener;
import org.catrobat.paintroid.tools.ToolType;
import org.catrobat.paintroid.ui.DrawingSurface;
import org.catrobat.paintroid.ui.Statusbar.ToolButtonIDs;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Point;
import android.graphics.RectF;
public class RectangleFillTool extends BaseToolWithRectangleShape {
private static final boolean ROTATION_ENABLED = true;
private static final boolean RESPECT_IMAGE_BOUNDS = false;
private static final float SHAPE_OFFSET = 10f;
private BaseShape mBaseShape;
private ShapeDrawType mShapeDrawType;
public static enum ShapeDrawType {
OUTLINE, FILL
};
public static enum BaseShape {
RECTANGLE, OVAL
};
public RectangleFillTool(Context context, ToolType toolType) {
super(context, toolType);
setRotationEnabled(ROTATION_ENABLED);
setRespectImageBounds(RESPECT_IMAGE_BOUNDS);
mBaseShape = BaseShape.RECTANGLE;
mShapeDrawType = ShapeDrawType.FILL;
mColor = new OnColorPickedListener() {
@Override
public void colorChanged(int color) {
changePaintColor(color);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
};
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
@Override
public void setDrawPaint(Paint paint) {
// necessary because of timing in MainActivity and Eraser
super.setDrawPaint(paint);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
@Override
public void changePaintColor(int color) {
super.changePaintColor(color);
createAndSetBitmap(PaintroidApplication.drawingSurface);
}
protected void createAndSetBitmap(DrawingSurface drawingSurface) {
Bitmap bitmap = Bitmap.createBitmap((int) mBoxWidth, (int) mBoxHeight,
Bitmap.Config.ARGB_8888);
Canvas drawCanvas = new Canvas(bitmap);
RectF shapeRect = new RectF(SHAPE_OFFSET, SHAPE_OFFSET, mBoxWidth
- SHAPE_OFFSET, mBoxHeight - SHAPE_OFFSET);
Paint drawPaint = new Paint();
drawPaint.setColor(mCanvasPaint.getColor());
drawPaint.setAntiAlias(DEFAULT_ANTIALISING_ON);
switch (mShapeDrawType) {
case FILL:
drawPaint.setStyle(Style.FILL);
break;
case OUTLINE:
drawPaint.setStyle(Style.STROKE);
float strokeWidth = mBitmapPaint.getStrokeWidth();
shapeRect = new RectF(SHAPE_OFFSET + (strokeWidth / 2),
SHAPE_OFFSET + (strokeWidth / 2), mBoxWidth - SHAPE_OFFSET
- (strokeWidth / 2), mBoxHeight - SHAPE_OFFSET
- (strokeWidth / 2));
drawPaint.setStrokeWidth(strokeWidth);
drawPaint.setStrokeCap(Paint.Cap.BUTT);
break;
default:
break;
}
switch (mBaseShape) {
case RECTANGLE:
drawCanvas.drawRect(shapeRect, drawPaint);
break;
case OVAL:
drawCanvas.drawOval(shapeRect, drawPaint);
break;
default:
break;
}
mDrawingBitmap = bitmap;
}
@Override
protected void onClickInBox() {
Point intPosition = new Point((int) mToolPosition.x,
(int) mToolPosition.y);
Command command = new StampCommand(mDrawingBitmap, intPosition,
mBoxWidth, mBoxHeight, mBoxRotation);
((StampCommand) command).addObserver(this);
mProgressDialog.show();
PaintroidApplication.commandManager.commitCommand(command);
}
@Override
public void attributeButtonClick(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
case BUTTON_ID_PARAMETER_BOTTOM_2:
showColorPicker();
break;
default:
break;
}
}
@Override
public int getAttributeButtonResource(ToolButtonIDs buttonNumber) {
switch (buttonNumber) {
case BUTTON_ID_PARAMETER_TOP:
return getStrokeColorResource();
case BUTTON_ID_PARAMETER_BOTTOM_2:
return R.drawable.icon_menu_color_palette;
default:
return super.getAttributeButtonResource(buttonNumber);
}
}
@Override
protected void drawToolSpecifics(Canvas canvas) {
// TODO Auto-generated method stub
}
@Override
public void resetInternalState() {
// TODO Auto-generated method stub
}
} |
<<<<<<<
=======
filenames.add(PaintroidApplication.savedPictureUri.toString());
>>>>>>>
filenames.add(PaintroidApplication.savedPictureUri.toString());
<<<<<<<
mSolo.waitForDialogToOpen(SHORT_TIMEOUT);
mSolo.waitForDialogToClose(TIMEOUT);
assertNotSame(imageFile, PaintroidApplication.savedBitmapFile);
=======
mSolo.sleep(1000);
// TOOD: comparing apples and oranges here...
assertNotSame(imageFile, PaintroidApplication.savedPictureUri);
>>>>>>>
mSolo.waitForDialogToOpen(SHORT_TIMEOUT);
mSolo.waitForDialogToClose(TIMEOUT);
// TOOD: comparing apples and oranges here...
assertNotSame(imageFile, PaintroidApplication.savedPictureUri);
<<<<<<<
mSolo.waitForDialogToOpen(SHORT_TIMEOUT);
assertTrue("Progress Dialog is not showing", IndeterminateProgressDialog.getInstance().isShowing());
mSolo.waitForDialogToClose();
FILENAMES.add(PaintroidApplication.savedBitmapFile.getName());
=======
assertTrue("Progress Dialog is not showing", ProgressIntermediateDialog.getInstance().isShowing());
mSolo.sleep(1000);
filenames.add(PaintroidApplication.savedPictureUri.toString());
>>>>>>>
mSolo.waitForDialogToOpen(SHORT_TIMEOUT);
assertTrue("Progress Dialog is not showing", IndeterminateProgressDialog.getInstance().isShowing());
mSolo.waitForDialogToClose();
mSolo.sleep(1000);
filenames.add(PaintroidApplication.savedPictureUri.toString()); |
<<<<<<<
import android.graphics.Point;
import at.tugraz.ist.paintroid.ui.Perspective;
import at.tugraz.ist.paintroid.ui.implementation.PerspectiveImplementation;
=======
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.widget.GridView;
import android.widget.TextView;
import at.tugraz.ist.paintroid.R;
import at.tugraz.ist.paintroid.dialog.colorpicker.ColorPickerView;
import at.tugraz.ist.paintroid.dialog.colorpicker.RgbSelectorView;
import com.jayway.android.robotium.solo.Solo;
>>>>>>>
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.Display;
import android.view.View;
import android.widget.GridView;
import android.widget.TextView;
import at.tugraz.ist.paintroid.R;
import at.tugraz.ist.paintroid.dialog.colorpicker.ColorPickerView;
import at.tugraz.ist.paintroid.dialog.colorpicker.RgbSelectorView;
import at.tugraz.ist.paintroid.ui.Perspective;
import at.tugraz.ist.paintroid.ui.implementation.PerspectiveImplementation;
import com.jayway.android.robotium.solo.Solo;
<<<<<<<
public static int[] bitmapToPixelArray(Bitmap bitmap) {
int bitmapWidth = bitmap.getWidth();
int bitmapHeight = bitmap.getHeight();
int pixelArray[] = new int[bitmapWidth * bitmapHeight];
bitmap.getPixels(pixelArray, 0, bitmapWidth, 0, 0, bitmapWidth, bitmapHeight);
return pixelArray;
}
public static synchronized Point convertFromCanvasToScreen(Point canvasPoint, Perspective currentPerspective)
throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
Float surfaceCenterX = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceCenterX");
Float surfaceScale = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class, currentPerspective,
"mSurfaceScale");
Float surfaceTranslationX = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceTranslationX");
Float surfaceCenterY = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceCenterY");
Float surfaceTranslationY = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceTranslationY");
Point screenPoint = new Point();
// screenPoint.x = (int) ((p.x - surfaceCenterX) / surfaceScale + surfaceCenterX - surfaceTranslationX);
// screenPoint.y = (int) ((p.y - surfaceCenterY) / surfaceScale + surfaceCenterY - surfaceTranslationY);
screenPoint.x = (int) ((canvasPoint.x + surfaceTranslationX - surfaceCenterX) * surfaceScale + surfaceCenterX);
screenPoint.y = (int) ((canvasPoint.y + surfaceTranslationY - surfaceCenterY) * surfaceScale + surfaceCenterY);
return screenPoint;
}
=======
>>>>>>>
public static synchronized Point convertFromCanvasToScreen(Point canvasPoint, Perspective currentPerspective)
throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
Float surfaceCenterX = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceCenterX");
Float surfaceScale = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class, currentPerspective,
"mSurfaceScale");
Float surfaceTranslationX = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceTranslationX");
Float surfaceCenterY = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceCenterY");
Float surfaceTranslationY = (Float) PrivateAccess.getMemberValue(PerspectiveImplementation.class,
currentPerspective, "mSurfaceTranslationY");
Point screenPoint = new Point();
// screenPoint.x = (int) ((p.x - surfaceCenterX) / surfaceScale + surfaceCenterX - surfaceTranslationX);
// screenPoint.y = (int) ((p.y - surfaceCenterY) / surfaceScale + surfaceCenterY - surfaceTranslationY);
screenPoint.x = (int) ((canvasPoint.x + surfaceTranslationX - surfaceCenterX) * surfaceScale + surfaceCenterX);
screenPoint.y = (int) ((canvasPoint.y + surfaceTranslationY - surfaceCenterY) * surfaceScale + surfaceCenterY);
return screenPoint;
} |
<<<<<<<
import org.catrobat.paintroid.listener.TransformToolOptionsListener;
=======
import org.catrobat.paintroid.listener.LayerListener;
>>>>>>>
import org.catrobat.paintroid.listener.TransformToolOptionsListener;
import org.catrobat.paintroid.listener.LayerListener; |
<<<<<<<
@Test
public void testBrushToolBackPressedFromCatroidAndUsePicture() throws SecurityException, IllegalArgumentException,
NoSuchFieldException, IllegalAccessException {
mTestCaseWithActivityFinished = true;
mSolo.clickOnScreen(mScreenWidth / 2, mScreenHeight / 2);
String pathToFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/"
+ PaintroidApplication.applicationContext.getString(R.string.app_name) + "/"
+ mSolo.getString(R.string.temp_picture_name) + ".png";
File fileToReturnToCatroid = new File(pathToFile);
if (fileToReturnToCatroid.exists())
fileToReturnToCatroid.delete();
PaintroidApplication.openedFromCatroid = true;
int numberButtonsAtBeginning = mSolo.getCurrentViews(Button.class).size();
mSolo.goBack();
assertTrue("Waiting for the exit dialog to appear", mSolo.waitForActivity("MainActivity", TIMEOUT));
assertTrue("Yes Option should be available", mSolo.searchText(mSolo.getString(R.string.save_button_text)));
assertTrue("No Option should be available", mSolo.searchText(mSolo.getString(R.string.discard_button_text)));
TextView exitTextView = mSolo.getText(mSolo.getString(R.string.closing_security_question));
assertNotNull("No exit Text found", exitTextView);
mSolo.goBack();
assertTrue("Waiting for the exit dialog to close", mSolo.waitForActivity("MainActivity", TIMEOUT));
assertEquals("Two buttons exit screen should be away", mSolo.getCurrentViews(Button.class).size(),
numberButtonsAtBeginning);
mSolo.goBack();
assertTrue("Waiting for the exit dialog to appear", mSolo.waitForActivity("MainActivity", TIMEOUT));
mSolo.clickOnButton(mSolo.getString(R.string.save_button_text));
assertTrue("Waiting for the exit dialog to finish", mSolo.waitForActivity("MainActivity", TIMEOUT));
mSolo.sleep(8000);
boolean hasStopped = PrivateAccess.getMemberValueBoolean(Activity.class, getActivity(), "mStopped");
assertTrue("MainActivity should be finished.", hasStopped);
fileToReturnToCatroid = new File(pathToFile);
assertTrue("No file was created", fileToReturnToCatroid.exists());
assertTrue("The created file is empty", (fileToReturnToCatroid.length() > 0));
fileToReturnToCatroid.delete();
}
@Test
public void testBrushToolBackPressedFromCatroidAndDiscardPicture() {
mTestCaseWithActivityFinished = true;
mSolo.clickOnScreen(mScreenWidth / 2, mScreenHeight / 2);
String pathToFile = getActivity().getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES)
+ "/" + mSolo.getString(R.string.temp_picture_name) + ".png";
File fileToReturnToCatroid = new File(pathToFile);
if (fileToReturnToCatroid.exists())
fileToReturnToCatroid.delete();
PaintroidApplication.openedFromCatroid = true;
mSolo.goBack();
mSolo.waitForText(mSolo.getString(R.string.discard_button_text));
mSolo.clickOnButton(mSolo.getString(R.string.discard_button_text));
assertTrue("Exit dialog not closing", mSolo.waitForDialogToClose());
assertEquals("Application finished, buttons left", mSolo.getCurrentViews(Button.class).size(), 0);
mSolo.sleep(500);
fileToReturnToCatroid = new File(pathToFile);
assertFalse("File was created", fileToReturnToCatroid.exists());
if (fileToReturnToCatroid.exists())
fileToReturnToCatroid.delete();
}
=======
>>>>>>>
@Test
public void testBrushToolBackPressedFromCatroidAndUsePicture() throws SecurityException, IllegalArgumentException,
NoSuchFieldException, IllegalAccessException {
mTestCaseWithActivityFinished = true;
mSolo.clickOnScreen(mScreenWidth / 2, mScreenHeight / 2);
String pathToFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/"
+ PaintroidApplication.applicationContext.getString(R.string.app_name) + "/"
+ mSolo.getString(R.string.temp_picture_name) + ".png";
File fileToReturnToCatroid = new File(pathToFile);
if (fileToReturnToCatroid.exists())
fileToReturnToCatroid.delete();
PaintroidApplication.openedFromCatroid = true;
int numberButtonsAtBeginning = mSolo.getCurrentViews(Button.class).size();
mSolo.goBack();
assertTrue("Waiting for the exit dialog to appear", mSolo.waitForActivity("MainActivity", TIMEOUT));
assertTrue("Yes Option should be available", mSolo.searchText(mSolo.getString(R.string.save_button_text)));
assertTrue("No Option should be available", mSolo.searchText(mSolo.getString(R.string.discard_button_text)));
TextView exitTextView = mSolo.getText(mSolo.getString(R.string.closing_security_question));
assertNotNull("No exit Text found", exitTextView);
mSolo.goBack();
assertTrue("Waiting for the exit dialog to close", mSolo.waitForActivity("MainActivity", TIMEOUT));
assertEquals("Two buttons exit screen should be away", mSolo.getCurrentViews(Button.class).size(),
numberButtonsAtBeginning);
mSolo.goBack();
assertTrue("Waiting for the exit dialog to appear", mSolo.waitForActivity("MainActivity", TIMEOUT));
mSolo.clickOnButton(mSolo.getString(R.string.save_button_text));
assertTrue("Waiting for the exit dialog to finish", mSolo.waitForActivity("MainActivity", TIMEOUT));
mSolo.sleep(8000);
boolean hasStopped = PrivateAccess.getMemberValueBoolean(Activity.class, getActivity(), "mStopped");
assertTrue("MainActivity should be finished.", hasStopped);
fileToReturnToCatroid = new File(pathToFile);
assertTrue("No file was created", fileToReturnToCatroid.exists());
assertTrue("The created file is empty", (fileToReturnToCatroid.length() > 0));
fileToReturnToCatroid.delete();
}
@Test
public void testBrushToolBackPressedFromCatroidAndDiscardPicture() {
mTestCaseWithActivityFinished = true;
mSolo.clickOnScreen(mScreenWidth / 2, mScreenHeight / 2);
String pathToFile = getActivity().getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES)
+ "/" + mSolo.getString(R.string.temp_picture_name) + ".png";
File fileToReturnToCatroid = new File(pathToFile);
if (fileToReturnToCatroid.exists())
fileToReturnToCatroid.delete();
PaintroidApplication.openedFromCatroid = true;
mSolo.goBack();
mSolo.waitForText(mSolo.getString(R.string.discard_button_text));
mSolo.clickOnButton(mSolo.getString(R.string.discard_button_text));
assertTrue("Exit dialog not closing", mSolo.waitForDialogToClose());
assertEquals("Application finished, buttons left", mSolo.getCurrentViews(Button.class).size(), 0);
mSolo.sleep(500);
fileToReturnToCatroid = new File(pathToFile);
assertFalse("File was created", fileToReturnToCatroid.exists());
if (fileToReturnToCatroid.exists())
fileToReturnToCatroid.delete();
} |
<<<<<<<
// Rotate (on symbol)
if (clickCoordinatesRotatedX < this.toolPosition.x - this.width / 2 - roationSymbolDistance
&& clickCoordinatesRotatedX > this.toolPosition.x - this.width / 2 - roationSymbolDistance
- roationSymbolWidth
&& clickCoordinatesRotatedY < this.toolPosition.y - this.height / 2 - roationSymbolDistance
&& clickCoordinatesRotatedY > this.toolPosition.y - this.height / 2 - roationSymbolDistance
- roationSymbolWidth) {
=======
// rotate everywhere outside the box with the distance of the rotation symbol
if ((clickCoordinatesRotatedX < this.position.x - this.width / 2 - roationSymbolDistance)
|| (clickCoordinatesRotatedX > this.position.x + this.width / 2 + roationSymbolDistance)
|| (clickCoordinatesRotatedY < this.position.y - this.height / 2 - roationSymbolDistance)
|| (clickCoordinatesRotatedY > this.position.y + this.height / 2 + roationSymbolDistance)) {
if ((clickCoordinatesRotatedX <= this.position.x) && (clickCoordinatesRotatedY <= this.position.y)) {
mRotatePosition = RotatePosition.TOP_LEFT;
} else if ((clickCoordinatesRotatedX > this.position.x)
&& (clickCoordinatesRotatedY <= this.position.y)) {
mRotatePosition = RotatePosition.TOP_RIGHT;
} else if ((clickCoordinatesRotatedX <= this.position.x)
&& (clickCoordinatesRotatedY > this.position.y)) {
mRotatePosition = RotatePosition.BOTTOM_LEFT;
} else if ((clickCoordinatesRotatedX > this.position.x) && (clickCoordinatesRotatedY > this.position.y)) {
mRotatePosition = RotatePosition.BOTTOM_RIGHT;
}
>>>>>>>
// Rotate (on symbol)
if (clickCoordinatesRotatedX < this.toolPosition.x - this.width / 2 - roationSymbolDistance
&& clickCoordinatesRotatedX > this.toolPosition.x - this.width / 2 - roationSymbolDistance
- roationSymbolWidth
&& clickCoordinatesRotatedY < this.toolPosition.y - this.height / 2 - roationSymbolDistance
&& clickCoordinatesRotatedY > this.toolPosition.y - this.height / 2 - roationSymbolDistance
- roationSymbolWidth) {
// rotate everywhere outside the box with the distance of the rotation symbol
if ((clickCoordinatesRotatedX < this.position.x - this.width / 2 - roationSymbolDistance)
|| (clickCoordinatesRotatedX > this.position.x + this.width / 2 + roationSymbolDistance)
|| (clickCoordinatesRotatedY < this.position.y - this.height / 2 - roationSymbolDistance)
|| (clickCoordinatesRotatedY > this.position.y + this.height / 2 + roationSymbolDistance)) {
if ((clickCoordinatesRotatedX <= this.position.x) && (clickCoordinatesRotatedY <= this.position.y)) {
mRotatePosition = RotatePosition.TOP_LEFT;
} else if ((clickCoordinatesRotatedX > this.position.x)
&& (clickCoordinatesRotatedY <= this.position.y)) {
mRotatePosition = RotatePosition.TOP_RIGHT;
} else if ((clickCoordinatesRotatedX <= this.position.x)
&& (clickCoordinatesRotatedY > this.position.y)) {
mRotatePosition = RotatePosition.BOTTOM_LEFT;
} else if ((clickCoordinatesRotatedX > this.position.x) && (clickCoordinatesRotatedY > this.position.y)) {
mRotatePosition = RotatePosition.BOTTOM_RIGHT;
} |
<<<<<<<
=======
import android.annotation.SuppressLint;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.graphics.PointF;
import android.support.test.InstrumentationRegistry;
>>>>>>>
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.graphics.PointF; |
<<<<<<<
import org.catrobat.paintroid.tools.implementation.RectangleFillTool;
import org.catrobat.paintroid.tools.implementation.RotationTool;
=======
>>>>>>>
import org.catrobat.paintroid.tools.implementation.RotationTool; |
<<<<<<<
private int mPresetButtonHeight = (int) (50.0f * mScale + 0.5f);
private TableLayout mTableLayout;
=======
private int COLOR_BUTTON_MARGIN = 2;
>>>>>>>
private TableLayout mTableLayout;
private int COLOR_BUTTON_MARGIN = 2;
<<<<<<<
colorButtonLayoutParameters.setMargins(2, 2, 2, 2);
=======
colorButtonLayoutParameters.setMargins(COLOR_BUTTON_MARGIN,
COLOR_BUTTON_MARGIN, COLOR_BUTTON_MARGIN, COLOR_BUTTON_MARGIN);
>>>>>>>
colorButtonLayoutParameters.setMargins(COLOR_BUTTON_MARGIN,
COLOR_BUTTON_MARGIN, COLOR_BUTTON_MARGIN, COLOR_BUTTON_MARGIN);
<<<<<<<
if (color == this.mSelectedColor) {
=======
if (color == mSelectedColor) {
>>>>>>>
if (color == mSelectedColor) {
<<<<<<<
this.mSelectedColor = color;
=======
mSelectedColor = color;
>>>>>>>
mSelectedColor = color; |
<<<<<<<
public static Boolean DEBUG_ENABLED = BuildConfig.DEBUG; // will be set to true for debug builds and false for release builds
public static final String LOG_TAG = "PopcornTimeForAndroid";
public static final String PREFS_FILE = "PCT_Prefs";
public static final String DATABASE_NAME = "PCT_DB.db";
public static final Integer DATABASE_VERSION = 1;
public static final Integer SERVER_PORT = 55723;
public static final String BUGSNAG_KEY = "8ab4dda6780329b10aca038b86d506e5";
public static final String GIT_URL = "https://git.popcorntime.io/";
public static final String JIRA_API = GIT_URL + "jira/rest/api/2/";
public static final String JIRA_PROJECT = "10200";
public static final String CAST_ID = "9A435985";
=======
public static Boolean DEBUG_ENABLED = BuildConfig.DEBUG; // will be set to true for debug builds and false for release builds
public static final String LOG_TAG = "PopcornTimeForAndroid";
public static final String PREFS_FILE = "PCT_Prefs";
public static final String DATABASE_NAME = "PCT_DB.db";
public static final Integer DATABASE_VERSION = 1;
public static final String BUGSNAG_KEY = "8ab4dda6780329b10aca038b86d506e5";
public static final String GIT_URL = "https://git.popcorntime.io/";
public static final String POPCORN_URL = "https://popcorntime.io/";
public static final String FB_URL = "https://fb.com/PopcornTimeTv";
public static final String BLOG_URL = "https://blog.popcorntime.io";
public static final String DISCUSS_URL = "https://discuss.popcorntime.io";
public static final String TWITTER_URL = "https://twitter.com/PopcornTimeTv";
public static final String JIRA_API = GIT_URL + "jira/rest/api/2/";
public static final String JIRA_PROJECT = "10200";
>>>>>>>
public static Boolean DEBUG_ENABLED = BuildConfig.DEBUG; // will be set to true for debug builds and false for release builds
public static final String LOG_TAG = "PopcornTimeForAndroid";
public static final String PREFS_FILE = "PCT_Prefs";
public static final String DATABASE_NAME = "PCT_DB.db";
public static final Integer DATABASE_VERSION = 1;
public static final Integer SERVER_PORT = 55723;
public static final String BUGSNAG_KEY = "8ab4dda6780329b10aca038b86d506e5";
public static final String GIT_URL = "https://git.popcorntime.io/";
public static final String POPCORN_URL = "https://popcorntime.io/";
public static final String FB_URL = "https://fb.com/PopcornTimeTv";
public static final String BLOG_URL = "https://blog.popcorntime.io";
public static final String DISCUSS_URL = "https://discuss.popcorntime.io";
public static final String TWITTER_URL = "https://twitter.com/PopcornTimeTv";
public static final String JIRA_API = GIT_URL + "jira/rest/api/2/";
public static final String JIRA_PROJECT = "10200";
public static final String CAST_ID = "9A435985"; |
<<<<<<<
private ToolButton[] buttons = {
new ToolButton(R.drawable.brush64, R.string.button_brush, ToolType.BRUSH),
new ToolButton(R.drawable.cursor64, R.string.button_cursor, ToolType.CURSOR),
// new ToolButton(R.drawable.scroll64, R.string.button_choose, ToolType.SCROLL),
new ToolButton(R.drawable.pipette64, R.string.button_pipette, ToolType.PIPETTE),
new ToolButton(R.drawable.magic64, R.string.button_magic, ToolType.MAGIC),
new ToolButton(R.drawable.undo64, R.string.button_undo, ToolType.UNDO),
new ToolButton(R.drawable.redo64, R.string.button_redo, ToolType.REDO),
new ToolButton(R.drawable.stamp64, R.string.button_floating_box, ToolType.STAMP),
new ToolButton(R.drawable.import64, R.string.button_import_png, ToolType.IMPORTPNG),
new ToolButton(R.drawable.icon_crop, R.string.button_crop, ToolType.CROP) };
public ToolButtonAdapter(Context context) {
=======
private ArrayList<ToolButton> mButtonsList;
public ToolButtonAdapter(Context context, boolean fromCatrobat) {
>>>>>>>
private ToolButton[] buttons = {
new ToolButton(R.drawable.brush64, R.string.button_brush, ToolType.BRUSH),
new ToolButton(R.drawable.cursor64, R.string.button_cursor, ToolType.CURSOR),
// new ToolButton(R.drawable.scroll64, R.string.button_choose, ToolType.SCROLL),
new ToolButton(R.drawable.pipette64, R.string.button_pipette, ToolType.PIPETTE),
new ToolButton(R.drawable.magic64, R.string.button_magic, ToolType.MAGIC),
new ToolButton(R.drawable.undo64, R.string.button_undo, ToolType.UNDO),
new ToolButton(R.drawable.redo64, R.string.button_redo, ToolType.REDO),
new ToolButton(R.drawable.stamp64, R.string.button_floating_box, ToolType.STAMP),
new ToolButton(R.drawable.import64, R.string.button_import_png, ToolType.IMPORTPNG),
new ToolButton(R.drawable.icon_crop, R.string.button_crop, ToolType.CROP) };
private ArrayList<ToolButton> mButtonsList;
public ToolButtonAdapter(Context context, boolean fromCatrobat) { |
<<<<<<<
=======
mButtonsList.add(new ToolButton(R.drawable.brush64, R.string.button_brush, ToolType.BRUSH));
mButtonsList.add(new ToolButton(R.drawable.cursor64, R.string.button_cursor, ToolType.CURSOR));
mButtonsList.add(new ToolButton(R.drawable.pipette64, R.string.button_pipette, ToolType.PIPETTE));
mButtonsList.add(new ToolButton(R.drawable.magic64, R.string.button_magic, ToolType.MAGIC));
mButtonsList.add(new ToolButton(R.drawable.undo64, R.string.button_undo, ToolType.UNDO));
mButtonsList.add(new ToolButton(R.drawable.redo64, R.string.button_redo, ToolType.REDO));
mButtonsList.add(new ToolButton(R.drawable.stamp64, R.string.button_floating_box, ToolType.STAMP));
mButtonsList.add(new ToolButton(R.drawable.import64, R.string.button_import_png, ToolType.IMPORTPNG));
mButtonsList.add(new ToolButton(R.drawable.eraser_64, R.string.button_eraser, ToolType.ERASER));
mButtonsList.add(new ToolButton(R.drawable.icon_crop, R.string.button_crop, ToolType.CROP));
mButtonsList.add(new ToolButton(R.drawable.action64, R.string.button_flip, ToolType.FLIP));
>>>>>>> |
<<<<<<<
import at.tugraz.ist.paintroid.MainActivity.ToolType;
=======
import at.tugraz.ist.paintroid.MainActivity.ToolbarItem;
>>>>>>>
import at.tugraz.ist.paintroid.MainActivity.ToolType;
<<<<<<<
import at.tugraz.ist.zoomscroll.ZoomStatus;
/**
* Base class for on-Touch events on the DrawSurface
*
* Status: refactored 20.02.2011
* @author PaintroidTeam
* @version 6.0.4b
*/
=======
>>>>>>>
<<<<<<<
public boolean onDoubleTap(MotionEvent event)
{
switch (control_type) {
case BRUSH:
case CURSOR:
return surface.doubleTapEvent(event.getX(), event.getY());
default:
break;
=======
public boolean onDoubleTap(MotionEvent event) {
switch (controlType) {
case BRUSH:
return drawingSurface.doubleTapEvent(event.getX(), event.getY());
default:
break;
>>>>>>>
public boolean onDoubleTap(MotionEvent event)
{
switch (control_type) {
case BRUSH:
case CURSOR:
return drawingSurface.doubleTapEvent(event.getX(), event.getY());
default:
break;
<<<<<<<
// Actual Draw Control Type (set to init value ZOOM)
protected ToolType control_type = ToolType.ZOOM;
// Tolerance in pixel for drawing
protected static final float TOUCH_TOLERANCE = 4;
=======
protected ToolbarItem controlType = ToolbarItem.ZOOM;
>>>>>>>
// Actual Draw Control Type (set to init value ZOOM)
protected ToolType control_type = ToolType.ZOOM;
<<<<<<<
/**
* Sets the DrawControlType
*
* @param type The DrawControlType to set
*/
public void setControlType(ToolType type) {
control_type = type;
=======
public void setControlType(ToolbarItem type) {
controlType = type;
>>>>>>>
public void setControlType(ToolType type) {
control_type = type; |
<<<<<<<
MapHandler STRING_STRING_MAP_HANDLER = new StringStringMapHandler(
(engine, serviceName) -> engine.getFilePerKeyMap(serviceName));
=======
MapHandler STRING_STRING_MAP_HANDLER = new StringStringMapHandler((engine, serviceName) ->
engine.getFilePerKeyMap(serviceName));
>>>>>>>
MapHandler STRING_STRING_MAP_HANDLER = new StringStringMapHandler(
(engine, serviceName) -> engine.getFilePerKeyMap(serviceName));
<<<<<<<
MapHandler STRING_CHAR_SEQUENCE_MAP_HANDLER = new StringCharSequenceMapHandler((engine, serviceName) -> {
=======
MapHandler CHAR_CHAR_MAP_HANDLER = new CharCharMapHandler((engine, serviceName) -> {
>>>>>>>
MapHandler STRING_CHAR_SEQUENCE_MAP_HANDLER = new StringCharSequenceMapHandler((engine, serviceName) -> {
MapHandler CHAR_CHAR_MAP_HANDLER = new StringStringMapHandler((engine, serviceName) -> {
<<<<<<<
<V> BiConsumer<ValueOut, V> getKeyToWire();
<V> Function<ValueIn, V> getWireToKey();
<V> BiConsumer<ValueOut, V> getValueToWire();
<V> Function<ValueIn, V> getWireToValue();
<V> BiConsumer<ValueOut, Map.Entry<V, V>> getEntryToWire();
<V> Function<ValueIn, Map.Entry<V, V>> getWireToEntry();
=======
>>>>>>>
<V> BiConsumer<ValueOut, V> getKeyToWire();
<V> Function<ValueIn, V> getWireToKey();
<V> BiConsumer<ValueOut, V> getValueToWire();
<V> Function<ValueIn, V> getWireToValue();
<V> BiConsumer<ValueOut, Map.Entry<V, V>> getEntryToWire();
<V> Function<ValueIn, Map.Entry<V, V>> getWireToEntry(); |
<<<<<<<
NotificationCompat.Builder notification = new NotificationCompat.Builder(mContext, bundle.getString("channel"))
.setContentTitle(title)
.setContentText(bundle.getString("body"))
.setTicker(bundle.getString("ticker"))
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setAutoCancel(bundle.getBoolean("auto_cancel", true))
.setNumber((int)bundle.getDouble("number"))
.setSubText(bundle.getString("sub_text"))
.setVibrate(new long[]{0, DEFAULT_VIBRATION})
.setExtras(bundle.getBundle("data"));
=======
title = URLDecoder.decode( title, "UTF-8" );
String ticker = bundle.getString("ticker");
if (ticker != null) ticker = URLDecoder.decode( ticker, "UTF-8" );
String subText = bundle.getString("sub_text");
if (subText != null) subText = URLDecoder.decode( subText, "UTF-8" );
NotificationCompat.Builder notification = new NotificationCompat.Builder(mContext)
.setContentTitle(title)
.setContentText(body)
.setTicker(ticker)
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setAutoCancel(bundle.getBoolean("auto_cancel", true))
.setNumber(bundle.getInt("number", (int)bundle.getDouble("number")))
.setSubText(subText)
.setVibrate(new long[]{0, DEFAULT_VIBRATION})
.setExtras(bundle.getBundle("data"));
>>>>>>>
title = URLDecoder.decode( title, "UTF-8" );
String ticker = bundle.getString("ticker");
if (ticker != null) ticker = URLDecoder.decode( ticker, "UTF-8" );
String subText = bundle.getString("sub_text");
if (subText != null) subText = URLDecoder.decode( subText, "UTF-8" );
NotificationCompat.Builder notification = new NotificationCompat.Builder(mContext, bundle.getString("channel"))
.setContentTitle(title)
.setContentText(body)
.setTicker(ticker)
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setAutoCancel(bundle.getBoolean("auto_cancel", true))
.setNumber(bundle.getInt("number", (int)bundle.getDouble("number")))
.setSubText(subText)
.setVibrate(new long[]{0, DEFAULT_VIBRATION})
.setExtras(bundle.getBundle("data")); |
<<<<<<<
Bugsnag.onActivityResume(this);
getApp().startService();
CastingManager.getInstance(this).addListener(this);
}
@Override
protected void onPause() {
super.onPause();
Bugsnag.onActivityPause(this);
CastingManager.getInstance(this).removeListener(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
Bugsnag.onActivityDestroy(this);
=======
>>>>>>>
CastingManager.getInstance(this).addListener(this);
}
@Override
protected void onPause() {
super.onPause();
CastingManager.getInstance(this).removeListener(this); |
<<<<<<<
private static OkHttpClient sHttpClient;
private static Picasso sPicasso;
private static String sDefSystemLanguage;
private static PopcornApplication sInstance;
public PopcornApplication() {
sInstance = this;
}
public static PopcornApplication getInstance() {
return sInstance;
}
@Override
public void onCreate() {
super.onCreate();
sDefSystemLanguage = LocaleUtils.getCurrent();
Constants.DEBUG_ENABLED = false;
int versionCode = 0;
try {
=======
private static OkHttpClient sHttpClient;
private static String sDefSystemLanguage;
@Override
public void onCreate() {
super.onCreate();
sDefSystemLanguage = LocaleUtils.getCurrent();
Constants.DEBUG_ENABLED = false;
int versionCode = 0;
try {
>>>>>>>
private static OkHttpClient sHttpClient;
private static String sDefSystemLanguage;
private static PopcornApplication sInstance;
public PopcornApplication() {
sInstance = this;
}
public static PopcornApplication getInstance() {
return sInstance;
}
@Override
public void onCreate() {
super.onCreate();
sDefSystemLanguage = LocaleUtils.getCurrent();
Constants.DEBUG_ENABLED = false;
int versionCode = 0;
try {
<<<<<<<
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
sDefSystemLanguage = LocaleUtils.getCurrent();
}
public static String getSystemLanguage() {
return sDefSystemLanguage;
}
public static OkHttpClient getHttpClient() {
if (sHttpClient == null) {
sHttpClient = new OkHttpClient();
int cacheSize = 10 * 1024 * 1024;
try {
File cacheLocation = new File(PrefUtils.get(PopcornApplication.getAppContext(), Prefs.STORAGE_LOCATION,
StorageUtils.getIdealCacheDirectory(PopcornApplication.getAppContext()).toString()));
cacheLocation.mkdirs();
com.squareup.okhttp.Cache cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize);
sHttpClient.setCache(cache);
} catch (IOException e) {
e.printStackTrace();
}
}
return sHttpClient;
}
public static Picasso getPicasso() {
if (sPicasso == null) {
Picasso.Builder builder = new Picasso.Builder(getAppContext());
OkHttpDownloader downloader = new OkHttpDownloader(getHttpClient());
builder.downloader(downloader);
sPicasso = builder.build();
}
return sPicasso;
}
public static String getStreamDir() {
File path = new File(
PrefUtils.get(getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(getAppContext()).toString()));
File directory = new File(path, "/torrents/");
return directory.toString();
}
=======
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
sDefSystemLanguage = LocaleUtils.getCurrent();
}
public static String getSystemLanguage() {
return sDefSystemLanguage;
}
public static OkHttpClient getHttpClient() {
if (sHttpClient == null) {
sHttpClient = new OkHttpClient();
int cacheSize = 10 * 1024 * 1024;
try {
File cacheLocation = new File(PrefUtils.get(PopcornApplication.getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(PopcornApplication.getAppContext()).toString()));
cacheLocation.mkdirs();
com.squareup.okhttp.Cache cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize);
sHttpClient.setCache(cache);
} catch (IOException e) {
e.printStackTrace();
}
}
return sHttpClient;
}
public static String getStreamDir() {
File path = new File(PrefUtils.get(getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(getAppContext()).toString()));
File directory = new File(path, "/torrents/");
return directory.toString();
}
>>>>>>>
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
sDefSystemLanguage = LocaleUtils.getCurrent();
}
public static String getSystemLanguage() {
return sDefSystemLanguage;
}
public static OkHttpClient getHttpClient() {
if (sHttpClient == null) {
sHttpClient = new OkHttpClient();
int cacheSize = 10 * 1024 * 1024;
try {
File cacheLocation = new File(PrefUtils.get(PopcornApplication.getAppContext(), Prefs.STORAGE_LOCATION,
StorageUtils.getIdealCacheDirectory(PopcornApplication.getAppContext()).toString()));
cacheLocation.mkdirs();
com.squareup.okhttp.Cache cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize);
sHttpClient.setCache(cache);
} catch (IOException e) {
e.printStackTrace();
}
}
return sHttpClient;
}
public static String getStreamDir() {
File path = new File(
PrefUtils.get(getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(getAppContext()).toString()));
File directory = new File(path, "/torrents/");
return directory.toString();
} |
<<<<<<<
public static void addItemToWishlist(final Context context, final CompressedWishlistInfo wishlistInfo) {
final ArrayList<MtgCard> currentWishlist = ReadWishlist(context, false);
=======
public static void addItemToWishlist(final Activity activity, final CompressedWishlistInfo wishlistInfo) {
final ArrayList<MtgCard> currentWishlist = ReadWishlist(activity);
>>>>>>>
public static void addItemToWishlist(final Activity activity, final CompressedWishlistInfo wishlistInfo) {
final ArrayList<MtgCard> currentWishlist = ReadWishlist(activity, false);
<<<<<<<
* @param mCtx A context to open the file and pop toasts with
* @param loadFullData true to load all card data from the database, false to just read the file
=======
* @param activity A context to open the file and pop toasts with
>>>>>>>
* @param activity A context to open the file and pop toasts with
* @param loadFullData true to load all card data from the database, false to just read the file
<<<<<<<
public static ArrayList<MtgCard> ReadWishlist(Context mCtx, boolean loadFullData) {
=======
public static ArrayList<MtgCard> ReadWishlist(Activity activity) {
>>>>>>>
public static ArrayList<MtgCard> ReadWishlist(Activity activity, boolean loadFullData) {
<<<<<<<
MtgCard card = MtgCard.fromWishlistString(line, false, mCtx);
=======
MtgCard card = MtgCard.fromWishlistString(line, activity);
>>>>>>>
MtgCard card = MtgCard.fromWishlistString(line, false, activity); |
<<<<<<<
=======
import com.gelakinetic.mtgfam.helpers.database.CardDbAdapter;
import com.gelakinetic.mtgfam.helpers.database.DatabaseManager;
import com.gelakinetic.mtgfam.helpers.database.FamiliarDbException;
import com.gelakinetic.mtgfam.helpers.NumberButtonOnClickListener;
>>>>>>>
import com.gelakinetic.mtgfam.helpers.database.CardDbAdapter;
import com.gelakinetic.mtgfam.helpers.database.DatabaseManager;
import com.gelakinetic.mtgfam.helpers.database.FamiliarDbException;
import com.gelakinetic.mtgfam.helpers.NumberButtonOnClickListener; |
<<<<<<<
public synchronized @DrawableRes int getTapSymbol() {
return context.getResources().getIdentifier(
this.prefs.getString(context.getString(R.string.key_tap_symbol), "glyph_tap"),
"drawable",
context.getPackageName()
);
}
public synchronized @DrawableRes int getWhiteSymbol() {
return context.getResources().getIdentifier(
this.prefs.getString(context.getString(R.string.key_white_symbol), "glyph_w"),
"drawable",
context.getPackageName()
);
}
=======
/* General list settings (trades, wishlist, decklist) */
public synchronized int getUndoTimeout() {
return this.prefs.getInt(context.getString(R.string.key_undoTimeout), 3) * 1000;
}
public boolean getShowTotalDecklistPrice() {
return this.prefs.getBoolean(context.getString(R.string.key_showTotalPriceDecklistPref), false);
}
>>>>>>>
public synchronized @DrawableRes int getTapSymbol() {
return context.getResources().getIdentifier(
this.prefs.getString(context.getString(R.string.key_tap_symbol), "glyph_tap"),
"drawable",
context.getPackageName()
);
}
public synchronized @DrawableRes int getWhiteSymbol() {
return context.getResources().getIdentifier(
this.prefs.getString(context.getString(R.string.key_white_symbol), "glyph_w"),
"drawable",
context.getPackageName()
);
}
/* General list settings (trades, wishlist, decklist) */
public synchronized int getUndoTimeout() {
return this.prefs.getInt(context.getString(R.string.key_undoTimeout), 3) * 1000;
}
public boolean getShowTotalDecklistPrice() {
return this.prefs.getBoolean(context.getString(R.string.key_showTotalPriceDecklistPref), false);
} |
<<<<<<<
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
=======
import android.support.v4.content.ContextCompat;
>>>>>>>
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
<<<<<<<
mFormatButton.setTextColor(getResources().getColor(getResourceIdFromAttr(R.attr.color_text)));
mRarityButton.setTextColor(getResources().getColor(getResourceIdFromAttr(R.attr.color_text)));
=======
mSetButton.setTextColor(ContextCompat.getColor(getContext(), getResourceIdFromAttr(R.attr.color_text)));
mFormatButton.setTextColor(ContextCompat.getColor(getContext(), getResourceIdFromAttr(R.attr.color_text)));
mRarityButton.setTextColor(ContextCompat.getColor(getContext(), getResourceIdFromAttr(R.attr.color_text)));
>>>>>>>
mFormatButton.setTextColor(ContextCompat.getColor(getContext(), getResourceIdFromAttr(R.attr.color_text)));
mRarityButton.setTextColor(ContextCompat.getColor(getContext(), getResourceIdFromAttr(R.attr.color_text)));
<<<<<<<
=======
if (mSetCheckedIndices.length > 0) {
mSetButton.setTextColor(ContextCompat.getColor(getContext(), getResourceIdFromAttr(R.attr.colorPrimary_attr)));
}
>>>>>>> |
<<<<<<<
import com.gelakinetic.mtgfam.helpers.ToastWrapper;
=======
import com.gelakinetic.mtgfam.helpers.DecklistHelpers.CompressedDecklistInfo;
import com.gelakinetic.mtgfam.helpers.SnackbarWrapper;
import com.gelakinetic.mtgfam.helpers.database.CardDbAdapter;
import com.gelakinetic.mtgfam.helpers.database.DatabaseManager;
import com.gelakinetic.mtgfam.helpers.database.FamiliarDbException;
import com.gelakinetic.mtgfam.helpers.database.FamiliarDbHandle;
>>>>>>>
import com.gelakinetic.mtgfam.helpers.SnackbarWrapper; |
<<<<<<<
import android.widget.CheckBox;
import android.widget.CompoundButton;
=======
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
>>>>>>>
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
<<<<<<<
import org.mozilla.mozstumbler.service.Prefs;
import org.mozilla.mozstumbler.service.core.logging.Log;
=======
import org.mozilla.mozstumbler.service.Prefs;
import static org.mozilla.mozstumbler.R.string;
>>>>>>>
import org.mozilla.mozstumbler.service.Prefs;
import org.mozilla.mozstumbler.service.core.logging.Log;
import static org.mozilla.mozstumbler.R.string;
<<<<<<<
setupSaveJSONLogs();
setupBatterySaver();
return mRootView;
}
private void setupSaveJSONLogs() {
boolean saveStumbleLogs = Prefs.getInstance().isSaveStumbleLogs();
CheckBox button = (CheckBox) mRootView.findViewById(R.id.toggleSaveStumbleLogs);
button.setChecked(saveStumbleLogs);
button.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
onToggleSaveStumbleLogs(isChecked);
}
});
}
private void setupBatterySaver() {
=======
// Setup for any logical group of config options should self contained in their
// own methods. This is mostly to help with merges in the event that multiple
// source branches update the developer options.
setupSimulationPreference();
setupLowBatterySpinner();
setupLocationChangeSpinners();
return mRootView;
}
private void setupLowBatterySpinner() {
final ClientPrefs cPrefs = ClientPrefs.getInstance(mRootView.getContext());
>>>>>>>
// Setup for any logical group of config options should self contained in their
// own methods. This is mostly to help with merges in the event that multiple
// source branches update the developer options.
setupSaveJSONLogs();
setupSimulationPreference();
setupLowBatterySpinner();
setupLocationChangeSpinners();
return mRootView;
}
private void setupSaveJSONLogs() {
boolean saveStumbleLogs = Prefs.getInstanceWithoutContext().isSaveStumbleLogs();
CheckBox button = (CheckBox) mRootView.findViewById(R.id.toggleSaveStumbleLogs);
button.setChecked(saveStumbleLogs);
button.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
onToggleSaveStumbleLogs(isChecked);
}
});
}
private void setupLowBatterySpinner() {
final ClientPrefs cPrefs = ClientPrefs.getInstance(mRootView.getContext());
<<<<<<<
final ArrayAdapter<String> adapter = (ArrayAdapter<String>)spinnerAdapter;
final int percent = ClientPrefs.getInstance().getMinBatteryPercent();
=======
final ArrayAdapter<String> adapter = (ArrayAdapter<String>)spinnerAdapter;
final int percent = cPrefs.getMinBatteryPercent();
>>>>>>>
final ArrayAdapter<String> adapter = (ArrayAdapter<String>)spinnerAdapter;
final int percent = cPrefs.getMinBatteryPercent();
<<<<<<<
=======
simResetBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(android.view.View view) {
ClientPrefs cPrefs = ClientPrefs.getInstance(mRootView.getContext());
cPrefs.clearSimulationStart();
Context btnCtx = simResetBtn.getContext();
Toast.makeText(btnCtx,
btnCtx.getText(R.string.reset_simulation_start),
Toast.LENGTH_SHORT).show();
}
});
}
private void onToggleSimulation(boolean isChecked) {
Prefs.getInstance(mRootView.getContext()).setSimulateStumble(isChecked);
}
private void setupLocationChangeSpinners() {
final ClientPrefs cPrefs = ClientPrefs.getInstance(mRootView.getContext());
>>>>>>>
simResetBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(android.view.View view) {
ClientPrefs cPrefs = ClientPrefs.getInstance(mRootView.getContext());
cPrefs.clearSimulationStart();
Context btnCtx = simResetBtn.getContext();
Toast.makeText(btnCtx,
btnCtx.getText(R.string.reset_simulation_start),
Toast.LENGTH_SHORT).show();
}
});
}
private void setupLocationChangeSpinners() {
final ClientPrefs cPrefs = ClientPrefs.getInstance(mRootView.getContext());
<<<<<<<
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
=======
@Override
public void onNothingSelected(AdapterView<?> arg0) {}
>>>>>>>
@Override
public void onNothingSelected(AdapterView<?> arg0) {} |
<<<<<<<
import android.widget.Button;
=======
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
>>>>>>>
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
<<<<<<<
=======
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
>>>>>>>
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
<<<<<<<
=======
final Spinner batterySpinner = (Spinner) mRootView.findViewById(R.id.spinnerBatteryPercent);
final SpinnerAdapter spinnerAdapter = batterySpinner.getAdapter();
assert(spinnerAdapter instanceof ArrayAdapter);
@SuppressWarnings("unchecked")
final ArrayAdapter<String> adapter = (ArrayAdapter<String>)spinnerAdapter;
final int percent = ClientPrefs.getInstance().getMinBatteryPercent();
final int spinnerPosition = adapter.getPosition(percent + "%");
batterySpinner.setSelection(spinnerPosition);
batterySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1, int position, long id) {
String item = parent.getItemAtPosition(position).toString().replace("%", "");
int percent = Integer.valueOf(item);
ClientPrefs prefs = ClientPrefs.createGlobalInstance(getActivity().getApplicationContext());
prefs.setMinBatteryPercent(percent);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {}
});
>>>>>>>
private void setupLowBatterySpinner() {
final Spinner batterySpinner = (Spinner) mRootView.findViewById(R.id.spinnerBatteryPercent);
final SpinnerAdapter spinnerAdapter = batterySpinner.getAdapter();
assert(spinnerAdapter instanceof ArrayAdapter);
@SuppressWarnings("unchecked")
final ArrayAdapter<String> adapter = (ArrayAdapter<String>)spinnerAdapter;
final int percent = ClientPrefs.getInstance().getMinBatteryPercent();
final int spinnerPosition = adapter.getPosition(percent + "%");
batterySpinner.setSelection(spinnerPosition);
batterySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1, int position, long id) {
String item = parent.getItemAtPosition(position).toString().replace("%", "");
int percent = Integer.valueOf(item);
ClientPrefs prefs = ClientPrefs.createGlobalInstance(getActivity().getApplicationContext());
prefs.setMinBatteryPercent(percent);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {}
});
} |
<<<<<<<
=======
import org.acra.ACRA;
import org.mozilla.mozstumbler.service.AppGlobals;
>>>>>>>
import org.acra.ACRA;
<<<<<<<
public class DataStorageManager implements IDataStorageManager {
ILogger Log = (ILogger) ServiceLocator.getInstance().getService(ILogger.class);
=======
public class DataStorageManager {
private static ILogger Log = (ILogger) ServiceLocator.getInstance().getService(ILogger.class);
>>>>>>>
public class DataStorageManager implements IDataStorageManager {
private static ILogger Log = (ILogger) ServiceLocator.getInstance().getService(ILogger.class); |
<<<<<<<
import android.telephony.TelephonyManager;
=======
>>>>>>>
import android.telephony.TelephonyManager;
<<<<<<<
=======
import org.mozilla.mozstumbler.service.Prefs;
import org.mozilla.mozstumbler.service.core.logging.Log;
import org.mozilla.mozstumbler.service.stumblerthread.Reporter;
>>>>>>>
import org.mozilla.mozstumbler.service.Prefs;
import org.mozilla.mozstumbler.service.core.logging.Log;
import org.mozilla.mozstumbler.service.stumblerthread.Reporter;
<<<<<<<
public interface CellScannerImpl {
void start();
boolean isStarted();
boolean isSupportedOnThisDevice();
void stop();
List<CellInfo> getCellInfo();
}
=======
public CellScanner(Context appCtx) {
mAppContext = appCtx;
>>>>>>>
public CellScanner(Context appCtx) {
mAppContext = appCtx;
<<<<<<<
final long curTime = System.currentTimeMillis();
=======
>>>>>>> |
<<<<<<<
setActiveLocationUpdatesEnabled(false);
}
public void setActiveLocationUpdatesEnabled(boolean enable) {
if (enable) {
// enable NetworkLocationListener first because GpsLocationListener will disable it
enableLocationListener(true, mNetworkLocationListener);
enableLocationListener(true, mGpsLocationListener);
} else {
// disable GpsLocationListener first because it might enable NetworkLocationListener
enableLocationListener(false, mGpsLocationListener);
enableLocationListener(false, mNetworkLocationListener);
}
=======
enableLocationListener(false, mGpsLocationListener);
enableLocationListener(false, mNetworkLocationListener);
enableLocationListener(false, mPassiveLocationListener);
>>>>>>>
setActiveLocationUpdatesEnabled(false);
enableLocationListener(false, mPassiveLocationListener);
}
public void setActiveLocationUpdatesEnabled(boolean enable) {
if (enable) {
// enable NetworkLocationListener first because GpsLocationListener will disable it
enableLocationListener(true, mNetworkLocationListener);
enableLocationListener(true, mGpsLocationListener);
} else {
// disable GpsLocationListener first because it might enable NetworkLocationListener
enableLocationListener(false, mGpsLocationListener);
enableLocationListener(false, mNetworkLocationListener);
} |
<<<<<<<
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
=======
>>>>>>>
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
<<<<<<<
import org.mozilla.mozstumbler.service.Prefs;
import static org.mozilla.mozstumbler.R.string;
=======
import org.mozilla.mozstumbler.service.stumblerthread.motiondetection.LocationChangeSensor;
import org.mozilla.mozstumbler.service.stumblerthread.motiondetection.MotionSensor;
import org.mozilla.mozstumbler.service.utils.BatteryCheckReceiver;
>>>>>>>
import org.mozilla.mozstumbler.service.Prefs;
import static org.mozilla.mozstumbler.R.string;
import org.mozilla.mozstumbler.service.stumblerthread.motiondetection.LocationChangeSensor;
import org.mozilla.mozstumbler.service.stumblerthread.motiondetection.MotionSensor;
import org.mozilla.mozstumbler.service.utils.BatteryCheckReceiver;
<<<<<<<
private void setupSimulationPreference() {
boolean simulationEnabled = Prefs.getInstance().isSimulateStumble();
final CheckBox simCheckBox = (CheckBox) mRootView.findViewById(R.id.toggleSimulation);
final Button simResetBtn = (Button) mRootView.findViewById(R.id.buttonClearSimulationDefault);
if (!AppGlobals.isDebug) {
simCheckBox.setEnabled(false);
simResetBtn.setEnabled(false);
return;
}
simCheckBox.setChecked(simulationEnabled);
simCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
onToggleSimulation(isChecked);
}
});
simResetBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(android.view.View view) {
ClientPrefs cPrefs = ClientPrefs.getInstance();
cPrefs.clearSimulationStart();
Context btnCtx = simResetBtn.getContext();
Toast.makeText(btnCtx,
btnCtx.getText(R.string.reset_simulation_start),
Toast.LENGTH_SHORT).show();
}
});
}
private void onToggleSimulation(boolean isChecked) {
Prefs.getInstance().setSimulateStumble(isChecked);
=======
final String[] distanceArray = {"30 m", "50 m", "75 m", "100 m", "125 m", "150 m", "175 m", "200 m"};
final ArrayAdapter<String> distanceAdapter =
new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, distanceArray);
final Spinner distanceSpinner = (Spinner) mRootView.findViewById(R.id.spinnerMotionDetectionDistanceMeters);
distanceSpinner.setAdapter(distanceAdapter);
final int dist = ClientPrefs.getInstance().getMotionChangeDistanceMeters();
distanceSpinner.setSelection(findIndexOf(dist, distanceArray));
distanceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1, int position, long id) {
changeOfMotionDetectionDistanceOrTime(parent, position, IsDistanceOrTime.DISTANCE);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {}
});
final String[] timeArray = {"5 s", "30 s", "60 s", "90 s", "120 s", "180 s", "210 s", "240 s", "270 s", "300 s"};
final ArrayAdapter<String> timeAdapter =
new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, timeArray);
final Spinner timeSpinner = (Spinner) mRootView.findViewById(R.id.spinnerMotionDetectionTimeSeconds);
timeSpinner.setAdapter(timeAdapter);
final int time = ClientPrefs.getInstance().getMotionChangeTimeWindowSeconds();
timeSpinner.setSelection(findIndexOf(time, timeArray));
timeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1, int position, long id) {
changeOfMotionDetectionDistanceOrTime(parent, position, IsDistanceOrTime.TIME);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {}
});
return mRootView;
>>>>>>>
private void setupSimulationPreference() {
boolean simulationEnabled = Prefs.getInstance().isSimulateStumble();
final CheckBox simCheckBox = (CheckBox) mRootView.findViewById(R.id.toggleSimulation);
final Button simResetBtn = (Button) mRootView.findViewById(R.id.buttonClearSimulationDefault);
if (!AppGlobals.isDebug) {
simCheckBox.setEnabled(false);
simResetBtn.setEnabled(false);
return;
}
simCheckBox.setChecked(simulationEnabled);
simCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
onToggleSimulation(isChecked);
}
});
simResetBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(android.view.View view) {
ClientPrefs cPrefs = ClientPrefs.getInstance();
cPrefs.clearSimulationStart();
Context btnCtx = simResetBtn.getContext();
Toast.makeText(btnCtx,
btnCtx.getText(R.string.reset_simulation_start),
Toast.LENGTH_SHORT).show();
}
});
}
private void onToggleSimulation(boolean isChecked) {
Prefs.getInstance().setSimulateStumble(isChecked);
}
private void setupLocationChangeSpinners() {
final String[] distanceArray = {"30 m", "50 m", "75 m", "100 m", "125 m", "150 m", "175 m", "200 m"};
final ArrayAdapter<String> distanceAdapter =
new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, distanceArray);
final Spinner distanceSpinner = (Spinner) mRootView.findViewById(R.id.spinnerMotionDetectionDistanceMeters);
distanceSpinner.setAdapter(distanceAdapter);
final int dist = ClientPrefs.getInstance().getMotionChangeDistanceMeters();
distanceSpinner.setSelection(findIndexOf(dist, distanceArray));
distanceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1, int position, long id) {
changeOfMotionDetectionDistanceOrTime(parent, position, IsDistanceOrTime.DISTANCE);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {}
});
final String[] timeArray = {"5 s", "30 s", "60 s", "90 s", "120 s", "180 s", "210 s", "240 s", "270 s", "300 s"};
final ArrayAdapter<String> timeAdapter =
new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, timeArray);
final Spinner timeSpinner = (Spinner) mRootView.findViewById(R.id.spinnerMotionDetectionTimeSeconds);
timeSpinner.setAdapter(timeAdapter);
final int time = ClientPrefs.getInstance().getMotionChangeTimeWindowSeconds();
timeSpinner.setSelection(findIndexOf(time, timeArray));
timeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View arg1, int position, long id) {
changeOfMotionDetectionDistanceOrTime(parent, position, IsDistanceOrTime.TIME);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {}
}); |
<<<<<<<
import org.mozilla.mozstumbler.service.utils.NetworkInfo;
=======
import org.mozilla.mozstumbler.service.stumblerthread.datahandling.DataStorageContract;
import org.mozilla.mozstumbler.service.utils.NetworkUtils;
>>>>>>>
import org.mozilla.mozstumbler.service.utils.NetworkInfo;
import org.mozilla.mozstumbler.service.stumblerthread.datahandling.DataStorageContract;
<<<<<<<
public void setMLSQuery(JSONObject ichnaeaQueryObj) {
mMLSQuery = ichnaeaQueryObj;
=======
public void setMLSQuery(JSONObject queryCellAndWifi) {
mMLSQuery = queryCellAndWifi;
try {
mHasCellScan = mMLSQuery.getInt(DataStorageContract.ReportsColumns.CELL_COUNT) > 0;
mHasWifiScan = mMLSQuery.getInt(DataStorageContract.ReportsColumns.WIFI_COUNT) > 0;
} catch (JSONException ex) {}
>>>>>>>
public void setMLSQuery(JSONObject ichnaeaQueryObj) {
mMLSQuery = ichnaeaQueryObj;
try {
mHasCellScan = mMLSQuery.getInt(DataStorageContract.ReportsColumns.CELL_COUNT) > 0;
mHasWifiScan = mMLSQuery.getInt(DataStorageContract.ReportsColumns.WIFI_COUNT) > 0;
} catch (JSONException ex) {} |
<<<<<<<
import org.mozilla.mozstumbler.service.Prefs;
=======
import org.mozilla.mozstumbler.service.stumblerthread.motiondetection.LocationChangeSensor;
import org.mozilla.mozstumbler.service.stumblerthread.motiondetection.MotionSensor;
>>>>>>>
import org.mozilla.mozstumbler.service.AppGlobals;
import org.mozilla.mozstumbler.service.Prefs;
import org.mozilla.mozstumbler.service.core.logging.Log;
<<<<<<<
public synchronized void startScanning(Context ctx) {
Log.d(LOG_TAG, "ScanManager::startScanning");
if (this.isScanning()) {
=======
public synchronized void startScanning(Context context) {
if (isScanning()) {
>>>>>>>
public synchronized void startScanning(Context ctx) {
Log.d(LOG_TAG, "ScanManager::startScanning");
if (isScanning()) {
<<<<<<<
=======
mIsMotionlessPausedState = false;
if (mLocationChangeSensor == null) {
mLocationChangeSensor = new LocationChangeSensor(mContext, mDetectUserIdleReceiver);
}
mLocationChangeSensor.start();
if (mMotionSensor == null) {
mMotionSensor = new MotionSensor(mContext, mDetectMotionReceiver);
}
if (mGPSScanner == null) {
mGPSScanner = new GPSScanner(context, this);
mWifiScanner = new WifiScanner(context);
mCellScanner = new CellScanner(context);
}
>>>>>>>
mIsMotionlessPausedState = false;
if (mLocationChangeSensor == null) {
mLocationChangeSensor = new LocationChangeSensor(mAppContext, mDetectUserIdleReceiver);
}
mLocationChangeSensor.start();
if (mMotionSensor == null) {
mMotionSensor = new MotionSensor(mAppContext, mDetectMotionReceiver);
}
if (mGPSScanner == null) {
mGPSScanner = new GPSScanner(mAppContext, this);
mWifiScanner = new WifiScanner(mAppContext);
mCellScanner = new CellScanner(mAppContext);
} |
<<<<<<<
=======
>>>>>>> |
<<<<<<<
void captureCharacterDataFromObservedStates(){
if (observedStates ==null){
if (data != null)
data.removeListener(this);
data = null;
}
else {
CharacterData temp = observedStates.getParentData();
if (temp != data){
if (data != null)
data.removeListener(this);
if (temp != null)
temp.addListenerHighPriority(this);
data = temp;
}
}
}
public CharacterData getCharacterData(){
return data;
}
=======
/*.................................................................................................................*/
public boolean arrowTouchInRow(int ic, int x, int y, boolean doubleClick, int modifiers){
if (MesquiteEvent.rightClick(modifiers)) {
MesquitePopup popup = new MesquitePopup(table.getMatrixPanel());
MesquiteCommand mcCopy = makeCommand("copyData", this);
mcCopy.setDefaultArguments(""+ic);
MesquiteCheckMenuItem mCopyItem = new MesquiteCheckMenuItem("Copy Data", this, mcCopy, null, null);
popup.add(mCopyItem);
MesquiteCommand mcPaste = makeCommand("pasteData", this); //only if something in clipboard
mcPaste.setDefaultArguments(""+ic);
MesquiteCheckMenuItem mPasteItem = new MesquiteCheckMenuItem("Paste Data", this, mcPaste, null, null);
popup.add(mPasteItem);
MesquiteCommand mcDelete = makeCommand("deleteDataTouched", this);
mcDelete.setDefaultArguments(""+ic);
MesquiteCheckMenuItem mDeleteItem = new MesquiteCheckMenuItem("Delete Data", this, mcDelete, null, null);
popup.add(mDeleteItem);
popup.showPopup(x,y+18);
}
return false;
}
>>>>>>>
void captureCharacterDataFromObservedStates(){
if (observedStates ==null){
if (data != null)
data.removeListener(this);
data = null;
}
else {
CharacterData temp = observedStates.getParentData();
if (temp != data){
if (data != null)
data.removeListener(this);
if (temp != null)
temp.addListenerHighPriority(this);
data = temp;
}
}
}
public CharacterData getCharacterData(){
return data;
}
/*.................................................................................................................*/
public boolean arrowTouchInRow(int ic, int x, int y, boolean doubleClick, int modifiers){
if (MesquiteEvent.rightClick(modifiers)) {
MesquitePopup popup = new MesquitePopup(table.getMatrixPanel());
MesquiteCommand mcCopy = makeCommand("copyData", this);
mcCopy.setDefaultArguments(""+ic);
MesquiteCheckMenuItem mCopyItem = new MesquiteCheckMenuItem("Copy Data", this, mcCopy, null, null);
popup.add(mCopyItem);
MesquiteCommand mcPaste = makeCommand("pasteData", this); //only if something in clipboard
mcPaste.setDefaultArguments(""+ic);
MesquiteCheckMenuItem mPasteItem = new MesquiteCheckMenuItem("Paste Data", this, mcPaste, null, null);
popup.add(mPasteItem);
MesquiteCommand mcDelete = makeCommand("deleteDataTouched", this);
mcDelete.setDefaultArguments(""+ic);
MesquiteCheckMenuItem mDeleteItem = new MesquiteCheckMenuItem("Delete Data", this, mcDelete, null, null);
popup.add(mDeleteItem);
popup.showPopup(x,y+18);
}
return false;
} |
<<<<<<<
int startLine = charCoords.y;
while (startLine > - getScrollBuffer().getLineCount()
&& myBackBuffer.getLine(startLine - 1).isWrapped()) {
startLine--;
}
int endLine = charCoords.y;
while (endLine < myBackBuffer.getHeight()
&& myBackBuffer.getLine(endLine).isWrapped()) {
endLine++;
}
mySelection = new TerminalSelection(new Point(0, startLine));
mySelection.updateEnd(new Point(myTermSize.width, endLine), myTermSize.width);
=======
mySelection = new TerminalSelection(new Point(0, charCoords.y));
mySelection.updateEnd(new Point(myTermSize.width, charCoords.y), myTermSize.width);
if (mySettingsProvider.emulateX11CopyPaste()) {
handleCopy(false);
}
>>>>>>>
int startLine = charCoords.y;
while (startLine > - getScrollBuffer().getLineCount()
&& myBackBuffer.getLine(startLine - 1).isWrapped()) {
startLine--;
}
int endLine = charCoords.y;
while (endLine < myBackBuffer.getHeight()
&& myBackBuffer.getLine(endLine).isWrapped()) {
endLine++;
}
mySelection = new TerminalSelection(new Point(0, startLine));
mySelection.updateEnd(new Point(myTermSize.width, endLine), myTermSize.width);
if (mySettingsProvider.emulateX11CopyPaste()) {
handleCopy(false);
} |
<<<<<<<
=======
public void addModelListener(TerminalModelListener listener) {
myListeners.add(listener);
}
public void removeModelListener(TerminalModelListener listener) {
myListeners.remove(listener);
}
private void fireModelChangeEvent() {
for (TerminalModelListener modelListener: myListeners) {
modelListener.modelChanged();
}
}
>>>>>>>
public void addModelListener(TerminalModelListener listener) {
myListeners.add(listener);
}
public void removeModelListener(TerminalModelListener listener) {
myListeners.remove(listener);
}
private void fireModelChangeEvent() {
for (TerminalModelListener modelListener: myListeners) {
modelListener.modelChanged();
}
}
<<<<<<<
=======
fireModelChangeEvent();
>>>>>>>
fireModelChangeEvent();
<<<<<<<
=======
fireModelChangeEvent();
>>>>>>>
fireModelChangeEvent();
<<<<<<<
=======
fireModelChangeEvent();
>>>>>>>
fireModelChangeEvent();
<<<<<<<
myScreenBuffer.processLines(yStart - getScreenLinesCount(), Math.min(yCount, myScreenBuffer.getLineCount()), consumer);
}
public void processBufferRows(final int startRow, final int height, final StyledTextConsumer consumer) {
processScreenLine(startRow, height, consumer);
}
public void processScreenLine(final int startRow,
final int height,
final StyledTextConsumer consumer) {
final int endRow = startRow + height;
myLock.lock();
try {
for (int row = startRow; row < endRow; row++) {
processScreenLine(row, consumer);
}
} finally {
myLock.unlock();
}
}
public void processScreenLine(int line, StyledTextConsumer consumer) {
myScreenBuffer.processLines(line, 1, consumer);
}
=======
myScreenBuffer.processLines(yStart, yCount, consumer);
}
>>>>>>>
myScreenBuffer.processLines(yStart, yCount, consumer);
} |
<<<<<<<
@Override
public void setVolume(float volume) {
currentVolume = volume;
player.setVolume(volume, volume);
}
@Override
public float getVolume() {
return currentVolume;
}
=======
@Override
public int getCurrentTimestamp () {
return player.getCurrentPosition();
}
>>>>>>>
@Override
public void setVolume(float volume) {
currentVolume = volume;
player.setVolume(volume, volume);
}
@Override
public float getVolume() {
return currentVolume;
}
@Override public int getCurrentTimestamp () {
return player.getCurrentPosition();
} |
<<<<<<<
=======
import android.os.Parcelable;
import android.util.Log;
>>>>>>>
import android.os.Parcelable;
<<<<<<<
private static String WECHAT_DETAILS_EN = "Details";
private static String WECHAT_DETAILS_CH = "红包详情";
private static String WECHAT_BETTER_LUCK_EN = "Better luck next time!";
private static String WECHAT_BETTER_LUCK_CH = "手慢了";
private static String WECHAT_OPEN_EN = "Open";
private static String WECHAT_OPENED_EN = "You've opened";
private static String WECHAT_OPEN_CH = "拆红包";
private static String WECHAT_VIEW_SELF_CH = "查看红包";
private static String WECHAT_VIEW_OTHERS_CH = "领取红包";
private static String WECHAT_DEFAULT_TEXT_EN = "Best wishes!";
private static String WECHAT_DEFAULT_TEXT_CH = "恭喜发财,大吉大利!";
private static int MAX_CACHE_TOLERANCE = 5000;
=======
private String WECHAT_DETAILS_EN = "Details";
private String WECHAT_DETAILS_CH = "红包详情";
private String WECHAT_BETTER_LUCK_EN = "Better luck next time!";
private String WECHAT_BETTER_LUCK_CH = "手慢了";
private String WECHAT_OPEN_EN = "Open";
private String WECHAT_OPENED_EN = "opened";
private String WECHAT_OPEN_CH = "拆红包";
private String WECHAT_VIEW_SELF_CH = "查看红包";
private String WECHAT_VIEW_OTHERS_CH = "领取红包";
private String WECHAT_DEFAULT_TEXT_EN = "Best wishes!";
private String WECHAT_DEFAULT_TEXT_CH = "恭喜发财,大吉大利!";
private final static String NOTIFICATION_TIP = "[微信红包]";
private int MAX_DURATION_TOLERANCE = 5000;
>>>>>>>
private static final String WECHAT_DETAILS_EN = "Details";
private static final String WECHAT_DETAILS_CH = "红包详情";
private static final String WECHAT_BETTER_LUCK_EN = "Better luck next time!";
private static final String WECHAT_BETTER_LUCK_CH = "手慢了";
private static final String WECHAT_OPEN_EN = "Open";
private static final String WECHAT_OPENED_EN = "You've opened";
private static final String WECHAT_OPEN_CH = "拆红包";
private static final String WECHAT_VIEW_SELF_CH = "查看红包";
private static final String WECHAT_VIEW_OTHERS_CH = "领取红包";
private static final String WECHAT_DEFAULT_TEXT_EN = "Best wishes!";
private static final String WECHAT_DEFAULT_TEXT_CH = "恭喜发财,大吉大利!";
private final static String WECHAT_NOTIFICATION_TIP = "[微信红包]";
private static final int MAX_CACHE_TOLERANCE = 5000;
private boolean mCycle = false;
<<<<<<<
=======
Log.d("111", "0");
>>>>>>>
<<<<<<<
=======
Log.d("111", "1");
>>>>>>>
mCycle = true; |
<<<<<<<
public HaeinsaResult get(@Nullable Transaction tx, HaeinsaGet get) throws IOException {
Preconditions.checkNotNull(get);
if (tx == null){
return getWithoutTx(get);
}
=======
public HaeinsaResult get(HaeinsaTransaction tx, HaeinsaGet get) throws IOException {
>>>>>>>
public HaeinsaResult get(@Nullable HaeinsaTransaction tx, HaeinsaGet get) throws IOException {
Preconditions.checkNotNull(get);
if (tx == null){
return getWithoutTx(get);
}
<<<<<<<
public HaeinsaResultScanner getScanner(@Nullable Transaction tx, HaeinsaScan scan)
=======
public HaeinsaResultScanner getScanner(HaeinsaTransaction tx, HaeinsaScan scan)
>>>>>>>
public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, HaeinsaScan scan)
<<<<<<<
public HaeinsaResultScanner getScanner(@Nullable Transaction tx,
=======
public HaeinsaResultScanner getScanner(HaeinsaTransaction tx,
>>>>>>>
public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx,
<<<<<<<
public void put(Transaction tx, HaeinsaPut put) throws IOException {
Preconditions.checkNotNull(tx);
Preconditions.checkNotNull(put);
=======
public void put(HaeinsaTransaction tx, HaeinsaPut put) throws IOException {
>>>>>>>
public void put(HaeinsaTransaction tx, HaeinsaPut put) throws IOException {
Preconditions.checkNotNull(tx);
Preconditions.checkNotNull(put);
<<<<<<<
public void put(Transaction tx, List<HaeinsaPut> puts) throws IOException {
Preconditions.checkNotNull(tx);
Preconditions.checkNotNull(puts);
=======
public void put(HaeinsaTransaction tx, List<HaeinsaPut> puts) throws IOException {
>>>>>>>
public void put(HaeinsaTransaction tx, List<HaeinsaPut> puts) throws IOException {
Preconditions.checkNotNull(tx);
Preconditions.checkNotNull(puts);
<<<<<<<
public void delete(Transaction tx, HaeinsaDelete delete) throws IOException {
Preconditions.checkNotNull(tx);
Preconditions.checkNotNull(delete);
=======
public void delete(HaeinsaTransaction tx, HaeinsaDelete delete) throws IOException {
>>>>>>>
public void delete(HaeinsaTransaction tx, HaeinsaDelete delete) throws IOException {
Preconditions.checkNotNull(tx);
Preconditions.checkNotNull(delete); |
<<<<<<<
* Creates an identifier from a string for the given authority.
*/
private ReferenceIdentifier createIdentifier(final Citation authority, final String identifier) {
if (authority == getAuthority()) {
return new ImmutableIdentifier(authority, getCodeSpace(), identifier, getVersion(), null);
} else {
// Do not use the version information since it applies to the default authority rather than the given one.
return new ImmutableIdentifier(authority, Citations.getCodeSpace(authority), identifier);
}
}
/**
=======
>>>>>>>
<<<<<<<
properties.put("description", description);
=======
/*
* Convert to InternationalString now in order to share the same instance if
* the same description is used both for an Identifier and an IdentifiedObject.
*/
properties.put(Identifier.DESCRIPTION_KEY, Types.toInternationalString(description));
>>>>>>>
/*
* Convert to InternationalString now in order to share the same instance if
* the same description is used both for an Identifier and an IdentifiedObject.
*/
properties.put("description", Types.toInternationalString(description)); |
<<<<<<<
=======
import org.apache.sis.internal.jdk8.DateTimeException;
import org.opengis.feature.Feature;
import org.opengis.feature.FeatureType;
import org.opengis.feature.PropertyType;
import org.opengis.feature.AttributeType;
>>>>>>>
import org.opengis.feature.Feature;
import org.opengis.feature.FeatureType;
import org.opengis.feature.PropertyType;
import org.opengis.feature.AttributeType; |
<<<<<<<
import org.opengis.referencing.ReferenceIdentifier;
=======
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.metadata.NameMeaning;
>>>>>>>
import org.opengis.referencing.ReferenceIdentifier;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.metadata.NameMeaning;
<<<<<<<
* {@linkplain IdentifiedObject#getAlias() aliases} which are instance of {@link ReferenceIdentifier}.
* This iterator is used for {@link AbstractIdentifiedObject} marshalling because GML merges the name and
* aliases in a single {@code <gml:name>} property.
=======
* {@linkplain IdentifiedObject#getAlias() aliases} which are instance of {@link Identifier}.
* This iterator is used for {@link AbstractIdentifiedObject} XML marshalling because GML merges the name
* and aliases in a single {@code <gml:name>} property. However this iterator is useful only if the aliases
* are instances of {@link NamedIdentifier}, or any other implementation which is both a name and an identifier.
>>>>>>>
* {@linkplain IdentifiedObject#getAlias() aliases} which are instance of {@link ReferenceIdentifier}.
* This iterator is used for {@link AbstractIdentifiedObject} XML marshalling because GML merges the name
* and aliases in a single {@code <gml:name>} property. However this iterator is useful only if the aliases
* are instances of {@link NamedIdentifier}, or any other implementation which is both a name and an identifier.
<<<<<<<
* @version 0.4
=======
* @version 0.7
>>>>>>>
* @version 0.7 |
<<<<<<<
import org.opengis.metadata.citation.ResponsibleParty;
import org.opengis.metadata.citation.Series;
import org.opengis.metadata.constraint.Constraints;
import org.opengis.metadata.content.ContentInformation;
import org.opengis.metadata.distribution.Distribution;
import org.opengis.metadata.distribution.Format;
=======
import org.opengis.metadata.citation.Responsibility;
>>>>>>>
import org.opengis.metadata.citation.ResponsibleParty;
<<<<<<<
* @deprecated As of SIS 1.0, replaced by {@link #getLocalesAndCharsets()}.
*/
@Override
@Deprecated
public Collection<Locale> getLanguages() {
return Collections.emptySet(); // We use 'Set' because we handle 'Locale' like a CodeList.
}
/**
* @deprecated As of SIS 1.0, replaced by {@link #getLocalesAndCharsets()}.
*/
@Override
@Deprecated
public Locale getLanguage() {
return null;
}
/**
* @deprecated As of SIS 1.0, replaced by {@link #getLocalesAndCharsets()}.
*/
@Override
@Deprecated
public Collection<Locale> getLocales() {
return Collections.emptySet(); // We use 'Set' because we handle 'Locale' like a CodeList.
}
/**
* @deprecated As of SIS 1.0, replaced by {@link #getLocalesAndCharsets()}.
*/
@Override
@Deprecated
public final Collection getCharacterSets() {
return Collections.emptySet(); // We use 'Set' because we handle 'Charset' like a CodeList.
}
/**
* @deprecated As of SIS 0.5, replaced by {@link #getCharacterSets()}.
*/
@Override
@Deprecated
public CharacterSet getCharacterSet() {
return null;
}
/**
=======
>>>>>>>
<<<<<<<
/**
* Information about the feature and coverage characteristics.
*/
@Override
public Collection<ContentInformation> getContentInfo() {
return Collections.emptyList();
}
/**
* Information about the distributor of and options for obtaining the resource(s).
*/
@Override
public Distribution getDistributionInfo() {
return null;
}
/**
* Overall assessment of quality of a resource(s).
*/
@Override
public Collection<DataQuality> getDataQualityInfo() {
return Collections.emptyList();
}
/**
* Information about the catalogue of rules defined for the portrayal of a resource(s).
*/
@Override
public Collection<PortrayalCatalogueReference> getPortrayalCatalogueInfo() {
return Collections.emptyList();
}
/**
* Restrictions on the access and use of metadata.
*/
@Override
public Collection<Constraints> getMetadataConstraints() {
return Collections.emptyList();
}
/**
* Information about the conceptual schema of a dataset.
*/
@Override
public Collection<ApplicationSchemaInformation> getApplicationSchemaInfo() {
return Collections.emptyList();
}
/**
* Information about the acquisition of the data.
*/
@Override
public Collection<AcquisitionInformation> getAcquisitionInformation() {
return Collections.emptyList();
}
/**
* Information about the frequency of metadata updates, and the scope of those updates.
*/
@Override
public MaintenanceInformation getMetadataMaintenance() {
return null;
}
/**
* Information about the provenance, sources and/or the production processes applied to the resource.
*/
@Override
public Collection<Lineage> getResourceLineages() {
return Collections.emptyList();
}
=======
>>>>>>>
<<<<<<<
* Summary of the intentions with which the resource was developed.
* This is part of the information returned by {@link #getIdentificationInfo()}.
*/
@Override
public InternationalString getPurpose() {
return null;
}
/**
* Recognition of those who contributed to the resource.
* This is part of the information returned by {@link #getIdentificationInfo()}.
*/
@Override
public Collection<String> getCredits() {
return Collections.emptyList();
}
/**
* Status of the resource.
* This is part of the information returned by {@link #getIdentificationInfo()}.
*/
@Override
public Collection<Progress> getStatus() {
return Collections.emptySet(); // We use 'Set' because 'Progress' is a CodeList.
}
/**
* Identification of, and means of communication with, person(s) and organisations associated with the resource(s).
* This is part of the information returned by {@link #getIdentificationInfo()}.
*/
@Override
public Collection<ResponsibleParty> getPointOfContacts() {
return Collections.emptyList();
}
/**
=======
>>>>>>>
<<<<<<<
* Short names or other language names by which the cited information is known.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Collection<InternationalString> getAlternateTitles() {
return Collections.emptyList();
}
/**
* Reference dates for the cited resource.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Collection<CitationDate> getDates() {
return Collections.emptyList();
}
/**
* Version of the cited resource.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public InternationalString getEdition() {
return null;
}
/**
* Date of the edition.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Date getEditionDate() {
return null;
}
/**
* Unique identifier for the resource.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Collection<Identifier> getIdentifiers() {
return Collections.emptyList();
}
/**
* Role, name, contact and position information for individuals or organisations
* that are responsible for the resource.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Collection<ResponsibleParty> getCitedResponsibleParties() {
return Collections.emptyList();
}
/**
=======
>>>>>>>
<<<<<<<
/**
* Information about the series, or aggregate dataset, of which the dataset is a part.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Series getSeries() {
return null;
}
/**
* Other information required to complete the citation that is not recorded elsewhere.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public InternationalString getOtherCitationDetails() {
return null;
}
/**
* @deprecated Removed as of ISO 19115:2014.
*/
@Override
@Deprecated
public InternationalString getCollectiveTitle() {
return null;
}
/**
* International Standard Book Number.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public String getISBN() {
return null;
}
/**
* International Standard Serial Number.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public String getISSN() {
return null;
}
/**
* Online references to the cited resource.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Collection<OnlineResource> getOnlineResources() {
return Collections.emptyList();
}
/**
* Citation graphics or logo for cited party.
* This is part of the information returned by {@link #getCitation()}.
*/
@Override
public Collection<BrowseGraphic> getGraphics() {
return Collections.emptyList();
}
=======
>>>>>>> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.