conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
import build.buildfarm.common.Watcher;
=======
import build.buildfarm.common.Write;
>>>>>>>
import build.buildfarm.common.Watcher;
import build.buildfarm.common.Write;
<<<<<<<
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.UncheckedExecutionException;
=======
import com.google.common.util.concurrent.ListenableFuture;
>>>>>>>
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
<<<<<<<
import java.io.IOException;
=======
import java.io.IOException;
import java.io.InputStream;
>>>>>>>
import java.io.IOException;
import java.io.InputStream;
<<<<<<<
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeoutException;
import java.util.function.Supplier;
=======
import java.util.UUID;
import java.util.function.Predicate;
>>>>>>>
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
<<<<<<<
public final ByteString getBlob(Digest blobDigest) throws InterruptedException {
=======
@Override
public InputStream newBlobInput(Digest digest, long offset) throws IOException {
return contentAddressableStorage.newInput(digest, offset);
}
@Override
public Write getBlobWrite(Digest digest, UUID uuid) {
return contentAddressableStorage.getWrite(digest, uuid);
}
@Override
public ListenableFuture<Iterable<Response>> getAllBlobsFuture(Iterable<Digest> digests) {
return contentAddressableStorage.getAllFuture(digests);
}
@Override
public final ByteString getBlob(Digest blobDigest) {
>>>>>>>
@Override
public InputStream newBlobInput(Digest digest, long offset) throws IOException {
return contentAddressableStorage.newInput(digest, offset);
}
@Override
public Write getBlobWrite(Digest digest, UUID uuid) {
return contentAddressableStorage.getWrite(digest, uuid);
}
@Override
public ListenableFuture<Iterable<Response>> getAllBlobsFuture(Iterable<Digest> digests) {
return contentAddressableStorage.getAllFuture(digests);
}
ByteString getBlob(Digest blobDigest) throws InterruptedException { |
<<<<<<<
import build.buildfarm.common.grpc.TracingMetadataUtils.ServerHeadersInterceptor;
=======
import static build.buildfarm.common.IOUtils.formatIOError;
>>>>>>>
import static build.buildfarm.common.IOUtils.formatIOError;
import build.buildfarm.common.grpc.TracingMetadataUtils.ServerHeadersInterceptor;
<<<<<<<
BuildFarmServerOptions options = parser.getOptions(BuildFarmServerOptions.class);
String session = "buildfarm-server";
if (!options.publicName.isEmpty()) {
session += "-" + options.publicName;
}
session += "-" + UUID.randomUUID();
BuildFarmServer server;
=======
>>>>>>>
BuildFarmServerOptions options = parser.getOptions(BuildFarmServerOptions.class);
String session = "buildfarm-server";
if (!options.publicName.isEmpty()) {
session += "-" + options.publicName;
}
session += "-" + UUID.randomUUID();
BuildFarmServer server; |
<<<<<<<
import com.google.common.annotations.VisibleForTesting;
=======
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
>>>>>>>
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
<<<<<<<
import com.google.common.io.ByteStreams;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.common.util.concurrent.UncheckedExecutionException;
import com.google.devtools.remoteexecution.v1test.Digest;
import com.google.devtools.remoteexecution.v1test.Directory;
import com.google.devtools.remoteexecution.v1test.DirectoryNode;
import com.google.devtools.remoteexecution.v1test.FileNode;
import com.google.protobuf.ByteString;
=======
import build.bazel.remote.execution.v2.Digest;
import build.bazel.remote.execution.v2.Directory;
import build.bazel.remote.execution.v2.DirectoryNode;
import build.bazel.remote.execution.v2.FileNode;
>>>>>>>
import com.google.common.io.ByteStreams;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.common.util.concurrent.UncheckedExecutionException;
import com.google.protobuf.ByteString;
<<<<<<<
private void decrementReferencesSynchronized(Iterable<Path> inputFiles, Iterable<Digest> inputDirectories) {
=======
public synchronized void decrementReferences(Iterable<Path> inputFiles, Iterable<Digest> inputDirectories) {
decrementReferencesSynchronized(inputFiles, inputDirectories);
}
private void decrementReferencesSynchronized(Iterable<Path> inputFiles, Iterable<Digest> inputDirectories) {
>>>>>>>
public synchronized void decrementReferences(Iterable<Path> inputFiles, Iterable<Digest> inputDirectories) {
decrementReferencesSynchronized(inputFiles, inputDirectories);
}
private void decrementReferencesSynchronized(Iterable<Path> inputFiles, Iterable<Digest> inputDirectories) {
<<<<<<<
private Path getDirectoryPath(Digest digest) {
return root.resolve(digestFilename(digest) + "_dir");
}
private void remove(Digest digest, boolean isExecutable) throws IOException {
Path key = getKey(digest, isExecutable);
Lock l = locks.acquire(key);
l.lock();
try {
Entry e = storage.remove(key);
if (e != null) {
synchronized (this) {
unlinkEntry(e);
}
}
} finally {
locks.release(key);
l.unlock();
}
}
/** must be called in synchronized context */
private void unlinkEntry(Entry e) throws IOException {
if (e.referenceCount == 0) {
e.unlink();
} else {
System.out.println(String.format("CASFileCache::unlinkEntry(%s): Removed referenced entry!", e.key));
}
for (Digest containingDirectory : e.containingDirectories) {
getOrIOException(expireDirectory(containingDirectory));
}
// still debating this one being in this method
sizeInBytes -= e.size;
// technically we should attempt to remove the file here,
// but we're only called in contexts where it doesn't exist...
=======
@VisibleForTesting
public Path getDirectoryPath(Digest digest) {
return root.resolve(digestFilename(digest));
>>>>>>>
private void remove(Digest digest, boolean isExecutable) throws IOException {
Path key = getKey(digest, isExecutable);
Lock l = locks.acquire(key);
l.lock();
try {
Entry e = storage.remove(key);
if (e != null) {
synchronized (this) {
unlinkEntry(e);
}
}
} finally {
locks.release(key);
l.unlock();
}
}
/** must be called in synchronized context */
private void unlinkEntry(Entry e) throws IOException {
if (e.referenceCount == 0) {
e.unlink();
} else {
logger.info(String.format("CASFileCache::unlinkEntry(%s): Removed referenced entry!", e.key));
}
for (Digest containingDirectory : e.containingDirectories) {
getOrIOException(expireDirectory(containingDirectory));
}
// still debating this one being in this method
sizeInBytes -= e.size;
// technically we should attempt to remove the file here,
// but we're only called in contexts where it doesn't exist...
}
@VisibleForTesting
public Path getDirectoryPath(Digest digest) {
return root.resolve(digestFilename(digest) + "_dir");
<<<<<<<
=======
}
/** must be called in synchronized context */
private void expireDirectory(Digest digest) throws IOException {
DirectoryEntry e = directoryStorage.remove(digest);
purgeDirectoryFromInputs(digest, e.inputs);
removeDirectory(getDirectoryPath(digest));
>>>>>>>
<<<<<<<
if (Files.exists(path)) {
if (Files.isDirectory(path)) {
getOrIOException(removeDirectoryAsync(path));
} else {
Files.delete(path);
}
}
Files.createDirectory(path);
Directory directory = directoriesIndex.get(digest);
if (directory == null) {
throw new IOException("directory not found");
}
for (FileNode fileNode : directory.getFilesList()) {
if (fileNode.getDigest().getSizeBytes() == 0) {
Files.createFile(path.resolve(fileNode.getName()));
} else {
=======
putDirectoryFiles(files, path, /* containingDirectory=*/ null, inputsBuilder);
}
private void putDirectoryFiles(
Iterable<FileNode> files,
Path path,
Digest containingDirectory,
ImmutableList.Builder<Path> inputsBuilder) throws IOException, InterruptedException {
for (FileNode fileNode : files) {
Path filePath = path.resolve(fileNode.getName());
if (fileNode.getDigest().getSizeBytes() != 0) {
>>>>>>>
putDirectoryFiles(files, path, /* containingDirectory=*/ null, inputsBuilder);
}
private void putDirectoryFiles(
Iterable<FileNode> files,
Path path,
Digest containingDirectory,
ImmutableList.Builder<Path> inputsBuilder) throws IOException, InterruptedException {
for (FileNode fileNode : files) {
Path filePath = path.resolve(fileNode.getName());
if (fileNode.getDigest().getSizeBytes() != 0) {
<<<<<<<
=======
} else {
Files.createFile(filePath);
>>>>>>>
} else {
Files.createFile(filePath);
<<<<<<<
synchronized (this) {
DirectoryEntry e = directoryStorage.get(digest);
if (e != null) {
ImmutableList.Builder<Path> inputsBuilder = new ImmutableList.Builder<>();
for (Path input : e.inputs) {
Entry fileEntry = storage.get(input);
if (fileEntry == null) {
System.err.println("CASFileCache::putDirectory(" + DigestUtil.toString(digest) + ") exists, but input " + input + " does not, purging it with fire and resorting to fetch");
e = null;
break;
}
fileEntry.incrementReference();
inputsBuilder.add(input);
}
if (e != null) {
return path;
}
decrementReferencesSynchronized(inputsBuilder.build(), ImmutableList.<Digest>of());
getOrIOException(expireDirectory(digest));
}
=======
synchronized (this) {
DirectoryEntry e = directoryStorage.get(digest);
if (e != null) {
incrementReferences(e.inputs);
return path;
}
>>>>>>>
synchronized (this) {
DirectoryEntry e = directoryStorage.get(digest);
if (e != null) {
ImmutableList.Builder<Path> inputsBuilder = new ImmutableList.Builder<>();
for (Path input : e.inputs) {
Entry fileEntry = storage.get(input);
if (fileEntry == null) {
logger.severe("CASFileCache::putDirectory(" + DigestUtil.toString(digest) + ") exists, but input " + input + " does not, purging it with fire and resorting to fetch");
e = null;
break;
}
fileEntry.incrementReference();
inputsBuilder.add(input);
}
if (e != null) {
return path;
}
decrementReferencesSynchronized(inputsBuilder.build(), ImmutableList.<Digest>of());
getOrIOException(expireDirectory(digest));
}
<<<<<<<
boolean fetched = false;
try {
fetchDirectory(digest, path, digest, directoriesIndex, inputsBuilder);
fetched = true;
} finally {
if (!fetched) {
ImmutableList<Path> inputs = inputsBuilder.build();
synchronized (this) {
purgeDirectoryFromInputs(digest, inputs);
decrementReferencesSynchronized(inputs, ImmutableList.<Digest>of());
}
removeDirectoryAsync(path);
}
}
=======
try {
fetchDirectory(digest, path, digest, directoriesIndex, inputsBuilder);
} catch (IOException e) {
ImmutableList<Path> inputs = inputsBuilder.build();
synchronized (this) {
purgeDirectoryFromInputs(digest, inputs);
decrementReferencesSynchronized(inputs, ImmutableList.<Digest>of());
}
try {
removeDirectory(path);
} catch (IOException rmdirEx) {
// unexpected failure removing directory, log and maintain original exception
rmdirEx.printStackTrace();
}
throw e;
}
>>>>>>>
boolean fetched = false;
try {
fetchDirectory(digest, path, digest, directoriesIndex, inputsBuilder);
fetched = true;
} finally {
if (!fetched) {
ImmutableList<Path> inputs = inputsBuilder.build();
synchronized (this) {
purgeDirectoryFromInputs(digest, inputs);
decrementReferencesSynchronized(inputs, ImmutableList.<Digest>of());
}
removeDirectoryAsync(path);
}
}
<<<<<<<
Path tmpPath = key.resolveSibling(key.getFileName() + ".tmp");
return new OutputStream() {
OutputStream tmpFile = Files.newOutputStream(tmpPath, CREATE, TRUNCATE_EXISTING);
long size = 0;
@Override
public void flush() throws IOException {
tmpFile.flush();
}
=======
Path tmpPath = key.resolveSibling(key.getFileName() + ".tmp");
try (InputStream in = inputStreamFactory.apply(digest)) {
// FIXME make a validating file copy object and verify digest
long copySize = Files.copy(in, tmpPath);
if (copySize != digest.getSizeBytes()) {
Files.delete(tmpPath);
throw new IOException(String.format(
"invalid size copied for %s: was %d",
DigestUtil.toString(digest),
copySize));
}
}
setPermissions(tmpPath, isExecutable);
Files.move(tmpPath, key, REPLACE_EXISTING);
>>>>>>>
Path tmpPath = key.resolveSibling(key.getFileName() + ".tmp");
return new CancellableOutputStream() {
OutputStream tmpFile = Files.newOutputStream(tmpPath, CREATE, TRUNCATE_EXISTING);
long size = 0;
@Override
public void flush() throws IOException {
tmpFile.flush();
} |
<<<<<<<
import java.util.concurrent.ConcurrentHashMap;
=======
import java.util.logging.Logger;
>>>>>>>
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger; |
<<<<<<<
protected Result fetchNext() throws IOException {
// trying to fetch data from nextItemsToFetch buffer
if (mapInputBuff.size() == 0) {
return null;
}
return mapInputBuff.poll();
=======
Result fetchNext() throws IOException {
return fetchNextFromBuffer();
>>>>>>>
protected Result fetchNext() throws IOException {
return fetchNextFromBuffer(); |
<<<<<<<
import com.nekokittygames.thaumictinkerer.common.libs.LibResearch;
=======
import com.nekokittygames.thaumictinkerer.common.libs.LibOreDict;
>>>>>>>
import com.nekokittygames.thaumictinkerer.common.libs.LibResearch;
import com.nekokittygames.thaumictinkerer.common.libs.LibOreDict;
<<<<<<<
import net.minecraftforge.registries.IForgeRegistry;
=======
import net.minecraftforge.oredict.OreDictionary;
>>>>>>>
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.oredict.OreDictionary;
<<<<<<<
public static void initializeRecipes(IForgeRegistry<IRecipe> registry) {
initializeCraftingRecipes(registry);
=======
public static void initializeRecipes() {
registerOreDict();
initializeCraftingRecipes();
>>>>>>>
public static void initializeRecipes(IForgeRegistry<IRecipe> registry) {
registerOreDict();
initializeCraftingRecipes(registry); |
<<<<<<<
if(imovable)
worldObj.addTileEntity(passenger);
=======
>>>>>>> |
<<<<<<<
private static final String TAG_CONNECTING_GOLEM="ConnectingGolem";
=======
>>>>>>>
<<<<<<<
@Override
public boolean itemInteractionForEntity(ItemStack par1ItemStack,
EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) {
par1ItemStack=par2EntityPlayer.getCurrentEquippedItem();
if(par2EntityPlayer.isSneaking())
{
if(par3EntityLivingBase instanceof EntityGolemBase)
{
if(getY(par1ItemStack)==-1)
{
if(par3EntityLivingBase.worldObj.isRemote)
{
return false;
}
par2EntityPlayer.addChatMessage("ttmisc.golemconnector.notinterf");
return true;
}
int x = getX(par1ItemStack);
int y = getY(par1ItemStack);
int z = getZ(par1ItemStack);
TileEntity tile1 = par2EntityPlayer.worldObj.getBlockTileEntity(x, y, z);
if (tile1 == null || !(tile1 instanceof TileGolemConnector)) {
setY(par1ItemStack, -1);
if(par3EntityLivingBase.worldObj.isRemote)
{
return false;
}
par2EntityPlayer.addChatMessage("ttmisc.golemconnector.notpresent");
return false;
} else {
if(par3EntityLivingBase.worldObj.isRemote)
{
par2EntityPlayer.swingItem();
return false;
}
TileGolemConnector trans = (TileGolemConnector) tile1;
trans.ConnectGolem(par3EntityLivingBase.getUniqueID());
setY(par1ItemStack, -1);
playSound(par3EntityLivingBase.worldObj, (int)par3EntityLivingBase.posX, (int)par3EntityLivingBase.posY, (int)par3EntityLivingBase.posZ);
par2EntityPlayer.addChatMessage("ttmisc.golemconnector.complete");
PacketDispatcher.sendPacketToAllInDimension(trans.getDescriptionPacket(), par3EntityLivingBase.worldObj.provider.dimensionId);
}
return true;
}
}
return false;
}
=======
>>>>>>>
@Override
public boolean itemInteractionForEntity(ItemStack par1ItemStack,
EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) {
par1ItemStack=par2EntityPlayer.getCurrentEquippedItem();
if(par2EntityPlayer.isSneaking())
{
if(par3EntityLivingBase instanceof EntityGolemBase)
{
if(getY(par1ItemStack)==-1)
{
if(par3EntityLivingBase.worldObj.isRemote)
{
return false;
}
par2EntityPlayer.addChatMessage("ttmisc.golemconnector.notinterf");
return true;
}
int x = getX(par1ItemStack);
int y = getY(par1ItemStack);
int z = getZ(par1ItemStack);
TileEntity tile1 = par2EntityPlayer.worldObj.getBlockTileEntity(x, y, z);
if (tile1 == null || !(tile1 instanceof TileGolemConnector)) {
setY(par1ItemStack, -1);
if(par3EntityLivingBase.worldObj.isRemote)
{
return false;
}
par2EntityPlayer.addChatMessage("ttmisc.golemconnector.notpresent");
return false;
} else {
if(par3EntityLivingBase.worldObj.isRemote)
{
par2EntityPlayer.swingItem();
return false;
}
TileGolemConnector trans = (TileGolemConnector) tile1;
trans.ConnectGolem(par3EntityLivingBase.getUniqueID());
setY(par1ItemStack, -1);
playSound(par3EntityLivingBase.worldObj, (int)par3EntityLivingBase.posX, (int)par3EntityLivingBase.posY, (int)par3EntityLivingBase.posZ);
par2EntityPlayer.addChatMessage("ttmisc.golemconnector.complete");
PacketDispatcher.sendPacketToAllInDimension(trans.getDescriptionPacket(), par3EntityLivingBase.worldObj.provider.dimensionId);
}
return true;
}
}
return false;
}
<<<<<<<
public static boolean getConnectingGolem(ItemStack stack)
{
return ItemNBTHelper.getBoolean(stack, TAG_CONNECTING_GOLEM, false);
}
public static void setConnectingGolem(ItemStack stack,boolean connecting)
{
ItemNBTHelper.setBoolean(stack, TAG_CONNECTING_GOLEM, connecting);
}
=======
>>>>>>> |
<<<<<<<
ingest(connector, getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
verify(connector, getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
=======
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS, COLS, 50, 0,
tableName);
verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS, COLS, 50, 0,
tableName);
>>>>>>>
ingest(connector, getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
verify(connector, getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
<<<<<<<
// Invocation is different for SASL. We're only logged in via this processes memory (not via some credentials cache on disk)
=======
ClientConfiguration clientConf = cluster.getClientConfig();
// Invocation is different for SASL. We're only logged in via this processes memory (not
// via some credentials cache on disk)
>>>>>>>
// Invocation is different for SASL. We're only logged in via this processes memory (not
// via some credentials cache on disk)
<<<<<<<
// Invocation is different for SASL. We're only logged in via this processes memory (not via some credentials cache on disk)
=======
ClientConfiguration clientConf = cluster.getClientConfig();
// Invocation is different for SASL. We're only logged in via this processes memory (not
// via some credentials cache on disk)
>>>>>>>
// Invocation is different for SASL. We're only logged in via this processes memory (not
// via some credentials cache on disk)
<<<<<<<
ingest(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, 0, tableName);
=======
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50, 0,
tableName);
>>>>>>>
ingest(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, 0, tableName);
<<<<<<<
verify(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, start, tableName);
=======
verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50,
start, tableName);
>>>>>>>
verify(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, start, tableName);
<<<<<<<
ingest(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, i + CHUNKSIZE, tableName);
=======
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50,
i + CHUNKSIZE, tableName);
>>>>>>>
ingest(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, i + CHUNKSIZE, tableName);
<<<<<<<
verify(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, i, tableName);
=======
verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50, i,
tableName);
>>>>>>>
verify(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, i, tableName);
<<<<<<<
ingest(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
=======
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2000, 1, 50, 0,
tableName);
>>>>>>>
ingest(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
<<<<<<<
verifyLocalityGroupsInRFile(connector, tableName);
}
/**
* Pretty much identical to sunnyLG, but verifies locality groups are created when configured in NewTableConfiguration prior to table creation.
*/
@Test
public void sunnyLGUsingNewTableConfiguration() throws Exception {
// create a locality group, write to it and ensure it exists in the RFiles that result
final Connector connector = getConnector();
final String tableName = getUniqueNames(1)[0];
NewTableConfiguration ntc = new NewTableConfiguration();
Map<String,Set<Text>> groups = new HashMap<>();
groups.put("g1", Collections.singleton(t("colf")));
ntc.setLocalityGroups(groups);
connector.tableOperations().create(tableName, ntc);
verifyLocalityGroupsInRFile(connector, tableName);
}
private void verifyLocalityGroupsInRFile(final Connector connector, final String tableName) throws Exception, AccumuloException, AccumuloSecurityException,
TableNotFoundException {
ingest(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
verify(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
=======
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2000, 1, 50, 0,
tableName);
verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2000, 1, 50, 0,
tableName);
>>>>>>>
verifyLocalityGroupsInRFile(connector, tableName);
}
/**
* Pretty much identical to sunnyLG, but verifies locality groups are created when configured in
* NewTableConfiguration prior to table creation.
*/
@Test
public void sunnyLGUsingNewTableConfiguration() throws Exception {
// create a locality group, write to it and ensure it exists in the RFiles that result
final Connector connector = getConnector();
final String tableName = getUniqueNames(1)[0];
NewTableConfiguration ntc = new NewTableConfiguration();
Map<String,Set<Text>> groups = new HashMap<>();
groups.put("g1", Collections.singleton(t("colf")));
ntc.setLocalityGroups(groups);
connector.tableOperations().create(tableName, ntc);
verifyLocalityGroupsInRFile(connector, tableName);
}
private void verifyLocalityGroupsInRFile(final Connector connector, final String tableName)
throws Exception, AccumuloException, AccumuloSecurityException, TableNotFoundException {
ingest(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
verify(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
<<<<<<<
ingest(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
ingest(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table);
=======
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0,
table);
ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0,
"xyz", table);
>>>>>>>
ingest(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
ingest(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table);
<<<<<<<
verify(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
verify(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table);
=======
verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0,
table);
verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0,
"xyz", table);
>>>>>>>
verify(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
verify(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table); |
<<<<<<<
public TileEntityRelay() {
}
=======
>>>>>>>
public TileEntityRelay() {
} |
<<<<<<<
setMarkdownExtensions(Utils.getPrefsStrings(options, "markdownExtensions"));
=======
setMarkdownFileExtensions(options.get("markdownFileExtensions", DEF_MARKDOWN_FILE_EXTENSIONS));
setMarkdownExtensions(options.getInt("markdownExtensions", Extensions.ALL));
>>>>>>>
setMarkdownFileExtensions(options.get("markdownFileExtensions", DEF_MARKDOWN_FILE_EXTENSIONS));
setMarkdownExtensions(Utils.getPrefsStrings(options, "markdownExtensions"));
<<<<<<<
Utils.putPrefsStrings(options, "markdownExtensions", getMarkdownExtensions());
=======
Utils.putPrefs(options, "markdownFileExtensions", getMarkdownFileExtensions(), DEF_MARKDOWN_FILE_EXTENSIONS);
Utils.putPrefsInt(options, "markdownExtensions", getMarkdownExtensions(), Extensions.ALL);
>>>>>>>
Utils.putPrefs(options, "markdownFileExtensions", getMarkdownFileExtensions(), DEF_MARKDOWN_FILE_EXTENSIONS);
Utils.putPrefsStrings(options, "markdownExtensions", getMarkdownExtensions()); |
<<<<<<<
// load options
setFontFamily(safeFontFamily(options.get("fontFamily", null)));
setFontSize(options.getInt("fontSize", DEF_FONT_SIZE));
setLineSeparator(options.get("lineSeparator", null));
setEncoding(options.get("encoding", null));
setMarkdownFileExtensions(options.get("markdownFileExtensions", DEF_MARKDOWN_FILE_EXTENSIONS));
setMarkdownExtensions(Utils.getPrefsStrings(options, "markdownExtensions"));
setMarkdownRenderer(Utils.getPrefsEnum(options, "markdownRenderer", RendererType.CommonMark));
setShowWhitespace(options.getBoolean("showWhitespace", false));
setSpellChecker(options.getBoolean("spellChecker", true));
// save options on change
fontFamilyProperty().addListener((ob, o, n) -> {
Utils.putPrefs(options, "fontFamily", getFontFamily(), null);
});
fontSizeProperty().addListener((ob, o, n) -> {
Utils.putPrefsInt(options, "fontSize", getFontSize(), DEF_FONT_SIZE);
});
lineSeparatorProperty().addListener((ob, o, n) -> {
Utils.putPrefs(options, "lineSeparator", getLineSeparator(), null);
});
encodingProperty().addListener((ob, o, n) -> {
Utils.putPrefs(options, "encoding", getEncoding(), null);
});
markdownFileExtensionsProperty().addListener((ob, o, n) -> {
Utils.putPrefs(options, "markdownFileExtensions", getMarkdownFileExtensions(), DEF_MARKDOWN_FILE_EXTENSIONS);
});
markdownExtensionsProperty().addListener((ob, o, n) -> {
Utils.putPrefsStrings(options, "markdownExtensions", getMarkdownExtensions());
});
markdownRendererProperty().addListener((ob, o, n) -> {
Utils.putPrefsEnum(options, "markdownRenderer", getMarkdownRenderer(), RendererType.CommonMark);
});
showWhitespaceProperty().addListener((ob, o, n) -> {
Utils.putPrefsBoolean(options, "showWhitespace", isShowWhitespace(), false);
});
spellCheckerProperty().addListener((ob, o, n) -> {
Utils.putPrefsBoolean(options, "spellChecker", isSpellChecker(), true);
});
=======
fontFamily.init(options, "fontFamily", null, value -> safeFontFamily(value));
fontSize.init(options, "fontSize", DEF_FONT_SIZE);
lineSeparator.init(options, "lineSeparator", null);
encoding.init(options, "encoding", null);
markdownFileExtensions.init(options, "markdownFileExtensions", DEF_MARKDOWN_FILE_EXTENSIONS);
markdownExtensions.init(options, "markdownExtensions");
markdownRenderer.init(options, "markdownRenderer", RendererType.CommonMark);
showLineNo.init(options, "showLineNo", false);
showWhitespace.init(options, "showWhitespace", false);
>>>>>>>
fontFamily.init(options, "fontFamily", null, value -> safeFontFamily(value));
fontSize.init(options, "fontSize", DEF_FONT_SIZE);
lineSeparator.init(options, "lineSeparator", null);
encoding.init(options, "encoding", null);
markdownFileExtensions.init(options, "markdownFileExtensions", DEF_MARKDOWN_FILE_EXTENSIONS);
markdownExtensions.init(options, "markdownExtensions");
markdownRenderer.init(options, "markdownRenderer", RendererType.CommonMark);
showLineNo.init(options, "showLineNo", false);
showWhitespace.init(options, "showWhitespace", false);
setSpellChecker(options.getBoolean("spellChecker", true));
spellCheckerProperty().addListener((ob, o, n) -> {
Utils.putPrefsBoolean(options, "spellChecker", isSpellChecker(), true);
}); |
<<<<<<<
showWhitespaceCheckBox.setSelected(Options.isShowWhitespace());
spellCheckerCheckBox.setSelected(Options.isSpellChecker());
=======
markdownFileExtensionsField.setText(Options.getMarkdownFileExtensions());
>>>>>>>
markdownFileExtensionsField.setText(Options.getMarkdownFileExtensions());
// spell checker
spellCheckerCheckBox.setSelected(Options.isSpellChecker());
<<<<<<<
Options.setShowWhitespace(showWhitespaceCheckBox.isSelected());
Options.setSpellChecker(spellCheckerCheckBox.isSelected());
=======
Options.setMarkdownFileExtensions(Utils.defaultIfEmpty(
markdownFileExtensionsField.getText().trim(),
Options.DEF_MARKDOWN_FILE_EXTENSIONS));
>>>>>>>
Options.setMarkdownFileExtensions(Utils.defaultIfEmpty(
markdownFileExtensionsField.getText().trim(),
Options.DEF_MARKDOWN_FILE_EXTENSIONS));
// spell checker
Options.setSpellChecker(spellCheckerCheckBox.isSelected());
<<<<<<<
showWhitespaceCheckBox = new CheckBox();
spellCheckerCheckBox = new CheckBox();
=======
Label markdownFileExtensionsLabel = new Label();
markdownFileExtensionsField = new TextField();
>>>>>>>
Label markdownFileExtensionsLabel = new Label();
markdownFileExtensionsField = new TextField();
spellCheckerCheckBox = new CheckBox();
<<<<<<<
setCols("[fill][fill][fill]");
setRows("[][]para[][]");
=======
setCols("[indent,fill]0[fill][fill][grow,fill]");
setRows("[][][][]para[][][][]para");
//---- editorSettingsLabel ----
editorSettingsLabel.setText(Messages.get("GeneralOptionsPane.editorSettingsLabel.text"));
add(editorSettingsLabel, "cell 0 0 2 1");
//---- fontFamilyLabel ----
fontFamilyLabel.setText(Messages.get("GeneralOptionsPane.fontFamilyLabel.text"));
fontFamilyLabel.setMnemonicParsing(true);
add(fontFamilyLabel, "cell 1 1");
//---- fontFamilyField ----
fontFamilyField.setVisibleRowCount(20);
add(fontFamilyField, "cell 2 1");
//---- fontSizeLabel ----
fontSizeLabel.setText(Messages.get("GeneralOptionsPane.fontSizeLabel.text"));
fontSizeLabel.setMnemonicParsing(true);
add(fontSizeLabel, "cell 1 2");
add(fontSizeField, "cell 2 2,alignx left,growx 0");
//---- showWhitespaceCheckBox ----
showWhitespaceCheckBox.setText(Messages.get("GeneralOptionsPane.showWhitespaceCheckBox.text"));
add(showWhitespaceCheckBox, "cell 1 3 3 1,alignx left,growx 0");
//---- fileSettingsLabel ----
fileSettingsLabel.setText(Messages.get("GeneralOptionsPane.fileSettingsLabel.text"));
add(fileSettingsLabel, "cell 0 4 2 1");
>>>>>>>
setCols("[indent,fill]0[fill][fill][grow,fill]");
setRows("[][][][]para[][][][]para[]");
//---- editorSettingsLabel ----
editorSettingsLabel.setText(Messages.get("GeneralOptionsPane.editorSettingsLabel.text"));
add(editorSettingsLabel, "cell 0 0 2 1");
//---- fontFamilyLabel ----
fontFamilyLabel.setText(Messages.get("GeneralOptionsPane.fontFamilyLabel.text"));
fontFamilyLabel.setMnemonicParsing(true);
add(fontFamilyLabel, "cell 1 1");
//---- fontFamilyField ----
fontFamilyField.setVisibleRowCount(20);
add(fontFamilyField, "cell 2 1");
//---- fontSizeLabel ----
fontSizeLabel.setText(Messages.get("GeneralOptionsPane.fontSizeLabel.text"));
fontSizeLabel.setMnemonicParsing(true);
add(fontSizeLabel, "cell 1 2");
add(fontSizeField, "cell 2 2,alignx left,growx 0");
//---- showWhitespaceCheckBox ----
showWhitespaceCheckBox.setText(Messages.get("GeneralOptionsPane.showWhitespaceCheckBox.text"));
add(showWhitespaceCheckBox, "cell 1 3 3 1,alignx left,growx 0");
//---- fileSettingsLabel ----
fileSettingsLabel.setText(Messages.get("GeneralOptionsPane.fileSettingsLabel.text"));
add(fileSettingsLabel, "cell 0 4 2 1");
<<<<<<<
//---- showWhitespaceCheckBox ----
showWhitespaceCheckBox.setText(Messages.get("GeneralOptionsPane.showWhitespaceCheckBox.text"));
add(showWhitespaceCheckBox, "cell 0 2 3 1,growx 0,alignx left");
//---- spellCheckerCheckBox ----
spellCheckerCheckBox.setText(Messages.get("GeneralOptionsPane.spellCheckerCheckBox.text"));
add(spellCheckerCheckBox, "cell 0 3 3 1,growx 0,alignx left");
=======
//---- markdownFileExtensionsLabel ----
markdownFileExtensionsLabel.setText(Messages.get("GeneralOptionsPane.markdownFileExtensionsLabel.text"));
markdownFileExtensionsLabel.setMnemonicParsing(true);
add(markdownFileExtensionsLabel, "cell 1 7");
add(markdownFileExtensionsField, "cell 2 7 2 1");
>>>>>>>
//---- markdownFileExtensionsLabel ----
markdownFileExtensionsLabel.setText(Messages.get("GeneralOptionsPane.markdownFileExtensionsLabel.text"));
markdownFileExtensionsLabel.setMnemonicParsing(true);
add(markdownFileExtensionsLabel, "cell 1 7");
add(markdownFileExtensionsField, "cell 2 7 2 1");
//---- spellCheckerCheckBox ----
spellCheckerCheckBox.setText(Messages.get("GeneralOptionsPane.spellCheckerCheckBox.text"));
add(spellCheckerCheckBox, "cell 1 8 3 1,alignx left,growx 0");
<<<<<<<
private CheckBox showWhitespaceCheckBox;
private CheckBox spellCheckerCheckBox;
=======
private TextField markdownFileExtensionsField;
>>>>>>>
private TextField markdownFileExtensionsField;
private CheckBox spellCheckerCheckBox; |
<<<<<<<
spellCheckerOptionsPane.load();
=======
stylesheetsOptionsPane.load();
>>>>>>>
spellCheckerOptionsPane.load();
stylesheetsOptionsPane.load();
<<<<<<<
spellCheckerOptionsPane.save();
=======
stylesheetsOptionsPane.save();
>>>>>>>
spellCheckerOptionsPane.save();
stylesheetsOptionsPane.save();
<<<<<<<
spellingTab = new Tab();
spellCheckerOptionsPane = new SpellCheckerOptionsPane();
=======
stylesheetsTab = new Tab();
stylesheetsOptionsPane = new StylesheetsOptionsPane();
>>>>>>>
spellingTab = new Tab();
spellCheckerOptionsPane = new SpellCheckerOptionsPane();
stylesheetsTab = new Tab();
stylesheetsOptionsPane = new StylesheetsOptionsPane();
<<<<<<<
//======== spellingTab ========
{
spellingTab.setText(Messages.get("OptionsDialog.spellingTab.text"));
spellingTab.setContent(spellCheckerOptionsPane);
}
tabPane.getTabs().addAll(generalTab, editorTab, markdownTab, spellingTab);
=======
//======== stylesheetsTab ========
{
stylesheetsTab.setText(Messages.get("OptionsDialog.stylesheetsTab.text"));
stylesheetsTab.setContent(stylesheetsOptionsPane);
}
tabPane.getTabs().addAll(generalTab, editorTab, markdownTab, stylesheetsTab);
>>>>>>>
//======== spellingTab ========
{
spellingTab.setText(Messages.get("OptionsDialog.spellingTab.text"));
spellingTab.setContent(spellCheckerOptionsPane);
}
//======== stylesheetsTab ========
{
stylesheetsTab.setText(Messages.get("OptionsDialog.stylesheetsTab.text"));
stylesheetsTab.setContent(stylesheetsOptionsPane);
}
tabPane.getTabs().addAll(generalTab, editorTab, markdownTab, spellingTab,
stylesheetsTab);
<<<<<<<
private Tab spellingTab;
private SpellCheckerOptionsPane spellCheckerOptionsPane;
=======
private Tab stylesheetsTab;
private StylesheetsOptionsPane stylesheetsOptionsPane;
>>>>>>>
private Tab spellingTab;
private SpellCheckerOptionsPane spellCheckerOptionsPane;
private Tab stylesheetsTab;
private StylesheetsOptionsPane stylesheetsOptionsPane; |
<<<<<<<
private void deactivated() {
if (markdownEditorPane == null)
return;
markdownEditorPane.setVisible(false);
}
=======
void requestFocus() {
if (markdownEditorPane != null)
markdownEditorPane.requestFocus();
}
>>>>>>>
private void deactivated() {
if (markdownEditorPane == null)
return;
markdownEditorPane.setVisible(false);
}
void requestFocus() {
if (markdownEditorPane != null)
markdownEditorPane.requestFocus();
} |
<<<<<<<
spellChecker.init(options, "spellChecker", true);
grammarChecker.init(options, "grammarChecker", true);
language.init(options, "language", null);
userDictionary.init(options, "userDictionary", null);
disabledRules.init(options, "disabledRules");
=======
formatOnlyModifiedParagraphs.init(options, "formatOnlyModifiedParagraphs", false);
// listen to active project
ProjectManager.activeProjectProperty().addListener((observer, oldProject, newProject) -> {
set(getProjectOptions(newProject));
});
}
private static void set(Preferences options) {
if (Options.options == options)
return;
Options.options = options;
fontFamily.setPreferences(options);
fontSize.setPreferences(options);
lineSeparator.setPreferences(options);
encoding.setPreferences(options);
markdownFileExtensions.setPreferences(options);
markdownExtensions.setPreferences(options);
markdownRenderer.setPreferences(options);
showLineNo.setPreferences(options);
showWhitespace.setPreferences(options);
showImagesEmbedded.setPreferences(options);
emphasisMarker.setPreferences(options);
strongEmphasisMarker.setPreferences(options);
bulletListMarker.setPreferences(options);
wrapLineLength.setPreferences(options);
formatOnSave.setPreferences(options);
formatOnlyModifiedParagraphs.setPreferences(options);
}
private static Preferences getProjectOptions(File project) {
if (project != null) {
Preferences projectOptions = ProjectSettings.get(project).getOptions();
if (projectOptions != null)
return projectOptions;
}
return globalOptions;
}
static boolean isStoreInProject() {
return options != globalOptions;
}
static void storeInProject(boolean enable) {
ProjectSettings projectSettings = ProjectSettings.get(ProjectManager.getActiveProject());
projectSettings.enableOptions(enable);
set(enable ? projectSettings.getOptions() : globalOptions);
>>>>>>>
formatOnlyModifiedParagraphs.init(options, "formatOnlyModifiedParagraphs", false);
spellChecker.init(options, "spellChecker", true);
grammarChecker.init(options, "grammarChecker", true);
language.init(options, "language", null);
userDictionary.init(options, "userDictionary", null);
disabledRules.init(options, "disabledRules");
// listen to active project
ProjectManager.activeProjectProperty().addListener((observer, oldProject, newProject) -> {
set(getProjectOptions(newProject));
});
}
private static void set(Preferences options) {
if (Options.options == options)
return;
Options.options = options;
fontFamily.setPreferences(options);
fontSize.setPreferences(options);
lineSeparator.setPreferences(options);
encoding.setPreferences(options);
markdownFileExtensions.setPreferences(options);
markdownExtensions.setPreferences(options);
markdownRenderer.setPreferences(options);
showLineNo.setPreferences(options);
showWhitespace.setPreferences(options);
showImagesEmbedded.setPreferences(options);
emphasisMarker.setPreferences(options);
strongEmphasisMarker.setPreferences(options);
bulletListMarker.setPreferences(options);
wrapLineLength.setPreferences(options);
formatOnSave.setPreferences(options);
formatOnlyModifiedParagraphs.setPreferences(options);
}
private static Preferences getProjectOptions(File project) {
if (project != null) {
Preferences projectOptions = ProjectSettings.get(project).getOptions();
if (projectOptions != null)
return projectOptions;
}
return globalOptions;
}
static boolean isStoreInProject() {
return options != globalOptions;
}
static void storeInProject(boolean enable) {
ProjectSettings projectSettings = ProjectSettings.get(ProjectManager.getActiveProject());
projectSettings.enableOptions(enable);
set(enable ? projectSettings.getOptions() : globalOptions);
<<<<<<<
// 'spellChecker' property
private static final PrefsBooleanProperty spellChecker = new PrefsBooleanProperty();
public static boolean isSpellChecker() { return spellChecker.get(); }
public static void setSpellChecker(boolean spellChecker) { Options.spellChecker.set(spellChecker); }
public static BooleanProperty spellCheckerProperty() { return spellChecker; }
// 'grammarChecker' property
private static final PrefsBooleanProperty grammarChecker = new PrefsBooleanProperty();
public static boolean isGrammarChecker() { return grammarChecker.get(); }
public static void setGrammarChecker(boolean grammarChecker) { Options.grammarChecker.set(grammarChecker); }
public static BooleanProperty grammarCheckerProperty() { return grammarChecker; }
// 'language' property
private static final PrefsStringProperty language = new PrefsStringProperty();
public static String getLanguage() { return language.get(); }
public static void setLanguage(String language) { Options.language.set(language); }
public static StringProperty languageProperty() { return language; }
// 'userDictionary' property
private static final PrefsStringProperty userDictionary = new PrefsStringProperty();
public static String getUserDictionary() { return userDictionary.get(); }
public static void setUserDictionary(String userDictionary) { Options.userDictionary.set(userDictionary); }
public static StringProperty userDictionaryProperty() { return userDictionary; }
// 'disabledRules' property
// (value syntax: ruleID=ruleDescription)
private static final PrefsStringsProperty disabledRules = new PrefsStringsProperty();
public static String[] getDisabledRules() { return disabledRules.get(); }
public static void setDisabledRules(String[] disabledRules) { Options.disabledRules.set(disabledRules); }
public static ObjectProperty<String[]> disabledRulesProperty() { return disabledRules; }
public static String ruleIdDesc2id(String str) {
return str.contains("=") ? str.substring(0, str.indexOf('=')) : str;
}
public static String ruleIdDesc2desc(String str) {
return str.contains("=") ? str.substring(str.indexOf('=') + 1) : str;
}
public static List<String> ruleIdDescs2ids(String[] strs) {
return Stream.of(strs)
.map(Options::ruleIdDesc2id)
.collect(Collectors.toList());
}
=======
// 'formatOnlyModifiedParagraphs' property
private static final PrefsBooleanProperty formatOnlyModifiedParagraphs = new PrefsBooleanProperty();
public static boolean isFormatOnlyModifiedParagraphs() { return formatOnlyModifiedParagraphs.get(); }
public static void setFormatOnlyModifiedParagraphs(boolean formatOnlyModifiedParagraphs) { Options.formatOnlyModifiedParagraphs.set(formatOnlyModifiedParagraphs); }
public static BooleanProperty formatOnlyModifiedParagraphsProperty() { return formatOnlyModifiedParagraphs; }
>>>>>>>
// 'formatOnlyModifiedParagraphs' property
private static final PrefsBooleanProperty formatOnlyModifiedParagraphs = new PrefsBooleanProperty();
public static boolean isFormatOnlyModifiedParagraphs() { return formatOnlyModifiedParagraphs.get(); }
public static void setFormatOnlyModifiedParagraphs(boolean formatOnlyModifiedParagraphs) { Options.formatOnlyModifiedParagraphs.set(formatOnlyModifiedParagraphs); }
public static BooleanProperty formatOnlyModifiedParagraphsProperty() { return formatOnlyModifiedParagraphs; }
// 'spellChecker' property
private static final PrefsBooleanProperty spellChecker = new PrefsBooleanProperty();
public static boolean isSpellChecker() { return spellChecker.get(); }
public static void setSpellChecker(boolean spellChecker) { Options.spellChecker.set(spellChecker); }
public static BooleanProperty spellCheckerProperty() { return spellChecker; }
// 'grammarChecker' property
private static final PrefsBooleanProperty grammarChecker = new PrefsBooleanProperty();
public static boolean isGrammarChecker() { return grammarChecker.get(); }
public static void setGrammarChecker(boolean grammarChecker) { Options.grammarChecker.set(grammarChecker); }
public static BooleanProperty grammarCheckerProperty() { return grammarChecker; }
// 'language' property
private static final PrefsStringProperty language = new PrefsStringProperty();
public static String getLanguage() { return language.get(); }
public static void setLanguage(String language) { Options.language.set(language); }
public static StringProperty languageProperty() { return language; }
// 'userDictionary' property
private static final PrefsStringProperty userDictionary = new PrefsStringProperty();
public static String getUserDictionary() { return userDictionary.get(); }
public static void setUserDictionary(String userDictionary) { Options.userDictionary.set(userDictionary); }
public static StringProperty userDictionaryProperty() { return userDictionary; }
// 'disabledRules' property
// (value syntax: ruleID=ruleDescription)
private static final PrefsStringsProperty disabledRules = new PrefsStringsProperty();
public static String[] getDisabledRules() { return disabledRules.get(); }
public static void setDisabledRules(String[] disabledRules) { Options.disabledRules.set(disabledRules); }
public static ObjectProperty<String[]> disabledRulesProperty() { return disabledRules; }
public static String ruleIdDesc2id(String str) {
return str.contains("=") ? str.substring(0, str.indexOf('=')) : str;
}
public static String ruleIdDesc2desc(String str) {
return str.contains("=") ? str.substring(str.indexOf('=') + 1) : str;
}
public static List<String> ruleIdDescs2ids(String[] strs) {
return Stream.of(strs)
.map(Options::ruleIdDesc2id)
.collect(Collectors.toList());
} |
<<<<<<<
spellChecker.init(options, "spellChecker", true);
=======
emphasisMarker.init(options, "emphasisMarker", "_");
strongEmphasisMarker.init(options, "strongEmphasisMarker", "**");
bulletListMarker.init(options, "bulletListMarker", "-");
>>>>>>>
emphasisMarker.init(options, "emphasisMarker", "_");
strongEmphasisMarker.init(options, "strongEmphasisMarker", "**");
bulletListMarker.init(options, "bulletListMarker", "-");
spellChecker.init(options, "spellChecker", true);
<<<<<<<
// 'spellChecker' property
private static final PrefsBooleanProperty spellChecker = new PrefsBooleanProperty();
public static boolean isSpellChecker() { return spellChecker.get(); }
public static void setSpellChecker(boolean spellChecker) { Options.spellChecker.set(spellChecker); }
public static BooleanProperty spellCheckerProperty() { return spellChecker; }
=======
// 'emphasisMarker' property
private static final PrefsStringProperty emphasisMarker = new PrefsStringProperty();
public static String getEmphasisMarker() { return emphasisMarker.get(); }
public static void setEmphasisMarker(String emphasisMarker) { Options.emphasisMarker.set(emphasisMarker); }
public static StringProperty emphasisMarkerProperty() { return emphasisMarker; }
// 'strongEmphasisMarker' property
private static final PrefsStringProperty strongEmphasisMarker = new PrefsStringProperty();
public static String getStrongEmphasisMarker() { return strongEmphasisMarker.get(); }
public static void setStrongEmphasisMarker(String strongEmphasisMarker) { Options.strongEmphasisMarker.set(strongEmphasisMarker); }
public static StringProperty strongEmphasisMarkerProperty() { return strongEmphasisMarker; }
// 'bulletListMarker' property
private static final PrefsStringProperty bulletListMarker = new PrefsStringProperty();
public static String getBulletListMarker() { return bulletListMarker.get(); }
public static void setBulletListMarker(String bulletListMarker) { Options.bulletListMarker.set(bulletListMarker); }
public static StringProperty bulletListMarkerProperty() { return bulletListMarker; }
>>>>>>>
// 'emphasisMarker' property
private static final PrefsStringProperty emphasisMarker = new PrefsStringProperty();
public static String getEmphasisMarker() { return emphasisMarker.get(); }
public static void setEmphasisMarker(String emphasisMarker) { Options.emphasisMarker.set(emphasisMarker); }
public static StringProperty emphasisMarkerProperty() { return emphasisMarker; }
// 'strongEmphasisMarker' property
private static final PrefsStringProperty strongEmphasisMarker = new PrefsStringProperty();
public static String getStrongEmphasisMarker() { return strongEmphasisMarker.get(); }
public static void setStrongEmphasisMarker(String strongEmphasisMarker) { Options.strongEmphasisMarker.set(strongEmphasisMarker); }
public static StringProperty strongEmphasisMarkerProperty() { return strongEmphasisMarker; }
// 'bulletListMarker' property
private static final PrefsStringProperty bulletListMarker = new PrefsStringProperty();
public static String getBulletListMarker() { return bulletListMarker.get(); }
public static void setBulletListMarker(String bulletListMarker) { Options.bulletListMarker.set(bulletListMarker); }
public static StringProperty bulletListMarkerProperty() { return bulletListMarker; }
// 'spellChecker' property
private static final PrefsBooleanProperty spellChecker = new PrefsBooleanProperty();
public static boolean isSpellChecker() { return spellChecker.get(); }
public static void setSpellChecker(boolean spellChecker) { Options.spellChecker.set(spellChecker); }
public static BooleanProperty spellCheckerProperty() { return spellChecker; } |
<<<<<<<
public void update() {
=======
void addGutterFactory(IntFunction<Node> gutterFactory) {
gutterFactories.add(gutterFactory);
update();
}
void removeGutterFactory(IntFunction<Node> gutterFactory) {
gutterFactories.remove(gutterFactory);
update();
}
void update() {
>>>>>>>
void addGutterFactory(IntFunction<Node> gutterFactory) {
gutterFactories.add(gutterFactory);
update();
}
void removeGutterFactory(IntFunction<Node> gutterFactory) {
gutterFactories.remove(gutterFactory);
update();
}
public void update() { |
<<<<<<<
import com.geecko.QuickLyric.lyrics.Lyrics;
import com.geecko.QuickLyric.utils.ColorUtils;
=======
import com.geecko.QuickLyric.model.Lyrics;
>>>>>>>
import com.geecko.QuickLyric.utils.ColorUtils;
import com.geecko.QuickLyric.model.Lyrics; |
<<<<<<<
=======
import android.util.Log;
import android.util.TypedValue;
>>>>>>>
import android.util.Log;
import android.util.TypedValue;
<<<<<<<
import com.geecko.QuickLyric.utils.ColorUtils;
=======
import com.geecko.QuickLyric.model.Recents;
import com.geecko.QuickLyric.model.Track;
>>>>>>>
import com.geecko.QuickLyric.utils.ColorUtils;
import com.geecko.QuickLyric.model.Recents;
import com.geecko.QuickLyric.model.Track; |
<<<<<<<
=======
import org.apache.accumulo.server.security.SecurityUtil;
import org.apache.accumulo.server.security.SystemCredentials;
>>>>>>>
import org.apache.accumulo.server.security.SecurityUtil; |
<<<<<<<
import edu.sdsc.scigraph.owlapi.loader.bindings.*;
class OwlLoaderModule extends AbstractModule {
=======
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesExactIndexedProperties;
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesIndexedProperties;
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesMappedCategories;
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesMappedProperties;
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesNumberOfConsumerThreads;
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesNumberOfProducerThreads;
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesNumberOfShutdownProducers;
import edu.sdsc.scigraph.owlapi.loader.bindings.IndicatesUniqueProperty;
public class OwlLoaderModule extends AbstractModule {
>>>>>>>
import edu.sdsc.scigraph.owlapi.loader.bindings.*;
public class OwlLoaderModule extends AbstractModule { |
<<<<<<<
import com.swmansion.reanimated.ReanimatedPackage;
=======
import com.bugsnag.BugsnagReactNative;
>>>>>>>
import com.swmansion.reanimated.ReanimatedPackage;
import com.bugsnag.BugsnagReactNative;
<<<<<<<
new ReanimatedPackage(),
=======
BugsnagReactNative.getPackage(),
>>>>>>>
new ReanimatedPackage(),
BugsnagReactNative.getPackage(), |
<<<<<<<
vconn.reconfigure(bucket);
((CouchbaseConnection)mconn).reconfigure(bucket);
=======
if (mconn instanceof CouchbaseConnection) {
CouchbaseConnection cbConn = (CouchbaseConnection) mconn;
cbConn.reconfigure(bucket);
} else {
CouchbaseMemcachedConnection cbMConn= (CouchbaseMemcachedConnection) mconn;
cbMConn.reconfigure(bucket);
}
>>>>>>>
vconn.reconfigure(bucket);
if (mconn instanceof CouchbaseConnection) {
CouchbaseConnection cbConn = (CouchbaseConnection) mconn;
cbConn.reconfigure(bucket);
} else {
CouchbaseMemcachedConnection cbMConn= (CouchbaseMemcachedConnection) mconn;
cbMConn.reconfigure(bucket);
} |
<<<<<<<
=======
import java.io.FileInputStream;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
>>>>>>>
<<<<<<<
import com.baidu.acu.pie.model.*;
import org.joda.time.DateTime;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
=======
import com.baidu.acu.pie.exception.AsrException;
import com.baidu.acu.pie.model.AsrConfig;
import com.baidu.acu.pie.model.AsrProduct;
import com.baidu.acu.pie.model.RecognitionResult;
import com.baidu.acu.pie.model.RequestMetaData;
import com.baidu.acu.pie.model.StreamContext;
>>>>>>>
import com.baidu.acu.pie.model.*;
import org.joda.time.DateTime;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
<<<<<<<
private static String userName = "your_username"; // 用户名, 请联系百度相关人员进行申请
private static String passWord = "your_password"; // 密码, 请联系百度相关人员进行申请
private static String audioPath = "/path/to/your/file/test.wav"; // 音频文件路径
=======
private static String userName = ""; // 用户名, 请联系百度相关人员进行申请
private static String passWord = ""; // 密码, 请联系百度相关人员进行申请
private static String audioPath = ""; // 音频文件路径
private static Logger logger = LoggerFactory.getLogger(AsyncRecognizeWithStream.class);
>>>>>>>
private static String userName = "your_username"; // 用户名, 请联系百度相关人员进行申请
private static String passWord = "your_password"; // 密码, 请联系百度相关人员进行申请
private static String audioPath = "/path/to/your/file/test.wav"; // 音频文件路径
private static Logger logger = LoggerFactory.getLogger(AsyncRecognizeWithStream.class);
<<<<<<<
requestMetaData.setSendPerSeconds(0.02); // 指定每次发送的音频数据包大小,数值越大,识别越快,但准确率可能下降
=======
>>>>>>>
requestMetaData.setSendPerSeconds(0.02); // 指定每次发送的音频数据包大小,数值越大,识别越快,但准确率可能下降
<<<<<<<
requestMetaData.setEnableFlushData(true);// 是否返回中间翻译结果
final AtomicReference<DateTime> beginSend = new AtomicReference<DateTime>();
final StreamContext streamContext = asrClient.asyncRecognize(new Consumer<RecognitionResult>() {
=======
requestMetaData.setEnableFlushData(true);// 是否返回中间翻译结果
StreamContext streamContext = asrClient.asyncRecognize(new Consumer<RecognitionResult>() {
>>>>>>>
requestMetaData.setEnableFlushData(true);// 是否返回中间翻译结果
final AtomicReference<DateTime> beginSend = new AtomicReference<DateTime>();
final StreamContext streamContext = asrClient.asyncRecognize(new Consumer<RecognitionResult>() {
<<<<<<<
final FileInputStream audioStream = new FileInputStream(audioPath);
// 实时音频流的情况下,8k音频用320, 16k音频用640
final byte[] data = new byte[asrClient.getFragmentSize(requestMetaData)];
=======
FileInputStream audioStream = new FileInputStream(audioPath);
byte[] data = new byte[asrClient.getFragmentSize(requestMetaData)]; // byte 数组的大小要根据 requestMeta 计算出来
int readSize;
System.out.println(new DateTime().toString() + "\t" + Thread.currentThread().getId() + " start to send");
>>>>>>>
final FileInputStream audioStream = new FileInputStream(audioPath);
// 实时音频流的情况下,8k音频用320, 16k音频用640
final byte[] data = new byte[asrClient.getFragmentSize(requestMetaData)];
<<<<<<<
executor.shutdown();
=======
>>>>>>>
executor.shutdown(); |
<<<<<<<
=======
import org.mwg.Graph;
>>>>>>>
import org.mwg.Graph;
<<<<<<<
* @param variableNameToSet The name of the property to set, should be stored previously as a variable in task context.
* @return this task to chain actions (fluent API)
*/
Task set(String propertyName, String variableNameToSet);
/**
* Sets the value of an attribute of a node or an array of nodes with a variable value
* The node (or the array) should be init in the previous task
*
* @param propertyName The name of the attribute. Must be unique per node.
=======
>>>>>>> |
<<<<<<<
* @native ts
* this._index = p_index;
=======
* {@native ts
* this._world = p_world;
* this._time = p_time;
* this._id = p_id;
>>>>>>>
* {@native ts
* this._index = p_index;
<<<<<<<
* this._seed = -1;
=======
* this._currentIndex = new java.util.concurrent.atomic.AtomicLong(0);
* this.load(initialPayload);
* }
>>>>>>>
* this._seed = -1;
* }
<<<<<<<
* @native ts
* if (this._seed == org.mwg.Constants.KEY_PREFIX_MASK) {
=======
* {@native ts
* if (this._currentIndex.get() == org.mwg.Constants.KEY_PREFIX_MASK) {
>>>>>>>
* {@native ts
* if (this._seed == org.mwg.Constants.KEY_PREFIX_MASK) {
<<<<<<<
=======
@Override
public final long marks() {
return this._marks;
}
/**
* @native ts
* this._marks = this._marks + 1;
* return this._marks
*/
@Override
public final long mark() {
long before;
long after;
do {
before = _marks;
after = before + 1;
} while (!unsafe.compareAndSwapLong(this, _marksOffset, before, after));
return after;
}
/**
* @native ts
* this._marks = this._marks - 1;
* return this._marks
*/
@Override
public final long unmark() {
long before;
long after;
do {
before = _marks;
after = before - 1;
} while (!unsafe.compareAndSwapLong(this, _marksOffset, before, after));
return after;
}
@Override
public final long flags() {
return _flags;
}
/**
* {@native ts
* var val = this._flags
* var nval = val & ~bitsToDisable | bitsToEnable;
* this._flags = nval;
* return val != nval;
* }
*/
@Override
public final boolean setFlags(long bitsToEnable, long bitsToDisable) {
long val;
long nval;
do {
val = _flags;
nval = val & ~bitsToDisable | bitsToEnable;
} while (!unsafe.compareAndSwapLong(this, _flagsOffset, val, nval));
return val != nval;
}
@Override
public void setIndex(long p_index) {
this._index = p_index;
}
private void internal_set_dirty() {
if (_space != null) {
if ((_flags & CoreConstants.DIRTY_BIT) != CoreConstants.DIRTY_BIT) {
_space.declareDirty(this);
}
}
}
>>>>>>> |
<<<<<<<
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
=======
>>>>>>>
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
<<<<<<<
=======
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
>>>>>>>
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
<<<<<<<
if(mPlusClient != null && mPlusClient.isConnected()) {
plusButton.setVisibility(View.VISIBLE);
plusButton.initialize(mPlusClient, url, 1);
=======
if(mPlusClient != null) {
viewHolder.plusButton.setVisibility(View.VISIBLE);
viewHolder.plusButton.initialize(mPlusClient, viewHolder.url, 1);
>>>>>>>
if(mPlusClient != null && mPlusClient.isConnected()) {
viewHolder.plusButton.setVisibility(View.VISIBLE);
viewHolder.plusButton.initialize(mPlusClient, viewHolder.url, 1);
<<<<<<<
PlusOneButton plusButton = (PlusOneButton) view.findViewById(R.id.plus_one_button);
if(mPlusClient != null && mPlusClient.isConnected()) {
plusButton.setVisibility(View.VISIBLE);
plusButton.initialize(mPlusClient, activity.getUrl(), 1);
=======
if(mPlusClient != null) {
mViewHolder.plusButton.setVisibility(View.VISIBLE);
mViewHolder.plusButton.initialize(mPlusClient, activity.getUrl(), 1);
>>>>>>>
PlusOneButton plusButton = (PlusOneButton) view.findViewById(R.id.plus_one_button);
if(mPlusClient != null && mPlusClient.isConnected()) {
mViewHolder.plusButton.setVisibility(View.VISIBLE);
mViewHolder.plusButton.initialize(mPlusClient, activity.getUrl(), 1); |
<<<<<<<
import com.google.common.collect.ImmutableMap;
import com.google.common.net.HostAndPort;
=======
>>>>>>>
import com.google.common.collect.ImmutableMap; |
<<<<<<<
import butterknife.InjectView;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.google.android.gms.games.GamesClient;
import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;
=======
>>>>>>>
<<<<<<<
case R.string.devfest:
navigateTo(DevFestActivity.class);
=======
case Const.DRAWER_SPECIAL:
Bundle special = new Bundle();
special.putInt(Const.SPECIAL_EVENT_LOGO_EXTRA, R.drawable.ioextended);
special.putString(Const.SPECIAL_EVENT_VIEWTAG_EXTRA, "i-oextended");
special.putString(Const.SPECIAL_EVENT_CACHEKEY_EXTRA, "i-oextended");
special.putLong(Const.SPECIAL_EVENT_START_EXTRA, DateTime.now().getMillis());
special.putLong(Const.SPECIAL_EVENT_END_EXTRA, 1419984000000L);
special.putInt(Const.SPECIAL_EVENT_DESCRIPTION_EXTRA, R.string.ioextended_description);
navigateTo(SpecialEventActivity.class, special);
>>>>>>>
case Const.DRAWER_SPECIAL:
Bundle special = new Bundle();
special.putInt(Const.SPECIAL_EVENT_LOGO_EXTRA, R.drawable.ioextended);
special.putString(Const.SPECIAL_EVENT_VIEWTAG_EXTRA, "i-oextended");
special.putString(Const.SPECIAL_EVENT_CACHEKEY_EXTRA, "i-oextended");
special.putLong(Const.SPECIAL_EVENT_START_EXTRA, DateTime.now().getMillis());
special.putLong(Const.SPECIAL_EVENT_END_EXTRA, 1419984000000L);
special.putInt(Const.SPECIAL_EVENT_DESCRIPTION_EXTRA, R.string.ioextended_description);
navigateTo(SpecialEventActivity.class, special); |
<<<<<<<
String truststorePassword = primarySiteConfig
.get(Property.RPC_SSL_TRUSTSTORE_PASSWORD.getKey());
if (truststorePassword != null) {
=======
String truststorePassword =
primarySiteConfig.get(Property.RPC_SSL_TRUSTSTORE_PASSWORD.getKey());
if (null != truststorePassword) {
>>>>>>>
String truststorePassword =
primarySiteConfig.get(Property.RPC_SSL_TRUSTSTORE_PASSWORD.getKey());
if (truststorePassword != null) {
<<<<<<<
String credProvider = primarySiteConfig
.get(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey());
if (credProvider != null) {
=======
String credProvider =
primarySiteConfig.get(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey());
if (null != credProvider) {
>>>>>>>
String credProvider =
primarySiteConfig.get(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey());
if (credProvider != null) {
<<<<<<<
final Set<String> filesNeedingReplication = clientMaster.replicationOperations()
.referencedFiles(masterTable);
=======
final Set<String> filesNeedingReplication =
connMaster.replicationOperations().referencedFiles(masterTable);
>>>>>>>
final Set<String> filesNeedingReplication =
clientMaster.replicationOperations().referencedFiles(masterTable); |
<<<<<<<
/**
* Override this method if need to customize the behavior.
* {@inheritDoc}
*/
@Override
public boolean onHookGroupCollapse(int groupPosition, boolean fromUser, Object payload) {
return onHookGroupCollapse(groupPosition, fromUser);
}
=======
/**
* {@inheritDoc}
*/
@Override
public boolean getInitialGroupExpandedState(int groupPosition) {
return false;
}
>>>>>>>
/**
* Override this method if need to customize the behavior.
* {@inheritDoc}
*/
@Override
public boolean onHookGroupCollapse(int groupPosition, boolean fromUser, Object payload) {
return onHookGroupCollapse(groupPosition, fromUser);
/**
* {@inheritDoc}
*/
@Override
public boolean getInitialGroupExpandedState(int groupPosition) {
return false;
} |
<<<<<<<
import com.onedrive.sdk.authentication.adal.BrokerPermissionsChecker;
import com.onedrive.sdk.concurrency.ICallback;
import com.onedrive.sdk.concurrency.IExecutors;
import com.onedrive.sdk.concurrency.SimpleWaiter;
=======
import com.microsoft.onedrivesdk.BuildConfig;
import com.onedrive.sdk.concurrency.ICallback;
import com.onedrive.sdk.concurrency.IExecutors;
import com.onedrive.sdk.concurrency.SimpleWaiter;
>>>>>>>
import com.onedrive.sdk.authentication.adal.BrokerPermissionsChecker;
import com.microsoft.onedrivesdk.BuildConfig;
import com.onedrive.sdk.concurrency.ICallback;
import com.onedrive.sdk.concurrency.IExecutors;
import com.onedrive.sdk.concurrency.SimpleWaiter; |
<<<<<<<
=======
import android.text.TextUtils;
import android.util.Base64;
>>>>>>> |
<<<<<<<
import org.apache.mycommons.lang3.StringUtils;
=======
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
>>>>>>>
import org.apache.mycommons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
<<<<<<<
import org.liberty.android.fantastischmemo.tts.AnyMemoTTSPlatform;
import org.liberty.android.fantastischmemo.tts.AudioFileTTS;
import org.liberty.android.fantastischmemo.ui.CategoryEditorFragment.CategoryEditorResultListener;
import org.liberty.android.fantastischmemo.utils.AMGUIUtility;
import org.liberty.android.fantastischmemo.utils.AMUtil;
=======
import org.liberty.android.fantastischmemo.tts.AnyMemoTTSImpl;
>>>>>>>
import org.liberty.android.fantastischmemo.tts.AudioFileTTS;
import org.liberty.android.fantastischmemo.ui.CategoryEditorFragment.CategoryEditorResultListener;
import org.liberty.android.fantastischmemo.utils.AMGUIUtility;
import org.liberty.android.fantastischmemo.utils.AMUtil;
import org.liberty.android.fantastischmemo.tts.AnyMemoTTSImpl;
<<<<<<<
=======
import android.view.LayoutInflater;
>>>>>>>
import android.view.LayoutInflater;
<<<<<<<
case R.id.menu_auto_speak:
{
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
LinearLayout root = (LinearLayout)findViewById(R.id.root);
FrameLayout fl = new FrameLayout(this);
Fragment f = new AutoSpeakFragment();
fl.setId(MAGIC_FRAME_LAYOUT_ID);
root.addView(fl);
// Log.e(TAG, String.format("fl id is %d", fl.getId()));
ft.add(fl.getId(), f);
ft.commit();
return true;
}
}
return false;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo){
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.editscreen_context_menu, menu);
menu.setHeaderTitle(R.string.menu_text);
}
@Override
public boolean onContextItemSelected(MenuItem menuitem) {
switch(menuitem.getItemId()) {
=======
>>>>>>>
case R.id.menu_auto_speak:
{
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
LinearLayout root = (LinearLayout)findViewById(R.id.root);
FrameLayout fl = new FrameLayout(this);
Fragment f = new AutoSpeakFragment();
fl.setId(MAGIC_FRAME_LAYOUT_ID);
root.addView(fl);
// Log.e(TAG, String.format("fl id is %d", fl.getId()));
ft.add(fl.getId(), f);
ft.commit();
return true;
}
}
return false;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo){
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.editscreen_context_menu, menu);
menu.setHeaderTitle(R.string.menu_text);
}
@Override
public boolean onContextItemSelected(MenuItem menuitem) {
switch(menuitem.getItemId()) { |
<<<<<<<
private KeyAddress networkAdminKeyAddress = null;
private KeyAddress networkReconfigKeyAddress = null;
=======
public Map<String,Integer> minPayment = new HashMap<>();
public Map<String,Double> rate = new HashMap<>();
>>>>>>>
private KeyAddress networkAdminKeyAddress = null;
private KeyAddress networkReconfigKeyAddress = null;
public Map<String,Integer> minPayment = new HashMap<>();
public Map<String,Double> rate = new HashMap<>();
<<<<<<<
=======
private Bytes networkConfigIssuerKeyData = Bytes.fromHex("1E 08 1C 01 00 01 C4 00 01 83 D8 9D 79 7E 80 DD 69 3D 0A EC 27 66 B6 A4 5D DB E1 60 38 88 88 ED 07 03 E6 16 98 B0 2B 71 9B E1 85 A1 8C AF 0D 62 D6 60 3A 4B D2 FA 34 F0 2E 85 87 19 CE 6F 0C C6 DC 2B D5 11 12 C8 9A A6 F8 71 70 53 EE 3D B3 4C 97 1E 10 89 B1 77 2F 2B 6D D8 C7 B3 44 A4 8A E9 1A 42 AD F4 E0 82 74 11 A1 42 49 6C D1 87 35 94 10 66 19 80 AB 4A 13 27 B4 F0 BD C5 8F 43 25 9E 2C 6C CB 81 3C 85 10 CE 99 D6 2D 88 11 01 B6 5B F8 AB 99 15 70 08 AF B8 51 3B 4A CD 4D 9E A1 13 9C E9 EA 83 F0 95 02 E1 F6 10 72 E8 2B 2F 64 3F FB DC 27 F6 5A D2 83 BA 71 C3 D6 A2 AE 41 4F CA AA BB AA 54 C3 2F D9 F7 7A 64 AA 3A F7 67 AC 5A CA AA 20 08 90 CE D8 35 FA C0 2B 02 17 F4 0A BF 25 85 17 F9 DC 6E 6B 9D D8 A2 43 1E D1 0E CD 4F F4 FA 75 C1 62 BD 7B DD D4 2F 52 85 E0 FA 55 C7 B7 BB 4B 39 EB 08 74 C4 77");
private Bytes networkAdminKeyData = Bytes.fromHex("1E 08 1C 01 00 01 C4 00 01 83 D8 9D 79 7E 80 DD 69 3D 0A EC 27 66 B6 A4 5D DB E1 60 38 88 88 ED 07 03 E6 16 98 B0 2B 71 9B E1 85 A1 8C AF 0D 62 D6 60 3A 4B D2 FA 34 F0 2E 85 87 19 CE 6F 0C C6 DC 2B D5 11 12 C8 9A A6 F8 71 70 53 EE 3D B3 4C 97 1E 10 89 B1 77 2F 2B 6D D8 C7 B3 44 A4 8A E9 1A 42 AD F4 E0 82 74 11 A1 42 49 6C D1 87 35 94 10 66 19 80 AB 4A 13 27 B4 F0 BD C5 8F 43 25 9E 2C 6C CB 81 3C 85 10 CE 99 D6 2D 88 11 01 B6 5B F8 AB 99 15 70 08 AF B8 51 3B 4A CD 4D 9E A1 13 9C E9 EA 83 F0 95 02 E1 F6 10 72 E8 2B 2F 64 3F FB DC 27 F6 5A D2 83 BA 71 C3 D6 A2 AE 41 4F CA AA BB AA 54 C3 2F D9 F7 7A 64 AA 3A F7 67 AC 5A CA AA 20 08 90 CE D8 35 FA C0 2B 02 17 F4 0A BF 25 85 17 F9 DC 6E 6B 9D D8 A2 43 1E D1 0E CD 4F F4 FA 75 C1 62 BD 7B DD D4 2F 52 85 E0 FA 55 C7 B7 BB 4B 39 EB 08 74 C4 77");
private Bytes authorizedNameServiceCenterKeyData = Bytes.fromHex("1E 08 1C 01 00 01 C4 00 01 83 D8 9D 79 7E 80 DD 69 3D 0A EC 27 66 B6 A4 5D DB E1 60 38 88 88 ED 07 03 E6 16 98 B0 2B 71 9B E1 85 A1 8C AF 0D 62 D6 60 3A 4B D2 FA 34 F0 2E 85 87 19 CE 6F 0C C6 DC 2B D5 11 12 C8 9A A6 F8 71 70 53 EE 3D B3 4C 97 1E 10 89 B1 77 2F 2B 6D D8 C7 B3 44 A4 8A E9 1A 42 AD F4 E0 82 74 11 A1 42 49 6C D1 87 35 94 10 66 19 80 AB 4A 13 27 B4 F0 BD C5 8F 43 25 9E 2C 6C CB 81 3C 85 10 CE 99 D6 2D 88 11 01 B6 5B F8 AB 99 15 70 08 AF B8 51 3B 4A CD 4D 9E A1 13 9C E9 EA 83 F0 95 02 E1 F6 10 72 E8 2B 2F 64 3F FB DC 27 F6 5A D2 83 BA 71 C3 D6 A2 AE 41 4F CA AA BB AA 54 C3 2F D9 F7 7A 64 AA 3A F7 67 AC 5A CA AA 20 08 90 CE D8 35 FA C0 2B 02 17 F4 0A BF 25 85 17 F9 DC 6E 6B 9D D8 A2 43 1E D1 0E CD 4F F4 FA 75 C1 62 BD 7B DD D4 2F 52 85 E0 FA 55 C7 B7 BB 4B 39 EB 08 74 C4 77");
>>>>>>>
private PublicKey authorizedNameServiceCenterKey = null; |
<<<<<<<
import com.icodici.universa.contract.Contract;
import com.icodici.universa.node.network.TestKeys;
import com.icodici.universa.node2.ItemLock;
import com.icodici.universa.node2.Config;
import com.icodici.universa.node2.NodeInfo;
import com.icodici.universa.node2.NodeStats;
=======
>>>>>>>
import com.icodici.universa.contract.Contract;
import com.icodici.universa.node.network.TestKeys;
import com.icodici.universa.node2.ItemLock;
import com.icodici.universa.node2.Config;
import com.icodici.universa.node2.NodeInfo;
import com.icodici.universa.node2.NodeStats;
<<<<<<<
import java.net.DatagramSocket;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId;
=======
import java.sql.PreparedStatement;
import java.sql.ResultSet;
>>>>>>>
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId;
<<<<<<<
import java.time.temporal.ChronoUnit;
import java.util.*;
=======
import java.util.ArrayList;
import java.util.List;
>>>>>>>
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.ArrayList;
import java.util.List; |
<<<<<<<
public static final String NODE_VERSION = "2.4.6-a7";
private PostgresLedger ledger;
=======
public static final String NODE_VERSION = "3.0.1";
>>>>>>>
public static final String NODE_VERSION = "3.0.1";
private PostgresLedger ledger; |
<<<<<<<
=======
private void removeRevokedAddresses(Approvable approvable, Set<String> set) {
if (approvable instanceof UnsContract) {
UnsContract unsContract = (UnsContract) approvable;
for (UnsName unsName : unsContract.storedNames)
for (UnsRecord unsRecord : unsName.getUnsRecords())
for (KeyAddress keyAddress : unsRecord.getAddresses())
set.remove(keyAddress.toString());
}
for (Approvable revoked : approvable.getRevokingItems())
removeRevokedAddresses(revoked, set);
}
private boolean additionallyUnsCheck_isNamesAvailable(ImmutableEnvironment ime, List<String> reducedNames) {
boolean checkResult;
if (reducedNames.size() == 0)
return true;
>>>>>>>
private void removeRevokedAddresses(Approvable approvable, Set<String> set) {
if (approvable instanceof UnsContract) {
UnsContract unsContract = (UnsContract) approvable;
for (UnsName unsName : unsContract.storedNames)
for (UnsRecord unsRecord : unsName.getUnsRecords())
for (KeyAddress keyAddress : unsRecord.getAddresses())
set.remove(keyAddress.toString());
}
for (Approvable revoked : approvable.getRevokingItems())
removeRevokedAddresses(revoked, set);
}
<<<<<<<
ZonedDateTime expiresAt = prepaidFrom.plusSeconds((long) (prepaidNamesForDays * 24 * 3600));
storedNames.forEach(sn -> me.createNameRecord(sn,expiresAt));
=======
long environmentId = ledger.saveEnvironmentToStorage(getExtendedType(), getId(), Boss.pack(me), getPackedTransaction());
List<String> namesList = new ArrayList<>();
List<String> addressesList = new ArrayList<>();
List<HashId> originsList = new ArrayList<>();
// get number of entries
int entries = 0;
for (UnsName sn: storedNames)
entries += sn.getRecordsCount();
if (entries == 0)
entries = 1;
final int finalEntries = entries;
storedNames.forEach(sn -> {
namesList.add(sn.getUnsName());
NameRecordModel nrm = new NameRecordModel();
nrm.name_full = sn.getUnsName();
nrm.name_reduced = sn.getUnsNameReduced();
nrm.description = sn.getUnsDescription();
nrm.url = sn.getUnsURL();
nrm.expires_at = prepaidFrom.plusSeconds((long) (prepaidNamesForDays * 24 * 3600 / finalEntries));
nrm.entries = new ArrayList<>();
sn.getUnsRecords().forEach(snr ->{
NameEntryModel nem = new NameEntryModel();
if(snr.getOrigin() != null) {
nem.origin = snr.getOrigin().getDigest();
originsList.add(snr.getOrigin());
}
snr.getAddresses().forEach(keyAddress -> {
addressesList.add(keyAddress.toString());
if(keyAddress.isLong()) {
nem.long_addr = keyAddress.toString();
} else {
nem.short_addr = keyAddress.toString();
}
});
nrm.entries.add(nem);
});
nrm.environment_id = environmentId;
ledger.saveNameRecord(nrm);
}
);
nameCache.unlockNameList(namesList);
nameCache.unlockAddressList(addressesList);
nameCache.unlockOriginList(originsList);
>>>>>>>
// get number of entries
int entries = 0;
for (UnsName sn: storedNames)
entries += sn.getRecordsCount();
if (entries == 0)
entries = 1;
final int finalEntries = entries;
ZonedDateTime expiresAt = prepaidFrom.plusSeconds((long) (prepaidNamesForDays * 24 * 3600 / finalEntries));
storedNames.forEach(sn -> me.createNameRecord(sn,expiresAt));
<<<<<<<
ZonedDateTime expiresAt = prepaidFrom.plusSeconds((long) (prepaidNamesForDays * 24 * 3600));
Map<String, UnsName> newNames = storedNames.stream().collect(Collectors.toMap(UnsName::getUnsName, un -> un));
me.nameRecords().forEach( nameRecord -> {
UnsName unsName = newNames.get(nameRecord.getName());
if(unsName != null &&
unsName.getUnsRecords().size() == nameRecord.getEntries().size() &&
unsName.getUnsRecords().stream().allMatch(unsRecord -> nameRecord.getEntries().stream().anyMatch(nameRecordEntry -> unsRecord.equalsTo(nameRecordEntry)))) {
me.setNameRecordExpiresAt(nameRecord,expiresAt);
newNames.remove(nameRecord.getName());
} else {
me.destroyNameRecord(nameRecord);
}
});
newNames.values().forEach(sn -> me.createNameRecord(sn,expiresAt));
=======
ledger.removeEnvironment(getId());
long environmentId = ledger.saveEnvironmentToStorage(getExtendedType(), getId(), Boss.pack(me), getPackedTransaction());
List<String> namesList = new ArrayList<>();
List<String> addressesList = new ArrayList<>();
List<HashId> originsList = new ArrayList<>();
// get number of entries
int entries = 0;
for (UnsName sn: storedNames)
entries += sn.getRecordsCount();
if (entries == 0)
entries = 1;
final int finalEntries = entries;
storedNames.forEach(sn -> {
namesList.add(sn.getUnsName());
NameRecordModel nrm = new NameRecordModel();
nrm.name_full = sn.getUnsName();
nrm.name_reduced = sn.getUnsNameReduced();
nrm.description = sn.getUnsDescription();
nrm.url = sn.getUnsURL();
nrm.expires_at = prepaidFrom.plusSeconds((long) (prepaidNamesForDays * 24 * 3600 / finalEntries));
nrm.entries = new ArrayList<>();
sn.getUnsRecords().forEach(snr ->{
NameEntryModel nem = new NameEntryModel();
if(snr.getOrigin() != null) {
nem.origin = snr.getOrigin().getDigest();
originsList.add(snr.getOrigin());
}
snr.getAddresses().forEach(keyAddress -> {
addressesList.add(keyAddress.toString());
if(keyAddress.isLong()) {
nem.long_addr = keyAddress.toString();
} else {
nem.short_addr = keyAddress.toString();
}
});
nrm.entries.add(nem);
});
nrm.environment_id = environmentId;
ledger.saveNameRecord(nrm);
}
);
nameCache.unlockNameList(namesList);
nameCache.unlockAddressList(addressesList);
nameCache.unlockOriginList(originsList);
>>>>>>>
// get number of entries
int entries = 0;
for (UnsName sn: storedNames)
entries += sn.getRecordsCount();
if (entries == 0)
entries = 1;
final int finalEntries = entries;
ZonedDateTime expiresAt = prepaidFrom.plusSeconds((long) (prepaidNamesForDays * 24 * 3600 / finalEntries));
Map<String, UnsName> newNames = storedNames.stream().collect(Collectors.toMap(UnsName::getUnsName, un -> un));
me.nameRecords().forEach( nameRecord -> {
UnsName unsName = newNames.get(nameRecord.getName());
if(unsName != null &&
unsName.getUnsRecords().size() == nameRecord.getEntries().size() &&
unsName.getUnsRecords().stream().allMatch(unsRecord -> nameRecord.getEntries().stream().anyMatch(nameRecordEntry -> unsRecord.equalsTo(nameRecordEntry)))) {
me.setNameRecordExpiresAt(nameRecord,expiresAt);
newNames.remove(nameRecord.getName());
} else {
me.destroyNameRecord(nameRecord);
}
});
newNames.values().forEach(sn -> me.createNameRecord(sn,expiresAt)); |
<<<<<<<
assertEquals(ledger.getNameRecord(unsName.getUnsReducedName()).getEntries().size(),2);
=======
ItemResult itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
assertEquals(ledger.getNameRecord(unsName.getUnsNameReduced()).entries.size(),2);
>>>>>>>
ItemResult itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
assertEquals(ledger.getNameRecord(unsName.getUnsReducedName()).getEntries().size(),2);
<<<<<<<
assertEquals(ledger.getNameRecord(unsNameToChange.getUnsReducedName()).getEntries().size(),2);
assertEquals(ledger.getNameRecord(unsNameToRemove.getUnsReducedName()).getEntries().size(),1);
=======
ItemResult itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
assertEquals(ledger.getNameRecord(unsNameToChange.getUnsNameReduced()).entries.size(),2);
assertEquals(ledger.getNameRecord(unsNameToRemove.getUnsNameReduced()).entries.size(),1);
>>>>>>>
ItemResult itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
assertEquals(ledger.getNameRecord(unsNameToChange.getUnsReducedName()).getEntries().size(),2);
assertEquals(ledger.getNameRecord(unsNameToRemove.getUnsReducedName()).getEntries().size(),1);
<<<<<<<
assertEquals(ledger.getNameRecord(unsNameToChange.getUnsReducedName()).getEntries().size(),2);
assertEquals(ledger.getNameRecord(unsNameToAdd.getUnsReducedName()).getEntries().size(),1);
assertNull(ledger.getNameRecord(unsNameToRemove.getUnsReducedName()));
=======
itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
assertEquals(ledger.getNameRecord(unsNameToChange.getUnsNameReduced()).entries.size(),2);
assertEquals(ledger.getNameRecord(unsNameToAdd.getUnsNameReduced()).entries.size(),1);
assertNull(ledger.getNameRecord(unsNameToRemove.getUnsNameReduced()));
>>>>>>>
itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
assertEquals(ledger.getNameRecord(unsNameToChange.getUnsReducedName()).getEntries().size(),2);
assertEquals(ledger.getNameRecord(unsNameToAdd.getUnsReducedName()).getEntries().size(),1);
assertNull(ledger.getNameRecord(unsNameToRemove.getUnsReducedName()));
<<<<<<<
assertEquals(1, ledger.getNameRecord(reducedName).getEntries().size());
=======
ItemResult itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
assertEquals(1, ledger.getNameRecord(reducedName).entries.size());
>>>>>>>
ItemResult itemResult = node.waitItem(uns.getId(), 8000);
assertEquals("ok", itemResult.extraDataBinder.getBinder("onCreatedResult").getString("status", null));
assertEquals(1, ledger.getNameRecord(reducedName).getEntries().size());
<<<<<<<
assertEquals(ledger.getNameRecord(reducedName).getEntries().size(),1);
=======
assertEquals("ok", ir.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
assertEquals(ledger.getNameRecord(reducedName).entries.size(),1);
>>>>>>>
assertEquals("ok", ir.extraDataBinder.getBinder("onUpdateResult").getString("status", null));
assertEquals(ledger.getNameRecord(reducedName).getEntries().size(),1); |
<<<<<<<
// LogPrinter.showDebug(true);
node.resync(c.getId()).await();
=======
LogPrinter.showDebug(true);
node.resync(c.getId());
>>>>>>>
// LogPrinter.showDebug(true);
node.resync(c.getId()); |
<<<<<<<
String[] names = getUniqueNames(1);
String tableName = names[0];
NewTableConfiguration ntc = new NewTableConfiguration();
ntc.setProperties(Stream.of(new Pair<>(Property.TABLE_LOAD_BALANCER.getKey(), ChaoticLoadBalancer.class.getName()),
new Pair<>(Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K"), new Pair<>(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K")).collect(
Collectors.toMap(k -> k.getFirst(), v -> v.getSecond())));
c.tableOperations().create(tableName, ntc);
=======
String[] names = getUniqueNames(2);
String tableName = names[0], unused = names[1];
c.tableOperations().create(tableName);
c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
SortedSet<Text> splits = new TreeSet<>();
for (int i = 0; i < 100; i++) {
splits.add(new Text(String.format("%03d", i)));
}
c.tableOperations().create(unused);
c.tableOperations().addSplits(unused, splits);
>>>>>>>
String[] names = getUniqueNames(1);
String tableName = names[0];
NewTableConfiguration ntc = new NewTableConfiguration();
ntc.setProperties(Stream.of(new Pair<>(Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K"), new Pair<>(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K")).collect(
Collectors.toMap(k -> k.getFirst(), v -> v.getSecond())));
c.tableOperations().create(tableName, ntc); |
<<<<<<<
import com.icodici.crypto.PrivateKey;
import com.icodici.db.PooledDb;
import com.icodici.universa.Approvable;
=======
import com.icodici.db.PooledDb;
>>>>>>>
import com.icodici.crypto.PrivateKey;
import com.icodici.db.PooledDb;
import com.icodici.universa.Approvable;
<<<<<<<
import com.icodici.universa.node2.ItemLock;
=======
import com.icodici.universa.node2.Config;
>>>>>>>
import com.icodici.universa.node2.ItemLock;
import com.icodici.universa.node2.Config;
<<<<<<<
import java.util.*;
=======
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
>>>>>>>
import java.time.temporal.ChronoUnit;
import java.util.*; |
<<<<<<<
boolean isAllNameRecordsAvailable(final Collection<String> reducedNames);
boolean isAllOriginsAvailable(final Collection<HashId> origins);
boolean isAllAddressesAvailable(final Collection<String> addresses);
=======
NameRecordModel getNameByAddress (String address);
NameRecordModel getNameByOrigin (byte[] origin);
boolean isAllNameRecordsAvailable(final List<String> reducedNames);
boolean isAllOriginsAvailable(final List<HashId> origins);
boolean isAllAddressesAvailable(final List<String> addresses);
>>>>>>>
NameRecordModel getNameByAddress (String address);
NameRecordModel getNameByOrigin (byte[] origin);
boolean isAllNameRecordsAvailable(final Collection<String> reducedNames);
boolean isAllOriginsAvailable(final Collection<HashId> origins);
boolean isAllAddressesAvailable(final Collection<String> addresses); |
<<<<<<<
public EnvCache getEnvCache() {
return envCache;
}
=======
public PublicKey getNodeKey() {
return myInfo.getPublicKey();
}
>>>>>>>
public EnvCache getEnvCache() {
return envCache;
}
public PublicKey getNodeKey() {
return myInfo.getPublicKey();
} |
<<<<<<<
@Ignore
@Test
public void checkMemoryLeaks() throws Exception {
List<String> dbUrls = new ArrayList<>();
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t1");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t2");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t3");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t4");
List<Ledger> ledgers = new ArrayList<>();
for (int it = 0; it < 100; it++) {
if (it % 10 == 0)
System.out.println("Iteration " + it);
dbUrls.stream().forEach(url -> {
try {
clearLedger(url);
PostgresLedger ledger = new PostgresLedger(url);
ledgers.add(ledger);
} catch (Exception e) {
e.printStackTrace();
}
});
TestSpace ts = prepareTestSpace();
ts.node.config.getKeysWhiteList().add(TestKeys.publicKey(3));
Contract testContract = new Contract(ts.myKey);
testContract.seal();
assertTrue(testContract.isOk());
Parcel parcel = createParcelWithFreshTU(ts.client, testContract, Do.listOf(ts.myKey));
ts.client.registerParcel(parcel.pack(), 18000);
Contract testContract2 = new Contract(ts.myKey);
testContract2.seal();
assertTrue(testContract2.isOk());
ts.client.register(testContract2.getPackedTransaction(), 18000);
ts.nodes.forEach(x -> x.shutdown());
ts.myKey = null;
ts.nodes.clear();
ts.node = null;
ts.nodes = null;
ts.client = null;
ts = null;
ledgers.stream().forEach(ledger -> ledger.close());
ledgers.clear();
System.gc();
Thread.sleep(2000);
}
}
@Ignore
@Test
public void checkPublicKeyMemoryLeak() throws Exception {
byte[] bytes = Do.read("./src/test_contracts/keys/tu_key.public.unikey");
for (int it = 0; it < 10000; it++) {
PublicKey pk = new PublicKey(bytes);
pk = null;
System.gc();
}
}
=======
@Before
public void clearLedgers() throws Exception {
List<String> dbUrls = new ArrayList<>();
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t1");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t2");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t3");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t4");
List<Ledger> ledgers = new ArrayList<>();
dbUrls.stream().forEach(url -> {
try {
clearLedger(url);
PostgresLedger ledger = new PostgresLedger(url);
ledgers.add(ledger);
} catch (Exception e) {
e.printStackTrace();
}
});
}
>>>>>>>
@Ignore
@Test
public void checkMemoryLeaks() throws Exception {
List<String> dbUrls = new ArrayList<>();
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t1");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t2");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t3");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t4");
List<Ledger> ledgers = new ArrayList<>();
for (int it = 0; it < 100; it++) {
if (it % 10 == 0)
System.out.println("Iteration " + it);
dbUrls.stream().forEach(url -> {
try {
clearLedger(url);
PostgresLedger ledger = new PostgresLedger(url);
ledgers.add(ledger);
} catch (Exception e) {
e.printStackTrace();
}
});
TestSpace ts = prepareTestSpace();
ts.node.config.getKeysWhiteList().add(TestKeys.publicKey(3));
Contract testContract = new Contract(ts.myKey);
testContract.seal();
assertTrue(testContract.isOk());
Parcel parcel = createParcelWithFreshTU(ts.client, testContract, Do.listOf(ts.myKey));
ts.client.registerParcel(parcel.pack(), 18000);
Contract testContract2 = new Contract(ts.myKey);
testContract2.seal();
assertTrue(testContract2.isOk());
ts.client.register(testContract2.getPackedTransaction(), 18000);
ts.nodes.forEach(x -> x.shutdown());
ts.myKey = null;
ts.nodes.clear();
ts.node = null;
ts.nodes = null;
ts.client = null;
ts = null;
ledgers.stream().forEach(ledger -> ledger.close());
ledgers.clear();
System.gc();
Thread.sleep(2000);
}
}
@Ignore
@Test
public void checkPublicKeyMemoryLeak() throws Exception {
byte[] bytes = Do.read("./src/test_contracts/keys/tu_key.public.unikey");
for (int it = 0; it < 10000; it++) {
PublicKey pk = new PublicKey(bytes);
pk = null;
System.gc();
}
}
@Before
public void clearLedgers() throws Exception {
List<String> dbUrls = new ArrayList<>();
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t1");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t2");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t3");
dbUrls.add("jdbc:postgresql://localhost:5432/universa_node_t4");
List<Ledger> ledgers = new ArrayList<>();
dbUrls.stream().forEach(url -> {
try {
clearLedger(url);
PostgresLedger ledger = new PostgresLedger(url);
ledgers.add(ledger);
} catch (Exception e) {
e.printStackTrace();
}
});
}
<<<<<<<
@Test(timeout = 30000)
public void freeRegistrationsAllowedFromCoreVersion() throws Exception {
List<Main> mm = new ArrayList<>();
for (int i = 0; i < 4; i++)
mm.add(createMain("node" + (i + 1), false));
Main main = mm.get(0);
Client client = new Client(TestKeys.privateKey(20), main.myInfo, null);
Contract contract = new Contract(TestKeys.privateKey(0));
contract.seal();
ItemState expectedState = ItemState.UNDEFINED;
if (Core.VERSION.contains("private"))
expectedState = ItemState.APPROVED;
System.out.println("Core.VERSION: " + Core.VERSION);
System.out.println("expectedState: " + expectedState);
ItemResult itemResult = client.register(contract.getPackedTransaction(), 5000);
System.out.println("itemResult: " + itemResult);
assertEquals(expectedState, itemResult.state);
}
@Test(timeout = 30000)
public void freeRegistrationsAllowedFromConfigOrVersion() throws Exception {
List<Main> mm = new ArrayList<>();
for (int i = 0; i < 4; i++)
mm.add(createMain("node" + (i + 1), false));
Main main = mm.get(0);
main.config.setIsFreeRegistrationsAllowedFromYaml(true);
Client client = new Client(TestKeys.privateKey(20), main.myInfo, null);
Contract contract = new Contract(TestKeys.privateKey(0));
contract.seal();
ItemState expectedState = ItemState.APPROVED;
System.out.println("expectedState: " + expectedState);
ItemResult itemResult = client.register(contract.getPackedTransaction(), 5000);
System.out.println("itemResult: " + itemResult);
assertEquals(expectedState, itemResult.state);
main.config.setIsFreeRegistrationsAllowedFromYaml(false);
contract = new Contract(TestKeys.privateKey(0));
contract.seal();
expectedState = ItemState.UNDEFINED;
if (Core.VERSION.contains("private"))
expectedState = ItemState.APPROVED;
System.out.println("Core.VERSION: " + Core.VERSION);
System.out.println("expectedState: " + expectedState);
itemResult = client.register(contract.getPackedTransaction(), 5000);
System.out.println("itemResult: " + itemResult);
assertEquals(expectedState, itemResult.state);
}
=======
>>>>>>>
@Test(timeout = 30000)
public void freeRegistrationsAllowedFromCoreVersion() throws Exception {
List<Main> mm = new ArrayList<>();
for (int i = 0; i < 4; i++)
mm.add(createMain("node" + (i + 1), false));
Main main = mm.get(0);
Client client = new Client(TestKeys.privateKey(20), main.myInfo, null);
Contract contract = new Contract(TestKeys.privateKey(0));
contract.seal();
ItemState expectedState = ItemState.UNDEFINED;
if (Core.VERSION.contains("private"))
expectedState = ItemState.APPROVED;
System.out.println("Core.VERSION: " + Core.VERSION);
System.out.println("expectedState: " + expectedState);
ItemResult itemResult = client.register(contract.getPackedTransaction(), 5000);
System.out.println("itemResult: " + itemResult);
assertEquals(expectedState, itemResult.state);
}
@Test(timeout = 30000)
public void freeRegistrationsAllowedFromConfigOrVersion() throws Exception {
List<Main> mm = new ArrayList<>();
for (int i = 0; i < 4; i++)
mm.add(createMain("node" + (i + 1), false));
Main main = mm.get(0);
main.config.setIsFreeRegistrationsAllowedFromYaml(true);
Client client = new Client(TestKeys.privateKey(20), main.myInfo, null);
Contract contract = new Contract(TestKeys.privateKey(0));
contract.seal();
ItemState expectedState = ItemState.APPROVED;
System.out.println("expectedState: " + expectedState);
ItemResult itemResult = client.register(contract.getPackedTransaction(), 5000);
System.out.println("itemResult: " + itemResult);
assertEquals(expectedState, itemResult.state);
main.config.setIsFreeRegistrationsAllowedFromYaml(false);
contract = new Contract(TestKeys.privateKey(0));
contract.seal();
expectedState = ItemState.UNDEFINED;
if (Core.VERSION.contains("private"))
expectedState = ItemState.APPROVED;
System.out.println("Core.VERSION: " + Core.VERSION);
System.out.println("expectedState: " + expectedState);
itemResult = client.register(contract.getPackedTransaction(), 5000);
System.out.println("itemResult: " + itemResult);
assertEquals(expectedState, itemResult.state);
} |
<<<<<<<
=======
assertEquals(6569, sum);
>>>>>>> |
<<<<<<<
@Getter
private List<EggIncubator> incubators;
@Getter
private List<Pokemon> eggs;
=======
@Getter
private Hatchery hatchery;
>>>>>>>
@Getter
private List<EggIncubator> incubators;
@Getter
private Hatchery hatchery;
<<<<<<<
incubators = new ArrayList<>();
eggs = new ArrayList<>();
=======
hatchery = new Hatchery(api);
>>>>>>>
incubators = new ArrayList<>();
hatchery = new Hatchery(api); |
<<<<<<<
public void visitBeforeChildren(T node, NodeHandler<T> handler)
=======
@Override
public void visitBeforeChildren(ConfigurationNode node)
>>>>>>>
@Override
public void visitBeforeChildren(T node, NodeHandler<T> handler)
<<<<<<<
public void visitAfterChildren(T node, NodeHandler<T> handler)
=======
@Override
public void visitAfterChildren(ConfigurationNode node)
>>>>>>>
@Override
public void visitAfterChildren(T node, NodeHandler<T> handler) |
<<<<<<<
public void visitBeforeChildren(ConfigurationNode node,
NodeHandler<ConfigurationNode> handler)
=======
@Override
public void visitBeforeChildren(ConfigurationNode node)
>>>>>>>
@Override
public void visitBeforeChildren(ConfigurationNode node,
NodeHandler<ConfigurationNode> handler)
<<<<<<<
public void visitAfterChildren(ConfigurationNode node,
NodeHandler<ConfigurationNode> handler)
=======
@Override
public void visitAfterChildren(ConfigurationNode node)
>>>>>>>
@Override
public void visitAfterChildren(ConfigurationNode node,
NodeHandler<ConfigurationNode> handler) |
<<<<<<<
import java.awt.event.MouseListener;
=======
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
>>>>>>>
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
<<<<<<<
import msg.ClientBackChess;
import msg.ClientBackResult;
import msg.ClientBeReady;
import msg.ClientClickChatMsg;
import msg.ClientMovePieces;
=======
import msg.*;
>>>>>>>
import msg.*;
<<<<<<<
public Room(int roomid, boolean isleft) {//网络对战模式
MyClient.getMyClient().setRoom(this);
System.out.println("网络对战");
=======
public Room(int roomid, boolean isleft,RoomList roomList) {
this.roomList=roomList;
>>>>>>>
public Room(int roomid, boolean isleft,RoomList roomList) {
this.roomList=roomList;
MyClient.getMyClient().setRoom(this);
System.out.println("网络对战");
<<<<<<<
init(0);
=======
// this.rightPlayer = room.getRightPlayer();
// this.status = room.getStatus();
if(isleft==true){
//System.out.println("房间"+rid+":左边有人坐下来了"+leftPlayer.getName());
}
else{
//System.out.println("房间"+rid+":右边有人坐下来了"+rightPlayer.getName());
}
init(0);
>>>>>>>
init(0);
<<<<<<<
public Room(RoomList roomList) {
this.roomList = roomList;
init(0);//网络对战
}
=======
>>>>>>> |
<<<<<<<
=======
/**
* 功能: 查找玩家信息
* @return 返回实体类供他人调用
*/
public List<User> findAll() {
// TODO Auto-generated method stub
String sql="select * from userinfo";
ResultSet rs=b.doQuery(sql);
ArrayList list=new ArrayList();
User ui=null;
try {
while(rs.next())
{
ui=new User(rs.getString(1),rs.getString(2),rs.getInt(3));
list.add(ui);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
>>>>>>> |
<<<<<<<
=======
getContentPane().setLayout(new BorderLayout(0, 0));
JPanel gamerInfo = new JPanel();
getContentPane().add(gamerInfo, BorderLayout.WEST);
JPanel gameRoom = new JPanel();
getContentPane().add(gameRoom, BorderLayout.CENTER);
gameRoom.setLayout(new BorderLayout(0, 0));
JPanel UIPanel = new JPanel();
gameRoom.add(UIPanel, BorderLayout.SOUTH);
gamerInfo.setLayout(new GridLayout(0, 1, 0, 0));
JPanel gamer1 = new JPanel();
gamerInfo.add(gamer1);
JPanel gamer2 = new JPanel();
gamerInfo.add(gamer2);
Chess chessPanel=new Chess();
gameRoom.add(chessPanel, BorderLayout.CENTER);
UIPanel.setLayout(new BorderLayout(0, 0));
JButton But_ready = new JButton("准备");
UIPanel.add(But_ready, BorderLayout.WEST);
JButton But_start = new JButton("开始");
UIPanel.add(But_start, BorderLayout.CENTER);
JButton But_exit = new JButton("退出");
But_exit.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
toRoomList();
}
});
UIPanel.add(But_exit, BorderLayout.EAST);
gamer1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
JLabel lblNewLabel = new JLabel("对手信息标签");
gamer1.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("个人信息标签");
gamer2.add(lblNewLabel_1);
JPanel logoPanel = new JPanel();
gameRoom.add(logoPanel, BorderLayout.NORTH);
logoPanel.setLayout(new BorderLayout(0, 0));
JLabel lbllogo = new JLabel("五子棋LOGO");
logoPanel.add(lbllogo, BorderLayout.NORTH);
JPanel chatRoom = new JPanel();
getContentPane().add(chatRoom, BorderLayout.EAST);
chatRoom.setLayout(new BorderLayout(0, 0));
JLabel label_1 = new JLabel("聊天室");
chatRoom.add(label_1);
>>>>>>> |
<<<<<<<
import net.sf.redmine_mylyn.internal.api.client.RedmineApiIssueProperty;
import net.sf.redmine_mylyn.internal.api.parser.adapter.type.WatchersType;
=======
>>>>>>>
import net.sf.redmine_mylyn.internal.api.parser.adapter.type.WatchersType; |
<<<<<<<
=======
import blue.BlueSystem;
import blue.components.AlphaMarquee;
import blue.event.EditModeListener;
import blue.event.GroupMovementSelectionList;
import blue.event.SelectionEvent;
import blue.event.SelectionListener;
import blue.orchestra.blueSynthBuilder.BSBGraphicInterface;
import blue.orchestra.blueSynthBuilder.BSBObject;
import blue.orchestra.blueSynthBuilder.BSBObjectEntry;
import blue.orchestra.blueSynthBuilder.GridSettings;
import blue.ui.utilities.UiUtilities;
import java.awt.Graphics;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
>>>>>>>
<<<<<<<
=======
// if(viewHolder.)
>>>>>>> |
<<<<<<<
import java.util.List;
import java.util.StringTokenizer;
=======
>>>>>>>
<<<<<<<
if (tempNote != null) {
notes.add(tempNote);
previousNote = tempNote;
}
=======
break;
>>>>>>>
break;
<<<<<<<
returnText.append("N").append(i).append(": s>").append(nl.get(i).getStartTime()).append(" d>").append(nl.get(i).getSubjectiveDuration()).append("\n");
=======
returnText.append("N").append(i).append(": s>").append(
nl.getNote(i).getStartTime()).append(" d>").append(
nl.getNote(i).getSubjectiveDuration()).append("\n");
>>>>>>>
returnText.append("N").append(i).append(": s>").append(nl.get(i).getStartTime()).append(" d>").append(nl.get(i).getSubjectiveDuration()).append("\n"); |
<<<<<<<
TransformBlock(mcu.y);
if (header.colorComponents.size() > 1) {
TransformBlock(mcu.cb);
TransformBlock(mcu.cr);
=======
MCUInverseDCT(mcu.y);
if (header.numComponents > 1) {
MCUInverseDCT(mcu.cb);
MCUInverseDCT(mcu.cr);
>>>>>>>
TransformBlock(mcu.y);
if (header.numComponents > 1) {
TransformBlock(mcu.cb);
TransformBlock(mcu.cr); |
<<<<<<<
String tableId = ReplicationSchema.StatusSection.getTableId(entry.getKey());
log.info("Processing replication status record for " + file + " on table " + tableId);
=======
ReplicationSchema.StatusSection.getTableId(entry.getKey(), tableId);
log.debug("Processing replication status record for " + file + " on table " + tableId);
>>>>>>>
String tableId = ReplicationSchema.StatusSection.getTableId(entry.getKey());
log.debug("Processing replication status record for " + file + " on table " + tableId); |
<<<<<<<
public <T> Subscription schedule(T state, Func2<? super Scheduler, ? super T, ? extends Subscription> action, long delayTime, TimeUnit unit) {
queue.add(new TimedAction<T>(this, time + unit.toNanos(delayTime), action, state));
return Subscriptions.empty();
=======
public <T> Subscription schedule(T state, Func2<Scheduler, T, Subscription> action, long delayTime, TimeUnit unit) {
final TimedAction<T> timedAction = new TimedAction<T>(this, time + unit.toNanos(delayTime), action, state);
queue.add(timedAction);
return new Subscription() {
@Override
public void unsubscribe() {
timedAction.cancel();
}
};
>>>>>>>
public <T> Subscription schedule(T state, Func2<? super Scheduler, ? super T, ? extends Subscription> action, long delayTime, TimeUnit unit) {
final TimedAction<T> timedAction = new TimedAction<T>(this, time + unit.toNanos(delayTime), action, state);
queue.add(timedAction);
return new Subscription() {
@Override
public void unsubscribe() {
timedAction.cancel();
}
}; |
<<<<<<<
import rx.operators.OperationThrottle;
import rx.operators.OperationThrottleWithTimeout;
import rx.operators.OperationThrottleLast;
=======
import rx.operators.OperationThrottleFirst;
>>>>>>>
import rx.operators.OperationThrottle;
import rx.operators.OperationThrottleFirst;
import rx.operators.OperationThrottleWithTimeout;
import rx.operators.OperationThrottleLast;
<<<<<<<
* Throttles by dropping all values that are followed by newer values before the timeout value expires. The timer reset on each `onNext` call.
* <p>
* NOTE: If the timeout is set higher than the rate of traffic then this will drop all data.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
* @param unit
* The {@link TimeUnit} for the timeout.
*
* @return An {@link Observable} which filters out values which are too quickly followed up with newer values.
*/
public Observable<T> throttleWithTimeout(long timeout, TimeUnit unit) {
return create(OperationThrottleWithTimeout.throttleWithTimeout(this, timeout, unit));
}
/**
* Throttles by dropping all values that are followed by newer values before the timeout value expires. The timer reset on each `onNext` call.
* <p>
* NOTE: If the timeout is set higher than the rate of traffic then this will drop all data.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
* @param unit
* The unit of time for the specified timeout.
* @param scheduler
* The {@link Scheduler} to use internally to manage the timers which handle timeout for each event.
* @return Observable which performs the throttle operation.
*/
public Observable<T> throttleWithTimeout(long timeout, TimeUnit unit, Scheduler scheduler) {
return create(OperationThrottleWithTimeout.throttleWithTimeout(this, timeout, unit, scheduler));
}
/**
* Throttles the {@link Observable} by dropping values which are followed by newer values before the timer has expired.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
*
* @param unit
* The {@link TimeUnit} for the timeout.
*
* @return An {@link Observable} which filters out values which are too quickly followed up with newer values.
*/
public Observable<T> throttleLast(long timeout, TimeUnit unit) {
return create(OperationThrottleLast.throttleLast(this, timeout, unit));
}
/**
* Throttles the {@link Observable} by dropping values which are followed by newer values before the timer has expired.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
* @param unit
* The {@link TimeUnit} for the timeout.
* @param scheduler
* The {@link Scheduler} to use when timing incoming values.
* @return An {@link Observable} which filters out values which are too quickly followed up with newer values.
*/
public Observable<T> throttleLast(long timeout, TimeUnit unit, Scheduler scheduler) {
return create(OperationThrottleLast.throttleLast(this, timeout, unit, scheduler));
}
/**
=======
* Throttles to first value in each window.
*
* @param windowDuration
* Duration of windows within with the first value will be chosen.
* @param unit
* The unit of time for the specified timeout.
* @return Observable which performs the throttle operation.
*/
public Observable<T> throttleFirst(long windowDuration, TimeUnit unit) {
return create(OperationThrottleFirst.throttleFirst(this, windowDuration, unit));
}
/**
* Throttles to first value in each window.
*
* @param windowDuration
* Duration of windows within with the first value will be chosen.
* @param unit
* The unit of time for the specified timeout.
* @param scheduler
* The {@link Scheduler} to use internally to manage the timers which handle timeout for each event.
* @return Observable which performs the throttle operation.
*/
public Observable<T> throttleFirst(long windowDuration, TimeUnit unit, Scheduler scheduler) {
return create(OperationThrottleFirst.throttleFirst(this, windowDuration, unit, scheduler));
}
/**
>>>>>>>
* Throttles by dropping all values that are followed by newer values before the timeout value expires. The timer reset on each `onNext` call.
* <p>
* NOTE: If the timeout is set higher than the rate of traffic then this will drop all data.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
* @param unit
* The {@link TimeUnit} for the timeout.
*
* @return An {@link Observable} which filters out values which are too quickly followed up with newer values.
*/
public Observable<T> throttleWithTimeout(long timeout, TimeUnit unit) {
return create(OperationThrottleWithTimeout.throttleWithTimeout(this, timeout, unit));
}
/**
* Throttles by dropping all values that are followed by newer values before the timeout value expires. The timer reset on each `onNext` call.
* <p>
* NOTE: If the timeout is set higher than the rate of traffic then this will drop all data.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
* @param unit
* The unit of time for the specified timeout.
* @param scheduler
* The {@link Scheduler} to use internally to manage the timers which handle timeout for each event.
* @return Observable which performs the throttle operation.
*/
public Observable<T> throttleWithTimeout(long timeout, TimeUnit unit, Scheduler scheduler) {
return create(OperationThrottleWithTimeout.throttleWithTimeout(this, timeout, unit, scheduler));
}
/**
* Throttles to first value in each window.
*
* @param windowDuration
* Duration of windows within with the first value will be chosen.
* @param unit
* The unit of time for the specified timeout.
* @return Observable which performs the throttle operation.
*/
public Observable<T> throttleFirst(long windowDuration, TimeUnit unit) {
return create(OperationThrottleFirst.throttleFirst(this, windowDuration, unit));
}
/**
* Throttles to first value in each window.
*
* @param windowDuration
* Duration of windows within with the first value will be chosen.
* @param unit
* The unit of time for the specified timeout.
* @param scheduler
* The {@link Scheduler} to use internally to manage the timers which handle timeout for each event.
* @return Observable which performs the throttle operation.
*/
public Observable<T> throttleFirst(long windowDuration, TimeUnit unit, Scheduler scheduler) {
return create(OperationThrottleFirst.throttleFirst(this, windowDuration, unit, scheduler));
}
/**
* Throttles the {@link Observable} by dropping values which are followed by newer values before the timer has expired.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
*
* @param unit
* The {@link TimeUnit} for the timeout.
*
* @return An {@link Observable} which filters out values which are too quickly followed up with newer values.
*/
public Observable<T> throttleLast(long timeout, TimeUnit unit) {
return create(OperationThrottleLast.throttleLast(this, timeout, unit));
}
/**
* Throttles the {@link Observable} by dropping values which are followed by newer values before the timer has expired.
*
* @param timeout
* The time each value has to be 'the most recent' of the {@link Observable} to ensure that it's not dropped.
* @param unit
* The {@link TimeUnit} for the timeout.
* @param scheduler
* The {@link Scheduler} to use when timing incoming values.
* @return An {@link Observable} which filters out values which are too quickly followed up with newer values.
*/
public Observable<T> throttleLast(long timeout, TimeUnit unit, Scheduler scheduler) {
return create(OperationThrottleLast.throttleLast(this, timeout, unit, scheduler));
}
/** |
<<<<<<<
import rx.util.Pair;
=======
import rx.util.Exceptions;
>>>>>>>
import rx.util.Exceptions;
import rx.util.Pair;
<<<<<<<
@Test
public void testTakeUntil() {
Subscription sSource = mock(Subscription.class);
Subscription sOther = mock(Subscription.class);
TestObservable source = new TestObservable(sSource);
TestObservable other = new TestObservable(sOther);
Observer<String> result = mock(Observer.class);
Observable<String> stringObservable = takeUntil(source, other);
stringObservable.subscribe(result);
source.sendOnNext("one");
source.sendOnNext("two");
other.sendOnNext("three");
source.sendOnNext("four");
source.sendOnCompleted();
other.sendOnCompleted();
verify(result, times(1)).onNext("one");
verify(result, times(1)).onNext("two");
verify(result, times(0)).onNext("three");
verify(result, times(0)).onNext("four");
verify(sSource, times(1)).unsubscribe();
verify(sOther, times(1)).unsubscribe();
}
private static class TestObservable extends Observable<String> {
Observer<String> observer = null;
Subscription s;
public TestObservable(Subscription s) {
this.s = s;
}
/* used to simulate subscription */
public void sendOnCompleted() {
observer.onCompleted();
}
/* used to simulate subscription */
public void sendOnNext(String value) {
observer.onNext(value);
}
/* used to simulate subscription */
@SuppressWarnings("unused")
public void sendOnError(Exception e) {
observer.onError(e);
}
@Override
public Subscription subscribe(final Observer<String> observer) {
this.observer = observer;
return s;
}
}
=======
@Test
public void testToIterable() {
Observable<String> obs = toObservable("one", "two", "three");
Iterator<String> it = obs.toIterable().iterator();
assertEquals(true, it.hasNext());
assertEquals("one", it.next());
assertEquals(true, it.hasNext());
assertEquals("two", it.next());
assertEquals(true, it.hasNext());
assertEquals("three", it.next());
assertEquals(false, it.hasNext());
}
@Test(expected = TestException.class)
public void testToIterableWithException() {
Observable<String> obs = create(new Func1<Observer<String>, Subscription>() {
@Override
public Subscription call(Observer<String> observer) {
observer.onNext("one");
observer.onError(new TestException());
return Observable.noOpSubscription();
}
});
Iterator<String> it = obs.toIterable().iterator();
assertEquals(true, it.hasNext());
assertEquals("one", it.next());
assertEquals(true, it.hasNext());
it.next();
}
@Test
public void testLastOrDefault1() {
Observable<String> observable = toObservable("one", "two", "three");
assertEquals("three", observable.lastOrDefault("default"));
}
@Test
public void testLastOrDefault2() {
Observable<String> observable = toObservable();
assertEquals("default", observable.lastOrDefault("default"));
}
@Test
public void testLastOrDefault() {
Observable<Integer> observable = toObservable(1, 0, -1);
int last = observable.lastOrDefault(-100, new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args >= 0;
}
});
assertEquals(0, last);
}
@Test
public void testLastOrDefaultWrongPredicate() {
Observable<Integer> observable = toObservable(-1, -2, -3);
int last = observable.lastOrDefault(0, new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args >= 0;
}
});
assertEquals(0, last);
}
@Test
public void testLastOrDefaultWithPredicate() {
Observable<Integer> observable = toObservable(1, 0, -1);
int last = observable.lastOrDefault(0, new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args < 0;
}
});
assertEquals(-1, last);
}
public void testSingle() {
Observable<String> observable = toObservable("one");
assertEquals("one", observable.single());
}
@Test
public void testSingleDefault() {
Observable<String> observable = toObservable();
assertEquals("default", observable.singleOrDefault("default"));
}
@Test(expected = IllegalStateException.class)
public void testSingleDefaultWithMoreThanOne() {
Observable<String> observable = toObservable("one", "two", "three");
observable.singleOrDefault("default");
}
@Test
public void testSingleWithPredicateDefault() {
Observable<String> observable = toObservable("one", "two", "four");
assertEquals("four", observable.single(new Func1<String, Boolean>() {
@Override
public Boolean call(String s) {
return s.length() == 4;
}
}));
}
@Test(expected = IllegalStateException.class)
public void testSingleWrong() {
Observable<Integer> observable = toObservable(1, 2);
observable.single();
}
@Test(expected = IllegalStateException.class)
public void testSingleWrongPredicate() {
Observable<Integer> observable = toObservable(-1);
observable.single(new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args > 0;
}
});
}
@Test
public void testSingleDefaultPredicateMatchesNothing() {
Observable<String> observable = toObservable("one", "two");
String result = observable.singleOrDefault("default", new Func1<String, Boolean>() {
@Override
public Boolean call(String args) {
return args.length() == 4;
}
});
assertEquals("default", result);
}
@Test(expected = IllegalStateException.class)
public void testSingleDefaultPredicateMatchesMoreThanOne() {
Observable<String> observable = toObservable("one", "two");
String result = observable.singleOrDefault("default", new Func1<String, Boolean>() {
@Override
public Boolean call(String args) {
return args.length() == 3;
}
});
}
private static class TestException extends RuntimeException {
}
>>>>>>>
@Test
public void testToIterable() {
Observable<String> obs = toObservable("one", "two", "three");
Iterator<String> it = obs.toIterable().iterator();
assertEquals(true, it.hasNext());
assertEquals("one", it.next());
assertEquals(true, it.hasNext());
assertEquals("two", it.next());
assertEquals(true, it.hasNext());
assertEquals("three", it.next());
assertEquals(false, it.hasNext());
}
@Test(expected = TestException.class)
public void testToIterableWithException() {
Observable<String> obs = create(new Func1<Observer<String>, Subscription>() {
@Override
public Subscription call(Observer<String> observer) {
observer.onNext("one");
observer.onError(new TestException());
return Observable.noOpSubscription();
}
});
Iterator<String> it = obs.toIterable().iterator();
assertEquals(true, it.hasNext());
assertEquals("one", it.next());
assertEquals(true, it.hasNext());
it.next();
}
@Test
public void testLastOrDefault1() {
Observable<String> observable = toObservable("one", "two", "three");
assertEquals("three", observable.lastOrDefault("default"));
}
@Test
public void testLastOrDefault2() {
Observable<String> observable = toObservable();
assertEquals("default", observable.lastOrDefault("default"));
}
@Test
public void testLastOrDefault() {
Observable<Integer> observable = toObservable(1, 0, -1);
int last = observable.lastOrDefault(-100, new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args >= 0;
}
});
assertEquals(0, last);
}
@Test
public void testLastOrDefaultWrongPredicate() {
Observable<Integer> observable = toObservable(-1, -2, -3);
int last = observable.lastOrDefault(0, new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args >= 0;
}
});
assertEquals(0, last);
}
@Test
public void testLastOrDefaultWithPredicate() {
Observable<Integer> observable = toObservable(1, 0, -1);
int last = observable.lastOrDefault(0, new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args < 0;
}
});
assertEquals(-1, last);
}
public void testSingle() {
Observable<String> observable = toObservable("one");
assertEquals("one", observable.single());
}
@Test
public void testSingleDefault() {
Observable<String> observable = toObservable();
assertEquals("default", observable.singleOrDefault("default"));
}
@Test(expected = IllegalStateException.class)
public void testSingleDefaultWithMoreThanOne() {
Observable<String> observable = toObservable("one", "two", "three");
observable.singleOrDefault("default");
}
@Test
public void testSingleWithPredicateDefault() {
Observable<String> observable = toObservable("one", "two", "four");
assertEquals("four", observable.single(new Func1<String, Boolean>() {
@Override
public Boolean call(String s) {
return s.length() == 4;
}
}));
}
@Test(expected = IllegalStateException.class)
public void testSingleWrong() {
Observable<Integer> observable = toObservable(1, 2);
observable.single();
}
@Test(expected = IllegalStateException.class)
public void testSingleWrongPredicate() {
Observable<Integer> observable = toObservable(-1);
observable.single(new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer args) {
return args > 0;
}
});
}
@Test
public void testSingleDefaultPredicateMatchesNothing() {
Observable<String> observable = toObservable("one", "two");
String result = observable.singleOrDefault("default", new Func1<String, Boolean>() {
@Override
public Boolean call(String args) {
return args.length() == 4;
}
});
assertEquals("default", result);
}
@Test(expected = IllegalStateException.class)
public void testSingleDefaultPredicateMatchesMoreThanOne() {
Observable<String> observable = toObservable("one", "two");
String result = observable.singleOrDefault("default", new Func1<String, Boolean>() {
@Override
public Boolean call(String args) {
return args.length() == 3;
}
});
}
@Test
public void testTakeUntil() {
Subscription sSource = mock(Subscription.class);
Subscription sOther = mock(Subscription.class);
TestObservable source = new TestObservable(sSource);
TestObservable other = new TestObservable(sOther);
Observer<String> result = mock(Observer.class);
Observable<String> stringObservable = takeUntil(source, other);
stringObservable.subscribe(result);
source.sendOnNext("one");
source.sendOnNext("two");
other.sendOnNext("three");
source.sendOnNext("four");
source.sendOnCompleted();
other.sendOnCompleted();
verify(result, times(1)).onNext("one");
verify(result, times(1)).onNext("two");
verify(result, times(0)).onNext("three");
verify(result, times(0)).onNext("four");
verify(sSource, times(1)).unsubscribe();
verify(sOther, times(1)).unsubscribe();
}
private static class TestObservable extends Observable<String> {
Observer<String> observer = null;
Subscription s;
public TestObservable(Subscription s) {
this.s = s;
}
/* used to simulate subscription */
public void sendOnCompleted() {
observer.onCompleted();
}
/* used to simulate subscription */
public void sendOnNext(String value) {
observer.onNext(value);
}
/* used to simulate subscription */
@SuppressWarnings("unused")
public void sendOnError(Exception e) {
observer.onError(e);
}
@Override
public Subscription subscribe(final Observer<String> observer) {
this.observer = observer;
return s;
}
}
private static class TestException extends RuntimeException {
} |
<<<<<<<
import rx.operators.OperationOnExceptionResumeNextViaObservable;
=======
import rx.operators.OperationGroupByUntil;
import rx.operators.OperationGroupJoin;
import rx.operators.OperationInterval;
import rx.operators.OperationJoin;
import rx.operators.OperationMergeDelayError;
import rx.operators.OperationMergeMaxConcurrent;
import rx.operators.OperationMulticast;
import rx.operators.OperationOnErrorResumeNextViaObservable;
import rx.operators.OperationOnErrorReturn;
>>>>>>>
<<<<<<<
import rx.operators.OperatorOnErrorResumeNextViaObservable;
import rx.operators.OperatorOnErrorReturn;
=======
import rx.operators.OperatorOnExceptionResumeNextViaObservable;
>>>>>>>
import rx.operators.OperatorOnErrorResumeNextViaObservable;
import rx.operators.OperatorOnErrorReturn;
import rx.operators.OperatorOnExceptionResumeNextViaObservable; |
<<<<<<<
import rx.operators.OperatorToMap;
import rx.operators.OperationUsing;
=======
import rx.operators.OperationTimer;
import rx.operators.OperationToMap;
import rx.operators.OperationToMultimap;
import rx.operators.OperatorUsing;
>>>>>>>
import rx.operators.OperatorToMap;
import rx.operators.OperatorUsing; |
<<<<<<<
import rx.operators.OperationDistinctUntilChanged;
=======
import rx.operators.OperationDistinct;
>>>>>>>
import rx.operators.OperationDistinctUntilChanged;
import rx.operators.OperationDistinct;
<<<<<<<
* Returns an Observable that forwards all sequentially distinct items emitted from the source Observable.
*
* @return an Observable of sequentially distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229494%28v=vs.103%29.aspx">MSDN: Observable.distinctUntilChanged</a>
*/
public Observable<T> distinctUntilChanged() {
return create(OperationDistinctUntilChanged.distinctUntilChanged(this));
}
/**
* Returns an Observable that forwards all items emitted from the source Observable that are sequentially distinct according to
* a key selector function.
*
* @param keySelector
* a function that projects an emitted item to a key value which is used for deciding whether an item is sequentially
* distinct from another one or not
* @return an Observable of sequentially distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229508%28v=vs.103%29.aspx">MSDN: Observable.distinctUntilChanged</a>
*/
public <U> Observable<T> distinctUntilChanged(Func1<? super T, ? extends U> keySelector) {
return create(OperationDistinctUntilChanged.distinctUntilChanged(this, keySelector));
}
/**
=======
* Returns an Observable that forwards all distinct items emitted from the source Observable.
*
* @return an Observable of distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229764%28v=vs.103%29.aspx">MSDN: Observable.distinct</a>
*/
public Observable<T> distinct() {
return create(OperationDistinct.distinct(this));
}
/**
* Returns an Observable that forwards all items emitted from the source Observable that are distinct according to
* a key selector function.
*
* @param keySelector
* a function that projects an emitted item to a key value which is used for deciding whether an item is
* distinct from another one or not
* @return an Observable of distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh244310%28v=vs.103%29.aspx">MSDN: Observable.distinct</a>
*/
public <U> Observable<T> distinct(Func1<? super T, ? extends U> keySelector) {
return create(OperationDistinct.distinct(this, keySelector));
}
/**
>>>>>>>
* Returns an Observable that forwards all sequentially distinct items emitted from the source Observable.
*
* @return an Observable of sequentially distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229494%28v=vs.103%29.aspx">MSDN: Observable.distinctUntilChanged</a>
*/
public Observable<T> distinctUntilChanged() {
return create(OperationDistinctUntilChanged.distinctUntilChanged(this));
}
/**
* Returns an Observable that forwards all items emitted from the source Observable that are sequentially distinct according to
* a key selector function.
*
* @param keySelector
* a function that projects an emitted item to a key value which is used for deciding whether an item is sequentially
* distinct from another one or not
* @return an Observable of sequentially distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229508%28v=vs.103%29.aspx">MSDN: Observable.distinctUntilChanged</a>
*/
public <U> Observable<T> distinctUntilChanged(Func1<? super T, ? extends U> keySelector) {
return create(OperationDistinctUntilChanged.distinctUntilChanged(this, keySelector));
}
/**
* Returns an Observable that forwards all distinct items emitted from the source Observable.
*
* @return an Observable of distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229764%28v=vs.103%29.aspx">MSDN: Observable.distinct</a>
*/
public Observable<T> distinct() {
return create(OperationDistinct.distinct(this));
}
/**
* Returns an Observable that forwards all items emitted from the source Observable that are distinct according to
* a key selector function.
*
* @param keySelector
* a function that projects an emitted item to a key value which is used for deciding whether an item is
* distinct from another one or not
* @return an Observable of distinct items
* @see <a href="http://msdn.microsoft.com/en-us/library/hh244310%28v=vs.103%29.aspx">MSDN: Observable.distinct</a>
*/
public <U> Observable<T> distinct(Func1<? super T, ? extends U> keySelector) {
return create(OperationDistinct.distinct(this, keySelector));
}
/** |
<<<<<<<
=======
private final ObjectMapper POLY_MAPPER = newMapperBuilder()
.activateDefaultTyping(new NoCheckSubTypeValidator())
.build();
>>>>>>>
private final ObjectMapper POLY_MAPPER = newMapperBuilder()
.activateDefaultTyping(new NoCheckSubTypeValidator())
.build();
<<<<<<<
ObjectMapper mapper = newMapperBuilder()
.activateDefaultTyping(new NoCheckSubTypeValidator())
.build();
=======
>>>>>>>
<<<<<<<
ObjectMapper mapper = newMapperBuilder()
.activateDefaultTyping(new NoCheckSubTypeValidator())
.build();
=======
>>>>>>> |
<<<<<<<
//log.info(var);
=======
>>>>>>>
<<<<<<<
//log.info("curr_var: " + curr_var);
=======
>>>>>>>
int curr_len = curr_var.max_len();
if (curr_len > max_len) {
max_len = curr_len;
}
total_len += curr_len;
SimpleInterval1D curr_var_reg = null;
try {
curr_var_reg = curr_var.get_geno_var_interval();
} catch (Exception e) {
e.printStackTrace();
log.error("Original variant: " + var);
log.error("Bad variant: " + curr_var);
System.exit(1);
}
curr_var.idx = num_added;
curr_var.full_idx = num_read;
curr_var.original_type = orig_type;
true_store.put(chr_name, new ValueInterval1D<Variant>(curr_var_reg,curr_var));
num_added++;
}
if (total_len >= SV_LEN_LIM && max_len / total_len >= overlap_ratio && var_list.size() > 1) {
// in this case we break down the variant into canoical forms since
// the original variant was probably a large deletion with a small insertion
for (Variant curr_var : var_list) {
int curr_len = curr_var.max_len();
full_validated_total.add(curr_len);
true_var_list.add(curr_var);
num_read++;
}
} else {
full_validated_total.add(total_len);
true_var_list.add(var);
num_read++;
}
}
log.info("Num read: " + num_read);
log.info("Num added: " + num_added);
log.info("Num nodes: " + true_store.size());
log.info("Max depth: " + true_store.maxDepth());
// this is for the split variants
// set to true if the canonical original variant was validated true
BitSet validated_true = new BitSet(num_added);
// this is for the original variants
// count of the number of bases validated for the original variant
int[] full_validated_count = new int[num_read];
// generate the output files
PrintWriter TP_writer = null;
PrintWriter FP_writer = null;
PrintWriter FN_writer = null;
PrintWriter JSON_writer = null;
try {
TP_writer = new PrintWriter(out_prefix + "_TP.vcf", "UTF-8");
FP_writer = new PrintWriter(out_prefix + "_FP.vcf", "UTF-8");
FN_writer = new PrintWriter(out_prefix + "_FN.vcf", "UTF-8");
JSON_writer = new PrintWriter(out_prefix + "_report.json", "UTF-8");
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
// for this case we add to false positives if the variant is not validated.
// However, do don't add to true positives, those that computed later
log.info("Load New VCF");
int num_new_vars = 0;
// iterate over new VCF and collect stats
for(String curr_vcf_file : new_vcf_filename) {
VCFparser new_parser = new VCFparser(curr_vcf_file, sample_name, false);
while (new_parser.hasMoreInput()) {
Variant var = new_parser.parseLine();
if (var == null) {
// System.err.println("Bad variant or not a variant line");
continue;
}
Genotypes geno = var.getGeno();
String chr_name = var.getChr_name();
SimpleInterval1D var_reg = var.get_geno_interval();
if (!(intersector == null || intersector.contains(chr_name, var_reg))) {
continue;
}
// the overall type of the called variant
Variant.OverallType curr_var_type = var.getType();
// if called as complex variant convert to indel+snps
ArrayList<Variant> var_list = convert_var_to_var_list(new Variant(var));
double total_len = 0;
double validated_len = 0;
double max_len = 0;
for (Variant curr_var : var_list) {
total_len += curr_var.max_len();
if (max_len < curr_var.max_len()) {
max_len = curr_var.max_len();
}
}
// split up variants that are basically one big variant and one small one
boolean compute_as_split = false;
if (total_len >= SV_LEN_LIM && max_len / total_len >= overlap_ratio && var_list.size() > 1) {
compute_as_split = true;
}
for (Variant curr_var : var_list) { |
<<<<<<<
_paternal = phase[0];
_maternal = phase[1];
_isPhased = isPhased;
this.chr2 = chr2;
this.pos2 = pos2;
this.end2 = end2;
=======
paternal = phase[0];
maternal = phase[1];
this.isPhased = isPhased;
>>>>>>>
this.chr2 = chr2;
this.pos2 = pos2;
this.end2 = end2;
paternal = phase[0];
maternal = phase[1];
this.isPhased = isPhased;
<<<<<<<
_paternal = var._paternal;
_maternal = var._maternal;
_isPhased = var._isPhased;
_rand = var._rand;
this.chr2 = var.chr2;
this.pos2 = var.pos2;
this.end2 = var.end2;
=======
paternal = var.paternal;
maternal = var.maternal;
isPhased = var.isPhased;
rand = var.rand;
>>>>>>>
this.chr2 = var.chr2;
this.pos2 = var.pos2;
this.end2 = var.end2;
paternal = var.paternal;
maternal = var.maternal;
isPhased = var.isPhased;
rand = var.rand; |
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
//DSFIXME: CODE0010: Native static method requires manual modeling
return new Annotation[]{(Annotation)declaringClass.dsTaint};
>>>>>>>
//DSFIXME: CODE0012: Native static method requires manual modeling
return new Annotation[]{(Annotation)declaringClass.dsTaint};
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
//DSFIXME: CODE0010: Native static method requires manual modeling
// Cannot create using taint from delacringClass since cannot "create"
// an annotation.
return (A)declaringClass.dsTaint;
>>>>>>>
//DSFIXME: CODE0012: Native static method requires manual modeling
// Cannot create using taint from delacringClass since cannot "create"
// an annotation.
return (A)declaringClass.dsTaint;
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
return DSUtils.UNKNOWN_BOOLEAN;
>>>>>>>
return DSUtils.UNKNOWN_BOOLEAN; |
<<<<<<<
// try catch blocks here
=======
//new TestPTA();
>>>>>>>
// try catch blocks here
//new TestPTA(); |
<<<<<<<
System.out
.println("accumulo init | master | tserver | monitor | shell | admin | gc | classpath | rfile-info | login-info | tracer | minicluster | proxy | zookeeper | create-token | info | version | help | jar <jar> [<main class>] args | <accumulo class> args");
}
// feature: will work even if main class isn't in the JAR
static Class<?> loadClassFromJar(String[] args, JarFile f, ClassLoader cl) throws IOException, ClassNotFoundException {
ClassNotFoundException explicitNotFound = null;
if (args.length >= 3) {
try {
return cl.loadClass(args[2]); // jar jar-file main-class
} catch (ClassNotFoundException cnfe) {
// assume this is the first argument, look for main class in JAR manifest
explicitNotFound = cnfe;
}
}
String mainClass = f.getManifest().getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
if (mainClass == null) {
if (explicitNotFound != null) {
throw explicitNotFound;
}
throw new ClassNotFoundException("No main class was specified, and the JAR manifest does not specify one");
}
return cl.loadClass(mainClass);
=======
System.out.println("accumulo init | master | tserver | monitor | shell | admin | gc | classpath | rfile-info | login-info "
+ "| tracer | proxy | zookeeper | info | version | help | <accumulo class> args");
>>>>>>>
System.out.println("accumulo init | master | tserver | monitor | shell | admin | gc | classpath | rfile-info | login-info "
+ "| tracer | minicluster | proxy | zookeeper | create-token | info | version | help | jar <jar> [<main class>] args | <accumulo class> args");
}
// feature: will work even if main class isn't in the JAR
static Class<?> loadClassFromJar(String[] args, JarFile f, ClassLoader cl) throws IOException, ClassNotFoundException {
ClassNotFoundException explicitNotFound = null;
if (args.length >= 3) {
try {
return cl.loadClass(args[2]); // jar jar-file main-class
} catch (ClassNotFoundException cnfe) {
// assume this is the first argument, look for main class in JAR manifest
explicitNotFound = cnfe;
}
}
String mainClass = f.getManifest().getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
if (mainClass == null) {
if (explicitNotFound != null) {
throw explicitNotFound;
}
throw new ClassNotFoundException("No main class was specified, and the JAR manifest does not specify one");
}
return cl.loadClass(mainClass); |
<<<<<<<
/** If true, analyze information flows. */
public boolean infoFlow = false;
/** Path where to export information flows in DOT */
public String infoFlowDotFile;
/** Method on which to export information flows in DOT */
public String infoFlowDotMethod;
/** If true, then classes loaded from android.jar will be treated as
* application classes and analyses may analyze them.
*/
public boolean API_CLASSES_ARE_APP = false;
=======
>>>>>>>
/** If true, analyze information flows. */
public boolean infoFlow = false;
/** Path where to export information flows in DOT */
public String infoFlowDotFile;
/** Method on which to export information flows in DOT */
public String infoFlowDotMethod;
/** If true, then classes loaded from android.jar will be treated as
* application classes and analyses may analyze them.
*/
public boolean API_CLASSES_ARE_APP = false;
<<<<<<<
Option infoFlow = new Option(null, "infoflow", false, "Analyze information flows");
options.addOption(infoFlow);
Option infoFlowDotFile = OptionBuilder.withArgName("FILE").hasArg().withDescription("Export information flows to FILE in DOT").withLongOpt("infoflow-dot-file").create();
options.addOption(infoFlowDotFile);
Option infoFlowDotMethod = OptionBuilder.withArgName("METHOD").hasArg().withDescription("Export information flows specific to METHOD only: METHOD is specified by its signature (e.g. \"<com.jpgextractor.PicViewerActivity: void sendExif(java.util.ArrayList)>\")").withLongOpt("infoflow-dot-method").create();
options.addOption(infoFlowDotMethod);
=======
Option pta = new Option("ptadump", "Dump pta to ./droidsafe/pta.txt");
options.addOption(pta);
Option callgraph = new Option("callgraph", "Output .dot callgraph file ");
options.addOption(callgraph);
>>>>>>>
Option infoFlow = new Option(null, "infoflow", false, "Analyze information flows");
options.addOption(infoFlow);
Option infoFlowDotFile = OptionBuilder.withArgName("FILE").hasArg().withDescription("Export information flows to FILE in DOT").withLongOpt("infoflow-dot-file").create();
options.addOption(infoFlowDotFile);
Option infoFlowDotMethod = OptionBuilder.withArgName("METHOD").hasArg().withDescription("Export information flows specific to METHOD only: METHOD is specified by its signature (e.g. \"<com.jpgextractor.PicViewerActivity: void sendExif(java.util.ArrayList)>\")").withLongOpt("infoflow-dot-method").create();
options.addOption(infoFlowDotMethod);
Option pta = new Option("ptadump", "Dump pta to ./droidsafe/pta.txt");
options.addOption(pta);
Option callgraph = new Option("callgraph", "Output .dot callgraph file ");
options.addOption(callgraph);
<<<<<<<
if (cmd.hasOption("infoflow")) {
this.infoFlow = true;
}
if (cmd.hasOption("infoflow-dot-file")) {
assert this.infoFlow == true;
this.infoFlowDotFile = cmd.getOptionValue("infoflow-dot-file");
}
if (cmd.hasOption("infoflow-dot-method")) {
assert this.infoFlowDotFile != null;
this.infoFlowDotMethod = cmd.getOptionValue("infoflow-dot-method");
}
=======
if (cmd.hasOption("ptadump"))
this.DUMP_PTA = true;
if (cmd.hasOption("callgraph"))
this.DUMP_CALL_GRAPH = true;
>>>>>>>
if (cmd.hasOption("infoflow")) {
this.infoFlow = true;
}
if (cmd.hasOption("infoflow-dot-file")) {
assert this.infoFlow == true;
this.infoFlowDotFile = cmd.getOptionValue("infoflow-dot-file");
}
if (cmd.hasOption("infoflow-dot-method")) {
assert this.infoFlowDotFile != null;
this.infoFlowDotMethod = cmd.getOptionValue("infoflow-dot-method");
}
if (cmd.hasOption("ptadump"))
this.DUMP_PTA = true;
if (cmd.hasOption("callgraph"))
this.DUMP_CALL_GRAPH = true; |
<<<<<<<
ANDROID_CALLBACK,
=======
UTIL_FUNCTION,
>>>>>>>
UTIL_FUNCTION,
<<<<<<<
CLASS_LOADER,
SECURITY_VIOLATION,
=======
BAN_OTHERS,
>>>>>>>
CLASS_LOADER,
SECURITY_VIOLATION,
BAN_OTHERS,
<<<<<<<
APP_RESOURCE,
CALLBACK_INVOKE,
=======
ANDROID_LOADER,
APP_RESOURCE,
BACKUP_SUBSYSTEM,
BLUETOOTH,
NFC,
CONTACT,
CALLBACK_INVOKE, //method to trigger callback (user requests)
>>>>>>>
APP_RESOURCE,
CALLBACK_INVOKE,
BACKUP_SUBSYSTEM,
BLUETOOTH,
NFC,
CONTACT,
<<<<<<<
IO_ACTION_METHOD,
=======
IO_ACTION_METHOD,
IPC,
SERVICE,
>>>>>>>
IO_ACTION_METHOD,
IPC,
SERVICE,
<<<<<<<
STORAGE,
SYSTEM_SETTING,
SYSTEM_SERVICE,
=======
STORAGE_ACCESS,
SYSTEM,
SYSTEM_PREFERENCES,
SYSTEM_SETTINGS,
SECURITY,
SERIALIZATION,
>>>>>>>
STORAGE,
SYSTEM_SETTING,
SYSTEM_SERVICE,
STORAGE_ACCESS,
SYSTEM,
SYSTEM_PREFERENCES,
SYSTEM_SETTINGS,
SECURITY,
SERIALIZATION, |
<<<<<<<
import android.os.IBinder;
import droidsafe.annotations.DSC;
=======
import android.app.Application;
import droidsafe.annotations.DSC;
>>>>>>>
import android.os.IBinder;
import android.app.Application;
import droidsafe.annotations.DSC;
<<<<<<<
=======
@DSModeled(DSC.SPEC)
>>>>>>>
<<<<<<<
service.onCreate();
Intent bindIntent = new Intent();
service.onBind(bindIntent);
service.onConfigurationChanged(new Configuration());
service.onRebind(new Intent());
service.onStart(new Intent(), 0);
service.onStartCommand(new Intent(), 0, 0);
service.onTaskRemoved(new Intent());
service.onLowMemory();
service.onTrimMemory(0);
service.onUnbind(bindIntent);
service.stopSelf(0);
service.onDestroy();
=======
if (mApplication != null)
service.setApplication(mApplication);
>>>>>>>
if (mApplication != null)
service.setApplication(mApplication);
service.onCreate();
Intent bindIntent = new Intent();
service.onBind(bindIntent);
service.onConfigurationChanged(new Configuration());
service.onRebind(new Intent());
service.onStart(new Intent(), 0);
service.onStartCommand(new Intent(), 0, 0);
service.onTaskRemoved(new Intent());
service.onLowMemory();
service.onTrimMemory(0);
service.onUnbind(bindIntent);
service.stopSelf(0);
service.onDestroy();
<<<<<<<
@DSModeled(DSC.SPEC)
public static void modelApplication(android.app.Application app) {
while (true) {
app.droidsafeOnCreate();
app.droidsafeOnTerminate();
app.droidsafeOnEverythingElse();
}
//code
}
=======
@DSModeled(DSC.SPEC)
public static void modelApplication(android.app.Application app) {
mApplication = app;
while (true) {
app.droidsafeOnCreate();
app.droidsafeOnTerminate();
app.droidsafeOnEverythingElse();
}
//code
}
>>>>>>>
@DSModeled(DSC.SPEC)
public static void modelApplication(android.app.Application app) {
mApplication = app;
while (true) {
app.droidsafeOnCreate();
app.droidsafeOnTerminate();
app.droidsafeOnEverythingElse();
}
//code
} |
<<<<<<<
// DSFIXME
// GITI DSModeled
public static void launchContentProvider(android.app.Activity activity) {
}
// DSFIXME
// GITI DSModeled
public static void launchBroadCastReceiver(android.app.Activity activity) {
}
/* at some point these should be created
void launchService(android.app.Activity)
*/
=======
public void modelService(android.app.Service service) {
}
public void modelContentProvider(android.content.ContentProvider contentProvider) {
}
public void modelBroadCastReceiver(BroadcastReceiver receiver) {
}
>>>>>>>
// DSFIXME
// GITI DSModeled
public static void launchContentProvider(android.app.Activity activity) {
}
// DSFIXME
// GITI DSModeled
public static void launchBroadCastReceiver(android.app.Activity activity) {
}
public void modelService(android.app.Service service) {
}
public void modelContentProvider(android.content.ContentProvider contentProvider) {
}
public void modelBroadCastReceiver(BroadcastReceiver receiver) {
} |
<<<<<<<
import soot.Context;
=======
import soot.jimple.toolkits.pta.IAllocNode;
>>>>>>>
import soot.jimple.toolkits.pta.IAllocNode;
<<<<<<<
public void tranformsInvoke(SootMethod containingMthd, SootMethod callee, InvokeExpr invoke, Stmt stmt, Body body) {
// is this one of the invokes that we want to transform?
if (!sigsOfInvokesToTransform.contains(callee.getSignature()))
=======
public void tranformsInvoke(SootMethod containingMthd, SootMethod callee, InvokeExpr invoke, Stmt stmt, Body body, PTAContext context) {
if(!Project.v().isSrcClass(containingMthd.getDeclaringClass())){
>>>>>>>
public void tranformsInvoke(SootMethod containingMthd, SootMethod callee, InvokeExpr invoke, Stmt stmt, Body body) {
if(!Project.v().isSrcClass(containingMthd.getDeclaringClass())){
<<<<<<<
for (SootField activityField : getDestinationsOfIntent(intentArg)) {
=======
for (SootField activityField : getIntentTargetHarnessFlds(intentArg, context)) {
>>>>>>>
for (SootField activityField : getIntentTargetHarnessFlds(intentArg)) {
<<<<<<<
private Set<SootField> getDestinationsOfIntent(Value intentArg) {
Set<SootField> destActivityHarnessSootFields = new HashSet<SootField>();
Set<? extends IAllocNode> allocNodes = PTABridge.v().getPTSet(intentArg);
=======
private Set<SootField> getIntentTargetHarnessFlds(Value intentArg, PTAContext context) {
Set<SootField> resolvedTargetHarnessFlds = new HashSet<SootField>();
Set<? extends IAllocNode> allocNodes = PTABridge.v().getPTSet(intentArg, context);
// Couldn't figure out which intents
if(allocNodes.size() == 0) {
logger.warn("getPTSet didn't return anything for: {}", intentArg);
resolvedTargetHarnessFlds.addAll(allHarnessActivityFlds);
}
>>>>>>>
private Set<SootField> getIntentTargetHarnessFlds(Value intentArg) {
Set<SootField> resolvedTargetHarnessFlds = new HashSet<SootField>();
Set<? extends IAllocNode> allocNodes = PTABridge.v().getPTSet(intentArg);
// Couldn't figure out which intents
if(allocNodes.size() == 0) {
logger.warn("getPTSet didn't return anything for: {}", intentArg);
resolvedTargetHarnessFlds.addAll(allHarnessActivityFlds);
} |
<<<<<<<
JSAStrings.v().addArgumentHotspots("<android.app.Activity: void setTitle(java.lang.CharSequence)>",0);
JSAStrings.run(Config.v());
// Debugging.
JSAStrings.v().log();
}
AddAllocsForAPICalls.run();
logger.info("Starting PTA...");
GeoPTA.run();
=======
{
logger.info("Starting PTA...");
GeoPTA.run();
logger.info("Incorporating XML layout information");
//IntegrateXMLLayouts.run();
logger.info("Specializing API Calls");
//APICallSpecialization.run();
logger.info("Restarting PTA...");
GeoPTA.release();
GeoPTA.run();
}
>>>>>>>
JSAStrings.v().addArgumentHotspots("<android.app.Activity: void setTitle(java.lang.CharSequence)>",0);
JSAStrings.run(Config.v());
// Debugging.
JSAStrings.v().log();
}
AddAllocsForAPICalls.run();
{
logger.info("Starting PTA...");
GeoPTA.run();
logger.info("Incorporating XML layout information");
//IntegrateXMLLayouts.run();
logger.info("Specializing API Calls");
//APICallSpecialization.run();
logger.info("Restarting PTA...");
GeoPTA.release();
GeoPTA.run();
} |
<<<<<<<
Option infoFlow = new Option(null, "infoflow", false, "Analyze information flows");
options.addOption(infoFlow);
Option infoFlowDotFile = OptionBuilder.withArgName("FILE").hasArg().withDescription("Export information flows to FILE in DOT").withLongOpt("infoflow-dot-file").create();
options.addOption(infoFlowDotFile);
Option infoFlowDotMethod = OptionBuilder.withArgName("METHOD").hasArg().withDescription("Export information flows specific to METHOD only: METHOD is specified by its signature (e.g. \"<com.jpgextractor.PicViewerActivity: void sendExif(java.util.ArrayList)>\")").withLongOpt("infoflow-dot-method").create();
options.addOption(infoFlowDotMethod);
=======
Option runStringAnalysis = new Option("analyzestrings", "Run string analysis.");
options.addOption(runStringAnalysis);
>>>>>>>
Option infoFlow = new Option(null, "infoflow", false, "Analyze information flows");
options.addOption(infoFlow);
Option infoFlowDotFile = OptionBuilder.withArgName("FILE").hasArg().withDescription("Export information flows to FILE in DOT").withLongOpt("infoflow-dot-file").create();
options.addOption(infoFlowDotFile);
Option infoFlowDotMethod = OptionBuilder.withArgName("METHOD").hasArg().withDescription("Export information flows specific to METHOD only: METHOD is specified by its signature (e.g. \"<com.jpgextractor.PicViewerActivity: void sendExif(java.util.ArrayList)>\")").withLongOpt("infoflow-dot-method").create();
options.addOption(infoFlowDotMethod);
Option runStringAnalysis = new Option("analyzestrings", "Run string analysis.");
options.addOption(runStringAnalysis); |
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
//DSFIXME: CODE0010: Native static method requires manual modeling
return new Annotation[]{(Annotation)declaringClass.dsTaint};
>>>>>>>
//DSFIXME: CODE0012: Native static method requires manual modeling
return new Annotation[]{(Annotation)declaringClass.dsTaint};
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
//DSFIXME: CODE0010: Native static method requires manual modeling
return new Annotation[]{(Annotation)declaringClass.dsTaint};
>>>>>>>
//DSFIXME: CODE0012: Native static method requires manual modeling
return new Annotation[]{(Annotation)declaringClass.dsTaint};
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
//DSFIXME: CODE0010: Native static method requires manual modeling
return (A)declaringClass.dsTaint;
>>>>>>>
//DSFIXME: CODE0012: Native static method requires manual modeling
return (A)declaringClass.dsTaint;
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
//DSFIXME: CODE0010: Native static method requires manual modeling
return new Annotation[][]{new Annotation[]{(Annotation)declaringClass.dsTaint}};
>>>>>>>
//DSFIXME: CODE0012: Native static method requires manual modeling
return new Annotation[][]{new Annotation[]{(Annotation)declaringClass.dsTaint}};
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
return DSUtils.UNKNOWN_INT;
>>>>>>>
return DSUtils.UNKNOWN_INT; |
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
//DSFIXME: CODE0010: Native static method requires manual modeling
return new Proxy().getClass();
>>>>>>>
//DSFIXME: CODE0012: Native static method requires manual modeling
return new Proxy().getClass();
<<<<<<<
//DSFIXME: CODE0012: Native static method requires manual modeling
=======
>>>>>>> |
<<<<<<<
=======
import com.taobao.luaview.global.LuaViewConfig;
import com.taobao.luaview.util.DebugUtil;
import com.taobao.luaview.util.LogUtil;
>>>>>>>
import com.taobao.luaview.global.LuaViewConfig;
import com.taobao.luaview.util.DebugUtil;
import com.taobao.luaview.util.LogUtil;
<<<<<<<
/**
=======
private static final String TAG = Globals.class.getSimpleName();
/**
>>>>>>>
private static final String TAG = Globals.class.getSimpleName();
/** |
<<<<<<<
BufferedReader fbr = new BufferedReader(new InputStreamReader(in));
CSVParser parser = new CSVParser(fbr, format);
=======
BufferedReader fbr = new BufferedReader(new InputStreamReader(in, cs));
CSVParser parser = new CSVParser(fbr, CSVFormat.DEFAULT);
>>>>>>>
BufferedReader fbr = new BufferedReader(new InputStreamReader(in, cs));
CSVParser parser = new CSVParser(fbr, format);
<<<<<<<
final File tmpdirectory, final boolean distinct, final int numHeader, CSVFormat format) throws IOException {
=======
final File tmpdirectory, final boolean distinct, final int numHeader) throws IOException {
>>>>>>>
final File tmpdirectory, final boolean distinct, final int numHeader, CSVFormat format) throws IOException {
<<<<<<<
boolean distinct, CSVFormat format) throws IOException {
=======
boolean distinct) throws IOException {
>>>>>>>
boolean distinct, CSVFormat format) throws IOException {
<<<<<<<
CSVPrinter printer = new CSVPrinter(new BufferedWriter(new FileWriter(newtmpfile)), format);
try {
=======
try (Writer writer = new OutputStreamWriter(new FileOutputStream(newtmpfile), cs);
CSVPrinter printer = new CSVPrinter(new BufferedWriter(writer), CSVFormat.DEFAULT);
){
>>>>>>>
try (Writer writer = new OutputStreamWriter(new FileOutputStream(newtmpfile), cs);
CSVPrinter printer = new CSVPrinter(new BufferedWriter(writer), format);
){ |
<<<<<<<
import java.nio.file.Files;
=======
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
>>>>>>>
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Files;
<<<<<<<
private static final String FILE_CSV_WITH_TABS = "externalSortingTabs.csv";
private static final String FILE_CSV_WITH_SEMICOOLONS = "externalSortingSemicolon.csv";
private static final char SEMICOLON = ';';
=======
private static final String FILE_UNICODE_CSV = "nonLatinSorting.csv";
>>>>>>>
private static final String FILE_UNICODE_CSV = "nonLatinSorting.csv";
private static final String FILE_CSV_WITH_TABS = "externalSortingTabs.csv";
private static final String FILE_CSV_WITH_SEMICOOLONS = "externalSortingSemicolon.csv";
private static final char SEMICOLON = ';';
<<<<<<<
=======
>>>>>>>
<<<<<<<
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1, CSVFormat.DEFAULT);
=======
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1);
>>>>>>>
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1, CSVFormat.DEFAULT);
<<<<<<<
@Test
public void testCVSFormat() throws Exception {
Map<CSVFormat, Pair<String, String>> map = new HashMap<CSVFormat, Pair<String, String>>(){{
put(CSVFormat.MYSQL, new Pair<>(FILE_CSV_WITH_TABS, "6 \"this wont work in other systems\" 3"));
put(CSVFormat.EXCEL.withDelimiter(SEMICOLON), new Pair<>(FILE_CSV_WITH_SEMICOOLONS, "6;this wont work in other systems;3"));
}};
for (Map.Entry<CSVFormat, Pair<String, String>> format : map.entrySet()){
String path = this.getClass().getClassLoader().getResource(format.getValue().getKey()).getPath();
File file = new File(path);
outputfile = new File("outputSort1.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1, format.getKey());
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, comparator, Charset.defaultCharset(), false, false, format.getKey());
assertEquals(mergeSortedFiles, 4);
List<String> lines = Files.readAllLines(outputfile.toPath());
assertEquals(format.getValue().getValue(), lines.get(0));
}
}
=======
@Test
public void testNonLatin() throws Exception {
Field cs = Charset.class.getDeclaredField("defaultCharset");
cs.setAccessible(true);
cs.set(null, Charset.forName("windows-1251"));
String path = this.getClass().getClassLoader().getResource(FILE_UNICODE_CSV).getPath();
File file = new File(path);
outputfile = new File("unicode_output.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, StandardCharsets.UTF_8, null, false, 1);
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, comparator, StandardCharsets.UTF_8, false, true);
assertEquals(mergeSortedFiles, 5);
List<String> lines = Files.readAllLines(Paths.get(outputfile.getPath()), StandardCharsets.UTF_8);
assertEquals(lines.get(0), "2,זה רק טקסט אחי לקריאה קשה,8");
assertEquals(lines.get(1), "5,هذا هو النص إخوانه فقط من الصعب القراءة,3");
assertEquals(lines.get(2), "6,это не будет работать в других системах,3");
}
>>>>>>>
@Test
public void testNonLatin() throws Exception {
Field cs = Charset.class.getDeclaredField("defaultCharset");
cs.setAccessible(true);
cs.set(null, Charset.forName("windows-1251"));
String path = this.getClass().getClassLoader().getResource(FILE_UNICODE_CSV).getPath();
File file = new File(path);
outputfile = new File("unicode_output.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, StandardCharsets.UTF_8, null, false, 1);
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, comparator, StandardCharsets.UTF_8, false, true);
assertEquals(mergeSortedFiles, 5);
List<String> lines = Files.readAllLines(Paths.get(outputfile.getPath()), StandardCharsets.UTF_8);
assertEquals(lines.get(0), "2,זה רק טקסט אחי לקריאה קשה,8");
assertEquals(lines.get(1), "5,هذا هو النص إخوانه فقط من الصعب القراءة,3");
assertEquals(lines.get(2), "6,это не будет работать в других системах,3");
}
@Test
public void testCVSFormat() throws Exception {
Map<CSVFormat, Pair<String, String>> map = new HashMap<CSVFormat, Pair<String, String>>(){{
put(CSVFormat.MYSQL, new Pair<>(FILE_CSV_WITH_TABS, "6 \"this wont work in other systems\" 3"));
put(CSVFormat.EXCEL.withDelimiter(SEMICOLON), new Pair<>(FILE_CSV_WITH_SEMICOOLONS, "6;this wont work in other systems;3"));
}};
for (Map.Entry<CSVFormat, Pair<String, String>> format : map.entrySet()){
String path = this.getClass().getClassLoader().getResource(format.getValue().getKey()).getPath();
File file = new File(path);
outputfile = new File("outputSort1.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1, format.getKey());
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, comparator, Charset.defaultCharset(), false, false, format.getKey());
assertEquals(mergeSortedFiles, 4);
List<String> lines = Files.readAllLines(outputfile.toPath());
assertEquals(format.getValue().getValue(), lines.get(0));
}
} |
<<<<<<<
CsvSortOptions sortOptions = new CsvSortOptions
.Builder(CsvExternalSort.DEFAULTMAXTEMPFILES, comparator, 1, CsvExternalSort.estimateAvailableMemory())
.charset(Charset.defaultCharset())
.distinct(false)
.numHeader(1)
.build();
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, null, sortOptions);
=======
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1, CSVFormat.DEFAULT);
>>>>>>>
CsvSortOptions sortOptions = new CsvSortOptions
.Builder(CsvExternalSort.DEFAULTMAXTEMPFILES, comparator, 1, CsvExternalSort.estimateAvailableMemory())
.charset(Charset.defaultCharset())
.distinct(false)
.numHeader(1, CSVFormat.DEFAULT)
.build();
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, null, sortOptions);
<<<<<<<
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, sortOptions, true);
=======
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, comparator, Charset.defaultCharset(), false, true, CSVFormat.DEFAULT);
>>>>>>>
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, sortOptions, true, CSVFormat.DEFAULT);
<<<<<<<
@Test
public void testMultiLineFileWthHeader() throws IOException, ClassNotFoundException {
String path = this.getClass().getClassLoader().getResource(FILE_CSV).getPath();
File file = new File(path);
outputfile = new File("outputSort1.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
CsvSortOptions sortOptions = new CsvSortOptions
.Builder(CsvExternalSort.DEFAULTMAXTEMPFILES, comparator, 1, CsvExternalSort.estimateAvailableMemory())
.charset(Charset.defaultCharset())
.distinct(false)
.numHeader(1)
.skipHeader(false)
.build();
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, null, sortOptions);
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, sortOptions, true);
assertEquals(mergeSortedFiles, 5);
List<String> lines = Files.readAllLines(outputfile.toPath(), sortOptions.getCharset());
assertEquals(lines.get(0), "personId,text,ishired");
assertEquals(lines.get(1), "6,this wont work in other systems,3");
}
=======
@Test
public void testCVSFormat() throws Exception {
Map<CSVFormat, Pair> map = new HashMap<CSVFormat, Pair>(){{
put(CSVFormat.MYSQL, new Pair(FILE_CSV_WITH_TABS, "6 \"this wont work in other systems\" 3"));
put(CSVFormat.EXCEL.withDelimiter(SEMICOLON), new Pair(FILE_CSV_WITH_SEMICOOLONS, "6;this wont work in other systems;3"));
}};
for (Map.Entry<CSVFormat, Pair> format : map.entrySet()){
String path = this.getClass().getClassLoader().getResource(format.getValue().getFileName()).getPath();
File file = new File(path);
outputfile = new File("outputSort1.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1, format.getKey());
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, comparator, Charset.defaultCharset(), false, false, format.getKey());
assertEquals(mergeSortedFiles, 4);
List<String> lines = Files.readAllLines(outputfile.toPath());
assertEquals(format.getValue().getExpected(), lines.get(0));
}
}
>>>>>>>
@Test
public void testCVSFormat() throws Exception {
Map<CSVFormat, Pair> map = new HashMap<CSVFormat, Pair>(){{
put(CSVFormat.MYSQL, new Pair(FILE_CSV_WITH_TABS, "6 \"this wont work in other systems\" 3"));
put(CSVFormat.EXCEL.withDelimiter(SEMICOLON), new Pair(FILE_CSV_WITH_SEMICOOLONS, "6;this wont work in other systems;3"));
}};
for (Map.Entry<CSVFormat, Pair> format : map.entrySet()){
String path = this.getClass().getClassLoader().getResource(format.getValue().getFileName()).getPath();
File file = new File(path);
outputfile = new File("outputSort1.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, comparator, CsvExternalSort.DEFAULTMAXTEMPFILES, Charset.defaultCharset(), null, false, 1, format.getKey());
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, comparator, Charset.defaultCharset(), false, false, format.getKey());
assertEquals(mergeSortedFiles, 4);
List<String> lines = Files.readAllLines(outputfile.toPath());
assertEquals(format.getValue().getExpected(), lines.get(0));
}
}
@Test
public void testMultiLineFileWthHeader() throws IOException, ClassNotFoundException {
String path = this.getClass().getClassLoader().getResource(FILE_CSV).getPath();
File file = new File(path);
outputfile = new File("outputSort1.csv");
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0)
.compareTo(op2.get(0));
CsvSortOptions sortOptions = new CsvSortOptions
.Builder(CsvExternalSort.DEFAULTMAXTEMPFILES, comparator, 1, CsvExternalSort.estimateAvailableMemory())
.charset(Charset.defaultCharset())
.distinct(false)
.numHeader(1)
.skipHeader(false)
.build();
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, null, sortOptions);
assertEquals(sortInBatch.size(), 1);
int mergeSortedFiles = CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, sortOptions, true);
assertEquals(mergeSortedFiles, 5);
List<String> lines = Files.readAllLines(outputfile.toPath(), sortOptions.getCharset());
assertEquals(lines.get(0), "personId,text,ishired");
assertEquals(lines.get(1), "6,this wont work in other systems,3");
} |
<<<<<<<
try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
for (Entry<Key,Value> entry : scanner) {
counter++;
Key k = entry.getKey();
Assert.assertEquals("Row", k.getRow().toString());
Assert.assertEquals("cf", k.getColumnFamily().toString());
Assert.assertEquals("cq", k.getColumnQualifier().toString());
Assert.assertEquals("value", entry.getValue().toString());
=======
final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
for (Entry<Key,Value> entry : scanner) {
counter++;
Key k = entry.getKey();
assertEquals("Row", k.getRow().toString());
assertEquals("cf", k.getColumnFamily().toString());
assertEquals("cq", k.getColumnQualifier().toString());
assertEquals("value", entry.getValue().toString());
>>>>>>>
try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
for (Entry<Key,Value> entry : scanner) {
counter++;
Key k = entry.getKey();
assertEquals("Row", k.getRow().toString());
assertEquals("cf", k.getColumnFamily().toString());
assertEquals("cq", k.getColumnQualifier().toString());
assertEquals("value", entry.getValue().toString());
<<<<<<<
try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
for (Entry<Key,Value> entry : scanner) {
Key k = entry.getKey();
data[data.length - 1] = (byte) count;
String expected = new String(data, UTF_8);
Assert.assertEquals(expected, k.getRow().toString());
Assert.assertEquals("cf", k.getColumnFamily().toString());
Assert.assertEquals("cq", k.getColumnQualifier().toString());
Assert.assertEquals("value", entry.getValue().toString());
count++;
}
=======
final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
for (Entry<Key,Value> entry : scanner) {
Key k = entry.getKey();
data[data.length - 1] = (byte) count;
String expected = new String(data, UTF_8);
assertEquals(expected, k.getRow().toString());
assertEquals("cf", k.getColumnFamily().toString());
assertEquals("cq", k.getColumnQualifier().toString());
assertEquals("value", entry.getValue().toString());
count++;
>>>>>>>
try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
for (Entry<Key,Value> entry : scanner) {
Key k = entry.getKey();
data[data.length - 1] = (byte) count;
String expected = new String(data, UTF_8);
assertEquals(expected, k.getRow().toString());
assertEquals("cf", k.getColumnFamily().toString());
assertEquals("cq", k.getColumnQualifier().toString());
assertEquals("value", entry.getValue().toString());
count++;
}
<<<<<<<
=======
Key k = entry.getKey();
data[data.length - 1] = (byte) extra;
String expected = new String(data, UTF_8);
assertEquals(expected, k.getRow().toString());
assertEquals("cf", k.getColumnFamily().toString());
assertEquals("cq", k.getColumnQualifier().toString());
assertEquals("value", entry.getValue().toString());
extra++;
>>>>>>>
<<<<<<<
// Make sure no splits occurred in the table
Assert.assertEquals(0, conn.tableOperations().listSplits(tableName).size());
=======
// Make sure no splits occured in the table
assertEquals(0, conn.tableOperations().listSplits(tableName).size());
>>>>>>>
// Make sure no splits occurred in the table
assertEquals(0, conn.tableOperations().listSplits(tableName).size()); |
<<<<<<<
=======
@Override
>>>>>>>
@Override
<<<<<<<
=======
@Override
>>>>>>>
@Override
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>> |
<<<<<<<
import com.codingapi.txlcn.logger.helper.TxlcnLogDbHelper;
import com.codingapi.txlcn.logger.model.*;
=======
import com.codingapi.txlcn.logger.helper.TxLcnLogDbHelper;
>>>>>>>
import com.codingapi.txlcn.logger.helper.TxLcnLogDbHelper;
import com.codingapi.txlcn.logger.model.*; |
<<<<<<<
=======
// @Bean
// @ConditionalOnClass(name = "com.codingapi.txlcn.client.TxClientConfiguration")
// public NettyRpcClientInitializer nettyRpcClientInitializer() {
// return new NettyRpcClientInitializer();
// }
@PostConstruct
public void init() {
RpcCmdContext.getInstance().setRpcConfig(rpcConfig());
SocketManager.getInstance().setRpcConfig(rpcConfig());
}
>>>>>>> |
<<<<<<<
import java.util.ArrayList;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
=======
import com.alibaba.fastjson.JSONObject;
import com.codingapi.tx.framework.utils.SocketManager;
import com.codingapi.tx.model.Request;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
>>>>>>>
import java.util.ArrayList;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import com.codingapi.tx.framework.utils.SocketManager;
import com.codingapi.tx.model.Request;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
<<<<<<<
/**
* 是否同一个模块被多次请求
*/
=======
private Map<String,String> cacheModelInfo = new ConcurrentHashMap<>();
/**
* 是否同一个模块被多次请求
*/
>>>>>>>
private Map<String,String> cacheModelInfo = new ConcurrentHashMap<>();
/**
* 是否同一个模块被多次请求
*/
<<<<<<<
private List<String> cachedModelList = new ArrayList<String>();
=======
private boolean readOnly = false;
>>>>>>>
private boolean readOnly = false;
private List<String> cachedModelList = new ArrayList<String>();
<<<<<<<
public boolean isHasMoreService() {
return hasMoreService;
}
public void setHasMoreService(boolean hasMoreService) {
this.hasMoreService = hasMoreService;
}
=======
public boolean isHasConnection() {
return hasConnection;
}
>>>>>>>
public boolean isHasConnection() {
return hasConnection;
} |
<<<<<<<
import javax.xml.bind.JAXBException;
=======
>>>>>>>
import javax.xml.bind.JAXBException;
<<<<<<<
options.addOption(OptionFactory.createOption("cosmic-file", "Output directory to save the JSON result", false)); // Mutation options
// Drug options
options.addOption(OptionFactory.createOption("drug-file", "Output directory to save the JSON result", false));
=======
options.addOption(OptionFactory.createOption("cosmic-file", "Input COSMIC file", false));
>>>>>>>
options.addOption(OptionFactory.createOption("cosmic-file", "Input COSMIC file", false));
// Drug options
options.addOption(OptionFactory.createOption("drug-file", "Output directory to save the JSON result", false));
<<<<<<<
try {
// Help option is checked manually, otherwise the parser will complain about obligatory options
if(args.length > 0 && (args[0].equals("-h") || args[0].equals("--help"))) {
=======
if (args.length > 0 && (args[0].equals("-h") || args[0].equals("--help"))) {
>>>>>>>
try {
// Help option is checked manually, otherwise the parser will complain about obligatory options
if(args.length > 0 && (args[0].equals("-h") || args[0].equals("--help"))) {
<<<<<<<
// Now CLI can be parsed
=======
>>>>>>>
<<<<<<<
GeneParser geneParser = new GeneParser(serializer);
if(geneFilesDir != null && !geneFilesDir.equals("")) {
geneParser.parse(Paths.get(geneFilesDir), Paths.get(genomeFastaFile));
}else {
geneParser.parse(Paths.get(gtfFile), Paths.get(geneDescriptionFile), Paths.get(xrefFile), Paths.get(uniprotIdMapping), Paths.get(tfbsFile), Paths.get(mirnaFile), Paths.get(genomeFastaFile));
}
=======
GeneParser geneParser = new GeneParser(serializer);
if (geneFilesDir != null && !geneFilesDir.equals("")) {
geneParser.parse(Paths.get(geneFilesDir), Paths.get(genomeFastaFile));
} else {
geneParser.parse(Paths.get(gtfFile), Paths.get(geneDescriptionFile), Paths.get(xrefFile), Paths.get(tfbsFile), Paths.get(mirnaFile), Paths.get(genomeFastaFile));
}
>>>>>>>
GeneParser geneParser = new GeneParser(serializer);
if(geneFilesDir != null && !geneFilesDir.equals("")) {
geneParser.parse(Paths.get(geneFilesDir), Paths.get(genomeFastaFile));
}else {
geneParser.parse(Paths.get(gtfFile), Paths.get(geneDescriptionFile), Paths.get(xrefFile), Paths.get(uniprotIdMapping), Paths.get(tfbsFile), Paths.get(mirnaFile), Paths.get(genomeFastaFile));
}
<<<<<<<
if(conservationFilesDir != null) {
ConservedRegionParser conservedRegionParser = new ConservedRegionParser();
conservedRegionParser.parse(Paths.get(conservationFilesDir), conservationChunkSize, Paths.get(conservationOutputFile));
=======
if (conservationFilesDir != null) {
ConservedRegionParser.parseConservedRegionFilesToJson(Paths.get(conservationFilesDir), conservationChunkSize, Paths.get(conservationOutputFile));
>>>>>>>
if(conservationFilesDir != null) {
ConservedRegionParser conservedRegionParser = new ConservedRegionParser();
conservedRegionParser.parse(Paths.get(conservationFilesDir), conservationChunkSize, Paths.get(conservationOutputFile)); |
<<<<<<<
import org.opencb.biodata.models.variant.Variant;
import org.opencb.cellbase.core.config.CellBaseConfiguration;
=======
import org.opencb.cellbase.core.CellBaseConfiguration;
>>>>>>>
<<<<<<<
CellBaseConfiguration cellBaseConfiguration) {
super(queue, data, database, field, cellBaseConfiguration);
// if (cellBaseConfiguration.getDatabases().get("mongodb").getOptions().get("mongodb-index-folder") != null) {
if (cellBaseConfiguration.getDatabases().getMongodb().getOptions().get("mongodb-index-folder") != null) {
// indexScriptFolder = Paths.get(cellBaseConfiguration.getDatabases().get("mongodb").getOptions().get("mongodb-index-folder"));
indexScriptFolder = Paths.get(cellBaseConfiguration.getDatabases().getMongodb().getOptions().get("mongodb-index-folder"));
=======
String[] innerFields, CellBaseConfiguration cellBaseConfiguration) {
super(queue, data, database, field, innerFields, cellBaseConfiguration);
if (cellBaseConfiguration.getDatabase().getOptions().get("mongodb-index-folder") != null) {
indexScriptFolder = Paths.get(cellBaseConfiguration.getDatabase().getOptions().get("mongodb-index-folder"));
>>>>>>>
String[] innerFields, CellBaseConfiguration cellBaseConfiguration) {
super(queue, data, database, field, innerFields, cellBaseConfiguration);
if (cellBaseConfiguration.getDatabases().getMongodb().getOptions().get("mongodb-index-folder") != null) {
indexScriptFolder = Paths.get(cellBaseConfiguration.getDatabases().getMongodb().getOptions().get("mongodb-index-folder")); |
<<<<<<<
* A BatchScanner instance will use no more threads than provided in the construction of the BatchScanner implementation. Multiple invocations of
* <code>iterator()</code> will all share the same resources of the instance. A new BatchScanner instance should be created to use allocate additional threads.
=======
* <p>
* A BatchScanner instance will use no more threads than provided in the construction of the BatchScanner
* implementation. Multiple invocations of <code>iterator()</code> will all share the same resources of the instance.
* A new BatchScanner instance should be created to use allocate additional threads.
>>>>>>>
* <p>
* A BatchScanner instance will use no more threads than provided in the construction of the BatchScanner implementation. Multiple invocations of
* <code>iterator()</code> will all share the same resources of the instance. A new BatchScanner instance should be created to use allocate additional threads. |
<<<<<<<
import org.opencb.biodata.models.variant.avro.*;
import org.opencb.cellbase.app.cli.EtlCommons;
=======
import org.opencb.biodata.models.variant.avro.EvidenceEntry;
import org.opencb.biodata.models.variant.avro.ModeOfInheritance;
import org.opencb.biodata.models.variant.avro.Property;
import org.opencb.biodata.models.variant.avro.VariantAvro;
>>>>>>>
import org.opencb.biodata.models.variant.avro.*;
import org.opencb.cellbase.app.cli.EtlCommons;
<<<<<<<
import java.util.*;
=======
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
>>>>>>>
import java.util.*;
<<<<<<<
import static junit.framework.Assert.assertNull;
=======
import static junit.framework.Assert.assertTrue;
>>>>>>>
import static junit.framework.Assert.assertNull;
<<<<<<<
private static final String SYMBOL = "symbol";
private static final String DOCM = "docm";
=======
private ObjectMapper jsonObjectMapper;
public ClinicalVariantParserTest() {
jsonObjectMapper = new ObjectMapper();
jsonObjectMapper.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true);
jsonObjectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
}
>>>>>>>
private static final String SYMBOL = "symbol";
private static final String DOCM = "docm";
private ObjectMapper jsonObjectMapper;
public ClinicalVariantParserTest() {
jsonObjectMapper = new ObjectMapper();
jsonObjectMapper.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true);
jsonObjectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
}
<<<<<<<
private Set<String> getAllTraitNames(List<EvidenceEntry> evidenceEntryList, String source) {
Set<String> traitNameSet = new HashSet<>(evidenceEntryList.size());
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (source.equals(evidenceEntry.getSource().getName())) {
traitNameSet.addAll(evidenceEntry.getHeritableTraits().stream()
.map(heritableTrait -> heritableTrait.getTrait()).collect(Collectors.toSet()));
}
}
return traitNameSet;
}
private Set<String> getAllEnsemblIds(List<EvidenceEntry> evidenceEntryList, String source) {
Set<String> ensemblIdSet = new HashSet<>(evidenceEntryList.size());
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (source.equals(evidenceEntry.getSource().getName())) {
ensemblIdSet.addAll(evidenceEntry.getGenomicFeatures().stream()
.map(genomicFeature -> genomicFeature.getEnsemblId()).collect(Collectors.toSet()));
}
}
return ensemblIdSet;
}
private Set<String> getAllGeneSymbols(List<EvidenceEntry> evidenceEntryList, String source) {
Set<String> geneSymbolSet = new HashSet<>(evidenceEntryList.size());
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (source.equals(evidenceEntry.getSource().getName())) {
geneSymbolSet.addAll(evidenceEntry.getGenomicFeatures().stream()
.map(genomicFeature -> genomicFeature.getXrefs() != null ?
genomicFeature.getXrefs().get(SYMBOL) : null).collect(Collectors.toSet()));
}
}
return geneSymbolSet;
}
private EvidenceEntry getEvidenceEntryBySource(List<EvidenceEntry> evidenceEntryList, String sourceName) {
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (sourceName.equals(evidenceEntry.getSource().getName())) {
return evidenceEntry;
}
}
return null;
}
private Variant getVariantByVariant(List<Variant> variantList, Variant variant) {
for (Variant variant1 : variantList) {
if (variant.getChromosome().equals(variant1.getChromosome())
&& variant.getStart().equals(variant1.getStart())
&& variant.getReference().equals(variant1.getReference())
&& variant.getAlternate().equals(variant1.getAlternate())) {
return variant1;
}
}
return null;
}
private Variant getVariantByAccession(List<Variant> variantList, String accession) {
=======
private Property getProperty(List<Property> propertyList, String propertyName) {
for (Property property : propertyList) {
if (propertyName.equals(property.getName())) {
return property;
}
}
return null;
}
private EvidenceEntry getEvidenceEntryByAccession(Variant variant, String accession) {
for (EvidenceEntry evidenceEntry : variant.getAnnotation().getTraitAssociation()) {
if (evidenceEntry.getId().equals(accession)) {
return evidenceEntry;
}
}
return null;
}
private List<Variant> getVariantByAccession(List<Variant> variantList, String accession) {
List<Variant> returnVariantList = new ArrayList<>();
>>>>>>>
private Set<String> getAllTraitNames(List<EvidenceEntry> evidenceEntryList, String source) {
Set<String> traitNameSet = new HashSet<>(evidenceEntryList.size());
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (source.equals(evidenceEntry.getSource().getName())) {
traitNameSet.addAll(evidenceEntry.getHeritableTraits().stream()
.map(heritableTrait -> heritableTrait.getTrait()).collect(Collectors.toSet()));
}
}
return traitNameSet;
}
private Set<String> getAllEnsemblIds(List<EvidenceEntry> evidenceEntryList, String source) {
Set<String> ensemblIdSet = new HashSet<>(evidenceEntryList.size());
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (source.equals(evidenceEntry.getSource().getName())) {
ensemblIdSet.addAll(evidenceEntry.getGenomicFeatures().stream()
.map(genomicFeature -> genomicFeature.getEnsemblId()).collect(Collectors.toSet()));
}
}
return ensemblIdSet;
}
private Set<String> getAllGeneSymbols(List<EvidenceEntry> evidenceEntryList, String source) {
Set<String> geneSymbolSet = new HashSet<>(evidenceEntryList.size());
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (source.equals(evidenceEntry.getSource().getName())) {
geneSymbolSet.addAll(evidenceEntry.getGenomicFeatures().stream()
.map(genomicFeature -> genomicFeature.getXrefs() != null ?
genomicFeature.getXrefs().get(SYMBOL) : null).collect(Collectors.toSet()));
}
}
return geneSymbolSet;
}
private EvidenceEntry getEvidenceEntryBySource(List<EvidenceEntry> evidenceEntryList, String sourceName) {
for (EvidenceEntry evidenceEntry : evidenceEntryList) {
if (sourceName.equals(evidenceEntry.getSource().getName())) {
return evidenceEntry;
}
}
return null;
}
private Property getProperty(List<Property> propertyList, String propertyName) {
for (Property property : propertyList) {
if (propertyName.equals(property.getName())) {
return property;
}
}
return null;
}
private Variant getVariantByVariant(List<Variant> variantList, Variant variant) {
for (Variant variant1 : variantList) {
if (variant.getChromosome().equals(variant1.getChromosome())
&& variant.getStart().equals(variant1.getStart())
&& variant.getReference().equals(variant1.getReference())
&& variant.getAlternate().equals(variant1.getAlternate())) {
return variant1;
}
}
return null;
}
private EvidenceEntry getEvidenceEntryByAccession(Variant variant, String accession) {
for (EvidenceEntry evidenceEntry : variant.getAnnotation().getTraitAssociation()) {
if (evidenceEntry.getId().equals(accession)) {
return evidenceEntry;
}
}
return null;
}
private List<Variant> getVariantByAccession(List<Variant> variantList, String accession) {
List<Variant> returnVariantList = new ArrayList<>();
<<<<<<<
for (EvidenceEntry evidenceEntry : variant.getAnnotation().getTraitAssociation()) {
// DOCM does not provide IDs
if (evidenceEntry.getId() != null
&& evidenceEntry.getId().equals(accession)) {
return variant;
}
=======
int i = 0;
while (i < variant.getAnnotation().getTraitAssociation().size()
&& !variant.getAnnotation().getTraitAssociation().get(i).getId().equals(accession)) {
i++;
}
if (i < variant.getAnnotation().getTraitAssociation().size()) {
returnVariantList.add(variant);
>>>>>>>
int i = 0;
while (i < variant.getAnnotation().getTraitAssociation().size()
&& (variant.getAnnotation().getTraitAssociation().get(i).getId() == null
|| !variant.getAnnotation().getTraitAssociation().get(i).getId().equals(accession))) {
i++;
}
if (i < variant.getAnnotation().getTraitAssociation().size()) {
returnVariantList.add(variant); |
<<<<<<<
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mongodb.*;
import org.broad.tribble.readers.TabixReader;
import org.opencb.biodata.models.core.Gene;
import org.opencb.biodata.models.core.MiRNAGene;
=======
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.QueryBuilder;
import htsjdk.tribble.readers.TabixReader;
>>>>>>>
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mongodb.*;
import org.opencb.biodata.models.core.Gene;
import org.opencb.biodata.models.core.MiRNAGene;
import htsjdk.tribble.readers.TabixReader;
<<<<<<<
// if (includeList.isEmpty()) {
// includeList = Arrays.asList("variation", "clinical", "consequenceType", "conservation");
// }
=======
if (includeList.isEmpty()) {
includeList = Arrays.asList("variation", "clinical", "consequenceType", "conservation", "drugInteraction");
}
>>>>>>>
<<<<<<<
List<QueryResult> variationConsequenceTypeList = null;
if (includeList.isEmpty() || includeList.contains("consequenceType")) {
variationConsequenceTypeList = getAllConsequenceTypesByVariantList(variantList, queryOptions);
if (annotations == null) {
annotations = variationConsequenceTypeList;
}
}
=======
// List<QueryResult> variationConsequenceTypeList = null;
// if (includeList.contains("consequenceType")) {
// variationConsequenceTypeList = getAllConsequenceTypesByVariantList(variantList, queryOptions);
// if (annotations == null) {
// annotations = variationConsequenceTypeList;
// }
// }
>>>>>>> |
<<<<<<<
case EtlCommons.STRUCTURAL_VARIANTS_DATA:
if (speciesHasInfoToDownload(sp, "svs")) {
downloadStructuralVariants(sp, assembly.getName(), spFolder);
}
break;
=======
case EtlCommons.REPEATS_DATA:
if (speciesHasInfoToDownload(sp, "repeats")) {
downloadRepeats(sp, assembly.getName(), spFolder);
}
break;
>>>>>>>
case EtlCommons.STRUCTURAL_VARIANTS_DATA:
if (speciesHasInfoToDownload(sp, "svs")) {
downloadStructuralVariants(sp, assembly.getName(), spFolder);
}
break;
case EtlCommons.REPEATS_DATA:
if (speciesHasInfoToDownload(sp, "repeats")) {
downloadRepeats(sp, assembly.getName(), spFolder);
}
break; |
<<<<<<<
QueryBuilder builder = QueryBuilder.start("id").is(id);
queries.add(new Document(builder.get().toMap()));
=======
QueryBuilder builder = QueryBuilder.start("ids").is(id);
queries.add(builder.get());
>>>>>>>
QueryBuilder builder = QueryBuilder.start("ids").is(id);
queries.add(new Document(builder.get().toMap()));
<<<<<<<
QueryBuilder builder = QueryBuilder.start("transcriptVariations.transcriptId").is(id);
queries.add(new Document(builder.get().toMap()));
=======
QueryBuilder builder = QueryBuilder.start("annotation.consequenceTypes.ensemblTranscriptId").is(id);
queries.add(builder.get());
>>>>>>>
QueryBuilder builder = QueryBuilder.start("annotation.consequenceTypes.ensemblTranscriptId").is(id);
queries.add(new Document(builder.get().toMap()));
<<<<<<<
@Override
public QueryResult getAllPhenotypes(QueryOptions options) {
// return executeDistinct("distinct", "phenotype", mongoVariationPhenotypeDBCollection);
QueryBuilder builder = new QueryBuilder();
if (options.containsKey("phenotype")) {
String pheno = options.getString("phenotype");
if (pheno != null && !pheno.equals("")) {
builder = builder.start("phenotype").is(pheno);
}
}
return executeQuery("result", new Document(builder.get().toMap()), options);
// return executeQuery("result", builder.get(), options, mongoVariationPhenotypeDBCollection);
}
@Override
public List<QueryResult> getAllPhenotypeByRegion(List<Region> regions, QueryOptions options) {
QueryBuilder builder = null;
List<Document> queries = new ArrayList<>();
/**
* If source is present in options is it parsed and prepare first,
* otherwise ti will be done for each iteration of regions.
*/
List<Object> source = options.getList("source", null);
BasicDBList sourceIds = new BasicDBList();
if (source != null && source.size() > 0) {
sourceIds.addAll(source);
}
// List<Region> regions = Region.parseRegions(options.getString("region"));
List<String> ids = new ArrayList<>(regions.size());
for (Region region : regions) {
if (region != null && !region.equals("")) {
// If regions is 1 position then query can be optimize using chunks
if (region.getStart() == region.getEnd()) {
String chunkId = getChunkIdPrefix(region.getChromosome(), region.getStart(), variationChunkSize);
System.out.println(chunkId);
builder = QueryBuilder.start("_chunkIds").is(chunkId).and("end")
.greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd());
} else {
builder = QueryBuilder.start("chromosome").is(region.getChromosome()).and("end")
.greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd());
}
if (sourceIds != null && sourceIds.size() > 0) {
builder = builder.and("source").in(sourceIds);
}
queries.add(new Document(builder.get().toMap()));
ids.add(region.toString());
}
}
return executeQueryList2(ids, queries, options, mongoVariationPhenotypeDBCollection2);
}
@Override
public QueryResult getAllByPhenotype(String phenotype, QueryOptions options) {
QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype);
List<QueryResult> queryResults = new ArrayList<>();
if (options.containsKey("variants")) {
List<Object> variantList = options.getList("variants");
List<Variant> variants = new ArrayList<>(variantList.size());
for (int i = 0; i < variantList.size(); i++) {
Variant genomicVariant = (Variant) variantList.get(i);
variants.add(genomicVariant);
}
}
return null;
}
@Override
public List<QueryResult> getAllByPhenotypeList(List<String> phenotypeList, QueryOptions options) {
return null;
}
@Override
public QueryResult getAllGenesByPhenotype(String phenotype, QueryOptions options) {
QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype);
return executeQuery(phenotype, new Document(builder.get().toMap()), options, mongoVariationPhenotypeDBCollection2);
}
@Override
public List<QueryResult> getAllGenesByPhenotypeList(List<String> phenotypeList, QueryOptions options) {
List<Document> queries = new ArrayList<>(phenotypeList.size());
for (String id : phenotypeList) {
QueryBuilder builder = QueryBuilder.start("phenotype").is(id);
queries.add(new Document(builder.get().toMap()));
}
return executeQueryList2(phenotypeList, queries, options, mongoVariationPhenotypeDBCollection2);
}
=======
// TODO: phenotype queries shall be answered by the clinicalMongoDBAdaptor
// @Override
// public QueryResult getAllPhenotypes(QueryOptions options) {
//// return executeDistinct("distinct", "phenotype", mongoVariationPhenotypeDBCollection);
// QueryBuilder builder = new QueryBuilder();
// if (options.containsKey("phenotype")) {
// String pheno = options.getString("phenotype");
// if (pheno != null && !pheno.equals("")) {
// builder = builder.start("phenotype").is(pheno);
// }
// }
// return executeQuery("result", builder.get(), options);
//// return executeQuery("result", builder.get(), options, mongoVariationPhenotypeDBCollection);
// }
//
// @Override
// public List<QueryResult> getAllPhenotypeByRegion(List<Region> regions, QueryOptions options) {
// QueryBuilder builder = null;
// List<DBObject> queries = new ArrayList<>();
//
// /**
// * If source is present in options is it parsed and prepare first,
// * otherwise ti will be done for each iteration of regions.
// */
// List<Object> source = options.getList("source", null);
// BasicDBList sourceIds = new BasicDBList();
// if (source != null && source.size() > 0) {
// sourceIds.addAll(source);
// }
//
//// List<Region> regions = Region.parseRegions(options.getString("region"));
// List<String> ids = new ArrayList<>(regions.size());
// for (Region region : regions) {
// if (region != null && !region.equals("")) {
// // If regions is 1 position then query can be optimize using chunks
// if (region.getStart() == region.getEnd()) {
// String chunkId = getChunkIdPrefix(region.getChromosome(), region.getStart(), variationChunkSize);
// System.out.println(chunkId);
// builder = QueryBuilder.start("_chunkIds").is(chunkId).and("end")
// .greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd());
// } else {
// builder = QueryBuilder.start("chromosome").is(region.getChromosome()).and("end")
// .greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd());
// }
//
// if (sourceIds != null && sourceIds.size() > 0) {
// builder = builder.and("source").in(sourceIds);
// }
//
// queries.add(builder.get());
// ids.add(region.toString());
// }
// }
// return executeQueryList2(ids, queries, options, mongoVariationPhenotypeDBCollection2);
// }
//
// @Override
// public QueryResult getAllByPhenotype(String phenotype, QueryOptions options) {
// QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype);
//
// List<QueryResult> queryResults = new ArrayList<>();
// if (options.containsKey("variants")) {
// List<Object> variantList = options.getList("variants");
// List<Variant> variants = new ArrayList<>(variantList.size());
// for (int i = 0; i < variantList.size(); i++) {
// Variant genomicVariant = (Variant) variantList.get(i);
// variants.add(genomicVariant);
// }
// }
//
// return null;
// }
//
// @Override
// public List<QueryResult> getAllByPhenotypeList(List<String> phenotypeList, QueryOptions options) {
// return null;
// }
//
//
// @Override
// public QueryResult getAllGenesByPhenotype(String phenotype, QueryOptions options) {
// QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype);
// return executeQuery(phenotype, builder.get(), options, mongoVariationPhenotypeDBCollection2);
// }
//
// @Override
// public List<QueryResult> getAllGenesByPhenotypeList(List<String> phenotypeList, QueryOptions options) {
// List<DBObject> queries = new ArrayList<>(phenotypeList.size());
// for (String id : phenotypeList) {
// QueryBuilder builder = QueryBuilder.start("phenotype").is(id);
// queries.add(builder.get());
// }
// return executeQueryList2(phenotypeList, queries, options, mongoVariationPhenotypeDBCollection2);
// }
>>>>>>>
// TODO: phenotype queries shall be answered by the clinicalMongoDBAdaptor
// @Override
// public QueryResult getAllPhenotypes(QueryOptions options) {
//// return executeDistinct("distinct", "phenotype", mongoVariationPhenotypeDBCollection);
// QueryBuilder builder = new QueryBuilder();
// if (options.containsKey("phenotype")) {
// String pheno = options.getString("phenotype");
// if (pheno != null && !pheno.equals("")) {
// builder = builder.start("phenotype").is(pheno);
// }
// }
// return executeQuery("result", new Document(builder.get().toMap()), options);
//// return executeQuery("result", builder.get(), options, mongoVariationPhenotypeDBCollection);
// }
//
// @Override
// public List<QueryResult> getAllPhenotypeByRegion(List<Region> regions, QueryOptions options) {
// QueryBuilder builder = null;
// List<Document> queries = new ArrayList<>();
//
// /**
// * If source is present in options is it parsed and prepare first,
// * otherwise ti will be done for each iteration of regions.
// */
// List<Object> source = options.getList("source", null);
// BasicDBList sourceIds = new BasicDBList();
// if (source != null && source.size() > 0) {
// sourceIds.addAll(source);
// }
//
//// List<Region> regions = Region.parseRegions(options.getString("region"));
// List<String> ids = new ArrayList<>(regions.size());
// for (Region region : regions) {
// if (region != null && !region.equals("")) {
// // If regions is 1 position then query can be optimize using chunks
// if (region.getStart() == region.getEnd()) {
// String chunkId = getChunkIdPrefix(region.getChromosome(), region.getStart(), variationChunkSize);
// System.out.println(chunkId);
// builder = QueryBuilder.start("_chunkIds").is(chunkId).and("end")
// .greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd());
// } else {
// builder = QueryBuilder.start("chromosome").is(region.getChromosome()).and("end")
// .greaterThanEquals(region.getStart()).and("start").lessThanEquals(region.getEnd());
// }
//
// if (sourceIds != null && sourceIds.size() > 0) {
// builder = builder.and("source").in(sourceIds);
// }
//
// queries.add(new Document(builder.get().toMap()));
// ids.add(region.toString());
// }
// }
// return executeQueryList2(ids, queries, options, mongoVariationPhenotypeDBCollection2);
// }
//
// @Override
// public QueryResult getAllByPhenotype(String phenotype, QueryOptions options) {
// QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype);
//
// List<QueryResult> queryResults = new ArrayList<>();
// if (options.containsKey("variants")) {
// List<Object> variantList = options.getList("variants");
// List<Variant> variants = new ArrayList<>(variantList.size());
// for (int i = 0; i < variantList.size(); i++) {
// Variant genomicVariant = (Variant) variantList.get(i);
// variants.add(genomicVariant);
// }
// }
//
// return null;
// }
//
// @Override
// public List<QueryResult> getAllByPhenotypeList(List<String> phenotypeList, QueryOptions options) {
// return null;
// }
//
//
// @Override
// public QueryResult getAllGenesByPhenotype(String phenotype, QueryOptions options) {
// QueryBuilder builder = QueryBuilder.start("phenotype").is(phenotype);
// return executeQuery(phenotype, new Document(builder.get().toMap()), options, mongoVariationPhenotypeDBCollection2);
// }
//
// @Override
// public List<QueryResult> getAllGenesByPhenotypeList(List<String> phenotypeList, QueryOptions options) {
// List<Document> queries = new ArrayList<>(phenotypeList.size());
// for (String id : phenotypeList) {
// QueryBuilder builder = QueryBuilder.start("phenotype").is(id);
// queries.add(new Document(builder.get().toMap()));
// }
// return executeQueryList2(phenotypeList, queries, options, mongoVariationPhenotypeDBCollection2);
// }
<<<<<<<
Document variantObject = (Document) idObject;
idList.add(variantObject.get("id").toString());
=======
DBObject variantObject = (DBObject) idObject;
// Arbitrarily selects the first one. Assuming variants in variation collection will just have one id
idList.add(((BasicDBList) variantObject.get("ids")).get(0).toString());
>>>>>>>
Document variantObject = (Document) idObject;
// Arbitrarily selects the first one. Assuming variants in variation collection will just have one id
idList.add(((BasicDBList) variantObject.get("ids")).get(0).toString()); |
<<<<<<<
public abstract TranscriptDBAdaptor getTranscriptDBAdaptor(String species);
public abstract TranscriptDBAdaptor getTranscriptDBAdaptor(String species, String assembly);
=======
public abstract VariantDBAdaptor getVariationDBAdaptor(String species);
public abstract VariantDBAdaptor getVariationDBAdaptor(String species, String assembly);
// public abstract TranscriptDBAdaptor getTranscriptDBAdaptor(String species);
//
// public abstract TranscriptDBAdaptor getTranscriptDBAdaptor(String species, String assembly);
>>>>>>>
public abstract TranscriptDBAdaptor getTranscriptDBAdaptor(String species);
public abstract TranscriptDBAdaptor getTranscriptDBAdaptor(String species, String assembly);
public abstract VariantDBAdaptor getVariationDBAdaptor(String species);
public abstract VariantDBAdaptor getVariationDBAdaptor(String species, String assembly); |
<<<<<<<
@Parameter(names = {"--num-threads"}, description = "", required = false, arity = 1)
public int threads = 2;
=======
}
@Parameters(commandNames = {"query"}, commandDescription = "Description")
public class QueryCommandOptions {
@ParametersDelegate
public CommonCommandOptions commonOptions = commonCommandOptions;
@Parameter(names = {"--species"}, description = "", required = true)
public String species;
@Parameter(names = {"--assembly"}, description = "", required = false)
public String assembly;
@Parameter(names = {"--type"}, description = "", required = false, arity = 1)
public String category;
@Parameter(names = {"--id"}, description = "", required = false, variableArity = true)
public List<String> ids;
@Parameter(names = {"--resource"}, description = "", required = false, arity = 1)
public String resource;
@Parameter(names = {"--variant-annot"}, description = "", required = false)
public boolean annotate;
@Parameter(names = {"-i", "--input-file"}, description = "", required = false, arity = 1)
public String inputFile;
@Parameter(names = {"-o", "--output-file"}, description = "", required = false, arity = 1)
public String outputFile;
@Parameter(names = {"--host-url"}, description = "", required = false, arity = 1)
public String url;
>>>>>>>
@Parameter(names = {"--num-threads"}, description = "", required = false, arity = 1)
public int threads = 2;
}
@Parameters(commandNames = {"query"}, commandDescription = "Description")
public class QueryCommandOptions {
@ParametersDelegate
public CommonCommandOptions commonOptions = commonCommandOptions;
@Parameter(names = {"--species"}, description = "", required = true)
public String species;
@Parameter(names = {"--assembly"}, description = "", required = false)
public String assembly;
@Parameter(names = {"--type"}, description = "", required = false, arity = 1)
public String category;
@Parameter(names = {"--id"}, description = "", required = false, variableArity = true)
public List<String> ids;
@Parameter(names = {"--resource"}, description = "", required = false, arity = 1)
public String resource;
@Parameter(names = {"--variant-annot"}, description = "", required = false)
public boolean annotate;
@Parameter(names = {"-i", "--input-file"}, description = "", required = false, arity = 1)
public String inputFile;
@Parameter(names = {"-o", "--output-file"}, description = "", required = false, arity = 1)
public String outputFile;
@Parameter(names = {"--host-url"}, description = "", required = false, arity = 1)
public String url; |
<<<<<<<
@SuppressWarnings("deprecation")
private static final Property INSTANCE_DFS_URI = Property.INSTANCE_DFS_URI;
static TemporaryFolder tempFolder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
=======
static TemporaryFolder tempFolder = new TemporaryFolder(
new File(System.getProperty("user.dir") + "/target"));
>>>>>>>
@SuppressWarnings("deprecation")
private static final Property INSTANCE_DFS_URI = Property.INSTANCE_DFS_URI;
static TemporaryFolder tempFolder = new TemporaryFolder(
new File(System.getProperty("user.dir") + "/target"));
<<<<<<<
siteConfig.put(INSTANCE_DFS_URI.getKey(), "hdfs://");
MiniAccumuloConfigImpl config = new MiniAccumuloConfigImpl(tempFolder.getRoot(), "password").setSiteConfig(siteConfig).initialize();
assertEquals("hdfs://", config.getSiteConfig().get(INSTANCE_DFS_URI.getKey()));
=======
siteConfig.put(Property.INSTANCE_DFS_URI.getKey(), "hdfs://");
MiniAccumuloConfigImpl config = new MiniAccumuloConfigImpl(tempFolder.getRoot(), "password")
.setSiteConfig(siteConfig).initialize();
assertEquals("hdfs://", config.getSiteConfig().get(Property.INSTANCE_DFS_URI.getKey()));
>>>>>>>
siteConfig.put(INSTANCE_DFS_URI.getKey(), "hdfs://");
MiniAccumuloConfigImpl config = new MiniAccumuloConfigImpl(tempFolder.getRoot(), "password")
.setSiteConfig(siteConfig).initialize();
assertEquals("hdfs://", config.getSiteConfig().get(INSTANCE_DFS_URI.getKey())); |
<<<<<<<
VariantAnnotation variantAnnotation = getVariantAnnotation(key);
// List<EvidenceEntry> evidenceEntryList = getEvidenceEntryList(key);
addNewEntries(variantAnnotation, variationId, lineFields, traitsToEfoTermsMap);
rdb.put(key, jsonObjectWriter.writeValueAsBytes(variantAnnotation));
=======
List<EvidenceEntry> evidenceEntryList = getEvidenceEntryList(key);
addNewEntries(evidenceEntryList, variationId, lineFields, mateVariantString, traitsToEfoTermsMap);
rdb.put(key, jsonObjectWriter.writeValueAsBytes(evidenceEntryList));
>>>>>>>
VariantAnnotation variantAnnotation = getVariantAnnotation(key);
// List<EvidenceEntry> evidenceEntryList = getEvidenceEntryList(key);
addNewEntries(variantAnnotation, variationId, lineFields, mateVariantString, traitsToEfoTermsMap);
rdb.put(key, jsonObjectWriter.writeValueAsBytes(variantAnnotation));
<<<<<<<
private void addNewEntries(VariantAnnotation variantAnnotation, PublicSetType publicSet,
Map<String, EFO> traitsToEfoTermsMap) throws JsonProcessingException {
=======
private VariantClassification getVariantClassification(String lineField) {
VariantClassification variantClassification = new VariantClassification();
for (String value : lineField.split("[,/;]")) {
value = value.toLowerCase().trim();
if (VariantAnnotationUtils.CLINVAR_CLINSIG_TO_ACMG.containsKey(value)) {
// No value set
if (variantClassification.getClinicalSignificance() == null) {
variantClassification.setClinicalSignificance(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_ACMG.get(value));
// Seen cases like Benign;Pathogenic;association;not provided;risk factor for the same record
} else if (isBenign(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_ACMG.get(value))
&& isPathogenic(variantClassification.getClinicalSignificance())) {
logger.warn("Benign and Pathogenic clinical significances found for the same record");
logger.warn("Will set uncertain_significance instead");
variantClassification.setClinicalSignificance(ClinicalSignificance.uncertain_significance);
}
} else if (VariantAnnotationUtils.CLINVAR_CLINSIG_TO_TRAIT_ASSOCIATION.containsKey(value)) {
variantClassification.setTraitAssociation(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_TRAIT_ASSOCIATION.get(value));
} else if (VariantAnnotationUtils.CLINVAR_CLINSIG_TO_DRUG_RESPONSE.containsKey(value)) {
variantClassification.setDrugResponseClassification(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_DRUG_RESPONSE.get(value));
} else {
logger.debug("No mapping found for referenceClinVarAssertion.clinicalSignificance {}", value);
logger.debug("No value will be set at EvidenceEntry.variantClassification for this term");
}
}
return variantClassification;
}
private boolean isPathogenic(ClinicalSignificance clinicalSignificance) {
return ClinicalSignificance.pathogenic.equals(clinicalSignificance)
|| ClinicalSignificance.likely_pathogenic.equals(clinicalSignificance);
}
private boolean isBenign(ClinicalSignificance clinicalSignificance) {
return ClinicalSignificance.benign.equals(clinicalSignificance)
|| ClinicalSignificance.likely_benign.equals(clinicalSignificance);
}
private void addNewEntries(List<EvidenceEntry> evidenceEntryList, PublicSetType publicSet, String alleleId,
String mateVariantString, Map<String, EFO> traitsToEfoTermsMap) throws JsonProcessingException {
>>>>>>>
private VariantClassification getVariantClassification(String lineField) {
VariantClassification variantClassification = new VariantClassification();
for (String value : lineField.split("[,/;]")) {
value = value.toLowerCase().trim();
if (VariantAnnotationUtils.CLINVAR_CLINSIG_TO_ACMG.containsKey(value)) {
// No value set
if (variantClassification.getClinicalSignificance() == null) {
variantClassification.setClinicalSignificance(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_ACMG.get(value));
// Seen cases like Benign;Pathogenic;association;not provided;risk factor for the same record
} else if (isBenign(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_ACMG.get(value))
&& isPathogenic(variantClassification.getClinicalSignificance())) {
logger.warn("Benign and Pathogenic clinical significances found for the same record");
logger.warn("Will set uncertain_significance instead");
variantClassification.setClinicalSignificance(ClinicalSignificance.uncertain_significance);
}
} else if (VariantAnnotationUtils.CLINVAR_CLINSIG_TO_TRAIT_ASSOCIATION.containsKey(value)) {
variantClassification.setTraitAssociation(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_TRAIT_ASSOCIATION.get(value));
} else if (VariantAnnotationUtils.CLINVAR_CLINSIG_TO_DRUG_RESPONSE.containsKey(value)) {
variantClassification.setDrugResponseClassification(VariantAnnotationUtils.CLINVAR_CLINSIG_TO_DRUG_RESPONSE.get(value));
} else {
logger.debug("No mapping found for referenceClinVarAssertion.clinicalSignificance {}", value);
logger.debug("No value will be set at EvidenceEntry.variantClassification for this term");
}
}
return variantClassification;
}
private boolean isPathogenic(ClinicalSignificance clinicalSignificance) {
return ClinicalSignificance.pathogenic.equals(clinicalSignificance)
|| ClinicalSignificance.likely_pathogenic.equals(clinicalSignificance);
}
private boolean isBenign(ClinicalSignificance clinicalSignificance) {
return ClinicalSignificance.benign.equals(clinicalSignificance)
|| ClinicalSignificance.likely_benign.equals(clinicalSignificance);
}
private void addNewEntries(VariantAnnotation variantAnnotation, PublicSetType publicSet, String alleleId,
String mateVariantString, Map<String, EFO> traitsToEfoTermsMap) throws JsonProcessingException { |
<<<<<<<
QueryResponse<VariantAnnotation> annotationsGet = cellBaseClient.getVariantClient().getAnnotationByVariantIds("19:45411941:T:C, 14:38679764:-:GATCTG", null);
=======
QueryResponse<VariantAnnotation> annotationsGet = cellBaseClient37.getVariantClient().getAnnotations("19:45411941:T:C, 14:38679764:-:GATCTG", null);
>>>>>>>
QueryResponse<VariantAnnotation> annotationsGet = cellBaseClient37.getVariantClient().getAnnotationByVariantIds("19:45411941:T:C, 14:38679764:-:GATCTG", null);
<<<<<<<
annotationsGet = cellBaseClient.getVariantClient()
.getAnnotationByVariantIds(idString, new QueryOptions("numThreads", 4));
=======
annotationsGet = cellBaseClient37.getVariantClient()
.getAnnotations(idString, new QueryOptions("numThreads", 4));
>>>>>>>
annotationsGet = cellBaseClient37.getVariantClient()
.getAnnotationByVariantIds(idString, new QueryOptions("numThreads", 4));
<<<<<<<
QueryResponse<VariantAnnotation> annotationsPost = cellBaseClient.getVariantClient()
.getAnnotationByVariantIds(idString, new QueryOptions("numThreads", 4), true);
=======
QueryResponse<VariantAnnotation> annotationsPost = cellBaseClient37.getVariantClient()
.getAnnotations(idString, new QueryOptions("numThreads", 4), true);
>>>>>>>
QueryResponse<VariantAnnotation> annotationsPost = cellBaseClient37.getVariantClient()
.getAnnotationByVariantIds(idString, new QueryOptions("numThreads", 4), true); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.