Merge "Fix typos."
This commit is contained in:
commit
97351ad34c
4 changed files with 16 additions and 16 deletions
|
@ -144,7 +144,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
return mBinaryDictionary.isValidDictionary();
|
return mBinaryDictionary.isValidDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getFileNameExtentionToOpenDict() {
|
protected String getFileNameExtensionToOpenDict() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
// We have 'fileToOpen' in addition to 'file' for the v4 dictionary format
|
// We have 'fileToOpen' in addition to 'file' for the v4 dictionary format
|
||||||
// where 'file' is a directory, and 'fileToOpen' is a normal file.
|
// where 'file' is a directory, and 'fileToOpen' is a normal file.
|
||||||
final File fileToOpen = new File(mContext.getFilesDir(), mFilename
|
final File fileToOpen = new File(mContext.getFilesDir(), mFilename
|
||||||
+ getFileNameExtentionToOpenDict());
|
+ getFileNameExtensionToOpenDict());
|
||||||
// TODO: Make BinaryDictionary's constructor be able to accept filename
|
// TODO: Make BinaryDictionary's constructor be able to accept filename
|
||||||
// without extension.
|
// without extension.
|
||||||
mBinaryDictionary = new BinaryDictionary(
|
mBinaryDictionary = new BinaryDictionary(
|
||||||
|
@ -521,7 +521,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
}
|
}
|
||||||
|
|
||||||
final File file = new File(mContext.getFilesDir(), mFilename
|
final File file = new File(mContext.getFilesDir(), mFilename
|
||||||
+ getFileNameExtentionToOpenDict());
|
+ getFileNameExtensionToOpenDict());
|
||||||
final String filename = file.getAbsolutePath();
|
final String filename = file.getAbsolutePath();
|
||||||
final long length = file.length();
|
final long length = file.length();
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
/**
|
/**
|
||||||
* Generate binary dictionary using DictionaryWriter.
|
* Generate binary dictionary using DictionaryWriter.
|
||||||
*/
|
*/
|
||||||
protected void asyncFlashAllBinaryDictionary() {
|
protected void asyncFlushBinaryDictionary() {
|
||||||
final Runnable newTask = new Runnable() {
|
final Runnable newTask = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -84,7 +84,7 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
|
||||||
}
|
}
|
||||||
// Flush pending writes.
|
// Flush pending writes.
|
||||||
// TODO: Remove after this class become to use a dynamic binary dictionary.
|
// TODO: Remove after this class become to use a dynamic binary dictionary.
|
||||||
asyncFlashAllBinaryDictionary();
|
asyncFlushBinaryDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -121,7 +121,7 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getFileNameExtentionToOpenDict() {
|
protected String getFileNameExtensionToOpenDict() {
|
||||||
// TODO: pass the directory name instead
|
// TODO: pass the directory name instead
|
||||||
return "/" + FormatSpec.HEADER_FILE_EXTENSION;
|
return "/" + FormatSpec.HEADER_FILE_EXTENSION;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ public abstract class DecayingExpandableBinaryDictionaryBase extends ExpandableB
|
||||||
// Clear the node structure on memory
|
// Clear the node structure on memory
|
||||||
clear();
|
clear();
|
||||||
// Then flush the cleared state of the dictionary on disk.
|
// Then flush the cleared state of the dictionary on disk.
|
||||||
asyncFlashAllBinaryDictionary();
|
asyncFlushBinaryDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ void decayIfNeeded() {
|
/* package */ void decayIfNeeded() {
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a holder of a result of asynchronous computation.
|
* This class is a holder of the result of an asynchronous computation.
|
||||||
*
|
*
|
||||||
* @param <E> the type of the result.
|
* @param <E> the type of the result.
|
||||||
*/
|
*/
|
||||||
|
@ -36,9 +36,9 @@ public class AsyncResultHolder<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the result value to this holder.
|
* Sets the result value of this holder.
|
||||||
*
|
*
|
||||||
* @param result the value which is set.
|
* @param result the value to set.
|
||||||
*/
|
*/
|
||||||
public void set(final E result) {
|
public void set(final E result) {
|
||||||
synchronized(mLock) {
|
synchronized(mLock) {
|
||||||
|
@ -54,12 +54,12 @@ public class AsyncResultHolder<E> {
|
||||||
* Causes the current thread to wait unless the value is set or the specified time is elapsed.
|
* Causes the current thread to wait unless the value is set or the specified time is elapsed.
|
||||||
*
|
*
|
||||||
* @param defaultValue the default value.
|
* @param defaultValue the default value.
|
||||||
* @param timeOut the time to wait.
|
* @param timeOut the maximum time to wait.
|
||||||
* @return if the result is set until the time limit then the result, otherwise defaultValue.
|
* @return if the result is set before the time limit then the result, otherwise defaultValue.
|
||||||
*/
|
*/
|
||||||
public E get(final E defaultValue, final long timeOut) {
|
public E get(final E defaultValue, final long timeOut) {
|
||||||
try {
|
try {
|
||||||
if(mLatch.await(timeOut, TimeUnit.MILLISECONDS)) {
|
if (mLatch.await(timeOut, TimeUnit.MILLISECONDS)) {
|
||||||
return mResult;
|
return mResult;
|
||||||
} else {
|
} else {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|
|
@ -141,11 +141,11 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
|
||||||
binaryDictionary.getPropertyForTests(query);
|
binaryDictionary.getPropertyForTests(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testControllCurrentTime() {
|
public void testControlCurrentTime() {
|
||||||
testControllCurrentTime(FormatSpec.VERSION4);
|
testControlCurrentTime(FormatSpec.VERSION4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testControllCurrentTime(final int formatVersion) {
|
private void testControlCurrentTime(final int formatVersion) {
|
||||||
final int TEST_COUNT = 1000;
|
final int TEST_COUNT = 1000;
|
||||||
final long seed = System.currentTimeMillis();
|
final long seed = System.currentTimeMillis();
|
||||||
final Random random = new Random(seed);
|
final Random random = new Random(seed);
|
||||||
|
|
Loading…
Reference in a new issue